Skip to content

Instantly share code, notes, and snippets.

@BrunoGiubilei
Created April 4, 2022 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrunoGiubilei/9743b5d36f93ab22278fd3debfb14ca8 to your computer and use it in GitHub Desktop.
Save BrunoGiubilei/9743b5d36f93ab22278fd3debfb14ca8 to your computer and use it in GitHub Desktop.
JS to embed Webamp JS using the "User Javascript and CSS" chrome extension
This file has been truncated, but you can view the full file.
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["Webamp"] = factory();
else
root["Webamp"] = factory();
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 117);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__(55);
} else {}
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__(56);
} else {}
/***/ }),
/* 2 */
/***/ (function(module, exports) {
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
module.exports = _defineProperty;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.defaultMemoize = defaultMemoize;
exports.createSelectorCreator = createSelectorCreator;
exports.createStructuredSelector = createStructuredSelector;
function defaultEqualityCheck(a, b) {
return a === b;
}
function areArgumentsShallowlyEqual(equalityCheck, prev, next) {
if (prev === null || next === null || prev.length !== next.length) {
return false;
}
// Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.
var length = prev.length;
for (var i = 0; i < length; i++) {
if (!equalityCheck(prev[i], next[i])) {
return false;
}
}
return true;
}
function defaultMemoize(func) {
var equalityCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultEqualityCheck;
var lastArgs = null;
var lastResult = null;
// we reference arguments instead of spreading them for performance reasons
return function () {
if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {
// apply arguments instead of spreading for performance.
lastResult = func.apply(null, arguments);
}
lastArgs = arguments;
return lastResult;
};
}
function getDependencies(funcs) {
var dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs;
if (!dependencies.every(function (dep) {
return typeof dep === 'function';
})) {
var dependencyTypes = dependencies.map(function (dep) {
return typeof dep;
}).join(', ');
throw new Error('Selector creators expect all input-selectors to be functions, ' + ('instead received the following types: [' + dependencyTypes + ']'));
}
return dependencies;
}
function createSelectorCreator(memoize) {
for (var _len = arguments.length, memoizeOptions = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
memoizeOptions[_key - 1] = arguments[_key];
}
return function () {
for (var _len2 = arguments.length, funcs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
funcs[_key2] = arguments[_key2];
}
var recomputations = 0;
var resultFunc = funcs.pop();
var dependencies = getDependencies(funcs);
var memoizedResultFunc = memoize.apply(undefined, [function () {
recomputations++;
// apply arguments instead of spreading for performance.
return resultFunc.apply(null, arguments);
}].concat(memoizeOptions));
// If a selector is called with the exact same arguments we don't need to traverse our dependencies again.
var selector = defaultMemoize(function () {
var params = [];
var length = dependencies.length;
for (var i = 0; i < length; i++) {
// apply arguments instead of spreading and mutate a local list of params for performance.
params.push(dependencies[i].apply(null, arguments));
}
// apply arguments instead of spreading for performance.
return memoizedResultFunc.apply(null, params);
});
selector.resultFunc = resultFunc;
selector.recomputations = function () {
return recomputations;
};
selector.resetRecomputations = function () {
return recomputations = 0;
};
return selector;
};
}
var createSelector = exports.createSelector = createSelectorCreator(defaultMemoize);
function createStructuredSelector(selectors) {
var selectorCreator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createSelector;
if (typeof selectors !== 'object') {
throw new Error('createStructuredSelector expects first argument to be an object ' + ('where each property is a selector, instead received a ' + typeof selectors));
}
var objectKeys = Object.keys(selectors);
return selectorCreator(objectKeys.map(function (key) {
return selectors[key];
}), function () {
for (var _len3 = arguments.length, values = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
values[_key3] = arguments[_key3];
}
return values.reduce(function (composition, value, index) {
composition[objectKeys[index]] = value;
return composition;
}, {});
});
}
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg) && arg.length) {
var inner = classNames.apply(null, arg);
if (inner) {
classes.push(inner);
}
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if ( true && module.exports) {
classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}());
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function checkDCE() {
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function'
) {
return;
}
if (false) {}
try {
// Verify that the code above has been dead code eliminated (DCE'd).
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
} catch (err) {
// DevTools shouldn't crash React, no matter what.
// We should still report in case we break this code.
console.error(err);
}
}
if (true) {
// DCE check should happen before ReactDOM bundle executes so that
// DevTools can report bad minification during injection.
checkDCE();
module.exports = __webpack_require__(57);
} else {}
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = __webpack_require__(18);
const ieee754 = __webpack_require__(102);
// Possibly call flush()
const maybeFlush = (b, o, len, flush) => {
if (o + len > b.length) {
if (typeof (flush) !== 'function') {
throw new Error('Buffer out of space and no valid flush() function found');
}
flush(b, o);
return 0;
}
return o;
};
// Primitive types
/**
* 8-bit unsigned integer
*/
exports.UINT8 = {
len: 1,
get(buf, off) {
return buf.readUInt8(off);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= 0 && v <= 0xff);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeUInt8(v, no);
return (no - o) + this.len;
}
};
/**
* 16-bit unsigned integer, Little Endian byte order
*/
exports.UINT16_LE = {
len: 2,
get(buf, off) {
return buf.readUInt16LE(off);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= 0 && v <= 0xffff);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeUInt16LE(v, no);
return (no - o) + this.len;
}
};
/**
* 16-bit unsigned integer, Big Endian byte order
*/
exports.UINT16_BE = {
len: 2,
get(buf, off) {
return buf.readUInt16BE(off);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= 0 && v <= 0xffff);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeUInt16BE(v, no);
return (no - o) + this.len;
}
};
/**
* 24-bit unsigned integer, Little Endian byte order
*/
exports.UINT24_LE = {
len: 3,
get(buf, off) {
return buf.readUIntLE(off, 3);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= 0 && v <= 0xffffff);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeUIntLE(v, no, 3);
return (no - o) + this.len;
}
};
/**
* 24-bit unsigned integer, Big Endian byte order
*/
exports.UINT24_BE = {
len: 3,
get(buf, off) {
return buf.readUIntBE(off, 3);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= 0 && v <= 0xffffff);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeUIntBE(v, no, 3);
return (no - o) + this.len;
}
};
/**
* 32-bit unsigned integer, Little Endian byte order
*/
exports.UINT32_LE = {
len: 4,
get(buf, off) {
return buf.readUInt32LE(off);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= 0 && v <= 0xffffffff);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeUInt32LE(v, no);
return (no - o) + this.len;
}
};
/**
* 32-bit unsigned integer, Big Endian byte order
*/
exports.UINT32_BE = {
len: 4,
get(buf, off) {
return buf.readUInt32BE(off);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= 0 && v <= 0xffffffff);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeUInt32BE(v, no);
return (no - o) + this.len;
}
};
/**
* 8-bit signed integer
*/
exports.INT8 = {
len: 1,
get(buf, off) {
return buf.readInt8(off);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= -128 && v <= 127);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeInt8(v, no);
return (no - o) + this.len;
}
};
/**
* 16-bit signed integer, Big Endian byte order
*/
exports.INT16_BE = {
len: 2,
get(buf, off) {
return buf.readInt16BE(off);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= -32768 && v <= 32767);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeInt16BE(v, no);
return (no - o) + this.len;
}
};
/**
* 16-bit signed integer, Little Endian byte order
*/
exports.INT16_LE = {
len: 2,
get(buf, off) {
return buf.readInt16LE(off);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= -32768 && v <= 32767);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeInt16LE(v, no);
return (no - o) + this.len;
}
};
/**
* 24-bit signed integer, Little Endian byte order
*/
exports.INT24_LE = {
len: 3,
get(buf, off) {
return buf.readIntLE(off, 3);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= -0x800000 && v <= 0x7fffff);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeIntLE(v, no, 3);
return (no - o) + this.len;
}
};
/**
* 24-bit signed integer, Big Endian byte order
*/
exports.INT24_BE = {
len: 3,
get(buf, off) {
return buf.readIntBE(off, 3);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= -0x800000 && v <= 0x7fffff);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeIntBE(v, no, 3);
return (no - o) + this.len;
}
};
/**
* 32-bit signed integer, Big Endian byte order
*/
exports.INT32_BE = {
len: 4,
get(buf, off) {
return buf.readInt32BE(off);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= -2147483648 && v <= 2147483647);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeInt32BE(v, no);
return (no - o) + this.len;
}
};
/**
* 32-bit signed integer, Big Endian byte order
*/
exports.INT32_LE = {
len: 4,
get(buf, off) {
return buf.readInt32LE(off);
},
put(b, o, v, flush) {
assert.equal(typeof o, 'number');
assert.equal(typeof v, 'number');
assert.ok(v >= -2147483648 && v <= 2147483647);
assert.ok(o >= 0);
assert.ok(this.len <= b.length);
const no = maybeFlush(b, o, this.len, flush);
b.writeInt32LE(v, no);
return (no - o) + this.len;
}
};
/**
* 64-bit unsigned integer, Little Endian byte order
*/
exports.UINT64_LE = {
len: 8,
get(buf, off) {
return readUIntLE(buf, off, this.len);
},
put(b, o, v) {
return writeUIntLE(b, v, o, this.len);
}
};
/**
* 64-bit signed integer, Little Endian byte order
*/
exports.INT64_LE = {
len: 8,
get(buf, off) {
return readIntLE(buf, off, this.len);
},
put(b, off, v) {
return writeIntLE(b, v, off, this.len);
}
};
/**
* 64-bit unsigned integer, Big Endian byte order
*/
exports.UINT64_BE = {
len: 8,
get(b, off) {
return readUIntBE(b, off, this.len);
},
put(b, o, v) {
return writeUIntBE(b, v, o, this.len);
}
};
/**
* 64-bit signed integer, Big Endian byte order
*/
exports.INT64_BE = {
len: 8,
get(b, off) {
return readIntBE(b, off, this.len);
},
put(b, off, v) {
return writeIntBE(b, v, off, this.len);
}
};
/**
* IEEE 754 16-bit (half precision) float, big endian
*/
exports.Float16_BE = {
len: 2,
get(b, off) {
return ieee754.read(b, off, false, 10, this.len);
},
put(b, off, v) {
return ieee754.write(b, v, off, false, 10, this.len);
}
};
/**
* IEEE 754 16-bit (half precision) float, little endian
*/
exports.Float16_LE = {
len: 2,
get(b, off) {
return ieee754.read(b, off, true, 10, this.len);
},
put(b, off, v) {
return ieee754.write(b, v, off, true, 10, this.len);
}
};
/**
* IEEE 754 32-bit (single precision) float, big endian
*/
exports.Float32_BE = {
len: 4,
get(b, off) {
return b.readFloatBE(off);
},
put(b, off, v) {
return b.writeFloatBE(v, off);
}
};
/**
* IEEE 754 32-bit (single precision) float, little endian
*/
exports.Float32_LE = {
len: 4,
get(b, off) {
return b.readFloatLE(off);
},
put(b, off, v) {
return b.writeFloatLE(v, off);
}
};
/**
* IEEE 754 64-bit (double precision) float, big endian
*/
exports.Float64_BE = {
len: 8,
get(b, off) {
return b.readDoubleBE(off);
},
put(b, off, v) {
return b.writeDoubleBE(v, off);
}
};
/**
* IEEE 754 64-bit (double precision) float, little endian
*/
exports.Float64_LE = {
len: 8,
get(b, off) {
return b.readDoubleLE(off);
},
put(b, off, v) {
return b.writeDoubleLE(v, off);
}
};
/**
* IEEE 754 80-bit (extended precision) float, big endian
*/
exports.Float80_BE = {
len: 10,
get(b, off) {
return ieee754.read(b, off, false, 63, this.len);
},
put(b, off, v) {
return ieee754.write(b, v, off, false, 63, this.len);
}
};
/**
* IEEE 754 80-bit (extended precision) float, little endian
*/
exports.Float80_LE = {
len: 10,
get(b, off) {
return ieee754.read(b, off, true, 63, this.len);
},
put(b, off, v) {
return ieee754.write(b, v, off, true, 63, this.len);
}
};
/**
* Ignore a given number of bytes
*/
class IgnoreType {
/**
* @param len number of bytes to ignore
*/
constructor(len) {
this.len = len;
}
// ToDo: don't read, but skip data
get(buf, off) {
}
}
exports.IgnoreType = IgnoreType;
class BufferType {
constructor(len) {
this.len = len;
}
get(buf, off) {
return buf.slice(off, off + this.len);
}
}
exports.BufferType = BufferType;
/**
* Consume a fixed number of bytes from the stream and return a string with a specified encoding.
*/
class StringType {
constructor(len, encoding) {
this.len = len;
this.encoding = encoding;
}
get(buf, off) {
return buf.toString(this.encoding, off, off + this.len);
}
}
exports.StringType = StringType;
/**
* ANSI Latin 1 String
* Using windows-1252 / ISO 8859-1 decoding
*/
class AnsiStringType {
constructor(len) {
this.len = len;
}
static decode(buffer, off, until) {
let str = '';
for (let i = off; i < until; ++i) {
str += AnsiStringType.codePointToString(AnsiStringType.singleByteDecoder(buffer[i]));
}
return str;
}
static inRange(a, min, max) {
return min <= a && a <= max;
}
static codePointToString(cp) {
if (cp <= 0xFFFF) {
return String.fromCharCode(cp);
}
else {
cp -= 0x10000;
return String.fromCharCode((cp >> 10) + 0xD800, (cp & 0x3FF) + 0xDC00);
}
}
static singleByteDecoder(bite) {
if (AnsiStringType.inRange(bite, 0x00, 0x7F)) {
return bite;
}
const codePoint = AnsiStringType.windows1252[bite - 0x80];
if (codePoint === null) {
throw Error('invaliding encoding');
}
return codePoint;
}
get(buf, off = 0) {
return AnsiStringType.decode(buf, off, off + this.len);
}
}
exports.AnsiStringType = AnsiStringType;
AnsiStringType.windows1252 = [8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 352,
8249, 338, 141, 381, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732,
8482, 353, 8250, 339, 157, 382, 376, 160, 161, 162, 163, 164, 165, 166, 167, 168,
169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
248, 249, 250, 251, 252, 253, 254, 255];
/**
* Best effort approach to read up to 64 bit unsigned integer, little endian.
* Note that JavasScript is limited to 2^53 - 1 bit.
*/
function readUIntLE(buf, offset, byteLength) {
offset = offset >>> 0;
byteLength = byteLength >>> 0;
let val = buf[offset];
let mul = 1;
let i = 0;
while (++i < byteLength && (mul *= 0x100)) {
val += buf[offset + i] * mul;
}
return val;
}
/**
* Best effort approach to write up to 64 bit unsigned integer, little endian.
* Note that JavasScript is limited to 2^53 - 1 bit.
*/
function writeUIntLE(buf, value, offset, byteLength) {
value = +value;
offset = offset >>> 0;
byteLength = byteLength >>> 0;
let mul = 1;
let i = 0;
buf[offset] = value & 0xFF;
while (++i < byteLength && (mul *= 0x100)) {
buf[offset + i] = (value / mul) & 0xFF;
}
return offset + byteLength;
}
/**
* Best effort approach to read 64 but signed integer, little endian.
* Note that JavasScript is limited to 2^53 - 1 bit.
*/
function readIntLE(buf, offset, byteLength) {
offset = offset >>> 0;
byteLength = byteLength >>> 0;
let val = buf[offset];
let mul = 1;
let i = 0;
while (++i < byteLength && (mul *= 0x100)) {
val += buf[offset + i] * mul;
}
mul *= 0x80;
if (val >= mul)
val -= Math.pow(2, 8 * byteLength);
return val;
}
/**
* Best effort approach to write 64 but signed integer, little endian.
* Note that JavasScript is limited to 2^53 - 1 bit.
*/
function writeIntLE(buf, value, offset, byteLength) {
value = +value;
offset = offset >>> 0;
let i = 0;
let mul = 1;
let sub = 0;
buf[offset] = value & 0xFF;
while (++i < byteLength && (mul *= 0x100)) {
if (value < 0 && sub === 0 && buf[offset + i - 1] !== 0) {
sub = 1;
}
buf[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
}
return offset + byteLength;
}
exports.writeIntLE = writeIntLE;
/**
* Best effort approach to read up to 64 bit unsigned integer, big endian.
* Note that JavasScript is limited to 2^53 - 1 bit.
*/
function readUIntBE(buf, offset, byteLength) {
offset = offset >>> 0;
byteLength = byteLength >>> 0;
let val = buf[offset + --byteLength];
let mul = 1;
while (byteLength > 0 && (mul *= 0x100)) {
val += buf[offset + --byteLength] * mul;
}
return val;
}
exports.readUIntBE = readUIntBE;
/**
* Best effort approach to write up to 64 bit unsigned integer, big endian.
* Note that JavasScript is limited to 2^53 - 1 bit.
*/
function writeUIntBE(buf, value, offset, byteLength) {
value = +value;
offset = offset >>> 0;
byteLength = byteLength >>> 0;
let i = byteLength - 1;
let mul = 1;
buf[offset + i] = value & 0xFF;
while (--i >= 0 && (mul *= 0x100)) {
buf[offset + i] = (value / mul) & 0xFF;
}
return offset + byteLength;
}
exports.writeUIntBE = writeUIntBE;
/**
* Best effort approach to read 64 but signed integer, big endian.
* Note that JavasScript is limited to 2^53 - 1 bit.
*/
function readIntBE(buf, offset, byteLength) {
offset = offset >>> 0;
byteLength = byteLength >>> 0;
let i = byteLength;
let mul = 1;
let val = buf[offset + --i];
while (i > 0 && (mul *= 0x100)) {
val += buf[offset + --i] * mul;
}
mul *= 0x80;
if (val >= mul)
val -= Math.pow(2, 8 * byteLength);
return val;
}
exports.readIntBE = readIntBE;
/**
* Best effort approach to write 64 but signed integer, big endian.
* Note that JavasScript is limited to 2^53 - 1 bit.
*/
function writeIntBE(buf, value, offset, byteLength) {
value = +value;
offset = offset >>> 0;
let i = byteLength - 1;
let mul = 1;
let sub = 0;
buf[offset + i] = value & 0xFF;
while (--i >= 0 && (mul *= 0x100)) {
if (value < 0 && sub === 0 && buf[offset + i + 1] !== 0) {
sub = 1;
}
buf[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
}
return offset + byteLength;
}
exports.writeIntBE = writeIntBE;
//# sourceMappingURL=index.js.map
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
var objectWithoutPropertiesLoose = __webpack_require__(65);
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
module.exports = _objectWithoutProperties;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/* eslint-env browser */
/**
* This is the web browser implementation of `debug()`.
*/
exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.storage = localstorage();
/**
* Colors.
*/
exports.colors = [
'#0000CC',
'#0000FF',
'#0033CC',
'#0033FF',
'#0066CC',
'#0066FF',
'#0099CC',
'#0099FF',
'#00CC00',
'#00CC33',
'#00CC66',
'#00CC99',
'#00CCCC',
'#00CCFF',
'#3300CC',
'#3300FF',
'#3333CC',
'#3333FF',
'#3366CC',
'#3366FF',
'#3399CC',
'#3399FF',
'#33CC00',
'#33CC33',
'#33CC66',
'#33CC99',
'#33CCCC',
'#33CCFF',
'#6600CC',
'#6600FF',
'#6633CC',
'#6633FF',
'#66CC00',
'#66CC33',
'#9900CC',
'#9900FF',
'#9933CC',
'#9933FF',
'#99CC00',
'#99CC33',
'#CC0000',
'#CC0033',
'#CC0066',
'#CC0099',
'#CC00CC',
'#CC00FF',
'#CC3300',
'#CC3333',
'#CC3366',
'#CC3399',
'#CC33CC',
'#CC33FF',
'#CC6600',
'#CC6633',
'#CC9900',
'#CC9933',
'#CCCC00',
'#CCCC33',
'#FF0000',
'#FF0033',
'#FF0066',
'#FF0099',
'#FF00CC',
'#FF00FF',
'#FF3300',
'#FF3333',
'#FF3366',
'#FF3399',
'#FF33CC',
'#FF33FF',
'#FF6600',
'#FF6633',
'#FF9900',
'#FF9933',
'#FFCC00',
'#FFCC33'
];
/**
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
* and the Firebug extension (any Firefox version) are known
* to support "%c" CSS customizations.
*
* TODO: add a `localStorage` variable to explicitly enable/disable colors
*/
// eslint-disable-next-line complexity
function useColors() {
// NB: In an Electron preload script, document will be defined but not fully
// initialized. Since we know we're in Chrome, we'll just detect this case
// explicitly
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
return true;
}
// Internet Explorer and Edge do not support colors.
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
return false;
}
// Is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
// Is firebug? http://stackoverflow.com/a/398120/376773
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
// Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
// Double check webkit in userAgent just in case we are in a worker
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
}
/**
* Colorize log arguments if enabled.
*
* @api public
*/
function formatArgs(args) {
args[0] = (this.useColors ? '%c' : '') +
this.namespace +
(this.useColors ? ' %c' : ' ') +
args[0] +
(this.useColors ? '%c ' : ' ') +
'+' + module.exports.humanize(this.diff);
if (!this.useColors) {
return;
}
const c = 'color: ' + this.color;
args.splice(1, 0, c, 'color: inherit');
// The final "%c" is somewhat tricky, because there could be other
// arguments passed either before or after the %c, so we need to
// figure out the correct index to insert the CSS into
let index = 0;
let lastC = 0;
args[0].replace(/%[a-zA-Z%]/g, match => {
if (match === '%%') {
return;
}
index++;
if (match === '%c') {
// We only are interested in the *last* %c
// (the user may have provided their own)
lastC = index;
}
});
args.splice(lastC, 0, c);
}
/**
* Invokes `console.log()` when available.
* No-op when `console.log` is not a "function".
*
* @api public
*/
function log(...args) {
// This hackery is required for IE8/9, where
// the `console.log` function doesn't have 'apply'
return typeof console === 'object' &&
console.log &&
console.log(...args);
}
/**
* Save `namespaces`.
*
* @param {String} namespaces
* @api private
*/
function save(namespaces) {
try {
if (namespaces) {
exports.storage.setItem('debug', namespaces);
} else {
exports.storage.removeItem('debug');
}
} catch (error) {
// Swallow
// XXX (@Qix-) should we be logging these?
}
}
/**
* Load `namespaces`.
*
* @return {String} returns the previously persisted debug modes
* @api private
*/
function load() {
let r;
try {
r = exports.storage.getItem('debug');
} catch (error) {
// Swallow
// XXX (@Qix-) should we be logging these?
}
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
if (!r && typeof process !== 'undefined' && 'env' in process) {
r = process.env.DEBUG;
}
return r;
}
/**
* Localstorage attempts to return the localstorage.
*
* This is necessary because safari throws
* when a user disables cookies/localstorage
* and you attempt to access it.
*
* @return {LocalStorage}
* @api private
*/
function localstorage() {
try {
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
// The Browser also has localStorage in the global context.
return localStorage;
} catch (error) {
// Swallow
// XXX (@Qix-) should we be logging these?
}
}
module.exports = __webpack_require__(120)(exports);
const {formatters} = module.exports;
/**
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
*/
formatters.j = function (v) {
try {
return JSON.stringify(v);
} catch (error) {
return '[UnexpectedJSONParseError]: ' + error.message;
}
};
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(30)))
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
/* eslint-disable no-proto */
var base64 = __webpack_require__(118)
var ieee754 = __webpack_require__(102)
var isArray = __webpack_require__(103)
exports.Buffer = Buffer
exports.SlowBuffer = SlowBuffer
exports.INSPECT_MAX_BYTES = 50
/**
* If `Buffer.TYPED_ARRAY_SUPPORT`:
* === true Use Uint8Array implementation (fastest)
* === false Use Object implementation (most compatible, even IE6)
*
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
* Opera 11.6+, iOS 4.2+.
*
* Due to various browser bugs, sometimes the Object implementation will be used even
* when the browser supports typed arrays.
*
* Note:
*
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
*
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
*
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
* incorrect length in some situations.
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
* get the Object implementation, which is slower but behaves correctly.
*/
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
? global.TYPED_ARRAY_SUPPORT
: typedArraySupport()
/*
* Export kMaxLength after typed array support is determined.
*/
exports.kMaxLength = kMaxLength()
function typedArraySupport () {
try {
var arr = new Uint8Array(1)
arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
return arr.foo() === 42 && // typed array instances can be augmented
typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
} catch (e) {
return false
}
}
function kMaxLength () {
return Buffer.TYPED_ARRAY_SUPPORT
? 0x7fffffff
: 0x3fffffff
}
function createBuffer (that, length) {
if (kMaxLength() < length) {
throw new RangeError('Invalid typed array length')
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = new Uint8Array(length)
that.__proto__ = Buffer.prototype
} else {
// Fallback: Return an object instance of the Buffer class
if (that === null) {
that = new Buffer(length)
}
that.length = length
}
return that
}
/**
* The Buffer constructor returns instances of `Uint8Array` that have their
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
* returns a single octet.
*
* The `Uint8Array` prototype remains unmodified.
*/
function Buffer (arg, encodingOrOffset, length) {
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
return new Buffer(arg, encodingOrOffset, length)
}
// Common case.
if (typeof arg === 'number') {
if (typeof encodingOrOffset === 'string') {
throw new Error(
'If encoding is specified then the first argument must be a string'
)
}
return allocUnsafe(this, arg)
}
return from(this, arg, encodingOrOffset, length)
}
Buffer.poolSize = 8192 // not used by this implementation
// TODO: Legacy, not needed anymore. Remove in next major version.
Buffer._augment = function (arr) {
arr.__proto__ = Buffer.prototype
return arr
}
function from (that, value, encodingOrOffset, length) {
if (typeof value === 'number') {
throw new TypeError('"value" argument must not be a number')
}
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
return fromArrayBuffer(that, value, encodingOrOffset, length)
}
if (typeof value === 'string') {
return fromString(that, value, encodingOrOffset)
}
return fromObject(that, value)
}
/**
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
* if value is a number.
* Buffer.from(str[, encoding])
* Buffer.from(array)
* Buffer.from(buffer)
* Buffer.from(arrayBuffer[, byteOffset[, length]])
**/
Buffer.from = function (value, encodingOrOffset, length) {
return from(null, value, encodingOrOffset, length)
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
Buffer.prototype.__proto__ = Uint8Array.prototype
Buffer.__proto__ = Uint8Array
if (typeof Symbol !== 'undefined' && Symbol.species &&
Buffer[Symbol.species] === Buffer) {
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
Object.defineProperty(Buffer, Symbol.species, {
value: null,
configurable: true
})
}
}
function assertSize (size) {
if (typeof size !== 'number') {
throw new TypeError('"size" argument must be a number')
} else if (size < 0) {
throw new RangeError('"size" argument must not be negative')
}
}
function alloc (that, size, fill, encoding) {
assertSize(size)
if (size <= 0) {
return createBuffer(that, size)
}
if (fill !== undefined) {
// Only pay attention to encoding if it's a string. This
// prevents accidentally sending in a number that would
// be interpretted as a start offset.
return typeof encoding === 'string'
? createBuffer(that, size).fill(fill, encoding)
: createBuffer(that, size).fill(fill)
}
return createBuffer(that, size)
}
/**
* Creates a new filled Buffer instance.
* alloc(size[, fill[, encoding]])
**/
Buffer.alloc = function (size, fill, encoding) {
return alloc(null, size, fill, encoding)
}
function allocUnsafe (that, size) {
assertSize(size)
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
if (!Buffer.TYPED_ARRAY_SUPPORT) {
for (var i = 0; i < size; ++i) {
that[i] = 0
}
}
return that
}
/**
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
* */
Buffer.allocUnsafe = function (size) {
return allocUnsafe(null, size)
}
/**
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
*/
Buffer.allocUnsafeSlow = function (size) {
return allocUnsafe(null, size)
}
function fromString (that, string, encoding) {
if (typeof encoding !== 'string' || encoding === '') {
encoding = 'utf8'
}
if (!Buffer.isEncoding(encoding)) {
throw new TypeError('"encoding" must be a valid string encoding')
}
var length = byteLength(string, encoding) | 0
that = createBuffer(that, length)
var actual = that.write(string, encoding)
if (actual !== length) {
// Writing a hex string, for example, that contains invalid characters will
// cause everything after the first invalid character to be ignored. (e.g.
// 'abxxcd' will be treated as 'ab')
that = that.slice(0, actual)
}
return that
}
function fromArrayLike (that, array) {
var length = array.length < 0 ? 0 : checked(array.length) | 0
that = createBuffer(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
}
function fromArrayBuffer (that, array, byteOffset, length) {
array.byteLength // this throws if `array` is not a valid ArrayBuffer
if (byteOffset < 0 || array.byteLength < byteOffset) {
throw new RangeError('\'offset\' is out of bounds')
}
if (array.byteLength < byteOffset + (length || 0)) {
throw new RangeError('\'length\' is out of bounds')
}
if (byteOffset === undefined && length === undefined) {
array = new Uint8Array(array)
} else if (length === undefined) {
array = new Uint8Array(array, byteOffset)
} else {
array = new Uint8Array(array, byteOffset, length)
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = array
that.__proto__ = Buffer.prototype
} else {
// Fallback: Return an object instance of the Buffer class
that = fromArrayLike(that, array)
}
return that
}
function fromObject (that, obj) {
if (Buffer.isBuffer(obj)) {
var len = checked(obj.length) | 0
that = createBuffer(that, len)
if (that.length === 0) {
return that
}
obj.copy(that, 0, 0, len)
return that
}
if (obj) {
if ((typeof ArrayBuffer !== 'undefined' &&
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
if (typeof obj.length !== 'number' || isnan(obj.length)) {
return createBuffer(that, 0)
}
return fromArrayLike(that, obj)
}
if (obj.type === 'Buffer' && isArray(obj.data)) {
return fromArrayLike(that, obj.data)
}
}
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
}
function checked (length) {
// Note: cannot use `length < kMaxLength()` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if (length >= kMaxLength()) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + kMaxLength().toString(16) + ' bytes')
}
return length | 0
}
function SlowBuffer (length) {
if (+length != length) { // eslint-disable-line eqeqeq
length = 0
}
return Buffer.alloc(+length)
}
Buffer.isBuffer = function isBuffer (b) {
return !!(b != null && b._isBuffer)
}
Buffer.compare = function compare (a, b) {
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
throw new TypeError('Arguments must be Buffers')
}
if (a === b) return 0
var x = a.length
var y = b.length
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
if (a[i] !== b[i]) {
x = a[i]
y = b[i]
break
}
}
if (x < y) return -1
if (y < x) return 1
return 0
}
Buffer.isEncoding = function isEncoding (encoding) {
switch (String(encoding).toLowerCase()) {
case 'hex':
case 'utf8':
case 'utf-8':
case 'ascii':
case 'latin1':
case 'binary':
case 'base64':
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return true
default:
return false
}
}
Buffer.concat = function concat (list, length) {
if (!isArray(list)) {
throw new TypeError('"list" argument must be an Array of Buffers')
}
if (list.length === 0) {
return Buffer.alloc(0)
}
var i
if (length === undefined) {
length = 0
for (i = 0; i < list.length; ++i) {
length += list[i].length
}
}
var buffer = Buffer.allocUnsafe(length)
var pos = 0
for (i = 0; i < list.length; ++i) {
var buf = list[i]
if (!Buffer.isBuffer(buf)) {
throw new TypeError('"list" argument must be an Array of Buffers')
}
buf.copy(buffer, pos)
pos += buf.length
}
return buffer
}
function byteLength (string, encoding) {
if (Buffer.isBuffer(string)) {
return string.length
}
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
(ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
return string.byteLength
}
if (typeof string !== 'string') {
string = '' + string
}
var len = string.length
if (len === 0) return 0
// Use a for loop to avoid recursion
var loweredCase = false
for (;;) {
switch (encoding) {
case 'ascii':
case 'latin1':
case 'binary':
return len
case 'utf8':
case 'utf-8':
case undefined:
return utf8ToBytes(string).length
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return len * 2
case 'hex':
return len >>> 1
case 'base64':
return base64ToBytes(string).length
default:
if (loweredCase) return utf8ToBytes(string).length // assume utf8
encoding = ('' + encoding).toLowerCase()
loweredCase = true
}
}
}
Buffer.byteLength = byteLength
function slowToString (encoding, start, end) {
var loweredCase = false
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
// property of a typed array.
// This behaves neither like String nor Uint8Array in that we set start/end
// to their upper/lower bounds if the value passed is out of range.
// undefined is handled specially as per ECMA-262 6th Edition,
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
if (start === undefined || start < 0) {
start = 0
}
// Return early if start > this.length. Done here to prevent potential uint32
// coercion fail below.
if (start > this.length) {
return ''
}
if (end === undefined || end > this.length) {
end = this.length
}
if (end <= 0) {
return ''
}
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
end >>>= 0
start >>>= 0
if (end <= start) {
return ''
}
if (!encoding) encoding = 'utf8'
while (true) {
switch (encoding) {
case 'hex':
return hexSlice(this, start, end)
case 'utf8':
case 'utf-8':
return utf8Slice(this, start, end)
case 'ascii':
return asciiSlice(this, start, end)
case 'latin1':
case 'binary':
return latin1Slice(this, start, end)
case 'base64':
return base64Slice(this, start, end)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return utf16leSlice(this, start, end)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = (encoding + '').toLowerCase()
loweredCase = true
}
}
}
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
// Buffer instances.
Buffer.prototype._isBuffer = true
function swap (b, n, m) {
var i = b[n]
b[n] = b[m]
b[m] = i
}
Buffer.prototype.swap16 = function swap16 () {
var len = this.length
if (len % 2 !== 0) {
throw new RangeError('Buffer size must be a multiple of 16-bits')
}
for (var i = 0; i < len; i += 2) {
swap(this, i, i + 1)
}
return this
}
Buffer.prototype.swap32 = function swap32 () {
var len = this.length
if (len % 4 !== 0) {
throw new RangeError('Buffer size must be a multiple of 32-bits')
}
for (var i = 0; i < len; i += 4) {
swap(this, i, i + 3)
swap(this, i + 1, i + 2)
}
return this
}
Buffer.prototype.swap64 = function swap64 () {
var len = this.length
if (len % 8 !== 0) {
throw new RangeError('Buffer size must be a multiple of 64-bits')
}
for (var i = 0; i < len; i += 8) {
swap(this, i, i + 7)
swap(this, i + 1, i + 6)
swap(this, i + 2, i + 5)
swap(this, i + 3, i + 4)
}
return this
}
Buffer.prototype.toString = function toString () {
var length = this.length | 0
if (length === 0) return ''
if (arguments.length === 0) return utf8Slice(this, 0, length)
return slowToString.apply(this, arguments)
}
Buffer.prototype.equals = function equals (b) {
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
if (this === b) return true
return Buffer.compare(this, b) === 0
}
Buffer.prototype.inspect = function inspect () {
var str = ''
var max = exports.INSPECT_MAX_BYTES
if (this.length > 0) {
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
if (this.length > max) str += ' ... '
}
return '<Buffer ' + str + '>'
}
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
if (!Buffer.isBuffer(target)) {
throw new TypeError('Argument must be a Buffer')
}
if (start === undefined) {
start = 0
}
if (end === undefined) {
end = target ? target.length : 0
}
if (thisStart === undefined) {
thisStart = 0
}
if (thisEnd === undefined) {
thisEnd = this.length
}
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
throw new RangeError('out of range index')
}
if (thisStart >= thisEnd && start >= end) {
return 0
}
if (thisStart >= thisEnd) {
return -1
}
if (start >= end) {
return 1
}
start >>>= 0
end >>>= 0
thisStart >>>= 0
thisEnd >>>= 0
if (this === target) return 0
var x = thisEnd - thisStart
var y = end - start
var len = Math.min(x, y)
var thisCopy = this.slice(thisStart, thisEnd)
var targetCopy = target.slice(start, end)
for (var i = 0; i < len; ++i) {
if (thisCopy[i] !== targetCopy[i]) {
x = thisCopy[i]
y = targetCopy[i]
break
}
}
if (x < y) return -1
if (y < x) return 1
return 0
}
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
//
// Arguments:
// - buffer - a Buffer to search
// - val - a string, Buffer, or number
// - byteOffset - an index into `buffer`; will be clamped to an int32
// - encoding - an optional encoding, relevant is val is a string
// - dir - true for indexOf, false for lastIndexOf
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
// Empty buffer means no match
if (buffer.length === 0) return -1
// Normalize byteOffset
if (typeof byteOffset === 'string') {
encoding = byteOffset
byteOffset = 0
} else if (byteOffset > 0x7fffffff) {
byteOffset = 0x7fffffff
} else if (byteOffset < -0x80000000) {
byteOffset = -0x80000000
}
byteOffset = +byteOffset // Coerce to Number.
if (isNaN(byteOffset)) {
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
byteOffset = dir ? 0 : (buffer.length - 1)
}
// Normalize byteOffset: negative offsets start from the end of the buffer
if (byteOffset < 0) byteOffset = buffer.length + byteOffset
if (byteOffset >= buffer.length) {
if (dir) return -1
else byteOffset = buffer.length - 1
} else if (byteOffset < 0) {
if (dir) byteOffset = 0
else return -1
}
// Normalize val
if (typeof val === 'string') {
val = Buffer.from(val, encoding)
}
// Finally, search either indexOf (if dir is true) or lastIndexOf
if (Buffer.isBuffer(val)) {
// Special case: looking for empty string/buffer always fails
if (val.length === 0) {
return -1
}
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
} else if (typeof val === 'number') {
val = val & 0xFF // Search for a byte value [0-255]
if (Buffer.TYPED_ARRAY_SUPPORT &&
typeof Uint8Array.prototype.indexOf === 'function') {
if (dir) {
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
} else {
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
}
}
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
}
throw new TypeError('val must be string, number or Buffer')
}
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
var indexSize = 1
var arrLength = arr.length
var valLength = val.length
if (encoding !== undefined) {
encoding = String(encoding).toLowerCase()
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
encoding === 'utf16le' || encoding === 'utf-16le') {
if (arr.length < 2 || val.length < 2) {
return -1
}
indexSize = 2
arrLength /= 2
valLength /= 2
byteOffset /= 2
}
}
function read (buf, i) {
if (indexSize === 1) {
return buf[i]
} else {
return buf.readUInt16BE(i * indexSize)
}
}
var i
if (dir) {
var foundIndex = -1
for (i = byteOffset; i < arrLength; i++) {
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
if (foundIndex === -1) foundIndex = i
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
} else {
if (foundIndex !== -1) i -= i - foundIndex
foundIndex = -1
}
}
} else {
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
for (i = byteOffset; i >= 0; i--) {
var found = true
for (var j = 0; j < valLength; j++) {
if (read(arr, i + j) !== read(val, j)) {
found = false
break
}
}
if (found) return i
}
}
return -1
}
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
return this.indexOf(val, byteOffset, encoding) !== -1
}
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
}
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
}
function hexWrite (buf, string, offset, length) {
offset = Number(offset) || 0
var remaining = buf.length - offset
if (!length) {
length = remaining
} else {
length = Number(length)
if (length > remaining) {
length = remaining
}
}
// must be an even number of digits
var strLen = string.length
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
if (length > strLen / 2) {
length = strLen / 2
}
for (var i = 0; i < length; ++i) {
var parsed = parseInt(string.substr(i * 2, 2), 16)
if (isNaN(parsed)) return i
buf[offset + i] = parsed
}
return i
}
function utf8Write (buf, string, offset, length) {
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
}
function asciiWrite (buf, string, offset, length) {
return blitBuffer(asciiToBytes(string), buf, offset, length)
}
function latin1Write (buf, string, offset, length) {
return asciiWrite(buf, string, offset, length)
}
function base64Write (buf, string, offset, length) {
return blitBuffer(base64ToBytes(string), buf, offset, length)
}
function ucs2Write (buf, string, offset, length) {
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
}
Buffer.prototype.write = function write (string, offset, length, encoding) {
// Buffer#write(string)
if (offset === undefined) {
encoding = 'utf8'
length = this.length
offset = 0
// Buffer#write(string, encoding)
} else if (length === undefined && typeof offset === 'string') {
encoding = offset
length = this.length
offset = 0
// Buffer#write(string, offset[, length][, encoding])
} else if (isFinite(offset)) {
offset = offset | 0
if (isFinite(length)) {
length = length | 0
if (encoding === undefined) encoding = 'utf8'
} else {
encoding = length
length = undefined
}
// legacy write(string, encoding, offset, length) - remove in v0.13
} else {
throw new Error(
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
)
}
var remaining = this.length - offset
if (length === undefined || length > remaining) length = remaining
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
throw new RangeError('Attempt to write outside buffer bounds')
}
if (!encoding) encoding = 'utf8'
var loweredCase = false
for (;;) {
switch (encoding) {
case 'hex':
return hexWrite(this, string, offset, length)
case 'utf8':
case 'utf-8':
return utf8Write(this, string, offset, length)
case 'ascii':
return asciiWrite(this, string, offset, length)
case 'latin1':
case 'binary':
return latin1Write(this, string, offset, length)
case 'base64':
// Warning: maxLength not taken into account in base64Write
return base64Write(this, string, offset, length)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return ucs2Write(this, string, offset, length)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = ('' + encoding).toLowerCase()
loweredCase = true
}
}
}
Buffer.prototype.toJSON = function toJSON () {
return {
type: 'Buffer',
data: Array.prototype.slice.call(this._arr || this, 0)
}
}
function base64Slice (buf, start, end) {
if (start === 0 && end === buf.length) {
return base64.fromByteArray(buf)
} else {
return base64.fromByteArray(buf.slice(start, end))
}
}
function utf8Slice (buf, start, end) {
end = Math.min(buf.length, end)
var res = []
var i = start
while (i < end) {
var firstByte = buf[i]
var codePoint = null
var bytesPerSequence = (firstByte > 0xEF) ? 4
: (firstByte > 0xDF) ? 3
: (firstByte > 0xBF) ? 2
: 1
if (i + bytesPerSequence <= end) {
var secondByte, thirdByte, fourthByte, tempCodePoint
switch (bytesPerSequence) {
case 1:
if (firstByte < 0x80) {
codePoint = firstByte
}
break
case 2:
secondByte = buf[i + 1]
if ((secondByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
if (tempCodePoint > 0x7F) {
codePoint = tempCodePoint
}
}
break
case 3:
secondByte = buf[i + 1]
thirdByte = buf[i + 2]
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
codePoint = tempCodePoint
}
}
break
case 4:
secondByte = buf[i + 1]
thirdByte = buf[i + 2]
fourthByte = buf[i + 3]
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
codePoint = tempCodePoint
}
}
}
}
if (codePoint === null) {
// we did not generate a valid codePoint so insert a
// replacement char (U+FFFD) and advance only 1 byte
codePoint = 0xFFFD
bytesPerSequence = 1
} else if (codePoint > 0xFFFF) {
// encode to utf16 (surrogate pair dance)
codePoint -= 0x10000
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
codePoint = 0xDC00 | codePoint & 0x3FF
}
res.push(codePoint)
i += bytesPerSequence
}
return decodeCodePointsArray(res)
}
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
// the lowest limit is Chrome, with 0x10000 args.
// We go 1 magnitude less, for safety
var MAX_ARGUMENTS_LENGTH = 0x1000
function decodeCodePointsArray (codePoints) {
var len = codePoints.length
if (len <= MAX_ARGUMENTS_LENGTH) {
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
}
// Decode in chunks to avoid "call stack size exceeded".
var res = ''
var i = 0
while (i < len) {
res += String.fromCharCode.apply(
String,
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
)
}
return res
}
function asciiSlice (buf, start, end) {
var ret = ''
end = Math.min(buf.length, end)
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i] & 0x7F)
}
return ret
}
function latin1Slice (buf, start, end) {
var ret = ''
end = Math.min(buf.length, end)
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i])
}
return ret
}
function hexSlice (buf, start, end) {
var len = buf.length
if (!start || start < 0) start = 0
if (!end || end < 0 || end > len) end = len
var out = ''
for (var i = start; i < end; ++i) {
out += toHex(buf[i])
}
return out
}
function utf16leSlice (buf, start, end) {
var bytes = buf.slice(start, end)
var res = ''
for (var i = 0; i < bytes.length; i += 2) {
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
}
return res
}
Buffer.prototype.slice = function slice (start, end) {
var len = this.length
start = ~~start
end = end === undefined ? len : ~~end
if (start < 0) {
start += len
if (start < 0) start = 0
} else if (start > len) {
start = len
}
if (end < 0) {
end += len
if (end < 0) end = 0
} else if (end > len) {
end = len
}
if (end < start) end = start
var newBuf
if (Buffer.TYPED_ARRAY_SUPPORT) {
newBuf = this.subarray(start, end)
newBuf.__proto__ = Buffer.prototype
} else {
var sliceLen = end - start
newBuf = new Buffer(sliceLen, undefined)
for (var i = 0; i < sliceLen; ++i) {
newBuf[i] = this[i + start]
}
}
return newBuf
}
/*
* Need to make sure that buffer isn't trying to write out of bounds.
*/
function checkOffset (offset, ext, length) {
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
}
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
offset = offset | 0
byteLength = byteLength | 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
var val = this[offset]
var mul = 1
var i = 0
while (++i < byteLength && (mul *= 0x100)) {
val += this[offset + i] * mul
}
return val
}
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
offset = offset | 0
byteLength = byteLength | 0
if (!noAssert) {
checkOffset(offset, byteLength, this.length)
}
var val = this[offset + --byteLength]
var mul = 1
while (byteLength > 0 && (mul *= 0x100)) {
val += this[offset + --byteLength] * mul
}
return val
}
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
if (!noAssert) checkOffset(offset, 1, this.length)
return this[offset]
}
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length)
return this[offset] | (this[offset + 1] << 8)
}
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length)
return (this[offset] << 8) | this[offset + 1]
}
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return ((this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16)) +
(this[offset + 3] * 0x1000000)
}
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return (this[offset] * 0x1000000) +
((this[offset + 1] << 16) |
(this[offset + 2] << 8) |
this[offset + 3])
}
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
offset = offset | 0
byteLength = byteLength | 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
var val = this[offset]
var mul = 1
var i = 0
while (++i < byteLength && (mul *= 0x100)) {
val += this[offset + i] * mul
}
mul *= 0x80
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
return val
}
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
offset = offset | 0
byteLength = byteLength | 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
var i = byteLength
var mul = 1
var val = this[offset + --i]
while (i > 0 && (mul *= 0x100)) {
val += this[offset + --i] * mul
}
mul *= 0x80
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
return val
}
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
if (!noAssert) checkOffset(offset, 1, this.length)
if (!(this[offset] & 0x80)) return (this[offset])
return ((0xff - this[offset] + 1) * -1)
}
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length)
var val = this[offset] | (this[offset + 1] << 8)
return (val & 0x8000) ? val | 0xFFFF0000 : val
}
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length)
var val = this[offset + 1] | (this[offset] << 8)
return (val & 0x8000) ? val | 0xFFFF0000 : val
}
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return (this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16) |
(this[offset + 3] << 24)
}
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return (this[offset] << 24) |
(this[offset + 1] << 16) |
(this[offset + 2] << 8) |
(this[offset + 3])
}
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return ieee754.read(this, offset, true, 23, 4)
}
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return ieee754.read(this, offset, false, 23, 4)
}
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 8, this.length)
return ieee754.read(this, offset, true, 52, 8)
}
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 8, this.length)
return ieee754.read(this, offset, false, 52, 8)
}
function checkInt (buf, value, offset, ext, max, min) {
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
if (offset + ext > buf.length) throw new RangeError('Index out of range')
}
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
value = +value
offset = offset | 0
byteLength = byteLength | 0
if (!noAssert) {
var maxBytes = Math.pow(2, 8 * byteLength) - 1
checkInt(this, value, offset, byteLength, maxBytes, 0)
}
var mul = 1
var i = 0
this[offset] = value & 0xFF
while (++i < byteLength && (mul *= 0x100)) {
this[offset + i] = (value / mul) & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
value = +value
offset = offset | 0
byteLength = byteLength | 0
if (!noAssert) {
var maxBytes = Math.pow(2, 8 * byteLength) - 1
checkInt(this, value, offset, byteLength, maxBytes, 0)
}
var i = byteLength - 1
var mul = 1
this[offset + i] = value & 0xFF
while (--i >= 0 && (mul *= 0x100)) {
this[offset + i] = (value / mul) & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
this[offset] = (value & 0xff)
return offset + 1
}
function objectWriteUInt16 (buf, value, offset, littleEndian) {
if (value < 0) value = 0xffff + value + 1
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
(littleEndian ? i : 1 - i) * 8
}
}
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value & 0xff)
this[offset + 1] = (value >>> 8)
} else {
objectWriteUInt16(this, value, offset, true)
}
return offset + 2
}
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 8)
this[offset + 1] = (value & 0xff)
} else {
objectWriteUInt16(this, value, offset, false)
}
return offset + 2
}
function objectWriteUInt32 (buf, value, offset, littleEndian) {
if (value < 0) value = 0xffffffff + value + 1
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
}
}
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset + 3] = (value >>> 24)
this[offset + 2] = (value >>> 16)
this[offset + 1] = (value >>> 8)
this[offset] = (value & 0xff)
} else {
objectWriteUInt32(this, value, offset, true)
}
return offset + 4
}
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 24)
this[offset + 1] = (value >>> 16)
this[offset + 2] = (value >>> 8)
this[offset + 3] = (value & 0xff)
} else {
objectWriteUInt32(this, value, offset, false)
}
return offset + 4
}
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) {
var limit = Math.pow(2, 8 * byteLength - 1)
checkInt(this, value, offset, byteLength, limit - 1, -limit)
}
var i = 0
var mul = 1
var sub = 0
this[offset] = value & 0xFF
while (++i < byteLength && (mul *= 0x100)) {
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
sub = 1
}
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) {
var limit = Math.pow(2, 8 * byteLength - 1)
checkInt(this, value, offset, byteLength, limit - 1, -limit)
}
var i = byteLength - 1
var mul = 1
var sub = 0
this[offset + i] = value & 0xFF
while (--i >= 0 && (mul *= 0x100)) {
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
sub = 1
}
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
if (value < 0) value = 0xff + value + 1
this[offset] = (value & 0xff)
return offset + 1
}
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value & 0xff)
this[offset + 1] = (value >>> 8)
} else {
objectWriteUInt16(this, value, offset, true)
}
return offset + 2
}
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 8)
this[offset + 1] = (value & 0xff)
} else {
objectWriteUInt16(this, value, offset, false)
}
return offset + 2
}
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value & 0xff)
this[offset + 1] = (value >>> 8)
this[offset + 2] = (value >>> 16)
this[offset + 3] = (value >>> 24)
} else {
objectWriteUInt32(this, value, offset, true)
}
return offset + 4
}
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
value = +value
offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
if (value < 0) value = 0xffffffff + value + 1
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 24)
this[offset + 1] = (value >>> 16)
this[offset + 2] = (value >>> 8)
this[offset + 3] = (value & 0xff)
} else {
objectWriteUInt32(this, value, offset, false)
}
return offset + 4
}
function checkIEEE754 (buf, value, offset, ext, max, min) {
if (offset + ext > buf.length) throw new RangeError('Index out of range')
if (offset < 0) throw new RangeError('Index out of range')
}
function writeFloat (buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
}
ieee754.write(buf, value, offset, littleEndian, 23, 4)
return offset + 4
}
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
return writeFloat(this, value, offset, true, noAssert)
}
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
return writeFloat(this, value, offset, false, noAssert)
}
function writeDouble (buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
}
ieee754.write(buf, value, offset, littleEndian, 52, 8)
return offset + 8
}
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
return writeDouble(this, value, offset, true, noAssert)
}
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
return writeDouble(this, value, offset, false, noAssert)
}
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
if (!start) start = 0
if (!end && end !== 0) end = this.length
if (targetStart >= target.length) targetStart = target.length
if (!targetStart) targetStart = 0
if (end > 0 && end < start) end = start
// Copy 0 bytes; we're done
if (end === start) return 0
if (target.length === 0 || this.length === 0) return 0
// Fatal error conditions
if (targetStart < 0) {
throw new RangeError('targetStart out of bounds')
}
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
if (end < 0) throw new RangeError('sourceEnd out of bounds')
// Are we oob?
if (end > this.length) end = this.length
if (target.length - targetStart < end - start) {
end = target.length - targetStart + start
}
var len = end - start
var i
if (this === target && start < targetStart && targetStart < end) {
// descending copy from end
for (i = len - 1; i >= 0; --i) {
target[i + targetStart] = this[i + start]
}
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
// ascending copy from start
for (i = 0; i < len; ++i) {
target[i + targetStart] = this[i + start]
}
} else {
Uint8Array.prototype.set.call(
target,
this.subarray(start, start + len),
targetStart
)
}
return len
}
// Usage:
// buffer.fill(number[, offset[, end]])
// buffer.fill(buffer[, offset[, end]])
// buffer.fill(string[, offset[, end]][, encoding])
Buffer.prototype.fill = function fill (val, start, end, encoding) {
// Handle string cases:
if (typeof val === 'string') {
if (typeof start === 'string') {
encoding = start
start = 0
end = this.length
} else if (typeof end === 'string') {
encoding = end
end = this.length
}
if (val.length === 1) {
var code = val.charCodeAt(0)
if (code < 256) {
val = code
}
}
if (encoding !== undefined && typeof encoding !== 'string') {
throw new TypeError('encoding must be a string')
}
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
throw new TypeError('Unknown encoding: ' + encoding)
}
} else if (typeof val === 'number') {
val = val & 255
}
// Invalid ranges are not set to a default, so can range check early.
if (start < 0 || this.length < start || this.length < end) {
throw new RangeError('Out of range index')
}
if (end <= start) {
return this
}
start = start >>> 0
end = end === undefined ? this.length : end >>> 0
if (!val) val = 0
var i
if (typeof val === 'number') {
for (i = start; i < end; ++i) {
this[i] = val
}
} else {
var bytes = Buffer.isBuffer(val)
? val
: utf8ToBytes(new Buffer(val, encoding).toString())
var len = bytes.length
for (i = 0; i < end - start; ++i) {
this[i + start] = bytes[i % len]
}
}
return this
}
// HELPER FUNCTIONS
// ================
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
function base64clean (str) {
// Node strips out invalid characters like \n and \t from the string, base64-js does not
str = stringtrim(str).replace(INVALID_BASE64_RE, '')
// Node converts strings with length < 2 to ''
if (str.length < 2) return ''
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
while (str.length % 4 !== 0) {
str = str + '='
}
return str
}
function stringtrim (str) {
if (str.trim) return str.trim()
return str.replace(/^\s+|\s+$/g, '')
}
function toHex (n) {
if (n < 16) return '0' + n.toString(16)
return n.toString(16)
}
function utf8ToBytes (string, units) {
units = units || Infinity
var codePoint
var length = string.length
var leadSurrogate = null
var bytes = []
for (var i = 0; i < length; ++i) {
codePoint = string.charCodeAt(i)
// is surrogate component
if (codePoint > 0xD7FF && codePoint < 0xE000) {
// last char was a lead
if (!leadSurrogate) {
// no lead yet
if (codePoint > 0xDBFF) {
// unexpected trail
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
continue
} else if (i + 1 === length) {
// unpaired lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
continue
}
// valid lead
leadSurrogate = codePoint
continue
}
// 2 leads in a row
if (codePoint < 0xDC00) {
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
leadSurrogate = codePoint
continue
}
// valid surrogate pair
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
} else if (leadSurrogate) {
// valid bmp char, but last char was a lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
}
leadSurrogate = null
// encode utf8
if (codePoint < 0x80) {
if ((units -= 1) < 0) break
bytes.push(codePoint)
} else if (codePoint < 0x800) {
if ((units -= 2) < 0) break
bytes.push(
codePoint >> 0x6 | 0xC0,
codePoint & 0x3F | 0x80
)
} else if (codePoint < 0x10000) {
if ((units -= 3) < 0) break
bytes.push(
codePoint >> 0xC | 0xE0,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
)
} else if (codePoint < 0x110000) {
if ((units -= 4) < 0) break
bytes.push(
codePoint >> 0x12 | 0xF0,
codePoint >> 0xC & 0x3F | 0x80,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
)
} else {
throw new Error('Invalid code point')
}
}
return bytes
}
function asciiToBytes (str) {
var byteArray = []
for (var i = 0; i < str.length; ++i) {
// Node's code seems to be doing this and not & 0x7F..
byteArray.push(str.charCodeAt(i) & 0xFF)
}
return byteArray
}
function utf16leToBytes (str, units) {
var c, hi, lo
var byteArray = []
for (var i = 0; i < str.length; ++i) {
if ((units -= 2) < 0) break
c = str.charCodeAt(i)
hi = c >> 8
lo = c % 256
byteArray.push(lo)
byteArray.push(hi)
}
return byteArray
}
function base64ToBytes (str) {
return base64.toByteArray(base64clean(str))
}
function blitBuffer (src, dst, offset, length) {
for (var i = 0; i < length; ++i) {
if ((i + offset >= dst.length) || (i >= src.length)) break
dst[i + offset] = src[i]
}
return i
}
function isnan (val) {
return val !== val // eslint-disable-line no-self-compare
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(17)))
/***/ }),
/* 10 */
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function(useSourceMap) {
var list = [];
// return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item, useSourceMap);
if(item[2]) {
return "@media " + item[2] + "{" + content + "}";
} else {
return content;
}
}).join("");
};
// import a list of modules into the list
list.i = function(modules, mediaQuery) {
if(typeof modules === "string")
modules = [[null, modules, ""]];
var alreadyImportedModules = {};
for(var i = 0; i < this.length; i++) {
var id = this[i][0];
if(typeof id === "number")
alreadyImportedModules[id] = true;
}
for(i = 0; i < modules.length; i++) {
var item = modules[i];
// skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
if(mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if(mediaQuery) {
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
}
list.push(item);
}
}
};
return list;
};
function cssWithMappingToString(item, useSourceMap) {
var content = item[1] || '';
var cssMapping = item[3];
if (!cssMapping) {
return content;
}
if (useSourceMap && typeof btoa === 'function') {
var sourceMapping = toComment(cssMapping);
var sourceURLs = cssMapping.sources.map(function (source) {
return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
});
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
}
return [content].join('\n');
}
// Adapted from convert-source-map (MIT)
function toComment(sourceMap) {
// eslint-disable-next-line no-undef
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
return '/*# ' + data + ' */';
}
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var stylesInDom = {};
var memoize = function (fn) {
var memo;
return function () {
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
return memo;
};
};
var isOldIE = memoize(function () {
// Test for IE <= 9 as proposed by Browserhacks
// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
// Tests for existence of standard globals is to allow style-loader
// to operate correctly into non-standard environments
// @see https://github.com/webpack-contrib/style-loader/issues/177
return window && document && document.all && !window.atob;
});
var getTarget = function (target, parent) {
if (parent){
return parent.querySelector(target);
}
return document.querySelector(target);
};
var getElement = (function (fn) {
var memo = {};
return function(target, parent) {
// If passing function in options, then use it for resolve "head" element.
// Useful for Shadow Root style i.e
// {
// insertInto: function () { return document.querySelector("#foo").shadowRoot }
// }
if (typeof target === 'function') {
return target();
}
if (typeof memo[target] === "undefined") {
var styleTarget = getTarget.call(this, target, parent);
// Special case to return head of iframe instead of iframe itself
if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
try {
// This will throw an exception if access to iframe is blocked
// due to cross-origin restrictions
styleTarget = styleTarget.contentDocument.head;
} catch(e) {
styleTarget = null;
}
}
memo[target] = styleTarget;
}
return memo[target]
};
})();
var singleton = null;
var singletonCounter = 0;
var stylesInsertedAtTop = [];
var fixUrls = __webpack_require__(70);
module.exports = function(list, options) {
if (typeof DEBUG !== "undefined" && DEBUG) {
if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
}
options = options || {};
options.attrs = typeof options.attrs === "object" ? options.attrs : {};
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
// By default, add <style> tags to the <head> element
if (!options.insertInto) options.insertInto = "head";
// By default, add <style> tags to the bottom of the target
if (!options.insertAt) options.insertAt = "bottom";
var styles = listToStyles(list, options);
addStylesToDom(styles, options);
return function update (newList) {
var mayRemove = [];
for (var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
domStyle.refs--;
mayRemove.push(domStyle);
}
if(newList) {
var newStyles = listToStyles(newList, options);
addStylesToDom(newStyles, options);
}
for (var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i];
if(domStyle.refs === 0) {
for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
delete stylesInDom[domStyle.id];
}
}
};
};
function addStylesToDom (styles, options) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
if(domStyle) {
domStyle.refs++;
for(var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j]);
}
for(; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j], options));
}
} else {
var parts = [];
for(var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j], options));
}
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
}
}
}
function listToStyles (list, options) {
var styles = [];
var newStyles = {};
for (var i = 0; i < list.length; i++) {
var item = list[i];
var id = options.base ? item[0] + options.base : item[0];
var css = item[1];
var media = item[2];
var sourceMap = item[3];
var part = {css: css, media: media, sourceMap: sourceMap};
if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
else newStyles[id].parts.push(part);
}
return styles;
}
function insertStyleElement (options, style) {
var target = getElement(options.insertInto)
if (!target) {
throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
}
var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
if (options.insertAt === "top") {
if (!lastStyleElementInsertedAtTop) {
target.insertBefore(style, target.firstChild);
} else if (lastStyleElementInsertedAtTop.nextSibling) {
target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
} else {
target.appendChild(style);
}
stylesInsertedAtTop.push(style);
} else if (options.insertAt === "bottom") {
target.appendChild(style);
} else if (typeof options.insertAt === "object" && options.insertAt.before) {
var nextSibling = getElement(options.insertAt.before, target);
target.insertBefore(style, nextSibling);
} else {
throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");
}
}
function removeStyleElement (style) {
if (style.parentNode === null) return false;
style.parentNode.removeChild(style);
var idx = stylesInsertedAtTop.indexOf(style);
if(idx >= 0) {
stylesInsertedAtTop.splice(idx, 1);
}
}
function createStyleElement (options) {
var style = document.createElement("style");
if(options.attrs.type === undefined) {
options.attrs.type = "text/css";
}
if(options.attrs.nonce === undefined) {
var nonce = getNonce();
if (nonce) {
options.attrs.nonce = nonce;
}
}
addAttrs(style, options.attrs);
insertStyleElement(options, style);
return style;
}
function createLinkElement (options) {
var link = document.createElement("link");
if(options.attrs.type === undefined) {
options.attrs.type = "text/css";
}
options.attrs.rel = "stylesheet";
addAttrs(link, options.attrs);
insertStyleElement(options, link);
return link;
}
function addAttrs (el, attrs) {
Object.keys(attrs).forEach(function (key) {
el.setAttribute(key, attrs[key]);
});
}
function getNonce() {
if (false) {}
return __webpack_require__.nc;
}
function addStyle (obj, options) {
var style, update, remove, result;
// If a transform function was defined, run it on the css
if (options.transform && obj.css) {
result = typeof options.transform === 'function'
? options.transform(obj.css)
: options.transform.default(obj.css);
if (result) {
// If transform returns a value, use that instead of the original css.
// This allows running runtime transformations on the css.
obj.css = result;
} else {
// If the transform function returns a falsy value, don't add this css.
// This allows conditional loading of css
return function() {
// noop
};
}
}
if (options.singleton) {
var styleIndex = singletonCounter++;
style = singleton || (singleton = createStyleElement(options));
update = applyToSingletonTag.bind(null, style, styleIndex, false);
remove = applyToSingletonTag.bind(null, style, styleIndex, true);
} else if (
obj.sourceMap &&
typeof URL === "function" &&
typeof URL.createObjectURL === "function" &&
typeof URL.revokeObjectURL === "function" &&
typeof Blob === "function" &&
typeof btoa === "function"
) {
style = createLinkElement(options);
update = updateLink.bind(null, style, options);
remove = function () {
removeStyleElement(style);
if(style.href) URL.revokeObjectURL(style.href);
};
} else {
style = createStyleElement(options);
update = applyToTag.bind(null, style);
remove = function () {
removeStyleElement(style);
};
}
update(obj);
return function updateStyle (newObj) {
if (newObj) {
if (
newObj.css === obj.css &&
newObj.media === obj.media &&
newObj.sourceMap === obj.sourceMap
) {
return;
}
update(obj = newObj);
} else {
remove();
}
};
}
var replaceText = (function () {
var textStore = [];
return function (index, replacement) {
textStore[index] = replacement;
return textStore.filter(Boolean).join('\n');
};
})();
function applyToSingletonTag (style, index, remove, obj) {
var css = remove ? "" : obj.css;
if (style.styleSheet) {
style.styleSheet.cssText = replaceText(index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = style.childNodes;
if (childNodes[index]) style.removeChild(childNodes[index]);
if (childNodes.length) {
style.insertBefore(cssNode, childNodes[index]);
} else {
style.appendChild(cssNode);
}
}
}
function applyToTag (style, obj) {
var css = obj.css;
var media = obj.media;
if(media) {
style.setAttribute("media", media)
}
if(style.styleSheet) {
style.styleSheet.cssText = css;
} else {
while(style.firstChild) {
style.removeChild(style.firstChild);
}
style.appendChild(document.createTextNode(css));
}
}
function updateLink (link, options, obj) {
var css = obj.css;
var sourceMap = obj.sourceMap;
/*
If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
and there is no publicPath defined then lets turn convertToAbsoluteUrls
on by default. Otherwise default to the convertToAbsoluteUrls option
directly
*/
var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
if (options.convertToAbsoluteUrls || autoFixUrls) {
css = fixUrls(css);
}
if (sourceMap) {
// http://stackoverflow.com/a/26603875
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
}
var blob = new Blob([css], { type: "text/css" });
var oldSrc = link.href;
link.href = URL.createObjectURL(blob);
if(oldSrc) URL.revokeObjectURL(oldSrc);
}
/***/ }),
/* 12 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__DO_NOT_USE__ActionTypes", function() { return ActionTypes; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyMiddleware", function() { return applyMiddleware; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bindActionCreators", function() { return bindActionCreators; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "combineReducers", function() { return combineReducers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return compose; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createStore", function() { return createStore; });
/* harmony import */ var symbol_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28);
/**
* These are private action types reserved by Redux.
* For any unknown actions, you must return the current state.
* If the current state is undefined, you must return the initial state.
* Do not reference these action types directly in your code.
*/
var randomString = function randomString() {
return Math.random().toString(36).substring(7).split('').join('.');
};
var ActionTypes = {
INIT: "@@redux/INIT" + randomString(),
REPLACE: "@@redux/REPLACE" + randomString(),
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
}
};
/**
* @param {any} obj The object to inspect.
* @returns {boolean} True if the argument appears to be a plain object.
*/
function isPlainObject(obj) {
if (typeof obj !== 'object' || obj === null) return false;
var proto = obj;
while (Object.getPrototypeOf(proto) !== null) {
proto = Object.getPrototypeOf(proto);
}
return Object.getPrototypeOf(obj) === proto;
}
/**
* Creates a Redux store that holds the state tree.
* The only way to change the data in the store is to call `dispatch()` on it.
*
* There should only be a single store in your app. To specify how different
* parts of the state tree respond to actions, you may combine several reducers
* into a single reducer function by using `combineReducers`.
*
* @param {Function} reducer A function that returns the next state tree, given
* the current state tree and the action to handle.
*
* @param {any} [preloadedState] The initial state. You may optionally specify it
* to hydrate the state from the server in universal apps, or to restore a
* previously serialized user session.
* If you use `combineReducers` to produce the root reducer function, this must be
* an object with the same shape as `combineReducers` keys.
*
* @param {Function} [enhancer] The store enhancer. You may optionally specify it
* to enhance the store with third-party capabilities such as middleware,
* time travel, persistence, etc. The only store enhancer that ships with Redux
* is `applyMiddleware()`.
*
* @returns {Store} A Redux store that lets you read the state, dispatch actions
* and subscribe to changes.
*/
function createStore(reducer, preloadedState, enhancer) {
var _ref2;
if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function.');
}
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
enhancer = preloadedState;
preloadedState = undefined;
}
if (typeof enhancer !== 'undefined') {
if (typeof enhancer !== 'function') {
throw new Error('Expected the enhancer to be a function.');
}
return enhancer(createStore)(reducer, preloadedState);
}
if (typeof reducer !== 'function') {
throw new Error('Expected the reducer to be a function.');
}
var currentReducer = reducer;
var currentState = preloadedState;
var currentListeners = [];
var nextListeners = currentListeners;
var isDispatching = false;
/**
* This makes a shallow copy of currentListeners so we can use
* nextListeners as a temporary list while dispatching.
*
* This prevents any bugs around consumers calling
* subscribe/unsubscribe in the middle of a dispatch.
*/
function ensureCanMutateNextListeners() {
if (nextListeners === currentListeners) {
nextListeners = currentListeners.slice();
}
}
/**
* Reads the state tree managed by the store.
*
* @returns {any} The current state tree of your application.
*/
function getState() {
if (isDispatching) {
throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
}
return currentState;
}
/**
* Adds a change listener. It will be called any time an action is dispatched,
* and some part of the state tree may potentially have changed. You may then
* call `getState()` to read the current state tree inside the callback.
*
* You may call `dispatch()` from a change listener, with the following
* caveats:
*
* 1. The subscriptions are snapshotted just before every `dispatch()` call.
* If you subscribe or unsubscribe while the listeners are being invoked, this
* will not have any effect on the `dispatch()` that is currently in progress.
* However, the next `dispatch()` call, whether nested or not, will use a more
* recent snapshot of the subscription list.
*
* 2. The listener should not expect to see all state changes, as the state
* might have been updated multiple times during a nested `dispatch()` before
* the listener is called. It is, however, guaranteed that all subscribers
* registered before the `dispatch()` started will be called with the latest
* state by the time it exits.
*
* @param {Function} listener A callback to be invoked on every dispatch.
* @returns {Function} A function to remove this change listener.
*/
function subscribe(listener) {
if (typeof listener !== 'function') {
throw new Error('Expected the listener to be a function.');
}
if (isDispatching) {
throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribelistener for more details.');
}
var isSubscribed = true;
ensureCanMutateNextListeners();
nextListeners.push(listener);
return function unsubscribe() {
if (!isSubscribed) {
return;
}
if (isDispatching) {
throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribelistener for more details.');
}
isSubscribed = false;
ensureCanMutateNextListeners();
var index = nextListeners.indexOf(listener);
nextListeners.splice(index, 1);
currentListeners = null;
};
}
/**
* Dispatches an action. It is the only way to trigger a state change.
*
* The `reducer` function, used to create the store, will be called with the
* current state tree and the given `action`. Its return value will
* be considered the **next** state of the tree, and the change listeners
* will be notified.
*
* The base implementation only supports plain object actions. If you want to
* dispatch a Promise, an Observable, a thunk, or something else, you need to
* wrap your store creating function into the corresponding middleware. For
* example, see the documentation for the `redux-thunk` package. Even the
* middleware will eventually dispatch plain object actions using this method.
*
* @param {Object} action A plain object representing “what changed”. It is
* a good idea to keep actions serializable so you can record and replay user
* sessions, or use the time travelling `redux-devtools`. An action must have
* a `type` property which may not be `undefined`. It is a good idea to use
* string constants for action types.
*
* @returns {Object} For convenience, the same action object you dispatched.
*
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
* return something else (for example, a Promise you can await).
*/
function dispatch(action) {
if (!isPlainObject(action)) {
throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
}
if (typeof action.type === 'undefined') {
throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
}
if (isDispatching) {
throw new Error('Reducers may not dispatch actions.');
}
try {
isDispatching = true;
currentState = currentReducer(currentState, action);
} finally {
isDispatching = false;
}
var listeners = currentListeners = nextListeners;
for (var i = 0; i < listeners.length; i++) {
var listener = listeners[i];
listener();
}
return action;
}
/**
* Replaces the reducer currently used by the store to calculate the state.
*
* You might need this if your app implements code splitting and you want to
* load some of the reducers dynamically. You might also need this if you
* implement a hot reloading mechanism for Redux.
*
* @param {Function} nextReducer The reducer for the store to use instead.
* @returns {void}
*/
function replaceReducer(nextReducer) {
if (typeof nextReducer !== 'function') {
throw new Error('Expected the nextReducer to be a function.');
}
currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
// Any reducers that existed in both the new and old rootReducer
// will receive the previous state. This effectively populates
// the new state tree with any relevant data from the old one.
dispatch({
type: ActionTypes.REPLACE
});
}
/**
* Interoperability point for observable/reactive libraries.
* @returns {observable} A minimal observable of state changes.
* For more information, see the observable proposal:
* https://github.com/tc39/proposal-observable
*/
function observable() {
var _ref;
var outerSubscribe = subscribe;
return _ref = {
/**
* The minimal observable subscription method.
* @param {Object} observer Any object that can be used as an observer.
* The observer object should have a `next` method.
* @returns {subscription} An object with an `unsubscribe` method that can
* be used to unsubscribe the observable from the store, and prevent further
* emission of values from the observable.
*/
subscribe: function subscribe(observer) {
if (typeof observer !== 'object' || observer === null) {
throw new TypeError('Expected the observer to be an object.');
}
function observeState() {
if (observer.next) {
observer.next(getState());
}
}
observeState();
var unsubscribe = outerSubscribe(observeState);
return {
unsubscribe: unsubscribe
};
}
}, _ref[symbol_observable__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]] = function () {
return this;
}, _ref;
} // When a store is created, an "INIT" action is dispatched so that every
// reducer returns their initial state. This effectively populates
// the initial state tree.
dispatch({
type: ActionTypes.INIT
});
return _ref2 = {
dispatch: dispatch,
subscribe: subscribe,
getState: getState,
replaceReducer: replaceReducer
}, _ref2[symbol_observable__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]] = observable, _ref2;
}
/**
* Prints a warning in the console if it exists.
*
* @param {String} message The warning message.
* @returns {void}
*/
function warning(message) {
/* eslint-disable no-console */
if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error(message);
}
/* eslint-enable no-console */
try {
// This error was thrown as a convenience so that if you enable
// "break on all exceptions" in your console,
// it would pause the execution at this line.
throw new Error(message);
} catch (e) {} // eslint-disable-line no-empty
}
function getUndefinedStateErrorMessage(key, action) {
var actionType = action && action.type;
var actionDescription = actionType && "action \"" + String(actionType) + "\"" || 'an action';
return "Given " + actionDescription + ", reducer \"" + key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined.";
}
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
var reducerKeys = Object.keys(reducers);
var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
if (reducerKeys.length === 0) {
return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
}
if (!isPlainObject(inputState)) {
return "The " + argumentName + " has unexpected type of \"" + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
}
var unexpectedKeys = Object.keys(inputState).filter(function (key) {
return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
});
unexpectedKeys.forEach(function (key) {
unexpectedKeyCache[key] = true;
});
if (action && action.type === ActionTypes.REPLACE) return;
if (unexpectedKeys.length > 0) {
return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored.");
}
}
function assertReducerShape(reducers) {
Object.keys(reducers).forEach(function (key) {
var reducer = reducers[key];
var initialState = reducer(undefined, {
type: ActionTypes.INIT
});
if (typeof initialState === 'undefined') {
throw new Error("Reducer \"" + key + "\" returned undefined during initialization. " + "If the state passed to the reducer is undefined, you must " + "explicitly return the initial state. The initial state may " + "not be undefined. If you don't want to set a value for this reducer, " + "you can use null instead of undefined.");
}
if (typeof reducer(undefined, {
type: ActionTypes.PROBE_UNKNOWN_ACTION()
}) === 'undefined') {
throw new Error("Reducer \"" + key + "\" returned undefined when probed with a random type. " + ("Don't try to handle " + ActionTypes.INIT + " or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the " + "current state for any unknown actions, unless it is undefined, " + "in which case you must return the initial state, regardless of the " + "action type. The initial state may not be undefined, but can be null.");
}
});
}
/**
* Turns an object whose values are different reducer functions, into a single
* reducer function. It will call every child reducer, and gather their results
* into a single state object, whose keys correspond to the keys of the passed
* reducer functions.
*
* @param {Object} reducers An object whose values correspond to different
* reducer functions that need to be combined into one. One handy way to obtain
* it is to use ES6 `import * as reducers` syntax. The reducers may never return
* undefined for any action. Instead, they should return their initial state
* if the state passed to them was undefined, and the current state for any
* unrecognized action.
*
* @returns {Function} A reducer function that invokes every reducer inside the
* passed object, and builds a state object with the same shape.
*/
function combineReducers(reducers) {
var reducerKeys = Object.keys(reducers);
var finalReducers = {};
for (var i = 0; i < reducerKeys.length; i++) {
var key = reducerKeys[i];
if (false) {}
if (typeof reducers[key] === 'function') {
finalReducers[key] = reducers[key];
}
}
var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same
// keys multiple times.
var unexpectedKeyCache;
if (false) {}
var shapeAssertionError;
try {
assertReducerShape(finalReducers);
} catch (e) {
shapeAssertionError = e;
}
return function combination(state, action) {
if (state === void 0) {
state = {};
}
if (shapeAssertionError) {
throw shapeAssertionError;
}
if (false) { var warningMessage; }
var hasChanged = false;
var nextState = {};
for (var _i = 0; _i < finalReducerKeys.length; _i++) {
var _key = finalReducerKeys[_i];
var reducer = finalReducers[_key];
var previousStateForKey = state[_key];
var nextStateForKey = reducer(previousStateForKey, action);
if (typeof nextStateForKey === 'undefined') {
var errorMessage = getUndefinedStateErrorMessage(_key, action);
throw new Error(errorMessage);
}
nextState[_key] = nextStateForKey;
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
}
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
return hasChanged ? nextState : state;
};
}
function bindActionCreator(actionCreator, dispatch) {
return function () {
return dispatch(actionCreator.apply(this, arguments));
};
}
/**
* Turns an object whose values are action creators, into an object with the
* same keys, but with every function wrapped into a `dispatch` call so they
* may be invoked directly. This is just a convenience method, as you can call
* `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
*
* For convenience, you can also pass an action creator as the first argument,
* and get a dispatch wrapped function in return.
*
* @param {Function|Object} actionCreators An object whose values are action
* creator functions. One handy way to obtain it is to use ES6 `import * as`
* syntax. You may also pass a single function.
*
* @param {Function} dispatch The `dispatch` function available on your Redux
* store.
*
* @returns {Function|Object} The object mimicking the original object, but with
* every action creator wrapped into the `dispatch` call. If you passed a
* function as `actionCreators`, the return value will also be a single
* function.
*/
function bindActionCreators(actionCreators, dispatch) {
if (typeof actionCreators === 'function') {
return bindActionCreator(actionCreators, dispatch);
}
if (typeof actionCreators !== 'object' || actionCreators === null) {
throw new Error("bindActionCreators expected an object or a function, instead received " + (actionCreators === null ? 'null' : typeof actionCreators) + ". " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
}
var boundActionCreators = {};
for (var key in actionCreators) {
var actionCreator = actionCreators[key];
if (typeof actionCreator === 'function') {
boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
}
}
return boundActionCreators;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
keys.push.apply(keys, Object.getOwnPropertySymbols(object));
}
if (enumerableOnly) keys = keys.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(source, true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(source).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
/**
* Composes single-argument functions from right to left. The rightmost
* function can take multiple arguments as it provides the signature for
* the resulting composite function.
*
* @param {...Function} funcs The functions to compose.
* @returns {Function} A function obtained by composing the argument functions
* from right to left. For example, compose(f, g, h) is identical to doing
* (...args) => f(g(h(...args))).
*/
function compose() {
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
funcs[_key] = arguments[_key];
}
if (funcs.length === 0) {
return function (arg) {
return arg;
};
}
if (funcs.length === 1) {
return funcs[0];
}
return funcs.reduce(function (a, b) {
return function () {
return a(b.apply(void 0, arguments));
};
});
}
/**
* Creates a store enhancer that applies middleware to the dispatch method
* of the Redux store. This is handy for a variety of tasks, such as expressing
* asynchronous actions in a concise manner, or logging every action payload.
*
* See `redux-thunk` package as an example of the Redux middleware.
*
* Because middleware is potentially asynchronous, this should be the first
* store enhancer in the composition chain.
*
* Note that each middleware will be given the `dispatch` and `getState` functions
* as named arguments.
*
* @param {...Function} middlewares The middleware chain to be applied.
* @returns {Function} A store enhancer applying the middleware.
*/
function applyMiddleware() {
for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
middlewares[_key] = arguments[_key];
}
return function (createStore) {
return function () {
var store = createStore.apply(void 0, arguments);
var _dispatch = function dispatch() {
throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');
};
var middlewareAPI = {
getState: store.getState,
dispatch: function dispatch() {
return _dispatch.apply(void 0, arguments);
}
};
var chain = middlewares.map(function (middleware) {
return middleware(middlewareAPI);
});
_dispatch = compose.apply(void 0, chain)(store.dispatch);
return _objectSpread2({}, store, {
dispatch: _dispatch
});
};
};
}
/*
* This is a dummy function to check if the function name has been altered by minification.
* If the function has been minified and NODE_ENV !== 'production', warn the user.
*/
function isCrushed() {}
if (false) {}
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var key = {
fullscreenEnabled: 0,
fullscreenElement: 1,
requestFullscreen: 2,
exitFullscreen: 3,
fullscreenchange: 4,
fullscreenerror: 5
};
var webkit = ['webkitFullscreenEnabled', 'webkitFullscreenElement', 'webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitfullscreenchange', 'webkitfullscreenerror'];
var moz = ['mozFullScreenEnabled', 'mozFullScreenElement', 'mozRequestFullScreen', 'mozCancelFullScreen', 'mozfullscreenchange', 'mozfullscreenerror'];
var ms = ['msFullscreenEnabled', 'msFullscreenElement', 'msRequestFullscreen', 'msExitFullscreen', 'MSFullscreenChange', 'MSFullscreenError'];
// so it doesn't throw if no window or document
var document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {};
var vendor = 'fullscreenEnabled' in document && Object.keys(key) || webkit[0] in document && webkit || moz[0] in document && moz || ms[0] in document && ms || [];
exports.default = {
requestFullscreen: function requestFullscreen(element) {
return element[vendor[key.requestFullscreen]]();
},
requestFullscreenFunction: function requestFullscreenFunction(element) {
return element[vendor[key.requestFullscreen]];
},
get exitFullscreen() {
return document[vendor[key.exitFullscreen]].bind(document);
},
addEventListener: function addEventListener(type, handler, options) {
return document.addEventListener(vendor[key[type]], handler, options);
},
removeEventListener: function removeEventListener(type, handler, options) {
return document.removeEventListener(vendor[key[type]], handler, options);
},
get fullscreenEnabled() {
return Boolean(document[vendor[key.fullscreenEnabled]]);
},
set fullscreenEnabled(val) {},
get fullscreenElement() {
return document[vendor[key.fullscreenElement]];
},
set fullscreenElement(val) {},
get onfullscreenchange() {
return document[('on' + vendor[key.fullscreenchange]).toLowerCase()];
},
set onfullscreenchange(handler) {
return document[('on' + vendor[key.fullscreenchange]).toLowerCase()] = handler;
},
get onfullscreenerror() {
return document[('on' + vendor[key.fullscreenerror]).toLowerCase()];
},
set onfullscreenerror(handler) {
return document[('on' + vendor[key.fullscreenerror]).toLowerCase()] = handler;
}
};
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = __webpack_require__(18);
const Windows1292Decoder_1 = __webpack_require__(137);
class Util {
/**
*
* @param buffer
* @param start
* @param end
* @param encoding // ToDo: ts.enum
* @return {number}
*/
static findZero(buffer, start, end, encoding) {
let i = start;
if (encoding === 'utf16') {
while (buffer[i] !== 0 || buffer[i + 1] !== 0) {
if (i >= end)
return end;
i += 2;
}
return i;
}
else {
while (buffer[i] !== 0) {
if (i >= end)
return end;
i++;
}
return i;
}
}
static trimRightNull(x) {
const pos0 = x.indexOf('\0');
return pos0 === -1 ? x : x.substr(0, pos0);
}
static swapBytes(buffer) {
const l = buffer.length;
assert.ok((l & 1) === 0, 'Buffer length must be even');
for (let i = 0; i < l; i += 2) {
const a = buffer[i];
buffer[i] = buffer[i + 1];
buffer[i + 1] = a;
}
return buffer;
}
static readUTF16String(buffer) {
let offset = 0;
if (buffer[0] === 0xFE && buffer[1] === 0xFF) { // big endian
buffer = Util.swapBytes(buffer);
offset = 2;
}
else if (buffer[0] === 0xFF && buffer[1] === 0xFE) { // little endian
offset = 2;
}
return buffer.toString('ucs2', offset);
}
/**
*
* @param buffer Decoder input data
* @param encoding 'utf16le' | 'utf16' | 'utf8' | 'iso-8859-1'
* @return {string}
*/
static decodeString(buffer, encoding) {
// annoying workaround for a double BOM issue
// https://github.com/leetreveil/musicmetadata/issues/84
if (buffer[0] === 0xFF && buffer[1] === 0xFE && buffer[2] === 0xFE && buffer[3] === 0xFF) {
buffer = buffer.slice(2);
}
if (encoding === 'utf16le' || encoding === 'utf16') {
return Util.readUTF16String(buffer);
}
else if (encoding === 'utf8') {
return buffer.toString('utf8');
}
else if (encoding === 'iso-8859-1') {
return Windows1292Decoder_1.Windows1292Decoder.decode(buffer);
}
throw Error(encoding + ' encoding is not supported!');
}
static stripNulls(str) {
str = str.replace(/^\x00+/g, '');
str = str.replace(/\x00+$/g, '');
return str;
}
/**
* Read bit-aligned number start from buffer
* Total offset in bits = byteOffset * 8 + bitOffset
* @param buf Byte buffer
* @param byteOffset Starting offset in bytes
* @param bitOffset Starting offset in bits: 0 = lsb
* @param len Length of number in bits
* @return {number} decoded bit aligned number
*/
static getBitAllignedNumber(buf, byteOffset, bitOffset, len) {
const byteOff = byteOffset + ~~(bitOffset / 8);
const bitOff = bitOffset % 8;
let value = buf[byteOff];
value &= 0xff >> bitOff;
const bitsRead = 8 - bitOff;
const bitsLeft = len - bitsRead;
if (bitsLeft < 0) {
value >>= (8 - bitOff - len);
}
else if (bitsLeft > 0) {
value <<= bitsLeft;
value |= Util.getBitAllignedNumber(buf, byteOffset, bitOffset + bitsRead, bitsLeft);
}
return value;
}
/**
* Read bit-aligned number start from buffer
* Total offset in bits = byteOffset * 8 + bitOffset
* @param buf Byte buffer
* @param byteOffset Starting offset in bytes
* @param bitOffset Starting offset in bits: 0 = most significant bit, 7 is least significant bit
* @return {number} decoded bit aligned number
*/
static isBitSet(buf, byteOffset, bitOffset) {
return Util.getBitAllignedNumber(buf, byteOffset, bitOffset, 1) === 1;
}
static a2hex(str) {
const arr = [];
for (let i = 0, l = str.length; i < l; i++) {
const hex = Number(str.charCodeAt(i)).toString(16);
arr.push(hex.length === 1 ? '0' + hex : hex);
}
return arr.join(' ');
}
}
Util.strtokBITSET = {
get: (buf, off, bit) => {
return (buf[off] & (1 << bit)) !== 0;
},
len: 1
};
exports.default = Util;
//# sourceMappingURL=Util.js.map
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {
Object.defineProperty(exports, "__esModule", { value: true });
const Util_1 = __webpack_require__(14);
const validFourCC = /^[\w-©][\w-\x000-3]/;
/**
* Token for read FourCC
* Ref: https://en.wikipedia.org/wiki/FourCC
*/
exports.FourCcToken = {
len: 4,
get: (buf, off) => {
const id = buf.toString("binary", off, off + exports.FourCcToken.len);
if (!id.match(validFourCC)) {
throw new Error(`FourCC contains invalid characters: ${Util_1.default.a2hex(id)}`);
}
return id;
},
put: (buffer, offset, id) => {
const str = Buffer.from(id, 'binary');
if (str.length !== 4)
throw new Error("Invalid length");
return str.copy(buffer, offset);
}
};
//# sourceMappingURL=FourCC.js.map
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(9).Buffer))
/***/ }),
/* 16 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "unpackString", function() { return /* binding */ unpackString; });
__webpack_require__.d(__webpack_exports__, "packString", function() { return /* binding */ packString; });
__webpack_require__.d(__webpack_exports__, "packStringTo", function() { return /* binding */ packStringTo; });
__webpack_require__.d(__webpack_exports__, "packArrayTo", function() { return /* binding */ packArrayTo; });
__webpack_require__.d(__webpack_exports__, "unpackArrayTo", function() { return /* binding */ unpackArrayTo; });
__webpack_require__.d(__webpack_exports__, "packTo", function() { return /* binding */ packTo; });
__webpack_require__.d(__webpack_exports__, "pack", function() { return /* binding */ byte_data_pack; });
__webpack_require__.d(__webpack_exports__, "packArray", function() { return /* binding */ packArray; });
__webpack_require__.d(__webpack_exports__, "unpackArray", function() { return /* binding */ unpackArray; });
__webpack_require__.d(__webpack_exports__, "unpack", function() { return /* binding */ byte_data_unpack; });
// CONCATENATED MODULE: /Users/jordaneldredge/projects/webamp/node_modules/endianness/endianness.js
/*
* Copyright (c) 2017-2018 Rafael da Silva Rocha.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/**
* @fileoverview A function to swap endianness in byte buffers.
* @see https://github.com/rochars/endianness
*/
/** @module endianness */
/**
* Swap the byte ordering in a buffer. The buffer is modified in place.
* @param {!Array|!Uint8Array} bytes The bytes.
* @param {number} offset The byte offset.
* @param {number=} start The start index. Assumes 0.
* @param {number=} end The end index. Assumes the buffer length.
* @throws {Error} If the buffer length is not valid.
*/
function endianness(bytes, offset, start=0, end=bytes.length) {
if (end % offset) {
throw new Error("Bad buffer length.");
}
for (let index = start; index < end; index += offset) {
swap(bytes, offset, index);
}
}
/**
* Swap the byte order of a value in a buffer. The buffer is modified in place.
* @param {!Array|!Uint8Array} bytes The bytes.
* @param {number} offset The byte offset.
* @param {number} index The start index.
* @private
*/
function swap(bytes, offset, index) {
offset--;
for(let x = 0; x < offset; x++) {
/** @type {*} */
let theByte = bytes[index + x];
bytes[index + x] = bytes[index + offset];
bytes[index + offset] = theByte;
offset--;
}
}
// CONCATENATED MODULE: /Users/jordaneldredge/projects/webamp/node_modules/utf8-buffer/index.js
/*
* Copyright (c) 2018 Rafael da Silva Rocha.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/**
* @fileoverview Functions to serialize and deserialize UTF-8 strings.
* @see https://github.com/rochars/utf8-buffer
* @see https://encoding.spec.whatwg.org/#the-encoding
* @see https://encoding.spec.whatwg.org/#utf-8-encoder
*/
/** @module utf8-buffer */
/**
* Read a string of UTF-8 characters from a byte buffer.
* Invalid characters are replaced with 'REPLACEMENT CHARACTER' (U+FFFD).
* @see https://encoding.spec.whatwg.org/#the-encoding
* @see https://stackoverflow.com/a/34926911
* @param {!Uint8Array|!Array<number>} buffer A byte buffer.
* @param {number=} start The buffer index to start reading.
* @param {?number=} end The buffer index to stop reading.
* Assumes the buffer length if undefined.
* @return {string}
*/
function unpack(buffer, start=0, end=buffer.length) {
/** @type {string} */
let str = '';
for(let index = start; index < end;) {
/** @type {number} */
let lowerBoundary = 0x80;
/** @type {number} */
let upperBoundary = 0xBF;
/** @type {boolean} */
let replace = false;
/** @type {number} */
let charCode = buffer[index++];
if (charCode >= 0x00 && charCode <= 0x7F) {
str += String.fromCharCode(charCode);
} else {
/** @type {number} */
let count = 0;
if (charCode >= 0xC2 && charCode <= 0xDF) {
count = 1;
} else if (charCode >= 0xE0 && charCode <= 0xEF ) {
count = 2;
if (buffer[index] === 0xE0) {
lowerBoundary = 0xA0;
}
if (buffer[index] === 0xED) {
upperBoundary = 0x9F;
}
} else if (charCode >= 0xF0 && charCode <= 0xF4 ) {
count = 3;
if (buffer[index] === 0xF0) {
lowerBoundary = 0x90;
}
if (buffer[index] === 0xF4) {
upperBoundary = 0x8F;
}
} else {
replace = true;
}
charCode = charCode & (1 << (8 - count - 1)) - 1;
for (let i = 0; i < count; i++) {
if (buffer[index] < lowerBoundary || buffer[index] > upperBoundary) {
replace = true;
}
charCode = (charCode << 6) | (buffer[index] & 0x3f);
index++;
}
if (replace) {
str += String.fromCharCode(0xFFFD);
}
else if (charCode <= 0xffff) {
str += String.fromCharCode(charCode);
} else {
charCode -= 0x10000;
str += String.fromCharCode(
((charCode >> 10) & 0x3ff) + 0xd800,
(charCode & 0x3ff) + 0xdc00);
}
}
}
return str;
}
/**
* Write a string of UTF-8 characters to a byte buffer.
* @see https://encoding.spec.whatwg.org/#utf-8-encoder
* @param {string} str The string to pack.
* @param {!Uint8Array|!Array<number>} buffer The buffer to pack the string to.
* @param {number=} index The buffer index to start writing.
* @return {number} The next index to write in the buffer.
*/
function pack(str, buffer, index=0) {
for (let i = 0, len = str.length; i < len; i++) {
/** @type {number} */
let codePoint = str.codePointAt(i);
if (codePoint < 128) {
buffer[index] = codePoint;
index++;
} else {
/** @type {number} */
let count = 0;
/** @type {number} */
let offset = 0;
if (codePoint <= 0x07FF) {
count = 1;
offset = 0xC0;
} else if(codePoint <= 0xFFFF) {
count = 2;
offset = 0xE0;
} else if(codePoint <= 0x10FFFF) {
count = 3;
offset = 0xF0;
i++;
}
buffer[index] = (codePoint >> (6 * count)) + offset;
index++;
while (count > 0) {
buffer[index] = 0x80 | (codePoint >> (6 * (count - 1)) & 0x3F);
index++;
count--;
}
}
}
return index;
}
// CONCATENATED MODULE: /Users/jordaneldredge/projects/webamp/node_modules/byte-data/lib/int-parser.js
/*
* Copyright (c) 2017-2018 Rafael da Silva Rocha.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/**
* @fileoverview Encode and decode int numbers to and from byte buffers.
* @see https://github.com/rochars/byte-data
*/
/**
* A class to write and read integer numbers to and from byte buffers.
*/
class IntParser {
/**
* @param {number} bits The number of bits used by the integer.
* @param {boolean} [signed=false] True for signed, false otherwise.
* @param {boolean} [clamp=false] True to clamp on overflow.
*/
constructor(bits, signed=false, clamp=false) {
/**
* The number of bits used by one number.
* @type {number}
*/
this.bits = bits;
/**
* The number of bytes used by one number.
* @type {number}
*/
this.bytes = bits < 8 ? 1 : Math.ceil(bits / 8);
/**
* @type {number}
* @protected
*/
this.max = Math.pow(2, bits) - 1;
/**
* @type {number}
* @protected
*/
this.min = 0;
/** @type {number} */
let r = 8 - ((((bits - 1) | 7) + 1) - bits);
/**
* @type {number}
* @private
*/
this.lastByteMask_ = Math.pow(2, r > 0 ? r : 8) - 1;
/**
* @type {Function}
* @protected
*/
this.unpack = this.unpackUnsigned_;
if (signed) {
this.max = Math.pow(2, bits) / 2 - 1;
this.min = -this.max - 1;
this.unpack = this.unpackSigned_;
}
if (clamp) {
this.overflow_ = this.overflowClamp_;
}
}
/**
* Write one unsigned integer to a byte buffer.
* @param {!(Uint8Array|Array<number>)} buffer An array of bytes.
* @param {number} num The number. Overflows are truncated.
* @param {number} [index=0] The index being written in the byte buffer.
* @return {number} The next index to write on the byte buffer.
*/
pack(buffer, num, index=0) {
if (num !== num || num.constructor != Number) {
throw new TypeError();
}
num = this.overflow_(num);
buffer[index] = (num < 0 ? num + Math.pow(2, this.bits) : num) & 255;
index++;
for (let i = 2, len = this.bytes; i < len; i++) {
buffer[index] = Math.floor(num / Math.pow(2, ((i - 1) * 8))) & 255;
index++;
}
if (this.bits > 8) {
buffer[index] = Math.floor(
num / Math.pow(2, ((this.bytes - 1) * 8))) & this.lastByteMask_;
index++;
}
return index;
}
/**
* Read one unsigned integer from a byte buffer.
* Does not check for overflows.
* @param {!(Uint8Array|Array<number>)} buffer An array of bytes.
* @param {number} [index=0] The index to read.
* @return {number}
*/
unpack_(buffer, index=0) {
/** @type {number} */
let num = 0;
for(let x = 0; x < this.bytes; x++) {
num += buffer[index + x] * Math.pow(256, x);
}
return num;
}
unpackUnsigned_(buffer, index=0) {
return this.overflow_(this.unpack_(buffer, index));
}
/**
* Read one two's complement signed integer from a byte buffer.
* @param {!(Uint8Array|Array<number>)} buffer An array of bytes.
* @param {number} [index=0] The index to read.
* @return {number}
*/
unpackSigned_(buffer, index=0) {
return this.overflow_(this.sign_(this.unpack_(buffer, index)));
}
/**
* Truncate values in case of overflow.
* @param {number} num The number.
* @private
*/
overflow_(num) {
if (num > this.max || num < this.min) {
throw new RangeError();
}
return num;
}
/**
* Truncate values in case of overflow.
* @param {number} num The number.
* @private
*/
overflowClamp_(num) {
if (num > this.max) {
return this.max;
} else if (num < this.min) {
return this.min;
}
return num;
}
/**
* Sign a number.
* @param {number} num The number.
* @return {number}
* @private
*/
sign_(num) {
if (num > this.max) {
num -= (this.max * 2) + 2;
}
return num;
}
}
// CONCATENATED MODULE: /Users/jordaneldredge/projects/webamp/node_modules/ieee754-buffer/index.js
/*
* Copyright (c) 2018-2019 Rafael da Silva Rocha.
* Copyright (c) 2013 DeNA Co., Ltd.
* Copyright (c) 2010, Linden Research, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/**
* @fileoverview Encode and decode IEEE 754 floating point numbers.
* @see https://github.com/rochars/ieee754-buffer
* @see https://bitbucket.org/lindenlab/llsd/raw/7d2646cd3f9b4c806e73aebc4b32bd81e4047fdc/js/typedarray.js
* @see https://github.com/kazuho/ieee754.js/blob/master/ieee754.js
*/
/**
* @module ieee754-buffer
*/
/**
* A class to encode and decode IEEE 754 floating-point numbers.
*/
class IEEE754Buffer {
/**
* Pack a IEEE 754 floating point number.
* @param {number} ebits The exponent bits.
* @param {number} fbits The fraction bits.
*/
constructor(ebits, fbits) {
/**
* @type {number}
* @private
*/
this.ebits = ebits;
/**
* @type {number}
* @private
*/
this.fbits = fbits;
/**
* @type {number}
* @private
*/
this.bias = (1 << (ebits - 1)) - 1;
/**
* @type {number}
* @private
*/
this.numBytes = Math.ceil((ebits + fbits) / 8);
/**
* @type {number}
* @private
*/
this.biasP2 = Math.pow(2, this.bias + 1);
/**
* @type {number}
* @private
*/
this.ebitsFbits = (ebits + fbits);
/**
* @type {number}
* @private
*/
this.fbias = Math.pow(2, -(8 * this.numBytes - 1 - ebits));
}
/**
* Pack a IEEE 754 floating point number.
* @param {!Uint8Array|!Array<number>} buffer The buffer.
* @param {number} num The number.
* @param {number} index The index to write on the buffer.
* @return {number} The next index to write on the buffer.
* @throws {TypeError} If input is not a number.
*/
pack(buffer, num, index) {
// Only numbers can be packed
if (typeof num != 'number') {
throw new TypeError();
}
// Round overflows
if (Math.abs(num) > this.biasP2 - (this.ebitsFbits * 2)) {
num = num < 0 ? -Infinity : Infinity;
}
/**
* sign, need this to handle negative zero
* @see http://cwestblog.com/2014/02/25/javascript-testing-for-negative-zero/
* @type {number}
*/
let sign = (((num = +num) || 1 / num) < 0) ? 1 : num < 0 ? 1 : 0;
num = Math.abs(num);
/** @type {number} */
let exp = Math.min(Math.floor(Math.log(num) / Math.LN2), 1023);
/** @type {number} */
let fraction = roundToEven(num / Math.pow(2, exp) * Math.pow(2, this.fbits));
// NaN
if (num !== num) {
fraction = Math.pow(2, this.fbits - 1);
exp = (1 << this.ebits) - 1;
// Number
} else if (num !== 0) {
if (num >= Math.pow(2, 1 - this.bias)) {
if (fraction / Math.pow(2, this.fbits) >= 2) {
exp = exp + 1;
fraction = 1;
}
// Overflow
if (exp > this.bias) {
exp = (1 << this.ebits) - 1;
fraction = 0;
} else {
exp = exp + this.bias;
fraction = roundToEven(fraction) - Math.pow(2, this.fbits);
}
} else {
fraction = roundToEven(num / Math.pow(2, 1 - this.bias - this.fbits));
exp = 0;
}
}
return this.packFloatBits_(buffer, index, sign, exp, fraction);
}
/**
* Unpack a IEEE 754 floating point number.
* Derived from IEEE754 by DeNA Co., Ltd., MIT License.
* Adapted to handle NaN. Should port the solution to the original repo.
* @param {!Uint8Array|!Array<number>} buffer The buffer.
* @param {number} index The index to read from the buffer.
* @return {number} The floating point number.
*/
unpack(buffer, index) {
/** @type {number} */
let eMax = (1 << this.ebits) - 1;
/** @type {number} */
let significand;
/** @type {string} */
let leftBits = "";
for (let i = this.numBytes - 1; i >= 0 ; i--) {
/** @type {string} */
let t = buffer[i + index].toString(2);
leftBits += "00000000".substring(t.length) + t;
}
/** @type {number} */
let sign = leftBits.charAt(0) == "1" ? -1 : 1;
leftBits = leftBits.substring(1);
/** @type {number} */
let exponent = parseInt(leftBits.substring(0, this.ebits), 2);
leftBits = leftBits.substring(this.ebits);
if (exponent == eMax) {
if (parseInt(leftBits, 2) !== 0) {
return NaN;
}
return sign * Infinity;
} else if (exponent === 0) {
exponent += 1;
significand = parseInt(leftBits, 2);
} else {
significand = parseInt("1" + leftBits, 2);
}
return sign * significand * this.fbias * Math.pow(2, exponent - this.bias);
}
/**
* Pack a IEEE754 from its sign, exponent and fraction bits
* and place it in a byte buffer.
* @param {!Uint8Array|!Array<number>} buffer The byte buffer to write to.
* @param {number} index The buffer index to write.
* @param {number} sign The sign.
* @param {number} exp the exponent.
* @param {number} fraction The fraction.
* @return {number}
* @private
*/
packFloatBits_(buffer, index, sign, exp, fraction) {
/** @type {!Array<number>} */
let bits = [];
// the sign
bits.push(sign);
// the exponent
for (let i = this.ebits; i > 0; i -= 1) {
bits[i] = (exp % 2 ? 1 : 0);
exp = Math.floor(exp / 2);
}
// the fraction
let len = bits.length;
for (let i = this.fbits; i > 0; i -= 1) {
bits[len + i] = (fraction % 2 ? 1 : 0);
fraction = Math.floor(fraction / 2);
}
// pack as bytes
/** @type {string} */
let str = bits.join('');
/** @type {number} */
let numBytes = this.numBytes + index - 1;
/** @type {number} */
let k = index;
while (numBytes >= index) {
buffer[numBytes] = parseInt(str.substring(0, 8), 2);
str = str.substring(8);
numBytes--;
k++;
}
return k;
}
}
/**
* Round a number to its nearest even value.
* @param {number} n The number.
* @return {number}
* @private
*/
function roundToEven(n) {
/** @type {number} */
let w = Math.floor(n);
let f = n - w;
if (f < 0.5) {
return w;
}
if (f > 0.5) {
return w + 1;
}
return w % 2 ? w + 1 : w;
}
// CONCATENATED MODULE: /Users/jordaneldredge/projects/webamp/node_modules/byte-data/index.js
/*
* Copyright (c) 2017-2019 Rafael da Silva Rocha.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/**
* @fileoverview JavaScript binary parser for any browser or environment.
* @see https://github.com/rochars/byte-data
*/
/** @module byte-data */
/**
* Read a string of UTF-8 characters from a byte buffer.
* @param {!(Uint8Array|Array<number>)} buffer A byte buffer.
* @param {number} [index=0] The buffer index to start reading.
* @param {number} [end=buffer.length] The index to stop reading, non inclusive.
* @return {string}
*/
function unpackString(buffer, index=0, end=buffer.length) {
return unpack(buffer, index, end);
}
/**
* Write a string of UTF-8 characters as a byte buffer.
* @param {string} str The string to pack.
* @return {!Array<number>} The UTF-8 string bytes.
*/
function packString(str) {
/** @type {!Array<number>} */
let buffer = [];
pack(str, buffer, 0);
return buffer;
}
/**
* Write a string of UTF-8 characters to a byte buffer.
* @param {string} str The string to pack.
* @param {!(Uint8Array|Array<number>)} buffer The output buffer.
* @param {number} [index=0] The buffer index to start writing.
* @return {number} The next index to write in the buffer.
*/
function packStringTo(str, buffer, index=0) {
return pack(str, buffer, index);
}
// Numbers
/**
* Pack a array of numbers to a byte buffer.
* All other packing functions are interfaces to this function.
* @param {!(Array<number>|TypedArray)} values The values to pack.
* @param {!{bits:number,
* fp: (boolean|undefined),
* signed: (boolean|undefined),
* be: (boolean|undefined)}} theType The type definition.
* @param {!(Uint8Array|Array<number>)} buffer The buffer to write on.
* @param {number} [index=0] The buffer index to start writing.
* @param {boolean} [clamp=false] True to clamp ints on overflow.
* @return {number} The next index to write.
* @throws {Error} If the type definition is not valid.
* @throws {RangeError} On overflow.
* @throws {TypeError} If input is not valid.
*/
function packArrayTo(values, theType, buffer, index=0, clamp=false) {
theType = theType || {};
/** @type {!Object} */
let packer = getParser_(theType.bits, theType.fp, theType.signed, clamp);
/** @type {number} */
let offset = Math.ceil(theType.bits / 8);
/** @type {number} */
let i = 0;
/** @type {number} */
let start = index;
try {
for (let valuesLen = values.length; i < valuesLen; i++) {
index = packer.pack(buffer, values[i], index);
}
if (theType.be) {
endianness(buffer, offset, start, index);
}
} catch (e) {
throwValueError_(e, values[i], i);
}
return index;
}
/**
* Unpack a array of numbers from a byte buffer to a array or a typed array.
* All other unpacking functions are interfaces to this function.
* @param {!(Uint8Array|Array<number>)} buffer The byte buffer.
* @param {!{bits:number,
* fp: (boolean|undefined),
* signed: (boolean|undefined),
* be: (boolean|undefined)}} theType The type definition.
* @param {!(TypedArray|Array<number>)} output The output array or typed array.
* @param {number} [start=0] The buffer index to start reading.
* @param {number} [end=buffer.length] The buffer index to stop reading.
* @param {boolean} [safe=false] If set to false, extra bytes in the end of
* the array are ignored and input buffers with insufficient bytes will
* write nothing to the output array. If safe is set to true the function
* will throw a 'Bad buffer length' error.
* @param {boolean} [clamp=false] True to clamp ints on overflow.
* @throws {Error} If the type definition is not valid
* @throws {RangeError} On overflow
*/
function unpackArrayTo(
buffer, theType, output, start=0, end=buffer.length,
safe=false, clamp=false) {
theType = theType || {};
/** @type {!Object} */
let packer = getParser_(theType.bits, theType.fp, theType.signed, clamp);
/** @type {number} */
let offset = Math.ceil(theType.bits / 8);
// getUnpackLen_ will either fix the length of the input buffer
// according to the byte offset of the type (on unsafe mode) or
// throw a Error if the input buffer has a bad length (on safe mode)
end = getUnpackLen_(buffer, start, end, offset, safe);
/** @type {number} */
let index = 0;
let j = start;
try {
if (theType.be) {
endianness(buffer, offset, start, end);
}
for (; j < end; j += offset, index++) {
output[index] = packer.unpack(buffer, j);
}
if (theType.be) {
endianness(buffer, offset, start, end);
}
} catch (e) {
throwValueError_(e, buffer.slice(j, j + offset), j);
}
}
/**
* Pack a number to a byte buffer.
* @param {number} value The value.
* @param {!{bits:number,
* fp: (boolean|undefined),
* signed: (boolean|undefined),
* be: (boolean|undefined)}} theType The type definition.
* @param {!(Uint8Array|Array<number>)} buffer The byte buffer to write on.
* @param {number} [index=0] The buffer index to write.
* @param {boolean} [clamp=false] True to clamp ints on overflow.
* @return {number} The next index to write.
* @throws {Error} If the type definition is not valid.
* @throws {RangeError} On overflow.
* @throws {TypeError} If input is not valid.
*/
function packTo(value, theType, buffer, index=0, clamp=false) {
return packArrayTo([value], theType, buffer, index, clamp);
}
/**
* Pack a number as a array of bytes.
* @param {number} value The number to pack.
* @param {!{bits:number,
* fp: (boolean|undefined),
* signed: (boolean|undefined),
* be: (boolean|undefined)}} theType The type definition.
* @param {boolean} [clamp=false] True to clamp ints on overflow.
* @return {!Array<number>} The packed value.
* @throws {Error} If the type definition is not valid.
* @throws {RangeError} On overflow.
* @throws {TypeError} If input is not valid.
*/
function byte_data_pack(value, theType, clamp=false) {
/** @type {!Array<number>} */
let output = [];
packTo(value, theType, output, 0, clamp);
return output;
}
/**
* Pack a array of numbers as a array of bytes.
* @param {!(Array<number>|TypedArray)} values The values to pack.
* @param {!{bits:number,
* fp: (boolean|undefined),
* signed: (boolean|undefined),
* be: (boolean|undefined)}} theType The type definition.
* @param {boolean} [clamp=false] True to clamp ints on overflow.
* @return {!Array<number>} The packed values.
* @throws {Error} If the type definition is not valid.
* @throws {RangeError} On overflow.
* @throws {TypeError} If input is not valid.
*/
function packArray(values, theType, clamp=false) {
/** @type {!Array<number>} */
let output = [];
packArrayTo(values, theType, output, 0, clamp);
return output;
}
/**
* Unpack a array of numbers from a byte buffer.
* @param {!(Uint8Array|Array<number>)} buffer The byte buffer.
* @param {!{bits:number,
* fp: (boolean|undefined),
* signed: (boolean|undefined),
* be: (boolean|undefined)}} theType The type definition.
* @param {number} [start=0] The buffer index to start reading.
* @param {number} [end=buffer.length] The buffer index to stop reading.
* @param {boolean} [safe=false] If set to false, extra bytes in the end of
* the array are ignored and input buffers with insufficient bytes will
* output a empty array. If safe is set to true the function
* will throw a 'Bad buffer length' error.
* @param {boolean} [clamp=false] True to clamp ints on overflow.
* @return {!Array<number>}
* @throws {Error} If the type definition is not valid
* @throws {RangeError} On overflow
*/
function unpackArray(
buffer, theType, start=0, end=buffer.length, safe=false, clamp=false) {
/** @type {!Array<number>} */
let output = [];
unpackArrayTo(buffer, theType, output, start, end, safe, clamp);
return output;
}
/**
* Unpack a number from a byte buffer.
* @param {!(Uint8Array|Array<number>)} buffer The byte buffer.
* @param {!{bits:number,
* fp: (boolean|undefined),
* signed: (boolean|undefined),
* be: (boolean|undefined)}} theType The type definition.
* @param {number} [index=0] The buffer index to read.
* @param {boolean} [clamp=false] True to clamp ints on overflow.
* @return {number}
* @throws {Error} If the type definition is not valid
* @throws {Error} On bad buffer length.
* @throws {RangeError} On overflow
*/
function byte_data_unpack(buffer, theType, index=0, clamp=false) {
return unpackArray(
buffer, theType, index, index + Math.ceil(theType.bits / 8),
true, clamp)[0];
}
/**
* Throw a error with information about the problem.
* @param {!Object} err The Error object that is being raised.
* @param {*} value The value that caused the error.
* @param {number} index The index of the value that caused the error.
* @throws {RangeError|TypeError|Error} A Error with a message.
* @private
*/
function throwValueError_(err, value, index) {
err.message = err.constructor.name +
' at index ' + index + ': ' + value;
throw err;
}
/**
* Unpack a array of numbers to a typed array.
* All other unpacking functions are interfaces to this function.
* @param {!(Uint8Array|Array<number>)} buffer The byte buffer.
* @param {number} start The buffer index to start reading.
* @param {number} end The buffer index to stop reading.
* @param {number} offset The number of bytes used by the type.
* @param {boolean} safe True for size-safe buffer reading.
* @throws {Error} On bad buffer length, if safe.
* @private
*/
function getUnpackLen_(buffer, start, end, offset, safe) {
/** @type {number} */
let extra = (end - start) % offset;
if (safe && (extra || buffer.length < offset)) {
throw new Error('Bad buffer length');
}
return end - extra;
}
/**
* Return a parser for int, uint or fp numbers.
* @param {number} bits The number of bits.
* @param {boolean|undefined} fp True for fp numbers, false otherwise.
* @param {boolean|undefined} signed True for signed ints, false otherwise.
* @param {boolean|undefined} clamp True to clamp ints on overflow, false otherwise.
* @return {!Object}
* @private
*/
function getParser_(bits, fp, signed, clamp) {
if (fp) {
validateFloatType(bits);
} else {
validateIntType(bits);
}
if (fp && bits === 16) {
return new IEEE754Buffer(5, 11);
} else if (fp && bits == 32) {
return new IEEE754Buffer(8, 23);
} else if(fp && bits == 64) {
return new IEEE754Buffer(11, 52);
}
return new IntParser(bits, signed, clamp);
}
/**
* The type definition error message.
* @type {string}
* @private
*/
const TYPE_ERR = 'Unsupported type';
/**
* Validate the type definition of floating-point numbers.
* @param {number} bits The number of bits.
* @throws {Error} If the type definition is not valid.
* @private
*/
function validateFloatType(bits) {
if (!bits || bits !== 16 && bits !== 32 && bits !== 64) {
throw new Error(TYPE_ERR + ': float, bits: ' + bits);
}
}
/**
* Validate the type definition of integers.
* @param {number} bits The number of bits.
* @throws {Error} If the type definition is not valid.
* @private
*/
function validateIntType(bits) {
if (!bits || bits < 1 || bits > 53) {
throw new Error(TYPE_ERR + ': int, bits: ' + bits);
}
}
/***/ }),
/* 17 */
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || new Function("return this")();
} catch (e) {
// This works if the window reference is available
if (typeof window === "object") g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
var objectAssign = __webpack_require__(23);
// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
// original notice:
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
function compare(a, b) {
if (a === b) {
return 0;
}
var x = a.length;
var y = b.length;
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
if (a[i] !== b[i]) {
x = a[i];
y = b[i];
break;
}
}
if (x < y) {
return -1;
}
if (y < x) {
return 1;
}
return 0;
}
function isBuffer(b) {
if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
return global.Buffer.isBuffer(b);
}
return !!(b != null && b._isBuffer);
}
// based on node assert, original notice:
// NB: The URL to the CommonJS spec is kept just for tradition.
// node-assert has evolved a lot since then, both in API and behavior.
// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
//
// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
//
// Originally from narwhal.js (http://narwhaljs.org)
// Copyright (c) 2009 Thomas Robinson <280north.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
var util = __webpack_require__(126);
var hasOwn = Object.prototype.hasOwnProperty;
var pSlice = Array.prototype.slice;
var functionsHaveNames = (function () {
return function foo() {}.name === 'foo';
}());
function pToString (obj) {
return Object.prototype.toString.call(obj);
}
function isView(arrbuf) {
if (isBuffer(arrbuf)) {
return false;
}
if (typeof global.ArrayBuffer !== 'function') {
return false;
}
if (typeof ArrayBuffer.isView === 'function') {
return ArrayBuffer.isView(arrbuf);
}
if (!arrbuf) {
return false;
}
if (arrbuf instanceof DataView) {
return true;
}
if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
return true;
}
return false;
}
// 1. The assert module provides functions that throw
// AssertionError's when particular conditions are not met. The
// assert module must conform to the following interface.
var assert = module.exports = ok;
// 2. The AssertionError is defined in assert.
// new assert.AssertionError({ message: message,
// actual: actual,
// expected: expected })
var regex = /\s*function\s+([^\(\s]*)\s*/;
// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
function getName(func) {
if (!util.isFunction(func)) {
return;
}
if (functionsHaveNames) {
return func.name;
}
var str = func.toString();
var match = str.match(regex);
return match && match[1];
}
assert.AssertionError = function AssertionError(options) {
this.name = 'AssertionError';
this.actual = options.actual;
this.expected = options.expected;
this.operator = options.operator;
if (options.message) {
this.message = options.message;
this.generatedMessage = false;
} else {
this.message = getMessage(this);
this.generatedMessage = true;
}
var stackStartFunction = options.stackStartFunction || fail;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, stackStartFunction);
} else {
// non v8 browsers so we can have a stacktrace
var err = new Error();
if (err.stack) {
var out = err.stack;
// try to strip useless frames
var fn_name = getName(stackStartFunction);
var idx = out.indexOf('\n' + fn_name);
if (idx >= 0) {
// once we have located the function frame
// we need to strip out everything before it (and its line)
var next_line = out.indexOf('\n', idx + 1);
out = out.substring(next_line + 1);
}
this.stack = out;
}
}
};
// assert.AssertionError instanceof Error
util.inherits(assert.AssertionError, Error);
function truncate(s, n) {
if (typeof s === 'string') {
return s.length < n ? s : s.slice(0, n);
} else {
return s;
}
}
function inspect(something) {
if (functionsHaveNames || !util.isFunction(something)) {
return util.inspect(something);
}
var rawname = getName(something);
var name = rawname ? ': ' + rawname : '';
return '[Function' + name + ']';
}
function getMessage(self) {
return truncate(inspect(self.actual), 128) + ' ' +
self.operator + ' ' +
truncate(inspect(self.expected), 128);
}
// At present only the three keys mentioned above are used and
// understood by the spec. Implementations or sub modules can pass
// other keys to the AssertionError's constructor - they will be
// ignored.
// 3. All of the following functions must throw an AssertionError
// when a corresponding condition is not met, with a message that
// may be undefined if not provided. All assertion methods provide
// both the actual and expected values to the assertion error for
// display purposes.
function fail(actual, expected, message, operator, stackStartFunction) {
throw new assert.AssertionError({
message: message,
actual: actual,
expected: expected,
operator: operator,
stackStartFunction: stackStartFunction
});
}
// EXTENSION! allows for well behaved errors defined elsewhere.
assert.fail = fail;
// 4. Pure assertion tests whether a value is truthy, as determined
// by !!guard.
// assert.ok(guard, message_opt);
// This statement is equivalent to assert.equal(true, !!guard,
// message_opt);. To test strictly for the value true, use
// assert.strictEqual(true, guard, message_opt);.
function ok(value, message) {
if (!value) fail(value, true, message, '==', assert.ok);
}
assert.ok = ok;
// 5. The equality assertion tests shallow, coercive equality with
// ==.
// assert.equal(actual, expected, message_opt);
assert.equal = function equal(actual, expected, message) {
if (actual != expected) fail(actual, expected, message, '==', assert.equal);
};
// 6. The non-equality assertion tests for whether two objects are not equal
// with != assert.notEqual(actual, expected, message_opt);
assert.notEqual = function notEqual(actual, expected, message) {
if (actual == expected) {
fail(actual, expected, message, '!=', assert.notEqual);
}
};
// 7. The equivalence assertion tests a deep equality relation.
// assert.deepEqual(actual, expected, message_opt);
assert.deepEqual = function deepEqual(actual, expected, message) {
if (!_deepEqual(actual, expected, false)) {
fail(actual, expected, message, 'deepEqual', assert.deepEqual);
}
};
assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
if (!_deepEqual(actual, expected, true)) {
fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
}
};
function _deepEqual(actual, expected, strict, memos) {
// 7.1. All identical values are equivalent, as determined by ===.
if (actual === expected) {
return true;
} else if (isBuffer(actual) && isBuffer(expected)) {
return compare(actual, expected) === 0;
// 7.2. If the expected value is a Date object, the actual value is
// equivalent if it is also a Date object that refers to the same time.
} else if (util.isDate(actual) && util.isDate(expected)) {
return actual.getTime() === expected.getTime();
// 7.3 If the expected value is a RegExp object, the actual value is
// equivalent if it is also a RegExp object with the same source and
// properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
} else if (util.isRegExp(actual) && util.isRegExp(expected)) {
return actual.source === expected.source &&
actual.global === expected.global &&
actual.multiline === expected.multiline &&
actual.lastIndex === expected.lastIndex &&
actual.ignoreCase === expected.ignoreCase;
// 7.4. Other pairs that do not both pass typeof value == 'object',
// equivalence is determined by ==.
} else if ((actual === null || typeof actual !== 'object') &&
(expected === null || typeof expected !== 'object')) {
return strict ? actual === expected : actual == expected;
// If both values are instances of typed arrays, wrap their underlying
// ArrayBuffers in a Buffer each to increase performance
// This optimization requires the arrays to have the same type as checked by
// Object.prototype.toString (aka pToString). Never perform binary
// comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
// bit patterns are not identical.
} else if (isView(actual) && isView(expected) &&
pToString(actual) === pToString(expected) &&
!(actual instanceof Float32Array ||
actual instanceof Float64Array)) {
return compare(new Uint8Array(actual.buffer),
new Uint8Array(expected.buffer)) === 0;
// 7.5 For all other Object pairs, including Array objects, equivalence is
// determined by having the same number of owned properties (as verified
// with Object.prototype.hasOwnProperty.call), the same set of keys
// (although not necessarily the same order), equivalent values for every
// corresponding key, and an identical 'prototype' property. Note: this
// accounts for both named and indexed properties on Arrays.
} else if (isBuffer(actual) !== isBuffer(expected)) {
return false;
} else {
memos = memos || {actual: [], expected: []};
var actualIndex = memos.actual.indexOf(actual);
if (actualIndex !== -1) {
if (actualIndex === memos.expected.indexOf(expected)) {
return true;
}
}
memos.actual.push(actual);
memos.expected.push(expected);
return objEquiv(actual, expected, strict, memos);
}
}
function isArguments(object) {
return Object.prototype.toString.call(object) == '[object Arguments]';
}
function objEquiv(a, b, strict, actualVisitedObjects) {
if (a === null || a === undefined || b === null || b === undefined)
return false;
// if one is a primitive, the other must be same
if (util.isPrimitive(a) || util.isPrimitive(b))
return a === b;
if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
return false;
var aIsArgs = isArguments(a);
var bIsArgs = isArguments(b);
if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
return false;
if (aIsArgs) {
a = pSlice.call(a);
b = pSlice.call(b);
return _deepEqual(a, b, strict);
}
var ka = objectKeys(a);
var kb = objectKeys(b);
var key, i;
// having the same number of owned properties (keys incorporates
// hasOwnProperty)
if (ka.length !== kb.length)
return false;
//the same set of keys (although not necessarily the same order),
ka.sort();
kb.sort();
//~~~cheap key test
for (i = ka.length - 1; i >= 0; i--) {
if (ka[i] !== kb[i])
return false;
}
//equivalent values for every corresponding key, and
//~~~possibly expensive deep test
for (i = ka.length - 1; i >= 0; i--) {
key = ka[i];
if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
return false;
}
return true;
}
// 8. The non-equivalence assertion tests for any deep inequality.
// assert.notDeepEqual(actual, expected, message_opt);
assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
if (_deepEqual(actual, expected, false)) {
fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
}
};
assert.notDeepStrictEqual = notDeepStrictEqual;
function notDeepStrictEqual(actual, expected, message) {
if (_deepEqual(actual, expected, true)) {
fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
}
}
// 9. The strict equality assertion tests strict equality, as determined by ===.
// assert.strictEqual(actual, expected, message_opt);
assert.strictEqual = function strictEqual(actual, expected, message) {
if (actual !== expected) {
fail(actual, expected, message, '===', assert.strictEqual);
}
};
// 10. The strict non-equality assertion tests for strict inequality, as
// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
if (actual === expected) {
fail(actual, expected, message, '!==', assert.notStrictEqual);
}
};
function expectedException(actual, expected) {
if (!actual || !expected) {
return false;
}
if (Object.prototype.toString.call(expected) == '[object RegExp]') {
return expected.test(actual);
}
try {
if (actual instanceof expected) {
return true;
}
} catch (e) {
// Ignore. The instanceof check doesn't work for arrow functions.
}
if (Error.isPrototypeOf(expected)) {
return false;
}
return expected.call({}, actual) === true;
}
function _tryBlock(block) {
var error;
try {
block();
} catch (e) {
error = e;
}
return error;
}
function _throws(shouldThrow, block, expected, message) {
var actual;
if (typeof block !== 'function') {
throw new TypeError('"block" argument must be a function');
}
if (typeof expected === 'string') {
message = expected;
expected = null;
}
actual = _tryBlock(block);
message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
(message ? ' ' + message : '.');
if (shouldThrow && !actual) {
fail(actual, expected, 'Missing expected exception' + message);
}
var userProvidedMessage = typeof message === 'string';
var isUnwantedException = !shouldThrow && util.isError(actual);
var isUnexpectedException = !shouldThrow && actual && !expected;
if ((isUnwantedException &&
userProvidedMessage &&
expectedException(actual, expected)) ||
isUnexpectedException) {
fail(actual, expected, 'Got unwanted exception' + message);
}
if ((shouldThrow && actual && expected &&
!expectedException(actual, expected)) || (!shouldThrow && actual)) {
throw actual;
}
}
// 11. Expected to throw an error:
// assert.throws(block, Error_opt, message_opt);
assert.throws = function(block, /*optional*/error, /*optional*/message) {
_throws(true, block, error, message);
};
// EXTENSION! This is annoying to write outside this module.
assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
_throws(false, block, error, message);
};
assert.ifError = function(err) { if (err) throw err; };
// Expose a strict only variant of assert
function strict(value, message) {
if (!value) fail(value, true, message, '==', strict);
}
assert.strict = objectAssign(strict, assert, {
equal: assert.strictEqual,
deepEqual: assert.deepStrictEqual,
notEqual: assert.notStrictEqual,
notDeepEqual: assert.notDeepStrictEqual
});
assert.strict.strict = assert.strict;
var objectKeys = Object.keys || function (obj) {
var keys = [];
for (var key in obj) {
if (hasOwn.call(obj, key)) keys.push(key);
}
return keys;
};
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(17)))
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var invariant = function(condition, format, a, b, c, d, e, f) {
if (false) {}
if (!condition) {
var error;
if (format === undefined) {
error = new Error(
'Minified exception occurred; use the non-minified dev environment ' +
'for the full error message and additional helpful warnings.'
);
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(
format.replace(/%s/g, function() { return args[argIndex++]; })
);
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
};
module.exports = invariant;
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class BasicParser {
constructor() {
this.warnings = []; // ToDo: make these part of the parsing result
}
/**
* Initialize parser with output (metadata), input (tokenizer) & parsing options (options).
* @param {INativeMetadataCollector} metadata Output
* @param {ITokenizer} tokenizer Input
* @param {IOptions} options Parsing options
*/
init(metadata, tokenizer, options) {
this.metadata = metadata;
this.tokenizer = tokenizer;
this.options = options;
return this;
}
}
exports.BasicParser = BasicParser;
//# sourceMappingURL=BasicParser.js.map
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ID3v1Parser_1 = __webpack_require__(48);
class CommonTagMapper {
constructor(tagTypes, tagMap) {
this.tagTypes = tagTypes;
this.tagMap = tagMap;
}
static parseGenre(origVal) {
// match everything inside parentheses
const split = origVal.trim().split(/\((.*?)\)/g).filter(val => {
return val !== '';
});
const array = [];
for (let cur of split) {
if (/^\d+$/.test(cur) && !isNaN(parseInt(cur, 10))) {
cur = ID3v1Parser_1.Genres[cur];
}
array.push(cur);
}
return array
.filter(val => {
return val !== undefined;
}).join('/');
}
static fixPictureMimeType(pictureType) {
pictureType = pictureType.toLocaleLowerCase();
switch (pictureType) {
case 'image/jpg':
return 'image/jpeg'; // ToDo: register warning
}
return pictureType;
}
static toIntOrNull(str) {
const cleaned = parseInt(str, 10);
return isNaN(cleaned) ? null : cleaned;
}
// TODO: a string of 1of1 would fail to be converted
// converts 1/10 to no : 1, of : 10
// or 1 to no : 1, of : 0
static normalizeTrack(origVal) {
const split = origVal.toString().split('/');
return {
no: parseInt(split[0], 10) || null,
of: parseInt(split[1], 10) || null
};
}
/**
* Process and set common tags
* @param comTags Target metadata to
* write common tags to
* @param tag Native tag
* @param value Native tag value
* @return common name
*/
mapGenericTag(tag) {
tag = { id: tag.id, value: tag.value }; // clone object
this.postMap(tag);
// Convert native tag event to generic 'alias' tag
const id = this.getCommonName(tag.id);
return id ? { id, value: tag.value } : null;
}
/**
* Convert native tag key to common tag key
* @tag Native header tag
* @return common tag name (alias)
*/
getCommonName(tag) {
return this.tagMap[tag];
}
/**
* Handle post mapping exceptions / correction
* @param {string} tag Tag e.g. {"©alb", "Buena Vista Social Club")
*/
postMap(tag) {
return;
}
}
CommonTagMapper.maxRatingScore = 1;
exports.CommonTagMapper = CommonTagMapper;
//# sourceMappingURL=GenericTagMapper.js.map
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Used to reject read if end-of-Stream or end-of-file is reached
* @type {Error}
*/
exports.endOfFile = "End-Of-File";
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
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;
}
}
module.exports = 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;
};
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// a duplex stream is just a stream that is both readable and writable.
// Since JS doesn't have multiple prototypal inheritance, this class
// prototypally inherits from Readable, and then parasitically from
// Writable.
/*<replacement>*/
var pna = __webpack_require__(44);
/*</replacement>*/
/*<replacement>*/
var objectKeys = Object.keys || function (obj) {
var keys = [];
for (var key in obj) {
keys.push(key);
}return keys;
};
/*</replacement>*/
module.exports = Duplex;
/*<replacement>*/
var util = Object.create(__webpack_require__(34));
util.inherits = __webpack_require__(31);
/*</replacement>*/
var Readable = __webpack_require__(107);
var Writable = __webpack_require__(53);
util.inherits(Duplex, Readable);
{
// avoid scope creep, the keys array can then be collected
var keys = objectKeys(Writable.prototype);
for (var v = 0; v < keys.length; v++) {
var method = keys[v];
if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
}
}
function Duplex(options) {
if (!(this instanceof Duplex)) return new Duplex(options);
Readable.call(this, options);
Writable.call(this, options);
if (options && options.readable === false) this.readable = false;
if (options && options.writable === false) this.writable = false;
this.allowHalfOpen = true;
if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
this.once('end', onend);
}
Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function () {
return this._writableState.highWaterMark;
}
});
// the no-half-open enforcer
function onend() {
// if we allow half-open state, or if the writable side ended,
// then we're ok.
if (this.allowHalfOpen || this._writableState.ended) return;
// no more data can be written.
// But allow more writes to happen in this tick.
pna.nextTick(onEndNT, this);
}
function onEndNT(self) {
self.end();
}
Object.defineProperty(Duplex.prototype, 'destroyed', {
get: function () {
if (this._readableState === undefined || this._writableState === undefined) {
return false;
}
return this._readableState.destroyed && this._writableState.destroyed;
},
set: function (value) {
// we ignore the value if the stream
// has not been initialized yet
if (this._readableState === undefined || this._writableState === undefined) {
return;
}
// backward compatibility, the user is explicitly
// managing destroyed
this._readableState.destroyed = value;
this._writableState.destroyed = value;
}
});
Duplex.prototype._destroy = function (err, cb) {
this.push(null);
this.end();
pna.nextTick(cb, err);
};
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
var root = __webpack_require__(79);
/** Built-in value references. */
var Symbol = root.Symbol;
module.exports = Symbol;
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__(63);
} else {}
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var reactIs = __webpack_require__(26);
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
var REACT_STATICS = {
childContextTypes: true,
contextType: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
getDerivedStateFromError: true,
getDerivedStateFromProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
callee: true,
arguments: true,
arity: true
};
var FORWARD_REF_STATICS = {
'$$typeof': true,
render: true,
defaultProps: true,
displayName: true,
propTypes: true
};
var MEMO_STATICS = {
'$$typeof': true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
function getStatics(component) {
// React v16.11 and below
if (reactIs.isMemo(component)) {
return MEMO_STATICS;
} // React v16.12 and above
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = Object.prototype;
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== 'string') {
// don't hoist over string (html) components
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
}
var keys = getOwnPropertyNames(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
var targetStatics = getStatics(targetComponent);
var sourceStatics = getStatics(sourceComponent);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
try {
// Avoid failures from read-only properties
defineProperty(targetComponent, key, descriptor);
} catch (e) {}
}
}
}
return targetComponent;
}
module.exports = hoistNonReactStatics;
/***/ }),
/* 28 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global, module) {/* harmony import */ var _ponyfill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(36);
/* global window */
var root;
if (typeof self !== 'undefined') {
root = self;
} else if (typeof window !== 'undefined') {
root = window;
} else if (typeof global !== 'undefined') {
root = global;
} else if (true) {
root = module;
} else {}
var result = Object(_ponyfill_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(root);
/* harmony default export */ __webpack_exports__["a"] = (result);
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(17), __webpack_require__(64)(module)))
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
var parser = __webpack_require__(66);
var creator = __webpack_require__(67);
module.exports = {
parser: parser,
creator: creator
};
/***/ }),
/* 30 */
/***/ (function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] }
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ }),
/* 31 */
/***/ (function(module, exports) {
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
module.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
})
}
};
} else {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor
var TempCtor = function () {}
TempCtor.prototype = superCtor.prototype
ctor.prototype = new TempCtor()
ctor.prototype.constructor = ctor
}
}
}
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const Token = __webpack_require__(6);
const Util_1 = __webpack_require__(14);
const FrameParser_1 = __webpack_require__(146);
const ID3v2_1 = __webpack_require__(33);
class ID3v2Parser {
static removeUnsyncBytes(buffer) {
let readI = 0;
let writeI = 0;
while (readI < buffer.length - 1) {
if (readI !== writeI) {
buffer[writeI] = buffer[readI];
}
readI += (buffer[readI] === 0xFF && buffer[readI + 1] === 0) ? 2 : 1;
writeI++;
}
if (readI < buffer.length) {
buffer[writeI++] = buffer[readI++];
}
return buffer.slice(0, writeI);
}
static readFrameHeader(v, majorVer) {
let header;
switch (majorVer) {
case 2:
header = {
id: v.toString('ascii', 0, 3),
length: Token.UINT24_BE.get(v, 3)
};
break;
case 3:
header = {
id: v.toString('ascii', 0, 4),
length: Token.UINT32_BE.get(v, 4),
flags: ID3v2Parser.readFrameFlags(v.slice(8, 10))
};
break;
case 4:
header = {
id: v.toString('ascii', 0, 4),
length: ID3v2_1.ID3v2Token.UINT32SYNCSAFE.get(v, 4),
flags: ID3v2Parser.readFrameFlags(v.slice(8, 10))
};
break;
default:
throw new Error('Unexpected majorVer: ' + majorVer);
}
return header;
}
static getFrameHeaderLength(majorVer) {
switch (majorVer) {
case 2:
return 6;
case 3:
case 4:
return 10;
default:
throw new Error('header versionIndex is incorrect');
}
}
static readFrameFlags(b) {
return {
status: {
tag_alter_preservation: Util_1.default.strtokBITSET.get(b, 0, 6),
file_alter_preservation: Util_1.default.strtokBITSET.get(b, 0, 5),
read_only: Util_1.default.strtokBITSET.get(b, 0, 4)
},
format: {
grouping_identity: Util_1.default.strtokBITSET.get(b, 1, 7),
compression: Util_1.default.strtokBITSET.get(b, 1, 3),
encryption: Util_1.default.strtokBITSET.get(b, 1, 2),
unsynchronisation: Util_1.default.strtokBITSET.get(b, 1, 1),
data_length_indicator: Util_1.default.strtokBITSET.get(b, 1, 0)
}
};
}
static readFrameData(buf, frameHeader, majorVer, includeCovers) {
switch (majorVer) {
case 2:
return FrameParser_1.default.readData(buf, frameHeader.id, majorVer, includeCovers);
case 3:
case 4:
if (frameHeader.flags.format.unsynchronisation) {
buf = ID3v2Parser.removeUnsyncBytes(buf);
}
if (frameHeader.flags.format.data_length_indicator) {
buf = buf.slice(4, buf.length);
}
return FrameParser_1.default.readData(buf, frameHeader.id, majorVer, includeCovers);
default:
throw new Error('Unexpected majorVer: ' + majorVer);
}
}
/**
* Create a combined tag key, of tag & description
* @param {string} tag e.g.: COM
* @param {string} description e.g. iTunPGAP
* @returns {string} e.g. COM:iTunPGAP
*/
static makeDescriptionTagName(tag, description) {
return tag + (description ? ':' + description : '');
}
parse(metadata, tokenizer, options) {
return __awaiter(this, void 0, void 0, function* () {
this.tokenizer = tokenizer;
this.metadata = metadata;
this.options = options;
const id3Header = yield this.tokenizer.readToken(ID3v2_1.ID3v2Token.Header);
if (id3Header.fileIdentifier !== 'ID3') {
throw new Error("expected ID3-header file-identifier 'ID3' was not found");
}
this.id3Header = id3Header;
this.headerType = ('ID3v2.' + id3Header.version.major);
if (id3Header.flags.isExtendedHeader) {
return this.parseExtendedHeader();
}
else {
return this.parseId3Data(id3Header.size);
}
});
}
parseExtendedHeader() {
return __awaiter(this, void 0, void 0, function* () {
const extendedHeader = yield this.tokenizer.readToken(ID3v2_1.ID3v2Token.ExtendedHeader);
const dataRemaining = extendedHeader.size - ID3v2_1.ID3v2Token.ExtendedHeader.len;
if (dataRemaining > 0) {
return this.parseExtendedHeaderData(dataRemaining, extendedHeader.size);
}
else {
return this.parseId3Data(this.id3Header.size - extendedHeader.size);
}
});
}
parseExtendedHeaderData(dataRemaining, extendedHeaderSize) {
return __awaiter(this, void 0, void 0, function* () {
const buffer = Buffer.alloc(dataRemaining);
yield this.tokenizer.readBuffer(buffer, 0, dataRemaining);
return this.parseId3Data(this.id3Header.size - extendedHeaderSize);
});
}
parseId3Data(dataLen) {
return __awaiter(this, void 0, void 0, function* () {
const buffer = Buffer.alloc(dataLen);
yield this.tokenizer.readBuffer(buffer, 0, dataLen);
for (const tag of this.parseMetadata(buffer)) {
if (tag.id === 'TXXX') {
for (const text of tag.value.text) {
this.addTag(ID3v2Parser.makeDescriptionTagName(tag.id, tag.value.description), text);
}
}
else if (tag.id === 'COM') {
for (const value of tag.value) {
this.addTag(ID3v2Parser.makeDescriptionTagName(tag.id, value.description), value.text);
}
}
else if (Array.isArray(tag.value)) {
for (const value of tag.value) {
this.addTag(tag.id, value);
}
}
else {
this.addTag(tag.id, tag.value);
}
}
});
}
addTag(id, value) {
this.metadata.addTag(this.headerType, id, value);
}
parseMetadata(data) {
let offset = 0;
const tags = [];
while (true) {
if (offset === data.length)
break;
const frameHeaderLength = ID3v2Parser.getFrameHeaderLength(this.id3Header.version.major);
if (offset + frameHeaderLength > data.length) {
// ToDo: generate WARNING: Illegal ID3v2-tag-length
break;
}
const frameHeaderBytes = data.slice(offset, offset += frameHeaderLength);
const frameHeader = ID3v2Parser.readFrameHeader(frameHeaderBytes, this.id3Header.version.major);
// Last frame. Check first char is a letter, bit of defensive programming
if (frameHeader.id === '' || frameHeader.id === '\u0000\u0000\u0000\u0000' ||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.indexOf(frameHeader.id[0]) === -1) {
// ToDo: generate WARNING
break;
}
const frameDataBytes = data.slice(offset, offset += frameHeader.length);
const values = ID3v2Parser.readFrameData(frameDataBytes, frameHeader, this.id3Header.version.major, !this.options.skipCovers);
tags.push({ id: frameHeader.id, value: values });
}
return tags;
}
}
exports.ID3v2Parser = ID3v2Parser;
//# sourceMappingURL=ID3v2Parser.js.map
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(9).Buffer))
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Token = __webpack_require__(6);
const Util_1 = __webpack_require__(14);
/**
* The picture type according to the ID3v2 APIC frame
* Ref: http://id3.org/id3v2.3.0#Attached_picture
*/
var AttachedPictureType;
(function (AttachedPictureType) {
AttachedPictureType[AttachedPictureType["Other"] = 0] = "Other";
AttachedPictureType[AttachedPictureType["32x32 pixels 'file icon' (PNG only)"] = 1] = "32x32 pixels 'file icon' (PNG only)";
AttachedPictureType[AttachedPictureType["Other file icon"] = 2] = "Other file icon";
AttachedPictureType[AttachedPictureType["Cover (front)"] = 3] = "Cover (front)";
AttachedPictureType[AttachedPictureType["Cover (back)"] = 4] = "Cover (back)";
AttachedPictureType[AttachedPictureType["Leaflet page"] = 5] = "Leaflet page";
AttachedPictureType[AttachedPictureType["Media (e.g. label side of CD)"] = 6] = "Media (e.g. label side of CD)";
AttachedPictureType[AttachedPictureType["Lead artist/lead performer/soloist"] = 7] = "Lead artist/lead performer/soloist";
AttachedPictureType[AttachedPictureType["Artist/performer"] = 8] = "Artist/performer";
AttachedPictureType[AttachedPictureType["Conductor"] = 9] = "Conductor";
AttachedPictureType[AttachedPictureType["Band/Orchestra"] = 10] = "Band/Orchestra";
AttachedPictureType[AttachedPictureType["Composer"] = 11] = "Composer";
AttachedPictureType[AttachedPictureType["Lyricist/text writer"] = 12] = "Lyricist/text writer";
AttachedPictureType[AttachedPictureType["Recording Location"] = 13] = "Recording Location";
AttachedPictureType[AttachedPictureType["During recording"] = 14] = "During recording";
AttachedPictureType[AttachedPictureType["During performance"] = 15] = "During performance";
AttachedPictureType[AttachedPictureType["Movie/video screen capture"] = 16] = "Movie/video screen capture";
AttachedPictureType[AttachedPictureType["A bright coloured fish"] = 17] = "A bright coloured fish";
AttachedPictureType[AttachedPictureType["Illustration"] = 18] = "Illustration";
AttachedPictureType[AttachedPictureType["Band/artist logotype"] = 19] = "Band/artist logotype";
AttachedPictureType[AttachedPictureType["Publisher/Studio logotype"] = 20] = "Publisher/Studio logotype";
})(AttachedPictureType = exports.AttachedPictureType || (exports.AttachedPictureType = {}));
class ID3v2Token {
}
/**
* 28 bits (representing up to 256MB) integer, the msb is 0 to avoid 'false syncsignals'.
* 4 * %0xxxxxxx
*/
ID3v2Token.UINT32SYNCSAFE = {
get: (buf, off) => {
return buf[off + 3] & 0x7f | ((buf[off + 2]) << 7) |
((buf[off + 1]) << 14) | ((buf[off]) << 21);
},
len: 4
};
/**
* ID3v2 header
* Ref: http://id3.org/id3v2.3.0#ID3v2_header
* ToDo
*/
ID3v2Token.Header = {
len: 10,
get: (buf, off) => {
return {
// ID3v2/file identifier "ID3"
fileIdentifier: new Token.StringType(3, 'ascii').get(buf, off),
// ID3v2 versionIndex
version: {
major: Token.INT8.get(buf, off + 3),
revision: Token.INT8.get(buf, off + 4)
},
// ID3v2 flags
flags: {
// Raw flags value
raw: Token.INT8.get(buf, off + 4),
// Unsynchronisation
unsynchronisation: Util_1.default.strtokBITSET.get(buf, off + 5, 7),
// Extended header
isExtendedHeader: Util_1.default.strtokBITSET.get(buf, off + 5, 6),
// Experimental indicator
expIndicator: Util_1.default.strtokBITSET.get(buf, off + 5, 5),
footer: Util_1.default.strtokBITSET.get(buf, off + 5, 4)
},
size: ID3v2Token.UINT32SYNCSAFE.get(buf, off + 6)
};
}
};
ID3v2Token.ExtendedHeader = {
len: 10,
get: (buf, off) => {
return {
// Extended header size
size: Token.UINT32_BE.get(buf, off),
// Extended Flags
extendedFlags: Token.UINT16_BE.get(buf, off + 4),
// Size of padding
sizeOfPadding: Token.UINT32_BE.get(buf, off + 6),
// CRC data present
crcDataPresent: Util_1.default.strtokBITSET.get(buf, off + 4, 31)
};
}
};
exports.ID3v2Token = ID3v2Token;
//# sourceMappingURL=ID3v2.js.map
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.
function isArray(arg) {
if (Array.isArray) {
return Array.isArray(arg);
}
return objectToString(arg) === '[object Array]';
}
exports.isArray = isArray;
function isBoolean(arg) {
return typeof arg === 'boolean';
}
exports.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === 'number';
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === 'string';
}
exports.isString = isString;
function isSymbol(arg) {
return typeof arg === 'symbol';
}
exports.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined;
function isRegExp(re) {
return objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
exports.isObject = isObject;
function isDate(d) {
return objectToString(d) === '[object Date]';
}
exports.isDate = isDate;
function isError(e) {
return (objectToString(e) === '[object Error]' || e instanceof Error);
}
exports.isError = isError;
function isFunction(arg) {
return typeof arg === 'function';
}
exports.isFunction = isFunction;
function isPrimitive(arg) {
return arg === null ||
typeof arg === 'boolean' ||
typeof arg === 'number' ||
typeof arg === 'string' ||
typeof arg === 'symbol' || // ES6 symbol
typeof arg === 'undefined';
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = Buffer.isBuffer;
function objectToString(o) {
return Object.prototype.toString.call(o);
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(9).Buffer))
/***/ }),
/* 35 */
/***/ (function(module, exports) {
var PRESET_VALUES = ["hz60", "hz170", "hz310", "hz600", "hz1000", "hz3000", "hz6000", "hz12000", "hz14000", "hz16000", "preamp"];
var HEADER = "Winamp EQ library file v1.1";
module.exports = {
PRESET_VALUES: PRESET_VALUES,
HEADER: HEADER
};
/***/ }),
/* 36 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return symbolObservablePonyfill; });
function symbolObservablePonyfill(root) {
var result;
var Symbol = root.Symbol;
if (typeof Symbol === 'function') {
if (Symbol.observable) {
result = Symbol.observable;
} else {
result = Symbol('observable');
Symbol.observable = result;
}
} else {
result = '@@observable';
}
return result;
};
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var compose = __webpack_require__(12).compose;
exports.__esModule = true;
exports.composeWithDevTools = (
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ :
function() {
if (arguments.length === 0) return undefined;
if (typeof arguments[0] === 'object') return compose;
return compose.apply(null, arguments);
}
);
exports.devToolsEnhancer = (
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__ ?
window.__REDUX_DEVTOOLS_EXTENSION__ :
function() { return function(noop) { return noop; } }
);
/***/ }),
/* 38 */
/***/ (function(module) {
module.exports = JSON.parse("{\"images\":{\"EQ_PREAMP_LINE\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHEAAAABCAYAAADpXEERAAAAE0lEQVQoU2Pcdfruf4ZRMKRDAAD1lwNjTqcaUQAAAABJRU5ErkJggg==\",\"EQ_GRAPH_LINE_COLORS\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAATCAYAAABRC2cZAAAAR0lEQVQYV2O4rCT9n+F9kOJ/hvfViv8ZHkzSQCE2afxneH/HEJm49Nr0PwOYWPLIAkp0PjL4z1B41uQ/Q9QGnf8MWrPEIAQANWYwvnlToNIAAAAASUVORK5CYII=\"},\"colors\":[\"rgb(0,0,0)\",\"rgb(24,33,41)\",\"rgb(239,49,16)\",\"rgb(206,41,16)\",\"rgb(214,90,0)\",\"rgb(214,102,0)\",\"rgb(214,115,0)\",\"rgb(198,123,8)\",\"rgb(222,165,24)\",\"rgb(214,181,33)\",\"rgb(189,222,41)\",\"rgb(148,222,33)\",\"rgb(41,206,16)\",\"rgb(50,190,16)\",\"rgb(57,181,16)\",\"rgb(49,156,8)\",\"rgb(41,148,0)\",\"rgb(24,132,8)\",\"rgb(255,255,255)\",\"rgb(214,214,222)\",\"rgb(181,189,189)\",\"rgb(160,170,175)\",\"rgb(148,156,165)\",\"rgb(150,150,150)\"],\"playlistStyle\":{\"normal\":\"#00FF00\",\"current\":\"#FFFFFF\",\"normalbg\":\"#000000\",\"selectedbg\":\"#0000FF\",\"font\":\"Arial\"}}");
/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = TinyQueue;
module.exports.default = TinyQueue;
function TinyQueue(data, compare) {
if (!(this instanceof TinyQueue)) return new TinyQueue(data, compare);
this.data = data || [];
this.length = this.data.length;
this.compare = compare || defaultCompare;
if (this.length > 0) {
for (var i = (this.length >> 1) - 1; i >= 0; i--) this._down(i);
}
}
function defaultCompare(a, b) {
return a < b ? -1 : a > b ? 1 : 0;
}
TinyQueue.prototype = {
push: function (item) {
this.data.push(item);
this.length++;
this._up(this.length - 1);
},
pop: function () {
if (this.length === 0) return undefined;
var top = this.data[0];
this.length--;
if (this.length > 0) {
this.data[0] = this.data[this.length];
this._down(0);
}
this.data.pop();
return top;
},
peek: function () {
return this.data[0];
},
_up: function (pos) {
var data = this.data;
var compare = this.compare;
var item = data[pos];
while (pos > 0) {
var parent = (pos - 1) >> 1;
var current = data[parent];
if (compare(item, current) >= 0) break;
data[pos] = current;
pos = parent;
}
data[pos] = item;
},
_down: function (pos) {
var data = this.data;
var compare = this.compare;
var halfLength = this.length >> 1;
var item = data[pos];
while (pos < halfLength) {
var left = (pos << 1) + 1;
var right = left + 1;
var best = data[left];
if (right < this.length && compare(data[right], best) < 0) {
left = right;
best = data[right];
}
if (compare(best, item) >= 0) break;
data[pos] = best;
pos = left;
}
data[pos] = item;
}
};
/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
var deburrLetter = __webpack_require__(75),
toString = __webpack_require__(77);
/** Used to match Latin Unicode letters (excluding mathematical operators). */
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
/** Used to compose unicode character classes. */
var rsComboMarksRange = '\\u0300-\\u036f',
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
rsComboSymbolsRange = '\\u20d0-\\u20ff',
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
/** Used to compose unicode capture groups. */
var rsCombo = '[' + rsComboRange + ']';
/**
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
*/
var reComboMark = RegExp(rsCombo, 'g');
/**
* Deburrs `string` by converting
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
* letters to basic Latin letters and removing
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to deburr.
* @returns {string} Returns the deburred string.
* @example
*
* _.deburr('déjà vu');
* // => 'deja vu'
*/
function deburr(string) {
string = toString(string);
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
}
module.exports = deburr;
/***/ }),
/* 41 */
/***/ (function(module) {
module.exports = JSON.parse("{\"type\":\"Winamp EQ library file v1.1\",\"presets\":[{\"name\":\"Classical\",\"hz60\":33,\"hz170\":33,\"hz310\":33,\"hz600\":33,\"hz1000\":33,\"hz3000\":33,\"hz6000\":20,\"hz12000\":20,\"hz14000\":20,\"hz16000\":16,\"preamp\":33},{\"name\":\"Club\",\"hz60\":33,\"hz170\":33,\"hz310\":38,\"hz600\":42,\"hz1000\":42,\"hz3000\":42,\"hz6000\":38,\"hz12000\":33,\"hz14000\":33,\"hz16000\":33,\"preamp\":33},{\"name\":\"Dance\",\"hz60\":48,\"hz170\":44,\"hz310\":36,\"hz600\":32,\"hz1000\":32,\"hz3000\":22,\"hz6000\":20,\"hz12000\":20,\"hz14000\":32,\"hz16000\":32,\"preamp\":33},{\"name\":\"Laptop speakers/headphones\",\"hz60\":40,\"hz170\":50,\"hz310\":41,\"hz600\":26,\"hz1000\":28,\"hz3000\":35,\"hz6000\":40,\"hz12000\":48,\"hz14000\":53,\"hz16000\":56,\"preamp\":33},{\"name\":\"Large hall\",\"hz60\":49,\"hz170\":49,\"hz310\":42,\"hz600\":42,\"hz1000\":33,\"hz3000\":24,\"hz6000\":24,\"hz12000\":24,\"hz14000\":33,\"hz16000\":33,\"preamp\":33},{\"name\":\"Party\",\"hz60\":44,\"hz170\":44,\"hz310\":33,\"hz600\":33,\"hz1000\":33,\"hz3000\":33,\"hz6000\":33,\"hz12000\":33,\"hz14000\":44,\"hz16000\":44,\"preamp\":33},{\"name\":\"Pop\",\"hz60\":29,\"hz170\":40,\"hz310\":44,\"hz600\":45,\"hz1000\":41,\"hz3000\":30,\"hz6000\":28,\"hz12000\":28,\"hz14000\":29,\"hz16000\":29,\"preamp\":33},{\"name\":\"Reggae\",\"hz60\":33,\"hz170\":33,\"hz310\":31,\"hz600\":22,\"hz1000\":33,\"hz3000\":43,\"hz6000\":43,\"hz12000\":33,\"hz14000\":33,\"hz16000\":33,\"preamp\":33},{\"name\":\"Rock\",\"hz60\":45,\"hz170\":40,\"hz310\":23,\"hz600\":19,\"hz1000\":26,\"hz3000\":39,\"hz6000\":47,\"hz12000\":50,\"hz14000\":50,\"hz16000\":50,\"preamp\":33},{\"name\":\"Soft\",\"hz60\":40,\"hz170\":35,\"hz310\":30,\"hz600\":28,\"hz1000\":30,\"hz3000\":39,\"hz6000\":46,\"hz12000\":48,\"hz14000\":50,\"hz16000\":52,\"preamp\":33},{\"name\":\"Ska\",\"hz60\":28,\"hz170\":24,\"hz310\":25,\"hz600\":31,\"hz1000\":39,\"hz3000\":42,\"hz6000\":47,\"hz12000\":48,\"hz14000\":50,\"hz16000\":48,\"preamp\":33},{\"name\":\"Full Bass\",\"hz60\":48,\"hz170\":48,\"hz310\":48,\"hz600\":42,\"hz1000\":35,\"hz3000\":25,\"hz6000\":18,\"hz12000\":15,\"hz14000\":14,\"hz16000\":14,\"preamp\":33},{\"name\":\"Soft Rock\",\"hz60\":39,\"hz170\":39,\"hz310\":36,\"hz600\":31,\"hz1000\":25,\"hz3000\":23,\"hz6000\":26,\"hz12000\":31,\"hz14000\":37,\"hz16000\":47,\"preamp\":33},{\"name\":\"Full Treble\",\"hz60\":16,\"hz170\":16,\"hz310\":16,\"hz600\":25,\"hz1000\":37,\"hz3000\":50,\"hz6000\":58,\"hz12000\":58,\"hz14000\":58,\"hz16000\":60,\"preamp\":33},{\"name\":\"Full Bass & Treble\",\"hz60\":44,\"hz170\":42,\"hz310\":33,\"hz600\":20,\"hz1000\":24,\"hz3000\":35,\"hz6000\":46,\"hz12000\":50,\"hz14000\":52,\"hz16000\":52,\"preamp\":33},{\"name\":\"Live\",\"hz60\":24,\"hz170\":33,\"hz310\":39,\"hz600\":41,\"hz1000\":42,\"hz3000\":42,\"hz6000\":39,\"hz12000\":37,\"hz14000\":37,\"hz16000\":36,\"preamp\":33},{\"name\":\"Techno\",\"hz60\":45,\"hz170\":42,\"hz310\":33,\"hz600\":23,\"hz1000\":24,\"hz3000\":33,\"hz6000\":45,\"hz12000\":48,\"hz14000\":48,\"hz16000\":47,\"preamp\":33}]}");
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertAniBinaryToCSS = void 0;
var parser_1 = __webpack_require__(96);
var JIFFIES_PER_MS = 1000 / 60;
// Generate CSS for an animated cursor.
//
// This function returns CSS containing a set of keyframes with embedded Data
// URIs as well as a CSS rule to the given selector.
function convertAniBinaryToCSS(selector, aniBinary) {
var ani = readAni(aniBinary);
var animationName = "ani-cursor-" + uniqueId();
var keyframes = ani.frames.map(function (_a) {
var url = _a.url, percents = _a.percents;
var percent = percents.map(function (num) { return num + "%"; }).join(", ");
return percent + " { cursor: url(" + url + "), auto; }";
});
// CSS properties with a animation type of "discrete", like `cursor`, actually
// switch half-way _between_ each keyframe percentage. Luckily this half-way
// measurement is applied _after_ the easing function is applied. So, we can
// force the frames to appear at exactly the % that we specify by using
// `timing-function` of `step-end`.
//
// https://drafts.csswg.org/web-animations-1/#discrete
var timingFunction = "step-end";
// Winamp (re)starts the animation cycle when your mouse enters an element. By
// default this approach would cause the animation to run continuously, even
// when the cursor is not visible. To match Winamp's behavior we add a
// `:hover` pseudo selector so that the animation only runs when the cursor is
// visible.
var pseudoSelector = ":hover";
// prettier-ignore
return "\n @keyframes " + animationName + " {\n " + keyframes.join("\n") + "\n }\n " + selector + pseudoSelector + " {\n animation: " + animationName + " " + ani.duration + "ms " + timingFunction + " infinite;\n }\n ";
}
exports.convertAniBinaryToCSS = convertAniBinaryToCSS;
function readAni(contents) {
var _a;
var ani = parser_1.parseAni(contents);
var rate = (_a = ani.rate) !== null && _a !== void 0 ? _a : ani.images.map(function () { return ani.metadata.iDispRate; });
var duration = sum(rate);
var frames = ani.images.map(function (image) { return ({
url: curUrlFromByteArray(image),
percents: [],
}); });
var elapsed = 0;
rate.forEach(function (r, i) {
var frameIdx = ani.seq ? ani.seq[i] : i;
frames[frameIdx].percents.push((elapsed / duration) * 100);
elapsed += r;
});
return { duration: duration * JIFFIES_PER_MS, frames: frames };
}
/* Utility Functions */
var i = 0;
var uniqueId = function () { return i++; };
function base64FromDataArray(dataArray) {
return window.btoa(String.fromCharCode.apply(String, __spread(dataArray)));
}
function curUrlFromByteArray(arr) {
var base64 = base64FromDataArray(arr);
return "data:image/x-win-bitmap;base64," + base64;
}
function sum(values) {
return values.reduce(function (total, value) { return total + value; }, 0);
}
//# sourceMappingURL=index.js.map
/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ReadStreamTokenizer_1 = __webpack_require__(123);
const BufferTokenizer_1 = __webpack_require__(129);
/**
* Construct ReadStreamTokenizer from given Stream.
* Will set fileSize, if provided given Stream has set the .path property/
* @param stream Stream.Readable
* @param size If known the 'file' size in bytes, maybe required to calculate the duration.
* @returns ReadStreamTokenizer
*/
function fromStream(stream, size) {
return new ReadStreamTokenizer_1.ReadStreamTokenizer(stream, size);
}
exports.fromStream = fromStream;
/**
* Construct ReadStreamTokenizer from given Buffer.
* @param buffer Buffer to tokenize
* @returns BufferTokenizer
*/
function fromBuffer(buffer) {
return new BufferTokenizer_1.BufferTokenizer(buffer);
}
exports.fromBuffer = fromBuffer;
/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
if (typeof process === 'undefined' ||
!process.version ||
process.version.indexOf('v0.') === 0 ||
process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
module.exports = { nextTick: nextTick };
} else {
module.exports = process
}
function nextTick(fn, arg1, arg2, arg3) {
if (typeof fn !== 'function') {
throw new TypeError('"callback" argument must be a function');
}
var len = arguments.length;
var args, i;
switch (len) {
case 0:
case 1:
return process.nextTick(fn);
case 2:
return process.nextTick(function afterTickOne() {
fn.call(null, arg1);
});
case 3:
return process.nextTick(function afterTickTwo() {
fn.call(null, arg1, arg2);
});
case 4:
return process.nextTick(function afterTickThree() {
fn.call(null, arg1, arg2, arg3);
});
default:
args = new Array(len - 1);
i = 0;
while (i < args.length) {
args[i++] = arguments[i];
}
return process.nextTick(function afterTick() {
fn.apply(null, args);
});
}
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(30)))
/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const initDebug = __webpack_require__(8);
const FileType = __webpack_require__(105);
const Token = __webpack_require__(6);
const assert = __webpack_require__(18);
const Util_1 = __webpack_require__(14);
const BasicParser_1 = __webpack_require__(20);
const APEv2Token_1 = __webpack_require__(159);
const debug = initDebug('music-metadata:parser:APEv2');
const tagFormat = 'APEv2';
const preamble = 'APETAGEX';
class APEv2Parser extends BasicParser_1.BasicParser {
constructor() {
super(...arguments);
this.ape = {};
}
/**
* Calculate the media file duration
* @param ah ApeHeader
* @return {number} duration in seconds
*/
static calculateDuration(ah) {
let duration = ah.totalFrames > 1 ? ah.blocksPerFrame * (ah.totalFrames - 1) : 0;
duration += ah.finalFrameBlocks;
return duration / ah.sampleRate;
}
/**
* @param {INativeMetadataCollector} metadata
* @param {ITokenizer} tokenizer
* @param {IOptions} options
* @returns {Promise<boolean>} True if tags have been found
*/
static parseTagHeader(metadata, tokenizer, options) {
return __awaiter(this, void 0, void 0, function* () {
if (tokenizer.fileSize && tokenizer.fileSize - tokenizer.position < APEv2Token_1.TagFooter.len) {
debug(`No APEv2 header found, end-of-file reached`);
return;
}
const footer = yield tokenizer.peekToken(APEv2Token_1.TagFooter);
if (footer.ID === preamble) {
yield tokenizer.ignore(APEv2Token_1.TagFooter.len);
const tags = yield tokenizer.readToken(APEv2Token_1.TagField(footer));
APEv2Parser.parseTags(metadata, footer, tags, 0, !options.skipCovers);
}
else {
debug(`APEv2 header not found at offset=${tokenizer.position}`);
if (tokenizer.fileSize) {
// Try to read the APEv2 header using just the footer-header
const remaining = tokenizer.fileSize - tokenizer.position; // ToDo: take ID3v1 into account
const buffer = Buffer.alloc(remaining);
yield tokenizer.readBuffer(buffer);
return APEv2Parser.parseTagFooter(metadata, buffer, !options.skipCovers);
}
}
});
}
static parseTagFooter(metadata, buffer, includeCovers) {
const footer = APEv2Token_1.TagFooter.get(buffer, buffer.length - APEv2Token_1.TagFooter.len);
assert.equal(footer.ID, preamble, 'APEv2 Footer preamble');
this.parseTags(metadata, footer, buffer, buffer.length - footer.size, includeCovers);
}
static parseTags(metadata, footer, buffer, offset, includeCovers) {
for (let i = 0; i < footer.fields; i++) {
// Only APEv2 tag has tag item headers
const tagItemHeader = APEv2Token_1.TagItemHeader.get(buffer, offset);
offset += APEv2Token_1.TagItemHeader.len;
let zero = Util_1.default.findZero(buffer, offset, buffer.length);
const key = buffer.toString('ascii', offset, zero);
offset = zero + 1;
switch (tagItemHeader.flags.dataType) {
case APEv2Token_1.DataType.text_utf8: { // utf-8 textstring
const value = buffer.toString('utf8', offset, offset += tagItemHeader.size);
const values = value.split(/\x00/g);
/*jshint loopfunc:true */
for (const val of values) {
metadata.addTag(tagFormat, key, val);
}
break;
}
case APEv2Token_1.DataType.binary: // binary (probably artwork)
if (includeCovers) {
const picData = buffer.slice(offset, offset + tagItemHeader.size);
let off = 0;
zero = Util_1.default.findZero(picData, off, picData.length);
const description = picData.toString('utf8', off, zero);
off = zero + 1;
const data = Buffer.from(picData.slice(off));
const fileType = FileType(data);
if (fileType) {
if (fileType.mime.indexOf('image/') === 0) {
const picture = {
description,
data,
format: fileType.mime
};
offset += tagItemHeader.size;
metadata.addTag(tagFormat, key, picture);
}
else {
debug(`Unexpected binary tag of type': ${fileType.mime}`);
}
}
else {
debug(`Failed to determine file type for binary tag: ${key}`);
}
}
break;
case APEv2Token_1.DataType.external_info:
debug(`Ignore external info ${key}`);
break;
default:
throw new Error(`Unexpected data-type: ${tagItemHeader.flags.dataType}`);
}
}
}
parse() {
return __awaiter(this, void 0, void 0, function* () {
const descriptor = yield this.tokenizer.readToken(APEv2Token_1.DescriptorParser);
assert.equal(descriptor.ID, 'MAC ', 'descriptor.ID');
this.ape.descriptor = descriptor;
const lenExp = descriptor.descriptorBytes - APEv2Token_1.DescriptorParser.len;
const header = yield (lenExp > 0 ? this.parseDescriptorExpansion(lenExp) : this.parseHeader());
yield this.tokenizer.readToken(new Token.IgnoreType(header.forwardBytes));
return APEv2Parser.parseTagHeader(this.metadata, this.tokenizer, this.options);
});
}
parseDescriptorExpansion(lenExp) {
return __awaiter(this, void 0, void 0, function* () {
yield this.tokenizer.readToken(new Token.IgnoreType(lenExp));
return this.parseHeader();
});
}
parseHeader() {
return __awaiter(this, void 0, void 0, function* () {
const header = yield this.tokenizer.readToken(APEv2Token_1.Header);
// ToDo before
this.metadata.setFormat('lossless', true);
this.metadata.setFormat('dataformat', 'Monkey\'s Audio');
this.metadata.setFormat('bitsPerSample', header.bitsPerSample);
this.metadata.setFormat('sampleRate', header.sampleRate);
this.metadata.setFormat('numberOfChannels', header.channel);
this.metadata.setFormat('duration', APEv2Parser.calculateDuration(header));
return {
forwardBytes: this.ape.descriptor.seekTableBytes + this.ape.descriptor.headerDataBytes +
this.ape.descriptor.apeFrameDataBytes + this.ape.descriptor.terminatingDataBytes
};
});
}
}
exports.APEv2Parser = APEv2Parser;
//# sourceMappingURL=APEv2Parser.js.map
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(9).Buffer))
/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const type_1 = __webpack_require__(22);
const ID3v2_1 = __webpack_require__(33);
const ID3v2Parser_1 = __webpack_require__(32);
const ID3v1Parser_1 = __webpack_require__(48);
const _debug = __webpack_require__(8);
const BasicParser_1 = __webpack_require__(20);
const debug = _debug('music-metadata:parser:ID3');
/**
* Abstract parser which tries take ID3v2 and ID3v1 headers.
*/
class AbstractID3Parser extends BasicParser_1.BasicParser {
constructor() {
super(...arguments);
this.id3parser = new ID3v2Parser_1.ID3v2Parser();
}
static startsWithID3v2Header(tokenizer) {
return __awaiter(this, void 0, void 0, function* () {
return (yield tokenizer.peekToken(ID3v2_1.ID3v2Token.Header)).fileIdentifier === 'ID3';
});
}
parse() {
return this.parseID3v2().catch(err => {
if (err.message === type_1.endOfFile)
// ToDo: maybe a warning?
return;
else
throw err;
});
}
finalize() {
return;
}
parseID3v2() {
return __awaiter(this, void 0, void 0, function* () {
yield this.tryReadId3v2Headers();
debug("End of ID3v2 header, go to MPEG-parser: pos=%s", this.tokenizer.position);
yield this._parse();
if (this.options.skipPostHeaders && this.metadata.hasAny()) {
this.finalize();
}
else {
const id3v1parser = new ID3v1Parser_1.ID3v1Parser();
yield id3v1parser.init(this.metadata, this.tokenizer, this.options).parse();
this.finalize();
}
});
}
tryReadId3v2Headers() {
return __awaiter(this, void 0, void 0, function* () {
const id3Header = yield this.tokenizer.peekToken(ID3v2_1.ID3v2Token.Header);
if (id3Header.fileIdentifier === "ID3") {
debug("Found ID3v2 header, pos=%s", this.tokenizer.position);
yield this.id3parser.parse(this.metadata, this.tokenizer, this.options);
return this.tryReadId3v2Headers();
}
});
}
}
exports.AbstractID3Parser = AbstractID3Parser;
//# sourceMappingURL=AbstractID3Parser.js.map
/***/ }),
/* 47 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/@babel/runtime/helpers/defineProperty.js
var defineProperty = __webpack_require__(2);
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/react/jsx-runtime.js
var jsx_runtime = __webpack_require__(0);
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/react/index.js
var react = __webpack_require__(1);
var react_default = /*#__PURE__*/__webpack_require__.n(react);
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/react-dom/index.js
var react_dom = __webpack_require__(5);
var react_dom_default = /*#__PURE__*/__webpack_require__.n(react_dom);
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/prop-types/index.js
var prop_types = __webpack_require__(60);
// CONCATENATED MODULE: ./node_modules/react-redux/es/components/Context.js
var ReactReduxContext = /*#__PURE__*/react_default.a.createContext(null);
if (false) {}
/* harmony default export */ var components_Context = (ReactReduxContext);
// CONCATENATED MODULE: ./node_modules/react-redux/es/utils/batch.js
// Default to a dummy "batch" implementation that just runs the callback
function defaultNoopBatch(callback) {
callback();
}
var batch_batch = defaultNoopBatch; // Allow injecting another batching function later
var setBatch = function setBatch(newBatch) {
return batch_batch = newBatch;
}; // Supply a getter just to skip dealing with ESM bindings
var getBatch = function getBatch() {
return batch_batch;
};
// CONCATENATED MODULE: ./node_modules/react-redux/es/utils/Subscription.js
// encapsulates the subscription logic for connecting a component to the redux store, as
// well as nesting subscriptions of descendant components, so that we can ensure the
// ancestor components re-render before descendants
var nullListeners = {
notify: function notify() {}
};
function createListenerCollection() {
var batch = getBatch();
var first = null;
var last = null;
return {
clear: function clear() {
first = null;
last = null;
},
notify: function notify() {
batch(function () {
var listener = first;
while (listener) {
listener.callback();
listener = listener.next;
}
});
},
get: function get() {
var listeners = [];
var listener = first;
while (listener) {
listeners.push(listener);
listener = listener.next;
}
return listeners;
},
subscribe: function subscribe(callback) {
var isSubscribed = true;
var listener = last = {
callback: callback,
next: null,
prev: last
};
if (listener.prev) {
listener.prev.next = listener;
} else {
first = listener;
}
return function unsubscribe() {
if (!isSubscribed || first === null) return;
isSubscribed = false;
if (listener.next) {
listener.next.prev = listener.prev;
} else {
last = listener.prev;
}
if (listener.prev) {
listener.prev.next = listener.next;
} else {
first = listener.next;
}
};
}
};
}
var Subscription = /*#__PURE__*/function () {
function Subscription(store, parentSub) {
this.store = store;
this.parentSub = parentSub;
this.unsubscribe = null;
this.listeners = nullListeners;
this.handleChangeWrapper = this.handleChangeWrapper.bind(this);
}
var _proto = Subscription.prototype;
_proto.addNestedSub = function addNestedSub(listener) {
this.trySubscribe();
return this.listeners.subscribe(listener);
};
_proto.notifyNestedSubs = function notifyNestedSubs() {
this.listeners.notify();
};
_proto.handleChangeWrapper = function handleChangeWrapper() {
if (this.onStateChange) {
this.onStateChange();
}
};
_proto.isSubscribed = function isSubscribed() {
return Boolean(this.unsubscribe);
};
_proto.trySubscribe = function trySubscribe() {
if (!this.unsubscribe) {
this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.handleChangeWrapper) : this.store.subscribe(this.handleChangeWrapper);
this.listeners = createListenerCollection();
}
};
_proto.tryUnsubscribe = function tryUnsubscribe() {
if (this.unsubscribe) {
this.unsubscribe();
this.unsubscribe = null;
this.listeners.clear();
this.listeners = nullListeners;
}
};
return Subscription;
}();
// CONCATENATED MODULE: ./node_modules/react-redux/es/components/Provider.js
function Provider(_ref) {
var store = _ref.store,
context = _ref.context,
children = _ref.children;
var contextValue = Object(react["useMemo"])(function () {
var subscription = new Subscription(store);
subscription.onStateChange = subscription.notifyNestedSubs;
return {
store: store,
subscription: subscription
};
}, [store]);
var previousState = Object(react["useMemo"])(function () {
return store.getState();
}, [store]);
Object(react["useEffect"])(function () {
var subscription = contextValue.subscription;
subscription.trySubscribe();
if (previousState !== store.getState()) {
subscription.notifyNestedSubs();
}
return function () {
subscription.tryUnsubscribe();
subscription.onStateChange = null;
};
}, [contextValue, previousState]);
var Context = context || ReactReduxContext;
return /*#__PURE__*/react_default.a.createElement(Context.Provider, {
value: contextValue
}, children);
}
if (false) {}
/* harmony default export */ var components_Provider = (Provider);
// CONCATENATED MODULE: ./node_modules/react-redux/node_modules/@babel/runtime/helpers/esm/extends.js
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
// CONCATENATED MODULE: ./node_modules/react-redux/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js
var hoist_non_react_statics_cjs = __webpack_require__(27);
var hoist_non_react_statics_cjs_default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics_cjs);
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/react-is/index.js
var react_is = __webpack_require__(26);
// CONCATENATED MODULE: ./node_modules/react-redux/es/utils/useIsomorphicLayoutEffect.js
// React currently throws a warning when using useLayoutEffect on the server.
// To get around it, we can conditionally useEffect on the server (no-op) and
// useLayoutEffect in the browser. We need useLayoutEffect to ensure the store
// subscription callback always has the selector from the latest render commit
// available, otherwise a store update may happen between render and the effect,
// which may cause missed updates; we also must ensure the store subscription
// is created synchronously, otherwise a store update may occur before the
// subscription is created and an inconsistent state may be observed
var useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? react["useLayoutEffect"] : react["useEffect"];
// CONCATENATED MODULE: ./node_modules/react-redux/es/components/connectAdvanced.js
// Define some constant arrays just to avoid re-creating these
var EMPTY_ARRAY = [];
var NO_SUBSCRIPTION_ARRAY = [null, null];
var stringifyComponent = function stringifyComponent(Comp) {
try {
return JSON.stringify(Comp);
} catch (err) {
return String(Comp);
}
};
function storeStateUpdatesReducer(state, action) {
var updateCount = state[1];
return [action.payload, updateCount + 1];
}
function useIsomorphicLayoutEffectWithArgs(effectFunc, effectArgs, dependencies) {
useIsomorphicLayoutEffect(function () {
return effectFunc.apply(void 0, effectArgs);
}, dependencies);
}
function captureWrapperProps(lastWrapperProps, lastChildProps, renderIsScheduled, wrapperProps, actualChildProps, childPropsFromStoreUpdate, notifyNestedSubs) {
// We want to capture the wrapper props and child props we used for later comparisons
lastWrapperProps.current = wrapperProps;
lastChildProps.current = actualChildProps;
renderIsScheduled.current = false; // If the render was from a store update, clear out that reference and cascade the subscriber update
if (childPropsFromStoreUpdate.current) {
childPropsFromStoreUpdate.current = null;
notifyNestedSubs();
}
}
function subscribeUpdates(shouldHandleStateChanges, store, subscription, childPropsSelector, lastWrapperProps, lastChildProps, renderIsScheduled, childPropsFromStoreUpdate, notifyNestedSubs, forceComponentUpdateDispatch) {
// If we're not subscribed to the store, nothing to do here
if (!shouldHandleStateChanges) return; // Capture values for checking if and when this component unmounts
var didUnsubscribe = false;
var lastThrownError = null; // We'll run this callback every time a store subscription update propagates to this component
var checkForUpdates = function checkForUpdates() {
if (didUnsubscribe) {
// Don't run stale listeners.
// Redux doesn't guarantee unsubscriptions happen until next dispatch.
return;
}
var latestStoreState = store.getState();
var newChildProps, error;
try {
// Actually run the selector with the most recent store state and wrapper props
// to determine what the child props should be
newChildProps = childPropsSelector(latestStoreState, lastWrapperProps.current);
} catch (e) {
error = e;
lastThrownError = e;
}
if (!error) {
lastThrownError = null;
} // If the child props haven't changed, nothing to do here - cascade the subscription update
if (newChildProps === lastChildProps.current) {
if (!renderIsScheduled.current) {
notifyNestedSubs();
}
} else {
// Save references to the new child props. Note that we track the "child props from store update"
// as a ref instead of a useState/useReducer because we need a way to determine if that value has
// been processed. If this went into useState/useReducer, we couldn't clear out the value without
// forcing another re-render, which we don't want.
lastChildProps.current = newChildProps;
childPropsFromStoreUpdate.current = newChildProps;
renderIsScheduled.current = true; // If the child props _did_ change (or we caught an error), this wrapper component needs to re-render
forceComponentUpdateDispatch({
type: 'STORE_UPDATED',
payload: {
error: error
}
});
}
}; // Actually subscribe to the nearest connected ancestor (or store)
subscription.onStateChange = checkForUpdates;
subscription.trySubscribe(); // Pull data from the store after first render in case the store has
// changed since we began.
checkForUpdates();
var unsubscribeWrapper = function unsubscribeWrapper() {
didUnsubscribe = true;
subscription.tryUnsubscribe();
subscription.onStateChange = null;
if (lastThrownError) {
// It's possible that we caught an error due to a bad mapState function, but the
// parent re-rendered without this component and we're about to unmount.
// This shouldn't happen as long as we do top-down subscriptions correctly, but
// if we ever do those wrong, this throw will surface the error in our tests.
// In that case, throw the error from here so it doesn't get lost.
throw lastThrownError;
}
};
return unsubscribeWrapper;
}
var initStateUpdates = function initStateUpdates() {
return [null, 0];
};
function connectAdvanced(
/*
selectorFactory is a func that is responsible for returning the selector function used to
compute new props from state, props, and dispatch. For example:
export default connectAdvanced((dispatch, options) => (state, props) => ({
thing: state.things[props.thingId],
saveThing: fields => dispatch(actionCreators.saveThing(props.thingId, fields)),
}))(YourComponent)
Access to dispatch is provided to the factory so selectorFactories can bind actionCreators
outside of their selector as an optimization. Options passed to connectAdvanced are passed to
the selectorFactory, along with displayName and WrappedComponent, as the second argument.
Note that selectorFactory is responsible for all caching/memoization of inbound and outbound
props. Do not use connectAdvanced directly without memoizing results between calls to your
selector, otherwise the Connect component will re-render on every state or props change.
*/
selectorFactory, // options object:
_ref) {
if (_ref === void 0) {
_ref = {};
}
var _ref2 = _ref,
_ref2$getDisplayName = _ref2.getDisplayName,
getDisplayName = _ref2$getDisplayName === void 0 ? function (name) {
return "ConnectAdvanced(" + name + ")";
} : _ref2$getDisplayName,
_ref2$methodName = _ref2.methodName,
methodName = _ref2$methodName === void 0 ? 'connectAdvanced' : _ref2$methodName,
_ref2$renderCountProp = _ref2.renderCountProp,
renderCountProp = _ref2$renderCountProp === void 0 ? undefined : _ref2$renderCountProp,
_ref2$shouldHandleSta = _ref2.shouldHandleStateChanges,
shouldHandleStateChanges = _ref2$shouldHandleSta === void 0 ? true : _ref2$shouldHandleSta,
_ref2$storeKey = _ref2.storeKey,
storeKey = _ref2$storeKey === void 0 ? 'store' : _ref2$storeKey,
_ref2$withRef = _ref2.withRef,
withRef = _ref2$withRef === void 0 ? false : _ref2$withRef,
_ref2$forwardRef = _ref2.forwardRef,
forwardRef = _ref2$forwardRef === void 0 ? false : _ref2$forwardRef,
_ref2$context = _ref2.context,
context = _ref2$context === void 0 ? ReactReduxContext : _ref2$context,
connectOptions = _objectWithoutPropertiesLoose(_ref2, ["getDisplayName", "methodName", "renderCountProp", "shouldHandleStateChanges", "storeKey", "withRef", "forwardRef", "context"]);
if (false) { var customStoreWarningMessage; }
var Context = context;
return function wrapWithConnect(WrappedComponent) {
if (false) {}
var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
var displayName = getDisplayName(wrappedComponentName);
var selectorFactoryOptions = _extends({}, connectOptions, {
getDisplayName: getDisplayName,
methodName: methodName,
renderCountProp: renderCountProp,
shouldHandleStateChanges: shouldHandleStateChanges,
storeKey: storeKey,
displayName: displayName,
wrappedComponentName: wrappedComponentName,
WrappedComponent: WrappedComponent
});
var pure = connectOptions.pure;
function createChildSelector(store) {
return selectorFactory(store.dispatch, selectorFactoryOptions);
} // If we aren't running in "pure" mode, we don't want to memoize values.
// To avoid conditionally calling hooks, we fall back to a tiny wrapper
// that just executes the given callback immediately.
var usePureOnlyMemo = pure ? react["useMemo"] : function (callback) {
return callback();
};
function ConnectFunction(props) {
var _useMemo = Object(react["useMemo"])(function () {
// Distinguish between actual "data" props that were passed to the wrapper component,
// and values needed to control behavior (forwarded refs, alternate context instances).
// To maintain the wrapperProps object reference, memoize this destructuring.
var reactReduxForwardedRef = props.reactReduxForwardedRef,
wrapperProps = _objectWithoutPropertiesLoose(props, ["reactReduxForwardedRef"]);
return [props.context, reactReduxForwardedRef, wrapperProps];
}, [props]),
propsContext = _useMemo[0],
reactReduxForwardedRef = _useMemo[1],
wrapperProps = _useMemo[2];
var ContextToUse = Object(react["useMemo"])(function () {
// Users may optionally pass in a custom context instance to use instead of our ReactReduxContext.
// Memoize the check that determines which context instance we should use.
return propsContext && propsContext.Consumer && Object(react_is["isContextConsumer"])( /*#__PURE__*/react_default.a.createElement(propsContext.Consumer, null)) ? propsContext : Context;
}, [propsContext, Context]); // Retrieve the store and ancestor subscription via context, if available
var contextValue = Object(react["useContext"])(ContextToUse); // The store _must_ exist as either a prop or in context.
// We'll check to see if it _looks_ like a Redux store first.
// This allows us to pass through a `store` prop that is just a plain value.
var didStoreComeFromProps = Boolean(props.store) && Boolean(props.store.getState) && Boolean(props.store.dispatch);
var didStoreComeFromContext = Boolean(contextValue) && Boolean(contextValue.store);
if (false) {} // Based on the previous check, one of these must be true
var store = didStoreComeFromProps ? props.store : contextValue.store;
var childPropsSelector = Object(react["useMemo"])(function () {
// The child props selector needs the store reference as an input.
// Re-create this selector whenever the store changes.
return createChildSelector(store);
}, [store]);
var _useMemo2 = Object(react["useMemo"])(function () {
if (!shouldHandleStateChanges) return NO_SUBSCRIPTION_ARRAY; // This Subscription's source should match where store came from: props vs. context. A component
// connected to the store via props shouldn't use subscription from context, or vice versa.
var subscription = new Subscription(store, didStoreComeFromProps ? null : contextValue.subscription); // `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in
// the middle of the notification loop, where `subscription` will then be null. This can
// probably be avoided if Subscription's listeners logic is changed to not call listeners
// that have been unsubscribed in the middle of the notification loop.
var notifyNestedSubs = subscription.notifyNestedSubs.bind(subscription);
return [subscription, notifyNestedSubs];
}, [store, didStoreComeFromProps, contextValue]),
subscription = _useMemo2[0],
notifyNestedSubs = _useMemo2[1]; // Determine what {store, subscription} value should be put into nested context, if necessary,
// and memoize that value to avoid unnecessary context updates.
var overriddenContextValue = Object(react["useMemo"])(function () {
if (didStoreComeFromProps) {
// This component is directly subscribed to a store from props.
// We don't want descendants reading from this store - pass down whatever
// the existing context value is from the nearest connected ancestor.
return contextValue;
} // Otherwise, put this component's subscription instance into context, so that
// connected descendants won't update until after this component is done
return _extends({}, contextValue, {
subscription: subscription
});
}, [didStoreComeFromProps, contextValue, subscription]); // We need to force this wrapper component to re-render whenever a Redux store update
// causes a change to the calculated child component props (or we caught an error in mapState)
var _useReducer = Object(react["useReducer"])(storeStateUpdatesReducer, EMPTY_ARRAY, initStateUpdates),
_useReducer$ = _useReducer[0],
previousStateUpdateResult = _useReducer$[0],
forceComponentUpdateDispatch = _useReducer[1]; // Propagate any mapState/mapDispatch errors upwards
if (previousStateUpdateResult && previousStateUpdateResult.error) {
throw previousStateUpdateResult.error;
} // Set up refs to coordinate values between the subscription effect and the render logic
var lastChildProps = Object(react["useRef"])();
var lastWrapperProps = Object(react["useRef"])(wrapperProps);
var childPropsFromStoreUpdate = Object(react["useRef"])();
var renderIsScheduled = Object(react["useRef"])(false);
var actualChildProps = usePureOnlyMemo(function () {
// Tricky logic here:
// - This render may have been triggered by a Redux store update that produced new child props
// - However, we may have gotten new wrapper props after that
// If we have new child props, and the same wrapper props, we know we should use the new child props as-is.
// But, if we have new wrapper props, those might change the child props, so we have to recalculate things.
// So, we'll use the child props from store update only if the wrapper props are the same as last time.
if (childPropsFromStoreUpdate.current && wrapperProps === lastWrapperProps.current) {
return childPropsFromStoreUpdate.current;
} // TODO We're reading the store directly in render() here. Bad idea?
// This will likely cause Bad Things (TM) to happen in Concurrent Mode.
// Note that we do this because on renders _not_ caused by store updates, we need the latest store state
// to determine what the child props should be.
return childPropsSelector(store.getState(), wrapperProps);
}, [store, previousStateUpdateResult, wrapperProps]); // We need this to execute synchronously every time we re-render. However, React warns
// about useLayoutEffect in SSR, so we try to detect environment and fall back to
// just useEffect instead to avoid the warning, since neither will run anyway.
useIsomorphicLayoutEffectWithArgs(captureWrapperProps, [lastWrapperProps, lastChildProps, renderIsScheduled, wrapperProps, actualChildProps, childPropsFromStoreUpdate, notifyNestedSubs]); // Our re-subscribe logic only runs when the store/subscription setup changes
useIsomorphicLayoutEffectWithArgs(subscribeUpdates, [shouldHandleStateChanges, store, subscription, childPropsSelector, lastWrapperProps, lastChildProps, renderIsScheduled, childPropsFromStoreUpdate, notifyNestedSubs, forceComponentUpdateDispatch], [store, subscription, childPropsSelector]); // Now that all that's done, we can finally try to actually render the child component.
// We memoize the elements for the rendered child component as an optimization.
var renderedWrappedComponent = Object(react["useMemo"])(function () {
return /*#__PURE__*/react_default.a.createElement(WrappedComponent, _extends({}, actualChildProps, {
ref: reactReduxForwardedRef
}));
}, [reactReduxForwardedRef, WrappedComponent, actualChildProps]); // If React sees the exact same element reference as last time, it bails out of re-rendering
// that child, same as if it was wrapped in React.memo() or returned false from shouldComponentUpdate.
var renderedChild = Object(react["useMemo"])(function () {
if (shouldHandleStateChanges) {
// If this component is subscribed to store updates, we need to pass its own
// subscription instance down to our descendants. That means rendering the same
// Context instance, and putting a different value into the context.
return /*#__PURE__*/react_default.a.createElement(ContextToUse.Provider, {
value: overriddenContextValue
}, renderedWrappedComponent);
}
return renderedWrappedComponent;
}, [ContextToUse, renderedWrappedComponent, overriddenContextValue]);
return renderedChild;
} // If we're in "pure" mode, ensure our wrapper component only re-renders when incoming props have changed.
var Connect = pure ? react_default.a.memo(ConnectFunction) : ConnectFunction;
Connect.WrappedComponent = WrappedComponent;
Connect.displayName = displayName;
if (forwardRef) {
var forwarded = react_default.a.forwardRef(function forwardConnectRef(props, ref) {
return /*#__PURE__*/react_default.a.createElement(Connect, _extends({}, props, {
reactReduxForwardedRef: ref
}));
});
forwarded.displayName = displayName;
forwarded.WrappedComponent = WrappedComponent;
return hoist_non_react_statics_cjs_default()(forwarded, WrappedComponent);
}
return hoist_non_react_statics_cjs_default()(Connect, WrappedComponent);
};
}
// CONCATENATED MODULE: ./node_modules/react-redux/es/utils/shallowEqual.js
function is(x, y) {
if (x === y) {
return x !== 0 || y !== 0 || 1 / x === 1 / y;
} else {
return x !== x && y !== y;
}
}
function shallowEqual(objA, objB) {
if (is(objA, objB)) return true;
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) return false;
for (var i = 0; i < keysA.length; i++) {
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
return true;
}
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/redux/es/redux.js
var redux = __webpack_require__(12);
// CONCATENATED MODULE: ./node_modules/react-redux/es/utils/isPlainObject.js
/**
* @param {any} obj The object to inspect.
* @returns {boolean} True if the argument appears to be a plain object.
*/
function isPlainObject(obj) {
if (typeof obj !== 'object' || obj === null) return false;
var proto = Object.getPrototypeOf(obj);
if (proto === null) return true;
var baseProto = proto;
while (Object.getPrototypeOf(baseProto) !== null) {
baseProto = Object.getPrototypeOf(baseProto);
}
return proto === baseProto;
}
// CONCATENATED MODULE: ./node_modules/react-redux/es/utils/warning.js
/**
* Prints a warning in the console if it exists.
*
* @param {String} message The warning message.
* @returns {void}
*/
function warning(message) {
/* eslint-disable no-console */
if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error(message);
}
/* eslint-enable no-console */
try {
// This error was thrown as a convenience so that if you enable
// "break on all exceptions" in your console,
// it would pause the execution at this line.
throw new Error(message);
/* eslint-disable no-empty */
} catch (e) {}
/* eslint-enable no-empty */
}
// CONCATENATED MODULE: ./node_modules/react-redux/es/utils/verifyPlainObject.js
function verifyPlainObject(value, displayName, methodName) {
if (!isPlainObject(value)) {
warning(methodName + "() in " + displayName + " must return a plain object. Instead received " + value + ".");
}
}
// CONCATENATED MODULE: ./node_modules/react-redux/es/connect/wrapMapToProps.js
function wrapMapToPropsConstant(getConstant) {
return function initConstantSelector(dispatch, options) {
var constant = getConstant(dispatch, options);
function constantSelector() {
return constant;
}
constantSelector.dependsOnOwnProps = false;
return constantSelector;
};
} // dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args
// to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine
// whether mapToProps needs to be invoked when props have changed.
//
// A length of one signals that mapToProps does not depend on props from the parent component.
// A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and
// therefore not reporting its length accurately..
function getDependsOnOwnProps(mapToProps) {
return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1;
} // Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction,
// this function wraps mapToProps in a proxy function which does several things:
//
// * Detects whether the mapToProps function being called depends on props, which
// is used by selectorFactory to decide if it should reinvoke on props changes.
//
// * On first call, handles mapToProps if returns another function, and treats that
// new function as the true mapToProps for subsequent calls.
//
// * On first call, verifies the first result is a plain object, in order to warn
// the developer that their mapToProps function is not returning a valid result.
//
function wrapMapToPropsFunc(mapToProps, methodName) {
return function initProxySelector(dispatch, _ref) {
var displayName = _ref.displayName;
var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) {
return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch);
}; // allow detectFactoryAndVerify to get ownProps
proxy.dependsOnOwnProps = true;
proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
proxy.mapToProps = mapToProps;
proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
var props = proxy(stateOrDispatch, ownProps);
if (typeof props === 'function') {
proxy.mapToProps = props;
proxy.dependsOnOwnProps = getDependsOnOwnProps(props);
props = proxy(stateOrDispatch, ownProps);
}
if (false) {}
return props;
};
return proxy;
};
}
// CONCATENATED MODULE: ./node_modules/react-redux/es/connect/mapDispatchToProps.js
function whenMapDispatchToPropsIsFunction(mapDispatchToProps) {
return typeof mapDispatchToProps === 'function' ? wrapMapToPropsFunc(mapDispatchToProps, 'mapDispatchToProps') : undefined;
}
function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {
return !mapDispatchToProps ? wrapMapToPropsConstant(function (dispatch) {
return {
dispatch: dispatch
};
}) : undefined;
}
function whenMapDispatchToPropsIsObject(mapDispatchToProps) {
return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? wrapMapToPropsConstant(function (dispatch) {
return Object(redux["bindActionCreators"])(mapDispatchToProps, dispatch);
}) : undefined;
}
/* harmony default export */ var connect_mapDispatchToProps = ([whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject]);
// CONCATENATED MODULE: ./node_modules/react-redux/es/connect/mapStateToProps.js
function whenMapStateToPropsIsFunction(mapStateToProps) {
return typeof mapStateToProps === 'function' ? wrapMapToPropsFunc(mapStateToProps, 'mapStateToProps') : undefined;
}
function whenMapStateToPropsIsMissing(mapStateToProps) {
return !mapStateToProps ? wrapMapToPropsConstant(function () {
return {};
}) : undefined;
}
/* harmony default export */ var connect_mapStateToProps = ([whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing]);
// CONCATENATED MODULE: ./node_modules/react-redux/es/connect/mergeProps.js
function defaultMergeProps(stateProps, dispatchProps, ownProps) {
return _extends({}, ownProps, stateProps, dispatchProps);
}
function wrapMergePropsFunc(mergeProps) {
return function initMergePropsProxy(dispatch, _ref) {
var displayName = _ref.displayName,
pure = _ref.pure,
areMergedPropsEqual = _ref.areMergedPropsEqual;
var hasRunOnce = false;
var mergedProps;
return function mergePropsProxy(stateProps, dispatchProps, ownProps) {
var nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps);
if (hasRunOnce) {
if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps;
} else {
hasRunOnce = true;
mergedProps = nextMergedProps;
if (false) {}
}
return mergedProps;
};
};
}
function whenMergePropsIsFunction(mergeProps) {
return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined;
}
function whenMergePropsIsOmitted(mergeProps) {
return !mergeProps ? function () {
return defaultMergeProps;
} : undefined;
}
/* harmony default export */ var connect_mergeProps = ([whenMergePropsIsFunction, whenMergePropsIsOmitted]);
// CONCATENATED MODULE: ./node_modules/react-redux/es/connect/verifySubselectors.js
function verify(selector, methodName, displayName) {
if (!selector) {
throw new Error("Unexpected value for " + methodName + " in " + displayName + ".");
} else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') {
if (!Object.prototype.hasOwnProperty.call(selector, 'dependsOnOwnProps')) {
warning("The selector for " + methodName + " of " + displayName + " did not specify a value for dependsOnOwnProps.");
}
}
}
function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) {
verify(mapStateToProps, 'mapStateToProps', displayName);
verify(mapDispatchToProps, 'mapDispatchToProps', displayName);
verify(mergeProps, 'mergeProps', displayName);
}
// CONCATENATED MODULE: ./node_modules/react-redux/es/connect/selectorFactory.js
function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) {
return function impureFinalPropsSelector(state, ownProps) {
return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps);
};
}
function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) {
var areStatesEqual = _ref.areStatesEqual,
areOwnPropsEqual = _ref.areOwnPropsEqual,
areStatePropsEqual = _ref.areStatePropsEqual;
var hasRunAtLeastOnce = false;
var state;
var ownProps;
var stateProps;
var dispatchProps;
var mergedProps;
function handleFirstCall(firstState, firstOwnProps) {
state = firstState;
ownProps = firstOwnProps;
stateProps = mapStateToProps(state, ownProps);
dispatchProps = mapDispatchToProps(dispatch, ownProps);
mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
hasRunAtLeastOnce = true;
return mergedProps;
}
function handleNewPropsAndNewState() {
stateProps = mapStateToProps(state, ownProps);
if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
return mergedProps;
}
function handleNewProps() {
if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps);
if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
return mergedProps;
}
function handleNewState() {
var nextStateProps = mapStateToProps(state, ownProps);
var statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps);
stateProps = nextStateProps;
if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
return mergedProps;
}
function handleSubsequentCalls(nextState, nextOwnProps) {
var propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps);
var stateChanged = !areStatesEqual(nextState, state);
state = nextState;
ownProps = nextOwnProps;
if (propsChanged && stateChanged) return handleNewPropsAndNewState();
if (propsChanged) return handleNewProps();
if (stateChanged) return handleNewState();
return mergedProps;
}
return function pureFinalPropsSelector(nextState, nextOwnProps) {
return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps);
};
} // TODO: Add more comments
// If pure is true, the selector returned by selectorFactory will memoize its results,
// allowing connectAdvanced's shouldComponentUpdate to return false if final
// props have not changed. If false, the selector will always return a new
// object and shouldComponentUpdate will always return true.
function finalPropsSelectorFactory(dispatch, _ref2) {
var initMapStateToProps = _ref2.initMapStateToProps,
initMapDispatchToProps = _ref2.initMapDispatchToProps,
initMergeProps = _ref2.initMergeProps,
options = _objectWithoutPropertiesLoose(_ref2, ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"]);
var mapStateToProps = initMapStateToProps(dispatch, options);
var mapDispatchToProps = initMapDispatchToProps(dispatch, options);
var mergeProps = initMergeProps(dispatch, options);
if (false) {}
var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory;
return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
}
// CONCATENATED MODULE: ./node_modules/react-redux/es/connect/connect.js
/*
connect is a facade over connectAdvanced. It turns its args into a compatible
selectorFactory, which has the signature:
(dispatch, options) => (nextState, nextOwnProps) => nextFinalProps
connect passes its args to connectAdvanced as options, which will in turn pass them to
selectorFactory each time a Connect component instance is instantiated or hot reloaded.
selectorFactory returns a final props selector from its mapStateToProps,
mapStateToPropsFactories, mapDispatchToProps, mapDispatchToPropsFactories, mergeProps,
mergePropsFactories, and pure args.
The resulting final props selector is called by the Connect component instance whenever
it receives new props or store state.
*/
function match(arg, factories, name) {
for (var i = factories.length - 1; i >= 0; i--) {
var result = factories[i](arg);
if (result) return result;
}
return function (dispatch, options) {
throw new Error("Invalid value of type " + typeof arg + " for " + name + " argument when connecting component " + options.wrappedComponentName + ".");
};
}
function strictEqual(a, b) {
return a === b;
} // createConnect with default args builds the 'official' connect behavior. Calling it with
// different options opens up some testing and extensibility scenarios
function createConnect(_temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$connectHOC = _ref.connectHOC,
connectHOC = _ref$connectHOC === void 0 ? connectAdvanced : _ref$connectHOC,
_ref$mapStateToPropsF = _ref.mapStateToPropsFactories,
mapStateToPropsFactories = _ref$mapStateToPropsF === void 0 ? connect_mapStateToProps : _ref$mapStateToPropsF,
_ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories,
mapDispatchToPropsFactories = _ref$mapDispatchToPro === void 0 ? connect_mapDispatchToProps : _ref$mapDispatchToPro,
_ref$mergePropsFactor = _ref.mergePropsFactories,
mergePropsFactories = _ref$mergePropsFactor === void 0 ? connect_mergeProps : _ref$mergePropsFactor,
_ref$selectorFactory = _ref.selectorFactory,
selectorFactory = _ref$selectorFactory === void 0 ? finalPropsSelectorFactory : _ref$selectorFactory;
return function connect(mapStateToProps, mapDispatchToProps, mergeProps, _ref2) {
if (_ref2 === void 0) {
_ref2 = {};
}
var _ref3 = _ref2,
_ref3$pure = _ref3.pure,
pure = _ref3$pure === void 0 ? true : _ref3$pure,
_ref3$areStatesEqual = _ref3.areStatesEqual,
areStatesEqual = _ref3$areStatesEqual === void 0 ? strictEqual : _ref3$areStatesEqual,
_ref3$areOwnPropsEqua = _ref3.areOwnPropsEqual,
areOwnPropsEqual = _ref3$areOwnPropsEqua === void 0 ? shallowEqual : _ref3$areOwnPropsEqua,
_ref3$areStatePropsEq = _ref3.areStatePropsEqual,
areStatePropsEqual = _ref3$areStatePropsEq === void 0 ? shallowEqual : _ref3$areStatePropsEq,
_ref3$areMergedPropsE = _ref3.areMergedPropsEqual,
areMergedPropsEqual = _ref3$areMergedPropsE === void 0 ? shallowEqual : _ref3$areMergedPropsE,
extraOptions = _objectWithoutPropertiesLoose(_ref3, ["pure", "areStatesEqual", "areOwnPropsEqual", "areStatePropsEqual", "areMergedPropsEqual"]);
var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps');
var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps');
var initMergeProps = match(mergeProps, mergePropsFactories, 'mergeProps');
return connectHOC(selectorFactory, _extends({
// used in error messages
methodName: 'connect',
// used to compute Connect's displayName from the wrapped component's displayName.
getDisplayName: function getDisplayName(name) {
return "Connect(" + name + ")";
},
// if mapStateToProps is falsy, the Connect component doesn't subscribe to store state changes
shouldHandleStateChanges: Boolean(mapStateToProps),
// passed through to selectorFactory
initMapStateToProps: initMapStateToProps,
initMapDispatchToProps: initMapDispatchToProps,
initMergeProps: initMergeProps,
pure: pure,
areStatesEqual: areStatesEqual,
areOwnPropsEqual: areOwnPropsEqual,
areStatePropsEqual: areStatePropsEqual,
areMergedPropsEqual: areMergedPropsEqual
}, extraOptions));
};
}
/* harmony default export */ var connect_connect = (/*#__PURE__*/createConnect());
// CONCATENATED MODULE: ./node_modules/react-redux/es/hooks/useReduxContext.js
/**
* A hook to access the value of the `ReactReduxContext`. This is a low-level
* hook that you should usually not need to call directly.
*
* @returns {any} the value of the `ReactReduxContext`
*
* @example
*
* import React from 'react'
* import { useReduxContext } from 'react-redux'
*
* export const CounterComponent = ({ value }) => {
* const { store } = useReduxContext()
* return <div>{store.getState()}</div>
* }
*/
function useReduxContext_useReduxContext() {
var contextValue = Object(react["useContext"])(ReactReduxContext);
if (false) {}
return contextValue;
}
// CONCATENATED MODULE: ./node_modules/react-redux/es/hooks/useStore.js
/**
* Hook factory, which creates a `useStore` hook bound to a given context.
*
* @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
* @returns {Function} A `useStore` hook bound to the specified context.
*/
function createStoreHook(context) {
if (context === void 0) {
context = ReactReduxContext;
}
var useReduxContext = context === ReactReduxContext ? useReduxContext_useReduxContext : function () {
return Object(react["useContext"])(context);
};
return function useStore() {
var _useReduxContext = useReduxContext(),
store = _useReduxContext.store;
return store;
};
}
/**
* A hook to access the redux store.
*
* @returns {any} the redux store
*
* @example
*
* import React from 'react'
* import { useStore } from 'react-redux'
*
* export const ExampleComponent = () => {
* const store = useStore()
* return <div>{store.getState()}</div>
* }
*/
var useStore_useStore = /*#__PURE__*/createStoreHook();
// CONCATENATED MODULE: ./node_modules/react-redux/es/hooks/useDispatch.js
/**
* Hook factory, which creates a `useDispatch` hook bound to a given context.
*
* @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
* @returns {Function} A `useDispatch` hook bound to the specified context.
*/
function createDispatchHook(context) {
if (context === void 0) {
context = ReactReduxContext;
}
var useStore = context === ReactReduxContext ? useStore_useStore : createStoreHook(context);
return function useDispatch() {
var store = useStore();
return store.dispatch;
};
}
/**
* A hook to access the redux `dispatch` function.
*
* @returns {any|function} redux store's `dispatch` function
*
* @example
*
* import React, { useCallback } from 'react'
* import { useDispatch } from 'react-redux'
*
* export const CounterComponent = ({ value }) => {
* const dispatch = useDispatch()
* const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
* return (
* <div>
* <span>{value}</span>
* <button onClick={increaseCounter}>Increase counter</button>
* </div>
* )
* }
*/
var useDispatch = /*#__PURE__*/createDispatchHook();
// CONCATENATED MODULE: ./node_modules/react-redux/es/hooks/useSelector.js
var refEquality = function refEquality(a, b) {
return a === b;
};
function useSelectorWithStoreAndSubscription(selector, equalityFn, store, contextSub) {
var _useReducer = Object(react["useReducer"])(function (s) {
return s + 1;
}, 0),
forceRender = _useReducer[1];
var subscription = Object(react["useMemo"])(function () {
return new Subscription(store, contextSub);
}, [store, contextSub]);
var latestSubscriptionCallbackError = Object(react["useRef"])();
var latestSelector = Object(react["useRef"])();
var latestStoreState = Object(react["useRef"])();
var latestSelectedState = Object(react["useRef"])();
var storeState = store.getState();
var selectedState;
try {
if (selector !== latestSelector.current || storeState !== latestStoreState.current || latestSubscriptionCallbackError.current) {
selectedState = selector(storeState);
} else {
selectedState = latestSelectedState.current;
}
} catch (err) {
if (latestSubscriptionCallbackError.current) {
err.message += "\nThe error may be correlated with this previous error:\n" + latestSubscriptionCallbackError.current.stack + "\n\n";
}
throw err;
}
useIsomorphicLayoutEffect(function () {
latestSelector.current = selector;
latestStoreState.current = storeState;
latestSelectedState.current = selectedState;
latestSubscriptionCallbackError.current = undefined;
});
useIsomorphicLayoutEffect(function () {
function checkForUpdates() {
try {
var newSelectedState = latestSelector.current(store.getState());
if (equalityFn(newSelectedState, latestSelectedState.current)) {
return;
}
latestSelectedState.current = newSelectedState;
} catch (err) {
// we ignore all errors here, since when the component
// is re-rendered, the selectors are called again, and
// will throw again, if neither props nor store state
// changed
latestSubscriptionCallbackError.current = err;
}
forceRender();
}
subscription.onStateChange = checkForUpdates;
subscription.trySubscribe();
checkForUpdates();
return function () {
return subscription.tryUnsubscribe();
};
}, [store, subscription]);
return selectedState;
}
/**
* Hook factory, which creates a `useSelector` hook bound to a given context.
*
* @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
* @returns {Function} A `useSelector` hook bound to the specified context.
*/
function createSelectorHook(context) {
if (context === void 0) {
context = ReactReduxContext;
}
var useReduxContext = context === ReactReduxContext ? useReduxContext_useReduxContext : function () {
return Object(react["useContext"])(context);
};
return function useSelector(selector, equalityFn) {
if (equalityFn === void 0) {
equalityFn = refEquality;
}
if (false) {}
var _useReduxContext = useReduxContext(),
store = _useReduxContext.store,
contextSub = _useReduxContext.subscription;
var selectedState = useSelectorWithStoreAndSubscription(selector, equalityFn, store, contextSub);
Object(react["useDebugValue"])(selectedState);
return selectedState;
};
}
/**
* A hook to access the redux store's state. This hook takes a selector function
* as an argument. The selector is called with the store state.
*
* This hook takes an optional equality comparison function as the second parameter
* that allows you to customize the way the selected state is compared to determine
* whether the component needs to be re-rendered.
*
* @param {Function} selector the selector function
* @param {Function=} equalityFn the function that will be used to determine equality
*
* @returns {any} the selected state
*
* @example
*
* import React from 'react'
* import { useSelector } from 'react-redux'
*
* export const CounterComponent = () => {
* const counter = useSelector(state => state.counter)
* return <div>{counter}</div>
* }
*/
var useSelector_useSelector = /*#__PURE__*/createSelectorHook();
// CONCATENATED MODULE: ./node_modules/react-redux/es/utils/reactBatchedUpdates.js
/* eslint-disable import/no-unresolved */
// CONCATENATED MODULE: ./node_modules/react-redux/es/index.js
setBatch(react_dom["unstable_batchedUpdates"]);
// CONCATENATED MODULE: /Users/jordaneldredge/projects/webamp/node_modules/redux-thunk/es/index.js
function createThunkMiddleware(extraArgument) {
return function (_ref) {
var dispatch = _ref.dispatch,
getState = _ref.getState;
return function (next) {
return function (action) {
if (typeof action === 'function') {
return action(dispatch, getState, extraArgument);
}
return next(action);
};
};
};
}
var thunk = createThunkMiddleware();
thunk.withExtraArgument = createThunkMiddleware;
/* harmony default export */ var es = (thunk);
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/redux-devtools-extension/index.js
var redux_devtools_extension = __webpack_require__(37);
// CONCATENATED MODULE: ./js/actionTypes.ts
const ADD_TRACK_FROM_URL = "ADD_TRACK_FROM_URL";
const CLOSE_WINAMP = "CLOSE_WINAMP";
const OPEN_WINAMP = "OPEN_WINAMP";
const MINIMIZE_WINAMP = "MINIMIZE_WINAMP";
const IS_PLAYING = "IS_PLAYING";
const IS_STOPPED = "IS_STOPPED";
const PAUSE = "PAUSE";
const PLAY = "PLAY";
const SEEK_TO_PERCENT_COMPLETE = "SEEK_TO_PERCENT_COMPLETE";
const SET_BALANCE = "SET_BALANCE";
const SET_BAND_VALUE = "SET_BAND_VALUE";
const SET_FOCUS = "SET_FOCUS";
const SET_BAND_FOCUS = "SET_BAND_FOCUS";
const SET_FOCUSED_WINDOW = "SET_FOCUSED_WINDOW";
const SET_MEDIA = "SET_MEDIA";
const SET_SCRUB_POSITION = "SET_SCRUB_POSITION";
const SET_SKIN_DATA = "SET_SKIN_DATA";
const SET_VOLUME = "SET_VOLUME";
const START_WORKING = "START_WORKING";
const STEP_MARQUEE = "STEP_MARQUEE";
const STOP = "STOP";
const STOP_WORKING = "STOP_WORKING";
const TOGGLE_DOUBLESIZE_MODE = "TOGGLE_DOUBLESIZE_MODE";
const SET_EQ_AUTO = "SET_EQ_AUTO";
const SET_EQ_ON = "SET_EQ_ON";
const SET_EQ_OFF = "SET_EQ_OFF";
const TOGGLE_LLAMA_MODE = "TOGGLE_LLAMA_MODE";
const TOGGLE_REPEAT = "TOGGLE_REPEAT";
const TOGGLE_SHUFFLE = "TOGGLE_SHUFFLE";
const TOGGLE_TIME_MODE = "TOGGLE_TIME_MODE";
const TOGGLE_VISUALIZER_STYLE = "TOGGLE_VISUALIZER_STYLE";
const UNSET_FOCUS = "UNSET_FOCUS";
const UPDATE_TIME_ELAPSED = "UPDATE_TIME_ELAPSED";
const SET_USER_MESSAGE = "SET_USER_MESSAGE";
const UNSET_USER_MESSAGE = "UNSET_USER_MESSAGE";
const SET_PLAYLIST_SCROLL_POSITION = "SET_PLAYLIST_SCROLL_POSITION";
const CLICKED_TRACK = "CLICKED_TRACK";
const CTRL_CLICKED_TRACK = "CTRL_CLICKED_TRACK";
const SHIFT_CLICKED_TRACK = "SHIFT_CLICKED_TRACK";
const SELECT_ALL = "SELECT_ALL";
const SELECT_ZERO = "SELECT_ZERO";
const INVERT_SELECTION = "INVERT_SELECTION";
const REMOVE_ALL_TRACKS = "REMOVE_ALL_TRACKS";
const CROP_TRACKS = "CROP_TRACKS";
const FILE_INFO = "FILE_INFO";
const REMOVE_TRACKS = "REMOVE_TRACKS";
const SET_AVAILABLE_SKINS = "SET_AVAILABLE_SKINS";
const REVERSE_LIST = "REVERSE_LIST";
const RANDOMIZE_LIST = "RANDOMIZE_LIST";
const SET_TRACK_ORDER = "SET_TRACK_ORDER";
const PLAY_TRACK = "PLAY_TRACK";
const BUFFER_TRACK = "BUFFER_TRACK";
const DRAG_SELECTED = "DRAG_SELECTED";
const SET_MEDIA_TAGS = "SET_MEDIA_TAGS";
const SET_MEDIA_DURATION = "SET_MEDIA_DURATION";
const TOGGLE_WINDOW = "TOGGLE_WINDOW";
const CLOSE_WINDOW = "CLOSE_WINDOW";
const MEDIA_TAG_REQUEST_INITIALIZED = "MEDIA_TAG_REQUEST_INITIALIZED";
const MEDIA_TAG_REQUEST_FAILED = "MEDIA_TAG_REQUEST_FAILED";
const NETWORK_CONNECTED = "NETWORK_CONNECTED";
const NETWORK_DISCONNECTED = "NETWORK_DISCONNECTED";
const UPDATE_WINDOW_POSITIONS = "UPDATE_WINDOW_POSITIONS";
const WINDOW_SIZE_CHANGED = "WINDOW_SIZE_CHANGED";
const TOGGLE_WINDOW_SHADE_MODE = "TOGGLE_WINDOW_SHADE_MODE";
const LOADED = "LOADED";
const SET_Z_INDEX = "SET_Z_INDEX";
const DISABLE_MARQUEE = "DISABLE_MARQUEE";
const SET_DUMMY_VIZ_DATA = "SET_DUMMY_VIZ_DATA";
const LOADING = "LOADING";
const CLOSE_REQUESTED = "CLOSE_REQUESTED";
const LOAD_SERIALIZED_STATE = "LOAD_SERIALIZED_STATE";
const RESET_WINDOW_SIZES = "RESET_WINDOW_SIZES";
const BROWSER_WINDOW_SIZE_CHANGED = "BROWSER_WINDOW_SIZE_CHANGED";
const LOAD_DEFAULT_SKIN = "LOAD_DEFAULT_SKIN";
const ENABLE_MILKDROP = "ENABLE_MILKDROP";
const SET_MILKDROP_DESKTOP = "SET_MILKDROP_DESKTOP";
const SET_VISUALIZER_STYLE = "SET_VISUALIZER_STYLE";
const GOT_BUTTERCHURN_PRESETS = "GOT_BUTTERCHURN_PRESETS";
const GOT_BUTTERCHURN = "GOT_BUTTERCHURN";
const RESOLVE_PRESET_AT_INDEX = "RESOLVE_PRESET_AT_INDEX";
const SELECT_PRESET_AT_INDEX = "SELECT_PRESET_AT_INDEX";
const TOGGLE_PRESET_OVERLAY = "TOGGLE_PRESET_OVERLAY";
const PRESET_REQUESTED = "PRESET_REQUESTED";
const TOGGLE_RANDOMIZE_PRESETS = "TOGGLE_RANDOMIZE_PRESETS";
const TOGGLE_PRESET_CYCLING = "TOGGLE_PRESET_CYCLING";
const SCHEDULE_MILKDROP_MESSAGE = "SCHEDULE_MILKDROP_MESSAGE";
const SET_MILKDROP_FULLSCREEN = "SET_MILKDROP_FULLSCREEN";
// EXTERNAL MODULE: ./js/baseSkin.json
var baseSkin = __webpack_require__(38);
// CONCATENATED MODULE: ./js/constants.ts
const BANDS = [60, 170, 310, 600, 1000, 3000, 6000, 12000, 14000, 16000];
const WINDOWS = {
MAIN: "main",
PLAYLIST: "playlist",
EQUALIZER: "equalizer",
MILKDROP: "milkdrop"
};
const LOAD_STYLE = {
BUFFER: "BUFFER",
PLAY: "PLAY",
NONE: "NONE"
}; // TODO: Make this an enum?
const MEDIA_TAG_REQUEST_STATUS = {
INITIALIZED: "INITIALIZED",
FAILED: "FAILED",
COMPLETE: "COMPLETE",
NOT_REQUESTED: "NOT_REQUESTED"
};
const UTF8_ELLIPSIS = "\u2026";
const CHARACTER_WIDTH = 5;
const WINDOW_RESIZE_SEGMENT_WIDTH = 25;
const WINDOW_RESIZE_SEGMENT_HEIGHT = 29;
const WINDOW_HEIGHT = 116;
const WINDOW_WIDTH = 275;
const TRACK_HEIGHT = 13;
const LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
const DEFAULT_SKIN = baseSkin;
const VISUALIZERS = {
OSCILLOSCOPE: "OSCILLOSCOPE",
BAR: "BAR",
NONE: "NONE",
MILKDROP: "MILKDROP"
};
const VISUALIZER_ORDER = [VISUALIZERS.BAR, VISUALIZERS.OSCILLOSCOPE, // TODO: Verify the order
VISUALIZERS.NONE];
const TIME_MODE = {
ELAPSED: "ELAPSED",
REMAINING: "REMAINING"
}; // TODO: Convert to enum once we are fully Typescript
const MEDIA_STATUS = {
PLAYING: "PLAYING",
STOPPED: "STOPPED",
PAUSED: "PAUSED"
};
// CONCATENATED MODULE: ./js/utils.ts
function imgFromUrl(url) {
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => {
resolve(img);
};
img.onerror = reject;
img.src = url;
});
}
const getTimeObj = time => {
if (time == null) {
// If we clean up `<MiniTime />` we don't need to do this any more.
return {
minutesFirstDigit: " ",
minutesSecondDigit: " ",
secondsFirstDigit: " ",
secondsSecondDigit: " "
};
}
const minutes = Math.floor(time / 60);
const seconds = time % 60;
const digits = time == null ? [" ", " ", " ", " "] : [String(Math.floor(minutes / 10)), String(Math.floor(minutes % 10)), String(Math.floor(seconds / 10)), String(Math.floor(seconds % 10))];
const [minutesFirstDigit, minutesSecondDigit, secondsFirstDigit, secondsSecondDigit] = digits;
return {
minutesFirstDigit,
minutesSecondDigit,
secondsFirstDigit,
secondsSecondDigit
};
};
const getTimeStr = (time, truncate = true) => {
if (time == null) {
return "";
}
const {
minutesFirstDigit,
minutesSecondDigit,
secondsFirstDigit,
secondsSecondDigit
} = getTimeObj(time);
return [truncate && minutesFirstDigit === "0" ? "" : minutesFirstDigit, minutesSecondDigit, ":", secondsFirstDigit, secondsSecondDigit].join("");
};
const parseViscolors = text => {
const entries = text.split("\n");
const regex = /^\s*(\d+)\s*,?\s*(\d+)\s*,?\s*(\d+)/;
const colors = [...DEFAULT_SKIN.colors];
entries.map(line => regex.exec(line)).filter(Boolean).map(matches => matches.slice(1, 4).join(",")).map((rgb, i) => {
colors[i] = `rgb(${rgb})`;
});
return colors;
};
const SECTION_REGEX = /^\s*\[(.+?)\]\s*$/;
const PROPERTY_REGEX = /^\s*([^;][^=]*)\s*=\s*(.*)\s*$/;
const parseIni = text => {
let section, match;
return text.split(/[\r\n]+/g).reduce((data, line) => {
if ((match = line.match(PROPERTY_REGEX)) && section != null) {
const key = match[1].trim().toLowerCase();
const value = match[2] // Ignore anything after a second `=`
// TODO: What if this is inside quotes or escaped?
.replace(/\=.*$/g, "").trim() // Strip quotes
// TODO: What about escaped quotes?
// TODO: What about unbalanced quotes?
.replace(/(^")|("$)|(^')|('$)/g, "");
data[section][key] = value;
} else if (match = line.match(SECTION_REGEX)) {
section = match[1].trim().toLowerCase();
data[section] = {};
}
return data;
}, {});
};
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
const sum = values => values.reduce((total, value) => total + value, 0);
function base64FromDataArray(dataArray) {
return window.btoa(Array.from(dataArray).map(byte => String.fromCharCode(byte)).join(""));
}
const base64FromArrayBuffer = arrayBuffer => {
return base64FromDataArray(new Uint8Array(arrayBuffer));
}; // https://stackoverflow.com/a/15832662/1263117
function downloadURI(uri, name) {
const link = document.createElement("a");
link.download = name;
link.href = uri;
window.document.body.appendChild(link);
link.click();
window.document.body.removeChild(link);
}
const toPercent = (min, max, value) => (value - min) / (max - min);
const percentToRange = (percent, min, max) => min + Math.round(percent * (max - min));
const percentToIndex = (percent, length) => percentToRange(percent, 0, length - 1);
const rebound = (oldMin, oldMax, newMin, newMax) => oldValue => percentToRange(toPercent(oldMin, oldMax, oldValue), newMin, newMax); // Convert an .eqf value to a 0-100
const normalizeEqBand = rebound(1, 64, 0, 100); // Convert a 0-100 to an .eqf value
const denormalizeEqBand = rebound(0, 100, 1, 64); // Merge a `source` object to a `target` recursively
// TODO: The typing here is a bit of a disaster.
function merge(target, source) {
const s = source;
const t = target; // Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties
for (const key of Object.keys(s)) {
if (s[key] instanceof Object) Object.assign(s[key], merge(t[key], s[key]));
} // Join `target` and modified `source`
Object.assign(target || {}, source);
return target;
} // Maps a value in a range (defined my min/max) to a value in an array (options).
function segment(min, max, value, newValues) {
const ratio = toPercent(min, max, value);
/*
| 0 | 1 | 2 |
0 1 2 3
*/
return newValues[percentToIndex(ratio, newValues.length)];
} // https://bost.ocks.org/mike/shuffle/
// Shuffle an array in O(n)
function utils_shuffle(array) {
const sorted = [...array];
let m = sorted.length; // While there remain elements to shuffle…
while (m) {
// Pick a remaining element…
const i = Math.floor(Math.random() * m--); // And swap it with the current element.
const val = sorted[m];
sorted[m] = sorted[i];
sorted[i] = val;
}
return sorted;
}
function sort(array, iteratee) {
return [...array].sort((a, b) => {
const aKey = iteratee(a);
const bKey = iteratee(b);
if (aKey < bKey) {
return -1;
} else if (aKey > bKey) {
return 1;
}
return 0;
});
}
function moveSelected(arr, isSelected, offset) {
const newArr = new Array(arr.length);
let next = 0;
for (let i = 0; i < newArr.length; i++) {
const from = i - offset; // Is a value supposed to move here?
if (from >= 0 && from < arr.length && isSelected(from)) {
newArr[i] = arr[from];
} else {
while (next < arr.length && isSelected(next)) {
next++;
}
newArr[i] = arr[next];
next++;
}
}
return newArr;
}
function spliceIn(original, start, newValues) {
const newArr = [...original];
newArr.splice(start, 0, ...newValues);
return newArr;
}
function replaceAtIndex(arr, index, newValue) {
return [...arr.slice(0, index), newValue, ...arr.slice(index + 1)];
}
function debounce(func, delay) {
let timeout;
let callbackArgs = [];
return function (context, ...args) {
callbackArgs = args;
if (timeout != null) {
clearTimeout(timeout);
}
timeout = window.setTimeout(() => {
func.apply(context, callbackArgs);
}, delay);
};
} // Trailing edge only throttle
function throttle(func, delay) {
let timeout = null;
let callbackArgs = [];
return function (context, ...args) {
callbackArgs = args;
if (!timeout) {
timeout = window.setTimeout(() => {
func.apply(context, callbackArgs);
timeout = null;
}, delay);
}
};
}
let counter = 0;
function uniqueId() {
return counter++;
}
function objectForEach(obj, cb) {
Object.keys(obj).forEach(key => cb(obj[key], key));
}
function objectMap(obj, cb) {
const modified = {};
Object.keys(obj).forEach(key => modified[key] = cb(obj[key], key));
return modified;
}
function objectFilter(obj, predicate) {
// TODO: Could return the original reference if no values change
return Object.keys(obj).reduce((newObj, key) => {
if (predicate(obj[key], key)) {
newObj[key] = obj[key];
}
return newObj;
}, {});
}
const calculateBoundingBox = windows => {
if (windows.length === 0) {
return null;
}
const windowSizes = windows.map(w => ({
left: w.x,
top: w.y,
bottom: w.y + w.height,
right: w.x + w.width
}));
return windowSizes.reduce((b, w) => ({
left: Math.min(b.left, w.left),
top: Math.min(b.top, w.top),
bottom: Math.max(b.bottom, w.bottom),
right: Math.max(b.right, w.right)
}));
};
function findLastIndex(arr, cb) {
for (let i = arr.length - 1; i >= 0; i--) {
if (cb(arr[i])) {
return i;
}
}
return -1;
}
function utils_getWindowSize() {
// Aparently this is crazy across browsers.
return {
width: Math.max(document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.body.clientWidth, document.documentElement.clientWidth),
height: Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight)
};
}
function getScreenSize() {
return {
width: window.screen.width,
height: window.screen.height
};
}
function getPos(e) {
switch (e.type) {
case "touchstart":
case "touchmove":
{
var _targetTouches$;
const touch = (_targetTouches$ = e.targetTouches[0]) !== null && _targetTouches$ !== void 0 ? _targetTouches$ : e.touches[0];
if (touch == null) {
// Investigating https://github.com/captbaritone/webamp/issues/1105
throw new Error("Unexpected touch event with zero touch targets.");
}
return touch;
}
case "mousedown":
case "mousemove":
{
return e;
}
default:
throw new Error(`Unexpected event type: ${e.type}`);
}
}
function getX(e) {
return getPos(e).clientX;
}
function getY(e) {
return getPos(e).clientY;
}
function weakMapMemoize(func) {
const cache = new WeakMap();
return value => {
if (!cache.has(value)) {
cache.set(value, func(value));
}
return cache.get(value);
};
}
// CONCATENATED MODULE: ./js/reducers/playlist.ts
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const defaultPlaylistState = {
trackOrder: [],
currentTrack: null,
lastSelectedIndex: null,
selectedTracks: new Set()
};
function toggleSetMembership(set, value) {
if (set.has(value)) {
set.delete(value);
} else {
set.add(value);
}
}
const playlist = (state = defaultPlaylistState, action) => {
switch (action.type) {
case CLICKED_TRACK:
return _objectSpread(_objectSpread({}, state), {}, {
selectedTracks: new Set([state.trackOrder[action.index]]),
lastSelectedIndex: action.index
});
case CTRL_CLICKED_TRACK:
{
const id = state.trackOrder[action.index];
const newSelectedTracks = new Set(state.selectedTracks);
toggleSetMembership(newSelectedTracks, id);
return _objectSpread(_objectSpread({}, state), {}, {
selectedTracks: newSelectedTracks,
// Using this as the lastClickedIndex is kinda funny, since you
// may have just _un_selected the track. However, this is what
// Winamp 2 does, so we'll copy it.
lastSelectedIndex: action.index
});
}
case SHIFT_CLICKED_TRACK:
if (state.lastSelectedIndex == null) {
return state;
}
const clickedIndex = action.index;
const start = Math.min(clickedIndex, state.lastSelectedIndex);
const end = Math.max(clickedIndex, state.lastSelectedIndex);
const selectedTracks = new Set(state.trackOrder.slice(start, end + 1));
return _objectSpread(_objectSpread({}, state), {}, {
selectedTracks
});
case SELECT_ALL:
return _objectSpread(_objectSpread({}, state), {}, {
selectedTracks: new Set(state.trackOrder)
});
case SELECT_ZERO:
return _objectSpread(_objectSpread({}, state), {}, {
selectedTracks: new Set()
});
case INVERT_SELECTION:
return _objectSpread(_objectSpread({}, state), {}, {
selectedTracks: new Set(state.trackOrder.filter(id => !state.selectedTracks.has(id)))
});
case REMOVE_ALL_TRACKS:
// TODO: Consider disposing of ObjectUrls
return _objectSpread(_objectSpread({}, state), {}, {
trackOrder: [],
currentTrack: null,
selectedTracks: new Set(),
lastSelectedIndex: null
});
case REMOVE_TRACKS:
// TODO: Consider disposing of ObjectUrls
const actionIds = new Set(action.ids.map(Number));
const {
currentTrack
} = state;
return _objectSpread(_objectSpread({}, state), {}, {
trackOrder: state.trackOrder.filter(trackId => !actionIds.has(trackId)),
currentTrack: actionIds.has(Number(currentTrack)) ? null : currentTrack,
selectedTracks: new Set(Array.from(state.selectedTracks).filter(id => actionIds.has(id))),
// TODO: This could probably be made to work, but we clear it just to be safe.
lastSelectedIndex: null
});
case REVERSE_LIST:
return _objectSpread(_objectSpread({}, state), {}, {
trackOrder: [...state.trackOrder].reverse(),
// TODO: This could probably be made to work, but we clear it just to be safe.
lastSelectedIndex: null
});
case RANDOMIZE_LIST:
return _objectSpread(_objectSpread({}, state), {}, {
trackOrder: utils_shuffle(state.trackOrder)
});
case SET_TRACK_ORDER:
const {
trackOrder
} = action;
return _objectSpread(_objectSpread({}, state), {}, {
trackOrder
});
case ADD_TRACK_FROM_URL:
const atIndex = action.atIndex == null ? state.trackOrder.length : action.atIndex;
return _objectSpread(_objectSpread({}, state), {}, {
trackOrder: [...state.trackOrder.slice(0, atIndex), Number(action.id), ...state.trackOrder.slice(atIndex)],
// TODO: This could probably be made to work, but we clear it just to be safe.
lastSelectedIndex: null
});
case PLAY_TRACK:
case BUFFER_TRACK:
return _objectSpread(_objectSpread({}, state), {}, {
currentTrack: action.id
});
case DRAG_SELECTED:
return _objectSpread(_objectSpread({}, state), {}, {
trackOrder: moveSelected(state.trackOrder, i => state.selectedTracks.has(state.trackOrder[i]), action.offset),
// TODO: This could probably be made to work, but we clear it just to be safe.
lastSelectedIndex: null
});
default:
return state;
}
};
/* harmony default export */ var reducers_playlist = (playlist);
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/@babel/runtime/helpers/objectWithoutProperties.js
var objectWithoutProperties = __webpack_require__(7);
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
// CONCATENATED MODULE: ./js/reducers/windows.ts
function windows_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function windows_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { windows_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { windows_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const defaultWindowsState = {
focused: WINDOWS.MAIN,
positionsAreRelative: true,
genWindows: {
// TODO: Remove static capabilites and derive them from ids/generic
[WINDOWS.MAIN]: {
title: "Main Window",
size: [0, 0],
open: true,
shade: false,
canResize: false,
canShade: true,
canDouble: true,
hotkey: "Alt+W",
position: {
x: 0,
y: 0
}
},
[WINDOWS.EQUALIZER]: {
title: "Equalizer",
size: [0, 0],
open: true,
shade: false,
canResize: false,
canShade: true,
canDouble: true,
hotkey: "Alt+G",
position: {
x: 0,
y: 0
}
},
[WINDOWS.PLAYLIST]: {
title: "Playlist Editor",
size: [0, 0],
open: true,
shade: false,
canResize: true,
canShade: true,
canDouble: false,
hotkey: "Alt+E",
position: {
x: 0,
y: 0
}
}
},
browserWindowSize: {
width: 0,
height: 0
},
windowOrder: [WINDOWS.PLAYLIST, WINDOWS.EQUALIZER, WINDOWS.MILKDROP, WINDOWS.MAIN]
};
const windows_windows = (state = defaultWindowsState, action) => {
switch (action.type) {
case ENABLE_MILKDROP:
return windows_objectSpread(windows_objectSpread({}, state), {}, {
genWindows: windows_objectSpread(windows_objectSpread({}, state.genWindows), {}, {
[WINDOWS.MILKDROP]: {
title: "Milkdrop",
size: [0, 0],
open: action.open,
shade: false,
canResize: true,
canShade: false,
canDouble: false,
position: {
x: 0,
y: 0
}
}
})
});
case SET_FOCUSED_WINDOW:
let windowOrder = state.windowOrder;
if (action.window != null) {
windowOrder = [...state.windowOrder.filter(windowId => windowId !== action.window), action.window];
}
return windows_objectSpread(windows_objectSpread({}, state), {}, {
focused: action.window,
windowOrder
});
case TOGGLE_WINDOW_SHADE_MODE:
const {
canShade
} = state.genWindows[action.windowId];
if (!canShade) {
throw new Error(`Tried to shade/unshade a window that cannot be shaded: ${action.windowId}`);
}
return windows_objectSpread(windows_objectSpread({}, state), {}, {
genWindows: windows_objectSpread(windows_objectSpread({}, state.genWindows), {}, {
[action.windowId]: windows_objectSpread(windows_objectSpread({}, state.genWindows[action.windowId]), {}, {
shade: !state.genWindows[action.windowId].shade
})
})
});
case TOGGLE_WINDOW:
const windowState = state.genWindows[action.windowId];
return windows_objectSpread(windows_objectSpread({}, state), {}, {
genWindows: windows_objectSpread(windows_objectSpread({}, state.genWindows), {}, {
[action.windowId]: windows_objectSpread(windows_objectSpread({}, windowState), {}, {
open: !windowState.open
})
})
});
case CLOSE_WINDOW:
return windows_objectSpread(windows_objectSpread({}, state), {}, {
genWindows: windows_objectSpread(windows_objectSpread({}, state.genWindows), {}, {
[action.windowId]: windows_objectSpread(windows_objectSpread({}, state.genWindows[action.windowId]), {}, {
open: false
})
})
});
case WINDOW_SIZE_CHANGED:
const {
canResize
} = state.genWindows[action.windowId];
if (!canResize) {
throw new Error(`Tried to resize a window that cannot be resized: ${action.windowId}`);
}
return windows_objectSpread(windows_objectSpread({}, state), {}, {
genWindows: windows_objectSpread(windows_objectSpread({}, state.genWindows), {}, {
[action.windowId]: windows_objectSpread(windows_objectSpread({}, state.genWindows[action.windowId]), {}, {
size: action.size
})
})
});
case UPDATE_WINDOW_POSITIONS:
return windows_objectSpread(windows_objectSpread({}, state), {}, {
positionsAreRelative: action.absolute === true ? false : state.positionsAreRelative,
genWindows: objectMap(state.genWindows, (w, windowId) => {
const newPosition = action.positions[windowId];
if (newPosition == null) {
return w;
}
return windows_objectSpread(windows_objectSpread({}, w), {}, {
position: newPosition
});
})
});
case RESET_WINDOW_SIZES:
return windows_objectSpread(windows_objectSpread({}, state), {}, {
genWindows: objectMap(state.genWindows, w => windows_objectSpread(windows_objectSpread({}, w), {}, {
// Not sure why TypeScript can't figure this out for itself.
size: [0, 0]
}))
});
case LOAD_SERIALIZED_STATE:
{
const {
genWindows,
focused,
positionsAreRelative
} = action.serializedState.windows;
return windows_objectSpread(windows_objectSpread({}, state), {}, {
positionsAreRelative,
genWindows: objectMap(state.genWindows, (w, windowId) => {
const serializedW = genWindows[windowId];
if (serializedW == null) {
return w;
} // Pull out `hidden` since it's been removed from our state.
const {
hidden
} = serializedW,
rest = objectWithoutProperties_default()(serializedW, ["hidden"]);
return windows_objectSpread(windows_objectSpread({}, w), rest);
}),
focused
});
}
case BROWSER_WINDOW_SIZE_CHANGED:
return windows_objectSpread(windows_objectSpread({}, state), {}, {
browserWindowSize: {
height: action.height,
width: action.width
}
});
default:
return state;
}
};
function getSerializedState(state) {
return {
positionsAreRelative: state.positionsAreRelative,
genWindows: objectMap(state.genWindows, w => {
return {
size: w.size,
open: w.open,
hidden: false,
// Not used any more
shade: w.shade || false,
position: w.position
};
}),
focused: state.focused
};
}
/* harmony default export */ var reducers_windows = (windows_windows);
// CONCATENATED MODULE: ./js/reducers/media.ts
function media_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function media_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { media_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { media_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const defaultState = {
timeMode: TIME_MODE.ELAPSED,
timeElapsed: 0,
// The winamp ini file declares the default volume as "200".
// The UI seems to show a default volume near 78, which would
// math with the default value being 200 out of 255.
volume: Math.round(200 / 255 * 100),
balance: 0,
shuffle: false,
repeat: false,
// TODO: Enforce possible values
status: MEDIA_STATUS.STOPPED
};
const media_media = (state = defaultState, action) => {
switch (action.type) {
// TODO: Make these constants
case PLAY:
case IS_PLAYING:
return media_objectSpread(media_objectSpread({}, state), {}, {
status: MEDIA_STATUS.PLAYING
});
case PAUSE:
return media_objectSpread(media_objectSpread({}, state), {}, {
status: MEDIA_STATUS.PAUSED
});
case STOP:
case IS_STOPPED:
return media_objectSpread(media_objectSpread({}, state), {}, {
status: MEDIA_STATUS.STOPPED
});
case TOGGLE_TIME_MODE:
const newMode = state.timeMode === TIME_MODE.REMAINING ? TIME_MODE.ELAPSED : TIME_MODE.REMAINING;
return media_objectSpread(media_objectSpread({}, state), {}, {
timeMode: newMode
});
case UPDATE_TIME_ELAPSED:
return media_objectSpread(media_objectSpread({}, state), {}, {
timeElapsed: action.elapsed
});
case SET_MEDIA:
return media_objectSpread({}, state);
case SET_VOLUME:
return media_objectSpread(media_objectSpread({}, state), {}, {
volume: action.volume
});
case SET_BALANCE:
return media_objectSpread(media_objectSpread({}, state), {}, {
balance: action.balance
});
case TOGGLE_REPEAT:
return media_objectSpread(media_objectSpread({}, state), {}, {
repeat: !state.repeat
});
case TOGGLE_SHUFFLE:
return media_objectSpread(media_objectSpread({}, state), {}, {
shuffle: !state.shuffle
});
case LOAD_SERIALIZED_STATE:
return media_objectSpread(media_objectSpread({}, state), action.serializedState.media);
default:
return state;
}
};
function media_getSerializedState(state) {
const {
volume,
balance,
shuffle,
repeat
} = state;
return {
volume,
balance,
shuffle,
repeat
};
}
/* harmony default export */ var reducers_media = (media_media);
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/reselect/lib/index.js
var lib = __webpack_require__(3);
// CONCATENATED MODULE: ./js/reducers/display.ts
function display_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function display_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { display_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { display_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const defaultSkinGenExColors = {
itemBackground: "rgb(0,0,0)",
itemForeground: "rgb(0,255,0)",
windowBackground: "rgb(56,55,87)",
buttonText: "rgb(57,57,66)",
windowText: "rgb(255,255,255)",
divider: "rgb(117,116,139)",
playlistSelection: "rgb(0,0,198)",
listHeaderBackground: "rgb(72,72,120)",
listHeaderText: "rgb(255,255,255)",
listHeaderFrameTopAndLeft: "rgb(108,108,180)",
listHeaderFrameBottomAndRight: "rgb(36,36,60)",
listHeaderFramePressed: "rgb(18,18,30)",
listHeaderDeadArea: "rgb(36,36,60)",
scrollbarOne: "rgb(36,36,60)",
scrollbarTwo: "rgb(36,36,60)",
pressedScrollbarOne: "rgb(121,130,150)",
pressedScrollbarTwo: "rgb(78,88,110)",
scrollbarDeadArea: "rgb(36,36,60)",
listTextHighlighted: "rgb(0,198,255)",
listTextHighlightedBackground: "rgb(0,198,255)",
listTextSelected: "rgb(0,198,255)",
listTextSelectedBackground: "rgb(0,198,255)"
};
const defaultDisplayState = {
doubled: false,
marqueeStep: 0,
disableMarquee: false,
loading: true,
llama: false,
closed: false,
working: false,
skinImages: DEFAULT_SKIN.images,
skinColors: DEFAULT_SKIN.colors,
skinCursors: null,
skinPlaylistStyle: null,
skinRegion: {},
visualizerStyle: 0,
// Index into VISUALIZER_ORDER
dummyVizData: null,
playlistScrollPosition: 0,
skinGenLetterWidths: null,
// TODO: Get the default value for this?
skinGenExColors: defaultSkinGenExColors,
additionalVisualizers: [],
zIndex: 0
};
const display = (state = defaultDisplayState, action) => {
switch (action.type) {
case LOAD_DEFAULT_SKIN:
{
const {
skinImages,
skinColors,
skinCursors,
skinPlaylistStyle,
skinRegion,
skinGenLetterWidths,
skinGenExColors
} = defaultDisplayState;
return display_objectSpread(display_objectSpread({}, state), {}, {
skinImages,
skinColors,
skinCursors,
skinPlaylistStyle,
skinRegion,
skinGenLetterWidths,
skinGenExColors
});
}
case TOGGLE_DOUBLESIZE_MODE:
return display_objectSpread(display_objectSpread({}, state), {}, {
doubled: !state.doubled
});
case TOGGLE_LLAMA_MODE:
return display_objectSpread(display_objectSpread({}, state), {}, {
llama: !state.llama
});
case STEP_MARQUEE:
return state.disableMarquee ? state : display_objectSpread(display_objectSpread({}, state), {}, {
marqueeStep: state.marqueeStep + 1
});
case DISABLE_MARQUEE:
return display_objectSpread(display_objectSpread({}, state), {}, {
disableMarquee: true
});
case STOP_WORKING:
return display_objectSpread(display_objectSpread({}, state), {}, {
working: false
});
case START_WORKING:
return display_objectSpread(display_objectSpread({}, state), {}, {
working: true
});
case CLOSE_WINAMP:
return display_objectSpread(display_objectSpread({}, state), {}, {
closed: true
});
case OPEN_WINAMP:
return display_objectSpread(display_objectSpread({}, state), {}, {
closed: false
});
case LOADING:
return display_objectSpread(display_objectSpread({}, state), {}, {
loading: true
});
case LOADED:
return display_objectSpread(display_objectSpread({}, state), {}, {
loading: false
});
case SET_SKIN_DATA:
const {
data
} = action;
return display_objectSpread(display_objectSpread({}, state), {}, {
loading: false,
skinImages: data.skinImages,
skinColors: data.skinColors,
skinPlaylistStyle: data.skinPlaylistStyle,
skinCursors: data.skinCursors,
skinRegion: data.skinRegion,
skinGenLetterWidths: data.skinGenLetterWidths,
skinGenExColors: data.skinGenExColors || defaultSkinGenExColors
});
case TOGGLE_VISUALIZER_STYLE:
return display_objectSpread(display_objectSpread({}, state), {}, {
visualizerStyle: (state.visualizerStyle + 1) % VISUALIZER_ORDER.length
});
case SET_PLAYLIST_SCROLL_POSITION:
return display_objectSpread(display_objectSpread({}, state), {}, {
playlistScrollPosition: action.position
});
case SET_Z_INDEX:
return display_objectSpread(display_objectSpread({}, state), {}, {
zIndex: action.zIndex
});
case SET_DUMMY_VIZ_DATA:
return display_objectSpread(display_objectSpread({}, state), {}, {
dummyVizData: action.data
});
case LOAD_SERIALIZED_STATE:
{
const _action$serializedSta = action.serializedState.display,
{
skinCursors
} = _action$serializedSta,
rest = objectWithoutProperties_default()(_action$serializedSta, ["skinCursors"]);
const upgrade = url => ({
type: "cur",
url
});
const newSkinCursors = skinCursors == null ? null : objectMap(skinCursors, upgrade);
return display_objectSpread(display_objectSpread({}, state), {}, {
skinCursors: newSkinCursors
}, rest);
}
default:
return state;
}
};
/* harmony default export */ var reducers_display = (display);
const display_getSerializedState = state => {
// My kingdom for a type-safe `_.pick`.
const {
visualizerStyle,
doubled,
llama,
marqueeStep,
skinImages,
skinCursors,
skinRegion,
skinGenLetterWidths,
skinColors,
skinPlaylistStyle
} = state;
let newCursors = null;
if (skinCursors != null) {
// @ts-ignore Typescript does not like that we can have `undefined` as
// values here. Since this is going to get serialized to JSON (which will
// drop undefined) it's fine.
// This code is geting removed soon anyway.
newCursors = objectMap(skinCursors, cursor => {
return cursor.type === "cur" ? cursor.url : undefined;
});
}
return {
visualizerStyle,
doubled,
llama,
marqueeStep,
skinImages,
skinCursors: newCursors,
skinRegion,
skinGenLetterWidths,
skinColors,
skinPlaylistStyle
};
};
const getVisualizerStyle = Object(lib["createSelector"])(state => state.visualizerStyle, visualizationStyle => {
return VISUALIZER_ORDER[visualizationStyle];
});
// CONCATENATED MODULE: ./js/reducers/userInput.ts
function userInput_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function userInput_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { userInput_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { userInput_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const defaultUserInput = {
focus: null,
bandFocused: null,
scrubPosition: 0,
userMessage: null
};
const userInput = (state = defaultUserInput, action) => {
switch (action.type) {
case SET_FOCUS:
return userInput_objectSpread(userInput_objectSpread({}, state), {}, {
focus: action.input,
bandFocused: null
});
case SET_BAND_FOCUS:
return userInput_objectSpread(userInput_objectSpread({}, state), {}, {
focus: action.input,
bandFocused: action.bandFocused
});
case UNSET_FOCUS:
return userInput_objectSpread(userInput_objectSpread({}, state), {}, {
focus: null,
bandFocused: null
});
case SET_SCRUB_POSITION:
return userInput_objectSpread(userInput_objectSpread({}, state), {}, {
scrubPosition: action.position
});
case SET_USER_MESSAGE:
return userInput_objectSpread(userInput_objectSpread({}, state), {}, {
userMessage: action.message
});
case UNSET_USER_MESSAGE:
return userInput_objectSpread(userInput_objectSpread({}, state), {}, {
userMessage: null
});
default:
return state;
}
};
/* harmony default export */ var reducers_userInput = (userInput);
// CONCATENATED MODULE: ./js/reducers/equalizer.ts
function equalizer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function equalizer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { equalizer_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { equalizer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const equalizer_defaultState = {
on: true,
auto: false,
sliders: {
preamp: 50,
60: 50,
170: 50,
310: 50,
600: 50,
1000: 50,
3000: 50,
6000: 50,
12000: 50,
14000: 50,
16000: 50
}
};
const equalizer = (state = equalizer_defaultState, action) => {
switch (action.type) {
case SET_BAND_VALUE:
const newSliders = equalizer_objectSpread(equalizer_objectSpread({}, state.sliders), {}, {
[action.band]: action.value
});
return equalizer_objectSpread(equalizer_objectSpread({}, state), {}, {
sliders: newSliders
});
case SET_EQ_ON:
return equalizer_objectSpread(equalizer_objectSpread({}, state), {}, {
on: true
});
case SET_EQ_OFF:
return equalizer_objectSpread(equalizer_objectSpread({}, state), {}, {
on: false
});
case SET_EQ_AUTO:
return equalizer_objectSpread(equalizer_objectSpread({}, state), {}, {
auto: action.value
});
case LOAD_SERIALIZED_STATE:
return action.serializedState.equalizer || state;
default:
return state;
}
};
function equalizer_getSerializedState(state) {
return state;
}
/* harmony default export */ var reducers_equalizer = (equalizer);
// CONCATENATED MODULE: ./js/reducers/network.ts
function network_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function network_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { network_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { network_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const network = (state = {
connected: true
}, action) => {
switch (action.type) {
case NETWORK_CONNECTED:
return network_objectSpread(network_objectSpread({}, state), {}, {
connected: true
});
case NETWORK_DISCONNECTED:
return network_objectSpread(network_objectSpread({}, state), {}, {
connected: false
});
default:
return state;
}
};
/* harmony default export */ var reducers_network = (network);
// CONCATENATED MODULE: ./js/reducers/settings.ts
function settings_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function settings_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { settings_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { settings_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const defaultSettingsState = {
availableSkins: []
};
const settings = (state = defaultSettingsState, action) => {
switch (action.type) {
case SET_AVAILABLE_SKINS:
return settings_objectSpread(settings_objectSpread({}, state), {}, {
availableSkins: action.skins
});
default:
return state;
}
};
/* harmony default export */ var reducers_settings = (settings);
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/invariant/browser.js
var browser = __webpack_require__(19);
var browser_default = /*#__PURE__*/__webpack_require__.n(browser);
// CONCATENATED MODULE: ./js/fileUtils.ts
// Import music-metadata type definitions
function genMediaTags(file, musicMetadata) {
browser_default()(file != null, "Attempted to get the tags of media file without passing a file");
const options = {
duration: true,
skipPostHeaders: true // avoid unnecessary data to be read
};
if (typeof file === "string") {
return musicMetadata.fetchFromUrl(file, options);
} // Assume Blob
return musicMetadata.parseBlob(file, options);
}
function genMediaDuration(url) {
browser_default()(typeof url === "string", "Attempted to get the duration of media file without passing a url");
return new Promise((resolve, reject) => {
// TODO: Does this actually stop downloading the file once it's
// got the duration?
const audio = document.createElement("audio");
audio.crossOrigin = "anonymous";
const durationChange = () => {
resolve(audio.duration);
audio.removeEventListener("durationchange", durationChange);
audio.src = ""; // TODO: Not sure if this really gets cleaned up.
};
audio.addEventListener("durationchange", durationChange);
audio.addEventListener("error", e => {
reject(e);
});
audio.src = url;
});
}
async function genArrayBufferFromFileReference(fileReference) {
browser_default()(fileReference != null, "Attempt to get an ArrayBuffer without assigning a fileReference");
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => {
resolve(reader.result);
};
reader.onerror = reject;
reader.readAsArrayBuffer(fileReference);
});
}
async function genStringFromFileReference(fileReference) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => {
resolve(reader.result);
};
reader.onerror = reject;
reader.readAsText(fileReference);
});
}
async function promptForFileReferences({
accept,
directory = false
} = {
accept: null,
directory: false
}) {
return new Promise(resolve => {
// Does this represent a memory leak somehow?
// Can this fail? Do we ever reject?
const fileInput = document.createElement("input");
if (accept) fileInput.setAttribute("accept", accept);
fileInput.type = "file";
fileInput.multiple = true; // @ts-ignore Non-standard
fileInput.webkitdirectory = directory; // @ts-ignore Non-standard
fileInput.directory = directory; // @ts-ignore Non-standard
fileInput.mozdirectory = directory; // Not entirely sure why this is needed, since the input
// was just created, but somehow this helps prevent change
// events from getting swallowed.
// https://stackoverflow.com/a/12102992/1263117
// @ts-ignore Technically you can't set this to null, it has to be a string.
// But I don't feel like retesting it, so I'll leave it as null
fileInput.value = null;
fileInput.addEventListener("change", e => {
const files = e.target.files;
resolve(files);
});
fileInput.click();
});
}
function urlIsBlobUrl(url) {
return /^blob:/.test(url);
}
function curUrlFromByteArray(arr) {
const base64 = base64FromDataArray(arr);
return `data:image/x-win-bitmap;base64,${base64}`;
} // This is not perfect, but... meh: https://stackoverflow.com/a/36756650/1263117
function filenameFromUrl(url) {
if (urlIsBlobUrl(url)) {
return null;
}
const lastSegment = url.split("/").pop();
if (lastSegment == null) {
return null;
}
return lastSegment.split("#")[0].split("?")[0];
}
// CONCATENATED MODULE: ./js/trackUtils.ts
const trackName = weakMapMemoize(track => {
const {
artist,
title,
defaultName,
url
} = track;
if (artist && title) {
return `${artist} - ${title}`;
} else if (title) {
return title;
} else if (defaultName) {
return defaultName;
} else if (url) {
const filename = filenameFromUrl(url);
if (filename) {
return filename;
}
}
return "???";
});
const trackFilename = weakMapMemoize(track => {
if (track.url) {
const urlFilename = filenameFromUrl(track.url);
if (urlFilename != null) {
return urlFilename;
}
}
if (track.defaultName) {
return track.defaultName;
}
return "???";
});
// CONCATENATED MODULE: ./js/reducers/tracks.ts
function tracks_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function tracks_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { tracks_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { tracks_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const tracks_defaultPlaylistState = {};
const tracks_tracks = (state = tracks_defaultPlaylistState, action) => {
var _action$duration;
switch (action.type) {
case ADD_TRACK_FROM_URL:
return tracks_objectSpread(tracks_objectSpread({}, state), {}, {
[action.id]: {
id: action.id,
defaultName: action.defaultName || null,
duration: (_action$duration = action.duration) !== null && _action$duration !== void 0 ? _action$duration : null,
url: action.url,
mediaTagsRequestStatus: MEDIA_TAG_REQUEST_STATUS.INITIALIZED
}
});
case SET_MEDIA:
{
const newTrack = tracks_objectSpread(tracks_objectSpread({}, state[action.id]), {}, {
duration: action.length
});
return tracks_objectSpread(tracks_objectSpread({}, state), {}, {
[action.id]: newTrack
});
}
case MEDIA_TAG_REQUEST_INITIALIZED:
return tracks_objectSpread(tracks_objectSpread({}, state), {}, {
[action.id]: tracks_objectSpread(tracks_objectSpread({}, state[action.id]), {}, {
mediaTagsRequestStatus: MEDIA_TAG_REQUEST_STATUS.INITIALIZED
})
});
case MEDIA_TAG_REQUEST_FAILED:
return tracks_objectSpread(tracks_objectSpread({}, state), {}, {
[action.id]: tracks_objectSpread(tracks_objectSpread({}, state[action.id]), {}, {
mediaTagsRequestStatus: MEDIA_TAG_REQUEST_STATUS.FAILED
})
});
case SET_MEDIA_DURATION:
{
return tracks_objectSpread(tracks_objectSpread({}, state), {}, {
[action.id]: tracks_objectSpread(tracks_objectSpread({}, state[action.id]), {}, {
duration: action.duration
})
});
}
case SET_MEDIA_TAGS:
const track = state[action.id];
const {
sampleRate,
bitrate,
numberOfChannels,
title,
artist,
album,
albumArtUrl
} = action;
const {
kbps,
khz,
channels
} = track;
return tracks_objectSpread(tracks_objectSpread({}, state), {}, {
[action.id]: tracks_objectSpread(tracks_objectSpread({}, track), {}, {
mediaTagsRequestStatus: MEDIA_TAG_REQUEST_STATUS.COMPLETE,
title,
artist,
album,
albumArtUrl,
kbps: bitrate != null ? String(Math.round(bitrate / 1000)) : kbps,
khz: sampleRate != null ? String(Math.round(sampleRate / 1000)) : khz,
channels: numberOfChannels != null ? numberOfChannels : channels
})
});
default:
return state;
}
};
/* harmony default export */ var reducers_tracks = (tracks_tracks);
const getTrackDisplayName = (state, id = null) => {
if (id == null) {
return null;
}
const track = state[id];
if (track == null) {
return null;
}
return trackName(track);
};
// CONCATENATED MODULE: ./js/types.ts
// Avoid warnings from Webpack: https://github.com/webpack/webpack/issues/7378
// TODO: Use a type to ensure these keys mirror the CURSORS constant in
// skinParser.js
// TODO: Type these keys.
// TODO: type these keys
// TODO: Fill these out once we actually use them.
// This is what we actually pass to butterchurn
// A URL that points to a Butterchurn preset
let TransitionType;
(function (TransitionType) {
TransitionType[TransitionType["IMMEDIATE"] = 0] = "IMMEDIATE";
TransitionType[TransitionType["DEFAULT"] = 1] = "DEFAULT";
TransitionType[TransitionType["USER_PRESET"] = 2] = "USER_PRESET";
})(TransitionType || (TransitionType = {}));
// CONCATENATED MODULE: ./js/reducers/milkdrop.ts
function milkdrop_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function milkdrop_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { milkdrop_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { milkdrop_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const defaultMilkdropState = {
display: "WINDOW",
overlay: false,
presetHistory: [],
presets: [],
currentPresetIndex: null,
butterchurn: null,
transitionType: TransitionType.DEFAULT,
randomize: true,
cycling: true,
message: null
};
const milkdrop_milkdrop = (state = defaultMilkdropState, action) => {
switch (action.type) {
case SET_MILKDROP_DESKTOP:
return milkdrop_objectSpread(milkdrop_objectSpread({}, state), {}, {
display: action.enabled ? "DESKTOP" : "WINDOW"
});
case SET_MILKDROP_FULLSCREEN:
return milkdrop_objectSpread(milkdrop_objectSpread({}, state), {}, {
display: action.enabled ? "FULLSCREEN" : "WINDOW"
});
case GOT_BUTTERCHURN:
return milkdrop_objectSpread(milkdrop_objectSpread({}, state), {}, {
butterchurn: action.butterchurn
});
case GOT_BUTTERCHURN_PRESETS:
return milkdrop_objectSpread(milkdrop_objectSpread({}, state), {}, {
presets: state.presets.concat(action.presets)
});
case PRESET_REQUESTED:
if (action.addToHistory) {
return milkdrop_objectSpread(milkdrop_objectSpread({}, state), {}, {
presetHistory: [...state.presetHistory, action.index]
});
}
return milkdrop_objectSpread(milkdrop_objectSpread({}, state), {}, {
presetHistory: state.presetHistory.slice(0, -1)
});
case RESOLVE_PRESET_AT_INDEX:
const preset = state.presets[action.index];
return milkdrop_objectSpread(milkdrop_objectSpread({}, state), {}, {
presets: replaceAtIndex(state.presets, action.index, {
type: "RESOLVED",
name: preset.name,
preset: action.json
})
});
case SELECT_PRESET_AT_INDEX:
return milkdrop_objectSpread(milkdrop_objectSpread({}, state), {}, {
currentPresetIndex: action.index,
transitionType: action.transitionType
});
case TOGGLE_PRESET_OVERLAY:
return milkdrop_objectSpread(milkdrop_objectSpread({}, state), {}, {
overlay: !state.overlay
});
case TOGGLE_RANDOMIZE_PRESETS:
return milkdrop_objectSpread(milkdrop_objectSpread({}, state), {}, {
randomize: !state.randomize
});
case TOGGLE_PRESET_CYCLING:
return milkdrop_objectSpread(milkdrop_objectSpread({}, state), {}, {
cycling: !state.cycling
});
case SCHEDULE_MILKDROP_MESSAGE:
return milkdrop_objectSpread(milkdrop_objectSpread({}, state), {}, {
message: {
text: action.message,
time: Date.now()
}
});
default:
return state;
}
};
/* harmony default export */ var reducers_milkdrop = (milkdrop_milkdrop);
// CONCATENATED MODULE: ./js/reducers/index.ts
const reducer = Object(redux["combineReducers"])({
userInput: reducers_userInput,
windows: reducers_windows,
display: reducers_display,
settings: reducers_settings,
equalizer: reducers_equalizer,
playlist: reducers_playlist,
media: reducers_media,
network: reducers_network,
tracks: reducers_tracks,
milkdrop: reducers_milkdrop
});
/* harmony default export */ var reducers = (reducer);
// CONCATENATED MODULE: ./js/playlistHtml.tsx
function playlistHtml_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function playlistHtml_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { playlistHtml_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { playlistHtml_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const getAsDataURI = text => `data:text/html;base64,${window.btoa(text)}`; // Replaces deprecated "noshade" attribute
const noshadeStyle = {
height: "2px",
borderWidth: 0,
color: "gray",
backgroundColor: "gray"
}; // We use all kinds of non-standard attributes and tags. So we create these fake
// components to trick Typescript.
const Body = props => {
// @ts-ignore
return /*#__PURE__*/Object(jsx_runtime["jsx"])("body", playlistHtml_objectSpread({}, props));
};
const Font = props => {
// @ts-ignore
return /*#__PURE__*/Object(jsx_runtime["jsx"])("font", playlistHtml_objectSpread({}, props));
};
const Hr = props => {
// @ts-ignore
return /*#__PURE__*/Object(jsx_runtime["jsx"])("hr", playlistHtml_objectSpread({}, props));
};
const Div = props => {
// @ts-ignore
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", playlistHtml_objectSpread({}, props));
};
const Table = props => {
// @ts-ignore
return /*#__PURE__*/Object(jsx_runtime["jsx"])("table", playlistHtml_objectSpread({}, props));
}; // TODO: Move <html> tag out to the string creation step in order
// to avoid the warning.
const Playlist = props => /*#__PURE__*/Object(jsx_runtime["jsxs"])("html", {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])("head", {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("link", {
rel: "stylesheet",
href: "null"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("style", {
type: "text/css",
children: `
body { background: #000040; }
.para1 { margin-top: -42px; margin-left: 145px; margin-right: 10px; font-family: "font2, Arial"; font-size: 30px; line-height: 35px; text-align: left; color: #E1E1E1; }
.para2 { margin-top: 15px; margin-left: 15px; margin-right: 50px; font-family: "font1, Arial Black"; font-size: 50px; line-height: 40px; text-align: left; color: #004080; }
`
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("title", {
children: "Winamp Generated PlayList"
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(Body, {
bgcolor: "#000080",
topmargin: "0",
leftmargin: "0",
text: "#FFFFFF",
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(Div, {
align: "center",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Div, {
className: "para2",
align: "center",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("p", {
children: "WINAMP"
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Div, {
className: "para1",
align: "center",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("p", {
children: "playlist"
})
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Hr, {
align: "left",
width: "90%",
size: "1",
color: "#FFBF00",
style: noshadeStyle
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Div, {
align: "right",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(Table, {
border: "0",
cellSpacing: "0",
cellPadding: "0",
width: "98%",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("tbody", {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("tr", {
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])("td", {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("small", {
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])("small", {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Font, {
face: "Arial",
color: "#FFBF00",
children: props.numberOfTracks
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Font, {
color: "#409FFF",
face: "Arial",
children: " track in playlist, average track length: "
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Font, {
face: "Arial",
color: "#FFBF00",
children: props.averageTrackLength
})]
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("br", {}), /*#__PURE__*/Object(jsx_runtime["jsx"])("small", {
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])("small", {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Font, {
color: "#409FFF",
face: "Arial",
children: "Playlist length: "
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Font, {
face: "Arial",
color: "#FFBF00",
children: props.playlistLengthMinutes
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Font, {
color: "#409FFF",
face: "Arial",
children: " minutes "
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Font, {
face: "Arial",
color: "#FFBF00",
children: props.playlistLengthSeconds
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Font, {
color: "#409FFF",
face: "Arial",
children: " second "
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("br", {}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(Font, {
color: "#409FFF",
face: "Arial",
children: ["Right-click ", /*#__PURE__*/Object(jsx_runtime["jsx"])("a", {
href: "./",
children: "here"
}), " to save this HTML file."]
})]
})
})]
})
})
})
})
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("blockquote", {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("p", {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(Font, {
color: "#FFBF00",
face: "Arial",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("big", {
children: "Playlist files:"
})
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("ul", {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(Font, {
face: "Arial",
color: "#FFFFFF",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("small", {
children: props.tracks.map(track => /*#__PURE__*/Object(jsx_runtime["jsxs"])("span", {
children: [track, /*#__PURE__*/Object(jsx_runtime["jsx"])("br", {})]
}, track))
})
})
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Hr, {
align: "left",
width: "90%",
size: "1",
color: "#FFBF00",
style: noshadeStyle
})]
})]
});
const createPlaylistHTML = props => {
const node = document.createElement("div");
Object(react_dom["render"])( /*#__PURE__*/Object(jsx_runtime["jsx"])(Playlist, playlistHtml_objectSpread({}, props)), node);
return node.innerHTML;
};
const createPlaylistURL = props => getAsDataURI(createPlaylistHTML(props));
// CONCATENATED MODULE: ./js/marqueeUtils.tsx
const getBalanceText = balance => {
if (balance === 0) {
return "Balance: Center";
}
const direction = balance > 0 ? "Right" : "Left";
return `Balance: ${Math.abs(balance)}% ${direction}`;
};
const getVolumeText = volume => `Volume: ${volume}%`;
const getPositionText = (duration, seekToPercent) => {
const newElapsedStr = getTimeStr(duration * seekToPercent / 100, false);
const durationStr = getTimeStr(duration, false);
return `Seek to: ${newElapsedStr}/${durationStr} (${seekToPercent}%)`;
};
const getDoubleSizeModeText = enabled => `${enabled ? "Disable" : "Enable"} doublesize mode`;
const formatHz = hz => hz < 1000 ? `${hz}HZ` : `${hz / 1000}KHZ`; // Format a number as a string, ensuring it has a + or - sign
const ensureSign = num => num > 0 ? `+${num}` : num.toString(); // Round to 1 and exactly 1 decimal point
const roundToTenths = num => (Math.round(num * 10) / 10).toFixed(1);
const getEqText = (band, level) => {
const db = roundToTenths((level - 50) / 50 * 12);
const label = band === "preamp" ? "Preamp" : formatHz(band);
return `EQ: ${label} ${ensureSign(db)} DB`;
};
// CONCATENATED MODULE: ./js/resizeUtils.ts
function getPositionDiff(graph, sizeDiff) {
const newGraph = {};
const positionDiff = {};
for (const key of Object.keys(graph)) {
newGraph[key] = {
above: [],
left: []
};
positionDiff[key] = {
x: 0,
y: 0
};
} // Construct an inverted graph
for (const [key, neighbors] of Object.entries(graph)) {
const {
below,
right
} = neighbors;
if (right != null) {
newGraph[right].left.push(key);
}
if (below != null) {
newGraph[below].above.push(key);
}
}
function walkRight(key) {
const node = newGraph[key];
const nodeSizeDiff = sizeDiff[key];
node.left.forEach(left => {
positionDiff[left].x += nodeSizeDiff.width + positionDiff[key].x;
walkRight(left);
});
}
function walkDown(key) {
const node = newGraph[key];
const nodeSizeDiff = sizeDiff[key];
node.above.forEach(above => {
positionDiff[above].y += nodeSizeDiff.height + positionDiff[key].y;
walkDown(above);
});
} // Find disconnected nodes, and walk
for (const [key, neighbors] of Object.entries(graph)) {
if (neighbors.below == null) {
walkDown(key);
}
if (neighbors.right == null) {
walkRight(key);
}
}
return positionDiff;
}
function generateGraph(windows) {
const bottoms = {};
const rights = {};
for (const w of windows) {
const bottom = w.y + w.height;
if (bottoms[bottom]) {
bottoms[bottom].push(w);
} else {
bottoms[bottom] = [w];
}
const right = w.x + w.width;
if (rights[right]) {
rights[right].push(w);
} else {
rights[right] = [w];
}
}
const graph = {};
for (const w of windows) {
const edges = {};
const top = w.y;
const left = w.x;
const tops = bottoms[top];
const lefts = rights[left];
if (tops) {
for (const below of tops) {
const isToTheLeft = below.x + below.width < w.x;
const isToTheRight = below.x > w.x + w.width;
const overlapsInX = !(isToTheLeft || isToTheRight);
if (overlapsInX) {
edges.below = below.key;
break;
}
}
}
if (lefts) {
for (const right of lefts) {
const isAbove = right.y + right.height < w.y;
const isBelow = right.y > w.y + w.height;
const overlapsInY = !(isAbove || isBelow);
if (overlapsInY) {
edges.right = right.key;
break;
}
}
}
graph[w.key] = edges;
}
return graph;
}
// CONCATENATED MODULE: ./js/selectors.ts
function selectors_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const getSliders = state => state.equalizer.sliders;
const getEqfData = Object(lib["createSelector"])(getSliders, sliders => {
const preset = {
name: "Entry1",
preamp: denormalizeEqBand(sliders.preamp)
};
BANDS.forEach(band => {
preset[`hz${band}`] = denormalizeEqBand(sliders[band]);
});
const eqfData = {
presets: [preset],
type: "Winamp EQ library file v1.1"
};
return eqfData;
});
const getTracks = state => state.tracks;
const getTrackUrl = state => {
return id => {
var _state$tracks$id;
return (_state$tracks$id = state.tracks[id]) === null || _state$tracks$id === void 0 ? void 0 : _state$tracks$id.url;
};
};
const getTrackOrder = state => state.playlist.trackOrder;
const getTrackCount = Object(lib["createSelector"])(getTrackOrder, trackOrder => trackOrder.length);
const getOrderedTracks = Object(lib["createSelector"])(getTracks, getTrackOrder, (tracks, trackOrder) => trackOrder.filter(id => tracks[id]));
const getUserTracks = Object(lib["createSelector"])(getTracks, getTrackOrder, (tracks, trackOrder) => trackOrder.map(id => {
const track = tracks[id];
return {
url: track.url,
metaData: {
artist: track.artist || "",
title: track.title || "",
album: track.album,
albumArtUrl: track.albumArtUrl || ""
}
};
}));
const getOrderedTrackObjects = Object(lib["createSelector"])(getTracks, getOrderedTracks, (tracks, trackOrder) => trackOrder.map(id => tracks[id]));
const getSelectedTrackIds = state => {
return state.playlist.selectedTracks;
};
const getSelectedTrackObjects = Object(lib["createSelector"])(getOrderedTrackObjects, getSelectedTrackIds, (tracks, selectedIds) => tracks.filter(track => selectedIds.has(track.id))); // If a duration is `null`, it counts as zero, which seems fine enough.
const runningTimeFromTracks = tracks => tracks.reduce((time, track) => time + Number(track.duration), 0);
const getTotalRunningTime = Object(lib["createSelector"])(getOrderedTrackObjects, runningTimeFromTracks);
const getSelectedRunningTime = Object(lib["createSelector"])(getSelectedTrackObjects, runningTimeFromTracks); // Note: We should append "+" to these values if some of the tracks are of unknown time.
const getRunningTimeMessage = Object(lib["createSelector"])(getTotalRunningTime, getSelectedRunningTime, (totalRunningTime, selectedRunningTime) => `${getTimeStr(selectedRunningTime)}/${getTimeStr(totalRunningTime)}`); // TODO: use slectors to get memoization
const getCurrentTrackIndex = state => {
const {
playlist
} = state;
if (playlist.currentTrack == null) {
return -1;
}
return playlist.trackOrder.indexOf(playlist.currentTrack);
};
const getCurrentTrackNumber = Object(lib["createSelector"])(getCurrentTrackIndex, currentTrackIndex => currentTrackIndex + 1);
const getCurrentTrackId = state => state.playlist.currentTrack; // TODO: Sigh... Technically, we should detect if we are looping only repeat if we are.
// I think this would require pre-computing the "random" order of a playlist.
const getRandomTrackId = state => {
const {
playlist: {
trackOrder,
currentTrack
}
} = state;
if (trackOrder.length === 0) {
return null;
}
let nextId;
do {
nextId = trackOrder[Math.floor(trackOrder.length * Math.random())];
} while (nextId === currentTrack && trackOrder.length > 1);
return nextId;
};
const getNextTrackId = (state, n = 1) => {
const {
playlist: {
trackOrder
},
media: {
repeat,
shuffle
}
} = state;
if (shuffle) {
return getRandomTrackId(state);
}
const trackCount = getTrackCount(state);
if (trackCount === 0) {
return null;
}
const currentIndex = getCurrentTrackIndex(state);
let nextIndex = currentIndex + n;
if (repeat) {
nextIndex = nextIndex % trackCount;
if (nextIndex < 0) {
// Handle wrapping around backwards
nextIndex += trackCount;
}
return trackOrder[nextIndex];
}
if (currentIndex === trackCount - 1 && n > 0) {
return null;
} else if (currentIndex === 0 && n < 0) {
return null;
}
nextIndex = clamp(nextIndex, 0, trackCount - 1);
return trackOrder[nextIndex];
};
const getGenWindows = state => {
return state.windows.genWindows;
};
const selectors_getWindowOpen = Object(lib["createSelector"])(getGenWindows, genWindows => {
return windowId => genWindows[windowId].open;
});
const selectors_getWindowHidden = Object(lib["createSelector"])(getMilkdropWindowEnabled, milkdropWindowEnabled => {
return windowId => {
return windowId === WINDOWS.MILKDROP && !milkdropWindowEnabled;
};
});
const selectors_getWindowShade = Object(lib["createSelector"])(getGenWindows, genWindows => {
return windowId => genWindows[windowId].shade;
});
const selectors_getWindowSize = Object(lib["createSelector"])(getGenWindows, genWindows => {
return windowId => genWindows[windowId].size;
});
const getWindowPositions = Object(lib["createSelector"])(getGenWindows, windows => objectMap(windows, w => w.position));
const BASE_WINDOW_HEIGHT = 58;
const getNumberOfVisibleTracks = Object(lib["createSelector"])(selectors_getWindowSize, getWindowSize_ => {
const playlistSize = getWindowSize_("playlist");
return Math.floor((BASE_WINDOW_HEIGHT + WINDOW_RESIZE_SEGMENT_HEIGHT * playlistSize[1]) / TRACK_HEIGHT);
});
const getOverflowTrackCount = Object(lib["createSelector"])(getTrackCount, getNumberOfVisibleTracks, (trackCount, numberOfVisibleTracks) => Math.max(0, trackCount - numberOfVisibleTracks));
const _getPlaylistScrollPosition = state => state.display.playlistScrollPosition;
const getPlaylistScrollPosition = Object(lib["createSelector"])(getOverflowTrackCount, _getPlaylistScrollPosition, (overflowTrackCount, playlistScrollPosition) => {
if (overflowTrackCount === 0) {
return 0;
}
return Math.round(Math.round(overflowTrackCount * playlistScrollPosition / 100) / overflowTrackCount * 100);
});
const getScrollOffset = Object(lib["createSelector"])(_getPlaylistScrollPosition, getTrackCount, getNumberOfVisibleTracks, (playlistScrollPosition, trackCount, numberOfVisibleTracks) => {
const overflow = Math.max(0, trackCount - numberOfVisibleTracks);
return percentToIndex(playlistScrollPosition / 100, overflow + 1);
});
const getVisibleTrackIds = Object(lib["createSelector"])(getScrollOffset, getTrackOrder, getNumberOfVisibleTracks, (offset, trackOrder, numberOfVisibleTracks) => trackOrder.slice(offset, offset + numberOfVisibleTracks));
function getAllTracksAreVisible(state) {
return getVisibleTrackIds(state).length === state.playlist.trackOrder.length;
}
const getTrackIsVisibleFunction = Object(lib["createSelector"])(getVisibleTrackIds, visibleTrackIds => {
return id => visibleTrackIds.includes(id);
});
const getVisibleTracks = Object(lib["createSelector"])(getVisibleTrackIds, getTracks, (visibleTrackIds, tracks) => visibleTrackIds.map(id => tracks[id]));
const getPlaylist = state => state.playlist;
const getDuration = state => {
const {
playlist,
tracks
} = state;
if (playlist.currentTrack == null) {
return null;
}
const currentTrack = tracks[playlist.currentTrack];
return currentTrack && currentTrack.duration;
};
const selectors_getTrackDisplayName = Object(lib["createSelector"])(getTracks, tracks => {
return Object(lib["defaultMemoize"])(trackId => getTrackDisplayName(tracks, trackId));
});
const getCurrentTrackDisplayName = Object(lib["createSelector"])(getCurrentTrackId, selectors_getTrackDisplayName, (id, getName) => {
return getName(id);
});
const getMediaStatus = state => {
return state.media.status;
};
const getMediaIsPlaying = state => state.media.status === MEDIA_STATUS.PLAYING;
const getCurrentTrack = Object(lib["createSelector"])(getCurrentTrackId, getTracks, (trackId, tracks) => {
return trackId == null ? null : tracks[trackId];
});
const getCurrentlyPlayingTrackIdIfLoaded = Object(lib["createSelector"])(getMediaIsPlaying, getCurrentTrack, (mediaIsPlaying, currentTrack) => {
if (!mediaIsPlaying || !currentTrack || currentTrack.mediaTagsRequestStatus === MEDIA_TAG_REQUEST_STATUS.INITIALIZED) {
return null;
}
return currentTrack.id;
});
const getCurrentTrackInfo = Object(lib["createSelector"])(getCurrentTrack, track => {
if (track == null) {
return null;
}
return {
url: track.url,
metaData: {
title: track.title || null,
artist: track.artist || null,
album: track.album || null,
albumArtUrl: track.albumArtUrl || null
}
};
});
const getMinimalMediaText = Object(lib["createSelector"])(getCurrentTrackNumber, getCurrentTrackDisplayName, (trackNumber, name) => name == null ? null : `${trackNumber}. ${name}`);
const getMediaText = Object(lib["createSelector"])(getMinimalMediaText, getDuration, (minimalMediaText, duration) => minimalMediaText == null ? null : `${minimalMediaText} (${getTimeStr(duration)})`);
const getNumberOfTracks = state => getTrackOrder(state).length;
const getPlaylistDuration = Object(lib["createSelector"])(getTracks, tracks => Object.values(tracks).reduce((total, track) => total + (track.duration || 0), 0));
const getPlaylistURL = Object(lib["createSelector"])(getNumberOfTracks, getPlaylistDuration, getTrackOrder, getTracks, selectors_getTrackDisplayName, (numberOfTracks, playlistDuration, trackOrder, tracks, getDisplayName) => createPlaylistURL({
numberOfTracks,
averageTrackLength: getTimeStr(playlistDuration / numberOfTracks),
// TODO: Handle hours
playlistLengthMinutes: Math.floor(playlistDuration / 60),
playlistLengthSeconds: Math.floor(playlistDuration % 60),
tracks: trackOrder.map((id, i) => `${i + 1}. ${getDisplayName(id)} (${getTimeStr(tracks[id].duration)})`)
}));
const selectors_WINDOW_HEIGHT = 116;
const SHADE_WINDOW_HEIGHT = 14;
function getWPixelSize(w, doubled) {
const [width, height] = w.size;
const doubledMultiplier = doubled && w.canDouble ? 2 : 1;
const pix = {
height: selectors_WINDOW_HEIGHT + height * WINDOW_RESIZE_SEGMENT_HEIGHT,
width: WINDOW_WIDTH + width * WINDOW_RESIZE_SEGMENT_WIDTH
};
return {
height: (w.shade ? SHADE_WINDOW_HEIGHT : pix.height) * doubledMultiplier,
width: pix.width * doubledMultiplier
};
}
function getFocusedWindow(state) {
return state.windows.focused;
}
function getWindowPosition(state) {
return windowId => state.windows.genWindows[windowId].position;
}
function getPositionsAreRelative(state) {
return state.windows.positionsAreRelative;
}
function getDoubled(state) {
return state.display.doubled;
}
function getLlamaMode(state) {
return state.display.llama;
}
function getZIndex(state) {
return state.display.zIndex;
} // TODO: This is poorly memoized. It invalidates when a window moves.
const getWindowSizes = Object(lib["createSelector"])(getGenWindows, getDoubled, (windows, doubled) => {
return objectMap(windows, w => getWPixelSize(w, doubled));
});
const selectors_getWindowPixelSize = Object(lib["createSelector"])(getWindowSizes, sizes => {
return windowId => sizes[windowId];
});
const getWindowOrder = state => state.windows.windowOrder;
const getNormalizedWindowOrder = Object(lib["createSelector"])(getWindowOrder, getGenWindows, (windowOrder, genWindows) => {
return [WINDOWS.MAIN, ...windowOrder.filter(windowId => windowId !== WINDOWS.MAIN && genWindows[windowId] != null)];
}); // TODO: Now that both size and position are stored on genWindows this seems a bit silly.
const getWindowsInfo = Object(lib["createSelector"])(getWindowSizes, getWindowPositions, getNormalizedWindowOrder, (sizes, positions, windowOrder) => {
return windowOrder.map(key => selectors_objectSpread(selectors_objectSpread({
key
}, sizes[key]), positions[key]));
});
const getWindowGraph = Object(lib["createSelector"])(getWindowsInfo, generateGraph);
const defaultPlaylistStyle = {
normal: "#00FF00",
current: "#FFFFFF",
normalbg: "#000000",
selectedbg: "#0000C6",
font: "Arial"
};
function getSkinColors(state) {
return state.display.skinColors;
}
const getSkinPlaylistStyle = state => {
return state.display.skinPlaylistStyle || defaultPlaylistStyle;
};
const selectors_getVisualizerStyle = state => {
const milkdrop = state.windows.genWindows[WINDOWS.MILKDROP];
if (milkdrop != null && milkdrop.open) {
return VISUALIZERS.MILKDROP;
}
return getVisualizerStyle(state.display);
};
const getVolume = state => state.media.volume;
const getBalance = state => state.media.balance;
const getShuffle = state => state.media.shuffle;
const getRepeat = state => state.media.repeat;
const getChannels = Object(lib["createSelector"])(getCurrentTrack, track => {
return track != null ? track.channels || null : null;
});
const getTimeElapsed = state => {
return state.media.timeElapsed;
};
function getSerlializedState(state) {
return {
version: 1,
media: media_getSerializedState(state.media),
equalizer: equalizer_getSerializedState(state.equalizer),
display: display_getSerializedState(state.display),
windows: getSerializedState(state.windows)
};
}
function getEqualizerEnabled(state) {
return state.equalizer.on;
}
function getEqualizerAuto(state) {
return state.equalizer.auto;
}
function getBrowserWindowSize(state) {
return state.windows.browserWindowSize;
}
const getOpenWindows = Object(lib["createSelector"])(getGenWindows, genWindows => objectFilter(genWindows, w => w.open));
const getStackedLayoutPositions = Object(lib["createSelector"])(getOpenWindows, getDoubled, (openWindows, doubled) => {
let offset = 0;
return objectMap(openWindows, w => {
const position = {
x: 0,
y: offset
};
offset += getWPixelSize(w, doubled).height;
return position;
});
});
const getUserInputFocus = state => {
return state.userInput.focus;
};
const getUserInputScrubPosition = state => {
return state.userInput.scrubPosition;
}; // TODO: Make this a reselect selector
const getMarqueeText = state => {
const defaultText = "Winamp 2.91";
if (state.userInput.userMessage != null) {
return state.userInput.userMessage;
}
switch (getUserInputFocus(state)) {
case "balance":
return getBalanceText(state.media.balance);
case "volume":
return getVolumeText(state.media.volume);
case "position":
const duration = getDuration(state);
if (duration == null) {
// This probably can't ever happen.
return defaultText;
}
return getPositionText(duration, getUserInputScrubPosition(state));
case "double":
return getDoubleSizeModeText(state.display.doubled);
case "eq":
const band = state.userInput.bandFocused;
if (band == null) {
// This probably can't ever happen.
return defaultText;
}
return getEqText(band, state.equalizer.sliders[band]);
default:
break;
}
if (state.playlist.currentTrack != null) {
const mediaText = getMediaText(state);
if (mediaText == null) {
// This probably can't ever happen.
return defaultText;
}
return mediaText;
}
return defaultText;
};
const getKbps = Object(lib["createSelector"])(getCurrentTrack, track => {
return track != null ? track.kbps || null : null;
});
const getKhz = Object(lib["createSelector"])(getCurrentTrack, track => {
return track != null ? track.khz || null : null;
});
function getMilkdropMessage(state) {
return state.milkdrop.message;
}
function getMilkdropWindowEnabled(state) {
return state.milkdrop.display === "WINDOW";
}
function getMilkdropDesktopEnabled(state) {
return state.milkdrop.display === "DESKTOP";
}
function getMilkdropFullscreenEnabled(state) {
return state.milkdrop.display === "FULLSCREEN";
}
function selectors_getPresets(state) {
return state.milkdrop.presets;
}
function getButterchurn(state) {
return state.milkdrop.butterchurn;
}
function getPresetTransitionType(state) {
return state.milkdrop.transitionType;
}
function getCurrentPresetIndex(state) {
return state.milkdrop.currentPresetIndex;
}
function getCurrentPreset(state) {
const index = getCurrentPresetIndex(state);
if (index == null) {
return null;
}
const preset = state.milkdrop.presets[index];
if (preset == null || preset.type === "UNRESOLVED") {
return null;
}
return preset.preset;
}
function getPresetNames(state) {
return state.milkdrop.presets.map(preset => preset.name);
}
function getPresetOverlayOpen(state) {
return state.milkdrop.overlay;
}
function getPresetsAreCycling(state) {
return state.milkdrop.cycling;
}
function getRandomizePresets(state) {
return state.milkdrop.randomize;
}
function getClosed(state) {
return state.display.closed;
}
function getSkinImages(state) {
return state.display.skinImages;
}
function getSkinCursors(state) {
return state.display.skinCursors;
}
function getSkinRegion(state) {
return state.display.skinRegion;
}
function getSkinLetterWidths(state) {
return state.display.skinGenLetterWidths;
}
function getPreampLineUrl(state) {
return state.display.skinImages.EQ_PREAMP_LINE;
}
function getLineColorsUrl(state) {
return state.display.skinImages.EQ_GRAPH_LINE_COLORS;
}
const getPreampLineImage = Object(lib["createSelector"])(getPreampLineUrl, async url => {
if (url == null) {
return null;
}
return imgFromUrl(url);
});
const getLineColorsImage = Object(lib["createSelector"])(getLineColorsUrl, async url => {
if (url == null) {
return null;
}
return imgFromUrl(url);
});
function getDummyVizData(state) {
return state.display.dummyVizData;
}
function getMarqueeStep(state) {
return state.display.marqueeStep;
}
function getNetworkConnected(state) {
return state.network.connected;
}
function getTimeMode(state) {
return state.media.timeMode;
}
function getLoading(state) {
return state.display.loading;
}
function getWorking(state) {
return state.display.working;
}
function getAvaliableSkins(state) {
return state.settings.availableSkins;
}
// CONCATENATED MODULE: ./js/snapUtils.ts
function snapUtils_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function snapUtils_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { snapUtils_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { snapUtils_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const SNAP_DISTANCE = 15;
const snapUtils_top = box => box.y;
const snapUtils_bottom = box => box.y + box.height;
const snapUtils_left = box => box.x;
const snapUtils_right = box => box.x + box.width;
const near = (a, b) => Math.abs(a - b) < SNAP_DISTANCE; // http://stackoverflow.com/a/3269471/1263117
const overlapX = (a, b) => snapUtils_left(a) <= snapUtils_right(b) + SNAP_DISTANCE && snapUtils_left(b) <= snapUtils_right(a) + SNAP_DISTANCE;
const overlapY = (a, b) => snapUtils_top(a) <= snapUtils_bottom(b) + SNAP_DISTANCE && snapUtils_top(b) <= snapUtils_bottom(a) + SNAP_DISTANCE; // Give a new position for `boxA` that snaps it to `boxB` if neede.
const snap = (boxA, boxB) => {
let x, y; // TODO: Refactor/simplify this code
if (overlapY(boxA, boxB)) {
if (near(snapUtils_left(boxA), snapUtils_right(boxB))) {
x = snapUtils_right(boxB);
} else if (near(snapUtils_right(boxA), snapUtils_left(boxB))) {
x = snapUtils_left(boxB) - boxA.width;
} else if (near(snapUtils_left(boxA), snapUtils_left(boxB))) {
x = snapUtils_left(boxB);
} else if (near(snapUtils_right(boxA), snapUtils_right(boxB))) {
x = snapUtils_right(boxB) - boxA.width;
}
}
if (overlapX(boxA, boxB)) {
if (near(snapUtils_top(boxA), snapUtils_bottom(boxB))) {
y = snapUtils_bottom(boxB);
} else if (near(snapUtils_bottom(boxA), snapUtils_top(boxB))) {
y = snapUtils_top(boxB) - boxA.height;
} else if (near(snapUtils_top(boxA), snapUtils_top(boxB))) {
y = snapUtils_top(boxB);
} else if (near(snapUtils_bottom(boxA), snapUtils_bottom(boxB))) {
y = snapUtils_bottom(boxB) - boxA.height;
}
}
return {
x,
y
};
};
const snapUtils_snapDiff = (a, b) => {
const newPos = snap(a, b);
return {
x: newPos.x === undefined ? 0 : newPos.x - a.x,
y: newPos.y === undefined ? 0 : newPos.y - a.y
};
}; // TODO: Use the first x and y combo
const snapDiffManyToMany = (as, bs) => {
let x = 0;
let y = 0;
for (const a of as) {
for (const b of bs) {
const diff = snapUtils_snapDiff(a, b);
x = x || diff.x;
y = y || diff.y;
if (x !== undefined && x > 0 && y !== undefined && y > 0) {
break;
}
}
}
return {
x,
y
};
};
const snapToMany = (boxA, otherBoxes) => {
let x;
let y;
otherBoxes.forEach(boxB => {
const newPos = snap(boxA, boxB);
x = newPos.x || x;
y = newPos.y || y;
});
return {
x,
y
};
};
const snapWithin = (boxA, boundingBox) => {
let x, y;
if (boxA.x - SNAP_DISTANCE < 0) {
x = 0;
} else if (boxA.x + boxA.width + SNAP_DISTANCE > boundingBox.width) {
x = boundingBox.width - boxA.width;
}
if (boxA.y - SNAP_DISTANCE < 0) {
y = 0;
} else if (boxA.y + boxA.height + SNAP_DISTANCE > boundingBox.height) {
y = boundingBox.height - boxA.height;
}
return {
x,
y
};
};
const snapWithinDiff = (a, b) => {
const newPos = snapWithin(a, b);
return {
x: newPos.x === undefined ? 0 : newPos.x - a.x,
y: newPos.y === undefined ? 0 : newPos.y - a.y
};
};
const applySnap = (original, ...snaps) => snaps.reduce((previous, snapped) => snapUtils_objectSpread(snapUtils_objectSpread({}, previous), {}, {
x: typeof snapped.x !== "undefined" ? snapped.x : previous.x,
y: typeof snapped.y !== "undefined" ? snapped.y : previous.y
}), original);
const snapUtils_boundingBox = nodes => {
const boxes = nodes.slice();
const firstNode = boxes.pop();
if (firstNode == null) {
throw new Error("boundingBox must be called with at least one node");
}
const bounding = {
top: snapUtils_top(firstNode),
right: snapUtils_right(firstNode),
bottom: snapUtils_bottom(firstNode),
left: snapUtils_left(firstNode)
};
boxes.forEach(node => {
bounding.top = Math.min(bounding.top, snapUtils_top(node));
bounding.right = Math.max(bounding.right, snapUtils_right(node));
bounding.bottom = Math.max(bounding.bottom, snapUtils_bottom(node));
bounding.left = Math.min(bounding.left, snapUtils_left(node));
});
return {
x: bounding.left,
y: bounding.top,
width: bounding.right - bounding.left,
height: bounding.bottom - bounding.top
};
};
function traceConnection(areConnected) {
return (candidates, node) => {
const connected = new Set();
const checkNode = n => {
for (const candidate of candidates) {
if (!connected.has(candidate) && areConnected(candidate, n)) {
connected.add(candidate);
checkNode(candidate);
}
}
};
checkNode(node);
return connected;
};
}
const applyDiff = (a, b) => ({
x: a.x + b.x,
y: a.y + b.y
}); // TODO: This should not
const applyMultipleDiffs = (initial, ...diffs) => {
const metaDiff = diffs.reduce((m, diff) => ({
// Use the smallest non-zero diff for each axis.
// TODO: Min should be the absolute value
x: m.x === 0 || diff.x === 0 ? m.x + diff.x : Math.min(m.x, diff.x),
y: m.y === 0 || diff.y === 0 ? m.y + diff.y : Math.min(m.y, diff.y)
}));
return applyDiff(initial, metaDiff);
};
// CONCATENATED MODULE: ./js/actionCreators/windows.ts
function actionCreators_windows_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function actionCreators_windows_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { actionCreators_windows_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { actionCreators_windows_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
// Dispatch an action and, if needed rearrange the windows to preserve
// the existing edge relationship.
//
// Works by checking the edges before the action is dispatched. Then,
// after disatching, calculating what position change would be required
// to restore those relationships.
function withWindowGraphIntegrity(action) {
return (dispatch, getState) => {
const state = getState();
const graph = getWindowGraph(state);
const originalSizes = getWindowSizes(state);
dispatch(action);
const newSizes = getWindowSizes(getState());
const sizeDiff = {};
for (const window of Object.keys(newSizes)) {
const original = originalSizes[window];
const current = newSizes[window];
sizeDiff[window] = {
height: current.height - original.height,
width: current.width - original.width
};
}
const positionDiff = getPositionDiff(graph, sizeDiff);
const windowPositions = getWindowPositions(state);
const newPositions = objectMap(windowPositions, (position, key) => applyDiff(position, positionDiff[key]));
dispatch(windows_updateWindowPositions(newPositions));
};
}
function windows_toggleDoubleSizeMode() {
return withWindowGraphIntegrity({
type: TOGGLE_DOUBLESIZE_MODE
});
}
function toggleLlamaMode() {
return {
type: TOGGLE_LLAMA_MODE
};
}
function windows_toggleEqualizerShadeMode() {
return withWindowGraphIntegrity({
type: TOGGLE_WINDOW_SHADE_MODE,
windowId: "equalizer"
});
}
function windows_toggleMainWindowShadeMode() {
return withWindowGraphIntegrity({
type: TOGGLE_WINDOW_SHADE_MODE,
windowId: "main"
});
}
function togglePlaylistShadeMode() {
return withWindowGraphIntegrity({
type: TOGGLE_WINDOW_SHADE_MODE,
windowId: "playlist"
});
}
function windows_closeWindow(windowId) {
return {
type: CLOSE_WINDOW,
windowId
};
}
function windows_setFocusedWindow(window) {
return {
type: SET_FOCUSED_WINDOW,
window
};
}
function windows_setWindowSize(windowId, size) {
return {
type: WINDOW_SIZE_CHANGED,
windowId,
size
};
}
function windows_toggleWindow(windowId) {
return {
type: TOGGLE_WINDOW,
windowId
};
}
function windows_updateWindowPositions(positions, absolute) {
return {
type: UPDATE_WINDOW_POSITIONS,
positions,
absolute
};
}
function centerWindowsInContainer(container) {
return (dispatch, getState) => {
if (!getPositionsAreRelative(getState())) {
return;
}
const {
left,
top
} = container.getBoundingClientRect();
const {
scrollWidth: width,
scrollHeight: height
} = container;
dispatch(centerWindows({
left,
top,
width,
height
}));
};
}
function centerWindowsInView() {
return centerWindows({
left: window.scrollX,
top: window.scrollY,
width: window.innerWidth,
height: window.innerHeight
});
}
function centerWindows(box) {
return (dispatch, getState) => {
const state = getState();
const windowsInfo = getWindowsInfo(state);
const getOpen = selectors_getWindowOpen(state);
const {
top,
left,
width,
height
} = box;
const offsetLeft = left + window.scrollX;
const offsetTop = top + window.scrollY; // A layout has been suplied. We will compute the bounding box and
// center the given layout.
const bounding = calculateBoundingBox(windowsInfo.filter(w => getOpen(w.key)));
if (bounding == null) {
// There are no windows to center
return;
}
const boxHeight = bounding.bottom - bounding.top;
const boxWidth = bounding.right - bounding.left;
const move = {
x: Math.ceil(offsetLeft - bounding.left + (width - boxWidth) / 2),
y: Math.ceil(offsetTop - bounding.top + (height - boxHeight) / 2)
};
const newPositions = windowsInfo.reduce((pos, w) => actionCreators_windows_objectSpread(actionCreators_windows_objectSpread({}, pos), {}, {
[w.key]: {
x: move.x + w.x,
y: move.y + w.y
}
}), {});
dispatch(windows_updateWindowPositions(newPositions, true));
};
}
function windows_browserWindowSizeChanged(size) {
return dispatch => {
dispatch(actionCreators_windows_objectSpread({
type: BROWSER_WINDOW_SIZE_CHANGED
}, size));
dispatch(ensureWindowsAreOnScreen());
};
}
function resetWindowSizes() {
return {
type: RESET_WINDOW_SIZES
};
}
function stackWindows() {
return (dispatch, getState) => {
dispatch(windows_updateWindowPositions(getStackedLayoutPositions(getState())));
};
}
function ensureWindowsAreOnScreen() {
return (dispatch, getState) => {
const state = getState();
const windowsInfo = getWindowsInfo(state);
const getOpen = selectors_getWindowOpen(state);
const {
height,
width
} = utils_getWindowSize();
const bounding = calculateBoundingBox(windowsInfo.filter(w => getOpen(w.key)));
if (bounding == null) {
// There are no windows visible, so there's no work to do.
return;
}
const positions = getWindowPositions(state); // Are we good?
if (bounding.left >= 0 && bounding.top >= 0 && bounding.right <= width && bounding.bottom <= height) {
// My work here is done.
return;
}
const boundingHeight = bounding.bottom - bounding.top;
const boundingWidth = bounding.right - bounding.left; // Could we simply shift all the windows by a constant offset?
if (boundingWidth <= width && boundingHeight <= height) {
let moveY = 0;
let moveX = 0;
if (bounding.top <= 0) {
moveY = bounding.top;
} else if (bounding.bottom > height) {
moveY = bounding.bottom - height;
}
if (bounding.left <= 0) {
moveX = bounding.left;
} else if (bounding.right > width) {
moveX = bounding.right - width;
}
const newPositions = objectMap(positions, position => ({
x: position.x - moveX,
y: position.y - moveY
}));
dispatch(windows_updateWindowPositions(newPositions));
return;
} // TODO: Try moving the individual groups to try to fit them in
// I give up. Just reset everything.
dispatch(resetWindowSizes());
dispatch(stackWindows());
dispatch(centerWindowsInView());
};
}
// CONCATENATED MODULE: ./js/actionCreators/media.ts
function playTrack(id) {
return (dispatch, getState) => {
const state = getState();
const isStopped = getMediaStatus(state) === MEDIA_STATUS.STOPPED;
if (isStopped) {
dispatch({
type: BUFFER_TRACK,
id
});
} else {
dispatch({
type: PLAY_TRACK,
id
});
}
};
}
function media_playTrackNow(id) {
return {
type: PLAY_TRACK,
id
};
}
function media_play() {
return (dispatch, getState) => {
const state = getState();
if (state.media.status === MEDIA_STATUS.STOPPED && state.playlist.currentTrack == null && state.playlist.trackOrder.length === 0) {
dispatch(files_openMediaFileDialog());
} else {
dispatch({
type: PLAY
});
}
};
}
function media_pause() {
return (dispatch, getState) => {
const {
status
} = getState().media;
if (status === MEDIA_STATUS.PLAYING) {
dispatch({
type: PAUSE
});
} else {
dispatch({
type: PLAY
});
}
};
}
function media_stop() {
return {
type: STOP
};
}
function media_nextN(n) {
return (dispatch, getState) => {
const nextTrackId = getNextTrackId(getState(), n);
if (nextTrackId == null) {
dispatch({
type: IS_STOPPED
});
return;
}
dispatch(playTrack(nextTrackId));
};
}
function media_next() {
return media_nextN(1);
}
function media_previous() {
return media_nextN(-1);
}
function seekToTime(seconds) {
return function (dispatch, getState) {
const state = getState();
const duration = getDuration(state);
if (duration == null) {
return;
}
dispatch({
type: SEEK_TO_PERCENT_COMPLETE,
percent: seconds / duration * 100
});
};
}
function media_seekForward(seconds) {
return function (dispatch, getState) {
const timeElapsed = getTimeElapsed(getState());
dispatch(seekToTime(timeElapsed + seconds));
};
}
function media_seekBackward(seconds) {
return media_seekForward(-seconds);
}
function media_setVolume(volume) {
return {
type: SET_VOLUME,
volume: clamp(volume, 0, 100)
};
}
function adjustVolume(volumeDiff) {
return (dispatch, getState) => {
const currentVolume = getState().media.volume;
return dispatch(media_setVolume(currentVolume + volumeDiff));
};
}
function media_scrollVolume(e) {
e.preventDefault();
return (dispatch, getState) => {
const currentVolume = getState().media.volume; // Using pixels as percentage difference here is a bit arbirary, but... oh well.
return dispatch(media_setVolume(currentVolume + e.deltaY));
};
}
function media_setBalance(balance) {
balance = clamp(balance, -100, 100); // The balance clips to the center
if (Math.abs(balance) < 25) {
balance = 0;
}
return {
type: SET_BALANCE,
balance
};
}
function media_toggleRepeat() {
return {
type: TOGGLE_REPEAT
};
}
function media_toggleShuffle() {
return {
type: TOGGLE_SHUFFLE
};
}
function media_toggleTimeMode() {
return {
type: TOGGLE_TIME_MODE
};
}
// CONCATENATED MODULE: ./js/actionCreators/equalizer.ts
const BAND_SNAP_DISTANCE = 5;
const BAND_MID_POINT_VALUE = 50;
function _snapBandValue(value) {
if (value < BAND_MID_POINT_VALUE + BAND_SNAP_DISTANCE && value > BAND_MID_POINT_VALUE - BAND_SNAP_DISTANCE) {
return BAND_MID_POINT_VALUE;
}
return value;
}
function setEqBand(band, value) {
return {
type: SET_BAND_VALUE,
band,
value: _snapBandValue(value)
};
}
function _setEqTo(value) {
return dispatch => {
Object.values(BANDS).forEach(band => {
dispatch({
type: SET_BAND_VALUE,
value,
band: band
});
});
};
}
function equalizer_setEqToMax() {
return _setEqTo(100);
}
function equalizer_setEqToMid() {
return _setEqTo(50);
}
function equalizer_setEqToMin() {
return _setEqTo(0);
}
function setPreamp(value) {
return {
type: SET_BAND_VALUE,
band: "preamp",
value: _snapBandValue(value)
};
}
function equalizer_toggleEq() {
return (dispatch, getState) => {
if (getState().equalizer.on) {
dispatch({
type: SET_EQ_OFF
});
} else {
dispatch({
type: SET_EQ_ON
});
}
};
}
function toggleEqAuto() {
return dispatch => {
// We don't actually support this feature yet so don't let the user ever turn it on.
// dispatch({ type: SET_EQ_AUTO, value: !getState().equalizer.auto });
dispatch({
type: SET_EQ_AUTO,
value: false
});
};
}
// EXTERNAL MODULE: ../winamp-eqf/index.js
var winamp_eqf = __webpack_require__(29);
// CONCATENATED MODULE: ./js/skinSprites.ts
/* TODO: There are too many " " and "_" characters */
const FONT_LOOKUP = {
a: [0, 0],
b: [0, 1],
c: [0, 2],
d: [0, 3],
e: [0, 4],
f: [0, 5],
g: [0, 6],
h: [0, 7],
i: [0, 8],
j: [0, 9],
k: [0, 10],
l: [0, 11],
m: [0, 12],
n: [0, 13],
o: [0, 14],
p: [0, 15],
q: [0, 16],
r: [0, 17],
s: [0, 18],
t: [0, 19],
u: [0, 20],
v: [0, 21],
w: [0, 22],
x: [0, 23],
y: [0, 24],
z: [0, 25],
'"': [0, 26],
"@": [0, 27],
" ": [0, 30],
"0": [1, 0],
"1": [1, 1],
"2": [1, 2],
"3": [1, 3],
"4": [1, 4],
"5": [1, 5],
"6": [1, 6],
"7": [1, 7],
"8": [1, 8],
"9": [1, 9],
[UTF8_ELLIPSIS]: [1, 10],
".": [1, 11],
":": [1, 12],
"(": [1, 13],
")": [1, 14],
"-": [1, 15],
"'": [1, 16],
"!": [1, 17],
_: [1, 18],
"+": [1, 19],
"\\": [1, 20],
"/": [1, 21],
"[": [1, 22],
"]": [1, 23],
"^": [1, 24],
"&": [1, 25],
"%": [1, 26],
",": [1, 27],
"=": [1, 28],
$: [1, 29],
"#": [1, 30],
Å: [2, 0],
Ö: [2, 1],
Ä: [2, 2],
"?": [2, 3],
"*": [2, 4],
"<": [1, 22],
">": [1, 23],
"{": [1, 22],
"}": [1, 23]
};
const imageConstFromChar = char => `CHARACTER_${char.charCodeAt(0)}`;
const CHAR_X = 5;
const CHAR_Y = 6;
const characterSprites = [];
for (const key in FONT_LOOKUP) {
if (FONT_LOOKUP.hasOwnProperty(key)) {
const position = FONT_LOOKUP[key];
characterSprites.push({
name: imageConstFromChar(key),
y: position[0] * CHAR_Y,
x: position[1] * CHAR_X,
width: CHAR_X,
height: CHAR_Y
});
}
}
const skinSprites_sprites = {
BALANCE: [{
name: "MAIN_BALANCE_BACKGROUND",
x: 9,
y: 0,
width: 38,
height: 420
}, {
name: "MAIN_BALANCE_THUMB",
x: 15,
y: 422,
width: 14,
height: 11
}, {
name: "MAIN_BALANCE_THUMB_ACTIVE",
x: 0,
y: 422,
width: 14,
height: 11
}],
CBUTTONS: [{
name: "MAIN_PREVIOUS_BUTTON",
x: 0,
y: 0,
width: 23,
height: 18
}, {
name: "MAIN_PREVIOUS_BUTTON_ACTIVE",
x: 0,
y: 18,
width: 23,
height: 18
}, {
name: "MAIN_PLAY_BUTTON",
x: 23,
y: 0,
width: 23,
height: 18
}, {
name: "MAIN_PLAY_BUTTON_ACTIVE",
x: 23,
y: 18,
width: 23,
height: 18
}, {
name: "MAIN_PAUSE_BUTTON",
x: 46,
y: 0,
width: 23,
height: 18
}, {
name: "MAIN_PAUSE_BUTTON_ACTIVE",
x: 46,
y: 18,
width: 23,
height: 18
}, {
name: "MAIN_STOP_BUTTON",
x: 69,
y: 0,
width: 23,
height: 18
}, {
name: "MAIN_STOP_BUTTON_ACTIVE",
x: 69,
y: 18,
width: 23,
height: 18
}, {
name: "MAIN_NEXT_BUTTON",
x: 92,
y: 0,
width: 23,
height: 18
}, {
name: "MAIN_NEXT_BUTTON_ACTIVE",
x: 92,
y: 18,
width: 22,
height: 18
}, {
name: "MAIN_EJECT_BUTTON",
x: 114,
y: 0,
width: 22,
height: 16
}, {
name: "MAIN_EJECT_BUTTON_ACTIVE",
x: 114,
y: 16,
width: 22,
height: 16
}],
MAIN: [{
name: "MAIN_WINDOW_BACKGROUND",
x: 0,
y: 0,
width: 275,
height: 116
}],
MONOSTER: [{
name: "MAIN_STEREO",
x: 0,
y: 12,
width: 29,
height: 12
}, {
name: "MAIN_STEREO_SELECTED",
x: 0,
y: 0,
width: 29,
height: 12
}, {
name: "MAIN_MONO",
x: 29,
y: 12,
width: 27,
height: 12
}, {
name: "MAIN_MONO_SELECTED",
x: 29,
y: 0,
width: 27,
height: 12
}],
NUMBERS: [{
name: "NO_MINUS_SIGN",
x: 9,
y: 6,
width: 5,
height: 1
}, {
name: "MINUS_SIGN",
x: 20,
y: 6,
width: 5,
height: 1
}, {
name: "DIGIT_0",
x: 0,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_1",
x: 9,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_2",
x: 18,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_3",
x: 27,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_4",
x: 36,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_5",
x: 45,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_6",
x: 54,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_7",
x: 63,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_8",
x: 72,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_9",
x: 81,
y: 0,
width: 9,
height: 13
}],
NUMS_EX: [{
name: "NO_MINUS_SIGN_EX",
x: 90,
y: 0,
width: 9,
height: 13
}, {
name: "MINUS_SIGN_EX",
x: 99,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_0_EX",
x: 0,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_1_EX",
x: 9,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_2_EX",
x: 18,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_3_EX",
x: 27,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_4_EX",
x: 36,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_5_EX",
x: 45,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_6_EX",
x: 54,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_7_EX",
x: 63,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_8_EX",
x: 72,
y: 0,
width: 9,
height: 13
}, {
name: "DIGIT_9_EX",
x: 81,
y: 0,
width: 9,
height: 13
}],
PLAYPAUS: [{
name: "MAIN_PLAYING_INDICATOR",
x: 0,
y: 0,
width: 9,
height: 9
}, {
name: "MAIN_PAUSED_INDICATOR",
x: 9,
y: 0,
width: 9,
height: 9
}, {
name: "MAIN_STOPPED_INDICATOR",
x: 18,
y: 0,
width: 9,
height: 9
}, {
name: "MAIN_NOT_WORKING_INDICATOR",
x: 36,
y: 0,
width: 9,
height: 9
}, {
name: "MAIN_WORKING_INDICATOR",
x: 39,
y: 0,
width: 9,
height: 9
}],
PLEDIT: [{
name: "PLAYLIST_TOP_TILE",
x: 127,
y: 21,
width: 25,
height: 20
}, {
name: "PLAYLIST_TOP_LEFT_CORNER",
x: 0,
y: 21,
width: 25,
height: 20
}, {
name: "PLAYLIST_TITLE_BAR",
x: 26,
y: 21,
width: 100,
height: 20
}, {
name: "PLAYLIST_TOP_RIGHT_CORNER",
x: 153,
y: 21,
width: 25,
height: 20
}, {
name: "PLAYLIST_TOP_TILE_SELECTED",
x: 127,
y: 0,
width: 25,
height: 20
}, {
name: "PLAYLIST_TOP_LEFT_SELECTED",
x: 0,
y: 0,
width: 25,
height: 20
}, {
name: "PLAYLIST_TITLE_BAR_SELECTED",
x: 26,
y: 0,
width: 100,
height: 20
}, {
name: "PLAYLIST_TOP_RIGHT_CORNER_SELECTED",
x: 153,
y: 0,
width: 25,
height: 20
}, {
name: "PLAYLIST_LEFT_TILE",
x: 0,
y: 42,
width: 12,
height: 29
}, {
name: "PLAYLIST_RIGHT_TILE",
x: 31,
y: 42,
width: 20,
height: 29
}, {
name: "PLAYLIST_BOTTOM_TILE",
x: 179,
y: 0,
width: 25,
height: 38
}, {
name: "PLAYLIST_BOTTOM_LEFT_CORNER",
x: 0,
y: 72,
width: 125,
height: 38
}, {
name: "PLAYLIST_BOTTOM_RIGHT_CORNER",
x: 126,
y: 72,
width: 150,
height: 38
}, {
name: "PLAYLIST_VISUALIZER_BACKGROUND",
x: 205,
y: 0,
width: 75,
height: 38
}, {
name: "PLAYLIST_SHADE_BACKGROUND",
x: 72,
y: 57,
width: 25,
height: 14
}, {
name: "PLAYLIST_SHADE_BACKGROUND_LEFT",
x: 72,
y: 42,
width: 25,
height: 14
}, {
name: "PLAYLIST_SHADE_BACKGROUND_RIGHT",
x: 99,
y: 57,
width: 50,
height: 14
}, {
name: "PLAYLIST_SHADE_BACKGROUND_RIGHT_SELECTED",
x: 99,
y: 42,
width: 50,
height: 14
}, {
name: "PLAYLIST_SCROLL_HANDLE_SELECTED",
x: 61,
y: 53,
width: 8,
height: 18
}, {
name: "PLAYLIST_SCROLL_HANDLE",
x: 52,
y: 53,
width: 8,
height: 18
}, {
name: "PLAYLIST_ADD_URL",
x: 0,
y: 111,
width: 22,
height: 18
}, {
name: "PLAYLIST_ADD_URL_SELECTED",
x: 23,
y: 111,
width: 22,
height: 18
}, {
name: "PLAYLIST_ADD_DIR",
x: 0,
y: 130,
width: 22,
height: 18
}, {
name: "PLAYLIST_ADD_DIR_SELECTED",
x: 23,
y: 130,
width: 22,
height: 18
}, {
name: "PLAYLIST_ADD_FILE",
x: 0,
y: 149,
width: 22,
height: 18
}, {
name: "PLAYLIST_ADD_FILE_SELECTED",
x: 23,
y: 149,
width: 22,
height: 18
}, {
name: "PLAYLIST_REMOVE_ALL",
x: 54,
y: 111,
width: 22,
height: 18
}, {
name: "PLAYLIST_REMOVE_ALL_SELECTED",
x: 77,
y: 111,
width: 22,
height: 18
}, {
name: "PLAYLIST_CROP",
x: 54,
y: 130,
width: 22,
height: 18
}, {
name: "PLAYLIST_CROP_SELECTED",
x: 77,
y: 130,
width: 22,
height: 18
}, {
name: "PLAYLIST_REMOVE_SELECTED",
x: 54,
y: 149,
width: 22,
height: 18
}, {
name: "PLAYLIST_REMOVE_SELECTED_SELECTED",
x: 77,
y: 149,
width: 22,
height: 18
}, {
name: "PLAYLIST_REMOVE_MISC",
x: 54,
y: 168,
width: 22,
height: 18
}, {
name: "PLAYLIST_REMOVE_MISC_SELECTED",
x: 77,
y: 168,
width: 22,
height: 18
}, {
name: "PLAYLIST_INVERT_SELECTION",
x: 104,
y: 111,
width: 22,
height: 18
}, {
name: "PLAYLIST_INVERT_SELECTION_SELECTED",
x: 127,
y: 111,
width: 22,
height: 18
}, {
name: "PLAYLIST_SELECT_ZERO",
x: 104,
y: 130,
width: 22,
height: 18
}, {
name: "PLAYLIST_SELECT_ZERO_SELECTED",
x: 127,
y: 130,
width: 22,
height: 18
}, {
name: "PLAYLIST_SELECT_ALL",
x: 104,
y: 149,
width: 22,
height: 18
}, {
name: "PLAYLIST_SELECT_ALL_SELECTED",
x: 127,
y: 149,
width: 22,
height: 18
}, {
name: "PLAYLIST_SORT_LIST",
x: 154,
y: 111,
width: 22,
height: 18
}, {
name: "PLAYLIST_SORT_LIST_SELECTED",
x: 177,
y: 111,
width: 22,
height: 18
}, {
name: "PLAYLIST_FILE_INFO",
x: 154,
y: 130,
width: 22,
height: 18
}, {
name: "PLAYLIST_FILE_INFO_SELECTED",
x: 177,
y: 130,
width: 22,
height: 18
}, {
name: "PLAYLIST_MISC_OPTIONS",
x: 154,
y: 149,
width: 22,
height: 18
}, {
name: "PLAYLIST_MISC_OPTIONS_SELECTED",
x: 177,
y: 149,
width: 22,
height: 18
}, {
name: "PLAYLIST_NEW_LIST",
x: 204,
y: 111,
width: 22,
height: 18
}, {
name: "PLAYLIST_NEW_LIST_SELECTED",
x: 227,
y: 111,
width: 22,
height: 18
}, {
name: "PLAYLIST_SAVE_LIST",
x: 204,
y: 130,
width: 22,
height: 18
}, {
name: "PLAYLIST_SAVE_LIST_SELECTED",
x: 227,
y: 130,
width: 22,
height: 18
}, {
name: "PLAYLIST_LOAD_LIST",
x: 204,
y: 149,
width: 22,
height: 18
}, {
name: "PLAYLIST_LOAD_LIST_SELECTED",
x: 227,
y: 149,
width: 22,
height: 18
}, {
name: "PLAYLIST_ADD_MENU_BAR",
x: 48,
y: 111,
width: 3,
height: 54
}, {
name: "PLAYLIST_REMOVE_MENU_BAR",
x: 100,
y: 111,
width: 3,
height: 72
}, {
name: "PLAYLIST_SELECT_MENU_BAR",
x: 150,
y: 111,
width: 3,
height: 54
}, {
name: "PLAYLIST_MISC_MENU_BAR",
x: 200,
y: 111,
width: 3,
height: 54
}, {
name: "PLAYLIST_LIST_BAR",
x: 250,
y: 111,
width: 3,
height: 54
}, {
name: "PLAYLIST_CLOSE_SELECTED",
x: 52,
y: 42,
width: 9,
height: 9
}, {
name: "PLAYLIST_COLLAPSE_SELECTED",
x: 62,
y: 42,
width: 9,
height: 9
}, {
name: "PLAYLIST_EXPAND_SELECTED",
x: 150,
y: 42,
width: 9,
height: 9
}],
EQ_EX: [{
name: "EQ_SHADE_BACKGROUND_SELECTED",
x: 0,
y: 0,
width: 275,
height: 14
}, {
name: "EQ_SHADE_BACKGROUND",
x: 0,
y: 15,
width: 275,
height: 14
}, {
name: "EQ_SHADE_VOLUME_SLIDER_LEFT",
x: 1,
y: 30,
width: 3,
height: 7
}, {
name: "EQ_SHADE_VOLUME_SLIDER_CENTER",
x: 4,
y: 30,
width: 3,
height: 7
}, {
name: "EQ_SHADE_VOLUME_SLIDER_RIGHT",
x: 7,
y: 30,
width: 3,
height: 7
}, {
name: "EQ_SHADE_BALANCE_SLIDER_LEFT",
x: 11,
y: 30,
width: 3,
height: 7
}, {
name: "EQ_SHADE_BALANCE_SLIDER_CENTER",
x: 14,
y: 30,
width: 3,
height: 7
}, {
name: "EQ_SHADE_BALANCE_SLIDER_RIGHT",
x: 17,
y: 30,
width: 3,
height: 7
}, {
name: "EQ_MAXIMIZE_BUTTON_ACTIVE",
x: 1,
y: 38,
width: 9,
height: 9
}, {
name: "EQ_MINIMIZE_BUTTON_ACTIVE",
x: 1,
y: 47,
width: 9,
height: 9
}, {
name: "EQ_SHADE_CLOSE_BUTTON",
x: 11,
y: 38,
width: 9,
height: 9
}, {
name: "EQ_SHADE_CLOSE_BUTTON_ACTIVE",
x: 11,
y: 47,
width: 9,
height: 9
}],
EQMAIN: [{
name: "EQ_WINDOW_BACKGROUND",
x: 0,
y: 0,
width: 275,
height: 116
}, {
name: "EQ_TITLE_BAR",
x: 0,
y: 149,
width: 275,
height: 14
}, {
name: "EQ_TITLE_BAR_SELECTED",
x: 0,
y: 134,
width: 275,
height: 14
}, {
name: "EQ_SLIDER_BACKGROUND",
x: 13,
y: 164,
width: 209,
height: 129
}, {
name: "EQ_SLIDER_THUMB",
x: 0,
y: 164,
width: 11,
height: 11
}, {
name: "EQ_SLIDER_THUMB_SELECTED",
x: 0,
y: 176,
width: 11,
height: 11
}, {
name: "EQ_CLOSE_BUTTON",
x: 0,
y: 116,
width: 9,
height: 9
}, {
name: "EQ_CLOSE_BUTTON_ACTIVE",
x: 0,
y: 125,
width: 9,
height: 9
}, // This is technically not a sprite, it's just part of the background.
// However, we extract it to use it as a fallback for
// `EQ_MAXIMIZE_BUTTON_ACTIVE`. Without this, skins that don't implement
// `eq_ex.bmp` would show the default skin's `EQ_MAXIMIZE_BUTTON_ACTIVE`
// instead of showing no sprite aka, just showing through to this portion of
// the title bar image.
{
name: "EQ_MAXIMIZE_BUTTON_ACTIVE_FALLBACK",
x: 254,
y: 152,
width: 9,
height: 9
}, {
name: "EQ_ON_BUTTON",
x: 10,
y: 119,
width: 26,
height: 12
}, {
name: "EQ_ON_BUTTON_DEPRESSED",
x: 128,
y: 119,
width: 26,
height: 12
}, {
name: "EQ_ON_BUTTON_SELECTED",
x: 69,
y: 119,
width: 26,
height: 12
}, {
name: "EQ_ON_BUTTON_SELECTED_DEPRESSED",
x: 187,
y: 119,
width: 26,
height: 12
}, {
name: "EQ_AUTO_BUTTON",
x: 36,
y: 119,
width: 32,
height: 12
}, {
name: "EQ_AUTO_BUTTON_DEPRESSED",
x: 154,
y: 119,
width: 32,
height: 12
}, {
name: "EQ_AUTO_BUTTON_SELECTED",
x: 95,
y: 119,
width: 32,
height: 12
}, {
name: "EQ_AUTO_BUTTON_SELECTED_DEPRESSED",
x: 213,
y: 119,
width: 32,
height: 12
}, {
name: "EQ_GRAPH_BACKGROUND",
x: 0,
y: 294,
width: 113,
height: 19
}, {
name: "EQ_GRAPH_LINE_COLORS",
x: 115,
y: 294,
width: 1,
height: 19
}, {
name: "EQ_PRESETS_BUTTON",
x: 224,
y: 164,
width: 44,
height: 12
}, {
name: "EQ_PRESETS_BUTTON_SELECTED",
x: 224,
y: 176,
width: 44,
height: 12
}, {
name: "EQ_PREAMP_LINE",
x: 0,
y: 314,
width: 113,
height: 1
}],
POSBAR: [{
name: "MAIN_POSITION_SLIDER_BACKGROUND",
x: 0,
y: 0,
width: 248,
height: 10
}, {
name: "MAIN_POSITION_SLIDER_THUMB",
x: 248,
y: 0,
width: 29,
height: 10
}, {
name: "MAIN_POSITION_SLIDER_THUMB_SELECTED",
x: 278,
y: 0,
width: 29,
height: 10
}],
SHUFREP: [{
name: "MAIN_SHUFFLE_BUTTON",
x: 28,
y: 0,
width: 47,
height: 15
}, {
name: "MAIN_SHUFFLE_BUTTON_DEPRESSED",
x: 28,
y: 15,
width: 47,
height: 15
}, {
name: "MAIN_SHUFFLE_BUTTON_SELECTED",
x: 28,
y: 30,
width: 47,
height: 15
}, {
name: "MAIN_SHUFFLE_BUTTON_SELECTED_DEPRESSED",
x: 28,
y: 45,
width: 47,
height: 15
}, {
name: "MAIN_REPEAT_BUTTON",
x: 0,
y: 0,
width: 28,
height: 15
}, {
name: "MAIN_REPEAT_BUTTON_DEPRESSED",
x: 0,
y: 15,
width: 28,
height: 15
}, {
name: "MAIN_REPEAT_BUTTON_SELECTED",
x: 0,
y: 30,
width: 28,
height: 15
}, {
name: "MAIN_REPEAT_BUTTON_SELECTED_DEPRESSED",
x: 0,
y: 45,
width: 28,
height: 15
}, {
name: "MAIN_EQ_BUTTON",
x: 0,
y: 61,
width: 23,
height: 12
}, {
name: "MAIN_EQ_BUTTON_SELECTED",
x: 0,
y: 73,
width: 23,
height: 12
}, {
name: "MAIN_EQ_BUTTON_DEPRESSED",
x: 46,
y: 61,
width: 23,
height: 12
}, {
name: "MAIN_EQ_BUTTON_DEPRESSED_SELECTED",
x: 46,
y: 73,
width: 23,
height: 12
}, {
name: "MAIN_PLAYLIST_BUTTON",
x: 23,
y: 61,
width: 23,
height: 12
}, {
name: "MAIN_PLAYLIST_BUTTON_SELECTED",
x: 23,
y: 73,
width: 23,
height: 12
}, {
name: "MAIN_PLAYLIST_BUTTON_DEPRESSED",
x: 69,
y: 61,
width: 23,
height: 12
}, {
name: "MAIN_PLAYLIST_BUTTON_DEPRESSED_SELECTED",
x: 69,
y: 73,
width: 23,
height: 12
}],
TEXT: characterSprites,
TITLEBAR: [{
name: "MAIN_TITLE_BAR",
x: 27,
y: 15,
width: 275,
height: 14
}, {
name: "MAIN_TITLE_BAR_SELECTED",
x: 27,
y: 0,
width: 275,
height: 14
}, {
name: "MAIN_EASTER_EGG_TITLE_BAR",
x: 27,
y: 72,
width: 275,
height: 14
}, {
name: "MAIN_EASTER_EGG_TITLE_BAR_SELECTED",
x: 27,
y: 57,
width: 275,
height: 14
}, {
name: "MAIN_OPTIONS_BUTTON",
x: 0,
y: 0,
width: 9,
height: 9
}, {
name: "MAIN_OPTIONS_BUTTON_DEPRESSED",
x: 0,
y: 9,
width: 9,
height: 9
}, {
name: "MAIN_MINIMIZE_BUTTON",
x: 9,
y: 0,
width: 9,
height: 9
}, {
name: "MAIN_MINIMIZE_BUTTON_DEPRESSED",
x: 9,
y: 9,
width: 9,
height: 9
}, {
name: "MAIN_SHADE_BUTTON",
x: 0,
y: 18,
width: 9,
height: 9
}, {
name: "MAIN_SHADE_BUTTON_DEPRESSED",
x: 9,
y: 18,
width: 9,
height: 9
}, {
name: "MAIN_CLOSE_BUTTON",
x: 18,
y: 0,
width: 9,
height: 9
}, {
name: "MAIN_CLOSE_BUTTON_DEPRESSED",
x: 18,
y: 9,
width: 9,
height: 9
}, {
name: "MAIN_CLUTTER_BAR_BACKGROUND",
x: 304,
y: 0,
width: 8,
height: 43
}, {
name: "MAIN_CLUTTER_BAR_BACKGROUND_DISABLED",
x: 312,
y: 0,
width: 8,
height: 43
}, {
name: "MAIN_CLUTTER_BAR_BUTTON_O_SELECTED",
x: 304,
y: 47,
width: 8,
height: 8
}, {
name: "MAIN_CLUTTER_BAR_BUTTON_A_SELECTED",
x: 312,
y: 55,
width: 8,
height: 7
}, {
name: "MAIN_CLUTTER_BAR_BUTTON_I_SELECTED",
x: 320,
y: 62,
width: 8,
height: 7
}, {
name: "MAIN_CLUTTER_BAR_BUTTON_D_SELECTED",
x: 328,
y: 69,
width: 8,
height: 8
}, {
name: "MAIN_CLUTTER_BAR_BUTTON_V_SELECTED",
x: 336,
y: 77,
width: 8,
height: 7
}, {
name: "MAIN_SHADE_BACKGROUND",
x: 27,
y: 42,
width: 275,
height: 14
}, {
name: "MAIN_SHADE_BACKGROUND_SELECTED",
x: 27,
y: 29,
width: 275,
height: 14
}, {
name: "MAIN_SHADE_BUTTON_SELECTED",
x: 0,
y: 27,
width: 9,
height: 9
}, {
name: "MAIN_SHADE_BUTTON_SELECTED_DEPRESSED",
x: 9,
y: 27,
width: 9,
height: 9
}, {
name: "MAIN_SHADE_POSITION_BACKGROUND",
x: 0,
y: 36,
width: 17,
height: 7
}, {
name: "MAIN_SHADE_POSITION_THUMB",
x: 20,
y: 36,
width: 3,
height: 7
}, {
name: "MAIN_SHADE_POSITION_THUMB_LEFT",
x: 17,
y: 36,
width: 3,
height: 7
}, {
name: "MAIN_SHADE_POSITION_THUMB_RIGHT",
x: 23,
y: 36,
width: 3,
height: 7
}],
VOLUME: [{
name: "MAIN_VOLUME_BACKGROUND",
x: 0,
y: 0,
width: 68,
height: 420
}, {
name: "MAIN_VOLUME_THUMB",
x: 15,
y: 422,
width: 14,
height: 11
}, {
name: "MAIN_VOLUME_THUMB_SELECTED",
x: 0,
y: 422,
width: 14,
height: 11
}],
GEN: [{
name: "GEN_TOP_LEFT_SELECTED",
x: 0,
y: 0,
width: 25,
height: 20
}, {
name: "GEN_TOP_LEFT_END_SELECTED",
x: 26,
y: 0,
width: 25,
height: 20
}, {
name: "GEN_TOP_CENTER_FILL_SELECTED",
x: 52,
y: 0,
width: 25,
height: 20
}, {
name: "GEN_TOP_RIGHT_END_SELECTED",
x: 78,
y: 0,
width: 25,
height: 20
}, {
name: "GEN_TOP_LEFT_RIGHT_FILL_SELECTED",
x: 104,
y: 0,
width: 25,
height: 20
}, {
name: "GEN_TOP_RIGHT_SELECTED",
x: 130,
y: 0,
width: 25,
height: 20
}, {
name: "GEN_TOP_LEFT",
x: 0,
y: 21,
width: 25,
height: 20
}, {
name: "GEN_TOP_LEFT_END",
x: 26,
y: 21,
width: 25,
height: 20
}, {
name: "GEN_TOP_CENTER_FILL",
x: 52,
y: 21,
width: 25,
height: 20
}, {
name: "GEN_TOP_RIGHT_END",
x: 78,
y: 21,
width: 25,
height: 20
}, {
name: "GEN_TOP_LEFT_RIGHT_FILL",
x: 104,
y: 21,
width: 25,
height: 20
}, {
name: "GEN_TOP_RIGHT",
x: 130,
y: 21,
width: 25,
height: 20
}, {
name: "GEN_BOTTOM_LEFT",
x: 0,
y: 42,
width: 125,
height: 14
}, {
name: "GEN_BOTTOM_RIGHT",
x: 0,
y: 57,
width: 125,
height: 14
}, {
name: "GEN_BOTTOM_FILL",
x: 127,
y: 72,
width: 25,
height: 14
}, {
name: "GEN_MIDDLE_LEFT",
x: 127,
y: 42,
width: 11,
height: 29
}, {
name: "GEN_MIDDLE_LEFT_BOTTOM",
x: 158,
y: 42,
width: 11,
height: 24
}, {
name: "GEN_MIDDLE_RIGHT",
x: 139,
y: 42,
width: 8,
height: 29
}, {
name: "GEN_MIDDLE_RIGHT_BOTTOM",
x: 170,
y: 42,
width: 8,
height: 24
}, {
name: "GEN_CLOSE_SELECTED",
x: 148,
y: 42,
width: 9,
height: 9
}]
/*
We don't currently support the Media Library, so there are disabled
GENEX: [
{
name: "GENEX_BUTTON_BACKGROUND_LEFT_UNPRESSED",
x: 0,
y: 0,
height: 15,
width: 4,
},
{
name: "GENEX_BUTTON_BACKGROUND_CENTER_UNPRESSED",
x: 4,
y: 0,
height: 15,
width: 39,
},
{
name: "GENEX_BUTTON_BACKGROUND_RIGHT_UNPRESSED",
x: 43,
y: 0,
height: 15,
width: 4,
},
{
name: "GENEX_BUTTON_BACKGROUND_PRESSED",
x: 0,
y: 1,
height: 15,
width: 47,
},
{ name: "GENEX_SCROLL_UP_UNPRESSED", x: 0, y: 31, height: 14, width: 14 },
{
name: "GENEX_SCROLL_DOWN_UNPRESSED",
x: 14,
y: 31,
height: 14,
width: 14,
},
{ name: "GENEX_SCROLL_UP_PRESSED", x: 28, y: 31, height: 14, width: 14 },
{ name: "GENEX_SCROLL_DOWN_PRESSED", x: 42, y: 31, height: 14, width: 14 },
{ name: "GENEX_SCROLL_LEFT_UNPRESSED", x: 0, y: 45, height: 14, width: 14 },
{
name: "GENEX_SCROLL_RIGHT_UNPRESSED",
x: 14,
y: 45,
height: 14,
width: 14,
},
{ name: "GENEX_SCROLL_LEFT_PRESSED", x: 28, y: 45, height: 14, width: 14 },
{ name: "GENEX_SCROLL_RIGHT_PRESSED", x: 42, y: 45, height: 14, width: 14 },
{
name: "GENEX_VERTICAL_SCROLL_HANDLE_UNPRESSED",
x: 56,
y: 31,
height: 28,
width: 14,
},
{
name: "GENEX_VERTICAL_SCROLL_HANDLE_PRESSED",
x: 70,
y: 31,
height: 28,
width: 14,
},
{
name: "GENEX_HORIZONTAL_SCROLL_HANDLE_UNPRESSED",
x: 84,
y: 31,
height: 14,
width: 28,
},
{
name: "GENEX_HORIZONTAL_SCROLL_HANDLE_PRESSED",
x: 84,
y: 45,
height: 14,
width: 28,
},
],
*/
};
/* harmony default export */ var skinSprites = (skinSprites_sprites);
// CONCATENATED MODULE: ./js/regionParser.ts
function pointPairs(arr) {
const pairedValues = [];
for (let i = 0; i < arr.length; i += 2) {
pairedValues.push(`${arr[i]},${arr[i + 1]}`);
}
return pairedValues;
}
function regionParser(regionStr) {
const iniData = parseIni(regionStr);
const data = {};
Object.keys(iniData).forEach(section => {
const {
numpoints,
pointlist
} = iniData[section];
if (!numpoints || !pointlist) {
return;
}
const pointCounts = numpoints.split(/\s*,\s*/).filter(val => val !== "");
const points = pointPairs( // points can be separated by spaces, or by commas
pointlist.split(/\s*[, ]\s*/).filter(val => val !== ""));
let pointIndex = 0;
const polygons = pointCounts.map(numStr => {
const num = Number(numStr);
if (num < 3) {
// What use is a polygon with less than three sides?
pointIndex += num;
return null;
}
const polygon = points.slice(pointIndex, pointIndex + num).join(" ");
if (!polygon.length) {
// It's possible that the skin author specified more polygons than provided points.
return null;
}
pointIndex += num;
return polygon;
});
const validPolygons = polygons.filter(polygon => polygon != null);
if (validPolygons.length) {
data[section] = validPolygons;
}
});
return data;
}
// CONCATENATED MODULE: ./js/skinParserUtils.ts
function skinParserUtils_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function skinParserUtils_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { skinParserUtils_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { skinParserUtils_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const getFileExtension = fileName => {
const matches = /\.([a-z]{3,4})$/i.exec(fileName);
return matches ? matches[1].toLowerCase() : null;
};
function getFilenameRegex(base, ext) {
// Note: The four slashes: \\\\ ultimately represent a single escaped slash in
// the regex ("\\"), however each itself needs to be escaped so that
// JavaScript does not interperate it as an escape character in the string
// literal. Wonderful.
return new RegExp(`^(.*[/\\\\])?${base}.(${ext})$`, "i");
}
async function getFileFromZip(zip, fileName, ext, mode) {
const files = zip.file(getFilenameRegex(fileName, ext));
if (!files.length) {
return null;
} // Windows file system is case insensitve, but zip files are not.
// This means that it's possible for a zip to contain both `main.bmp` _and_
// `main.BMP` but in Winamp only one will be materialized onto disk when
// decompressing. I suspect that in this case later files in the archive
// overwrite earlier ones. To mimic that behavior we use the last matching
// file.
//
// This works because `JSZip.file` filters the files by iterating the
// underlying `files` object under the hood:
// https://github.com/Stuk/jszip/blob/25d401e104926fef8528d670ecfe53f14e77a297/lib/object.js#L182
// Since JavaScript objects are iterable in the order that the keys were
// added this _should_ mean that by taking the last file here we will get
// the last file that JSZip extracted.
const lastFile = files[files.length - 1];
try {
const contents = await lastFile.async(mode);
return {
contents,
name: lastFile.name
};
} catch (e) {
console.warn(`Failed to extract "${fileName}.${ext}" from the skin archive.`);
return null;
}
}
function fallbackGetImgFromBlob(blob) {
return imgFromUrl(URL.createObjectURL(blob));
}
async function getImgFromBlob(blob) {
try {
// Use this faster native browser API if available.
// NOTE: In some browsers `window.createImageBitmap` may not exist so this will throw.
return await window.createImageBitmap(blob);
} catch (e) {
try {
return await fallbackGetImgFromBlob(blob);
} catch (ee) {
// Like Winamp we will silently fail on images that don't parse.
return null;
}
}
}
function getSpriteUrisFromImg(img, sprites) {
const canvas = document.createElement("canvas");
const context = canvas.getContext("2d");
if (context == null) {
throw new Error("Failed to get canvas context");
}
const images = {};
sprites.forEach(sprite => {
canvas.height = sprite.height;
canvas.width = sprite.width;
context.drawImage(img, -sprite.x, -sprite.y);
const image = canvas.toDataURL();
images[sprite.name] = image;
});
return images;
}
async function getImgFromFilename(zip, fileName) {
// Winamp only supports .bmp images, but WACUP set a precidence of supporting
// .png as well to reduce size. Since we care about size as well, we follow
// suit. Our default skin uses .png to save 14kb.
const file = await getFileFromZip(zip, fileName, "(png|bmp)", "blob");
if (!file) {
return null;
}
const mimeType = `image/${getFileExtension(file.name) || "*"}`; // The spec for createImageBitmap() says the browser should try to sniff the
// mime type, but it looks like Firefox does not. So we specify it here
// explicitly.
const typedBlob = new Blob([file.contents], {
type: mimeType
});
return getImgFromBlob(typedBlob);
}
async function getSpriteUrisFromFilename(zip, fileName) {
const img = await getImgFromFilename(zip, fileName);
if (img == null) {
return {};
}
return getSpriteUrisFromImg(img, skinSprites[fileName]);
} // https://docs.microsoft.com/en-us/windows/win32/xaudio2/resource-interchange-file-format--riff-
const RIFF_MAGIC = "RIFF".split("").map(c => c.charCodeAt(0));
function arrayStartsWith(arr, matcher) {
return matcher.every((item, i) => arr[i] === item);
}
async function getCursorFromFilename(zip, fileName) {
const file = await getFileFromZip(zip, fileName, "CUR", "uint8array");
if (file == null) {
return null;
}
const contents = file.contents;
if (arrayStartsWith(contents, RIFF_MAGIC)) {
return {
type: "ani",
aniData: contents
};
}
return {
type: "cur",
url: curUrlFromByteArray(contents)
};
}
async function getPlaylistStyle(zip) {
const files = zip.file(getFilenameRegex("PLEDIT", "txt"));
const file = files[0];
if (file == null) {
return DEFAULT_SKIN.playlistStyle;
}
const ini = await file.async("text");
if (ini == null) {
return DEFAULT_SKIN.playlistStyle;
}
const data = ini && parseIni(ini).text;
if (!data) {
// Corrupt or missing PLEDIT.txt file.
return DEFAULT_SKIN.playlistStyle;
} // Winamp seems to permit colors that contain too many characters.
// For compatibility with existing skins, we normalize them here.
["normal", "current", "normalbg", "selectedbg", "mbFG", "mbBG"].forEach(colorKey => {
let color = data[colorKey];
if (!color) {
return;
}
if (color[0] !== "#") {
color = `#${color}`;
}
data[colorKey] = color.slice(0, 7);
});
return skinParserUtils_objectSpread(skinParserUtils_objectSpread({}, DEFAULT_SKIN.playlistStyle), data);
}
async function getGenExColors(zip) {
const img = await getImgFromFilename(zip, "GENEX");
if (img == null) {
return null;
}
const canvas = document.createElement("canvas");
const context = canvas.getContext("2d");
if (context == null) {
return null;
}
canvas.width = img.width;
canvas.height = img.height;
context.drawImage(img, 0, 0);
const getColorAt = x => `rgb(${context.getImageData(x, 0, 1, 1) // Discard the alpha channel
.data.slice(0, 3).join(",")})`; // Ideally we would just have a map from key to the x value and map over
// that with getColorAt, but I don't know a great way to make that type
// safe. So, we'll just do this for now, where we explicitly call getColorAt
// for each key.
return {
// (1) x=48: item background (background to edits, listviews, etc.)
itemBackground: getColorAt(48),
// (2) x=50: item foreground (text colour of edits, listviews, etc.)
itemForeground: getColorAt(50),
// (3) x=52: window background (used to set the bg color for the dialog)
windowBackground: getColorAt(52),
// (4) x=54: button text colour
buttonText: getColorAt(54),
// (5) x=56: window text colour
windowText: getColorAt(56),
// (6) x=58: colour of dividers and sunken borders
divider: getColorAt(58),
// (7) x=60: selection colour for entries inside playlists (nothing else yet)
playlistSelection: getColorAt(60),
// (8) x=62: listview header background colour
listHeaderBackground: getColorAt(62),
// (9) x=64: listview header text colour
listHeaderText: getColorAt(64),
// (10) x=66: listview header frame top and left colour
listHeaderFrameTopAndLeft: getColorAt(66),
// (11) x=68: listview header frame bottom and right colour
listHeaderFrameBottomAndRight: getColorAt(68),
// (12) x=70: listview header frame colour, when pressed
listHeaderFramePressed: getColorAt(70),
// (13) x=72: listview header dead area colour
listHeaderDeadArea: getColorAt(72),
// (14) x=74: scrollbar colour #1
scrollbarOne: getColorAt(74),
// (15) x=76: scrollbar colour #2
scrollbarTwo: getColorAt(76),
// (16) x=78: pressed scrollbar colour #1
pressedScrollbarOne: getColorAt(78),
// (17) x=80: pressed scrollbar colour #2
pressedScrollbarTwo: getColorAt(80),
// (18) x=82: scrollbar dead area colour
scrollbarDeadArea: getColorAt(82),
// (19) x=84 List view text colour highlighted
listTextHighlighted: getColorAt(84),
// (20) x=86 List view background colour highlighted
listTextHighlightedBackground: getColorAt(86),
// (21) x=88 List view text colour selected
listTextSelected: getColorAt(88),
// (22) x=90 List view background colour selected
listTextSelectedBackground: getColorAt(90)
};
}
// CONCATENATED MODULE: ./js/skinParser.js
function skinParser_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function skinParser_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { skinParser_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { skinParser_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const shallowMerge = objs => objs.reduce((prev, img) => Object.assign(prev, img), {});
const CURSORS = ["CLOSE", "EQCLOSE", "EQNORMAL", "EQSLID", "EQTITLE", "MAINMENU", "MMENU", "MIN", "NORMAL", "PCLOSE", "PNORMAL", "POSBAR", "PSIZE", "PTBAR", "PVSCROLL", "PWINBUT", "PWSNORM", "PWSSIZE", "SONGNAME", "TITLEBAR", "VOLBAL", "WINBUT", "WSNORMAL", "WSPOSBAR"
/*
* > There are usually 4 more cursors in the skins: volbar.cur, wsclose.cur,
* > wswinbut.cur, wsmin.cur, but they are never used, at least in the last
* > versions of winamp, so there's no need of including them. The cursors
* > shown when the mouse is over the app-buttons are the same in normal and
* > winshade mode, except for the main menu button. You can make animated
* > cursors, but you have to name them with the extension .cur (animated
* > cursors are usually .ani files).
*
* -- Skinners Atlas
*
* "VOLBAR",
* "WSCLOSE",
* "WSWINBUT",
* "WSMIN",
*
*/
];
async function genVizColors(zip) {
const viscolor = await getFileFromZip(zip, "VISCOLOR", "txt", "text");
return viscolor ? parseViscolors(viscolor.contents) : DEFAULT_SKIN.colors;
}
async function genImages(zip) {
const imageObjs = await Promise.all(Object.keys(skinSprites).map(fileName => getSpriteUrisFromFilename(zip, fileName))); // Merge all the objects into a single object. Tests assert that sprite keys are unique.
return shallowMerge(imageObjs);
}
async function genCursors(zip) {
const cursorObjs = await Promise.all(CURSORS.map(async cursorName => ({
[cursorName]: await getCursorFromFilename(zip, cursorName)
})));
return shallowMerge(cursorObjs);
}
async function genRegion(zip) {
const region = await getFileFromZip(zip, "REGION", "txt", "text");
return region ? regionParser(region.contents) : {};
}
async function genGenTextSprites(zip) {
const img = await getImgFromFilename(zip, "GEN");
if (img == null) {
return null;
}
const canvas = document.createElement("canvas");
const context = canvas.getContext("2d");
canvas.width = img.width;
canvas.height = img.height;
context.drawImage(img, 0, 0);
const getLetters = (y, prefix) => {
const getColorAt = x => context.getImageData(x, y, 1, 1).data.join(",");
let x = 1;
const backgroundColor = getColorAt(0);
const height = 7;
return LETTERS.map(letter => {
let nextBackground = x;
while (getColorAt(nextBackground) !== backgroundColor && nextBackground < canvas.width) {
nextBackground++;
}
const width = nextBackground - x;
const name = `${prefix}_${letter}`;
const sprite = {
x,
y,
height,
width,
name
};
x = nextBackground + 1;
return sprite;
});
};
const letterWidths = {};
const sprites = [...getLetters(88, "GEN_TEXT_SELECTED"), ...getLetters(96, "GEN_TEXT")];
sprites.forEach(sprite => {
letterWidths[sprite.name] = sprite.width;
});
return [letterWidths, getSpriteUrisFromImg(img, sprites)];
} // A promise that, given an array buffer returns a skin style object
async function skinParser(zipFileBuffer, JSZip) {
const zip = await JSZip.loadAsync(zipFileBuffer);
const [colors, playlistStyle, images, cursors, region, genTextSprites, genExColors] = await Promise.all([genVizColors(zip), getPlaylistStyle(zip), genImages(zip), genCursors(zip), genRegion(zip), genGenTextSprites(zip), getGenExColors(zip)]);
const [genLetterWidths, genTextImages] = genTextSprites || [null, {}];
return {
colors,
playlistStyle,
images: skinParser_objectSpread(skinParser_objectSpread({}, images), genTextImages),
genLetterWidths,
cursors,
region,
genExColors
};
}
/* harmony default export */ var js_skinParser = (skinParser);
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/tinyqueue/index.js
var tinyqueue = __webpack_require__(39);
var tinyqueue_default = /*#__PURE__*/__webpack_require__.n(tinyqueue);
// CONCATENATED MODULE: ./js/loadQueue.js
// Push promises onto a queue with a priority.
// Run a given number of jobs in parallel
// Useful for prioritizing network requests
class loadQueue_LoadQueue {
constructor({
threads
}) {
// TODO: Consider not running items with zero priority
// Priority is a function so that items can change their priority between
// when their priority is evaluated.
// For example, we might add a track to the playlist and then scroll to/away
// from it before it gets processed.
this._queue = new tinyqueue_default.a([], (a, b) => a.priority() - b.priority());
this._availableThreads = threads;
}
push(task, priority) {
const t = {
task,
priority
};
this._queue.push(t); // Wait until the next event loop to pick a task to run. This way, we can
// enqueue multiple items in an event loop, and be sure they will be run in
// priority order.
setTimeout(() => {
this._run();
}, 0);
return () => {
// TODO: Could return a boolean representing if the task has already been
// kicked off.
this._queue = this._queue.filter(t1 => t1 !== t);
};
}
_run() {
while (this._availableThreads > 0) {
if (this._queue.length === 0) {
return;
}
this._availableThreads--;
const t = this._queue.pop();
const promise = t.task();
browser_default()(typeof promise.then === "function", `LoadQueue only supports loading Promises. Got ${promise}`);
promise.then(() => {
this._availableThreads++;
this._run();
});
}
}
}
// CONCATENATED MODULE: ./js/actionCreators/playlist.ts
function cropPlaylist() {
return (dispatch, getState) => {
const state = getState();
if (getSelectedTrackObjects(state).length === 0) {
return;
}
const selectedTrackIds = getSelectedTrackIds(state);
const {
playlist: {
trackOrder
}
} = state;
dispatch({
type: REMOVE_TRACKS,
// @ts-ignore The keys are numbers, but TypeScript does not trust us.
// https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208
ids: trackOrder.filter(id => !selectedTrackIds.has(id))
});
};
}
function removeSelectedTracks() {
return (dispatch, getState) => {
dispatch({
type: REMOVE_TRACKS,
// @ts-ignore The keys are numbers, but TypeScript does not trust us.
// https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208
ids: Array.from(getSelectedTrackIds(getState()))
});
};
}
function playlist_removeAllTracks() {
return dispatch => {
// It's a bit funky that we need to do both of these.
dispatch({
type: STOP
});
dispatch({
type: REMOVE_ALL_TRACKS
});
};
}
function playlist_reverseList() {
return {
type: REVERSE_LIST
};
}
function playlist_randomizeList() {
return {
type: RANDOMIZE_LIST
};
}
function playlist_sortListByTitle() {
return (dispatch, getState) => {
const state = getState();
const tracks = getTracks(state);
const trackOrder = sort(getTrackOrder(state), i => `${tracks[i].title}`.toLowerCase());
return dispatch({
type: SET_TRACK_ORDER,
trackOrder
});
};
}
function playlist_setPlaylistScrollPosition(position) {
return {
type: SET_PLAYLIST_SCROLL_POSITION,
position
};
}
function scrollNTracks(n) {
return (dispatch, getState) => {
const state = getState();
const overflow = getOverflowTrackCount(state);
const currentOffset = getScrollOffset(state);
const position = overflow ? clamp((currentOffset + n) / overflow, 0, 1) : 0;
return dispatch({
type: SET_PLAYLIST_SCROLL_POSITION,
position: position * 100
});
};
}
function playlist_scrollPlaylistByDelta(e) {
e.preventDefault();
return (dispatch, getState) => {
const state = getState();
if (getOverflowTrackCount(state)) {
e.stopPropagation();
}
const totalPixelHeight = state.playlist.trackOrder.length * TRACK_HEIGHT;
const percentDelta = e.deltaY / totalPixelHeight * 100;
dispatch({
type: SET_PLAYLIST_SCROLL_POSITION,
position: clamp(state.display.playlistScrollPosition + percentDelta, 0, 100)
});
};
}
function playlist_scrollUpFourTracks() {
return scrollNTracks(-4);
}
function playlist_scrollDownFourTracks() {
return scrollNTracks(4);
}
function playlist_dragSelected(offset) {
return (dispatch, getState) => {
const state = getState();
const tracks = getTracks(state);
const trackOrder = getTrackOrder(state);
const selectedIds = getSelectedTrackIds(state);
const firstSelected = trackOrder.findIndex(trackId => tracks[trackId] && selectedIds.has(trackId));
if (firstSelected === -1) {
return;
}
const lastSelected = findLastIndex(trackOrder, trackId => tracks[trackId] && selectedIds.has(trackId));
if (lastSelected === -1) {
throw new Error("We found a first selected, but not a last selected.");
} // Ensure we don't try to drag off either end.
const min = -firstSelected;
const max = trackOrder.length - 1 - lastSelected;
const normalizedOffset = clamp(offset, min, max);
if (normalizedOffset !== 0) {
dispatch({
type: DRAG_SELECTED,
offset: normalizedOffset
});
}
};
}
function invertSelection() {
return {
type: INVERT_SELECTION
};
}
function playlist_selectZero() {
return {
type: SELECT_ZERO
};
}
function selectAll() {
return {
type: SELECT_ALL
};
}
// CONCATENATED MODULE: ./js/actionCreators/files.ts
// Lower is better
const DURATION_VISIBLE_PRIORITY = 5;
const META_DATA_VISIBLE_PRIORITY = 10;
const DURATION_PRIORITY = 15;
const META_DATA_PRIORITY = 20;
const loadQueue = new loadQueue_LoadQueue({
threads: 4
});
function addTracksFromReferences(fileReferences, loadStyle, atIndex) {
const tracks = Array.from(fileReferences).map(file => ({
blob: file,
defaultName: file.name
}));
return files_loadMediaFiles(tracks, loadStyle, atIndex);
}
const SKIN_FILENAME_MATCHER = new RegExp("(wsz|zip)$", "i");
const EQF_FILENAME_MATCHER = new RegExp("eqf$", "i");
function loadFilesFromReferences(fileReferences, loadStyle = LOAD_STYLE.PLAY, atIndex = undefined) {
return dispatch => {
if (fileReferences.length < 1) {
return;
} else if (fileReferences.length === 1) {
const fileReference = fileReferences[0];
if (SKIN_FILENAME_MATCHER.test(fileReference.name)) {
dispatch(setSkinFromBlob(fileReference));
return;
} else if (EQF_FILENAME_MATCHER.test(fileReference.name)) {
dispatch(setEqFromFileReference(fileReference));
return;
}
}
dispatch(addTracksFromReferences(fileReferences, loadStyle, atIndex));
};
}
function setSkinFromBlob(blob) {
return async (dispatch, getState, {
requireJSZip
}) => {
if (!requireJSZip) {
alert("Webamp has not been configured to support custom skins.");
return;
}
dispatch({
type: LOADING
});
let JSZip;
try {
JSZip = await requireJSZip();
} catch (e) {
console.error(e);
dispatch({
type: LOADED
});
alert("Failed to load the skin parser.");
return;
}
try {
const skinData = await js_skinParser(blob, JSZip);
dispatch({
type: SET_SKIN_DATA,
data: {
skinImages: skinData.images,
skinColors: skinData.colors,
skinPlaylistStyle: skinData.playlistStyle,
skinCursors: skinData.cursors,
skinRegion: skinData.region,
skinGenLetterWidths: skinData.genLetterWidths,
skinGenExColors: skinData.genExColors
}
});
} catch (e) {
console.error(e);
dispatch({
type: LOADED
});
alert(`Failed to parse skin`);
}
};
}
function setSkinFromUrl(url) {
return async dispatch => {
dispatch({
type: LOADING
});
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(response.statusText);
}
dispatch(setSkinFromBlob(response.blob()));
} catch (e) {
console.error(e);
dispatch({
type: LOADED
});
alert(`Failed to download skin from ${url}`);
}
};
} // This function is private, since Winamp consumers can provide means for
// opening files via other methods. Only use the file type specific
// versions below, since they can defer to the user-defined behavior.
function _openFileDialog(accept, expectedType) {
return async dispatch => {
var _fileReferences$;
const fileReferences = await promptForFileReferences({
accept
});
dispatch({
type: "OPENED_FILES",
expectedType,
count: fileReferences.length,
firstFileName: (_fileReferences$ = fileReferences[0]) === null || _fileReferences$ === void 0 ? void 0 : _fileReferences$.name
});
dispatch(loadFilesFromReferences(fileReferences));
};
}
function files_openEqfFileDialog() {
return _openFileDialog(".eqf", "EQ");
}
function files_openMediaFileDialog() {
return _openFileDialog(null, "MEDIA");
}
function files_openSkinFileDialog() {
return _openFileDialog(".zip, .wsz", "SKIN");
}
function fetchMediaDuration(url, id) {
return (dispatch, getState) => {
loadQueue.push(async () => {
try {
const duration = await genMediaDuration(url);
dispatch({
type: SET_MEDIA_DURATION,
duration,
id
});
} catch (e) {// TODO: Should we update the state to indicate that we don't know the length?
}
}, () => {
const trackIsVisible = getTrackIsVisibleFunction(getState());
return trackIsVisible(id) ? DURATION_VISIBLE_PRIORITY : DURATION_PRIORITY;
});
};
}
function files_loadMedia(e, loadStyle = LOAD_STYLE.NONE, atIndex = 0) {
const {
files
} = e.dataTransfer;
return async (dispatch, getState, {
handleTrackDropEvent
}) => {
if (handleTrackDropEvent) {
const tracks = await handleTrackDropEvent(e);
if (tracks != null) {
dispatch(files_loadMediaFiles(tracks, loadStyle, atIndex));
return;
}
}
dispatch(loadFilesFromReferences(files, loadStyle, atIndex));
};
}
function files_loadMediaFiles(tracks, loadStyle = LOAD_STYLE.NONE, atIndex = 0) {
return dispatch => {
if (loadStyle === LOAD_STYLE.PLAY) {
// I'm the worst. It just so happens that in every case that we autoPlay,
// we should also clear all tracks.
dispatch(playlist_removeAllTracks());
}
tracks.forEach((track, i) => {
const priority = i === 0 ? loadStyle : LOAD_STYLE.NONE;
dispatch(loadMediaFile(track, priority, atIndex + i));
});
};
}
function loadMediaFile(track, priority = LOAD_STYLE.NONE, atIndex = 0) {
return dispatch => {
const id = uniqueId();
const {
defaultName,
metaData,
duration
} = track;
let canonicalUrl;
if ("url" in track) {
canonicalUrl = track.url.toString();
} else if ("blob" in track) {
canonicalUrl = URL.createObjectURL(track.blob);
} else {
throw new Error("Expected track to have either a blob or a url");
}
dispatch({
type: ADD_TRACK_FROM_URL,
url: canonicalUrl,
duration: track.duration,
defaultName,
id,
atIndex
});
switch (priority) {
case LOAD_STYLE.BUFFER:
dispatch({
type: BUFFER_TRACK,
id
});
break;
case LOAD_STYLE.PLAY:
dispatch({
type: PLAY_TRACK,
id
});
break;
case LOAD_STYLE.NONE:
default:
// If we're not going to load this right away,
// we should set duration on our own
if (duration != null) {
dispatch({
type: SET_MEDIA_DURATION,
duration,
id
});
} else {
dispatch(fetchMediaDuration(canonicalUrl, id));
}
}
if (metaData != null) {
const {
artist,
title,
album
} = metaData;
dispatch({
type: SET_MEDIA_TAGS,
artist,
title,
album,
// For now, we lie about these next three things.
// TODO: Ideally we would leave these as null and force a media data
// fetch when the user starts playing.
sampleRate: 44000,
bitrate: 192000,
numberOfChannels: 2,
id
});
} else if ("blob" in track) {
// Blobs can be loaded quickly
dispatch(fetchMediaTags(track.blob, id));
} else {
dispatch(queueFetchingMediaTags(id));
}
};
}
function queueFetchingMediaTags(id) {
return (dispatch, getState) => {
const track = getTracks(getState())[id];
loadQueue.push(() => dispatch(fetchMediaTags(track.url, id)), () => {
const trackIsVisible = getTrackIsVisibleFunction(getState());
return trackIsVisible(id) ? META_DATA_VISIBLE_PRIORITY : META_DATA_PRIORITY;
});
};
}
function fetchMediaTags(file, id) {
return async (dispatch, getState, {
requireMusicMetadata
}) => {
dispatch({
type: MEDIA_TAG_REQUEST_INITIALIZED,
id
});
try {
const metadata = await genMediaTags(file, await requireMusicMetadata()); // There's more data here, but we don't have a use for it yet:
const {
artist,
title,
album,
picture
} = metadata.common;
const {
numberOfChannels,
bitrate,
sampleRate
} = metadata.format;
let albumArtUrl = null;
if (picture && picture.length >= 1) {
const byteArray = new Uint8Array(picture[0].data);
const blob = new Blob([byteArray], {
type: picture[0].format
});
albumArtUrl = URL.createObjectURL(blob);
}
dispatch({
type: SET_MEDIA_TAGS,
artist: artist ? artist : "",
title: title ? title : "",
album,
albumArtUrl,
numberOfChannels,
bitrate,
sampleRate,
id
});
} catch (e) {
dispatch({
type: MEDIA_TAG_REQUEST_FAILED,
id
});
}
};
}
function setEqFromFileReference(fileReference) {
return async dispatch => {
const arrayBuffer = await genArrayBufferFromFileReference(fileReference);
const eqf = Object(winamp_eqf["parser"])(arrayBuffer);
const preset = eqf.presets[0];
dispatch(files_setEqFromObject(preset));
};
}
function files_setEqFromObject(preset) {
return dispatch => {
dispatch(setPreamp(normalizeEqBand(preset.preamp)));
BANDS.forEach(band => {
// @ts-ignore band and EqfPreset align
dispatch(setEqBand(band, normalizeEqBand(preset[`hz${band}`])));
});
};
}
function files_downloadPreset() {
return (dispatch, getState) => {
const state = getState();
const data = getEqfData(state);
const arrayBuffer = Object(winamp_eqf["creator"])(data);
const base64 = base64FromArrayBuffer(arrayBuffer);
const dataURI = `data:application/zip;base64,${base64}`;
downloadURI(dataURI, "entry.eqf");
};
}
function files_downloadHtmlPlaylist() {
return (dispatch, getState) => {
const uri = getPlaylistURL(getState());
downloadURI(uri, "Winamp Playlist.html");
};
}
let el = document.createElement("input");
el.type = "file"; // @ts-ingore
const DIR_SUPPORT = // @ts-ignore
typeof el.webkitdirectory !== "undefined" || // @ts-ignore
typeof el.mozdirectory !== "undefined" || // @ts-ignore
typeof el.directory !== "undefined"; // Release our reference
el = null;
function files_addFilesAtIndex(nextIndex) {
return async dispatch => {
const fileReferences = await promptForFileReferences();
dispatch(addTracksFromReferences(fileReferences, LOAD_STYLE.NONE, nextIndex));
};
}
function files_addDirAtIndex(nextIndex) {
return async dispatch => {
if (!DIR_SUPPORT) {
alert("Not supported in your browser");
return;
}
const fileReferences = await promptForFileReferences({
directory: true
});
dispatch(addTracksFromReferences(fileReferences, LOAD_STYLE.NONE, nextIndex));
};
}
function files_addFilesFromUrl(atIndex = 0) {
return async (dispatch, getState, {
handleAddUrlEvent
}) => {
if (handleAddUrlEvent) {
const tracks = await handleAddUrlEvent();
if (tracks != null) {
dispatch(files_loadMediaFiles(tracks, LOAD_STYLE.NONE, atIndex));
return;
}
} else {
alert("Not supported in Webamp");
}
};
}
function files_addFilesFromList() {
return async (dispatch, getState, {
handleLoadListEvent
}) => {
if (handleLoadListEvent) {
const tracks = await handleLoadListEvent();
if (tracks != null) {
dispatch(playlist_removeAllTracks());
dispatch(files_loadMediaFiles(tracks, LOAD_STYLE.NONE, 0));
return;
}
} else {
alert("Not supported in Webamp");
}
};
}
function files_saveFilesToList() {
return (dispatch, getState, {
handleSaveListEvent
}) => {
if (handleSaveListEvent) {
handleSaveListEvent(getUserTracks(getState()));
} else {
alert("Not supported in Webamp");
}
};
}
function files_droppedFiles(e, windowId) {
return dispatch => {
var _e$dataTransfer$files;
return dispatch({
type: "DROPPED_FILES",
count: e.dataTransfer.files.length,
firstFileName: (_e$dataTransfer$files = e.dataTransfer.files[0]) === null || _e$dataTransfer$files === void 0 ? void 0 : _e$dataTransfer$files.name,
windowId
});
};
}
// CONCATENATED MODULE: ./js/actionCreators/milkdrop.ts
function normalizePresetTypes(preset) {
const {
name
} = preset;
if ("butterchurnPresetObject" in preset) {
return {
type: "RESOLVED",
name,
preset: preset.butterchurnPresetObject
};
} else if ("getButterchrunPresetObject" in preset) {
return {
type: "UNRESOLVED",
name,
getPreset: preset.getButterchrunPresetObject
};
} else if ("butterchurnPresetUrl" in preset) {
return {
type: "UNRESOLVED",
name,
getPreset: async () => {
const resp = await fetch(preset.butterchurnPresetUrl);
return resp.json();
}
};
}
throw new Error("Invalid preset object");
}
function initializePresets(presetOptions) {
return async dispatch => {
const {
getPresets,
importButterchurn
} = presetOptions;
importButterchurn().then(butterchurn => {
dispatch({
type: GOT_BUTTERCHURN,
butterchurn: butterchurn.default
});
});
const presets = await getPresets();
const normalizePresets = presets.map(normalizePresetTypes);
dispatch(loadPresets(normalizePresets));
};
}
function loadPresets(presets) {
return (dispatch, getState) => {
const state = getState();
const presetsLength = state.milkdrop.presets.length;
dispatch({
type: GOT_BUTTERCHURN_PRESETS,
presets
});
if (presetsLength === 0 && getRandomizePresets(state)) {
dispatch(selectRandomPreset());
} else {
dispatch(milkdrop_requestPresetAtIndex(presetsLength, TransitionType.IMMEDIATE, true));
}
};
}
function milkdrop_appendPresetFileList(fileList) {
return async (dispatch, getState, {
convertPreset
}) => {
const presets = Array.from(fileList).map(file => {
const JSON_EXT = ".json";
const MILK_EXT = ".milk";
const filename = file.name.toLowerCase();
if (filename.endsWith(MILK_EXT)) {
if (convertPreset == null) {
throw new Error("Invalid type");
}
return {
type: "UNRESOLVED",
name: file.name.slice(0, file.name.length - MILK_EXT.length),
getPreset: () => convertPreset(file)
};
} else if (filename.endsWith(JSON_EXT)) {
return {
type: "UNRESOLVED",
name: file.name.slice(0, file.name.length - JSON_EXT.length),
getPreset: async () => {
const str = await genStringFromFileReference(file); // TODO: How should we handle the case where json parsing fails?
return JSON.parse(str);
}
};
}
console.error("Invalid type preset when loading directory");
return null;
}).filter(Boolean);
dispatch(loadPresets(presets));
};
}
function milkdrop_selectNextPreset(transitionType = TransitionType.DEFAULT) {
return (dispatch, getState) => {
const state = getState();
if (getRandomizePresets(state)) {
return dispatch(selectRandomPreset(transitionType));
}
const currentPresetIndex = getCurrentPresetIndex(state);
if (currentPresetIndex == null) {
return;
}
const nextPresetIndex = currentPresetIndex + 1;
dispatch(milkdrop_requestPresetAtIndex(nextPresetIndex, transitionType, true));
};
}
function milkdrop_selectPreviousPreset(transitionType = TransitionType.DEFAULT) {
return (dispatch, getState) => {
const state = getState();
const {
presetHistory
} = state.milkdrop;
if (presetHistory.length < 1) {
return;
} // Awkward. We do -2 becuase the the last track is the current track.
const lastPresetIndex = presetHistory[presetHistory.length - 2];
dispatch(milkdrop_requestPresetAtIndex(lastPresetIndex, transitionType, false));
};
}
function selectRandomPreset(transitionType = TransitionType.DEFAULT) {
return (dispatch, getState) => {
const state = getState(); // TODO: Make this a selector.
const randomIndex = Math.floor(Math.random() * state.milkdrop.presets.length);
dispatch(milkdrop_requestPresetAtIndex(randomIndex, transitionType, true));
};
} // TODO: Technically there's a race here. If you request two presets in a row, the
// first one may resolve before the second.
function milkdrop_requestPresetAtIndex(index, transitionType, addToHistory) {
return async (dispatch, getState) => {
const state = getState();
const preset = state.milkdrop.presets[index];
if (preset == null) {
// Index might be out of range.
return;
}
dispatch({
type: PRESET_REQUESTED,
index,
addToHistory
});
switch (preset.type) {
case "RESOLVED":
dispatch({
type: SELECT_PRESET_AT_INDEX,
index,
transitionType
});
return;
case "UNRESOLVED":
const json = await preset.getPreset(); // TODO: Ensure that this works correctly even if requests resolve out of order
dispatch({
type: RESOLVE_PRESET_AT_INDEX,
index,
json
});
dispatch({
type: SELECT_PRESET_AT_INDEX,
index,
transitionType
});
return;
}
};
}
function milkdrop_handlePresetDrop(e) {
return milkdrop_appendPresetFileList(e.dataTransfer.files);
}
function toggleRandomizePresets() {
return {
type: TOGGLE_RANDOMIZE_PRESETS
};
}
function togglePresetCycling() {
return {
type: TOGGLE_PRESET_CYCLING
};
}
function milkdrop_scheduleMilkdropMessage(message) {
return {
type: SCHEDULE_MILKDROP_MESSAGE,
message
};
}
// CONCATENATED MODULE: ./js/actionCreators/index.ts
function actionCreators_close() {
return dispatch => {
// TODO: This could probably be improved by adding a "PREVENT_CLOSE" action
// or something, but this works okay for now.
let defaultPrevented = false;
const cancel = () => {
defaultPrevented = true;
};
dispatch({
type: CLOSE_REQUESTED,
cancel
});
if (!defaultPrevented) {
dispatch({
type: STOP
});
dispatch({
type: CLOSE_WINAMP
});
}
};
}
function actionCreators_open() {
return {
type: OPEN_WINAMP
};
}
function actionCreators_toggleVisualizerStyle() {
return {
type: TOGGLE_VISUALIZER_STYLE
};
}
function actionCreators_minimize() {
return {
type: MINIMIZE_WINAMP
};
}
function actionCreators_setFocus(input) {
return {
type: SET_FOCUS,
input
};
}
function actionCreators_unsetFocus() {
return {
type: UNSET_FOCUS
};
}
function actionCreators_focusBand(band) {
return {
type: SET_BAND_FOCUS,
input: "eq",
bandFocused: band
};
}
function loadSerializedState( // In the future this type should be the union of all versioned types.
serializedState) {
return dispatch => {
dispatch({
type: LOAD_SERIALIZED_STATE,
serializedState
});
dispatch(ensureWindowsAreOnScreen());
};
}
function actionCreators_loadDefaultSkin() {
return {
type: LOAD_DEFAULT_SKIN
};
}
function toggleMilkdropDesktop() {
return (dispatch, getState) => {
if (getMilkdropDesktopEnabled(getState())) {
dispatch({
type: SET_MILKDROP_DESKTOP,
enabled: false
});
} else {
dispatch({
type: SET_MILKDROP_DESKTOP,
enabled: true
});
}
};
}
function setMilkdropFullscreen(enabled) {
return {
type: SET_MILKDROP_FULLSCREEN,
enabled
};
}
function toggleMilkdropFullscreen() {
return (dispatch, getState) => {
dispatch(setMilkdropFullscreen(!getMilkdropFullscreenEnabled(getState())));
};
}
function actionCreators_togglePresetOverlay() {
return (dispatch, getState) => {
if (getPresetOverlayOpen(getState())) {
dispatch(windows_setFocusedWindow(WINDOWS.MILKDROP));
}
dispatch({
type: TOGGLE_PRESET_OVERLAY
});
};
}
function actionCreators_stepMarquee() {
return {
type: STEP_MARQUEE
};
}
// CONCATENATED MODULE: ./js/mediaMiddleware.ts
/* harmony default export */ var mediaMiddleware = (media => store => {
const {
media: {
volume,
balance
},
equalizer: {
sliders
}
} = store.getState(); // Ensure the default state is the canonical value.
media.setVolume(volume);
media.setBalance(balance);
media.setPreamp(sliders.preamp); // TODO: Ensure other values like bands are in sync
media.on("timeupdate", () => {
store.dispatch({
type: UPDATE_TIME_ELAPSED,
elapsed: media.timeElapsed()
});
});
media.on("ended", () => {
store.dispatch(media_next());
});
media.on("playing", () => {
store.dispatch({
type: IS_PLAYING
});
});
media.on("waiting", () => {
store.dispatch({
type: START_WORKING
});
});
media.on("stopWaiting", () => {
store.dispatch({
type: STOP_WORKING
});
});
media.on("fileLoaded", () => {
const id = getCurrentTrackId(store.getState());
if (id == null) {
// Attempted to set the metadata for a track that was already removed.
// Really, the media should have been stopped when the track was removed.
return;
}
store.dispatch({
id,
type: SET_MEDIA,
kbps: "128",
khz: "44",
channels: 2,
length: media.duration()
});
});
return next => action => {
const returnValue = next(action);
const state = store.getState();
switch (action.type) {
case PLAY:
media.play();
break;
case PAUSE:
media.pause();
break;
case STOP:
media.stop();
break;
case SET_VOLUME:
media.setVolume(getVolume(state));
break;
case SET_BALANCE:
media.setBalance(getBalance(state));
break;
case SEEK_TO_PERCENT_COMPLETE:
media.seekToPercentComplete(action.percent);
break;
case PLAY_TRACK:
{
const url = getTrackUrl(store.getState())(action.id);
if (url != null) {
media.loadFromUrl(url, true);
}
break;
}
case BUFFER_TRACK:
{
const url = getTrackUrl(store.getState())(action.id);
if (url != null) {
media.loadFromUrl(url, false);
}
break;
}
case SET_BAND_VALUE:
if (action.band === "preamp") {
media.setPreamp(action.value);
} else {
media.setEqBand(action.band, action.value);
}
break;
case SET_EQ_OFF:
media.disableEq();
break;
case SET_EQ_ON:
media.enableEq();
break;
case LOAD_SERIALIZED_STATE:
{
// Set ALL THE THINGS!
if (getEqualizerEnabled(state)) {
media.enableEq();
} else {
media.disableEq();
}
media.setVolume(getVolume(state));
media.setBalance(getBalance(state));
objectForEach(state.equalizer.sliders, (value, slider) => {
if (slider === "preamp") {
media.setPreamp(value);
} else {
// @ts-ignore I don't know how to teach TypeScript about objects
// that use Slider as keys
media.setEqBand(slider, value);
}
});
break;
}
}
return returnValue;
};
});
// CONCATENATED MODULE: ./js/store.ts
// TODO: Move to demo
const compose = Object(redux_devtools_extension["composeWithDevTools"])({
actionsBlacklist: [UPDATE_TIME_ELAPSED, STEP_MARQUEE]
});
/* harmony default export */ var js_store = (function (media, actionEmitter, customMiddlewares = [], stateOverrides, extras) {
let initialState;
if (stateOverrides) {
initialState = merge(reducers(undefined, {
type: "@@init"
}), stateOverrides);
}
const emitterMiddleware = () => next => action => {
actionEmitter.trigger(action.type, action);
return next(action);
};
const enhancer = compose(Object(redux["applyMiddleware"])(...[es.withExtraArgument(extras), mediaMiddleware(media), emitterMiddleware, ...customMiddlewares].filter(Boolean))); // The Redux types are a bit confused, and don't realize that passing an
// undefined initialState is allowed.
const store = initialState ? Object(redux["createStore"])(reducers, initialState, enhancer) : Object(redux["createStore"])(reducers, enhancer);
return store;
});
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/fscreen/lib/index.js
var fscreen_lib = __webpack_require__(13);
var fscreen_lib_default = /*#__PURE__*/__webpack_require__.n(fscreen_lib);
// CONCATENATED MODULE: ./js/components/Fullscreen.tsx
// Adapted from https://github.com/snakesilk/react-fullscreen
function leaveFullScreen() {
if (fscreen_lib_default.a.fullscreenEnabled) {
fscreen_lib_default.a.exitFullscreen();
}
}
function enterFullScreen(node) {
if (fscreen_lib_default.a.fullscreenEnabled) {
fscreen_lib_default.a.requestFullscreen(node);
}
}
function FullScreen(props) {
const {
onChange,
enabled
} = props;
const ref = Object(react["useRef"])(null);
Object(react["useEffect"])(() => {
function detectFullScreen() {
if (onChange) {
onChange(fscreen_lib_default.a.fullscreenElement === ref.current);
}
}
fscreen_lib_default.a.addEventListener("fullscreenchange", detectFullScreen);
return () => {
fscreen_lib_default.a.removeEventListener("fullscreenchange", detectFullScreen);
};
}, [onChange]); // This must run in response to a click event, so we'll use useLayoutEffect just in case.
Object(react["useLayoutEffect"])(() => {
const isEnabled = fscreen_lib_default.a.fullscreenElement === ref.current;
if (isEnabled && !enabled) {
leaveFullScreen();
} else if (!isEnabled && enabled && ref.current != null) {
enterFullScreen(ref.current);
}
}, [enabled]);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
ref: ref,
style: props.enabled ? {
height: "100%",
width: "100%"
} : undefined,
children: props.children
});
}
/* harmony default export */ var Fullscreen = (FullScreen);
// CONCATENATED MODULE: ./js/hooks.ts
function useUnmountedRef() {
const unmountedRef = Object(react["useRef"])(false);
Object(react["useEffect"])(() => {
return () => {
unmountedRef.current = true;
};
}, []);
return unmountedRef;
}
function usePromiseValueOrNull(propValue) {
const [value, setValue] = Object(react["useState"])(null);
Object(react["useEffect"])(() => {
let disposed = false;
propValue.then(resolvedValue => {
if (disposed) {
return;
}
setValue(resolvedValue);
});
return () => {
disposed = true;
};
}, [propValue]);
return value;
}
function useScreenSize() {
const [size] = Object(react["useState"])(getScreenSize()); // TODO: We could subscribe to screen size changes.
return size;
}
function useWindowSize() {
const [size, setSize] = Object(react["useState"])(utils_getWindowSize());
const handler = Object(react["useCallback"])(throttle(() => {
setSize(utils_getWindowSize());
}, 100), []);
Object(react["useEffect"])(() => {
window.addEventListener("resize", handler);
return () => {
window.removeEventListener("resize", handler);
};
}, [handler]);
return size;
}
const cursorPositionRef = {
current: {
pageX: 0,
pageY: 0
}
};
window.document.addEventListener("mousemove", ({
pageX,
pageY
}) => {
cursorPositionRef.current = {
pageX,
pageY
};
}); // We use a single global event listener because there is no way to get the
// mouse position aside from an event. Ideally we could create/clean up the
// event listener in the hook, but in the case where we want to check the cursor
// position on mount, that we wouldn't have had time to capture an event.
function useCursorPositionRef() {
return cursorPositionRef;
} // CSS hover state is not respected if the cursor is already over the node when
// it is added to the DOM. This hook allows your component to know its hover
// state on mount without waiting for the mouse to move.
// https://stackoverflow.com/a/13259049/1263117
function useIsHovered() {
const cursorRef = useCursorPositionRef();
const [hover, setHover] = Object(react["useState"])(false);
const [node, setNode] = Object(react["useState"])(null);
Object(react["useLayoutEffect"])(() => {
if (node == null) {
setHover(false);
return;
}
const domRect = node.getBoundingClientRect();
const {
pageX,
pageY
} = cursorRef.current;
setHover(pageX >= domRect.left && pageX <= domRect.right && pageY >= domRect.top && pageY <= domRect.bottom);
const enter = () => setHover(true);
const leave = () => setHover(false);
node.addEventListener("mouseenter", enter);
node.addEventListener("mouseleave", leave);
return () => {
node.removeEventListener("mouseenter", enter);
node.removeEventListener("mouseleave", leave);
};
}, [node, cursorRef]);
return {
ref: setNode,
hover
};
}
function useOnClickAway(ref, callback) {
Object(react["useEffect"])(() => {
if (ref == null || callback == null) {
return;
}
const handleClickOut = ee => {
const clickOutTarget = ee.target;
if (!(clickOutTarget instanceof Element)) {
// TypeScript doesn't realize this will always be true
return;
}
if (ref.contains(clickOutTarget)) {
return;
} // If the click is _not_ inside the menu.
callback();
window.document.removeEventListener("click", handleClickOut, {
capture: true
});
};
window.document.addEventListener("click", handleClickOut, {
capture: true
});
return () => {
window.document.removeEventListener("click", handleClickOut, {
capture: true
});
};
}, [ref, callback]);
} // TODO: Return useSelector directly and apply the type without wrapping
function useTypedSelector(selector) {
return useSelector_useSelector(selector);
}
function useActionCreator(actionCreator) {
const dispatch = useDispatch();
return Object(react["useCallback"])((...args) => dispatch(actionCreator(...args)), [dispatch, actionCreator]);
}
function useTypedDispatch() {
return useDispatch();
}
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/classnames/index.js
var classnames = __webpack_require__(4);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
// EXTERNAL MODULE: ./css/gen-window.css
var gen_window = __webpack_require__(68);
// CONCATENATED MODULE: ./js/components/ResizeTarget.tsx
function ResizeTarget_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function ResizeTarget_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ResizeTarget_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ResizeTarget_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function ResizeTarget(props) {
const {
currentSize,
setWindowSize,
widthOnly
} = props,
passThroughProps = objectWithoutProperties_default()(props, ["currentSize", "setWindowSize", "widthOnly"]);
const [mouseDown, setMouseDown] = Object(react["useState"])(false);
const [mouseStart, setMouseStart] = Object(react["useState"])(null);
Object(react["useEffect"])(() => {
if (mouseDown === false || mouseStart == null) {
return;
}
const [width, height] = currentSize;
const handleMove = ee => {
const x = getX(ee) - mouseStart.x;
const y = getY(ee) - mouseStart.y;
const newWidth = Math.max(0, width + Math.round(x / WINDOW_RESIZE_SEGMENT_WIDTH));
const newHeight = widthOnly ? width : Math.max(0, height + Math.round(y / WINDOW_RESIZE_SEGMENT_HEIGHT));
const newSize = [newWidth, newHeight];
props.setWindowSize(newSize);
};
window.addEventListener("mousemove", handleMove);
window.addEventListener("touchmove", handleMove);
const handleMouseUp = () => setMouseDown(false);
window.addEventListener("mouseup", handleMouseUp);
window.addEventListener("touchend", handleMouseUp);
return () => {
window.removeEventListener("mousemove", handleMove);
window.removeEventListener("touchmove", handleMove);
window.removeEventListener("mouseup", handleMouseUp);
window.removeEventListener("touchend", handleMouseUp);
}; // We pruposefully close over the props from when the mouse went down
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [mouseStart, mouseDown]);
const handleMouseDown = e => {
setMouseStart({
x: getX(e),
y: getY(e)
});
setMouseDown(true);
};
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", ResizeTarget_objectSpread({
onMouseDown: handleMouseDown,
onTouchStart: handleMouseDown
}, passThroughProps));
}
/* harmony default export */ var components_ResizeTarget = (Object(react["memo"])(ResizeTarget));
// CONCATENATED MODULE: ./js/components/FocusTarget.tsx
function FocusTarget({
onKeyDown,
windowId,
children
}) {
const focusedWindowId = useTypedSelector(getFocusedWindow);
const setFocus = useActionCreator(windows_setFocusedWindow);
const focusHandler = Object(react["useCallback"])(() => {
if (windowId !== focusedWindowId) {
setFocus(windowId);
}
}, [windowId, focusedWindowId, setFocus]);
const [ref, setRef] = Object(react["useState"])(null);
Object(react["useEffect"])(() => {
if (ref == null || onKeyDown == null) {
return;
}
ref.addEventListener("keydown", onKeyDown);
return () => ref.removeEventListener("keydown", onKeyDown);
}, [onKeyDown, windowId, focusedWindowId, ref]); // It's possible for a child component to gain focus and then become
// unmounted. In that case, the browser will return focus to the `<body>`.
// In the following hook, use a `MutationObserver` to watch for that behavior
// and refocus the containing FocusTarget when it happens.
//
// I tried a number of other approaches using `focus/blur/focusin/focusout` on
// various DOM nodes, and was unable to find a solution which would trigger in
// this senario in Firefox. Therefore we use this `MutationObserver` approach.
Object(react["useEffect"])(() => {
// Only create the `MutationObserver` within the currently focused target.
if (ref == null || windowId !== focusedWindowId) {
return;
}
const observer = new MutationObserver(mutations => {
// In the common case we won't have focused the body, so we can do this
// inexpensive check first to avoid calling the more expensive `O(n)`
// check of the individual mutations.
if (document.activeElement !== document.body) {
return;
}
if (mutations.some(mutation => mutation.removedNodes.length > 0)) {
ref.focus();
}
});
observer.observe(ref, {
subtree: true,
attributes: false,
childList: true
});
return () => observer.disconnect();
}, [windowId, focusedWindowId, ref]);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
ref: setRef,
onMouseDown: focusHandler,
onTouchStart: focusHandler,
onFocus: focusHandler,
tabIndex: -1,
style: {
height: "100%",
width: "100%"
},
children: children
});
}
/* harmony default export */ var components_FocusTarget = (FocusTarget);
// CONCATENATED MODULE: ./js/components/GenWindow/index.tsx
const Text = ({
children
}) => {
const letters = children.split("");
return /*#__PURE__*/Object(jsx_runtime["jsx"])(react["Fragment"], {
children: letters.map((letter, i) => /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: `draggable gen-text-letter gen-text-${letter === " " ? "space" : letter.toLowerCase()}`
}, i))
});
};
const CHROME_WIDTH = 19;
const CHROME_HEIGHT = 34;
// Named export for testing
const GenWindow = ({
children,
title,
windowId,
onKeyDown
}) => {
const setWindowSize = useActionCreator(windows_setWindowSize);
const closeWindow = useActionCreator(windows_closeWindow);
const getWindowPixelSize = useTypedSelector(selectors_getWindowPixelSize);
const focusedWindow = useTypedSelector(getFocusedWindow);
const getWindowSize = useTypedSelector(selectors_getWindowSize);
const windowSize = getWindowSize(windowId);
const selected = focusedWindow === windowId;
const {
width,
height
} = getWindowPixelSize(windowId);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_FocusTarget, {
windowId: windowId,
onKeyDown: onKeyDown,
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: classnames_default()("gen-window", "window", {
selected
}),
style: {
width,
height
},
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "gen-top draggable",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-top-left draggable"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-top-left-fill draggable"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-top-left-end draggable"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-top-title draggable",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(Text, {
children: title
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-top-right-end draggable"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-top-right-fill draggable"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-top-right draggable",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-close selected",
onClick: () => closeWindow(windowId)
})
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "gen-middle",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-middle-left draggable",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-middle-left-bottom draggable"
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-middle-center",
children: children({
width: width - CHROME_WIDTH,
height: height - CHROME_HEIGHT
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-middle-right draggable",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-middle-right-bottom draggable"
})
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "gen-bottom draggable",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-bottom-left draggable"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "gen-bottom-right draggable",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(components_ResizeTarget, {
currentSize: windowSize,
setWindowSize: size => setWindowSize(windowId, size),
id: "gen-resize-target"
})
})]
})]
})
});
};
/* harmony default export */ var components_GenWindow = (GenWindow);
// CONCATENATED MODULE: ./js/components/MilkdropWindow/Visualizer.tsx
const TRANSITION_TYPE_DURATIONS = {
[TransitionType.DEFAULT]: 2.7,
[TransitionType.IMMEDIATE]: 0,
[TransitionType.USER_PRESET]: 5.7
};
function Visualizer({
analyser,
width,
height
}) {
const visualizerStyle = useTypedSelector(selectors_getVisualizerStyle);
const playing = useTypedSelector(getMediaIsPlaying);
const butterchurn = useTypedSelector(getButterchurn);
const trackTitle = useTypedSelector(getCurrentTrackDisplayName);
const currentPreset = useTypedSelector(getCurrentPreset);
const transitionType = useTypedSelector(getPresetTransitionType);
const message = useTypedSelector(getMilkdropMessage);
const isEnabledVisualizer = visualizerStyle === VISUALIZERS.MILKDROP;
const canvasRef = Object(react["useRef"])(null);
const [visualizer, setVisualizer] = Object(react["useState"])(null); // Initialize the visualizer
Object(react["useEffect"])(() => {
if (canvasRef.current == null || butterchurn == null) {
return;
}
if (visualizer != null) {
// Note: The visualizer does not offer anyway to clean itself up. So, we
// don't offer any way to recreate it. So, if you swap out the analyser
// node, or the canvas, that change won't be respected.
return;
}
const _visualizer = butterchurn.createVisualizer(analyser.context, canvasRef.current, {
width,
height,
meshWidth: 32,
meshHeight: 24,
pixelRatio: window.devicePixelRatio || 1
});
_visualizer.connectAudio(analyser);
setVisualizer(_visualizer);
}, [butterchurn, analyser, height, width, visualizer]); // Ensure render size stays up to date
Object(react["useEffect"])(() => {
if (visualizer == null) {
return;
}
visualizer.setRendererSize(width, height);
}, [visualizer, width, height]); // Load presets when they change
const hasLoadedPreset = Object(react["useRef"])(false);
Object(react["useEffect"])(() => {
if (visualizer == null || currentPreset == null) {
return;
}
if (hasLoadedPreset.current) {
visualizer.loadPreset(currentPreset, TRANSITION_TYPE_DURATIONS[transitionType]);
} else {
visualizer.loadPreset(currentPreset, TRANSITION_TYPE_DURATIONS[TransitionType.IMMEDIATE]);
hasLoadedPreset.current = true;
} // We don't want to trigger the transition if the transition type changes.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [visualizer, currentPreset]); // Handle title animations
Object(react["useEffect"])(() => {
if (visualizer == null || !trackTitle) {
return;
}
visualizer.launchSongTitleAnim(trackTitle);
}, [visualizer, trackTitle]);
const lastShownMessage = Object(react["useRef"])(null);
Object(react["useEffect"])(() => {
if (visualizer == null || message == null) {
return;
}
if (lastShownMessage.current == null || message.time > lastShownMessage.current) {
lastShownMessage.current = Date.now();
visualizer.launchSongTitleAnim(message.text);
}
}, [visualizer, message]);
const shouldAnimate = playing && isEnabledVisualizer; // Kick off the animation loop
Object(react["useEffect"])(() => {
if (!shouldAnimate || visualizer == null) {
return;
}
let animationFrameRequest = null;
const loop = () => {
visualizer.render();
animationFrameRequest = window.requestAnimationFrame(loop);
};
loop();
return () => {
if (animationFrameRequest != null) {
window.cancelAnimationFrame(animationFrameRequest);
}
};
}, [visualizer, shouldAnimate]);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("canvas", {
height: height,
width: width,
style: {
height: "100%",
width: "100%",
display: isEnabledVisualizer ? "block" : "none"
},
ref: canvasRef
});
}
/* harmony default export */ var MilkdropWindow_Visualizer = (Visualizer);
// EXTERNAL MODULE: ./css/milkdrop-window.css
var milkdrop_window = __webpack_require__(71);
// CONCATENATED MODULE: ./js/components/MilkdropWindow/Background.tsx
const Background = props => {
const {
innerRef
} = props;
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
ref: innerRef,
className: "draggable",
style: {
// This color will be used until Butterchurn is loaded
backgroundColor: "#000",
position: "absolute",
top: 0,
bottom: 0,
left: 0,
right: 0,
height: "100%",
width: "100%"
},
tabIndex: 0,
children: props.children
});
};
/* harmony default export */ var MilkdropWindow_Background = (Background);
// CONCATENATED MODULE: ./js/components/MilkdropWindow/PresetOverlay.tsx
function PresetOverlay_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function PresetOverlay_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { PresetOverlay_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { PresetOverlay_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const ENTRY_HEIGHT = 14;
const HEIGHT_PADDING = 15;
const WIDTH_PADDING = 20;
const LOADING_STYLE = {
position: "absolute",
top: 0,
left: 0,
color: "white",
background: "rgba(0.33, 0.33, 0.33, 0.33)"
};
const OUTER_WRAPPER_STYLE = {
position: "absolute",
top: 0,
left: 0,
padding: "15px 10px 0 10px"
};
const INNER_WRAPPER_STYLE = {
display: "inline-block",
whiteSpace: "nowrap",
overflow: "hidden",
background: "rgba(0, 0, 0, 0.815)",
fontSize: "12px"
};
function presetIndexFromListIndex(listIndex) {
return listIndex - 1;
}
function listIndexFromPresetIndex(listIndex) {
return listIndex + 1;
}
function PresetOverlay({
height,
width
}) {
const presetKeys = useTypedSelector(getPresetNames);
const currentPresetIndex = useTypedSelector(getCurrentPresetIndex);
const requestPresetAtIndex = useActionCreator(milkdrop_requestPresetAtIndex);
const togglePresetOverlay = useActionCreator(actionCreators_togglePresetOverlay);
const appendPresetFileList = useActionCreator(milkdrop_appendPresetFileList);
const unmountedRef = useUnmountedRef();
const [selectedListIndex, setSelectedListIndex] = Object(react["useState"])(() => {
if (currentPresetIndex != null) {
return listIndexFromPresetIndex(currentPresetIndex);
}
return 0;
}); // Number of presets, plus one for the "Load Local Directory" option, minus
// one to convert a length to an index.
const maxListIndex = presetKeys.length; // - 1 + 1;
const renderList = Object(react["useCallback"])(() => {
const maxVisibleRows = Math.floor((height - HEIGHT_PADDING) / ENTRY_HEIGHT);
const rowsToShow = Math.floor(maxVisibleRows * 0.75); // Only fill 3/4 of the screen.
const [startIndex, endIndex] = getRangeCenteredOnIndex(maxListIndex + 1, // Add one to convert an index to a length
rowsToShow, selectedListIndex);
const presetElms = [];
for (let i = startIndex; i <= endIndex; i++) {
const presetIndex = presetIndexFromListIndex(i);
const isSelected = i === selectedListIndex;
const isCurrent = presetIndex === currentPresetIndex;
let color;
if (isSelected) {
color = isCurrent ? "#FFCC22" : "#FF5050";
} else {
color = isCurrent ? "#CCFF03" : "#CCCCCC";
}
presetElms.push( /*#__PURE__*/Object(jsx_runtime["jsx"])("li", {
style: {
color,
lineHeight: `${ENTRY_HEIGHT}px`
},
children: i === 0 ? "Load Local Directory" : presetKeys[presetIndex]
}, i));
}
return presetElms;
}, [currentPresetIndex, height, maxListIndex, presetKeys, selectedListIndex]);
const loadLocalDir = Object(react["useCallback"])(async () => {
const fileReferences = await promptForFileReferences({
directory: true
});
if (unmountedRef.current) {
return;
}
appendPresetFileList(fileReferences);
}, [appendPresetFileList, unmountedRef]);
const handleFocusedKeyboardInput = Object(react["useCallback"])(e => {
switch (e.keyCode) {
case 38:
// up arrow
setSelectedListIndex(value => Math.max(value - 1, 0));
e.stopPropagation();
break;
case 40:
// down arrow
setSelectedListIndex(value => Math.min(value + 1, maxListIndex));
e.stopPropagation();
break;
case 13:
// enter
if (selectedListIndex === 0) {
loadLocalDir();
} else {
requestPresetAtIndex(presetIndexFromListIndex(selectedListIndex), TransitionType.DEFAULT, true);
}
e.stopPropagation();
break;
case 27:
// escape
togglePresetOverlay();
e.stopPropagation();
break;
}
}, [loadLocalDir, maxListIndex, requestPresetAtIndex, selectedListIndex, togglePresetOverlay]);
const handleNode = Object(react["useCallback"])(node => {
if (node != null && document.activeElement !== node) {
node.focus();
}
}, []);
if (presetKeys == null) {
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
style: LOADING_STYLE,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("span", {
children: "Loading presets"
})
});
}
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
ref: handleNode,
tabIndex: -1,
style: OUTER_WRAPPER_STYLE,
onKeyDown: handleFocusedKeyboardInput,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
style: PresetOverlay_objectSpread(PresetOverlay_objectSpread({}, INNER_WRAPPER_STYLE), {}, {
width: width - 20 - WIDTH_PADDING,
maxHeight: height - HEIGHT_PADDING
}),
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("ul", {
style: {
listStyleType: "none",
padding: 0,
margin: 0
},
children: renderList()
})
})
});
} // Find a tuple `[startIndex, endIndex]` representing start/end indexes into an
// array of length `length`, that descripe a range of size up to `rangeSize`
// where a best effort is made to center `indexToCenter`.
function getRangeCenteredOnIndex(length, maxRangeSize, indexToCenter) {
const rangeSize = Math.min(length, maxRangeSize);
const halfRangeSize = Math.floor(rangeSize / 2);
const idealStartIndex = indexToCenter - halfRangeSize;
const startIndex = clamp(idealStartIndex, 0, length - rangeSize);
const endIndex = startIndex + rangeSize - 1;
return [startIndex, endIndex];
}
/* harmony default export */ var MilkdropWindow_PresetOverlay = (PresetOverlay);
// CONCATENATED MODULE: ./js/components/DropTarget.tsx
function DropTarget_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function DropTarget_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { DropTarget_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { DropTarget_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function supress(e) {
e.stopPropagation();
e.preventDefault();
e.dataTransfer.dropEffect = "link";
e.dataTransfer.effectAllowed = "link";
}
const DropTarget = props => {
const {
// eslint-disable-next-line no-shadow, no-unused-vars
handleDrop,
windowId
} = props,
passThroughProps = objectWithoutProperties_default()(props, ["handleDrop", "windowId"]);
const droppedFiles = useActionCreator(files_droppedFiles);
const onDrop = Object(react["useCallback"])(e => {
supress(e);
droppedFiles(e, windowId); // TODO: We could probably move this coordinate logic into the playlist.
// I think that's the only place it gets used.
const {
currentTarget
} = e;
if (!(currentTarget instanceof Element)) {
return;
}
const {
left: x,
top: y
} = currentTarget.getBoundingClientRect();
handleDrop(e, {
x,
y
});
}, [handleDrop, droppedFiles, windowId]);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", DropTarget_objectSpread(DropTarget_objectSpread({}, passThroughProps), {}, {
onDragStart: supress,
onDragEnter: supress,
onDragOver: supress,
onDrop: onDrop
}));
};
/* harmony default export */ var components_DropTarget = (DropTarget);
// EXTERNAL MODULE: ./css/context-menu.css
var context_menu = __webpack_require__(73);
// CONCATENATED MODULE: ./js/components/ContextMenu.tsx
function ContextMenu_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function ContextMenu_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ContextMenu_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ContextMenu_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const Portal = props => {
const node = Object(react["useMemo"])(() => {
const div = document.createElement("div");
div.id = "webamp-context-menu";
div.style.position = "absolute";
div.style.top = "0";
div.style.left = "0";
div.style.zIndex = String(props.zIndex + 1);
return div;
}, [props.zIndex]);
Object(react["useEffect"])(() => {
document.body.appendChild(node);
return () => {
document.body.removeChild(node);
};
}, [node]);
const style = {
top: props.top,
left: props.left,
position: "absolute"
};
return Object(react_dom["createPortal"])( /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
style: style,
children: props.children
}), node);
};
const ContextMenu_Hr = () => /*#__PURE__*/Object(jsx_runtime["jsx"])("li", {
className: "hr",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("hr", {})
});
const Parent = ({
children,
label
}) => /*#__PURE__*/Object(jsx_runtime["jsxs"])("li", {
className: "parent",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("ul", {
children: children
}), label]
});
const LinkNode = props => /*#__PURE__*/Object(jsx_runtime["jsx"])("li", {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("a", ContextMenu_objectSpread(ContextMenu_objectSpread({}, props), {}, {
children: props.label
}))
});
const Node = props => {
const {
label,
checked,
className = ""
} = props,
passThroughProps = objectWithoutProperties_default()(props, ["label", "checked", "className"]);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("li", ContextMenu_objectSpread(ContextMenu_objectSpread({
className: classnames_default()(className, {
checked
})
}, passThroughProps), {}, {
children: label
}));
};
function ContextMenu({
children,
offsetTop,
offsetLeft,
top,
bottom,
selected
}) {
const zIndex = useTypedSelector(getZIndex);
if (!selected) {
return null;
}
return /*#__PURE__*/Object(jsx_runtime["jsx"])(Portal, {
top: offsetTop,
left: offsetLeft,
zIndex: zIndex,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("ul", {
className: classnames_default()("context-menu", {
top,
bottom
}),
children: children
})
});
}
// CONCATENATED MODULE: ./js/components/ContextMenuWrapper.tsx
function ContextMenuWrapper_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function ContextMenuWrapper_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ContextMenuWrapper_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ContextMenuWrapper_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
// Trigger a context menu at the user's cursor position when the user right
// clicks within this component.
// For a component that triggers relative to a given component when the user
// left-clicks see `<ContextMenuTarget />`.
// TODO: Consider using nested contexts to ensure we don't ever have multiple
// non-nested context menus open at a time.
function ContextMenuWraper(_ref) {
var _openPosition$y, _openPosition$x;
let {
children,
renderContents
} = _ref,
passThroughProps = objectWithoutProperties_default()(_ref, ["children", "renderContents"]);
const [openPosition, setOpenPosition] = Object(react["useState"])(null);
const closeMenu = Object(react["useCallback"])(() => {
setOpenPosition(null);
}, []);
const handleGlobalClick = Object(react["useCallback"])(e => {
if (e.button !== 2) {
closeMenu();
}
}, [closeMenu]);
const handleRightClick = Object(react["useCallback"])(e => {
const {
pageX,
pageY
} = e; // TODO: We could do an initial render to see if the menu fits here
// and do a second render if it does not.
setOpenPosition({
x: pageX,
y: pageY
});
e.preventDefault();
e.stopPropagation();
}, []); // Add click-away listeners when window is open
Object(react["useEffect"])(() => {
if (openPosition == null) {
return;
}
document.addEventListener("click", handleGlobalClick);
document.body.addEventListener("contextmenu", closeMenu);
return () => {
document.removeEventListener("click", handleGlobalClick);
document.body.removeEventListener("contextmenu", closeMenu);
};
}, [openPosition, closeMenu, handleGlobalClick]);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", ContextMenuWrapper_objectSpread(ContextMenuWrapper_objectSpread({
onContextMenu: handleRightClick,
style: {
width: "100%",
height: "100%"
}
}, passThroughProps), {}, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu, {
selected: openPosition != null,
offsetTop: (_openPosition$y = openPosition === null || openPosition === void 0 ? void 0 : openPosition.y) !== null && _openPosition$y !== void 0 ? _openPosition$y : 0,
offsetLeft: (_openPosition$x = openPosition === null || openPosition === void 0 ? void 0 : openPosition.x) !== null && _openPosition$x !== void 0 ? _openPosition$x : 0,
children: renderContents()
}), children]
}));
}
// CONCATENATED MODULE: ./js/components/MilkdropWindow/MilkdropContextMenu.tsx
const MilkdropContextMenu = props => {
const desktop = useTypedSelector(getMilkdropDesktopEnabled);
const closeWindow = useActionCreator(windows_closeWindow);
const toggleDesktop = useActionCreator(toggleMilkdropDesktop);
const toggleFullscreen = useActionCreator(toggleMilkdropFullscreen);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenuWraper, {
renderContents: () => {
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(jsx_runtime["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
onClick: toggleFullscreen,
label: "Fullscreen",
hotkey: "Alt+Enter"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
onClick: toggleDesktop,
checked: desktop,
label: "Desktop Mode",
hotkey: "Alt+D"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu_Hr, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
onClick: () => closeWindow(WINDOWS.MILKDROP),
label: "Quit"
})]
});
},
children: props.children
});
};
/* harmony default export */ var MilkdropWindow_MilkdropContextMenu = (MilkdropContextMenu);
// CONCATENATED MODULE: ./js/components/MilkdropWindow/Desktop.tsx
const Desktop = react["memo"](({
children
}) => {
const [desktopNode] = react["useState"](() => document.createElement("div"));
react["useEffect"](() => {
desktopNode.classList.add("webamp-desktop");
document.body.appendChild(desktopNode);
return () => {
document.body.removeChild(desktopNode);
};
}, [desktopNode]);
return react_dom_default.a.createPortal(children, desktopNode);
});
/* harmony default export */ var MilkdropWindow_Desktop = (Desktop);
// CONCATENATED MODULE: ./js/components/MilkdropWindow/index.tsx
function MilkdropWindow_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function MilkdropWindow_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { MilkdropWindow_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { MilkdropWindow_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const MILLISECONDS_BETWEEN_PRESET_TRANSITIONS = 15000;
function useKeyHandler() {
const trackTitle = useTypedSelector(getCurrentTrackDisplayName);
const selectNextPreset = useActionCreator(milkdrop_selectNextPreset);
const selectPreviousPreset = useActionCreator(milkdrop_selectPreviousPreset);
const toggleRandomize = useActionCreator(toggleRandomizePresets);
const togglePresetOverlay = useActionCreator(actionCreators_togglePresetOverlay);
const scheduleMilkdropMessage = useActionCreator(milkdrop_scheduleMilkdropMessage);
const toggleCycling = useActionCreator(togglePresetCycling); // Handle keyboard events
return Object(react["useCallback"])(e => {
switch (e.keyCode) {
case 32:
// spacebar
selectNextPreset();
break;
case 8:
// backspace
selectPreviousPreset(TransitionType.IMMEDIATE);
break;
case 72:
// H
selectNextPreset(TransitionType.IMMEDIATE);
break;
case 82:
// R
toggleRandomize();
break;
case 76:
// L
togglePresetOverlay();
e.stopPropagation();
break;
case 84:
// T
if (trackTitle != null) {
scheduleMilkdropMessage(trackTitle);
}
e.stopPropagation();
break;
case 145: // scroll lock
case 125:
// F14 (scroll lock for OS X)
toggleCycling();
break;
}
}, [scheduleMilkdropMessage, selectNextPreset, selectPreviousPreset, toggleCycling, togglePresetOverlay, toggleRandomize, trackTitle]);
}
function Milkdrop({
analyser
}) {
const desktop = useTypedSelector(getMilkdropDesktopEnabled);
const fullscreen = useTypedSelector(getMilkdropFullscreenEnabled);
const overlay = useTypedSelector(getPresetOverlayOpen);
const presetsAreCycling = useTypedSelector(getPresetsAreCycling);
const currentPresetIndex = useTypedSelector(getCurrentPresetIndex);
const mediaIsPlaying = useTypedSelector(getMediaIsPlaying);
const toggleFullscreen = useActionCreator(toggleMilkdropFullscreen);
const selectNextPreset = useActionCreator(milkdrop_selectNextPreset);
const handlePresetDrop = useActionCreator(milkdrop_handlePresetDrop);
const setFullscreen = useActionCreator(setMilkdropFullscreen);
const handleKeyDown = useKeyHandler(); // Cycle presets
Object(react["useEffect"])(() => {
if (!presetsAreCycling || !mediaIsPlaying) {
return;
}
const intervalId = setInterval(selectNextPreset, MILLISECONDS_BETWEEN_PRESET_TRANSITIONS);
return () => clearInterval(intervalId);
}, [presetsAreCycling, currentPresetIndex, mediaIsPlaying, selectNextPreset]);
const screenSize = useScreenSize();
const windowSize = useWindowSize();
if (desktop) {
return /*#__PURE__*/Object(jsx_runtime["jsx"])(MilkdropWindow_Desktop, {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(MilkdropWindow_MilkdropContextMenu, {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(MilkdropWindow_Visualizer, MilkdropWindow_objectSpread(MilkdropWindow_objectSpread({}, windowSize), {}, {
analyser: analyser
}))
})
});
}
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_GenWindow, {
title: "Milkdrop",
windowId: WINDOWS.MILKDROP,
onKeyDown: handleKeyDown,
children: genWindowSize => {
const size = fullscreen ? screenSize : genWindowSize;
return /*#__PURE__*/Object(jsx_runtime["jsx"])(MilkdropWindow_MilkdropContextMenu, {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(MilkdropWindow_Background, {
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])(components_DropTarget, {
windowId: WINDOWS.MILKDROP,
handleDrop: handlePresetDrop,
children: [overlay && /*#__PURE__*/Object(jsx_runtime["jsx"])(MilkdropWindow_PresetOverlay, MilkdropWindow_objectSpread({}, size)), /*#__PURE__*/Object(jsx_runtime["jsx"])(Fullscreen, {
enabled: fullscreen,
onChange: setFullscreen,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
onDoubleClick: toggleFullscreen,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(MilkdropWindow_Visualizer, MilkdropWindow_objectSpread(MilkdropWindow_objectSpread({}, size), {}, {
analyser: analyser
}))
})
})]
})
})
});
}
});
}
/* harmony default export */ var MilkdropWindow = (Milkdrop);
// CONCATENATED MODULE: ./js/components/PlaybackContextMenu.tsx
const PlaybackContextMenu = () => {
const previous = useActionCreator(media_previous);
const play = useActionCreator(media_play);
const pause = useActionCreator(media_pause);
const stop = useActionCreator(media_stop);
const next = useActionCreator(media_next);
const seekForward = useActionCreator(media_seekForward);
const seekBackward = useActionCreator(media_seekBackward);
const nextN = useActionCreator(media_nextN);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(react["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Previous",
hotkey: "Z",
onClick: previous
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Play",
hotkey: "X",
onClick: play
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Pause",
hotkey: "C",
onClick: pause
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Stop",
hotkey: "V",
onClick: stop
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Next",
hotkey: "B",
onClick: next
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu_Hr, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Back 5 seconds",
hotkey: "Left",
onClick: () => seekBackward(5)
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Fwd 5 seconds",
hotkey: "Right",
onClick: () => seekForward(5)
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "10 tracks back",
hotkey: "Num. 1",
onClick: () => nextN(-10)
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "10 tracks fwd",
hotkey: "Num. 3",
onClick: () => nextN(10)
})]
});
};
/* harmony default export */ var components_PlaybackContextMenu = (PlaybackContextMenu);
// CONCATENATED MODULE: ./js/components/SkinsContextMenu.tsx
const SkinContextMenu = () => {
const loadDefaultSkin = useActionCreator(actionCreators_loadDefaultSkin);
const openSkinFileDialog = useActionCreator(files_openSkinFileDialog);
const setSkin = useActionCreator(setSkinFromUrl);
const availableSkins = useTypedSelector(getAvaliableSkins);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(Parent, {
label: "Skins",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
onClick: openSkinFileDialog,
label: "Load Skin..."
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu_Hr, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
onClick: loadDefaultSkin,
label: "<Base Skin>"
}), availableSkins.map(skin => /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
onClick: () => setSkin(skin.url),
label: skin.name
}, skin.url))]
});
};
/* harmony default export */ var SkinsContextMenu = (SkinContextMenu);
// CONCATENATED MODULE: ./js/components/OptionsContextMenu.tsx
const OptionsContextMenu = () => {
const toggleTimeMode = useActionCreator(media_toggleTimeMode);
const toggleDoubleSizeMode = useActionCreator(windows_toggleDoubleSizeMode);
const toggleRepeat = useActionCreator(media_toggleRepeat);
const toggleShuffle = useActionCreator(media_toggleShuffle);
const doubled = useTypedSelector(getDoubled);
const timeMode = useTypedSelector(getTimeMode);
const repeat = useTypedSelector(getRepeat);
const shuffle = useTypedSelector(getShuffle);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(jsx_runtime["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(SkinsContextMenu, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu_Hr, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Time elapsed",
hotkey: "(Ctrl+T toggles)",
onClick: toggleTimeMode,
checked: timeMode === TIME_MODE.ELAPSED
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Time remaining",
hotkey: "(Ctrl+T toggles)",
onClick: toggleTimeMode,
checked: timeMode === TIME_MODE.REMAINING
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Double Size",
hotkey: "Ctrl+D",
onClick: toggleDoubleSizeMode,
checked: doubled
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu_Hr, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Repeat",
hotkey: "R",
onClick: toggleRepeat,
checked: repeat
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Shuffle",
hotkey: "S",
onClick: toggleShuffle,
checked: shuffle
})]
});
};
/* harmony default export */ var components_OptionsContextMenu = (OptionsContextMenu);
// CONCATENATED MODULE: ./js/components/MainWindow/MainContextMenu.tsx
const MainContextMenu = Object(react["memo"])(({
filePickers
}) => {
const networkConnected = useTypedSelector(getNetworkConnected);
const genWindows = useTypedSelector(getGenWindows);
const close = useActionCreator(actionCreators_close);
const openMediaFileDialog = useActionCreator(files_openMediaFileDialog);
const loadMediaFiles = useActionCreator(files_loadMediaFiles);
const toggleWindow = useActionCreator(windows_toggleWindow);
const menuOpened = useActionCreator(() => ({
type: "MAIN_CONTEXT_MENU_OPENED"
}));
Object(react["useEffect"])(() => {
menuOpened();
}, [menuOpened]);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(react["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(LinkNode, {
href: "https://webamp.org/about",
target: "_blank",
label: "Webamp..."
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu_Hr, {}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(Parent, {
label: "Play",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
onClick: openMediaFileDialog,
label: "File...",
hotkey: "L"
}), filePickers != null && filePickers.map((picker, i) => (networkConnected || !picker.requiresNetwork) && /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
onClick: async () => {
let files;
try {
files = await picker.filePicker();
} catch (e) {
console.error("Error loading from file picker", e);
}
loadMediaFiles(files || [], LOAD_STYLE.PLAY);
},
label: picker.contextMenuName
}, i))]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu_Hr, {}), Object.keys(genWindows).map(i => /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: genWindows[i].title,
checked: genWindows[i].open,
onClick: () => toggleWindow(i),
hotkey: genWindows[i].hotkey
}, i)), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu_Hr, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(SkinsContextMenu, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu_Hr, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Parent, {
label: "Options",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(components_OptionsContextMenu, {})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Parent, {
label: "Playback",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(components_PlaybackContextMenu, {})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu_Hr, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
onClick: close,
label: "Exit"
})]
});
});
/* harmony default export */ var MainWindow_MainContextMenu = (MainContextMenu);
// CONCATENATED MODULE: ./js/components/WindowManager.tsx
function WindowManager_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function WindowManager_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { WindowManager_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { WindowManager_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const abuts = (a, b) => {
// TODO: This is kinda a hack. They should really be touching, not just within snapping distance.
// Also, overlapping should not count.
const wouldMoveTo = snap(a, b);
return wouldMoveTo.x !== undefined || wouldMoveTo.y !== undefined;
};
function useHandleMouseDown(propsWindows) {
const windowsInfo = useTypedSelector(getWindowsInfo);
const getWindowHidden = useTypedSelector(selectors_getWindowHidden);
const browserWindowSize = useTypedSelector(getBrowserWindowSize);
const updateWindowPositions = useActionCreator(windows_updateWindowPositions);
const [draggingState, setDraggingState] = Object(react["useState"])(null); // When the mouse is down, attach a listener to track mouse move events.
Object(react["useEffect"])(() => {
if (draggingState == null) {
return;
}
const {
boundingBox,
moving,
stationary,
mouseStart
} = draggingState;
const handleMouseMove = ee => {
const proposedDiff = {
x: getX(ee) - mouseStart.x,
y: getY(ee) - mouseStart.y
};
const proposedWindows = moving.map(node => WindowManager_objectSpread(WindowManager_objectSpread({}, node), applyDiff(node, proposedDiff)));
const proposedBox = WindowManager_objectSpread(WindowManager_objectSpread({}, boundingBox), applyDiff(boundingBox, proposedDiff));
const snapDiff = snapDiffManyToMany(proposedWindows, stationary);
const withinDiff = snapWithinDiff(proposedBox, browserWindowSize);
const finalDiff = applyMultipleDiffs(proposedDiff, snapDiff, withinDiff);
const windowPositionDiff = {};
moving.forEach(w => {
windowPositionDiff[w.key] = applyDiff(w, finalDiff);
});
updateWindowPositions(windowPositionDiff, false);
};
function handleMouseUp() {
setDraggingState(null);
}
window.addEventListener("mouseup", handleMouseUp);
window.addEventListener("touchend", handleMouseUp);
window.addEventListener("mousemove", handleMouseMove, {
passive: false
});
window.addEventListener("touchmove", handleMouseMove, {
passive: false
});
return () => {
window.removeEventListener("mousemove", handleMouseMove);
window.removeEventListener("touchmove", handleMouseMove);
window.removeEventListener("mouseup", handleMouseUp);
window.removeEventListener("touchend", handleMouseUp);
};
}, [browserWindowSize, draggingState, updateWindowPositions]); // Mouse down handler
return Object(react["useCallback"])((key, e) => {
if (!e.target.classList.contains("draggable")) {
return;
}
const x = getX(e);
const y = getY(e);
if (getWindowHidden(key)) {
// The user may be clicking on full screen Milkdrop.
return;
}
const windows = windowsInfo.filter(w => propsWindows[w.key] != null && !getWindowHidden(w.key));
const targetNode = windows.find(node => node.key === key);
if (targetNode == null) {
throw new Error(`Tried to move a node that does not exist: ${key}`);
}
let movingSet = new Set([targetNode]); // Only the main window brings other windows along.
if (key === "main") {
const findAllConnected = traceConnection(abuts);
movingSet = findAllConnected(windows, targetNode);
}
const stationary = windows.filter(w => !movingSet.has(w));
const moving = Array.from(movingSet);
const mouseStart = {
x,
y
};
const boundingBox = snapUtils_boundingBox(moving);
setDraggingState({
boundingBox,
moving,
stationary,
mouseStart
});
}, [getWindowHidden, propsWindows, windowsInfo]);
}
function WindowManager({
windows: propsWindows
}) {
const windowsInfo = useTypedSelector(getWindowsInfo);
const setFocusedWindow = useActionCreator(windows_setFocusedWindow);
const handleMouseDown = useHandleMouseDown(propsWindows);
const windows = windowsInfo.filter(w => propsWindows[w.key]);
const onBlur = Object(react["useCallback"])( // I give up on trying to type things with `relatedTarget`.
e => {
const {
currentTarget,
relatedTarget
} = e;
if (currentTarget === relatedTarget || currentTarget.contains(relatedTarget)) {
return;
}
setFocusedWindow(null);
}, [setFocusedWindow]);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(jsx_runtime["Fragment"], {
children: windows.map(w => /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
onBlur: onBlur,
onMouseDown: e => {
handleMouseDown(w.key, e);
},
onTouchStart: e => {
handleMouseDown(w.key, e);
},
style: {
position: "absolute",
top: 0,
left: 0,
transform: `translate(${w.x}px, ${w.y}px)`,
touchAction: "none"
},
children: propsWindows[w.key]
}, w.key))
});
}
// EXTERNAL MODULE: /Users/jordaneldredge/projects/webamp/node_modules/lodash/deburr.js
var deburr = __webpack_require__(40);
var deburr_default = /*#__PURE__*/__webpack_require__.n(deburr);
// CONCATENATED MODULE: ./js/components/Character.tsx
function Character_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function Character_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Character_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Character_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
const characterClassName = char => `character-${deburr_default()(char.toString()).toLowerCase().charCodeAt(0)}`;
const Character = react["memo"]((_ref) => {
let {
children: char,
className
} = _ref,
passThrough = objectWithoutProperties_default()(_ref, ["children", "className"]);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("span", Character_objectSpread(Character_objectSpread({}, passThrough), {}, {
className: `${className || ""} character ${characterClassName(char)}`,
children: char
}));
});
/* harmony default export */ var components_Character = (Character);
// EXTERNAL MODULE: ./css/mini-time.css
var mini_time = __webpack_require__(88);
// CONCATENATED MODULE: ./js/components/MiniTime.tsx
// Sigh. When the display is blinking (say when it's paused) we need to
// alternate between the actual character and the space character. Not
// Possible to do that in pure CSS with the background being dynamically generated.
// All "space" characters is also how Winamp renders no content.
const MiniTime_Background = () => /*#__PURE__*/Object(jsx_runtime["jsx"])(react["Fragment"], {
children: [1, 7, 12, 20, 25].map((left, i) => /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Character, {
style: {
left
},
className: "background-character",
children: " "
}, i))
});
const MiniTime = () => {
const status = useTypedSelector(getMediaStatus);
const duration = useTypedSelector(getDuration);
const timeElapsed = useTypedSelector(getTimeElapsed);
const timeMode = useTypedSelector(getTimeMode);
const toggle = useActionCreator(media_toggleTimeMode);
let seconds = null; // TODO: Clean this up: If stopped, just render the background, rather than
// rendering spaces twice.
if (status !== MEDIA_STATUS.STOPPED && duration != null) {
seconds = timeMode === TIME_MODE.ELAPSED ? timeElapsed : duration - timeElapsed;
}
const timeObj = getTimeObj(seconds);
const showMinus = timeMode === TIME_MODE.REMAINING && status !== MEDIA_STATUS.STOPPED;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
onClick: toggle,
className: classnames_default()("mini-time", "countdown", {
blinking: status === MEDIA_STATUS.PAUSED
}),
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(MiniTime_Background, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Character, {
style: {
left: 1
},
children: showMinus ? "-" : " "
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Character, {
style: {
left: 7
},
children: timeObj.minutesFirstDigit
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Character, {
style: {
left: 12
},
children: timeObj.minutesSecondDigit
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Character, {
style: {
left: 20
},
children: timeObj.secondsFirstDigit
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Character, {
style: {
left: 25
},
children: timeObj.secondsSecondDigit
})]
});
};
/* harmony default export */ var components_MiniTime = (MiniTime);
// CONCATENATED MODULE: ./js/components/ClickedDiv.tsx
function ClickedDiv_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function ClickedDiv_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ClickedDiv_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ClickedDiv_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
// Winamp has a strange behavior for the buttons at the top of the main window.
// It shows through to the main background sprite until the first time that it's
// clicked, and then it shows the dedicated undepressed sprite thereafter.
// This component is an abstraction that tracks if a div has ever been clicked.
// Look in `skinSelectors` for CSS selectors that look like `#some-id.clicked`
// for examples of this functionality in use.
function ClickedDiv(props) {
const [clicked, setClicked] = Object(react["useState"])(false);
function handleMouseDown(e) {
setClicked(true);
if (props.onMouseDown) {
props.onMouseDown(e);
}
}
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", ClickedDiv_objectSpread(ClickedDiv_objectSpread({}, props), {}, {
className: classnames_default()(props.className, {
clicked
}),
onMouseDown: handleMouseDown
}));
}
/* harmony default export */ var components_ClickedDiv = (ClickedDiv);
// CONCATENATED MODULE: ./js/components/ContextMenuTarget.tsx
function ContextMenuTarget_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function ContextMenuTarget_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ContextMenuTarget_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ContextMenuTarget_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function getNodeOffset(node) {
if (node == null) {
return {
top: 0,
left: 0
};
}
const rect = node.getBoundingClientRect();
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
return {
top: rect.top + scrollTop,
left: rect.left + scrollLeft
};
} // Trigger a context menu relative to the child element when the user
// left-clicks on the child.
//
// For a component that triggers relative to the user's cursor on right-click
// see `<ContextMenuWrapper />`.
function ContextMenuTarget(props) {
const handleNode = Object(react["useRef"])(null);
const [selected, setSelected] = Object(react["useState"])(false);
Object(react["useEffect"])(() => {
if (!selected) {
return;
}
function handleGlobalClick(e) {
if (selected && // Typescript does not believe that these click events are always fired on DOM nodes.
e.target instanceof Element && selected && // Not sure how, but it's possible for this to get called when handleNode is null/undefined.
// https://sentry.io/share/issue/2066cd79f21e4f279791319f4d2ea35d/
handleNode.current && !handleNode.current.contains(e.target)) {
setSelected(false);
}
}
document.addEventListener("click", handleGlobalClick);
return () => {
document.removeEventListener("click", handleGlobalClick);
};
}, [selected]);
const offset = Object(react["useMemo"])(() => {
return selected ? getNodeOffset(handleNode.current) : // Kinda awkward. This is a nonsense return value since we only use
//this value when we are selected.
{
top: 0,
left: 0
};
}, [selected]);
const {
renderMenu,
children,
top,
bottom
} = props,
passThroughProps = objectWithoutProperties_default()(props, ["renderMenu", "children", "top", "bottom"]);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", ContextMenuTarget_objectSpread(ContextMenuTarget_objectSpread({}, passThroughProps), {}, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "handle",
style: {
width: "100%",
height: "100%"
},
ref: handleNode,
onClick: () => setSelected(!selected),
children: children
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu, {
selected: selected,
offsetTop: offset.top,
offsetLeft: offset.left,
top: top,
bottom: bottom,
children: renderMenu()
})]
}));
}
/* harmony default export */ var components_ContextMenuTarget = (ContextMenuTarget);
// CONCATENATED MODULE: ./js/components/useOscilloscopeVisualizer.ts
const PIXEL_DENSITY = 2; // Return the average value in a slice of dataArray
function sliceAverage(dataArray, sliceWidth, sliceNumber) {
const start = sliceWidth * sliceNumber;
const end = start + sliceWidth;
let sum = 0;
for (let i = start; i < end; i++) {
sum += dataArray[i];
}
return sum / sliceWidth;
}
function usePaintOscilloscopeFrame({
analyser,
height,
width,
renderWidth
}) {
const colors = useTypedSelector(getSkinColors);
const bufferLength = analyser.fftSize;
const dataArray = Object(react["useMemo"])(() => {
return new Uint8Array(bufferLength);
}, [bufferLength]);
return Object(react["useCallback"])(canvasCtx => {
analyser.getByteTimeDomainData(dataArray);
canvasCtx.lineWidth = PIXEL_DENSITY; // Just use one of the viscolors for now
canvasCtx.strokeStyle = colors[18]; // Since dataArray has more values than we have pixels to display, we
// have to average several dataArray values per pixel. We call these
// groups slices.
//
// We use the 2x scale here since we only want to plot values for
// "real" pixels.
const sliceWidth = Math.floor(bufferLength / width) * PIXEL_DENSITY;
const h = height;
canvasCtx.beginPath(); // Iterate over the width of the canvas in "real" pixels.
for (let j = 0; j <= renderWidth; j++) {
const amplitude = sliceAverage(dataArray, sliceWidth, j);
const percentAmplitude = amplitude / 255; // dataArray gives us bytes
const y = (1 - percentAmplitude) * h; // flip y
const x = j * PIXEL_DENSITY; // Canvas coordinates are in the middle of the pixel by default.
// When we want to draw pixel perfect lines, we will need to
// account for that here
if (x === 0) {
canvasCtx.moveTo(x, y);
} else {
canvasCtx.lineTo(x, y);
}
}
canvasCtx.stroke();
}, [analyser, bufferLength, colors, dataArray, height, renderWidth, width]);
}
// CONCATENATED MODULE: ./js/components/useBarVisualizer.ts
const useBarVisualizer_PIXEL_DENSITY = 2;
const BAR_WIDTH = 3 * useBarVisualizer_PIXEL_DENSITY;
const GRADIENT_COLOR_COUNT = 16;
const PEAK_COLOR_INDEX = 23;
const BAR_PEAK_DROP_RATE = 0.01;
const NUM_BARS = 20;
function octaveBucketsForBufferLength(bufferLength) {
const octaveBuckets = new Array(NUM_BARS).fill(0);
const minHz = 200;
const maxHz = 22050;
const octaveStep = Math.pow(maxHz / minHz, 1 / NUM_BARS);
octaveBuckets[0] = 0;
octaveBuckets[1] = minHz;
for (let i = 2; i < NUM_BARS - 1; i++) {
octaveBuckets[i] = octaveBuckets[i - 1] * octaveStep;
}
octaveBuckets[NUM_BARS - 1] = maxHz;
for (let i = 0; i < NUM_BARS; i++) {
const octaveIdx = Math.floor(octaveBuckets[i] / maxHz * bufferLength);
octaveBuckets[i] = octaveIdx;
}
return octaveBuckets;
}
function preRenderBar(height, colors, renderHeight) {
/**
* The order of the colours is commented in the file: the fist two colours
* define the background and dots (check it to see what are the dots), the
* next 16 colours are the analyzer's colours from top to bottom, the next
* 5 colours are the oscilloscope's ones, from center to top/bottom, the
* last colour is for the analyzer's peak markers.
*/
// Off-screen canvas for pre-rendering a single bar gradient
const barCanvas = document.createElement("canvas");
barCanvas.width = BAR_WIDTH;
barCanvas.height = height;
const offset = 2; // The first two colors are for the background;
const gradientColors = colors.slice(offset, offset + GRADIENT_COLOR_COUNT);
const barCanvasCtx = barCanvas.getContext("2d");
if (barCanvasCtx == null) {
throw new Error("Could not construct canvas context");
}
const multiplier = GRADIENT_COLOR_COUNT / renderHeight; // In shade mode, the five colors are, from top to bottom:
// 214, 102, 0 -- 3
// 222, 165, 24 -- 6
// 148, 222, 33 -- 9
// 57, 181, 16 -- 12
// 24, 132, 8 -- 15
// TODO: This could probably be improved by iterating backwards
for (let i = 0; i < renderHeight; i++) {
const colorIndex = GRADIENT_COLOR_COUNT - 1 - Math.floor(i * multiplier);
barCanvasCtx.fillStyle = gradientColors[colorIndex];
const y = height - i * useBarVisualizer_PIXEL_DENSITY;
barCanvasCtx.fillRect(0, y, BAR_WIDTH, useBarVisualizer_PIXEL_DENSITY);
}
return barCanvas;
}
function usePaintBar({
renderHeight,
height
}) {
const colors = useTypedSelector(getSkinColors);
const getWindowShade = useTypedSelector(selectors_getWindowShade);
const windowShade = getWindowShade("main");
const barCanvas = Object(react["useMemo"])(() => {
return preRenderBar(height, colors, renderHeight);
}, [colors, height, renderHeight]);
return Object(react["useCallback"])((ctx, x, barHeight, peakHeight) => {
barHeight = Math.ceil(barHeight) * useBarVisualizer_PIXEL_DENSITY;
peakHeight = Math.ceil(peakHeight) * useBarVisualizer_PIXEL_DENSITY;
if (barHeight > 0 || peakHeight > 0) {
const y = height - barHeight; // Draw the gradient
const b = BAR_WIDTH;
if (height > 0) {
ctx.drawImage(barCanvas, 0, y, b, height, x, y, b, height);
} // Draw the gray peak line
if (!windowShade) {
const peakY = height - peakHeight;
ctx.fillStyle = colors[PEAK_COLOR_INDEX];
ctx.fillRect(x, peakY, b, useBarVisualizer_PIXEL_DENSITY);
}
}
}, [barCanvas, colors, height, windowShade]);
}
function usePaintBarFrame({
renderHeight,
height,
analyser
}) {
const [barPeaks] = Object(react["useState"])(() => new Array(NUM_BARS).fill(0));
const [barPeakFrames] = Object(react["useState"])(() => new Array(NUM_BARS).fill(0));
const bufferLength = analyser.frequencyBinCount;
const octaveBuckets = Object(react["useMemo"])(() => {
return octaveBucketsForBufferLength(bufferLength);
}, [bufferLength]);
const dataArray = Object(react["useMemo"])(() => {
return new Uint8Array(bufferLength);
}, [bufferLength]);
const paintBar = usePaintBar({
height,
renderHeight
});
return Object(react["useCallback"])(canvasCtx => {
analyser.getByteFrequencyData(dataArray);
const heightMultiplier = renderHeight / 256;
const xOffset = BAR_WIDTH + useBarVisualizer_PIXEL_DENSITY; // Bar width, plus a pixel of spacing to the right.
for (let j = 0; j < NUM_BARS - 1; j++) {
const start = octaveBuckets[j];
const end = octaveBuckets[j + 1];
let amplitude = 0;
for (let k = start; k < end; k++) {
amplitude += dataArray[k];
}
amplitude /= end - start; // The drop rate should probably be normalized to the rendering FPS, for now assume 60 FPS
let barPeak = barPeaks[j] - BAR_PEAK_DROP_RATE * Math.pow(barPeakFrames[j], 2);
if (barPeak < amplitude) {
barPeak = amplitude;
barPeakFrames[j] = 0;
} else {
barPeakFrames[j] += 1;
}
barPeaks[j] = barPeak;
paintBar(canvasCtx, j * xOffset, amplitude * heightMultiplier, barPeak * heightMultiplier);
}
}, [analyser, barPeakFrames, barPeaks, dataArray, octaveBuckets, paintBar, renderHeight]);
}
// CONCATENATED MODULE: ./js/components/Visualizer.tsx
const Visualizer_PIXEL_DENSITY = 2;
// Pre-render the background grid
function preRenderBg(width, height, bgColor, fgColor, windowShade) {
// Off-screen canvas for pre-rendering the background
const bgCanvas = document.createElement("canvas");
bgCanvas.width = width;
bgCanvas.height = height;
const distance = 2 * Visualizer_PIXEL_DENSITY;
const bgCanvasCtx = bgCanvas.getContext("2d");
if (bgCanvasCtx == null) {
throw new Error("Could not construct canvas context");
}
bgCanvasCtx.fillStyle = bgColor;
bgCanvasCtx.fillRect(0, 0, width, height);
if (!windowShade) {
bgCanvasCtx.fillStyle = fgColor;
for (let x = 0; x < width; x += distance) {
for (let y = Visualizer_PIXEL_DENSITY; y < height; y += distance) {
bgCanvasCtx.fillRect(x, y, Visualizer_PIXEL_DENSITY, Visualizer_PIXEL_DENSITY);
}
}
}
return bgCanvas;
}
function Visualizer_Visualizer({
analyser
}) {
Object(react["useLayoutEffect"])(() => {
analyser.fftSize = 2048;
}, [analyser.fftSize]);
const colors = useTypedSelector(getSkinColors);
const style = useTypedSelector(selectors_getVisualizerStyle);
const status = useTypedSelector(getMediaStatus);
const getWindowShade = useTypedSelector(selectors_getWindowShade);
const dummyVizData = useTypedSelector(getDummyVizData);
const toggleVisualizerStyle = useActionCreator(actionCreators_toggleVisualizerStyle);
const windowShade = getWindowShade("main");
const renderWidth = windowShade ? 38 : 76;
const renderHeight = windowShade ? 5 : 16;
const width = renderWidth * Visualizer_PIXEL_DENSITY;
const height = renderHeight * Visualizer_PIXEL_DENSITY;
const bgCanvas = Object(react["useMemo"])(() => {
return preRenderBg(width, height, colors[0], colors[1], Boolean(windowShade));
}, [colors, height, width, windowShade]);
const paintOscilloscopeFrame = usePaintOscilloscopeFrame({
analyser,
height,
width,
renderWidth
});
const paintBarFrame = usePaintBarFrame({
analyser,
height,
renderHeight
});
const paintBar = usePaintBar({
height,
renderHeight
});
const paintFrame = Object(react["useCallback"])(canvasCtx => {
if (status !== MEDIA_STATUS.PLAYING) {
return;
}
if (dummyVizData) {
canvasCtx.drawImage(bgCanvas, 0, 0);
Object.entries(dummyVizData).forEach(([i, value]) => {
paintBar(canvasCtx, Number(i), value, -1);
});
return;
}
switch (style) {
case VISUALIZERS.OSCILLOSCOPE:
canvasCtx.drawImage(bgCanvas, 0, 0);
paintOscilloscopeFrame(canvasCtx);
break;
case VISUALIZERS.BAR:
canvasCtx.drawImage(bgCanvas, 0, 0);
paintBarFrame(canvasCtx);
break;
default:
canvasCtx.clearRect(0, 0, width, height);
}
}, [bgCanvas, dummyVizData, height, paintBar, paintBarFrame, paintOscilloscopeFrame, status, style, width]);
const [canvas, setCanvas] = Object(react["useState"])(null);
Object(react["useLayoutEffect"])(() => {
if (canvas == null) {
return;
}
const canvasCtx = canvas.getContext("2d");
if (canvasCtx == null) {
return;
}
canvasCtx.imageSmoothingEnabled = false;
let animationRequest = null; // Kick off the animation loop
const loop = () => {
paintFrame(canvasCtx);
animationRequest = window.requestAnimationFrame(loop);
};
loop();
return () => {
if (animationRequest != null) {
window.cancelAnimationFrame(animationRequest);
}
};
}, [canvas, paintFrame]);
if (status === MEDIA_STATUS.STOPPED) {
return null;
}
return /*#__PURE__*/Object(jsx_runtime["jsx"])("canvas", {
id: "visualizer",
ref: setCanvas,
style: {
width: renderWidth,
height: renderHeight
},
width: width,
height: height,
onClick: toggleVisualizerStyle
});
}
/* harmony default export */ var components_Visualizer = (Visualizer_Visualizer);
// CONCATENATED MODULE: ./js/components/MainWindow/ActionButtons.tsx
const ActionButtons = Object(react["memo"])(() => {
const previous = useActionCreator(media_previous);
const play = useActionCreator(media_play);
const pause = useActionCreator(media_pause);
const next = useActionCreator(media_next);
const stop = useActionCreator(media_stop);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "actions",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "previous",
onClick: previous,
title: "Previous Track"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "play",
onClick: play,
title: "Play"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "pause",
onClick: pause,
title: "Pause"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "stop",
onClick: stop,
title: "Stop"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "next",
onClick: next,
title: "Next Track"
})]
});
});
/* harmony default export */ var MainWindow_ActionButtons = (ActionButtons);
// CONCATENATED MODULE: ./js/components/Balance.tsx
function Balance_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function Balance_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Balance_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Balance_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function Balance({
style,
className,
id
}) {
const balance = useTypedSelector(getBalance);
const setBalance = useActionCreator(media_setBalance);
const setFocus = useActionCreator(actionCreators_setFocus);
const unsetFocus = useActionCreator(actionCreators_unsetFocus);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("input", {
id: id,
className: className,
type: "range",
min: "-100",
max: "100",
step: "1",
value: balance,
style: Balance_objectSpread(Balance_objectSpread({}, style), {}, {
touchAction: "none"
}),
onChange: e => setBalance(Number(e.target.value)),
onMouseDown: () => setFocus("balance"),
onMouseUp: unsetFocus,
title: "Balance"
});
}
// CONCATENATED MODULE: ./js/components/MainWindow/MainBalance.tsx
const offsetFromBalance = balance => {
const percent = Math.abs(balance) / 100;
const sprite = Math.floor(percent * 27);
const offset = sprite * 15;
return offset;
};
const MainBalance = Object(react["memo"])(() => {
const balance = useTypedSelector(getBalance);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(Balance, {
id: "balance",
style: {
backgroundPosition: `0 -${offsetFromBalance(balance)}px`
}
});
});
/* harmony default export */ var MainWindow_MainBalance = (MainBalance);
// CONCATENATED MODULE: ./js/components/MainWindow/Close.tsx
const Close = Object(react["memo"])(() => {
const close = useActionCreator(actionCreators_close);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_ClickedDiv, {
id: "close",
onClick: close,
title: "Close"
});
});
/* harmony default export */ var MainWindow_Close = (Close);
// CONCATENATED MODULE: ./js/components/MainWindow/ClutterBar.tsx
function setFocusDouble() {
return actionCreators_setFocus("double");
}
function mouseUp() {
return dispatch => {
dispatch(windows_toggleDoubleSizeMode());
dispatch(actionCreators_unsetFocus());
};
}
const ClutterBar = Object(react["memo"])(() => {
const handleMouseDown = useActionCreator(setFocusDouble);
const handleMouseUp = useActionCreator(mouseUp);
const doubled = useTypedSelector(getDoubled);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
id: "clutter-bar",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(components_ContextMenuTarget, {
bottom: true,
renderMenu: () => /*#__PURE__*/Object(jsx_runtime["jsx"])(components_OptionsContextMenu, {}),
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "button-o"
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "button-a"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "button-i"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
title: "Toggle Doublesize Mode",
id: "button-d",
className: classnames_default()({
selected: doubled
}),
onMouseUp: handleMouseUp,
onMouseDown: handleMouseDown
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "button-v"
})]
});
});
/* harmony default export */ var MainWindow_ClutterBar = (ClutterBar);
// CONCATENATED MODULE: ./js/components/MainWindow/Eject.tsx
const Eject = Object(react["memo"])(() => {
const openMediaFileDialog = useActionCreator(files_openMediaFileDialog);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "eject",
onClick: openMediaFileDialog,
title: "Open File(s)"
});
});
/* harmony default export */ var MainWindow_Eject = (Eject);
// CONCATENATED MODULE: ./js/components/MainWindow/EqToggleButton.tsx
function toggleEqualizer() {
return windows_toggleWindow("equalizer");
}
const EqToggleButton = Object(react["memo"])(() => {
const handleClick = useActionCreator(toggleEqualizer);
const windowOpen = useTypedSelector(selectors_getWindowOpen)("equalizer");
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "equalizer-button",
className: classnames_default()({
selected: windowOpen
}),
onClick: handleClick,
title: "Toggle Graphical Equalizer"
});
});
/* harmony default export */ var MainWindow_EqToggleButton = (EqToggleButton);
// CONCATENATED MODULE: ./js/components/MainWindow/PlaylistToggleButton.tsx
function togglePlaylist() {
return windows_toggleWindow("playlist");
}
const PlaylistToggleButton = Object(react["memo"])(() => {
const selected = useTypedSelector(selectors_getWindowOpen)("playlist");
const handleClick = useActionCreator(togglePlaylist);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "playlist-button",
className: classnames_default()({
selected
}),
onClick: handleClick,
title: "Toggle Playlist Editor"
});
});
/* harmony default export */ var MainWindow_PlaylistToggleButton = (PlaylistToggleButton);
// CONCATENATED MODULE: ./js/components/CharacterString.tsx
const CharacterString = Object(react["memo"])(props => {
const text = `${props.children}` || "";
const chars = text.split("");
return /*#__PURE__*/Object(jsx_runtime["jsx"])(react["Fragment"], {
children: chars.map((character, index) => /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Character, {
children: character
}, index + character))
});
});
/* harmony default export */ var components_CharacterString = (CharacterString);
// CONCATENATED MODULE: ./js/components/MainWindow/Kbps.tsx
const Kbps = Object(react["memo"])(() => {
const kbps = useTypedSelector(getKbps);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "kbps",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(components_CharacterString, {
children: kbps || ""
})
});
});
/* harmony default export */ var MainWindow_Kbps = (Kbps);
// CONCATENATED MODULE: ./js/components/MainWindow/Khz.tsx
const Khz = Object(react["memo"])(() => {
const khz = useTypedSelector(getKhz);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "khz",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(components_CharacterString, {
children: khz || ""
})
});
});
/* harmony default export */ var MainWindow_Khz = (Khz);
// CONCATENATED MODULE: ./js/components/MainWindow/Marquee.tsx
// Single line text display that can animate and hold multiple registers
// Knows how to display various modes like tracking, volume, balance, etc.
const SEPARATOR = " *** ";
const CHAR_WIDTH = 5;
const MARQUEE_MAX_LENGTH = 31; // Always positive modulus
const mod = (n, m) => (n % m + m) % m;
const isLong = text => text.length >= MARQUEE_MAX_LENGTH; // Given text and step, how many pixels should it be shifted?
const stepOffset = (text, step, pixels) => {
if (!isLong(text)) {
return 0;
}
const stepOffsetWidth = step * CHAR_WIDTH; // Steps move one char at a time
const offset = stepOffsetWidth + pixels;
const stringLength = (text.length + SEPARATOR.length) * CHAR_WIDTH;
return mod(offset, stringLength);
}; // Format an int as pixels
const pixelUnits = pixels => `${pixels}px`; // If text is wider than the marquee, it needs to loop
const loopText = text => isLong(text) ? `${text}${SEPARATOR}${text}` : text.padEnd(MARQUEE_MAX_LENGTH, " ");
// Call `step` every second, except when dragging. Resume stepping 1 second after dragging ceases.
function useStepper({
step,
dragging
}) {
const [stepping, setStepping] = react["useState"](true);
react["useEffect"](() => {
if (stepping === false) {
return;
}
const stepHandle = setInterval(step, 220);
return () => clearInterval(stepHandle);
}, [step, stepping]);
react["useEffect"](() => {
if (dragging) {
setStepping(false);
return;
}
const steppingTimeout = window.setTimeout(() => {
setStepping(true);
}, 1000);
return () => {
window.clearTimeout(steppingTimeout);
};
}, [dragging]);
} // When user calls `handleMouseDown`, and moves the mouse, `dragOffset` will update as they drag.
function useDragX() {
const [mouseDownX, setMouseDownX] = react["useState"](null);
const [dragOffset, setDragOffset] = react["useState"](0);
react["useEffect"](() => {
if (mouseDownX == null) {
return;
}
const xStart = mouseDownX;
const handleMouseMove = ee => {
const diff = getX(ee) - xStart;
setDragOffset(-diff);
}; // TODO: Use `once` or something instead of this flag nonsense
let cleanedUp = false;
const handleMouseUp = () => {
if (cleanedUp) {
return;
}
document.removeEventListener("mousemove", handleMouseMove);
document.removeEventListener("touchmove", handleMouseMove);
document.removeEventListener("mouseup", handleMouseUp);
document.removeEventListener("touchend", handleMouseUp);
setMouseDownX(null);
cleanedUp = true;
};
document.addEventListener("mousemove", handleMouseMove);
document.addEventListener("touchmove", handleMouseMove);
document.addEventListener("touseup", handleMouseUp);
document.addEventListener("touchend", handleMouseUp);
return handleMouseUp;
}, [mouseDownX]);
const handleMouseDown = react["useCallback"](e => {
setMouseDownX(getX(e));
}, []);
return {
handleMouseDown,
dragOffset,
dragging: mouseDownX != null
};
}
const Marquee = react["memo"](() => {
const text = useTypedSelector(getMarqueeText);
const doubled = useTypedSelector(getDoubled);
const marqueeStep = useTypedSelector(getMarqueeStep);
const stepMarquee = useActionCreator(actionCreators_stepMarquee);
const {
handleMouseDown,
dragOffset,
dragging
} = useDragX();
const offset = stepOffset(text, marqueeStep, dragOffset);
const offsetPixels = pixelUnits(-offset);
useStepper({
step: stepMarquee,
dragging
});
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "marquee",
className: "text",
onMouseDown: handleMouseDown,
onTouchStart: handleMouseDown,
title: "Song Title",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
style: {
whiteSpace: "nowrap",
willChange: "transform",
transform: `translateX(${offsetPixels})`
} // Force the DOM node to be recreated when the doubled size changes.
// This works around a Chrome browser bug where the `will-change: transform;`
// on this node seems to cause a change to the `image-rendering:
// pixelated;` which we inherit from `#webamp` not to be respected.
,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(components_CharacterString, {
children: loopText(text)
})
}, doubled ? "doubled" : "not-doubled")
});
});
/* harmony default export */ var MainWindow_Marquee = (Marquee);
// CONCATENATED MODULE: ./js/components/MainWindow/MonoStereo.tsx
const MonoStereo = Object(react["memo"])(() => {
const channels = useTypedSelector(getChannels);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "mono-stereo",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "stereo",
className: classnames_default()({
selected: channels === 2
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "mono",
className: classnames_default()({
selected: channels === 1
})
})]
});
});
/* harmony default export */ var MainWindow_MonoStereo = (MonoStereo);
// CONCATENATED MODULE: ./js/components/MainWindow/Position.tsx
function usePosition() {
const duration = useTypedSelector(getDuration);
const timeElapsed = useTypedSelector(getTimeElapsed);
const position = duration ? Math.floor(timeElapsed) / duration * 100 : 0;
const scrubPosition = useTypedSelector(getUserInputScrubPosition);
const userInputFocus = useTypedSelector(getUserInputFocus);
const displayedPosition = userInputFocus === "position" ? scrubPosition : position;
return [position, displayedPosition];
}
const Position = Object(react["memo"])(() => {
const [position, displayedPosition] = usePosition();
const dispatch = useTypedDispatch();
const seekToPercentComplete = Object(react["useCallback"])(e => {
dispatch({
type: SEEK_TO_PERCENT_COMPLETE,
percent: Number(e.target.value)
});
dispatch({
type: UNSET_FOCUS
});
}, [dispatch]);
const setPosition = Object(react["useCallback"])(e => {
dispatch({
type: SET_FOCUS,
input: "position"
});
dispatch({
type: SET_SCRUB_POSITION,
position: Number(e.target.value)
});
}, [dispatch]); // In shade mode, the position slider shows up differently depending on if
// it's near the start, middle or end of its progress
let className = "";
if (position <= 33) {
className = "left";
} else if (position >= 66) {
className = "right";
}
return /*#__PURE__*/Object(jsx_runtime["jsx"])("input", {
id: "position",
className: className,
type: "range",
min: "0",
max: "100",
step: "1",
style: {
touchAction: "none"
},
value: displayedPosition,
onInput: setPosition,
onChange: () => {}
/* React complains without this, can probably rename onInput to onChange */
,
onMouseUp: seekToPercentComplete,
onMouseDown: setPosition,
title: "Seeking Bar"
});
});
/* harmony default export */ var MainWindow_Position = (Position);
// CONCATENATED MODULE: ./js/components/MainWindow/Repeat.tsx
const Repeat = Object(react["memo"])(() => {
const repeat = useTypedSelector(getRepeat);
const handleClick = useActionCreator(media_toggleRepeat);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenuWraper, {
renderContents: () => /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
checked: repeat,
label: "Repeat",
onClick: handleClick,
hotkey: "(R)"
}),
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "repeat",
className: classnames_default()({
selected: repeat
}),
onClick: handleClick,
title: "Toggle Repeat"
})
});
});
/* harmony default export */ var MainWindow_Repeat = (Repeat);
// CONCATENATED MODULE: ./js/components/MainWindow/Shade.tsx
const Shade = Object(react["memo"])(() => {
const handleClick = useActionCreator(windows_toggleMainWindowShadeMode);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_ClickedDiv, {
id: "shade",
onMouseDown: handleClick,
onDoubleClick: e => e.stopPropagation(),
title: "Toggle Windowshade Mode"
});
});
/* harmony default export */ var MainWindow_Shade = (Shade);
// CONCATENATED MODULE: ./js/components/MainWindow/Minimize.tsx
const Minimize = Object(react["memo"])(() => {
const minimize = useActionCreator(actionCreators_minimize);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_ClickedDiv, {
id: "minimize",
title: "Minimize",
onClick: minimize
});
});
/* harmony default export */ var MainWindow_Minimize = (Minimize);
// CONCATENATED MODULE: ./js/components/MainWindow/Shuffle.tsx
const Shuffle = Object(react["memo"])(() => {
const shuffle = useTypedSelector(getShuffle);
const handleClick = useActionCreator(media_toggleShuffle);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenuWraper, {
renderContents: () => /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
checked: shuffle,
label: "Shuffle",
onClick: handleClick,
hotkey: "(S)"
}),
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "shuffle",
className: classnames_default()({
selected: shuffle
}),
onClick: handleClick,
title: "Toggle Shuffle"
})
});
});
/* harmony default export */ var MainWindow_Shuffle = (Shuffle);
// CONCATENATED MODULE: ./js/components/MainWindow/Time.tsx
const Time = Object(react["memo"])(() => {
const toggleTimeMode = useActionCreator(media_toggleTimeMode);
const timeElapsed = useTypedSelector(getTimeElapsed);
const duration = useTypedSelector(getDuration) || 0;
const timeMode = useTypedSelector(getTimeMode);
const seconds = timeMode === TIME_MODE.ELAPSED ? timeElapsed : duration - timeElapsed;
const timeObj = getTimeObj(seconds);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
id: "time",
onClick: toggleTimeMode,
className: "countdown",
children: [timeMode === TIME_MODE.REMAINING && /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "minus-sign"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "minute-first-digit",
className: `digit digit-${timeObj.minutesFirstDigit}`
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "minute-second-digit",
className: `digit digit-${timeObj.minutesSecondDigit}`
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "second-first-digit",
className: `digit digit-${timeObj.secondsFirstDigit}`
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "second-second-digit",
className: `digit digit-${timeObj.secondsSecondDigit}`
})]
});
});
/* harmony default export */ var MainWindow_Time = (Time);
// CONCATENATED MODULE: ./js/components/Volume.tsx
function Volume_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function Volume_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Volume_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Volume_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function Volume({
id,
style,
className
}) {
const volume = useTypedSelector(getVolume);
const setFocus = useActionCreator(actionCreators_setFocus);
const unsetFocus = useActionCreator(actionCreators_unsetFocus);
const setVolume = useActionCreator(media_setVolume);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("input", {
id: id,
type: "range",
min: "0",
max: "100",
step: "1",
value: volume,
style: Volume_objectSpread(Volume_objectSpread({}, style), {}, {
touchAction: "none"
}),
className: className,
onChange: e => setVolume(Number(e.target.value)),
onMouseDown: () => setFocus("volume"),
onTouchStart: () => {
setFocus("volume");
},
onMouseUp: unsetFocus,
onTouchEnd: unsetFocus,
title: "Volume Bar"
});
}
// CONCATENATED MODULE: ./js/components/MainWindow/MainVolume.tsx
const MainVolume = Object(react["memo"])(() => {
const volume = useTypedSelector(getVolume);
const percent = volume / 100;
const sprite = Math.round(percent * 28);
const offset = (sprite - 1) * 15;
const style = {
backgroundPosition: `0 -${offset}px`
};
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "volume",
style: style,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(Volume, {})
});
});
/* harmony default export */ var MainWindow_MainVolume = (MainVolume);
// EXTERNAL MODULE: ./css/main-window.css
var main_window = __webpack_require__(90);
// CONCATENATED MODULE: ./js/components/MainWindow/index.tsx
function loadMediaAndPlay(e) {
return files_loadMedia(e, LOAD_STYLE.PLAY);
}
const MainWindow = react["memo"](({
analyser,
filePickers
}) => {
const mainShade = useTypedSelector(selectors_getWindowShade)("main");
const status = useTypedSelector(getMediaStatus);
const focused = useTypedSelector(getFocusedWindow);
const loading = useTypedSelector(getLoading);
const doubled = useTypedSelector(getDoubled);
const llama = useTypedSelector(getLlamaMode);
const working = useTypedSelector(getWorking);
const className = classnames_default()({
window: true,
play: status === MEDIA_STATUS.PLAYING,
stop: status === MEDIA_STATUS.STOPPED,
pause: status === MEDIA_STATUS.PAUSED,
selected: focused === WINDOWS.MAIN,
shade: mainShade,
draggable: true,
loading,
doubled,
llama
});
const toggleMainWindowShadeMode = useActionCreator(windows_toggleMainWindowShadeMode);
const scrollVolume = useActionCreator(media_scrollVolume);
const loadMedia = useActionCreator(loadMediaAndPlay);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_DropTarget, {
id: "main-window",
windowId: WINDOWS.MAIN,
className: className,
handleDrop: loadMedia,
onWheel: scrollVolume,
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])(components_FocusTarget, {
windowId: WINDOWS.MAIN,
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
id: "title-bar",
className: "selected draggable",
onDoubleClick: toggleMainWindowShadeMode,
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(components_ContextMenuTarget, {
id: "option-context",
bottom: true,
renderMenu: () => /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_MainContextMenu, {
filePickers: filePickers
}),
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(components_ClickedDiv, {
id: "option",
title: "Winamp Menu"
})
}), mainShade && /*#__PURE__*/Object(jsx_runtime["jsx"])(components_MiniTime, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_Minimize, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_Shade, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_Close, {})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "webamp-status",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_ClutterBar, {}), !working && /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "play-pause"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "work-indicator",
className: classnames_default()({
selected: working
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_Time, {})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Visualizer // @ts-ignore Visualizer is not typed yet
, {
analyser: analyser
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "media-info",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_Marquee, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_Kbps, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_Khz, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_MonoStereo, {})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_MainVolume, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_MainBalance, {}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "windows",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_EqToggleButton, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_PlaylistToggleButton, {})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_Position, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_ActionButtons, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_Eject, {}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "shuffle-repeat",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_Shuffle, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_Repeat, {})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("a", {
id: "about",
target: "_blank",
href: "https://webamp.org/about",
title: "About"
})]
})
});
});
/* harmony default export */ var components_MainWindow = (MainWindow);
// CONCATENATED MODULE: ./js/components/PlaylistWindow/PlaylistResizeTarget.tsx
function PlaylistResizeTarget({
widthOnly
}) {
const windowSize = useTypedSelector(selectors_getWindowSize);
const setWindowSize = useActionCreator(windows_setWindowSize);
const currentSize = windowSize("playlist");
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_ResizeTarget, {
currentSize: currentSize,
id: "playlist-resize-target",
setWindowSize: size => {
setWindowSize("playlist", size);
},
widthOnly: widthOnly
});
}
/* harmony default export */ var PlaylistWindow_PlaylistResizeTarget = (PlaylistResizeTarget);
// CONCATENATED MODULE: ./js/components/PlaylistWindow/PlaylistShade.tsx
function PlaylistShade() {
const focused = useTypedSelector(getFocusedWindow);
const getWindowSize = useTypedSelector(selectors_getWindowSize);
const playlistSize = getWindowSize("playlist");
const duration = useTypedSelector(getDuration);
const name = useTypedSelector(getMinimalMediaText);
const closeWindow = useActionCreator(windows_closeWindow);
const toggleShade = useActionCreator(togglePlaylistShadeMode);
const focusWindow = useActionCreator(windows_setFocusedWindow);
const addedWidth = playlistSize[0] * WINDOW_RESIZE_SEGMENT_WIDTH;
const trimmedName = Object(react["useMemo"])(() => {
if (name == null) {
return "[No file]";
}
const MIN_NAME_WIDTH = 205;
const nameLength = (MIN_NAME_WIDTH + addedWidth) / CHARACTER_WIDTH;
return name.length > nameLength ? name.slice(0, nameLength - 1) + UTF8_ELLIPSIS : name;
}, [addedWidth, name]);
const time = Object(react["useMemo"])(() => {
return name == null ? "" : getTimeStr(duration);
}, [duration, name]);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "playlist-window-shade",
className: classnames_default()("window", "draggable", {
selected: focused === WINDOWS.PLAYLIST
}),
style: {
width: `${WINDOW_WIDTH + addedWidth}px`
},
onMouseDown: () => focusWindow("playlist"),
onDoubleClick: toggleShade,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "left",
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "right draggable",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "playlist-shade-track-title",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(components_CharacterString, {
children: trimmedName
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "playlist-shade-time",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(components_CharacterString, {
children: time
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistWindow_PlaylistResizeTarget, {
widthOnly: true
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "playlist-shade-button",
onClick: toggleShade
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "playlist-close-button",
onClick: () => closeWindow("playlist")
})]
})
})
});
}
/* harmony default export */ var PlaylistWindow_PlaylistShade = (PlaylistShade);
// CONCATENATED MODULE: ./js/components/PlaylistWindow/PlaylistMenuEntry.tsx
// We implement hover ourselves, because we hate ourselves and https://stackoverflow.com/a/13259049/1263117
function PlaylistMenuEntry({
children
}) {
const {
ref,
hover
} = useIsHovered();
return /*#__PURE__*/Object(jsx_runtime["jsx"])("li", {
ref: ref,
className: classnames_default()({
hover
}),
children: children
});
}
/* harmony default export */ var PlaylistWindow_PlaylistMenuEntry = (Object(react["memo"])(PlaylistMenuEntry));
// CONCATENATED MODULE: ./js/components/PlaylistWindow/PlaylistMenu.tsx
function PlaylistMenu(props) {
const [selected, setSelected] = Object(react["useState"])(false);
const [ref, setRef] = Object(react["useState"])(null);
const callback = Object(react["useCallback"])(() => {
// If we've clicked on a Context Menu spawed inside this menu, it will
// register as an external click. However, hiding the menu will remove
// the Context Menu from the DOM. Therefore, we wait until the next
// event loop to actually hide ourselves.
setTimeout(() => {
// Close the menu
setSelected(false);
}, 0);
}, []);
useOnClickAway(ref, selected ? callback : null);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
id: props.id,
className: classnames_default()("playlist-menu", {
selected
}),
ref: setRef,
onClick: () => setSelected(selected_ => !selected_),
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "bar"
}), selected && /*#__PURE__*/Object(jsx_runtime["jsx"])("ul", {
children: react["Children"].map(props.children, (child, i) => /*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistWindow_PlaylistMenuEntry, {
children: child
}, i))
})]
});
}
/* harmony default export */ var PlaylistWindow_PlaylistMenu = (Object(react["memo"])(PlaylistMenu));
// CONCATENATED MODULE: ./js/components/PlaylistWindow/AddMenu.tsx
const AddMenu = () => {
const nextIndex = useTypedSelector(getTrackCount);
const addDirAtIndex = useActionCreator(files_addDirAtIndex);
const addFilesAtIndex = useActionCreator(files_addFilesAtIndex);
const addFilesFromUrl = useActionCreator(files_addFilesFromUrl);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(PlaylistWindow_PlaylistMenu, {
id: "playlist-add-menu",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "add-url",
onClick: () => addFilesFromUrl(nextIndex)
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "add-dir",
onClick: () => addDirAtIndex(nextIndex)
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "add-file",
onClick: () => addFilesAtIndex(nextIndex)
})]
});
};
/* harmony default export */ var PlaylistWindow_AddMenu = (AddMenu);
// CONCATENATED MODULE: ./js/components/PlaylistWindow/RemoveMenu.tsx
/* eslint-disable no-alert */
const RemoveMenu = () => {
const removeSelected = useActionCreator(removeSelectedTracks);
const removeAll = useActionCreator(playlist_removeAllTracks);
const crop = useActionCreator(cropPlaylist);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(PlaylistWindow_PlaylistMenu, {
id: "playlist-remove-menu",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "remove-misc",
onClick: () => alert("Not supported in Webamp")
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "remove-all",
onClick: removeAll
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "crop",
onClick: crop
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "remove-selected",
onClick: removeSelected
})]
});
};
/* harmony default export */ var PlaylistWindow_RemoveMenu = (RemoveMenu);
// CONCATENATED MODULE: ./js/components/PlaylistWindow/SelectionMenu.tsx
function SelectionMenu() {
const invert = useActionCreator(invertSelection);
const zero = useActionCreator(playlist_selectZero);
const all = useActionCreator(selectAll);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(PlaylistWindow_PlaylistMenu, {
id: "playlist-selection-menu",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "invert-selection",
onClick: invert
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "select-zero",
onClick: zero
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "select-all",
onClick: all
})]
});
}
// CONCATENATED MODULE: ./js/components/PlaylistWindow/SortContextMenu.tsx
/* eslint-disable no-alert */
/* TODO: This should really be kitty-corner to the upper right hand corner of the MiscMenu */
function SortContextMenu() {
const reverseList = useActionCreator(playlist_reverseList);
const randomizeList = useActionCreator(playlist_randomizeList);
const sortListByTitle = useActionCreator(playlist_sortListByTitle);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_ContextMenuTarget, {
style: {
width: "100%",
height: "100%"
},
top: true,
renderMenu: () => /*#__PURE__*/Object(jsx_runtime["jsxs"])(jsx_runtime["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Sort list by title",
onClick: sortListByTitle
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu_Hr, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Reverse list",
onClick: reverseList
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
label: "Randomize list",
onClick: randomizeList
})]
}),
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {})
});
}
// CONCATENATED MODULE: ./js/components/PlaylistWindow/MiscOptionsContextMenu.tsx
const MiscOptionsContextMenu = () => {
const downloadHtmlPlaylist = useActionCreator(files_downloadHtmlPlaylist);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_ContextMenuTarget, {
style: {
width: "100%",
height: "100%"
},
top: true,
renderMenu: () => /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
onClick: downloadHtmlPlaylist,
label: "Generate HTML playlist"
}),
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {})
});
};
/* harmony default export */ var PlaylistWindow_MiscOptionsContextMenu = (MiscOptionsContextMenu);
// CONCATENATED MODULE: ./js/components/PlaylistWindow/MiscMenu.tsx
const MiscMenu = () => /*#__PURE__*/Object(jsx_runtime["jsxs"])(PlaylistWindow_PlaylistMenu, {
id: "playlist-misc-menu",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "sort-list",
onClick: e => e.stopPropagation(),
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(SortContextMenu, {})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "file-info",
onClick: () => alert("Not supported in Webamp")
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "misc-options",
onClick: e => e.stopPropagation(),
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistWindow_MiscOptionsContextMenu, {})
})]
});
/* harmony default export */ var PlaylistWindow_MiscMenu = (MiscMenu);
// CONCATENATED MODULE: ./js/components/PlaylistWindow/ListMenu.tsx
/* eslint-disable no-alert */
function ListMenu() {
const removeAllTracks = useActionCreator(playlist_removeAllTracks);
const addFilesFromList = useActionCreator(files_addFilesFromList);
const saveFilesToList = useActionCreator(files_saveFilesToList);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(PlaylistWindow_PlaylistMenu, {
id: "playlist-list-menu",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "new-list",
onClick: removeAllTracks
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "save-list",
onClick: saveFilesToList
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "load-list",
onClick: addFilesFromList
})]
});
}
// CONCATENATED MODULE: ./js/components/PlaylistWindow/RunningTimeDisplay.tsx
// While all the browsers I care about support String.prototype.padEnd,
// Not all node versions do, and I want tests to pass in Jest...
// Sigh.
function rightPad(str, len, fillChar) {
while (str.length < len) {
str += fillChar;
}
return str;
}
const RunningTimeDisplay = () => {
const runningTimeMessage = useTypedSelector(getRunningTimeMessage);
const text = Object(react["useMemo"])(() => rightPad(runningTimeMessage, 18, " "), [runningTimeMessage]);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-running-time-display draggable",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(components_CharacterString, {
children: text
})
})
});
};
/* harmony default export */ var PlaylistWindow_RunningTimeDisplay = (RunningTimeDisplay);
// CONCATENATED MODULE: ./js/components/PlaylistWindow/PlaylistActionArea.tsx
const PlaylistWindow = () => {
const play = useActionCreator(media_play);
const pause = useActionCreator(media_pause);
const stop = useActionCreator(media_stop);
const openMediaFileDialog = useActionCreator(files_openMediaFileDialog);
const next = useActionCreator(media_next);
const previous = useActionCreator(media_previous);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(react["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistWindow_RunningTimeDisplay, {}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "playlist-action-buttons",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-previous-button",
onClick: previous
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-play-button",
onClick: play
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-pause-button",
onClick: pause
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-stop-button",
onClick: stop
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-next-button",
onClick: next
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-eject-button",
onClick: openMediaFileDialog
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(components_MiniTime, {})]
});
};
/* harmony default export */ var PlaylistActionArea = (PlaylistWindow);
// CONCATENATED MODULE: ./js/components/PlaylistWindow/TrackCell.tsx
function TrackCell({
children,
handleMoveClick,
index,
id
}) {
const skinPlaylistStyle = useTypedSelector(getSkinPlaylistStyle);
const selectedTrackIds = useTypedSelector(getSelectedTrackIds);
const currentTrackId = useTypedSelector(getCurrentTrackId);
const selected = selectedTrackIds.has(id);
const current = currentTrackId === id;
const dispatch = useTypedDispatch();
const playTrackNow = useActionCreator(media_playTrackNow);
const onMouseDown = Object(react["useCallback"])(e => {
if (e.shiftKey) {
e.preventDefault();
dispatch({
type: SHIFT_CLICKED_TRACK,
index
});
return;
} else if (e.metaKey || e.ctrlKey) {
e.preventDefault();
dispatch({
type: CTRL_CLICKED_TRACK,
index
});
return;
}
if (!selected) {
dispatch({
type: CLICKED_TRACK,
index
});
}
handleMoveClick(e);
}, [dispatch, handleMoveClick, index, selected]);
const handleTouchStart = Object(react["useCallback"])(e => {
if (!selected) {
dispatch({
type: CLICKED_TRACK,
index
});
}
handleMoveClick(e); // There's no touch equivalent of onDoubleClick, so we fake one:
function handleSecondTap() {
playTrackNow(id);
}
e.target.addEventListener("touchstart", handleSecondTap);
setTimeout(() => {
// Technically we might be unmounted here, but that's fine since you
// can't tap an unmounted element and we will clean up eventually.
e.target.removeEventListener("touchstart", handleSecondTap);
}, 250);
}, [dispatch, handleMoveClick, id, index, playTrackNow, selected]);
const style = {
backgroundColor: selected ? skinPlaylistStyle.selectedbg : undefined,
color: current ? skinPlaylistStyle.current : undefined
};
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: classnames_default()("track-cell", {
selected,
current
}),
style: style,
onClick: e => e.stopPropagation(),
onMouseDown: onMouseDown,
onTouchStart: handleTouchStart,
onContextMenu: e => e.preventDefault(),
onDoubleClick: () => playTrackNow(id),
children: children
});
}
/* harmony default export */ var PlaylistWindow_TrackCell = (TrackCell);
// CONCATENATED MODULE: ./js/components/PlaylistWindow/TrackTitle.tsx
const TrackTitle = ({
id,
paddedTrackNumber
}) => {
const title = useTypedSelector(selectors_getTrackDisplayName)(id);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])("span", {
children: [paddedTrackNumber, ". ", title]
});
};
/* harmony default export */ var PlaylistWindow_TrackTitle = (TrackTitle);
// CONCATENATED MODULE: ./js/components/PlaylistWindow/TrackList.tsx
function getNumberLength(number) {
return number.toString().length;
}
function TrackList() {
const offset = useTypedSelector(getScrollOffset);
const trackIds = useTypedSelector(getVisibleTrackIds);
const tracks = useTypedSelector(getTracks);
const numberOfTracks = useTypedSelector(getNumberOfTracks);
const selectZero = useActionCreator(playlist_selectZero);
const dragSelected = useActionCreator(playlist_dragSelected);
const scrollPlaylistByDelta = useActionCreator(playlist_scrollPlaylistByDelta);
const [node, setNode] = Object(react["useState"])(null);
const [moving, setMoving] = Object(react["useState"])(false);
const [mouseStartY, setMouseStartY] = Object(react["useState"])(null);
const _handleMoveClick = e => {
setMoving(true);
setMouseStartY(getY(e));
};
Object(react["useEffect"])(() => {
if (node == null || mouseStartY == null || moving === false) {
return;
}
const {
top,
bottom,
left,
right
} = node.getBoundingClientRect();
let lastDiff = 0;
const handleMouseMove = ee => {
const x = getX(ee);
const y = getY(ee);
if (y < top || y > bottom || x < left || x > right) {
// Mouse is outside the track list
return;
}
const proposedDiff = Math.floor((y - mouseStartY) / TRACK_HEIGHT);
if (proposedDiff !== lastDiff) {
const diffDiff = proposedDiff - lastDiff;
dragSelected(diffDiff);
lastDiff = proposedDiff;
}
}; // A little indirect here. Basically, we set `moving` false here which
// causes our useEffect to rerun which removes all of these event listeners.
// It might be a little tigher to actually remove these listeners in the
// `handleMouseUp` callback, but... I'm lazy.
const handleMouseUp = () => setMoving(false);
window.addEventListener("mouseup", handleMouseUp);
window.addEventListener("mousemove", handleMouseMove);
window.addEventListener("touchend", handleMouseUp);
window.addEventListener("touchmove", handleMouseMove);
return () => {
window.removeEventListener("mousemove", handleMouseMove);
window.removeEventListener("touchmove", handleMouseMove);
window.removeEventListener("mouseup", handleMouseUp);
window.removeEventListener("touchend", handleMouseUp);
}; // I'm not 100% sure how well this would work if it rebound mid drag, so
// we'll just pretend it's okay that we have stale values in there.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [moving]);
function _renderTracks(format) {
return trackIds.map((id, i) => /*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistWindow_TrackCell, {
id: id,
index: offset + i,
handleMoveClick: _handleMoveClick,
children: format(id, i)
}, id));
}
const maxTrackNumberLength = getNumberLength(numberOfTracks);
const paddedTrackNumForIndex = i => (i + 1 + offset).toString().padStart(maxTrackNumberLength, "\u00A0");
Object(react["useEffect"])(() => {
if (node == null) {
return;
} // Chome changed wheel events to be passive be default. We need active (so
// we can prevent default) and React does not have a way to control this, so
// we must bind our own events.
//
// https://github.com/facebook/react/issues/14856#issuecomment-806052402
node.addEventListener("wheel", scrollPlaylistByDelta, {
passive: false
});
return () => {
node.removeEventListener("wheel", scrollPlaylistByDelta);
};
}, [node, scrollPlaylistByDelta]);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
ref: setNode,
className: "playlist-tracks",
style: {
height: "100%",
userSelect: "none"
},
onClick: selectZero,
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-track-titles",
children: _renderTracks((id, i) => /*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistWindow_TrackTitle, {
id: id,
paddedTrackNumber: paddedTrackNumForIndex(i)
}))
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-track-durations",
children: _renderTracks(id => getTimeStr(tracks[id].duration))
})]
});
}
/* harmony default export */ var PlaylistWindow_TrackList = (TrackList);
// CONCATENATED MODULE: ./js/components/VerticalSlider.tsx
// `<input type="range" />` can be rotated to become a vertical slider using
// CSS, but that makes it impossible to style the handle in a pixel perfect
// manner. Instead we reimplement it in React.
function VerticalSlider({
value,
height,
width,
handle,
handleHeight,
onBeforeChange,
onChange,
onAfterChange,
disabled
}) {
const ref = Object(react["useRef"])(null);
const handleRef = Object(react["useRef"])(null);
function registerMoveListener({
target,
clientY,
touch
}) {
const sliderNode = ref.current;
const handleNode = handleRef.current;
if (sliderNode == null || handleNode == null) {
// I don't think this could ever happen in practice
return null;
}
const sliderRect = sliderNode.getBoundingClientRect();
const handleRect = handleNode.getBoundingClientRect();
const {
top: sliderTop,
height: sliderHeight
} = sliderRect;
const {
top: handleTop,
height: realHandleHeight
} = handleRect; // If the user clicks on the handle we want them to continue to hold onto
// that point of te handle. If they click outside of the handle (in the
// slider itself) we want to center the handle at that point and have them
// move the handle from the center.
const handleOffset = handleNode.contains(target) ? clientY - handleTop : realHandleHeight / 2;
const baseOffset = sliderTop + handleOffset; // Measure the actual rect height rather than use the `height` prop, becuase
// we might be in double-size mode.
const spanSize = sliderHeight - realHandleHeight;
function moveToPosition(y) {
// Ensure dragging does not cause elements/text to be selected.
// https://stackoverflow.com/a/19164149/1263117
const startOffset = y - baseOffset;
onChange(clamp(startOffset / spanSize, 0, 1));
}
if (touch) {
const handleTouchMove = event => {
if (event.cancelable) {
event.preventDefault();
}
moveToPosition(event.touches[0].clientY);
};
const handleTouchEnd = () => {
if (onAfterChange != null) {
onAfterChange();
}
document.removeEventListener("touchmove", handleTouchMove);
document.removeEventListener("touchend", handleTouchEnd);
};
document.addEventListener("touchmove", handleTouchMove, {
passive: false
});
document.addEventListener("touchend", handleTouchEnd);
} else {
const handleMouseMove = event => {
event.preventDefault();
moveToPosition(event.clientY);
};
const handleMouseUp = () => {
if (onAfterChange != null) {
onAfterChange();
}
document.removeEventListener("mousemove", handleMouseMove);
document.removeEventListener("mouseup", handleMouseUp);
};
document.addEventListener("mousemove", handleMouseMove);
document.addEventListener("mouseup", handleMouseUp);
}
if (onBeforeChange != null) {
onBeforeChange();
} // Move the slider to where they've started.
moveToPosition(clientY);
}
function handleMouseDown(e) {
e.preventDefault();
registerMoveListener({
target: e.target,
clientY: e.clientY,
touch: false
});
}
function handleTouchStart(e) {
registerMoveListener({
target: e.target,
clientY: e.touches[0].clientY,
touch: true
});
}
const offset = Math.floor((height - handleHeight) * value);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
style: {
height,
width
},
onMouseDown: disabled ? undefined : handleMouseDown,
onTouchStart: disabled ? undefined : handleTouchStart,
ref: ref,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
style: {
transform: `translateY(${offset}px)`
},
ref: handleRef,
children: handle
})
});
}
// CONCATENATED MODULE: ./js/components/PlaylistWindow/PlaylistScrollBar.tsx
const HANDLE_HEIGHT = 18;
const Handle = () => /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-scrollbar-handle",
style: {
height: HANDLE_HEIGHT
}
});
function PlaylistScrollBar() {
const getWindowPixelSize = useTypedSelector(selectors_getWindowPixelSize);
const playlistHeight = getWindowPixelSize(WINDOWS.PLAYLIST).height;
const playlistScrollPosition = useTypedSelector(getPlaylistScrollPosition);
const allTracksAreVisible = useTypedSelector(getAllTracksAreVisible);
const setPlaylistScrollPosition = useActionCreator(playlist_setPlaylistScrollPosition);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-scrollbar",
style: {
marginLeft: 5
},
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(VerticalSlider, {
height: playlistHeight - 58,
handleHeight: HANDLE_HEIGHT,
width: 8,
value: playlistScrollPosition / 100,
onChange: val => setPlaylistScrollPosition(val * 100),
handle: /*#__PURE__*/Object(jsx_runtime["jsx"])(Handle, {}),
disabled: allTracksAreVisible
})
});
}
// EXTERNAL MODULE: ./css/playlist-window.css
var playlist_window = __webpack_require__(92);
// CONCATENATED MODULE: ./js/components/PlaylistWindow/index.tsx
function _maxTrackIndex(state) {
return state.playlist.trackOrder.length - 1;
}
function PlaylistWindow_PlaylistWindow({
analyser
}) {
const offset = useTypedSelector(getScrollOffset);
const getWindowSize = useTypedSelector(selectors_getWindowSize);
const selectedWindow = useTypedSelector(getFocusedWindow);
const getWindowShade = useTypedSelector(selectors_getWindowShade);
const getWindowOpen = useTypedSelector(selectors_getWindowOpen);
const maxTrackIndex = useTypedSelector(_maxTrackIndex);
const skinPlaylistStyle = useTypedSelector(getSkinPlaylistStyle);
const getWindowPixelSize = useTypedSelector(selectors_getWindowPixelSize);
const selected = selectedWindow === WINDOWS.PLAYLIST;
const playlistShade = Boolean(getWindowShade(WINDOWS.PLAYLIST));
const playlistSize = getWindowSize(WINDOWS.PLAYLIST);
const playlistWindowPixelSize = getWindowPixelSize(WINDOWS.PLAYLIST);
const close = useActionCreator(windows_closeWindow);
const toggleShade = useActionCreator(togglePlaylistShadeMode);
const scrollUpFourTracks = useActionCreator(playlist_scrollUpFourTracks);
const scrollDownFourTracks = useActionCreator(playlist_scrollDownFourTracks);
const scrollVolume = useActionCreator(media_scrollVolume);
const loadMedia = useActionCreator(files_loadMedia);
const showVisualizer = playlistSize[0] > 2;
const activateVisualizer = !getWindowOpen(WINDOWS.MAIN);
const handleDrop = Object(react["useCallback"])((e, targetCoords) => {
const top = e.clientY - targetCoords.y;
const atIndex = clamp(offset + Math.round((top - 23) / TRACK_HEIGHT), 0, maxTrackIndex + 1);
loadMedia(e, LOAD_STYLE.NONE, atIndex);
}, [loadMedia, maxTrackIndex, offset]);
if (playlistShade) {
return /*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistWindow_PlaylistShade, {});
}
const style = {
color: skinPlaylistStyle.normal,
backgroundColor: skinPlaylistStyle.normalbg,
fontFamily: `${skinPlaylistStyle.font}, Arial, sans-serif`,
height: `${playlistWindowPixelSize.height}px`,
width: `${playlistWindowPixelSize.width}px`
};
const classes = classnames_default()("window", "draggable", {
selected
});
const showSpacers = playlistSize[0] % 2 === 0;
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_FocusTarget, {
windowId: WINDOWS.PLAYLIST,
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])(components_DropTarget, {
id: "playlist-window",
windowId: WINDOWS.PLAYLIST,
className: classes,
style: style,
handleDrop: handleDrop,
onWheel: scrollVolume,
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "playlist-top draggable",
onDoubleClick: toggleShade,
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-top-left draggable"
}), showSpacers && /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-top-left-spacer draggable"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-top-left-fill draggable"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-top-title draggable"
}), showSpacers && /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-top-right-spacer draggable"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-top-right-fill draggable"
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "playlist-top-right draggable",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "playlist-shade-button",
onClick: toggleShade
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "playlist-close-button",
onClick: () => close(WINDOWS.PLAYLIST)
})]
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "playlist-middle draggable",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-middle-left draggable"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-middle-center",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistWindow_TrackList, {})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-middle-right draggable",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistScrollBar, {})
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "playlist-bottom draggable",
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "playlist-bottom-left draggable",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistWindow_AddMenu, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistWindow_RemoveMenu, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(SelectionMenu, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistWindow_MiscMenu, {})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-bottom-center draggable"
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "playlist-bottom-right draggable",
children: [showVisualizer && /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "playlist-visualizer",
children: activateVisualizer && /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "visualizer-wrapper",
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Visualizer // @ts-ignore Visualizer is not yet typed
, {
analyser: analyser
})
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistActionArea, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ListMenu, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "playlist-scroll-up-button",
onClick: scrollUpFourTracks
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "playlist-scroll-down-button",
onClick: scrollDownFourTracks
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(PlaylistWindow_PlaylistResizeTarget, {})]
})]
})]
})
});
}
/* harmony default export */ var components_PlaylistWindow = (PlaylistWindow_PlaylistWindow);
// CONCATENATED MODULE: ./js/components/EqualizerWindow/Band.tsx
const MAX_VALUE = 100; // Given a value between 1-100, return the sprite number (0-27)
const spriteNumber = value => {
const percent = value / MAX_VALUE;
return Math.round(percent * 27);
}; // Given a sprite number, return the x,y
const spriteOffsets = number => {
const x = number % 14;
const y = Math.floor(number / 14);
return {
x,
y
};
};
const Band_Handle = () => {
const style = {
width: 11,
height: 11,
marginLeft: 1
};
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
style: style,
className: "slider-handle"
});
};
function Band({
id,
onChange,
band
}) {
const sliders = useTypedSelector(getSliders);
const value = sliders[band];
const backgroundPosition = Object(react["useMemo"])(() => {
const {
x,
y
} = spriteOffsets(spriteNumber(value));
const xOffset = x * 15; // Each sprite is 15px wide
const yOffset = y * 65; // Each sprite is 15px tall
return `-${xOffset}px -${yOffset}px`;
}, [value]);
const focusBand = useActionCreator(actionCreators_focusBand);
const usetFocus = useActionCreator(actionCreators_unsetFocus); // Note: The band background is actually one pixel taller (63) than the slider
// it contains (62).
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: id,
className: "band",
style: {
backgroundPosition,
height: 63
},
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(VerticalSlider, {
height: 62,
width: 14,
handleHeight: 11,
value: 1 - value / MAX_VALUE,
onBeforeChange: () => focusBand(band),
onChange: val => onChange((1 - val) * MAX_VALUE),
onAfterChange: usetFocus,
handle: /*#__PURE__*/Object(jsx_runtime["jsx"])(Band_Handle, {})
})
});
}
// CONCATENATED MODULE: ./js/components/EqualizerWindow/EqOn.tsx
const EqOn = () => {
const toggleEq = useActionCreator(equalizer_toggleEq);
const on = useTypedSelector(getEqualizerEnabled);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "on",
className: classnames_default()({
selected: on
}),
onClick: toggleEq
});
};
/* harmony default export */ var EqualizerWindow_EqOn = (EqOn);
// CONCATENATED MODULE: ./js/components/EqualizerWindow/EqAuto.tsx
const EqAuto = Object(react["memo"])(() => {
const selected = useTypedSelector(state => state.equalizer.auto);
const toggleAuto = useActionCreator(toggleEqAuto);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "auto",
className: classnames_default()({
selected
}),
onClick: toggleAuto
});
});
/* harmony default export */ var EqualizerWindow_EqAuto = (EqAuto);
// CONCATENATED MODULE: ./js/components/EqualizerWindow/spline.js
// Adapted from https://github.com/morganherlocker/cubic-spline
function spline(xs, ys) {
const ks = getNaturalKs(xs, ys);
const maxX = xs[xs.length - 1];
const allYs = [];
let i = 1;
for (let x = 0; x <= maxX; x++) {
while (xs[i] < x) i++;
const t = (x - xs[i - 1]) / (xs[i] - xs[i - 1]);
const a = ks[i - 1] * (xs[i] - xs[i - 1]) - (ys[i] - ys[i - 1]);
const b = -ks[i] * (xs[i] - xs[i - 1]) + (ys[i] - ys[i - 1]);
const q = (1 - t) * ys[i - 1] + t * ys[i] + t * (1 - t) * (a * (1 - t) + b * t);
allYs.push(q);
}
return allYs;
}
function getNaturalKs(xs, ys) {
const ks = xs.map(() => 0);
const n = xs.length - 1;
const matrix = zerosMatrix(n + 1, n + 2);
for (let i = 1; i < n; i++ // rows
) {
matrix[i][i - 1] = 1 / (xs[i] - xs[i - 1]);
matrix[i][i] = 2 * (1 / (xs[i] - xs[i - 1]) + 1 / (xs[i + 1] - xs[i]));
matrix[i][i + 1] = 1 / (xs[i + 1] - xs[i]);
matrix[i][n + 1] = 3 * ((ys[i] - ys[i - 1]) / ((xs[i] - xs[i - 1]) * (xs[i] - xs[i - 1])) + (ys[i + 1] - ys[i]) / ((xs[i + 1] - xs[i]) * (xs[i + 1] - xs[i])));
}
matrix[0][0] = 2 / (xs[1] - xs[0]);
matrix[0][1] = 1 / (xs[1] - xs[0]);
matrix[0][n + 1] = 3 * (ys[1] - ys[0]) / ((xs[1] - xs[0]) * (xs[1] - xs[0]));
matrix[n][n - 1] = 1 / (xs[n] - xs[n - 1]);
matrix[n][n] = 2 / (xs[n] - xs[n - 1]);
matrix[n][n + 1] = 3 * (ys[n] - ys[n - 1]) / ((xs[n] - xs[n - 1]) * (xs[n] - xs[n - 1]));
return solve(matrix, ks);
}
function solve(matrix, ks) {
const m = matrix.length; // column
for (let k = 0; k < m; k++) {
// pivot for column
let iMax = 0;
let vali = Number.NEGATIVE_INFINITY;
for (let i = k; i < m; i++) if (matrix[i][k] > vali) {
iMax = i;
vali = matrix[i][k];
}
swapRows(matrix, k, iMax); // for all rows below pivot
for (let i = k + 1; i < m; i++) {
for (let j = k + 1; j < m + 1; j++) matrix[i][j] = matrix[i][j] - matrix[k][j] * (matrix[i][k] / matrix[k][k]);
matrix[i][k] = 0;
}
} // rows = columns
for (let i = m - 1; i >= 0; i--) {
const v = matrix[i][m] / matrix[i][i];
ks[i] = v; // rows
for (let j = i - 1; j >= 0; j--) {
matrix[j][m] -= matrix[j][i] * v;
matrix[j][i] = 0;
}
}
return ks;
}
function zerosMatrix(rows, columns) {
const matrix = [];
for (let i = 0; i < rows; i++) {
matrix.push([]);
for (let j = 0; j < columns; j++) {
matrix[i].push(0);
}
}
return matrix;
}
function swapRows(m, k, l) {
const p = m[k];
m[k] = m[l];
m[l] = p;
}
// CONCATENATED MODULE: ./js/components/EqualizerWindow/EqGraph.tsx
const GRAPH_HEIGHT = 19;
const GRAPH_WIDTH = 113;
function EqGraph() {
const sliders = useTypedSelector(getSliders);
const preampLineImagePromise = useTypedSelector(getPreampLineImage);
const preampLineImage = usePromiseValueOrNull(preampLineImagePromise);
const [canvasNode, setCanvasNode] = Object(react["useState"])(null);
const canvasCtx = Object(react["useMemo"])(() => {
var _canvasNode$getContex;
return (_canvasNode$getContex = canvasNode === null || canvasNode === void 0 ? void 0 : canvasNode.getContext("2d")) !== null && _canvasNode$getContex !== void 0 ? _canvasNode$getContex : null;
}, [canvasNode]);
const colorPattern = useColorPattern(canvasCtx);
Object(react["useLayoutEffect"])(() => {
if (canvasCtx == null || canvasNode == null || preampLineImage == null || colorPattern == null) {
return;
}
const width = Number(canvasNode.width);
const height = Number(canvasNode.height);
canvasCtx.clearRect(0, 0, width, height);
drawEqLine({
colorPattern,
sliders,
canvasCtx,
preampLineImage
});
}, [canvasCtx, canvasNode, colorPattern, preampLineImage, sliders]);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("canvas", {
id: "eqGraph",
ref: setCanvasNode,
width: GRAPH_WIDTH,
height: GRAPH_HEIGHT
});
}
function useColorPattern(canvasCtx) {
const lineColorsImagePromise = useTypedSelector(getLineColorsImage);
const lineColorsImage = usePromiseValueOrNull(lineColorsImagePromise);
return Object(react["useMemo"])(() => {
if (canvasCtx == null || lineColorsImage == null) {
return null;
}
return canvasCtx.createPattern(lineColorsImage, "repeat-x");
}, [canvasCtx, lineColorsImage]);
}
function drawEqLine({
colorPattern,
sliders,
canvasCtx,
preampLineImage
}) {
const preampValue = percentToRange(sliders.preamp / 100, 0, GRAPH_HEIGHT - 1);
canvasCtx.drawImage(preampLineImage, 0, preampValue, preampLineImage.width, preampLineImage.height);
const amplitudes = BANDS.map(band => sliders[band]);
canvasCtx.fillStyle = colorPattern;
const paddingLeft = 2; // TODO: This should be 1.5
const min = 0;
const max = GRAPH_HEIGHT - 1;
const xs = [];
const ys = [];
amplitudes.forEach((value, i) => {
const percent = (100 - value) / 100; // Each band is 12 pixels widex
xs.push(i * 12);
ys.push(percentToRange(percent, min, max));
});
const allYs = spline(xs, ys);
const maxX = xs[xs.length - 1];
let lastY = ys[0];
for (let x = 0; x <= maxX; x++) {
const y = clamp(Math.round(allYs[x]), 0, GRAPH_HEIGHT - 1);
const yTop = Math.min(y, lastY);
const height = 1 + Math.abs(lastY - y);
canvasCtx.fillRect(paddingLeft + x, yTop, 1, height);
lastY = y;
}
}
/* harmony default export */ var EqualizerWindow_EqGraph = (EqGraph);
// EXTERNAL MODULE: ./presets/builtin.json
var builtin = __webpack_require__(41);
// CONCATENATED MODULE: ./js/components/EqualizerWindow/PresetsContextMenu.tsx
const PresetsContextMenu = () => {
const openEqfFileDialog = useActionCreator(files_openEqfFileDialog);
const downloadPreset = useActionCreator(files_downloadPreset);
const setEqFromObject = useActionCreator(files_setEqFromObject);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_ContextMenuTarget, {
top: true,
id: "presets-context",
renderMenu: () => /*#__PURE__*/Object(jsx_runtime["jsxs"])(jsx_runtime["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(Parent, {
label: "Load",
children: [builtin.presets.map(preset => /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
onClick: () => setEqFromObject(preset),
label: preset.name
}, preset.name)), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenu_Hr, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
onClick: openEqfFileDialog,
label: "From Eqf..."
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Node, {
onClick: downloadPreset,
label: "Save"
})]
}),
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "presets"
})
});
};
/* harmony default export */ var EqualizerWindow_PresetsContextMenu = (PresetsContextMenu);
// CONCATENATED MODULE: ./js/components/EqualizerWindow/EqTitleButtons.tsx
function EqTitleButtons() {
const focusedWindow = useTypedSelector(getFocusedWindow);
const selected = focusedWindow === WINDOWS.EQUALIZER;
const closeWindow = useActionCreator(windows_closeWindow);
const toggleEqualizerShadeMode = useActionCreator(windows_toggleEqualizerShadeMode);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(components_ClickedDiv, {
id: "eq-buttons",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "equalizer-shade",
onClick: toggleEqualizerShadeMode
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "equalizer-close",
onClick: () => closeWindow(WINDOWS.EQUALIZER)
})]
}, selected ? "selected" : "unselected");
}
// CONCATENATED MODULE: ./js/components/EqualizerWindow/EqualizerShade.tsx
const EqualizerShade = () => {
const volume = useTypedSelector(getVolume);
const balance = useTypedSelector(getBalance);
const toggleEqualizerShadeMode = useActionCreator(windows_toggleEqualizerShadeMode);
const classes = ["left", "center", "right"];
const eqVolumeClassName = segment(0, 100, volume, classes);
const eqBalanceClassName = segment(-100, 100, balance, classes);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
className: "draggable",
onDoubleClick: toggleEqualizerShadeMode,
style: {
width: "100%",
height: "100%"
},
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(EqTitleButtons, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Volume, {
id: "equalizer-volume",
className: eqVolumeClassName
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Balance, {
id: "equalizer-balance",
className: eqBalanceClassName
})]
});
};
/* harmony default export */ var EqualizerWindow_EqualizerShade = (EqualizerShade);
// EXTERNAL MODULE: ./css/equalizer-window.css
var equalizer_window = __webpack_require__(94);
// CONCATENATED MODULE: ./js/components/EqualizerWindow/index.tsx
const bandClassName = band => `band-${band}`;
const EqualizerWindow = () => {
const doubled = useTypedSelector(getDoubled);
const focusedWindow = useTypedSelector(getFocusedWindow);
const getWindowShade = useTypedSelector(selectors_getWindowShade);
const selected = focusedWindow === WINDOWS.EQUALIZER;
const shade = getWindowShade(WINDOWS.EQUALIZER);
const setPreampValue = useActionCreator(setPreamp);
const setEqToMin = useActionCreator(equalizer_setEqToMin);
const setEqToMid = useActionCreator(equalizer_setEqToMid);
const setEqToMax = useActionCreator(equalizer_setEqToMax);
const setHertzValue = useActionCreator(setEqBand);
const toggleEqualizerShadeMode = useActionCreator(windows_toggleEqualizerShadeMode);
const className = classnames_default()({
selected,
doubled,
shade,
window: true,
draggable: true
});
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "equalizer-window",
className: className,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(components_FocusTarget, {
windowId: WINDOWS.EQUALIZER,
children: shade ? /*#__PURE__*/Object(jsx_runtime["jsx"])(EqualizerWindow_EqualizerShade, {}) : /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: "equalizer-top title-bar draggable",
onDoubleClick: toggleEqualizerShadeMode,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(EqTitleButtons, {})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(EqualizerWindow_EqOn, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(EqualizerWindow_EqAuto, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(EqualizerWindow_EqGraph, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(EqualizerWindow_PresetsContextMenu, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Band, {
id: "preamp",
band: "preamp",
onChange: setPreampValue
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "plus12db",
onClick: setEqToMax
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "zerodb",
onClick: setEqToMid
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
id: "minus12db",
onClick: setEqToMin
}), BANDS.map(hertz => /*#__PURE__*/Object(jsx_runtime["jsx"])(Band, {
id: bandClassName(hertz),
band: hertz,
onChange: value => setHertzValue(hertz, value)
}, hertz))]
})
})
});
};
/* harmony default export */ var components_EqualizerWindow = (EqualizerWindow);
// CONCATENATED MODULE: ./js/skinSelectors.ts
const imageSelectors = {
MAIN_BALANCE_BACKGROUND: ["#balance"],
MAIN_BALANCE_THUMB: ["#balance::-webkit-slider-thumb", "#balance::-moz-range-thumb"],
MAIN_BALANCE_THUMB_ACTIVE: ["#balance:active::-webkit-slider-thumb", "#balance:active::-moz-range-thumb"],
MAIN_PREVIOUS_BUTTON: [".actions #previous"],
MAIN_PREVIOUS_BUTTON_ACTIVE: [".actions #previous:active"],
MAIN_PLAY_BUTTON: [".actions #play"],
MAIN_PLAY_BUTTON_ACTIVE: [".actions #play:active"],
MAIN_PAUSE_BUTTON: [".actions #pause"],
MAIN_PAUSE_BUTTON_ACTIVE: [".actions #pause:active"],
MAIN_STOP_BUTTON: [".actions #stop"],
MAIN_STOP_BUTTON_ACTIVE: [".actions #stop:active"],
MAIN_NEXT_BUTTON: [".actions #next"],
MAIN_NEXT_BUTTON_ACTIVE: [".actions #next:active"],
MAIN_EJECT_BUTTON: ["#eject"],
MAIN_EJECT_BUTTON_ACTIVE: ["#eject:active"],
MAIN_WINDOW_BACKGROUND: ["#main-window"],
MAIN_STEREO: [".media-info #stereo", ".stop .media-info #stereo.selected"],
MAIN_STEREO_SELECTED: [".media-info #stereo.selected"],
MAIN_MONO: [".media-info #mono", ".stop .media-info #mono.selected"],
MAIN_MONO_SELECTED: [".media-info #mono.selected"],
NO_MINUS_SIGN: ["#time #minus-sign"],
MINUS_SIGN: ["#time.countdown #minus-sign"],
DIGIT_0: [".digit-0"],
DIGIT_1: [".digit-1"],
DIGIT_2: [".digit-2"],
DIGIT_3: [".digit-3"],
DIGIT_4: [".digit-4"],
DIGIT_5: [".digit-5"],
DIGIT_6: [".digit-6"],
DIGIT_7: [".digit-7"],
DIGIT_8: [".digit-8"],
DIGIT_9: [".digit-9"],
NO_MINUS_SIGN_EX: ["#time #minus-sign"],
MINUS_SIGN_EX: ["#time.countdown #minus-sign"],
DIGIT_0_EX: [".digit-0"],
DIGIT_1_EX: [".digit-1"],
DIGIT_2_EX: [".digit-2"],
DIGIT_3_EX: [".digit-3"],
DIGIT_4_EX: [".digit-4"],
DIGIT_5_EX: [".digit-5"],
DIGIT_6_EX: [".digit-6"],
DIGIT_7_EX: [".digit-7"],
DIGIT_8_EX: [".digit-8"],
DIGIT_9_EX: [".digit-9"],
MAIN_PLAYING_INDICATOR: [".play #play-pause"],
MAIN_PAUSED_INDICATOR: [".pause #play-pause"],
MAIN_STOPPED_INDICATOR: [".stop #play-pause"],
MAIN_NOT_WORKING_INDICATOR: ["#work-indicator"],
MAIN_WORKING_INDICATOR: ["#work-indicator.selected"],
PLAYLIST_TOP_TILE: [".playlist-top-left-fill", ".playlist-top-left-spacer", ".playlist-top-right-fill", ".playlist-top-right-spacer"],
PLAYLIST_TOP_LEFT_CORNER: [".playlist-top-left"],
PLAYLIST_TITLE_BAR: [".playlist-top-title"],
PLAYLIST_TOP_RIGHT_CORNER: [".playlist-top-right"],
PLAYLIST_TOP_TILE_SELECTED: [".selected .playlist-top-left-fill", ".selected .playlist-top-left-spacer", ".selected .playlist-top-right-fill", ".selected .playlist-top-right-spacer"],
PLAYLIST_TOP_LEFT_SELECTED: [".selected .playlist-top-left"],
PLAYLIST_TITLE_BAR_SELECTED: [".selected .playlist-top-title"],
PLAYLIST_TOP_RIGHT_CORNER_SELECTED: [".selected .playlist-top-right"],
PLAYLIST_LEFT_TILE: [".playlist-middle-left"],
PLAYLIST_RIGHT_TILE: [".playlist-middle-right"],
PLAYLIST_SCROLL_HANDLE: [".playlist-scrollbar-handle"],
PLAYLIST_SCROLL_HANDLE_SELECTED: [".playlist-middle-right:active .playlist-scrollbar-handle"],
PLAYLIST_BOTTOM_TILE: [".playlist-bottom"],
PLAYLIST_BOTTOM_LEFT_CORNER: [".playlist-bottom-left"],
PLAYLIST_BOTTOM_RIGHT_CORNER: [".playlist-bottom-right"],
PLAYLIST_VISUALIZER_BACKGROUND: [".playlist-visualizer"],
PLAYLIST_SHADE_BACKGROUND: ["#playlist-window-shade"],
PLAYLIST_SHADE_BACKGROUND_LEFT: ["#playlist-window-shade .left"],
PLAYLIST_SHADE_BACKGROUND_RIGHT: ["#playlist-window-shade .right"],
PLAYLIST_SHADE_BACKGROUND_RIGHT_SELECTED: ["#playlist-window-shade.selected .right"],
PLAYLIST_ADD_MENU_BAR: ["#playlist-add-menu.selected .bar"],
PLAYLIST_ADD_URL: ["#playlist-add-menu .add-url"],
PLAYLIST_ADD_URL_SELECTED: ["#playlist-add-menu .hover .add-url"],
PLAYLIST_ADD_DIR: ["#playlist-add-menu .add-dir"],
PLAYLIST_ADD_DIR_SELECTED: ["#playlist-add-menu .hover .add-dir"],
PLAYLIST_ADD_FILE: ["#playlist-add-menu .add-file"],
PLAYLIST_ADD_FILE_SELECTED: ["#playlist-add-menu .hover .add-file"],
PLAYLIST_REMOVE_MENU_BAR: ["#playlist-remove-menu.selected .bar"],
PLAYLIST_REMOVE_ALL: ["#playlist-remove-menu .remove-all"],
PLAYLIST_REMOVE_ALL_SELECTED: ["#playlist-remove-menu .hover .remove-all"],
PLAYLIST_CROP: ["#playlist-remove-menu .crop"],
PLAYLIST_CROP_SELECTED: ["#playlist-remove-menu .hover .crop"],
PLAYLIST_REMOVE_SELECTED: ["#playlist-remove-menu .remove-selected"],
PLAYLIST_REMOVE_SELECTED_SELECTED: ["#playlist-remove-menu .hover .remove-selected"],
PLAYLIST_REMOVE_MISC: ["#playlist-remove-menu .remove-misc"],
PLAYLIST_REMOVE_MISC_SELECTED: ["#playlist-remove-menu .hover .remove-misc"],
PLAYLIST_SELECT_MENU_BAR: ["#playlist-selection-menu.selected .bar"],
PLAYLIST_INVERT_SELECTION: ["#playlist-selection-menu .invert-selection"],
PLAYLIST_INVERT_SELECTION_SELECTED: ["#playlist-selection-menu .hover .invert-selection"],
PLAYLIST_SELECT_ZERO: ["#playlist-selection-menu .select-zero"],
PLAYLIST_SELECT_ZERO_SELECTED: ["#playlist-selection-menu .hover .select-zero"],
PLAYLIST_SELECT_ALL: ["#playlist-selection-menu .select-all"],
PLAYLIST_SELECT_ALL_SELECTED: ["#playlist-selection-menu .hover .select-all"],
PLAYLIST_CLOSE_SELECTED: ["#playlist-close-button:active"],
PLAYLIST_COLLAPSE_SELECTED: ["#playlist-window #playlist-shade-button:active"],
PLAYLIST_EXPAND_SELECTED: ["#playlist-window-shade #playlist-shade-button:active"],
PLAYLIST_MISC_MENU_BAR: ["#playlist-misc-menu.selected .bar"],
PLAYLIST_MISC_OPTIONS: ["#playlist-misc-menu .misc-options"],
PLAYLIST_MISC_OPTIONS_SELECTED: ["#playlist-misc-menu .hover .misc-options"],
PLAYLIST_FILE_INFO: ["#playlist-misc-menu .file-info"],
PLAYLIST_FILE_INFO_SELECTED: ["#playlist-misc-menu .hover .file-info"],
PLAYLIST_SORT_LIST: ["#playlist-misc-menu .sort-list"],
PLAYLIST_SORT_LIST_SELECTED: ["#playlist-misc-menu .hover .sort-list"],
PLAYLIST_LIST_BAR: ["#playlist-list-menu.selected .bar"],
PLAYLIST_NEW_LIST: ["#playlist-list-menu .new-list"],
PLAYLIST_NEW_LIST_SELECTED: ["#playlist-list-menu .hover .new-list"],
PLAYLIST_LOAD_LIST: ["#playlist-list-menu .load-list"],
PLAYLIST_LOAD_LIST_SELECTED: ["#playlist-list-menu .hover .load-list"],
PLAYLIST_SAVE_LIST: ["#playlist-list-menu .save-list"],
PLAYLIST_SAVE_LIST_SELECTED: ["#playlist-list-menu .hover .save-list"],
EQ_WINDOW_BACKGROUND: ["#equalizer-window:not(.shade)"],
EQ_TITLE_BAR: [".equalizer-top"],
EQ_TITLE_BAR_SELECTED: [".selected .equalizer-top"],
EQ_SLIDER_BACKGROUND: [".band"],
EQ_SLIDER_THUMB: [".band .slider-handle"],
// But the "active" pseudo selector on the parent, since clicking
// anywhere on the track moves the slider.
EQ_SLIDER_THUMB_SELECTED: [".band:active .slider-handle"],
EQ_ON_BUTTON: ["#on"],
EQ_ON_BUTTON_DEPRESSED: ["#on:active"],
EQ_ON_BUTTON_SELECTED: ["#on.selected"],
EQ_ON_BUTTON_SELECTED_DEPRESSED: ["#on.selected:active"],
EQ_AUTO_BUTTON: ["#auto"],
EQ_AUTO_BUTTON_DEPRESSED: ["#auto:active"],
EQ_AUTO_BUTTON_SELECTED: ["#auto.selected"],
EQ_AUTO_BUTTON_SELECTED_DEPRESSED: ["#auto.selected:active"],
EQ_GRAPH_BACKGROUND: ["#eqGraph"],
EQ_PRESETS_BUTTON: ["#presets"],
EQ_PRESETS_BUTTON_SELECTED: ["#presets:active"],
EQ_PREAMP_LINE: ["#preamp-line"],
EQ_SHADE_BACKGROUND: ["#equalizer-window.shade"],
EQ_SHADE_BACKGROUND_SELECTED: ["#equalizer-window.shade.selected"],
EQ_SHADE_VOLUME_SLIDER_LEFT: ["#equalizer-volume.left::-webkit-slider-thumb", "#equalizer-volume.left::-moz-range-thumb"],
EQ_SHADE_VOLUME_SLIDER_CENTER: ["#equalizer-volume.center::-webkit-slider-thumb", "#equalizer-volume.center::-moz-range-thumb"],
EQ_SHADE_VOLUME_SLIDER_RIGHT: ["#equalizer-volume.right::-webkit-slider-thumb", "#equalizer-volume.right::-moz-range-thumb"],
EQ_SHADE_BALANCE_SLIDER_LEFT: ["#equalizer-balance.left::-webkit-slider-thumb", "#equalizer-balance.left::-moz-range-thumb"],
EQ_SHADE_BALANCE_SLIDER_CENTER: ["#equalizer-balance.center::-webkit-slider-thumb", "#equalizer-balance.center::-moz-range-thumb"],
EQ_SHADE_BALANCE_SLIDER_RIGHT: ["#equalizer-balance.right::-webkit-slider-thumb", "#equalizer-balance.right::-moz-range-thumb"],
EQ_MAXIMIZE_BUTTON_ACTIVE: ["#equalizer-shade:active"],
EQ_MINIMIZE_BUTTON_ACTIVE: ["#equalizer-window.shade #equalizer-shade:active"],
EQ_CLOSE_BUTTON: ["#equalizer-window.selected #eq-buttons.clicked #equalizer-close"],
EQ_CLOSE_BUTTON_ACTIVE: ["#equalizer-window.selected #eq-buttons.clicked #equalizer-close:active"],
EQ_SHADE_CLOSE_BUTTON: ["#equalizer-window.shade.selected #eq-buttons.clicked #equalizer-close"],
EQ_SHADE_CLOSE_BUTTON_ACTIVE: ["#equalizer-window.shade.selected #eq-buttons.clicked #equalizer-close:active"],
MAIN_POSITION_SLIDER_BACKGROUND: ["#position"],
MAIN_POSITION_SLIDER_THUMB: ["#position::-webkit-slider-thumb", "#position::-moz-range-thumb"],
MAIN_POSITION_SLIDER_THUMB_SELECTED: ["#position:active::-webkit-slider-thumb", "#position:active::-moz-range-thumb"],
MAIN_SHUFFLE_BUTTON: ["#shuffle"],
MAIN_SHUFFLE_BUTTON_DEPRESSED: ["#shuffle:active"],
MAIN_SHUFFLE_BUTTON_SELECTED: ["#shuffle.selected"],
MAIN_SHUFFLE_BUTTON_SELECTED_DEPRESSED: ["#shuffle.selected:active"],
MAIN_REPEAT_BUTTON: ["#repeat"],
MAIN_REPEAT_BUTTON_DEPRESSED: ["#repeat:active"],
MAIN_REPEAT_BUTTON_SELECTED: ["#repeat.selected"],
MAIN_REPEAT_BUTTON_SELECTED_DEPRESSED: ["#repeat.selected:active"],
MAIN_EQ_BUTTON: ["#equalizer-button"],
MAIN_EQ_BUTTON_SELECTED: ["#equalizer-button.selected"],
MAIN_EQ_BUTTON_DEPRESSED: ["#equalizer-button:active"],
MAIN_EQ_BUTTON_DEPRESSED_SELECTED: ["#equalizer-button.selected:active"],
MAIN_PLAYLIST_BUTTON: ["#playlist-button"],
MAIN_PLAYLIST_BUTTON_SELECTED: ["#playlist-button.selected"],
MAIN_PLAYLIST_BUTTON_DEPRESSED: ["#playlist-button:active"],
MAIN_PLAYLIST_BUTTON_DEPRESSED_SELECTED: ["#playlist-button.selected:active"],
MAIN_TITLE_BAR: ["#title-bar"],
MAIN_TITLE_BAR_SELECTED: [".selected #title-bar"],
MAIN_EASTER_EGG_TITLE_BAR: [".llama #title-bar"],
MAIN_EASTER_EGG_TITLE_BAR_SELECTED: [".llama.selected #title-bar"],
MAIN_OPTIONS_BUTTON: [".selected #title-bar #option.clicked"],
MAIN_OPTIONS_BUTTON_DEPRESSED: [".selected #title-bar #option:active", ".selected #title-bar #option.selected"],
MAIN_MINIMIZE_BUTTON: [".selected #title-bar #minimize.clicked"],
MAIN_MINIMIZE_BUTTON_DEPRESSED: [".selected #title-bar #minimize:active"],
MAIN_SHADE_BUTTON: [".selected #title-bar #shade.clicked"],
MAIN_SHADE_BUTTON_DEPRESSED: [".selected #title-bar #shade:active"],
MAIN_CLOSE_BUTTON: [".selected #title-bar #close.clicked"],
MAIN_CLOSE_BUTTON_DEPRESSED: [".selected #title-bar #close:active"],
MAIN_CLUTTER_BAR_BACKGROUND: ["#clutter-bar"],
MAIN_CLUTTER_BAR_BACKGROUND_DISABLED: ["#clutter-bar.disabled"],
MAIN_CLUTTER_BAR_BUTTON_O_SELECTED: ["#button-o:active", "#button-0.selected"],
MAIN_CLUTTER_BAR_BUTTON_A_SELECTED: ["#button-a:active", "#button-a.selected"],
MAIN_CLUTTER_BAR_BUTTON_I_SELECTED: ["#button-i:active", "#button-i.selected"],
MAIN_CLUTTER_BAR_BUTTON_D_SELECTED: ["#button-d:active", "#button-d.selected"],
MAIN_CLUTTER_BAR_BUTTON_V_SELECTED: ["#button-v:active", "#button-v.selected"],
MAIN_SHADE_BACKGROUND: [".shade #title-bar"],
MAIN_SHADE_BACKGROUND_SELECTED: [".shade.selected #title-bar"],
MAIN_SHADE_BUTTON_SELECTED: [".shade.selected #title-bar #shade"],
MAIN_SHADE_BUTTON_SELECTED_DEPRESSED: [".shade #title-bar #shade:active"],
MAIN_SHADE_POSITION_BACKGROUND: [".shade #position"],
MAIN_SHADE_POSITION_THUMB: [".shade #position::-moz-range-thumb", ".shade #position::-webkit-slider-thumb"],
MAIN_SHADE_POSITION_THUMB_LEFT: [".shade #position.left::-moz-range-thumb", ".shade #position.left::-webkit-slider-thumb"],
MAIN_SHADE_POSITION_THUMB_RIGHT: [".shade #position.right::-moz-range-thumb", ".shade #position.right::-webkit-slider-thumb"],
MAIN_VOLUME_BACKGROUND: ["#volume"],
MAIN_VOLUME_THUMB: ["#volume input::-webkit-slider-thumb", "#volume input::-moz-range-thumb"],
MAIN_VOLUME_THUMB_SELECTED: ["#volume input:active::-webkit-slider-thumb", "#volume input:active::-moz-range-thumb"],
GEN_TOP_CENTER_FILL: [".gen-window .gen-top"],
GEN_TOP_LEFT: [".gen-window .gen-top-left"],
GEN_TOP_LEFT_END: [".gen-window .gen-top-left-end"],
GEN_TOP_RIGHT: [".gen-window .gen-top-right"],
GEN_TOP_RIGHT_END: [".gen-window .gen-top-right-end"],
GEN_TOP_LEFT_RIGHT_FILL: [".gen-window .gen-top-left-fill", ".gen-window .gen-top-right-fill"],
GEN_TOP_CENTER_FILL_SELECTED: [".gen-window.selected .gen-top"],
GEN_TOP_LEFT_SELECTED: [".gen-window.selected .gen-top-left"],
GEN_TOP_LEFT_END_SELECTED: [".gen-window.selected .gen-top-left-end"],
GEN_TOP_RIGHT_SELECTED: [".gen-window.selected .gen-top-right"],
GEN_TOP_RIGHT_END_SELECTED: [".gen-window.selected .gen-top-right-end"],
GEN_TOP_LEFT_RIGHT_FILL_SELECTED: [".gen-window.selected .gen-top-left-fill", ".gen-window.selected .gen-top-right-fill"],
GEN_BOTTOM_LEFT: [".gen-window .gen-bottom-left"],
GEN_BOTTOM_RIGHT: [".gen-window .gen-bottom-right"],
GEN_BOTTOM_FILL: [".gen-window .gen-bottom"],
GEN_MIDDLE_LEFT: [".gen-window .gen-middle-left"],
GEN_MIDDLE_LEFT_BOTTOM: [".gen-window .gen-middle-left-bottom"],
GEN_MIDDLE_RIGHT: [".gen-window .gen-middle-right"],
GEN_MIDDLE_RIGHT_BOTTOM: [".gen-window .gen-middle-right-bottom"],
GEN_CLOSE_SELECTED: [".gen-window .gen-close:active"]
};
Object.keys(FONT_LOOKUP).forEach(character => {
const key = imageConstFromChar(character);
const code = character.charCodeAt(0);
imageSelectors[key] = [`.character-${code}`];
});
LETTERS.forEach(character => {
imageSelectors[`GEN_TEXT_${character}`] = [`.gen-text-${character.toLowerCase()}`];
imageSelectors[`GEN_TEXT_SELECTED_${character}`] = [`.gen-window.selected .gen-text-${character.toLowerCase()}`];
});
const cursorSelectors = {
CLOSE: ["#title-bar #close"],
// This is not quite right. There are some areas that show this cursor
// but are not clickable.
EQSLID: ["#equalizer-window .band"],
EQNORMAL: ["#equalizer-window"],
EQCLOSE: ["#equalizer-window #equalizer-close"],
EQTITLE: ["#equalizer-window .title-bar", "#equalizer-window.shade", "#equalizer-window.shade input"],
MAINMENU: ["#main-window #option", "#webamp-context-menu .context-menu"],
MIN: ["#main-window #minimize"],
NORMAL: [// Use this as the default cursor.
".window", ".window input", // Otherwise
"#main-window", "#main-window.shade #title-bar"],
MMENU: ["#main-window.shade #option"],
PNORMAL: ["#playlist-window"],
// TODO: This is should really only apply to the top part of the top.
// The chrome around the playlist window is larger than others. The
// cursor only applies to the same height as the other window's chrome.
PTBAR: ["#playlist-window .playlist-top"],
PCLOSE: ["#playlist-window #playlist-close-button", "#playlist-window-shade #playlist-close-button"],
PWINBUT: ["#playlist-window #playlist-shade-button", "#playlist-window-shade #playlist-shade-button"],
POSBAR: ["#main-window #position"],
PSIZE: ["#playlist-window #playlist-resize-target"],
PWSSIZE: ["#playlist-window-shade #playlist-resize-target"],
PWSNORM: ["#playlist-window-shade"],
// TODO: The target for this is not quite right.
PVSCROLL: ["#playlist-window .playlist-scrollbar"],
SONGNAME: ["#main-window #marquee"],
TITLEBAR: ["#main-window #title-bar"],
VOLBAL: ["#volume", "#volume input", "#balance"],
WINBUT: ["#main-window #shade"],
WSNORMAL: ["#main-window.shade #title-bar"],
WSPOSBAR: ["#main-window.shade #position"]
};
// CONCATENATED MODULE: ./js/components/Css.tsx
function Css({
children,
id
}) {
const style = Object(react["useMemo"])(() => {
const s = document.createElement("style");
s.type = "text/css";
s.id = id;
return s;
}, [id]);
Object(react["useLayoutEffect"])(() => {
document.head.appendChild(style);
return () => style.remove();
}, [style]);
return Object(react_dom["createPortal"])(children, style);
}
// CONCATENATED MODULE: ./js/components/ClipPaths.tsx
// this.props.children should be an object containing arrays of strings. The
// keys are ids, and the arrays are arrays of polygon point strings
function ClipPaths({
children
}) {
const paths = Object(react["useMemo"])(() => {
return document.createElement("div");
}, []);
Object(react["useLayoutEffect"])(() => {
document.body.appendChild(paths);
return () => paths.remove();
}, [paths]);
return Object(react_dom["createPortal"])( /*#__PURE__*/Object(jsx_runtime["jsx"])("svg", {
height: 0,
width: 0,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("defs", {
children: Object.keys(children).map(id => /*#__PURE__*/Object(jsx_runtime["jsx"])("clipPath", {
id: id,
children: children[id].map((points, i) => /*#__PURE__*/Object(jsx_runtime["jsx"])("polygon", {
points: points
}, i))
}, id))
})
}), paths);
}
// EXTERNAL MODULE: ./node_modules/ani-cursor/dist/index.js
var dist = __webpack_require__(42);
// CONCATENATED MODULE: ./js/components/Skin.tsx
// Dynamically set the css background images for all the sprites
const CSS_PREFIX = "#webamp";
const mapRegionNamesToIds = {
normal: "mainWindowClipPath",
windowshade: "shadeMainWindowClipPath",
equalizer: "equalizerWindowClipPath",
equalizerws: "shadeEqualizerWindowClipPath"
};
const mapRegionNamesToMatcher = {
normal: "#main-window:not(.shade)",
windowshade: "#main-window.shade",
equalizer: "#equalizer-window:not(.shade)",
equalizerws: "#equalizer-window.shade"
};
const numExIsUsed = skinImages => Boolean(skinImages.DIGIT_0_EX);
const FALLBACKS = {
MAIN_BALANCE_BACKGROUND: "MAIN_VOLUME_BACKGROUND",
MAIN_BALANCE_THUMB: "MAIN_VOLUME_THUMB",
MAIN_BALANCE_THUMB_ACTIVE: "MAIN_VOLUME_THUMB_SELECTED",
EQ_MAXIMIZE_BUTTON_ACTIVE: "EQ_MAXIMIZE_BUTTON_ACTIVE_FALLBACK"
}; // Cursors might appear in context menus which are not nested inside the window layout div.
function normalizeCursorSelector(selector) {
return `${// TODO: Fix this hack
// Maybe our CSS name spacing should be based on some other class/id
// than the one we use for defining the main div.
// That way it could be shared by both the player and the context menu.
selector.startsWith("#webamp-context-menu") ? "" : CSS_PREFIX} ${selector}`;
}
const getCssRules = Object(lib["createSelector"])(getSkinImages, getSkinCursors, getSkinLetterWidths, getSkinRegion, (skinImages, skinCursors, skinGenLetterWidths, skinRegion) => {
if (!skinImages || !skinCursors) {
return null;
}
const cssRules = [];
Object.keys(imageSelectors).forEach(imageName => {
const imageUrl = skinImages[imageName] || skinImages[FALLBACKS[imageName]];
if (imageUrl) {
imageSelectors[imageName].forEach(selector => {
cssRules.push(`${CSS_PREFIX} ${selector} {background-image: url(${imageUrl})}`);
});
}
});
if (skinGenLetterWidths != null) {
LETTERS.forEach(letter => {
const width = skinGenLetterWidths[`GEN_TEXT_${letter}`];
const selectedWidth = skinGenLetterWidths[`GEN_TEXT_SELECTED_${letter}`];
cssRules.push(`${CSS_PREFIX} .gen-text-${letter.toLowerCase()} {width: ${width}px;}`);
cssRules.push(`${CSS_PREFIX} .selected .gen-text-${letter.toLowerCase()} {width: ${selectedWidth}px;}`);
});
}
Object.entries(cursorSelectors).forEach(([cursorName, cursorSelector]) => {
const cursor = skinCursors[cursorName];
if (cursor == null) {
return;
}
const cursorRules = cursorSelector.map(normalizeCursorSelector).map(selector => {
switch (cursor.type) {
case "cur":
return `${selector} {cursor: url(${cursor.url}), auto}`;
case "ani":
{
try {
return Object(dist["convertAniBinaryToCSS"])(selector, cursor.aniData);
} catch (e) {
console.error(e);
return null;
}
}
}
}).filter(Boolean);
cssRules.push(...cursorRules);
});
if (numExIsUsed(skinImages)) {
// This alternate number file requires that the minus sign be
// formatted differently.
cssRules.push(`${CSS_PREFIX} .webamp-status #time #minus-sign { top: 0px; left: -1px; width: 9px; height: 13px; }`);
}
for (const [regionName, polygons] of Object.entries(skinRegion)) {
if (polygons) {
const matcher = mapRegionNamesToMatcher[regionName];
const id = mapRegionNamesToIds[regionName];
cssRules.push(`${CSS_PREFIX} ${matcher} { clip-path: url(#${id}); }`);
}
}
return cssRules.join("\n");
});
const getClipPaths = Object(lib["createSelector"])(getSkinRegion, skinRegion => {
const clipPaths = {};
for (const [regionName, polygons] of Object.entries(skinRegion)) {
if (polygons) {
const id = mapRegionNamesToIds[regionName];
clipPaths[id] = polygons;
}
}
return clipPaths;
});
function Skin() {
const cssRules = useTypedSelector(getCssRules);
const clipPaths = useTypedSelector(getClipPaths);
if (cssRules == null) {
return null;
}
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(jsx_runtime["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Css, {
id: "webamp-skin",
children: cssRules
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ClipPaths, {
children: clipPaths
})]
});
}
// EXTERNAL MODULE: ./css/webamp.css
var webamp = __webpack_require__(98);
// CONCATENATED MODULE: ./js/components/App.tsx
/**
* Constructs the windows to render
*/
function App({
media,
filePickers
}) {
const closed = useTypedSelector(getClosed);
const genWindowsInfo = useTypedSelector(getGenWindows);
const zIndex = useTypedSelector(getZIndex);
const browserWindowSizeChanged = useActionCreator(windows_browserWindowSizeChanged);
const setFocusedWindow = useActionCreator(windows_setFocusedWindow);
const [webampNode] = Object(react["useState"])(() => {
const node = document.createElement("div");
node.id = "webamp"; // @ts-ignore I think I'm supposed to set this with setAttribute, but I can't confirm.
node.role = "application";
return node;
});
Object(react["useLayoutEffect"])(() => {
webampNode.style.zIndex = String(zIndex);
}, [webampNode, zIndex]);
Object(react["useLayoutEffect"])(() => {
document.body.appendChild(webampNode);
return () => {
document.body.removeChild(webampNode);
};
}, [webampNode]);
Object(react["useEffect"])(() => {
const handleWindowResize = () => {
if (webampNode == null) {
return;
} // It's a bit tricky to measure the "natural" size of the browser window.
// Specifically we want to know how large the window would be without our
// own Webamp windows influencing it. To achieve this, we temporarily make
// our container `overflow: hidden;`. We then make our container full
// screen by setting the bottom/right properties to zero. This second part
// allows our Webamp windows to stay visible during the resize. After we
// measure, we set the style back so that we don't end up interfering with
// click events outside of our Webamp windows.
webampNode.style.right = "0";
webampNode.style.bottom = "0";
webampNode.style.overflow = "hidden";
browserWindowSizeChanged(utils_getWindowSize());
webampNode.style.right = "auto";
webampNode.style.bottom = "auto";
webampNode.style.overflow = "visible";
};
handleWindowResize();
window.addEventListener("resize", handleWindowResize);
return () => {
window.removeEventListener("resize", handleWindowResize);
};
}, [browserWindowSizeChanged, webampNode]);
const renderWindows = Object(react["useCallback"])(() => {
return objectMap(genWindowsInfo, (w, id) => {
if (!w.open) {
return null;
}
switch (id) {
case WINDOWS.MAIN:
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_MainWindow, {
analyser: media.getAnalyser(),
filePickers: filePickers
});
case WINDOWS.EQUALIZER:
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_EqualizerWindow, {});
case WINDOWS.PLAYLIST:
return /*#__PURE__*/Object(jsx_runtime["jsx"])(components_PlaylistWindow, {
analyser: media.getAnalyser()
});
case WINDOWS.MILKDROP:
return /*#__PURE__*/Object(jsx_runtime["jsx"])(MilkdropWindow, {
analyser: media.getAnalyser()
});
default:
throw new Error(`Tried to render an unknown window: ${id}`);
}
});
}, [media, filePickers, genWindowsInfo]);
const handleBlur = e => {
if (!e.currentTarget.contains(e.relatedTarget)) {
setFocusedWindow(null);
}
};
if (closed) {
return null;
}
return react_dom_default.a.createPortal( /*#__PURE__*/Object(jsx_runtime["jsx"])(react["StrictMode"], {
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
onBlur: handleBlur,
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Skin, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ContextMenuWraper, {
renderContents: () => /*#__PURE__*/Object(jsx_runtime["jsx"])(MainWindow_MainContextMenu, {
filePickers: filePickers
}),
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(WindowManager, {
windows: renderWindows()
})
})]
})
}), webampNode);
}
// CONCATENATED MODULE: ./js/hotkeys.ts
const IGNORE_EVENTS_FROM_TAGS = new Set(["input", "textarea", "select"]);
function bindHotkeys(dispatch) {
let currentPos = 0;
const trigger = [78, // N
85, // U
76, // L
76, // L
83, // S
79, // O
70, // F
84 // T
];
const listener = e => {
if (e.target instanceof Element && IGNORE_EVENTS_FROM_TAGS.has(e.target.tagName.toLowerCase())) {
return;
}
if (e.ctrlKey) {
switch (e.keyCode) {
case 68:
// CTRL+D
dispatch(windows_toggleDoubleSizeMode());
e.preventDefault(); // Supress the "Bookmark" action on windows.
break;
case 76:
// CTRL+L FIXME
break;
case 82:
// CTRL+R
dispatch(playlist_reverseList());
break;
case 84:
// CTRL+T
dispatch({
type: TOGGLE_TIME_MODE
});
break;
}
} else if (e.altKey) {
switch (e.keyCode) {
case 87:
// ALT+W
dispatch(windows_toggleWindow("main"));
break;
case 69:
// ALT+E
dispatch(windows_toggleWindow("playlist"));
break;
case 71:
// ALT+G
dispatch(windows_toggleWindow("equalizer"));
break;
}
} else {
switch (e.keyCode) {
case 37:
// left arrow
dispatch(media_seekBackward(5));
break;
case 38:
// up arrow
dispatch(adjustVolume(1));
break;
case 39:
// right arrow
dispatch(media_seekForward(5));
break;
case 40:
// down arrow
dispatch(adjustVolume(-1));
break;
case 66:
// B
dispatch(media_next());
break;
case 67:
// C
dispatch(media_pause());
break;
case 76:
// L
dispatch(files_openMediaFileDialog());
break;
case 82:
// R
dispatch(media_toggleRepeat());
break;
case 83:
// S
dispatch(media_toggleShuffle());
break;
case 86:
// V
dispatch(media_stop());
break;
case 88:
// X
dispatch(media_play());
break;
case 90:
// Z
dispatch(media_previous());
break;
case 96:
// numpad 0
dispatch(files_openMediaFileDialog());
break;
case 97:
// numpad 1
dispatch(media_nextN(-10));
break;
case 98:
// numpad 2
dispatch(adjustVolume(-1));
break;
case 99:
// numpad 3
dispatch(media_nextN(10));
break;
case 100:
// numpad 4
dispatch(media_previous());
break;
case 101:
// numpad 5
dispatch(media_play());
break;
case 102:
// numpad 6
dispatch(media_next());
break;
case 103:
// numpad 7
dispatch(media_seekBackward(5));
break;
case 104:
// numpad 8
dispatch(adjustVolume(1));
break;
case 105:
// numpad 9
dispatch(media_seekForward(5));
break;
}
} // Easter Egg
// Ignore escape. Usually this gets swallowed by the browser, but not always.
if (e.keyCode !== 27) {
currentPos = e.keyCode === trigger[currentPos] ? currentPos + 1 : 0;
if (currentPos === trigger.length) {
dispatch({
type: TOGGLE_LLAMA_MODE
});
}
}
};
document.addEventListener("keydown", listener);
return () => {
document.removeEventListener("keydown", listener);
};
}
// CONCATENATED MODULE: ./js/emitter.ts
class emitter_Emitter {
constructor() {
defineProperty_default()(this, "_listeners", void 0);
this._listeners = {};
}
on(event, callback) {
const eventListeners = this._listeners[event] || [];
eventListeners.push(callback);
this._listeners[event] = eventListeners;
const unsubscribe = () => {
this._listeners[event] = eventListeners.filter(cb => cb !== callback);
};
return unsubscribe;
}
trigger(event, ...args) {
const callbacks = this._listeners[event];
if (callbacks) {
callbacks.forEach(cb => cb(...args));
}
}
dispose() {
this._listeners = {};
}
}
// CONCATENATED MODULE: ./js/media/StereoBalanceNode.js
// The Web Audio API does not offer an easy way to make a stereo balance
// control. This is an attempt to fill that void, using an API similar to
// [StereoPannerNode](https://developer.mozilla.org/en-US/docs/Web/API/StereoPannerNode)
function StereoBalanceNode(context, options = {
balance: 0
}) {
let balance = 0; // ChannelSplitterNode cannot be told to use a `channelInterperatation` of
// "speakers". This means that if we get a mono file, we will end up only
// playing in the left speaker. So instead we use this dummy gain node to
// convert whatever source we get (stereo, mono, or n channels) into a stereo
// signal.
// Idea credit: https://github.com/WebAudio/web-audio-api/issues/975#issue-177242377
const upMixer = context.createGain();
upMixer.channelCount = 2;
upMixer.channelCountMode = "explicit";
upMixer.channelInterpretation = "speakers";
const splitter = context.createChannelSplitter(2); // Create the gains for left and right
const leftGain = context.createGain();
const rightGain = context.createGain();
const merger = context.createChannelMerger(2);
upMixer.connect(splitter);
splitter.connect(leftGain, 0);
splitter.connect(rightGain, 1);
leftGain.connect(merger, 0, 0);
rightGain.connect(merger, 0, 1); // -1 (left) to 1 (right)
function set(rawValue) {
const value = Number(rawValue);
leftGain.gain.value = value > 0 ? 1 - value : 1;
rightGain.gain.value = value > 0 ? 1 : 1 + value;
balance = value;
}
function get() {
return balance;
} // Create our own version of an [AudioParam](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam).
// We don't currently support any of the "over time" methods, but maybe some day
// we'll want to.
const audioParam = {};
Object.defineProperties(audioParam, {
value: {
get,
set,
enumerable: true,
configurable: true
}
}); // The way the `.connect` API works, we can't actually construct our own
// AudioNode. Instead we have to take an existing node and monkey patch it.
Object.defineProperties(upMixer, {
balance: {
value: audioParam,
enumerable: true,
writable: false,
configurable: true
},
connect: {
value: AudioNode.prototype.connect.bind(merger),
enumerable: false,
writable: false,
configurable: true
},
disconnect: {
value: AudioNode.prototype.disconnect.bind(merger),
enumerable: false,
writable: false,
configurable: true
}
});
if (balance !== options.balance) {
set(options.balance);
}
return upMixer;
}
// CONCATENATED MODULE: ./js/media/elementSource.ts
class elementSource_ElementSource {
on(eventType, cb) {
return this._emitter.on(eventType, cb);
}
constructor(context, destination) {
defineProperty_default()(this, "_emitter", void 0);
defineProperty_default()(this, "_context", void 0);
defineProperty_default()(this, "_source", void 0);
defineProperty_default()(this, "_destination", void 0);
defineProperty_default()(this, "_audio", void 0);
defineProperty_default()(this, "_stalled", void 0);
defineProperty_default()(this, "_status", void 0);
this._emitter = new emitter_Emitter();
this._context = context;
this._destination = destination;
this._audio = document.createElement("audio");
this._audio.crossOrigin = "anonymous";
this._stalled = false;
this._status = MEDIA_STATUS.STOPPED; // TODO: #leak
this._audio.addEventListener("suspend", () => {
this._setStalled(true);
}); // TODO: #leak
this._audio.addEventListener("durationchange", () => {
this._emitter.trigger("loaded");
this._setStalled(false);
}); // TODO: #leak
this._audio.addEventListener("ended", () => {
this._emitter.trigger("ended");
this._setStatus(MEDIA_STATUS.STOPPED);
}); // TODO: Throttle to 50 (if needed)
// TODO: #leak
this._audio.addEventListener("timeupdate", () => {
this._emitter.trigger("positionChange");
}); // TODO: #leak
this._audio.addEventListener("error", e => {
switch (this._audio.error.code) {
case 1:
// The fetching of the associated resource was aborted by the user's request.
console.error("MEDIA_ERR_ABORTED", e);
break;
case 2:
console.error("MEDIA_ERR_NETWORK", e); // Some kind of network error occurred which prevented the media from being successfully fetched, despite having previously been available.
break;
case 3:
// Despite having previously been determined to be usable, an error occurred while trying to decode the media resource, resulting in an error.
// There is a bug in Chrome where improperly terminated mp3s can cuase this error.
// https://bugs.chromium.org/p/chromium/issues/detail?id=794782
// Related: Commit f44e826c83c74fef04c2c448af30cfb353b28312
console.error("PIPELINE_ERROR_DECODE", e);
break;
case 4:
console.error("MEDIA_ERR_SRC_NOT_SUPPORTED", e); // The associated resource or media provider object (such as a MediaStream) has been found to be unsuitable.
break;
} // Rather than just geting stuck in this error state, we can just pretend this is
// the end of the track.
this._emitter.trigger("ended");
this._setStatus(MEDIA_STATUS.STOPPED);
});
this._source = this._context.createMediaElementSource(this._audio);
this._source.connect(destination);
}
_setStalled(stalled) {
this._stalled = stalled;
this._emitter.trigger("stallChanged");
}
disconnect() {
this._source.disconnect();
} // Async for now, for compatibility with BufferAudioSource
// TODO: This does not need to be async
async loadUrl(url) {
this._audio.src = url;
}
async play() {
if (this._status !== MEDIA_STATUS.PAUSED) {
this.seekToTime(0);
}
try {
await this._audio.play(); // TODO #race
} catch (err) {//
}
this._setStatus(MEDIA_STATUS.PLAYING);
}
pause() {
this._audio.pause();
this._setStatus(MEDIA_STATUS.PAUSED);
}
stop() {
this._audio.pause();
this._audio.currentTime = 0;
this._setStatus(MEDIA_STATUS.STOPPED);
}
seekToTime(time) {
/* TODO: We could check if this is actually seekable:
const { seekable } = this._audio;
for (let i = 0; i < seekable.length; i++) {
console.log("start", seekable.start(i), "end", seekable.end(i));
}
*/
this._audio.currentTime = clamp(time, 0, this.getDuration());
this._emitter.trigger("positionChange");
}
getStalled() {
return this._stalled;
}
getStatus() {
return this._status;
}
getDuration() {
const {
duration
} = this._audio; // Safari on iOS currently has a strange behavior where it reports
// the duration as infinity if an Accept-Ranges header is not returned.
// For now, 0 is better even though it's still wrong.
return isNaN(duration) || duration === Infinity ? 0 : duration;
}
getTimeElapsed() {
return this._audio.currentTime;
}
_setStatus(status) {
this._status = status;
this._emitter.trigger("statusChange");
}
dispose() {
// TODO: Dispose subscriptions to this.audio
this.stop();
this._emitter.dispose();
}
}
// CONCATENATED MODULE: ./js/media/index.ts
/* Emulate the native <audio> element with Web Audio API */
// NOTE: While this is not technically a public API, https://winampify.io/ is
// replacing this class with a custom version. Breaking changes to this API
// surface should be communicated to Remi.
class media_Media {
constructor() {
defineProperty_default()(this, "_emitter", void 0);
defineProperty_default()(this, "_context", void 0);
defineProperty_default()(this, "_balance", void 0);
defineProperty_default()(this, "_staticSource", void 0);
defineProperty_default()(this, "_preamp", void 0);
defineProperty_default()(this, "_analyser", void 0);
defineProperty_default()(this, "_gainNode", void 0);
defineProperty_default()(this, "_source", void 0);
defineProperty_default()(this, "_bands", void 0);
this._emitter = new emitter_Emitter(); // @ts-ignore Typescript does not know about webkitAudioContext
this._context = new (window.AudioContext || window.webkitAudioContext)(); // Fix for iOS and Chrome (Canary) which require that the context be created
// or resumed by a user interaction.
// https://developers.google.com/web/updates/2017/09/autoplay-policy-changes
// https://gist.github.com/laziel/7aefabe99ee57b16081c
// Via: https://stackoverflow.com/a/43395068/1263117
// TODO #leak
if (this._context.state === "suspended") {
const resume = async () => {
await this._context.resume();
if (this._context.state === "running") {
// TODO: Add this to the disposable
document.body.removeEventListener("touchend", resume, false);
document.body.removeEventListener("click", resume, false);
document.body.removeEventListener("keydown", resume, false);
}
};
document.body.addEventListener("touchend", resume, false);
document.body.addEventListener("click", resume, false);
document.body.addEventListener("keydown", resume, false);
} // TODO: Maybe we can get rid of this now that we are using AudioAbstraction?
this._staticSource = this._context.createGain(); // Just a noop node
// @ts-ignore The way this class has to be monkey patched, makes it very hard to type.
this._balance = new StereoBalanceNode(this._context); // Create the preamp node
this._preamp = this._context.createGain(); // Create the analyser node for the visualizer
this._analyser = this._context.createAnalyser();
this._analyser.fftSize = 2048; // don't smooth audio analysis
this._analyser.smoothingTimeConstant = 0.0; // Create the gain node for the volume control
this._gainNode = this._context.createGain(); // Connect all the nodes in the correct way
// (Note, source is created and connected later)
//
// <source>
// |
// |_____________
// | \
// <preamp> |
// | | <-- Optional bypass
// [...biquadFilters] |
// |_____________/
// |
// <staticSource>
// |
// <balance>
// |
// |\
// | <analyser>
// <gain>
// |
// <destination>
this._source = new elementSource_ElementSource(this._context, this._staticSource);
this._source.on("positionChange", () => {
this._emitter.trigger("timeupdate");
});
this._source.on("ended", () => {
this._emitter.trigger("ended");
});
this._source.on("statusChange", () => {
switch (this._source.getStatus()) {
case MEDIA_STATUS.PLAYING:
this._emitter.trigger("playing");
break;
}
this._emitter.trigger("timeupdate");
});
this._source.on("loaded", () => {
this._emitter.trigger("fileLoaded");
});
this._staticSource.connect(this._preamp);
let output = this._preamp;
this._bands = {};
BANDS.forEach((band, i) => {
const filter = this._context.createBiquadFilter();
this._bands[band] = filter;
if (i === 0) {
// The first filter, includes all lower frequencies
filter.type = "lowshelf";
} else if (i === BANDS.length - 1) {
// The last filter, includes all higher frequencies
filter.type = "highshelf";
} else {
filter.type = "peaking";
}
filter.frequency.value = band;
filter.gain.value = 0;
output.connect(filter);
output = filter;
});
output.connect(this._balance);
this._balance.connect(this._gainNode);
this._balance.connect(this._analyser);
this._gainNode.connect(this._context.destination);
}
getAnalyser() {
return this._analyser;
}
/* Properties */
duration() {
return this._source.getDuration();
}
timeElapsed() {
return this._source.getTimeElapsed();
}
timeRemaining() {
return this.duration() - this.timeElapsed();
}
percentComplete() {
return this.timeElapsed() / this.duration() * 100;
}
/* Actions */
async play() {
await this._source.play();
}
pause() {
this._source.pause();
}
stop() {
this._source.stop();
}
/* Actions with arguments */
seekToPercentComplete(percent) {
const seekTime = this.duration() * (percent / 100);
this.seekToTime(seekTime);
} // From 0-1
setVolume(volume) {
this._gainNode.gain.value = volume / 100;
} // from 0 to 100
// The input value here is 0-100 which is kinda wrong, since it represents -12db to 12db.
// For now, 50 is 0db (no change).
// Equation used is: 10^((dB)/20) = x, where x (preamp.gain.value) is passed on to gainnode for boosting or attenuation.
setPreamp(value) {
const db = value / 100 * 24 - 12;
this._preamp.gain.value = Math.pow(10, db / 20);
} // From -100 to 100
setBalance(balance) {
// Yo Dawg.
this._balance.balance.value = balance / 100;
}
setEqBand(band, value) {
const db = value / 100 * 24 - 12;
this._bands[band].gain.value = db;
}
disableEq() {
this._staticSource.disconnect();
this._staticSource.connect(this._balance);
}
enableEq() {
this._staticSource.disconnect();
this._staticSource.connect(this._preamp);
}
/* Listeners */
on(event, callback) {
this._emitter.on(event, callback);
}
seekToTime(time) {
this._source.seekToTime(time);
} // Used only for the initial load, since it must have a CORS header
async loadFromUrl(url, autoPlay) {
this._emitter.trigger("waiting");
await this._source.loadUrl(url); // TODO #race
this._emitter.trigger("stopWaiting");
if (autoPlay) {
this.play();
}
}
dispose() {
this._source.dispose();
this._emitter.dispose();
}
}
// EXTERNAL MODULE: ./css/base-skin.css
var base_skin = __webpack_require__(100);
// CONCATENATED MODULE: ./js/Disposable.ts
class Disposable_Disposable {
constructor() {
defineProperty_default()(this, "_teardowns", []);
defineProperty_default()(this, "disposed", void 0);
this.disposed = false;
}
add(...teardowns) {
if (this.disposed) {
throw new Error("Attempted to add a new teardown to a disposed disposable.");
}
this._teardowns.push(...teardowns);
}
dispose() {
if (this.disposed) {
throw new Error("Attempted to dispose disposable which is already disposed.");
}
this._teardowns.forEach(teardown => {
if (typeof teardown === "function") {
teardown();
} else if (typeof teardown.dispose === "function") {
teardown.dispose();
}
});
this._teardowns = [];
this.disposed = true;
}
}
// CONCATENATED MODULE: ./js/webampLazy.tsx
// Return a promise that resolves when the store matches a predicate.
// TODO #leak
const storeHas = (store, predicate) => new Promise(resolve => {
if (predicate(store.getState())) {
resolve();
return;
}
const unsubscribe = store.subscribe(() => {
if (predicate(store.getState())) {
resolve();
unsubscribe();
}
});
});
class webampLazy_Webamp {
// TODO: Make this _private
// TODO: Make this _private
// TODO: Make this _private
static browserIsSupported() {
const supportsAudioApi = !!(window.AudioContext || // @ts-ignore
window.webkitAudioContext);
const supportsCanvas = !!window.document.createElement("canvas").getContext;
const supportsPromises = typeof Promise !== "undefined";
return supportsAudioApi && supportsCanvas && supportsPromises;
}
constructor(options) {
defineProperty_default()(this, "_actionEmitter", void 0);
defineProperty_default()(this, "_node", void 0);
defineProperty_default()(this, "_disposable", void 0);
defineProperty_default()(this, "options", void 0);
defineProperty_default()(this, "media", void 0);
defineProperty_default()(this, "store", void 0);
this._node = null;
this._disposable = new Disposable_Disposable();
this._actionEmitter = new emitter_Emitter();
this.options = options;
const {
initialTracks,
initialSkin,
avaliableSkins,
// Old misspelled name
availableSkins,
enableHotkeys = false,
zIndex,
requireJSZip,
requireMusicMetadata,
handleTrackDropEvent,
handleAddUrlEvent,
handleLoadListEvent,
handleSaveListEvent,
__butterchurnOptions,
__customMediaClass
} = this.options; // TODO: Make this much cleaner
let convertPreset = null;
if (__butterchurnOptions != null) {
const {
importConvertPreset,
presetConverterEndpoint
} = __butterchurnOptions;
if (importConvertPreset != null && presetConverterEndpoint != null) {
convertPreset = async file => {
const {
convertPreset: convert
} = await importConvertPreset();
return convert(await genStringFromFileReference(file), presetConverterEndpoint);
};
}
} // TODO: Validate required options
this.media = new (__customMediaClass || media_Media)();
this.store = js_store(this.media, this._actionEmitter, this.options.__customMiddlewares, this.options.__initialState, {
requireJSZip,
requireMusicMetadata,
convertPreset,
// @ts-ignore Typescript is drunk
handleTrackDropEvent,
handleAddUrlEvent,
handleLoadListEvent,
handleSaveListEvent
});
if (navigator.onLine) {
this.store.dispatch({
type: NETWORK_CONNECTED
});
} else {
this.store.dispatch({
type: NETWORK_DISCONNECTED
});
}
if (zIndex != null) {
this.store.dispatch({
type: SET_Z_INDEX,
zIndex
});
}
if (options.__butterchurnOptions) {
this.store.dispatch({
type: ENABLE_MILKDROP,
open: options.__butterchurnOptions.butterchurnOpen
});
this.store.dispatch(initializePresets(options.__butterchurnOptions));
}
const handleOnline = () => this.store.dispatch({
type: NETWORK_CONNECTED
});
const handleOffline = () => this.store.dispatch({
type: NETWORK_DISCONNECTED
});
window.addEventListener("online", handleOnline);
window.addEventListener("offline", handleOffline);
this._disposable.add(() => {
window.removeEventListener("online", handleOnline);
window.removeEventListener("offline", handleOffline);
});
if (initialSkin) {
this.store.dispatch(setSkinFromUrl(initialSkin.url));
} else {
// We are using the default skin.
this.store.dispatch({
type: LOADED
});
}
if (initialTracks) {
this._bufferTracks(initialTracks);
}
if (avaliableSkins != null) {
console.warn("The misspelled option `avaliableSkins` is deprecated. Please use `availableSkins` instead.");
this.store.dispatch({
type: SET_AVAILABLE_SKINS,
skins: avaliableSkins
});
} else if (availableSkins != null) {
this.store.dispatch({
type: SET_AVAILABLE_SKINS,
skins: availableSkins
});
}
const layout = options.__initialWindowLayout;
if (layout == null) {
this.store.dispatch(stackWindows());
} else {
objectForEach(layout, (w, windowId) => {
if (w.size != null) {
this.store.dispatch(windows_setWindowSize(windowId, w.size));
}
});
this.store.dispatch(windows_updateWindowPositions(objectMap(layout, w => w.position), false));
}
if (enableHotkeys) {
this._disposable.add(bindHotkeys(this.store.dispatch));
}
}
play() {
this.store.dispatch(media_play());
}
pause() {
this.store.dispatch(media_pause());
}
stop() {
this.store.dispatch(media_stop());
}
seekBackward(seconds) {
this.store.dispatch(media_seekBackward(seconds));
}
seekForward(seconds) {
this.store.dispatch(media_seekForward(seconds));
}
seekToTime(seconds) {
this.store.dispatch(seekToTime(seconds));
}
nextTrack() {
this.store.dispatch(media_next());
}
previousTrack() {
this.store.dispatch(media_previous());
}
_bufferTracks(tracks) {
const nextIndex = getTrackCount(this.store.getState());
this.store.dispatch(files_loadMediaFiles(tracks, LOAD_STYLE.BUFFER, nextIndex));
} // Append this array of tracks to the end of the current playlist.
appendTracks(tracks) {
const nextIndex = getTrackCount(this.store.getState());
this.store.dispatch(files_loadMediaFiles(tracks, LOAD_STYLE.NONE, nextIndex));
} // Replace any existing tracks with this array of tracks, and begin playing.
setTracksToPlay(tracks) {
this.store.dispatch(files_loadMediaFiles(tracks, LOAD_STYLE.PLAY));
}
getMediaStatus() {
return getMediaStatus(this.store.getState());
}
onWillClose(cb) {
return this._actionEmitter.on(CLOSE_REQUESTED, action => {
cb(action.cancel);
});
}
onClose(cb) {
return this._actionEmitter.on(CLOSE_WINAMP, cb);
}
close() {
this.store.dispatch(actionCreators_close());
}
reopen() {
this.store.dispatch(actionCreators_open());
}
onTrackDidChange(cb) {
let previousTrackId = null; // TODO #leak
return this.store.subscribe(() => {
const state = this.store.getState();
const trackId = getCurrentlyPlayingTrackIdIfLoaded(state);
if (trackId === previousTrackId) {
return;
}
previousTrackId = trackId;
cb(trackId == null ? null : getCurrentTrackInfo(state));
});
}
onMinimize(cb) {
return this._actionEmitter.on(MINIMIZE_WINAMP, cb);
}
setSkinFromUrl(url) {
this.store.dispatch(setSkinFromUrl(url));
}
async skinIsLoaded() {
// Wait for the skin to load.
// TODO #leak
await storeHas(this.store, state => !state.display.loading); // We attempt to pre-resolve these promises before we declare the skin
// loaded. That's because `<EqGraph>` needs these in order to render fully.
// As long as these are resolved before we attempt to render, we can ensure
// that we will have all the data we need on first paint.
//
// Note: This won't help for non-initial skin loads.
await Promise.all([getPreampLineImage(this.store.getState()), getLineColorsImage(this.store.getState())]);
return;
}
__loadSerializedState(serializedState) {
this.store.dispatch(loadSerializedState(serializedState));
}
__getSerializedState() {
return getSerlializedState(this.store.getState());
}
__onStateChange(cb) {
// TODO #leak
return this.store.subscribe(cb);
}
async renderWhenReady(node) {
this.store.dispatch(centerWindowsInContainer(node));
await this.skinIsLoaded(); // TODO #race We may have been destroyed
if (this._node != null) {
throw new Error("Cannot render a Webamp instance twice");
}
this._node = node;
this._disposable.add(() => {
if (this._node != null) {
react_dom_default.a.unmountComponentAtNode(this._node);
this._node = null;
}
});
react_dom_default.a.render( /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Provider, {
store: this.store,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(App, {
media: this.media,
filePickers: this.options.filePickers || []
})
}), node);
}
dispose() {
// TODO: Clean up store subscription in onTrackDidChange
// TODO: Every storeHas call represents a potential race condition
this.media.dispose();
this._actionEmitter.dispose();
this._disposable.dispose();
}
}
defineProperty_default()(webampLazy_Webamp, "VERSION", "1.5.0");
/* harmony default export */ var webampLazy = __webpack_exports__["default"] = (webampLazy_Webamp);
/***/ }),
/* 48 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const initDebug = __webpack_require__(8);
const Util_1 = __webpack_require__(14);
const Token = __webpack_require__(6);
const BasicParser_1 = __webpack_require__(20);
const debug = initDebug('music-metadata:parser:ID3v1');
/**
* ID3v1 Genre mappings
* Ref: https://de.wikipedia.org/wiki/Liste_der_ID3v1-Genres
*/
exports.Genres = [
"Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop",
"Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", "Rap", "Reggae", "Rock",
"Techno", "Industrial", "Alternative", "Ska", "Death Metal", "Pranks", "Soundtrack",
"Euro-Techno", "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance",
"Classical", "Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise",
"Alt. Rock", "Bass", "Soul", "Punk", "Space", "Meditative", "Instrumental Pop",
"Instrumental Rock", "Ethnic", "Gothic", "Darkwave", "Techno-Industrial",
"Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy", "Cult",
"Gangsta Rap", "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American",
"Cabaret", "New Wave", "Psychedelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal",
"Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock",
"Folk", "Folk/Rock", "National Folk", "Swing", "Fast-Fusion", "Bebob", "Latin", "Revival",
"Celtic", "Bluegrass", "Avantgarde", "Gothic Rock", "Progressive Rock", "Psychedelic Rock",
"Symphonic Rock", "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour",
"Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus",
"Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba", "Folklore",
"Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet", "Punk Rock", "Drum Solo",
"A Cappella", "Euro-House", "Dance Hall", "Goa", "Drum & Bass", "Club-House",
"Hardcore", "Terror", "Indie", "BritPop", "Negerpunk", "Polsk Punk", "Beat",
"Christian Gangsta Rap", "Heavy Metal", "Black Metal", "Crossover", "Contemporary Christian",
"Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop", "Synthpop",
"Abstract", "Art Rock", "Baroque", "Bhangra", "Big Beat", "Breakbeat", "Chillout",
"Downtempo", "Dub", "EBM", "Eclectic", "Electro", "Electroclash", "Emo", "Experimental",
"Garage", "Global", "IDM", "Illbient", "Industro-Goth", "Jam Band", "Krautrock",
"Leftfield", "Lounge", "Math Rock", "New Romantic", "Nu-Breakz", "Post-Punk", "Post-Rock",
"Psytrance", "Shoegaze", "Space Rock", "Trop Rock", "World Music", "Neoclassical", "Audiobook",
"Audio Theatre", "Neue Deutsche Welle", "Podcast", "Indie Rock", "G-Funk", "Dubstep",
"Garage Rock", "Psybient"
];
/**
* Spec: http://id3.org/ID3v1
* Wiki: https://en.wikipedia.org/wiki/ID3
*/
const Iid3v1Token = {
len: 128,
/**
* @param buf Buffer possibly holding the 128 bytes ID3v1.1 metadata header
* @param off Offset in buffer in bytes
* @returns ID3v1.1 header if first 3 bytes equals 'TAG', otherwise null is returned
*/
get: (buf, off) => {
const header = new Id3v1StringType(3).get(buf, off);
return header === "TAG" ? {
header,
title: new Id3v1StringType(30).get(buf, off + 3),
artist: new Id3v1StringType(30).get(buf, off + 33),
album: new Id3v1StringType(30).get(buf, off + 63),
year: new Id3v1StringType(4).get(buf, off + 93),
comment: new Id3v1StringType(28).get(buf, off + 97),
// ID3v1.1 separator for track
zeroByte: Token.UINT8.get(buf, off + 127),
// track: ID3v1.1 field added by Michael Mutschler
track: Token.UINT8.get(buf, off + 126),
genre: Token.UINT8.get(buf, off + 127)
} : null;
}
};
class Id3v1StringType extends Token.StringType {
constructor(len) {
super(len, "binary");
}
get(buf, off) {
let value = super.get(buf, off);
value = Util_1.default.trimRightNull(value);
value = value.trim();
return value.length > 0 ? value : undefined;
}
}
class ID3v1Parser extends BasicParser_1.BasicParser {
static getGenre(genreIndex) {
if (genreIndex < exports.Genres.length) {
return exports.Genres[genreIndex];
}
return undefined; // ToDO: generate warning
}
parse() {
return __awaiter(this, void 0, void 0, function* () {
if (!this.tokenizer.fileSize) {
debug('Skip checking for ID3v1 because the file-size is unknown');
return;
}
const offset = this.tokenizer.fileSize - Iid3v1Token.len;
if (this.tokenizer.position > offset) {
debug('Already consumed the last 128 bytes');
return;
}
const header = yield this.tokenizer.readToken(Iid3v1Token, offset);
if (header) {
debug("ID3v1 header found at: pos=%s", this.tokenizer.fileSize - Iid3v1Token.len);
for (const id of ["title", "artist", "album", "comment", "track", "year"]) {
if (header[id] && header[id] !== "")
this.addTag(id, header[id]);
}
const genre = ID3v1Parser.getGenre(header.genre);
if (genre)
this.addTag('genre', genre);
}
else {
debug("ID3v1 header not found at: pos=%s", this.tokenizer.fileSize - Iid3v1Token.len);
}
});
}
addTag(id, value) {
this.metadata.addTag('ID3v1', id, value);
}
}
exports.ID3v1Parser = ID3v1Parser;
//# sourceMappingURL=ID3v1Parser.js.map
/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const stream_1 = __webpack_require__(106);
/**
* Utility to convert stream to buffer
*/
class ID3Stream extends stream_1.Readable {
constructor(buf) {
super();
this.buf = buf;
}
_read() {
this.push(this.buf);
this.push(null); // push the EOF-signaling `null` chunk
}
}
exports.ID3Stream = ID3Stream;
//# sourceMappingURL=ID3Stream.js.map
/***/ }),
/* 50 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var R = typeof Reflect === 'object' ? Reflect : null
var ReflectApply = R && typeof R.apply === 'function'
? R.apply
: function ReflectApply(target, receiver, args) {
return Function.prototype.apply.call(target, receiver, args);
}
var ReflectOwnKeys
if (R && typeof R.ownKeys === 'function') {
ReflectOwnKeys = R.ownKeys
} else if (Object.getOwnPropertySymbols) {
ReflectOwnKeys = function ReflectOwnKeys(target) {
return Object.getOwnPropertyNames(target)
.concat(Object.getOwnPropertySymbols(target));
};
} else {
ReflectOwnKeys = function ReflectOwnKeys(target) {
return Object.getOwnPropertyNames(target);
};
}
function ProcessEmitWarning(warning) {
if (console && console.warn) console.warn(warning);
}
var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
return value !== value;
}
function EventEmitter() {
EventEmitter.init.call(this);
}
module.exports = EventEmitter;
// Backwards-compat with node 0.10.x
EventEmitter.EventEmitter = EventEmitter;
EventEmitter.prototype._events = undefined;
EventEmitter.prototype._eventsCount = 0;
EventEmitter.prototype._maxListeners = undefined;
// By default EventEmitters will print a warning if more than 10 listeners are
// added to it. This is a useful default which helps finding memory leaks.
var defaultMaxListeners = 10;
function checkListener(listener) {
if (typeof listener !== 'function') {
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
}
}
Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
enumerable: true,
get: function() {
return defaultMaxListeners;
},
set: function(arg) {
if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
}
defaultMaxListeners = arg;
}
});
EventEmitter.init = function() {
if (this._events === undefined ||
this._events === Object.getPrototypeOf(this)._events) {
this._events = Object.create(null);
this._eventsCount = 0;
}
this._maxListeners = this._maxListeners || undefined;
};
// Obviously not all Emitters should be limited to 10. This function allows
// that to be increased. Set to zero for unlimited.
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
}
this._maxListeners = n;
return this;
};
function _getMaxListeners(that) {
if (that._maxListeners === undefined)
return EventEmitter.defaultMaxListeners;
return that._maxListeners;
}
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
return _getMaxListeners(this);
};
EventEmitter.prototype.emit = function emit(type) {
var args = [];
for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
var doError = (type === 'error');
var events = this._events;
if (events !== undefined)
doError = (doError && events.error === undefined);
else if (!doError)
return false;
// If there is no 'error' event listener then throw.
if (doError) {
var er;
if (args.length > 0)
er = args[0];
if (er instanceof Error) {
// Note: The comments on the `throw` lines are intentional, they show
// up in Node's output if this results in an unhandled exception.
throw er; // Unhandled 'error' event
}
// At least give some kind of context to the user
var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
err.context = er;
throw err; // Unhandled 'error' event
}
var handler = events[type];
if (handler === undefined)
return false;
if (typeof handler === 'function') {
ReflectApply(handler, this, args);
} else {
var len = handler.length;
var listeners = arrayClone(handler, len);
for (var i = 0; i < len; ++i)
ReflectApply(listeners[i], this, args);
}
return true;
};
function _addListener(target, type, listener, prepend) {
var m;
var events;
var existing;
checkListener(listener);
events = target._events;
if (events === undefined) {
events = target._events = Object.create(null);
target._eventsCount = 0;
} else {
// To avoid recursion in the case that type === "newListener"! Before
// adding it to the listeners, first emit "newListener".
if (events.newListener !== undefined) {
target.emit('newListener', type,
listener.listener ? listener.listener : listener);
// Re-assign `events` because a newListener handler could have caused the
// this._events to be assigned to a new object
events = target._events;
}
existing = events[type];
}
if (existing === undefined) {
// Optimize the case of one listener. Don't need the extra array object.
existing = events[type] = listener;
++target._eventsCount;
} else {
if (typeof existing === 'function') {
// Adding the second element, need to change to array.
existing = events[type] =
prepend ? [listener, existing] : [existing, listener];
// If we've already got an array, just append.
} else if (prepend) {
existing.unshift(listener);
} else {
existing.push(listener);
}
// Check for listener leak
m = _getMaxListeners(target);
if (m > 0 && existing.length > m && !existing.warned) {
existing.warned = true;
// No error code for this since it is a Warning
// eslint-disable-next-line no-restricted-syntax
var w = new Error('Possible EventEmitter memory leak detected. ' +
existing.length + ' ' + String(type) + ' listeners ' +
'added. Use emitter.setMaxListeners() to ' +
'increase limit');
w.name = 'MaxListenersExceededWarning';
w.emitter = target;
w.type = type;
w.count = existing.length;
ProcessEmitWarning(w);
}
}
return target;
}
EventEmitter.prototype.addListener = function addListener(type, listener) {
return _addListener(this, type, listener, false);
};
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
EventEmitter.prototype.prependListener =
function prependListener(type, listener) {
return _addListener(this, type, listener, true);
};
function onceWrapper() {
if (!this.fired) {
this.target.removeListener(this.type, this.wrapFn);
this.fired = true;
if (arguments.length === 0)
return this.listener.call(this.target);
return this.listener.apply(this.target, arguments);
}
}
function _onceWrap(target, type, listener) {
var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
var wrapped = onceWrapper.bind(state);
wrapped.listener = listener;
state.wrapFn = wrapped;
return wrapped;
}
EventEmitter.prototype.once = function once(type, listener) {
checkListener(listener);
this.on(type, _onceWrap(this, type, listener));
return this;
};
EventEmitter.prototype.prependOnceListener =
function prependOnceListener(type, listener) {
checkListener(listener);
this.prependListener(type, _onceWrap(this, type, listener));
return this;
};
// Emits a 'removeListener' event if and only if the listener was removed.
EventEmitter.prototype.removeListener =
function removeListener(type, listener) {
var list, events, position, i, originalListener;
checkListener(listener);
events = this._events;
if (events === undefined)
return this;
list = events[type];
if (list === undefined)
return this;
if (list === listener || list.listener === listener) {
if (--this._eventsCount === 0)
this._events = Object.create(null);
else {
delete events[type];
if (events.removeListener)
this.emit('removeListener', type, list.listener || listener);
}
} else if (typeof list !== 'function') {
position = -1;
for (i = list.length - 1; i >= 0; i--) {
if (list[i] === listener || list[i].listener === listener) {
originalListener = list[i].listener;
position = i;
break;
}
}
if (position < 0)
return this;
if (position === 0)
list.shift();
else {
spliceOne(list, position);
}
if (list.length === 1)
events[type] = list[0];
if (events.removeListener !== undefined)
this.emit('removeListener', type, originalListener || listener);
}
return this;
};
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
EventEmitter.prototype.removeAllListeners =
function removeAllListeners(type) {
var listeners, events, i;
events = this._events;
if (events === undefined)
return this;
// not listening for removeListener, no need to emit
if (events.removeListener === undefined) {
if (arguments.length === 0) {
this._events = Object.create(null);
this._eventsCount = 0;
} else if (events[type] !== undefined) {
if (--this._eventsCount === 0)
this._events = Object.create(null);
else
delete events[type];
}
return this;
}
// emit removeListener for all listeners on all events
if (arguments.length === 0) {
var keys = Object.keys(events);
var key;
for (i = 0; i < keys.length; ++i) {
key = keys[i];
if (key === 'removeListener') continue;
this.removeAllListeners(key);
}
this.removeAllListeners('removeListener');
this._events = Object.create(null);
this._eventsCount = 0;
return this;
}
listeners = events[type];
if (typeof listeners === 'function') {
this.removeListener(type, listeners);
} else if (listeners !== undefined) {
// LIFO order
for (i = listeners.length - 1; i >= 0; i--) {
this.removeListener(type, listeners[i]);
}
}
return this;
};
function _listeners(target, type, unwrap) {
var events = target._events;
if (events === undefined)
return [];
var evlistener = events[type];
if (evlistener === undefined)
return [];
if (typeof evlistener === 'function')
return unwrap ? [evlistener.listener || evlistener] : [evlistener];
return unwrap ?
unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
}
EventEmitter.prototype.listeners = function listeners(type) {
return _listeners(this, type, true);
};
EventEmitter.prototype.rawListeners = function rawListeners(type) {
return _listeners(this, type, false);
};
EventEmitter.listenerCount = function(emitter, type) {
if (typeof emitter.listenerCount === 'function') {
return emitter.listenerCount(type);
} else {
return listenerCount.call(emitter, type);
}
};
EventEmitter.prototype.listenerCount = listenerCount;
function listenerCount(type) {
var events = this._events;
if (events !== undefined) {
var evlistener = events[type];
if (typeof evlistener === 'function') {
return 1;
} else if (evlistener !== undefined) {
return evlistener.length;
}
}
return 0;
}
EventEmitter.prototype.eventNames = function eventNames() {
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
};
function arrayClone(arr, n) {
var copy = new Array(n);
for (var i = 0; i < n; ++i)
copy[i] = arr[i];
return copy;
}
function spliceOne(list, index) {
for (; index + 1 < list.length; index++)
list[index] = list[index + 1];
list.pop();
}
function unwrapListeners(arr) {
var ret = new Array(arr.length);
for (var i = 0; i < ret.length; ++i) {
ret[i] = arr[i].listener || arr[i];
}
return ret;
}
/***/ }),
/* 51 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(107);
exports.Stream = exports;
exports.Readable = exports;
exports.Writable = __webpack_require__(53);
exports.Duplex = __webpack_require__(24);
exports.Transform = __webpack_require__(111);
exports.PassThrough = __webpack_require__(154);
/***/ }),
/* 52 */
/***/ (function(module, exports, __webpack_require__) {
/* eslint-disable node/no-deprecated-api */
var buffer = __webpack_require__(9)
var Buffer = buffer.Buffer
// alternative to using Object.keys for old browsers
function copyProps (src, dst) {
for (var key in src) {
dst[key] = src[key]
}
}
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
module.exports = buffer
} else {
// Copy properties from require('buffer')
copyProps(buffer, exports)
exports.Buffer = SafeBuffer
}
function SafeBuffer (arg, encodingOrOffset, length) {
return Buffer(arg, encodingOrOffset, length)
}
// Copy static methods from Buffer
copyProps(Buffer, SafeBuffer)
SafeBuffer.from = function (arg, encodingOrOffset, length) {
if (typeof arg === 'number') {
throw new TypeError('Argument must not be a number')
}
return Buffer(arg, encodingOrOffset, length)
}
SafeBuffer.alloc = function (size, fill, encoding) {
if (typeof size !== 'number') {
throw new TypeError('Argument must be a number')
}
var buf = Buffer(size)
if (fill !== undefined) {
if (typeof encoding === 'string') {
buf.fill(fill, encoding)
} else {
buf.fill(fill)
}
} else {
buf.fill(0)
}
return buf
}
SafeBuffer.allocUnsafe = function (size) {
if (typeof size !== 'number') {
throw new TypeError('Argument must be a number')
}
return Buffer(size)
}
SafeBuffer.allocUnsafeSlow = function (size) {
if (typeof size !== 'number') {
throw new TypeError('Argument must be a number')
}
return buffer.SlowBuffer(size)
}
/***/ }),
/* 53 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process, setImmediate, global) {// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// A bit simpler than readable streams.
// Implement an async ._write(chunk, encoding, cb), and it'll handle all
// the drain event emission and buffering.
/*<replacement>*/
var pna = __webpack_require__(44);
/*</replacement>*/
module.exports = Writable;
/* <replacement> */
function WriteReq(chunk, encoding, cb) {
this.chunk = chunk;
this.encoding = encoding;
this.callback = cb;
this.next = null;
}
// It seems a linked list but it is not
// there will be only 2 of these for each stream
function CorkedRequest(state) {
var _this = this;
this.next = null;
this.entry = null;
this.finish = function () {
onCorkedFinish(_this, state);
};
}
/* </replacement> */
/*<replacement>*/
var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
/*</replacement>*/
/*<replacement>*/
var Duplex;
/*</replacement>*/
Writable.WritableState = WritableState;
/*<replacement>*/
var util = Object.create(__webpack_require__(34));
util.inherits = __webpack_require__(31);
/*</replacement>*/
/*<replacement>*/
var internalUtil = {
deprecate: __webpack_require__(152)
};
/*</replacement>*/
/*<replacement>*/
var Stream = __webpack_require__(108);
/*</replacement>*/
/*<replacement>*/
var Buffer = __webpack_require__(52).Buffer;
var OurUint8Array = global.Uint8Array || function () {};
function _uint8ArrayToBuffer(chunk) {
return Buffer.from(chunk);
}
function _isUint8Array(obj) {
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
}
/*</replacement>*/
var destroyImpl = __webpack_require__(109);
util.inherits(Writable, Stream);
function nop() {}
function WritableState(options, stream) {
Duplex = Duplex || __webpack_require__(24);
options = options || {};
// Duplex streams are both readable and writable, but share
// the same options object.
// However, some cases require setting options to different
// values for the readable and the writable sides of the duplex stream.
// These options can be provided separately as readableXXX and writableXXX.
var isDuplex = stream instanceof Duplex;
// object stream flag to indicate whether or not this stream
// contains buffers or objects.
this.objectMode = !!options.objectMode;
if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
// the point at which write() starts returning false
// Note: 0 is a valid value, means that we always return false if
// the entire buffer is not flushed immediately on write()
var hwm = options.highWaterMark;
var writableHwm = options.writableHighWaterMark;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
// cast to ints.
this.highWaterMark = Math.floor(this.highWaterMark);
// if _final has been called
this.finalCalled = false;
// drain event flag.
this.needDrain = false;
// at the start of calling end()
this.ending = false;
// when end() has been called, and returned
this.ended = false;
// when 'finish' is emitted
this.finished = false;
// has it been destroyed
this.destroyed = false;
// should we decode strings into buffers before passing to _write?
// this is here so that some node-core streams can optimize string
// handling at a lower level.
var noDecode = options.decodeStrings === false;
this.decodeStrings = !noDecode;
// Crypto is kind of old and crusty. Historically, its default string
// encoding is 'binary' so we have to make this configurable.
// Everything else in the universe uses 'utf8', though.
this.defaultEncoding = options.defaultEncoding || 'utf8';
// not an actual buffer we keep track of, but a measurement
// of how much we're waiting to get pushed to some underlying
// socket or file.
this.length = 0;
// a flag to see when we're in the middle of a write.
this.writing = false;
// when true all writes will be buffered until .uncork() call
this.corked = 0;
// a flag to be able to tell if the onwrite cb is called immediately,
// or on a later tick. We set this to true at first, because any
// actions that shouldn't happen until "later" should generally also
// not happen before the first write call.
this.sync = true;
// a flag to know if we're processing previously buffered items, which
// may call the _write() callback in the same tick, so that we don't
// end up in an overlapped onwrite situation.
this.bufferProcessing = false;
// the callback that's passed to _write(chunk,cb)
this.onwrite = function (er) {
onwrite(stream, er);
};
// the callback that the user supplies to write(chunk,encoding,cb)
this.writecb = null;
// the amount that is being written when _write is called.
this.writelen = 0;
this.bufferedRequest = null;
this.lastBufferedRequest = null;
// number of pending user-supplied write callbacks
// this must be 0 before 'finish' can be emitted
this.pendingcb = 0;
// emit prefinish if the only thing we're waiting for is _write cbs
// This is relevant for synchronous Transform streams
this.prefinished = false;
// True if the error was already emitted and should not be thrown again
this.errorEmitted = false;
// count buffered requests
this.bufferedRequestCount = 0;
// allocate the first CorkedRequest, there is always
// one allocated and free to use, and we maintain at most two
this.corkedRequestsFree = new CorkedRequest(this);
}
WritableState.prototype.getBuffer = function getBuffer() {
var current = this.bufferedRequest;
var out = [];
while (current) {
out.push(current);
current = current.next;
}
return out;
};
(function () {
try {
Object.defineProperty(WritableState.prototype, 'buffer', {
get: internalUtil.deprecate(function () {
return this.getBuffer();
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
});
} catch (_) {}
})();
// Test _writableState for inheritance to account for Duplex streams,
// whose prototype chain only points to Readable.
var realHasInstance;
if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
realHasInstance = Function.prototype[Symbol.hasInstance];
Object.defineProperty(Writable, Symbol.hasInstance, {
value: function (object) {
if (realHasInstance.call(this, object)) return true;
if (this !== Writable) return false;
return object && object._writableState instanceof WritableState;
}
});
} else {
realHasInstance = function (object) {
return object instanceof this;
};
}
function Writable(options) {
Duplex = Duplex || __webpack_require__(24);
// Writable ctor is applied to Duplexes, too.
// `realHasInstance` is necessary because using plain `instanceof`
// would return false, as no `_writableState` property is attached.
// Trying to use the custom `instanceof` for Writable here will also break the
// Node.js LazyTransform implementation, which has a non-trivial getter for
// `_writableState` that would lead to infinite recursion.
if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
return new Writable(options);
}
this._writableState = new WritableState(options, this);
// legacy.
this.writable = true;
if (options) {
if (typeof options.write === 'function') this._write = options.write;
if (typeof options.writev === 'function') this._writev = options.writev;
if (typeof options.destroy === 'function') this._destroy = options.destroy;
if (typeof options.final === 'function') this._final = options.final;
}
Stream.call(this);
}
// Otherwise people can pipe Writable streams, which is just wrong.
Writable.prototype.pipe = function () {
this.emit('error', new Error('Cannot pipe, not readable'));
};
function writeAfterEnd(stream, cb) {
var er = new Error('write after end');
// TODO: defer error events consistently everywhere, not just the cb
stream.emit('error', er);
pna.nextTick(cb, er);
}
// Checks that a user-supplied chunk is valid, especially for the particular
// mode the stream is in. Currently this means that `null` is never accepted
// and undefined/non-string values are only allowed in object mode.
function validChunk(stream, state, chunk, cb) {
var valid = true;
var er = false;
if (chunk === null) {
er = new TypeError('May not write null values to stream');
} else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
er = new TypeError('Invalid non-string/buffer chunk');
}
if (er) {
stream.emit('error', er);
pna.nextTick(cb, er);
valid = false;
}
return valid;
}
Writable.prototype.write = function (chunk, encoding, cb) {
var state = this._writableState;
var ret = false;
var isBuf = !state.objectMode && _isUint8Array(chunk);
if (isBuf && !Buffer.isBuffer(chunk)) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (typeof encoding === 'function') {
cb = encoding;
encoding = null;
}
if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
if (typeof cb !== 'function') cb = nop;
if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
state.pendingcb++;
ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
}
return ret;
};
Writable.prototype.cork = function () {
var state = this._writableState;
state.corked++;
};
Writable.prototype.uncork = function () {
var state = this._writableState;
if (state.corked) {
state.corked--;
if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
}
};
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
// node::ParseEncoding() requires lower case.
if (typeof encoding === 'string') encoding = encoding.toLowerCase();
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
this._writableState.defaultEncoding = encoding;
return this;
};
function decodeChunk(state, chunk, encoding) {
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
chunk = Buffer.from(chunk, encoding);
}
return chunk;
}
Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function () {
return this._writableState.highWaterMark;
}
});
// if we're already writing something, then just put this
// in the queue, and wait our turn. Otherwise, call _write
// If we return false, then we need a drain event, so set that flag.
function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
if (!isBuf) {
var newChunk = decodeChunk(state, chunk, encoding);
if (chunk !== newChunk) {
isBuf = true;
encoding = 'buffer';
chunk = newChunk;
}
}
var len = state.objectMode ? 1 : chunk.length;
state.length += len;
var ret = state.length < state.highWaterMark;
// we must ensure that previous needDrain will not be reset to false.
if (!ret) state.needDrain = true;
if (state.writing || state.corked) {
var last = state.lastBufferedRequest;
state.lastBufferedRequest = {
chunk: chunk,
encoding: encoding,
isBuf: isBuf,
callback: cb,
next: null
};
if (last) {
last.next = state.lastBufferedRequest;
} else {
state.bufferedRequest = state.lastBufferedRequest;
}
state.bufferedRequestCount += 1;
} else {
doWrite(stream, state, false, len, chunk, encoding, cb);
}
return ret;
}
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
state.writelen = len;
state.writecb = cb;
state.writing = true;
state.sync = true;
if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
state.sync = false;
}
function onwriteError(stream, state, sync, er, cb) {
--state.pendingcb;
if (sync) {
// defer the callback if we are being called synchronously
// to avoid piling up things on the stack
pna.nextTick(cb, er);
// this can emit finish, and it will always happen
// after error
pna.nextTick(finishMaybe, stream, state);
stream._writableState.errorEmitted = true;
stream.emit('error', er);
} else {
// the caller expect this to happen before if
// it is async
cb(er);
stream._writableState.errorEmitted = true;
stream.emit('error', er);
// this can emit finish, but finish must
// always follow error
finishMaybe(stream, state);
}
}
function onwriteStateUpdate(state) {
state.writing = false;
state.writecb = null;
state.length -= state.writelen;
state.writelen = 0;
}
function onwrite(stream, er) {
var state = stream._writableState;
var sync = state.sync;
var cb = state.writecb;
onwriteStateUpdate(state);
if (er) onwriteError(stream, state, sync, er, cb);else {
// Check if we're actually ready to finish, but don't emit yet
var finished = needFinish(state);
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
clearBuffer(stream, state);
}
if (sync) {
/*<replacement>*/
asyncWrite(afterWrite, stream, state, finished, cb);
/*</replacement>*/
} else {
afterWrite(stream, state, finished, cb);
}
}
}
function afterWrite(stream, state, finished, cb) {
if (!finished) onwriteDrain(stream, state);
state.pendingcb--;
cb();
finishMaybe(stream, state);
}
// Must force callback to be called on nextTick, so that we don't
// emit 'drain' before the write() consumer gets the 'false' return
// value, and has a chance to attach a 'drain' listener.
function onwriteDrain(stream, state) {
if (state.length === 0 && state.needDrain) {
state.needDrain = false;
stream.emit('drain');
}
}
// if there's something in the buffer waiting, then process it
function clearBuffer(stream, state) {
state.bufferProcessing = true;
var entry = state.bufferedRequest;
if (stream._writev && entry && entry.next) {
// Fast case, write everything using _writev()
var l = state.bufferedRequestCount;
var buffer = new Array(l);
var holder = state.corkedRequestsFree;
holder.entry = entry;
var count = 0;
var allBuffers = true;
while (entry) {
buffer[count] = entry;
if (!entry.isBuf) allBuffers = false;
entry = entry.next;
count += 1;
}
buffer.allBuffers = allBuffers;
doWrite(stream, state, true, state.length, buffer, '', holder.finish);
// doWrite is almost always async, defer these to save a bit of time
// as the hot path ends with doWrite
state.pendingcb++;
state.lastBufferedRequest = null;
if (holder.next) {
state.corkedRequestsFree = holder.next;
holder.next = null;
} else {
state.corkedRequestsFree = new CorkedRequest(state);
}
state.bufferedRequestCount = 0;
} else {
// Slow case, write chunks one-by-one
while (entry) {
var chunk = entry.chunk;
var encoding = entry.encoding;
var cb = entry.callback;
var len = state.objectMode ? 1 : chunk.length;
doWrite(stream, state, false, len, chunk, encoding, cb);
entry = entry.next;
state.bufferedRequestCount--;
// if we didn't call the onwrite immediately, then
// it means that we need to wait until it does.
// also, that means that the chunk and cb are currently
// being processed, so move the buffer counter past them.
if (state.writing) {
break;
}
}
if (entry === null) state.lastBufferedRequest = null;
}
state.bufferedRequest = entry;
state.bufferProcessing = false;
}
Writable.prototype._write = function (chunk, encoding, cb) {
cb(new Error('_write() is not implemented'));
};
Writable.prototype._writev = null;
Writable.prototype.end = function (chunk, encoding, cb) {
var state = this._writableState;
if (typeof chunk === 'function') {
cb = chunk;
chunk = null;
encoding = null;
} else if (typeof encoding === 'function') {
cb = encoding;
encoding = null;
}
if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
// .end() fully uncorks
if (state.corked) {
state.corked = 1;
this.uncork();
}
// ignore unnecessary end() calls.
if (!state.ending && !state.finished) endWritable(this, state, cb);
};
function needFinish(state) {
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
}
function callFinal(stream, state) {
stream._final(function (err) {
state.pendingcb--;
if (err) {
stream.emit('error', err);
}
state.prefinished = true;
stream.emit('prefinish');
finishMaybe(stream, state);
});
}
function prefinish(stream, state) {
if (!state.prefinished && !state.finalCalled) {
if (typeof stream._final === 'function') {
state.pendingcb++;
state.finalCalled = true;
pna.nextTick(callFinal, stream, state);
} else {
state.prefinished = true;
stream.emit('prefinish');
}
}
}
function finishMaybe(stream, state) {
var need = needFinish(state);
if (need) {
prefinish(stream, state);
if (state.pendingcb === 0) {
state.finished = true;
stream.emit('finish');
}
}
return need;
}
function endWritable(stream, state, cb) {
state.ending = true;
finishMaybe(stream, state);
if (cb) {
if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
}
state.ended = true;
stream.writable = false;
}
function onCorkedFinish(corkReq, state, err) {
var entry = corkReq.entry;
corkReq.entry = null;
while (entry) {
var cb = entry.callback;
state.pendingcb--;
cb(err);
entry = entry.next;
}
if (state.corkedRequestsFree) {
state.corkedRequestsFree.next = corkReq;
} else {
state.corkedRequestsFree = corkReq;
}
}
Object.defineProperty(Writable.prototype, 'destroyed', {
get: function () {
if (this._writableState === undefined) {
return false;
}
return this._writableState.destroyed;
},
set: function (value) {
// we ignore the value if the stream
// has not been initialized yet
if (!this._writableState) {
return;
}
// backward compatibility, the user is explicitly
// managing destroyed
this._writableState.destroyed = value;
}
});
Writable.prototype.destroy = destroyImpl.destroy;
Writable.prototype._undestroy = destroyImpl.undestroy;
Writable.prototype._destroy = function (err, cb) {
this.end();
cb(err);
};
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(30), __webpack_require__(104).setImmediate, __webpack_require__(17)))
/***/ }),
/* 54 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {
Object.defineProperty(exports, "__esModule", { value: true });
const Token = __webpack_require__(6);
const _debug = __webpack_require__(8);
const Vorbis = __webpack_require__(113);
const debug = _debug('music-metadata:parser:ogg:vorbis1');
/**
* Vorbis 1 Parser.
* Used by OggParser
*/
class VorbisParser {
constructor(metadata, options) {
this.metadata = metadata;
this.options = options;
this.codecName = 'Vorbis I';
this.pageSegments = [];
}
/**
* Vorbis 1 parser
* @param header Ogg Page Header
* @param pageData Page data
*/
parsePage(header, pageData) {
if (header.headerType.firstPage) {
this.parseFirstPage(header, pageData);
}
else {
if (header.headerType.continued) {
if (this.pageSegments.length === 0) {
throw new Error("Cannot continue on previous page");
}
this.pageSegments.push(pageData);
}
if (header.headerType.lastPage || !header.headerType.continued) {
// Flush page segments
if (this.pageSegments.length > 0) {
const fullPage = Buffer.concat(this.pageSegments);
this.parseFullPage(fullPage);
}
// Reset page segments
this.pageSegments = header.headerType.lastPage ? [] : [pageData];
}
}
if (header.headerType.lastPage) {
this.calculateDuration(header);
}
}
flush() {
this.parseFullPage(Buffer.concat(this.pageSegments));
}
/**
* Parse first Ogg/Vorbis page
* @param {IPageHeader} header
* @param {Buffer} pageData
*/
parseFirstPage(header, pageData) {
debug("Parse first page");
// Parse Vorbis common header
const commonHeader = Vorbis.CommonHeader.get(pageData, 0);
if (commonHeader.vorbis !== 'vorbis')
throw new Error('Metadata does not look like Vorbis');
if (commonHeader.packetType === 1) {
const idHeader = Vorbis.IdentificationHeader.get(pageData, Vorbis.CommonHeader.len);
this.metadata.setFormat('sampleRate', idHeader.sampleRate);
this.metadata.setFormat('bitrate', idHeader.bitrateNominal);
this.metadata.setFormat('numberOfChannels', idHeader.channelMode);
debug("sample-rate=%s[hz], bitrate=%s[b/s], channel-mode=%s", idHeader.sampleRate, idHeader.bitrateNominal, idHeader.channelMode);
}
else
throw new Error('First Ogg page should be type 1: the identification header');
}
parseFullPage(pageData) {
// New page
const commonHeader = Vorbis.CommonHeader.get(pageData, 0);
debug("Parse full page: type=%s, byteLength=%s", commonHeader.packetType, pageData.byteLength);
switch (commonHeader.packetType) {
case 3: // type 3: comment header
return this.parseUserCommentList(pageData, Vorbis.CommonHeader.len);
case 1: // type 1: the identification header
case 5: // type 5: setup header type
break; // ignore
}
}
calculateDuration(header) {
if (this.metadata.format.sampleRate && header.absoluteGranulePosition >= 0) {
// Calculate duration
this.metadata.setFormat('numberOfSamples', header.absoluteGranulePosition);
this.metadata.setFormat('duration', this.metadata.format.numberOfSamples / this.metadata.format.sampleRate);
}
}
/**
* Ref: https://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-840005.2
* @returns {Promise<number>}
*/
parseUserCommentList(pageData, offset) {
const strLen = Token.UINT32_LE.get(pageData, offset);
offset += 4;
const vendorString = new Token.StringType(strLen, 'utf-8').get(pageData, offset);
offset += strLen;
let userCommentListLength = Token.UINT32_LE.get(pageData, offset);
offset += 4;
while (userCommentListLength-- > 0) {
offset += this.parseUserComment(pageData, offset);
}
}
parseUserComment(pageData, offset) {
const strLen = Token.UINT32_LE.get(pageData, offset);
const v = new Token.StringType(strLen, 'utf-8').get(pageData, offset + 4);
const idx = v.indexOf('=');
const key = v.slice(0, idx).toUpperCase();
let value = v.slice(idx + 1);
if (key === 'METADATA_BLOCK_PICTURE') {
value = this.options.skipCovers ? null : Vorbis.VorbisPictureToken.fromBase64(value);
}
if (value !== null) {
debug("Push tag: id=%s, value=%s", key, value);
this.metadata.addTag('vorbis', key, value);
}
return Token.UINT32_LE.len + strLen;
}
}
exports.VorbisParser = VorbisParser;
//# sourceMappingURL=VorbisParser.js.map
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(9).Buffer))
/***/ }),
/* 55 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v17.0.1
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
__webpack_require__(23);var f=__webpack_require__(1),g=60103;exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h("react.element");exports.Fragment=h("react.fragment")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};
function q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=""+k);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q;
/***/ }),
/* 56 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v17.0.1
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var l=__webpack_require__(23),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<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}
var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B={};function C(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A}C.prototype.isReactComponent={};C.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error(z(85));this.updater.enqueueSetState(this,a,b,"setState")};C.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};
function D(){}D.prototype=C.prototype;function E(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A}var F=E.prototype=new D;F.constructor=E;l(F,C.prototype);F.isPureReactComponent=!0;var G={current:null},H=Object.prototype.hasOwnProperty,I={key:!0,ref:!0,__self:!0,__source:!0};
function J(a,b,c){var e,d={},k=null,h=null;if(null!=b)for(e in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)H.call(b,e)&&!I.hasOwnProperty(e)&&(d[e]=b[e]);var g=arguments.length-2;if(1===g)d.children=c;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];d.children=f}if(a&&a.defaultProps)for(e in g=a.defaultProps,g)void 0===d[e]&&(d[e]=g[e]);return{$$typeof:n,type:a,key:k,ref:h,props:d,_owner:G.current}}
function K(a,b){return{$$typeof:n,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function L(a){return"object"===typeof a&&null!==a&&a.$$typeof===n}function escape(a){var b={"=":"=0",":":"=2"};return"$"+a.replace(/[=:]/g,function(a){return b[a]})}var M=/\/+/g;function N(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)}
function O(a,b,c,e,d){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case "string":case "number":h=!0;break;case "object":switch(a.$$typeof){case n:case p:h=!0}}if(h)return h=a,d=d(h),a=""===e?"."+N(h,0):e,Array.isArray(d)?(c="",null!=a&&(c=a.replace(M,"$&/")+"/"),O(d,b,c,"",function(a){return a})):null!=d&&(L(d)&&(d=K(d,c+(!d.key||h&&h.key===d.key?"":(""+d.key).replace(M,"$&/")+"/")+a)),b.push(d)),1;h=0;e=""===e?".":e+":";if(Array.isArray(a))for(var g=
0;g<a.length;g++){k=a[g];var f=e+N(k,g);h+=O(k,b,c,f,d)}else if(f=y(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=e+N(k,g++),h+=O(k,b,c,f,d);else if("object"===k)throw b=""+a,Error(z(31,"[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b));return h}function P(a,b,c){if(null==a)return a;var e=[],d=0;O(a,e,"","",function(a){return b.call(c,a,d++)});return e}
function Q(a){if(-1===a._status){var b=a._result;b=b();a._status=0;a._result=b;b.then(function(b){0===a._status&&(b=b.default,a._status=1,a._result=b)},function(b){0===a._status&&(a._status=2,a._result=b)})}if(1===a._status)return a._result;throw a._result;}var R={current:null};function S(){var a=R.current;if(null===a)throw Error(z(321));return a}var T={ReactCurrentDispatcher:R,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:G,IsSomeRendererActing:{current:!1},assign:l};
exports.Children={map:P,forEach:function(a,b,c){P(a,function(){b.apply(this,arguments)},c)},count:function(a){var b=0;P(a,function(){b++});return b},toArray:function(a){return P(a,function(a){return a})||[]},only:function(a){if(!L(a))throw Error(z(143));return a}};exports.Component=C;exports.PureComponent=E;exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T;
exports.cloneElement=function(a,b,c){if(null===a||void 0===a)throw Error(z(267,a));var e=l({},a.props),d=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=G.current);void 0!==b.key&&(d=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)H.call(b,f)&&!I.hasOwnProperty(f)&&(e[f]=void 0===b[f]&&void 0!==g?g[f]:b[f])}var f=arguments.length-2;if(1===f)e.children=c;else if(1<f){g=Array(f);for(var m=0;m<f;m++)g[m]=arguments[m+2];e.children=g}return{$$typeof:n,type:a.type,
key:d,ref:k,props:e,_owner:h}};exports.createContext=function(a,b){void 0===b&&(b=null);a={$$typeof:r,_calculateChangedBits:b,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:q,_context:a};return a.Consumer=a};exports.createElement=J;exports.createFactory=function(a){var b=J.bind(null,a);b.type=a;return b};exports.createRef=function(){return{current:null}};exports.forwardRef=function(a){return{$$typeof:t,render:a}};exports.isValidElement=L;
exports.lazy=function(a){return{$$typeof:v,_payload:{_status:-1,_result:a},_init:Q}};exports.memo=function(a,b){return{$$typeof:u,type:a,compare:void 0===b?null:b}};exports.useCallback=function(a,b){return S().useCallback(a,b)};exports.useContext=function(a,b){return S().useContext(a,b)};exports.useDebugValue=function(){};exports.useEffect=function(a,b){return S().useEffect(a,b)};exports.useImperativeHandle=function(a,b,c){return S().useImperativeHandle(a,b,c)};
exports.useLayoutEffect=function(a,b){return S().useLayoutEffect(a,b)};exports.useMemo=function(a,b){return S().useMemo(a,b)};exports.useReducer=function(a,b,c){return S().useReducer(a,b,c)};exports.useRef=function(a){return S().useRef(a)};exports.useState=function(a){return S().useState(a)};exports.version="17.0.1";
/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v17.0.1
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*
Modernizr 3.0.0pre (Custom Build) | MIT
*/
var aa=__webpack_require__(1),m=__webpack_require__(23),r=__webpack_require__(58);function y(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!aa)throw Error(y(227));var ba=new Set,ca={};function da(a,b){ea(a,b);ea(a+"Capture",b)}
function ea(a,b){ca[a]=b;for(a=0;a<b.length;a++)ba.add(b[a])}
var fa=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),ha=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ia=Object.prototype.hasOwnProperty,
ja={},ka={};function la(a){if(ia.call(ka,a))return!0;if(ia.call(ja,a))return!1;if(ha.test(a))return ka[a]=!0;ja[a]=!0;return!1}function ma(a,b,c,d){if(null!==c&&0===c.type)return!1;switch(typeof b){case "function":case "symbol":return!0;case "boolean":if(d)return!1;if(null!==c)return!c.acceptsBooleans;a=a.toLowerCase().slice(0,5);return"data-"!==a&&"aria-"!==a;default:return!1}}
function na(a,b,c,d){if(null===b||"undefined"===typeof b||ma(a,b,c,d))return!0;if(d)return!1;if(null!==c)switch(c.type){case 3:return!b;case 4:return!1===b;case 5:return isNaN(b);case 6:return isNaN(b)||1>b}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:!(2<b.length)||"o"!==b[0]&&"O"!==b[0]||"n"!==b[1]&&"N"!==b[1]?!1:!0;f||(na(b,c,e,d)&&(c=null),d||null===e?la(b)&&(null===c?a.removeAttribute(b):a.setAttribute(b,""+c)):e.mustUseProperty?a[e.propertyName]=null===c?3===e.type?!1:"":c:(b=e.attributeName,d=e.attributeNamespace,null===c?a.removeAttribute(b):(e=e.type,c=3===e||4===e&&!0===c?"":""+c,d?a.setAttributeNS(d,b,c):a.setAttribute(b,c))))}
var ra=aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,sa=60103,ta=60106,ua=60107,wa=60108,xa=60114,ya=60109,za=60110,Aa=60112,Ba=60113,Ca=60120,Da=60115,Ea=60116,Fa=60121,Ga=60128,Ha=60129,Ia=60130,Ja=60131;
if("function"===typeof Symbol&&Symbol.for){var E=Symbol.for;sa=E("react.element");ta=E("react.portal");ua=E("react.fragment");wa=E("react.strict_mode");xa=E("react.profiler");ya=E("react.provider");za=E("react.context");Aa=E("react.forward_ref");Ba=E("react.suspense");Ca=E("react.suspense_list");Da=E("react.memo");Ea=E("react.lazy");Fa=E("react.block");E("react.scope");Ga=E("react.opaque.id");Ha=E("react.debug_trace_mode");Ia=E("react.offscreen");Ja=E("react.legacy_hidden")}
var Ka="function"===typeof Symbol&&Symbol.iterator;function La(a){if(null===a||"object"!==typeof a)return null;a=Ka&&a[Ka]||a["@@iterator"];return"function"===typeof a?a:null}var Ma;function Na(a){if(void 0===Ma)try{throw Error();}catch(c){var b=c.stack.trim().match(/\n( *(at )?)/);Ma=b&&b[1]||""}return"\n"+Ma+a}var Oa=!1;
function Pa(a,b){if(!a||Oa)return"";Oa=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(b)if(b=function(){throw Error();},Object.defineProperty(b.prototype,"props",{set:function(){throw Error();}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(b,[])}catch(k){var d=k}Reflect.construct(a,[],b)}else{try{b.call()}catch(k){d=k}a.call(b.prototype)}else{try{throw Error();}catch(k){d=k}a()}}catch(k){if(k&&d&&"string"===typeof k.stack){for(var e=k.stack.split("\n"),
f=d.stack.split("\n"),g=e.length-1,h=f.length-1;1<=g&&0<=h&&e[g]!==f[h];)h--;for(;1<=g&&0<=h;g--,h--)if(e[g]!==f[h]){if(1!==g||1!==h){do if(g--,h--,0>h||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 m({},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="";aa.Children.forEach(a,function(a){null!=a&&(b+=a)});return b}function eb(a,b){a=m({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;e++)b["$"+c[e]]=!0;for(c=0;c<a.length;c++)e=b.hasOwnProperty("$"+a[c].value),a[c].selected!==e&&(a[c].selected=e),e&&d&&(a[c].defaultSelected=!0)}else{c=""+Sa(c);b=null;for(e=0;e<a.length;e++){if(a[e].value===c){a[e].selected=!0;d&&(a[e].defaultSelected=!0);return}null!==b||a[e].disabled||(b=a[e])}null!==b&&(b.selected=!0)}}
function gb(a,b){if(null!=b.dangerouslySetInnerHTML)throw Error(y(91));return m({},b,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function hb(a,b){var c=b.value;if(null==c){c=b.children;b=b.defaultValue;if(null!=c){if(null!=b)throw Error(y(92));if(Array.isArray(c)){if(!(1>=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="<svg>"+b.valueOf().toString()+"</svg>";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=m({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;a<b.length;a++)Bb(b[a])}}function Gb(a,b){return a(b)}function Hb(a,b,c,d,e){return a(b,c,d,e)}function Ib(){}var Jb=Gb,Kb=!1,Lb=!1;function Mb(){if(null!==zb||null!==Ab)Ib(),Fb()}
function Nb(a,b,c){if(Lb)return a(b,c);Lb=!0;try{return Jb(a,b,c)}finally{Lb=!1,Mb()}}
function Ob(a,b){var c=a.stateNode;if(null===c)return null;var d=Db(c);if(null===d)return null;c=d[b];a:switch(b){case "onClick":case "onClickCapture":case "onDoubleClick":case "onDoubleClickCapture":case "onMouseDown":case "onMouseDownCapture":case "onMouseMove":case "onMouseMoveCapture":case "onMouseUp":case "onMouseUpCapture":case "onMouseEnter":(d=!d.disabled)||(a=a.type,d=!("button"===a||"input"===a||"select"===a||"textarea"===a));a=!d;break a;default:a=!1}if(a)return null;if(c&&"function"!==
typeof c)throw Error(y(231,b,typeof c));return c}var Pb=!1;if(fa)try{var Qb={};Object.defineProperty(Qb,"passive",{get:function(){Pb=!0}});window.addEventListener("test",Qb,Qb);window.removeEventListener("test",Qb,Qb)}catch(a){Pb=!1}function Rb(a,b,c,d,e,f,g,h,k){var l=Array.prototype.slice.call(arguments,3);try{b.apply(c,l)}catch(n){this.onError(n)}}var Sb=!1,Tb=null,Ub=!1,Vb=null,Wb={onError:function(a){Sb=!0;Tb=a}};function Xb(a,b,c,d,e,f,g,h,k){Sb=!1;Tb=null;Rb.apply(Wb,arguments)}
function Yb(a,b,c,d,e,f,g,h,k){Xb.apply(this,arguments);if(Sb){if(Sb){var l=Tb;Sb=!1;Tb=null}else throw Error(y(198));Ub||(Ub=!0,Vb=l)}}function Zb(a){var b=a,c=a;if(a.alternate)for(;b.return;)b=b.return;else{a=b;do b=a,0!==(b.flags&1026)&&(c=b.return),a=b.return;while(a)}return 3===b.tag?c:null}function $b(a){if(13===a.tag){var b=a.memoizedState;null===b&&(a=a.alternate,null!==a&&(b=a.memoizedState));if(null!==b)return b.dehydrated}return null}function ac(a){if(Zb(a)!==a)throw Error(y(188));}
function bc(a){var b=a.alternate;if(!b){b=Zb(a);if(null===b)throw Error(y(188));return b!==a?null:a}for(var c=a,d=b;;){var e=c.return;if(null===e)break;var f=e.alternate;if(null===f){d=e.return;if(null!==d){c=d;continue}break}if(e.child===f.child){for(f=e.child;f;){if(f===c)return ac(e),a;if(f===d)return ac(e),b;f=f.sibling}throw Error(y(188));}if(c.return!==d.return)c=e,d=f;else{for(var g=!1,h=e.child;h;){if(h===c){g=!0;c=e;d=f;break}if(h===d){g=!0;d=e;c=f;break}h=h.sibling}if(!g){for(h=f.child;h;){if(h===
c){g=!0;c=f;d=e;break}if(h===d){g=!0;d=f;c=e;break}h=h.sibling}if(!g)throw Error(y(189));}}if(c.alternate!==d)throw Error(y(190));}if(3!==c.tag)throw Error(y(188));return c.stateNode.current===c?a:b}function cc(a){a=bc(a);if(!a)return null;for(var b=a;;){if(5===b.tag||6===b.tag)return b;if(b.child)b.child.return=b,b=b.child;else{if(b===a)break;for(;!b.sibling;){if(!b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}}return null}
function dc(a,b){for(var c=a.alternate;null!==b;){if(b===a||b===c)return!0;b=b.return}return!1}var ec,fc,gc,hc,ic=!1,jc=[],kc=null,lc=null,mc=null,nc=new Map,oc=new Map,pc=[],qc="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");
function rc(a,b,c,d,e){return{blockedOn:a,domEventName:b,eventSystemFlags:c|16,nativeEvent:e,targetContainers:[d]}}function sc(a,b){switch(a){case "focusin":case "focusout":kc=null;break;case "dragenter":case "dragleave":lc=null;break;case "mouseover":case "mouseout":mc=null;break;case "pointerover":case "pointerout":nc.delete(b.pointerId);break;case "gotpointercapture":case "lostpointercapture":oc.delete(b.pointerId)}}
function tc(a,b,c,d,e,f){if(null===a||a.nativeEvent!==f)return a=rc(b,c,d,e,f),null!==b&&(b=Cb(b),null!==b&&fc(b)),a;a.eventSystemFlags|=d;b=a.targetContainers;null!==e&&-1===b.indexOf(e)&&b.push(e);return a}
function uc(a,b,c,d,e){switch(b){case "focusin":return kc=tc(kc,a,b,c,d,e),!0;case "dragenter":return lc=tc(lc,a,b,c,d,e),!0;case "mouseover":return mc=tc(mc,a,b,c,d,e),!0;case "pointerover":var f=e.pointerId;nc.set(f,tc(nc.get(f)||null,a,b,c,d,e));return!0;case "gotpointercapture":return f=e.pointerId,oc.set(f,tc(oc.get(f)||null,a,b,c,d,e)),!0}return!1}
function vc(a){var b=wc(a.target);if(null!==b){var c=Zb(b);if(null!==c)if(b=c.tag,13===b){if(b=$b(c),null!==b){a.blockedOn=b;hc(a.lanePriority,function(){r.unstable_runWithPriority(a.priority,function(){gc(c)})});return}}else if(3===b&&c.stateNode.hydrate){a.blockedOn=3===c.tag?c.stateNode.containerInfo:null;return}}a.blockedOn=null}
function xc(a){if(null!==a.blockedOn)return!1;for(var b=a.targetContainers;0<b.length;){var c=yc(a.domEventName,a.eventSystemFlags,b[0],a.nativeEvent);if(null!==c)return b=Cb(c),null!==b&&fc(b),a.blockedOn=c,!1;b.shift()}return!0}function zc(a,b,c){xc(a)&&c.delete(b)}
function Ac(){for(ic=!1;0<jc.length;){var a=jc[0];if(null!==a.blockedOn){a=Cb(a.blockedOn);null!==a&&ec(a);break}for(var b=a.targetContainers;0<b.length;){var c=yc(a.domEventName,a.eventSystemFlags,b[0],a.nativeEvent);if(null!==c){a.blockedOn=c;break}b.shift()}null===a.blockedOn&&jc.shift()}null!==kc&&xc(kc)&&(kc=null);null!==lc&&xc(lc)&&(lc=null);null!==mc&&xc(mc)&&(mc=null);nc.forEach(zc);oc.forEach(zc)}
function Bc(a,b){a.blockedOn===b&&(a.blockedOn=null,ic||(ic=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,Ac)))}
function Cc(a){function b(b){return Bc(b,a)}if(0<jc.length){Bc(jc[0],a);for(var c=1;c<jc.length;c++){var d=jc[c];d.blockedOn===a&&(d.blockedOn=null)}}null!==kc&&Bc(kc,a);null!==lc&&Bc(lc,a);null!==mc&&Bc(mc,a);nc.forEach(b);oc.forEach(b);for(c=0;c<pc.length;c++)d=pc[c],d.blockedOn===a&&(d.blockedOn=null);for(;0<pc.length&&(c=pc[0],null===c.blockedOn);)vc(c),null===c.blockedOn&&pc.shift()}
function Dc(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;return c}var Ec={animationend:Dc("Animation","AnimationEnd"),animationiteration:Dc("Animation","AnimationIteration"),animationstart:Dc("Animation","AnimationStart"),transitionend:Dc("Transition","TransitionEnd")},Fc={},Gc={};
fa&&(Gc=document.createElement("div").style,"AnimationEvent"in window||(delete Ec.animationend.animation,delete Ec.animationiteration.animation,delete Ec.animationstart.animation),"TransitionEvent"in window||delete Ec.transitionend.transition);function Hc(a){if(Fc[a])return Fc[a];if(!Ec[a])return a;var b=Ec[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in Gc)return Fc[a]=b[c];return a}
var Ic=Hc("animationend"),Jc=Hc("animationiteration"),Kc=Hc("animationstart"),Lc=Hc("transitionend"),Mc=new Map,Nc=new Map,Oc=["abort","abort",Ic,"animationEnd",Jc,"animationIteration",Kc,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart",
"lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",Lc,"transitionEnd","waiting","waiting"];function Pc(a,b){for(var c=0;c<a.length;c+=2){var d=a[c],e=a[c+1];e="on"+(e[0].toUpperCase()+e.slice(1));Nc.set(d,b);Mc.set(d,e);da(e,[d])}}var Qc=r.unstable_now;Qc();var F=8;
function Rc(a){if(0!==(1&a))return F=15,1;if(0!==(2&a))return F=14,2;if(0!==(4&a))return F=13,4;var b=24&a;if(0!==b)return F=12,b;if(0!==(a&32))return F=11,32;b=192&a;if(0!==b)return F=10,b;if(0!==(a&256))return F=9,256;b=3584&a;if(0!==b)return F=8,b;if(0!==(a&4096))return F=7,4096;b=4186112&a;if(0!==b)return F=6,b;b=62914560&a;if(0!==b)return F=5,b;if(a&67108864)return F=4,67108864;if(0!==(a&134217728))return F=3,134217728;b=805306368&a;if(0!==b)return F=2,b;if(0!==(1073741824&a))return F=1,1073741824;
F=8;return a}function Sc(a){switch(a){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}function Tc(a){switch(a){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(y(358,a));}}
function Uc(a,b){var c=a.pendingLanes;if(0===c)return F=0;var d=0,e=0,f=a.expiredLanes,g=a.suspendedLanes,h=a.pingedLanes;if(0!==f)d=f,e=F=15;else if(f=c&134217727,0!==f){var k=f&~g;0!==k?(d=Rc(k),e=F):(h&=f,0!==h&&(d=Rc(h),e=F))}else f=c&~g,0!==f?(d=Rc(f),e=F):0!==h&&(d=Rc(h),e=F);if(0===d)return 0;d=31-Vc(d);d=c&((0>d?0:1<<d)<<1)-1;if(0!==b&&b!==d&&0===(b&g)){Rc(b);if(e<=F)return b;F=e}b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0<b;)c=31-Vc(b),e=1<<c,d|=a[c],b&=~e;return d}
function Wc(a){a=a.pendingLanes&-1073741825;return 0!==a?a:a&1073741824?1073741824:0}function Xc(a,b){switch(a){case 15:return 1;case 14:return 2;case 12:return a=Yc(24&~b),0===a?Xc(10,b):a;case 10:return a=Yc(192&~b),0===a?Xc(8,b):a;case 8:return a=Yc(3584&~b),0===a&&(a=Yc(4186112&~b),0===a&&(a=512)),a;case 2:return b=Yc(805306368&~b),0===b&&(b=268435456),b}throw Error(y(358,a));}function Yc(a){return a&-a}function Zc(a){for(var b=[],c=0;31>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=r.unstable_UserBlockingPriority,ed=r.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<jc.length&&-1<qc.indexOf(a))a=rc(null,a,b,c,d),jc.push(a);else{var f=yc(a,b,c,d);if(null===f)e&&sc(a,d);else{if(e){if(-1<qc.indexOf(a)){a=rc(f,a,b,c,d);jc.push(a);return}if(uc(f,a,b,c,d))return;sc(a,d)}jd(a,b,d,null,c)}}}}
function yc(a,b,c,d){var e=xb(d);e=wc(e);if(null!==e){var f=Zb(e);if(null===f)e=null;else{var g=f.tag;if(13===g){e=$b(f);if(null!==e)return e;e=null}else if(3===g){if(f.stateNode.hydrate)return 3===f.tag?f.stateNode.containerInfo:null;e=null}else f!==e&&(e=null)}}jd(a,b,d,e,c);return null}var kd=null,ld=null,md=null;
function nd(){if(md)return md;var a,b=ld,c=b.length,d,e="value"in kd?kd.value:kd.textContent,f=e.length;for(a=0;a<c&&b[a]===e[a];a++);var g=c-a;for(d=1;d<=g&&b[c-d]===e[f-d];d++);return md=e.slice(a,1<d?1-d:void 0)}function od(a){var b=a.keyCode;"charCode"in a?(a=a.charCode,0===a&&13===b&&(a=13)):a=b;10===a&&(a=13);return 32<=a||13===a?a:0}function pd(){return!0}function qd(){return!1}
function rd(a){function b(b,d,e,f,g){this._reactName=b;this._targetInst=e;this.type=d;this.nativeEvent=f;this.target=g;this.currentTarget=null;for(var c in a)a.hasOwnProperty(c)&&(b=a[c],this[c]=b?b(f):f[c]);this.isDefaultPrevented=(null!=f.defaultPrevented?f.defaultPrevented:!1===f.returnValue)?pd:qd;this.isPropagationStopped=qd;return this}m(b.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&
(a.returnValue=!1),this.isDefaultPrevented=pd)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=pd)},persist:function(){},isPersistent:pd});return b}
var sd={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},td=rd(sd),ud=m({},sd,{view:0,detail:0}),vd=rd(ud),wd,xd,yd,Ad=m({},ud,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zd,button:0,buttons:0,relatedTarget:function(a){return void 0===a.relatedTarget?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){if("movementX"in
a)return a.movementX;a!==yd&&(yd&&"mousemove"===a.type?(wd=a.screenX-yd.screenX,xd=a.screenY-yd.screenY):xd=wd=0,yd=a);return wd},movementY:function(a){return"movementY"in a?a.movementY:xd}}),Bd=rd(Ad),Cd=m({},Ad,{dataTransfer:0}),Dd=rd(Cd),Ed=m({},ud,{relatedTarget:0}),Fd=rd(Ed),Gd=m({},sd,{animationName:0,elapsedTime:0,pseudoElement:0}),Hd=rd(Gd),Id=m({},sd,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),Jd=rd(Id),Kd=m({},sd,{data:0}),Ld=rd(Kd),Md={Esc:"Escape",
Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nd={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",
119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Od={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pd(a){var b=this.nativeEvent;return b.getModifierState?b.getModifierState(a):(a=Od[a])?!!b[a]:!1}function zd(){return Pd}
var Qd=m({},ud,{key:function(a){if(a.key){var b=Md[a.key]||a.key;if("Unidentified"!==b)return b}return"keypress"===a.type?(a=od(a),13===a?"Enter":String.fromCharCode(a)):"keydown"===a.type||"keyup"===a.type?Nd[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zd,charCode:function(a){return"keypress"===a.type?od(a):0},keyCode:function(a){return"keydown"===a.type||"keyup"===a.type?a.keyCode:0},which:function(a){return"keypress"===
a.type?od(a):"keydown"===a.type||"keyup"===a.type?a.keyCode:0}}),Rd=rd(Qd),Sd=m({},Ad,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Td=rd(Sd),Ud=m({},ud,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zd}),Vd=rd(Ud),Wd=m({},sd,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xd=rd(Wd),Yd=m({},Ad,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},
deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),Zd=rd(Yd),$d=[9,13,27,32],ae=fa&&"CompositionEvent"in window,be=null;fa&&"documentMode"in document&&(be=document.documentMode);var ce=fa&&"TextEvent"in window&&!be,de=fa&&(!ae||be&&8<be&&11>=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.char.length)return b.char;if(b.which)return String.fromCharCode(b.which)}return null;case "compositionend":return de&&"ko"!==b.locale?null:b.data;default:return null}}
var le={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function me(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return"input"===b?!!le[a.type]:"textarea"===b?!0:!1}function ne(a,b,c,d){Eb(d);b=oe(b,"onChange");0<b.length&&(c=new td("onChange","change",null,c,d),a.push({event:c,listeners:b}))}var pe=null,qe=null;function re(a){se(a,0)}function te(a){var b=ue(a);if(Wa(b))return a}
function ve(a,b){if("change"===a)return b}var we=!1;if(fa){var xe;if(fa){var ye="oninput"in document;if(!ye){var ze=document.createElement("div");ze.setAttribute("oninput","return;");ye="function"===typeof ze.oninput}xe=ye}else xe=!1;we=xe&&(!document.documentMode||9<document.documentMode)}function Ae(){pe&&(pe.detachEvent("onpropertychange",Be),qe=pe=null)}function Be(a){if("value"===a.propertyName&&te(qe)){var b=[];ne(b,qe,a,xb(a));a=re;if(Kb)a(b);else{Kb=!0;try{Gb(a,b)}finally{Kb=!1,Mb()}}}}
function Ce(a,b,c){"focusin"===a?(Ae(),pe=b,qe=c,pe.attachEvent("onpropertychange",Be)):"focusout"===a&&Ae()}function De(a){if("selectionchange"===a||"keyup"===a||"keydown"===a)return te(qe)}function Ee(a,b){if("click"===a)return te(b)}function Fe(a,b){if("input"===a||"change"===a)return te(b)}function Ge(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var He="function"===typeof Object.is?Object.is:Ge,Ie=Object.prototype.hasOwnProperty;
function Je(a,b){if(He(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var c=Object.keys(a),d=Object.keys(b);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++)if(!Ie.call(b,c[d])||!He(a[c[d]],b[c[d]]))return!1;return!0}function Ke(a){for(;a&&a.firstChild;)a=a.firstChild;return a}
function Le(a,b){var c=Ke(a);a=0;for(var d;c;){if(3===c.nodeType){d=a+c.textContent.length;if(a<=b&&d>=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"),0<d.length&&(b=new td("onSelect","select",null,b,c),a.push({event:b,listeners:d}),b.target=Qe)))}
Pc("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),
0);Pc("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1);Pc(Oc,2);for(var Ve="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),We=0;We<Ve.length;We++)Nc.set(Ve[We],0);ea("onMouseEnter",["mouseout","mouseover"]);
ea("onMouseLeave",["mouseout","mouseover"]);ea("onPointerEnter",["pointerout","pointerover"]);ea("onPointerLeave",["pointerout","pointerover"]);da("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));da("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));da("onBeforeInput",["compositionend","keypress","textInput","paste"]);da("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));
da("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));da("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xe="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Ye=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xe));
function Ze(a,b,c){var d=a.type||"unknown-event";a.currentTarget=c;Yb(d,b,void 0,a);a.currentTarget=null}
function se(a,b){b=0!==(b&4);for(var c=0;c<a.length;c++){var d=a[c],e=d.event;d=d.listeners;a:{var f=void 0;if(b)for(var g=d.length-1;0<=g;g--){var h=d[g],k=h.instance,l=h.currentTarget;h=h.listener;if(k!==f&&e.isPropagationStopped())break a;Ze(e,h,l);f=k}else for(g=0;g<d.length;g++){h=d[g];k=h.instance;l=h.currentTarget;h=h.listener;if(k!==f&&e.isPropagationStopped())break a;Ze(e,h,l);f=k}}}if(Ub)throw a=Vb,Ub=!1,Vb=null,a;}
function G(a,b){var c=$e(b),d=a+"__bubble";c.has(d)||(af(b,a,2,!1),c.add(d))}var bf="_reactListening"+Math.random().toString(36).slice(2);function cf(a){a[bf]||(a[bf]=!0,ba.forEach(function(b){Ye.has(b)||df(b,!1,a,null);df(b,!0,a,null)}))}
function df(a,b,c,d){var e=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,f=c;"selectionchange"===a&&9!==c.nodeType&&(f=c.ownerDocument);if(null!==d&&!b&&Ye.has(a)){if("scroll"!==a)return;e|=2;f=d}var g=$e(f),h=a+"__"+(b?"capture":"bubble");g.has(h)||(b&&(e|=4),af(f,a,e,b),g.add(h))}
function af(a,b,c,d){var e=Nc.get(b);switch(void 0===e?2:e){case 0:e=gd;break;case 1:e=id;break;default:e=hd}c=e.bind(null,b,c,a);e=void 0;!Pb||"touchstart"!==b&&"touchmove"!==b&&"wheel"!==b||(e=!0);d?void 0!==e?a.addEventListener(b,c,{capture:!0,passive:e}):a.addEventListener(b,c,!0):void 0!==e?a.addEventListener(b,c,{passive:e}):a.addEventListener(b,c,!1)}
function jd(a,b,c,d,e){var f=d;if(0===(b&1)&&0===(b&2)&&null!==d)a:for(;;){if(null===d)return;var g=d.tag;if(3===g||4===g){var h=d.stateNode.containerInfo;if(h===e||8===h.nodeType&&h.parentNode===e)break;if(4===g)for(g=d.return;null!==g;){var k=g.tag;if(3===k||4===k)if(k=g.stateNode.containerInfo,k===e||8===k.nodeType&&k.parentNode===e)return;g=g.return}for(;null!==h;){g=wc(h);if(null===g)return;k=g.tag;if(5===k||6===k){d=f=g;continue a}h=h.parentNode}}d=d.return}Nb(function(){var d=f,e=xb(c),g=[];
a:{var h=Mc.get(a);if(void 0!==h){var k=td,x=a;switch(a){case "keypress":if(0===od(c))break a;case "keydown":case "keyup":k=Rd;break;case "focusin":x="focus";k=Fd;break;case "focusout":x="blur";k=Fd;break;case "beforeblur":case "afterblur":k=Fd;break;case "click":if(2===c.button)break a;case "auxclick":case "dblclick":case "mousedown":case "mousemove":case "mouseup":case "mouseout":case "mouseover":case "contextmenu":k=Bd;break;case "drag":case "dragend":case "dragenter":case "dragexit":case "dragleave":case "dragover":case "dragstart":case "drop":k=
Dd;break;case "touchcancel":case "touchend":case "touchmove":case "touchstart":k=Vd;break;case Ic:case Jc:case Kc:k=Hd;break;case Lc:k=Xd;break;case "scroll":k=vd;break;case "wheel":k=Zd;break;case "copy":case "cut":case "paste":k=Jd;break;case "gotpointercapture":case "lostpointercapture":case "pointercancel":case "pointerdown":case "pointermove":case "pointerout":case "pointerover":case "pointerup":k=Td}var w=0!==(b&4),z=!w&&"scroll"===a,u=w?null!==h?h+"Capture":null:h;w=[];for(var t=d,q;null!==
t;){q=t;var v=q.stateNode;5===q.tag&&null!==v&&(q=v,null!==u&&(v=Ob(t,u),null!=v&&w.push(ef(t,v,q))));if(z)break;t=t.return}0<w.length&&(h=new k(h,x,null,c,e),g.push({event:h,listeners:w}))}}if(0===(b&7)){a:{h="mouseover"===a||"pointerover"===a;k="mouseout"===a||"pointerout"===a;if(h&&0===(b&16)&&(x=c.relatedTarget||c.fromElement)&&(wc(x)||x[ff]))break a;if(k||h){h=e.window===e?e:(h=e.ownerDocument)?h.defaultView||h.parentWindow:window;if(k){if(x=c.relatedTarget||c.toElement,k=d,x=x?wc(x):null,null!==
x&&(z=Zb(x),x!==z||5!==x.tag&&6!==x.tag))x=null}else k=null,x=d;if(k!==x){w=Bd;v="onMouseLeave";u="onMouseEnter";t="mouse";if("pointerout"===a||"pointerover"===a)w=Td,v="onPointerLeave",u="onPointerEnter",t="pointer";z=null==k?h:ue(k);q=null==x?h:ue(x);h=new w(v,t+"leave",k,c,e);h.target=z;h.relatedTarget=q;v=null;wc(e)===d&&(w=new w(u,t+"enter",x,c,e),w.target=q,w.relatedTarget=z,v=w);z=v;if(k&&x)b:{w=k;u=x;t=0;for(q=w;q;q=gf(q))t++;q=0;for(v=u;v;v=gf(v))q++;for(;0<t-q;)w=gf(w),t--;for(;0<q-t;)u=
gf(u),q--;for(;t--;){if(w===u||null!==u&&w===u.alternate)break b;w=gf(w);u=gf(u)}w=null}else w=null;null!==k&&hf(g,h,k,w,!1);null!==x&&null!==z&&hf(g,z,x,w,!0)}}}a:{h=d?ue(d):window;k=h.nodeName&&h.nodeName.toLowerCase();if("select"===k||"input"===k&&"file"===h.type)var J=ve;else if(me(h))if(we)J=Fe;else{J=De;var K=Ce}else(k=h.nodeName)&&"input"===k.toLowerCase()&&("checkbox"===h.type||"radio"===h.type)&&(J=Ee);if(J&&(J=J(a,d))){ne(g,J,c,e);break a}K&&K(a,h,d);"focusout"===a&&(K=h._wrapperState)&&
K.controlled&&"number"===h.type&&bb(h,"number",h.value)}K=d?ue(d):window;switch(a){case "focusin":if(me(K)||"true"===K.contentEditable)Qe=K,Re=d,Se=null;break;case "focusout":Se=Re=Qe=null;break;case "mousedown":Te=!0;break;case "contextmenu":case "mouseup":case "dragend":Te=!1;Ue(g,c,e);break;case "selectionchange":if(Pe)break;case "keydown":case "keyup":Ue(g,c,e)}var Q;if(ae)b:{switch(a){case "compositionstart":var L="onCompositionStart";break b;case "compositionend":L="onCompositionEnd";break b;
case "compositionupdate":L="onCompositionUpdate";break b}L=void 0}else ie?ge(a,c)&&(L="onCompositionEnd"):"keydown"===a&&229===c.keyCode&&(L="onCompositionStart");L&&(de&&"ko"!==c.locale&&(ie||"onCompositionStart"!==L?"onCompositionEnd"===L&&ie&&(Q=nd()):(kd=e,ld="value"in kd?kd.value:kd.textContent,ie=!0)),K=oe(d,L),0<K.length&&(L=new Ld(L,a,null,c,e),g.push({event:L,listeners:K}),Q?L.data=Q:(Q=he(c),null!==Q&&(L.data=Q))));if(Q=ce?je(a,c):ke(a,c))d=oe(d,"onBeforeInput"),0<d.length&&(e=new Ld("onBeforeInput",
"beforeinput",null,c,e),g.push({event:e,listeners:d}),e.data=Q)}se(g,b)})}function ef(a,b,c){return{instance:a,listener:b,currentTarget:c}}function oe(a,b){for(var c=b+"Capture",d=[];null!==a;){var e=a,f=e.stateNode;5===e.tag&&null!==f&&(e=f,f=Ob(a,c),null!=f&&d.unshift(ef(a,f,e)),f=Ob(a,b),null!=f&&d.push(ef(a,f,e)));a=a.return}return d}function gf(a){if(null===a)return null;do a=a.return;while(a&&5!==a.tag);return a?a:null}
function hf(a,b,c,d,e){for(var f=b._reactName,g=[];null!==c&&c!==d;){var h=c,k=h.alternate,l=h.stateNode;if(null!==k&&k===d)break;5===h.tag&&null!==l&&(h=l,e?(k=Ob(c,f),null!=k&&g.unshift(ef(c,k,h))):e||(k=Ob(c,f),null!=k&&g.push(ef(c,k,h))));c=c.return}0!==g.length&&a.push({event:b,listeners:g})}function jf(){}var kf=null,lf=null;function mf(a,b){switch(a){case "button":case "input":case "select":case "textarea":return!!b.autoFocus}return!1}
function nf(a,b){return"textarea"===a||"option"===a||"noscript"===a||"string"===typeof b.children||"number"===typeof b.children||"object"===typeof b.dangerouslySetInnerHTML&&null!==b.dangerouslySetInnerHTML&&null!=b.dangerouslySetInnerHTML.__html}var of="function"===typeof setTimeout?setTimeout:void 0,pf="function"===typeof clearTimeout?clearTimeout:void 0;function qf(a){1===a.nodeType?a.textContent="":9===a.nodeType&&(a=a.body,null!=a&&(a.textContent=""))}
function rf(a){for(;null!=a;a=a.nextSibling){var b=a.nodeType;if(1===b||3===b)break}return a}function sf(a){a=a.previousSibling;for(var b=0;a;){if(8===a.nodeType){var c=a.data;if("$"===c||"$!"===c||"$?"===c){if(0===b)return a;b--}else"/$"===c&&b++}a=a.previousSibling}return null}var tf=0;function uf(a){return{$$typeof:Ga,toString:a,valueOf:a}}var vf=Math.random().toString(36).slice(2),wf="__reactFiber$"+vf,xf="__reactProps$"+vf,ff="__reactContainer$"+vf,yf="__reactEvents$"+vf;
function wc(a){var b=a[wf];if(b)return b;for(var c=a.parentNode;c;){if(b=c[ff]||c[wf]){c=b.alternate;if(null!==b.child||null!==c&&null!==c.child)for(a=sf(a);null!==a;){if(c=a[wf])return c;a=sf(a)}return b}a=c;c=a.parentNode}return null}function Cb(a){a=a[wf]||a[ff];return!a||5!==a.tag&&6!==a.tag&&13!==a.tag&&3!==a.tag?null:a}function ue(a){if(5===a.tag||6===a.tag)return a.stateNode;throw Error(y(33));}function Db(a){return a[xf]||null}
function $e(a){var b=a[yf];void 0===b&&(b=a[yf]=new Set);return b}var zf=[],Af=-1;function Bf(a){return{current:a}}function H(a){0>Af||(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 m({},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=r.unstable_runWithPriority,Of=r.unstable_scheduleCallback,Pf=r.unstable_cancelCallback,Qf=r.unstable_shouldYield,Rf=r.unstable_requestPaint,Sf=r.unstable_now,Tf=r.unstable_getCurrentPriorityLevel,Uf=r.unstable_ImmediatePriority,Vf=r.unstable_UserBlockingPriority,Wf=r.unstable_NormalPriority,Xf=r.unstable_LowPriority,Yf=r.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(;a<b.length;a++){var c=b[a];do c=c(!0);while(null!==c)}});ag=null}catch(c){throw null!==ag&&(ag=ag.slice(a+1)),Of(Uf,ig),c;}finally{cg=!1}}}var kg=ra.ReactCurrentBatchConfig;function lg(a,b){if(a&&a.defaultProps){b=m({},b);a=a.defaultProps;for(var c in a)void 0===b[c]&&(b[c]=a[c]);return b}return b}var mg=Bf(null),ng=null,og=null,pg=null;function qg(){pg=og=ng=null}
function rg(a){var b=mg.current;H(mg);a.type._context._currentValue=b}function sg(a,b){for(;null!==a;){var c=a.alternate;if((a.childLanes&b)===b)if(null===c||(c.childLanes&b)===b)break;else c.childLanes|=b;else a.childLanes|=b,null!==c&&(c.childLanes|=b);a=a.return}}function tg(a,b){ng=a;pg=og=null;a=a.dependencies;null!==a&&null!==a.firstContext&&(0!==(a.lanes&b)&&(ug=!0),a.firstContext=null)}
function vg(a,b){if(pg!==a&&!1!==b&&0!==b){if("number"!==typeof b||1073741823===b)pg=a,b=1073741823;b={context:a,observedBits:b,next:null};if(null===og){if(null===ng)throw Error(y(308));og=b;ng.dependencies={lanes:0,firstContext:b,responders:null}}else og=og.next=b}return a._currentValue}var wg=!1;function xg(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}
function yg(a,b){a=a.updateQueue;b.updateQueue===a&&(b.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function zg(a,b){return{eventTime:a,lane:b,tag:0,payload:null,callback:null,next:null}}function Ag(a,b){a=a.updateQueue;if(null!==a){a=a.shared;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b}}
function Bg(a,b){var c=a.updateQueue,d=a.alternate;if(null!==d&&(d=d.updateQueue,c===d)){var e=null,f=null;c=c.firstBaseUpdate;if(null!==c){do{var g={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};null===f?e=f=g:f=f.next=g;c=c.next}while(null!==c);null===f?e=f=b:f=f.next=b}else e=f=b;c={baseState:d.baseState,firstBaseUpdate:e,lastBaseUpdate:f,shared:d.shared,effects:d.effects};a.updateQueue=c;return}a=c.lastBaseUpdate;null===a?c.firstBaseUpdate=b:a.next=
b;c.lastBaseUpdate=b}
function Cg(a,b,c,d){var e=a.updateQueue;wg=!1;var f=e.firstBaseUpdate,g=e.lastBaseUpdate,h=e.shared.pending;if(null!==h){e.shared.pending=null;var k=h,l=k.next;k.next=null;null===g?f=l:g.next=l;g=k;var n=a.alternate;if(null!==n){n=n.updateQueue;var A=n.lastBaseUpdate;A!==g&&(null===A?n.firstBaseUpdate=l:A.next=l,n.lastBaseUpdate=k)}}if(null!==f){A=e.baseState;g=0;n=l=k=null;do{h=f.lane;var p=f.eventTime;if((d&h)===h){null!==n&&(n=n.next={eventTime:p,lane:0,tag:f.tag,payload:f.payload,callback:f.callback,
next:null});a:{var C=a,x=f;h=b;p=c;switch(x.tag){case 1:C=x.payload;if("function"===typeof C){A=C.call(p,A,h);break a}A=C;break a;case 3:C.flags=C.flags&-4097|64;case 0:C=x.payload;h="function"===typeof C?C.call(p,A,h):C;if(null===h||void 0===h)break a;A=m({},A,h);break a;case 2:wg=!0}}null!==f.callback&&(a.flags|=32,h=e.effects,null===h?e.effects=[f]:h.push(f))}else p={eventTime:p,lane:h,tag:f.tag,payload:f.payload,callback:f.callback,next:null},null===n?(l=n=p,k=A):n=n.next=p,g|=h;f=f.next;if(null===
f)if(h=e.shared.pending,null===h)break;else f=h.next,h.next=null,e.lastBaseUpdate=h,e.shared.pending=null}while(1);null===n&&(k=A);e.baseState=k;e.firstBaseUpdate=l;e.lastBaseUpdate=n;Dg|=g;a.lanes=g;a.memoizedState=A}}function Eg(a,b,c){a=b.effects;b.effects=null;if(null!==a)for(b=0;b<a.length;b++){var d=a[b],e=d.callback;if(null!==e){d.callback=null;d=c;if("function"!==typeof e)throw Error(y(191,e));e.call(d)}}}var Fg=(new aa.Component).refs;
function Gg(a,b,c,d){b=a.memoizedState;c=c(d,b);c=null===c||void 0===c?b:m({},b,c);a.memoizedState=c;0===a.lanes&&(a.updateQueue.baseState=c)}
var Kg={isMounted:function(a){return(a=a._reactInternals)?Zb(a)===a:!1},enqueueSetState:function(a,b,c){a=a._reactInternals;var d=Hg(),e=Ig(a),f=zg(d,e);f.payload=b;void 0!==c&&null!==c&&(f.callback=c);Ag(a,f);Jg(a,e,d)},enqueueReplaceState:function(a,b,c){a=a._reactInternals;var d=Hg(),e=Ig(a),f=zg(d,e);f.tag=1;f.payload=b;void 0!==c&&null!==c&&(f.callback=c);Ag(a,f);Jg(a,e,d)},enqueueForceUpdate:function(a,b){a=a._reactInternals;var c=Hg(),d=Ig(a),e=zg(c,d);e.tag=2;void 0!==b&&null!==b&&(e.callback=
b);Ag(a,e);Jg(a,d,c)}};function Lg(a,b,c,d,e,f,g){a=a.stateNode;return"function"===typeof a.shouldComponentUpdate?a.shouldComponentUpdate(d,f,g):b.prototype&&b.prototype.isPureReactComponent?!Je(c,d)||!Je(e,f):!0}
function Mg(a,b,c){var d=!1,e=Cf;var f=b.contextType;"object"===typeof f&&null!==f?f=vg(f):(e=Ff(b)?Df:M.current,d=b.contextTypes,f=(d=null!==d&&void 0!==d)?Ef(a,e):Cf);b=new b(c,f);a.memoizedState=null!==b.state&&void 0!==b.state?b.state:null;b.updater=Kg;a.stateNode=b;b._reactInternals=a;d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=e,a.__reactInternalMemoizedMaskedChildContext=f);return b}
function Ng(a,b,c,d){a=b.state;"function"===typeof b.componentWillReceiveProps&&b.componentWillReceiveProps(c,d);"function"===typeof b.UNSAFE_componentWillReceiveProps&&b.UNSAFE_componentWillReceiveProps(c,d);b.state!==a&&Kg.enqueueReplaceState(b,b.state,null)}
function Og(a,b,c,d){var e=a.stateNode;e.props=c;e.state=a.memoizedState;e.refs=Fg;xg(a);var f=b.contextType;"object"===typeof f&&null!==f?e.context=vg(f):(f=Ff(b)?Df:M.current,e.context=Ef(a,f));Cg(a,c,e,d);e.state=a.memoizedState;f=b.getDerivedStateFromProps;"function"===typeof f&&(Gg(a,b,f,c),e.state=a.memoizedState);"function"===typeof b.getDerivedStateFromProps||"function"===typeof e.getSnapshotBeforeUpdate||"function"!==typeof e.UNSAFE_componentWillMount&&"function"!==typeof e.componentWillMount||
(b=e.state,"function"===typeof e.componentWillMount&&e.componentWillMount(),"function"===typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),b!==e.state&&Kg.enqueueReplaceState(e,e.state,null),Cg(a,c,e,d),e.state=a.memoizedState);"function"===typeof e.componentDidMount&&(a.flags|=4)}var Pg=Array.isArray;
function Qg(a,b,c){a=c.ref;if(null!==a&&"function"!==typeof a&&"object"!==typeof a){if(c._owner){c=c._owner;if(c){if(1!==c.tag)throw Error(y(309));var d=c.stateNode}if(!d)throw Error(y(147,a));var e=""+a;if(null!==b&&null!==b.ref&&"function"===typeof b.ref&&b.ref._stringRef===e)return b.ref;b=function(a){var b=d.refs;b===Fg&&(b=d.refs={});null===a?delete b[e]:b[e]=a};b._stringRef=e;return b}if("string"!==typeof a)throw Error(y(284));if(!c._owner)throw Error(y(290,a));}return a}
function Rg(a,b){if("textarea"!==a.type)throw Error(y(31,"[object Object]"===Object.prototype.toString.call(b)?"object with keys {"+Object.keys(b).join(", ")+"}":b));}
function Sg(a){function b(b,c){if(a){var d=b.lastEffect;null!==d?(d.nextEffect=c,b.lastEffect=c):b.firstEffect=b.lastEffect=c;c.nextEffect=null;c.flags=8}}function c(c,d){if(!a)return null;for(;null!==d;)b(c,d),d=d.sibling;return null}function d(a,b){for(a=new Map;null!==b;)null!==b.key?a.set(b.key,b):a.set(b.index,b),b=b.sibling;return a}function e(a,b){a=Tg(a,b);a.index=0;a.sibling=null;return a}function f(b,c,d){b.index=d;if(!a)return c;d=b.alternate;if(null!==d)return d=d.index,d<c?(b.flags=2,
c):d;b.flags=2;return c}function g(b){a&&null===b.alternate&&(b.flags=2);return b}function h(a,b,c,d){if(null===b||6!==b.tag)return b=Ug(c,a.mode,d),b.return=a,b;b=e(b,c);b.return=a;return b}function k(a,b,c,d){if(null!==b&&b.elementType===c.type)return d=e(b,c.props),d.ref=Qg(a,b,c),d.return=a,d;d=Vg(c.type,c.key,c.props,null,a.mode,d);d.ref=Qg(a,b,c);d.return=a;return d}function l(a,b,c,d){if(null===b||4!==b.tag||b.stateNode.containerInfo!==c.containerInfo||b.stateNode.implementation!==c.implementation)return b=
Wg(c,a.mode,d),b.return=a,b;b=e(b,c.children||[]);b.return=a;return b}function n(a,b,c,d,f){if(null===b||7!==b.tag)return b=Xg(c,a.mode,d,f),b.return=a,b;b=e(b,c);b.return=a;return b}function A(a,b,c){if("string"===typeof b||"number"===typeof b)return b=Ug(""+b,a.mode,c),b.return=a,b;if("object"===typeof b&&null!==b){switch(b.$$typeof){case sa:return c=Vg(b.type,b.key,b.props,null,a.mode,c),c.ref=Qg(a,null,b),c.return=a,c;case ta:return b=Wg(b,a.mode,c),b.return=a,b}if(Pg(b)||La(b))return b=Xg(b,
a.mode,c,null),b.return=a,b;Rg(a,b)}return null}function p(a,b,c,d){var e=null!==b?b.key:null;if("string"===typeof c||"number"===typeof c)return null!==e?null:h(a,b,""+c,d);if("object"===typeof c&&null!==c){switch(c.$$typeof){case sa:return c.key===e?c.type===ua?n(a,b,c.props.children,d,e):k(a,b,c,d):null;case ta:return c.key===e?l(a,b,c,d):null}if(Pg(c)||La(c))return null!==e?null:n(a,b,c,d,null);Rg(a,c)}return null}function C(a,b,c,d,e){if("string"===typeof d||"number"===typeof d)return a=a.get(c)||
null,h(b,a,""+d,e);if("object"===typeof d&&null!==d){switch(d.$$typeof){case sa:return a=a.get(null===d.key?c:d.key)||null,d.type===ua?n(b,a,d.props.children,e,d.key):k(b,a,d,e);case ta:return a=a.get(null===d.key?c:d.key)||null,l(b,a,d,e)}if(Pg(d)||La(d))return a=a.get(c)||null,n(b,a,d,e,null);Rg(b,d)}return null}function x(e,g,h,k){for(var l=null,t=null,u=g,z=g=0,q=null;null!==u&&z<h.length;z++){u.index>z?(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(;z<h.length;z++)u=A(e,h[z],k),null!==u&&(g=f(u,g,z),null===t?l=u:t.sibling=u,t=u);return l}for(u=d(e,u);z<h.length;z++)q=C(u,e,z,h[z],k),null!==q&&(a&&null!==q.alternate&&u.delete(null===q.key?z:q.key),g=f(q,g,z),null===t?l=q:t.sibling=q,t=q);a&&u.forEach(function(a){return b(e,a)});return l}function w(e,g,h,k){var l=La(h);if("function"!==typeof l)throw Error(y(150));h=l.call(h);if(null==
h)throw Error(y(151));for(var t=l=null,u=g,z=g=0,q=null,n=h.next();null!==u&&!n.done;z++,n=h.next()){u.index>z?(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;a<th.length;a++)th[a]._workInProgressVersionPrimary=null;th.length=0}var vh=ra.ReactCurrentDispatcher,wh=ra.ReactCurrentBatchConfig,xh=0,R=null,S=null,T=null,yh=!1,zh=!1;function Ah(){throw Error(y(321));}function Bh(a,b){if(null===b)return!1;for(var c=0;c<b.length&&c<a.length;c++)if(!He(a[c],b[c]))return!1;return!0}
function Ch(a,b,c,d,e,f){xh=f;R=b;b.memoizedState=null;b.updateQueue=null;b.lanes=0;vh.current=null===a||null===a.memoizedState?Dh:Eh;a=c(d,e);if(zh){f=0;do{zh=!1;if(!(25>f))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;0<h;){var k=31-Vc(h),v=1<<k;d[k]|=a;h&=~v}}},[c,b,d]);h.useEffect(function(){return d(b._source,function(){var a=p.getSnapshot,c=p.setSnapshot;try{c(a(b._source));var d=Ig(w);e.mutableReadLanes|=d&e.pendingLanes}catch(q){c(function(){throw q;})}})},[b,d]);He(C,c)&&He(x,b)&&He(A,d)||(a={pending:null,dispatch:null,lastRenderedReducer:Jh,lastRenderedState:n},a.dispatch=l=Oh.bind(null,R,a),k.queue=a,k.baseQueue=null,n=Mh(e,b,c),k.memoizedState=k.baseState=n);return n}
function Ph(a,b,c){var d=Ih();return Nh(d,a,b,c)}function Qh(a){var b=Hh();"function"===typeof a&&(a=a());b.memoizedState=b.baseState=a;a=b.queue={pending:null,dispatch:null,lastRenderedReducer:Jh,lastRenderedState:a};a=a.dispatch=Oh.bind(null,R,a);return[b.memoizedState,a]}
function Rh(a,b,c,d){a={tag:a,create:b,destroy:c,deps:d,next:null};b=R.updateQueue;null===b?(b={lastEffect:null},R.updateQueue=b,b.lastEffect=a.next=a):(c=b.lastEffect,null===c?b.lastEffect=a.next=a:(d=c.next,c.next=a,a.next=d,b.lastEffect=a));return a}function Sh(a){var b=Hh();a={current:a};return b.memoizedState=a}function Th(){return Ih().memoizedState}function Uh(a,b,c,d){var e=Hh();R.flags|=a;e.memoizedState=Rh(1|b,c,void 0,void 0===d?null:d)}
function Vh(a,b,c,d){var e=Ih();d=void 0===d?null:d;var f=void 0;if(null!==S){var g=S.memoizedState;f=g.destroy;if(null!==d&&Bh(d,g.deps)){Rh(b,c,f,d);return}}R.flags|=a;e.memoizedState=Rh(1|b,c,f,d)}function Wh(a,b){return Uh(516,4,a,b)}function Xh(a,b){return Vh(516,4,a,b)}function Yh(a,b){return Vh(4,2,a,b)}function Zh(a,b){if("function"===typeof b)return a=a(),b(a),function(){b(null)};if(null!==b&&void 0!==b)return a=a(),b.current=a,function(){b.current=null}}
function $h(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return Vh(4,2,Zh.bind(null,b,a),c)}function ai(){}function bi(a,b){var c=Ih();b=void 0===b?null:b;var d=c.memoizedState;if(null!==d&&null!==b&&Bh(b,d[1]))return d[0];c.memoizedState=[a,b];return a}function ci(a,b){var c=Ih();b=void 0===b?null:b;var d=c.memoizedState;if(null!==d&&null!==b&&Bh(b,d[1]))return d[0];a=a();c.memoizedState=[a,b];return a}
function di(a,b){var c=eg();gg(98>c?98:c,function(){a(!0)});gg(97<c?97:c,function(){var c=wh.transition;wh.transition=1;try{a(!1),b()}finally{wh.transition=c}})}
function Oh(a,b,c){var d=Hg(),e=Ig(a),f={lane:e,action:c,eagerReducer:null,eagerState:null,next:null},g=b.pending;null===g?f.next=f:(f.next=g.next,g.next=f);b.pending=f;g=a.alternate;if(a===R||null!==g&&g===R)zh=yh=!0;else{if(0===a.lanes&&(null===g||0===g.lanes)&&(g=b.lastRenderedReducer,null!==g))try{var h=b.lastRenderedState,k=g(h,c);f.eagerReducer=g;f.eagerState=k;if(He(k,h))return}catch(l){}finally{}Jg(a,e,d)}}
var Gh={readContext:vg,useCallback:Ah,useContext:Ah,useEffect:Ah,useImperativeHandle:Ah,useLayoutEffect:Ah,useMemo:Ah,useReducer:Ah,useRef:Ah,useState:Ah,useDebugValue:Ah,useDeferredValue:Ah,useTransition:Ah,useMutableSource:Ah,useOpaqueIdentifier:Ah,unstable_isNewReconciler:!1},Dh={readContext:vg,useCallback:function(a,b){Hh().memoizedState=[a,void 0===b?null:b];return a},useContext:vg,useEffect:Wh,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return Uh(4,2,Zh.bind(null,
b,a),c)},useLayoutEffect:function(a,b){return Uh(4,2,a,b)},useMemo:function(a,b){var c=Hh();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=Hh();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a=d.queue={pending:null,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};a=a.dispatch=Oh.bind(null,R,a);return[d.memoizedState,a]},useRef:Sh,useState:Qh,useDebugValue:ai,useDeferredValue:function(a){var b=Qh(a),c=b[0],d=b[1];Wh(function(){var b=wh.transition;
wh.transition=1;try{d(a)}finally{wh.transition=b}},[a]);return c},useTransition:function(){var a=Qh(!1),b=a[0];a=di.bind(null,a[1]);Sh(a);return[a,b]},useMutableSource:function(a,b,c){var d=Hh();d.memoizedState={refs:{getSnapshot:b,setSnapshot:null},source:a,subscribe:c};return Nh(d,a,b,c)},useOpaqueIdentifier:function(){if(lh){var a=!1,b=uf(function(){a||(a=!0,c("r:"+(tf++).toString(36)));throw Error(y(355));}),c=Qh(b)[1];0===(R.mode&2)&&(R.flags|=516,Rh(5,function(){c("r:"+(tf++).toString(36))},
void 0,null));return b}b="r:"+(tf++).toString(36);Qh(b);return b},unstable_isNewReconciler:!1},Eh={readContext:vg,useCallback:bi,useContext:vg,useEffect:Xh,useImperativeHandle:$h,useLayoutEffect:Yh,useMemo:ci,useReducer:Kh,useRef:Th,useState:function(){return Kh(Jh)},useDebugValue:ai,useDeferredValue:function(a){var b=Kh(Jh),c=b[0],d=b[1];Xh(function(){var b=wh.transition;wh.transition=1;try{d(a)}finally{wh.transition=b}},[a]);return c},useTransition:function(){var a=Kh(Jh)[0];return[Th().current,
a]},useMutableSource:Ph,useOpaqueIdentifier:function(){return Kh(Jh)[0]},unstable_isNewReconciler:!1},Fh={readContext:vg,useCallback:bi,useContext:vg,useEffect:Xh,useImperativeHandle:$h,useLayoutEffect:Yh,useMemo:ci,useReducer:Lh,useRef:Th,useState:function(){return Lh(Jh)},useDebugValue:ai,useDeferredValue:function(a){var b=Lh(Jh),c=b[0],d=b[1];Xh(function(){var b=wh.transition;wh.transition=1;try{d(a)}finally{wh.transition=b}},[a]);return c},useTransition:function(){var a=Lh(Jh)[0];return[Th().current,
a]},useMutableSource:Ph,useOpaqueIdentifier:function(){return Lh(Jh)[0]},unstable_isNewReconciler:!1},ei=ra.ReactCurrentOwner,ug=!1;function fi(a,b,c,d){b.child=null===a?Zg(b,null,c,d):Yg(b,a.child,c,d)}function gi(a,b,c,d,e){c=c.render;var f=b.ref;tg(b,e);d=Ch(a,b,c,d,f,e);if(null!==a&&!ug)return b.updateQueue=a.updateQueue,b.flags&=-517,a.lanes&=~e,hi(a,b,e);b.flags|=1;fi(a,b,d,e);return b.child}
function ii(a,b,c,d,e,f){if(null===a){var g=c.type;if("function"===typeof g&&!ji(g)&&void 0===g.defaultProps&&null===c.compare&&void 0===c.defaultProps)return b.tag=15,b.type=g,ki(a,b,g,d,e,f);a=Vg(c.type,null,d,b,b.mode,f);a.ref=b.ref;a.return=b;return b.child=a}g=a.child;if(0===(e&f)&&(e=g.memoizedProps,c=c.compare,c=null!==c?c:Je,c(e,d)&&a.ref===b.ref))return hi(a,b,f);b.flags|=1;a=Tg(g,d);a.ref=b.ref;a.return=b;return b.child=a}
function ki(a,b,c,d,e,f){if(null!==a&&Je(a.memoizedProps,d)&&a.ref===b.ref)if(ug=!1,0!==(f&e))0!==(a.flags&16384)&&(ug=!0);else return b.lanes=a.lanes,hi(a,b,f);return li(a,b,c,d,f)}
function mi(a,b,c){var d=b.pendingProps,e=d.children,f=null!==a?a.memoizedState:null;if("hidden"===d.mode||"unstable-defer-without-hiding"===d.mode)if(0===(b.mode&4))b.memoizedState={baseLanes:0},ni(b,c);else if(0!==(c&1073741824))b.memoizedState={baseLanes:0},ni(b,null!==f?f.baseLanes:c);else return a=null!==f?f.baseLanes|c:c,b.lanes=b.childLanes=1073741824,b.memoizedState={baseLanes:a},ni(b,a),null;else null!==f?(d=f.baseLanes|c,b.memoizedState=null):d=c,ni(b,d);fi(a,b,e,c);return b.child}
function oi(a,b){var c=b.ref;if(null===a&&null!==c||null!==a&&a.ref!==c)b.flags|=128}function li(a,b,c,d,e){var f=Ff(c)?Df:M.current;f=Ef(b,f);tg(b,e);c=Ch(a,b,c,d,f,e);if(null!==a&&!ug)return b.updateQueue=a.updateQueue,b.flags&=-517,a.lanes&=~e,hi(a,b,e);b.flags|=1;fi(a,b,c,e);return b.child}
function pi(a,b,c,d,e){if(Ff(c)){var f=!0;Jf(b)}else f=!1;tg(b,e);if(null===b.stateNode)null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2),Mg(b,c,d),Og(b,c,d,e),d=!0;else if(null===a){var g=b.stateNode,h=b.memoizedProps;g.props=h;var k=g.context,l=c.contextType;"object"===typeof l&&null!==l?l=vg(l):(l=Ff(c)?Df:M.current,l=Ef(b,l));var n=c.getDerivedStateFromProps,A="function"===typeof n||"function"===typeof g.getSnapshotBeforeUpdate;A||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&
"function"!==typeof g.componentWillReceiveProps||(h!==d||k!==l)&&Ng(b,g,d,l);wg=!1;var p=b.memoizedState;g.state=p;Cg(b,d,g,e);k=b.memoizedState;h!==d||p!==k||N.current||wg?("function"===typeof n&&(Gg(b,c,n,d),k=b.memoizedState),(h=wg||Lg(b,c,h,d,p,k,l))?(A||"function"!==typeof g.UNSAFE_componentWillMount&&"function"!==typeof g.componentWillMount||("function"===typeof g.componentWillMount&&g.componentWillMount(),"function"===typeof g.UNSAFE_componentWillMount&&g.UNSAFE_componentWillMount()),"function"===
typeof g.componentDidMount&&(b.flags|=4)):("function"===typeof g.componentDidMount&&(b.flags|=4),b.memoizedProps=d,b.memoizedState=k),g.props=d,g.state=k,g.context=l,d=h):("function"===typeof g.componentDidMount&&(b.flags|=4),d=!1)}else{g=b.stateNode;yg(a,b);h=b.memoizedProps;l=b.type===b.elementType?h:lg(b.type,h);g.props=l;A=b.pendingProps;p=g.context;k=c.contextType;"object"===typeof k&&null!==k?k=vg(k):(k=Ff(c)?Df:M.current,k=Ef(b,k));var C=c.getDerivedStateFromProps;(n="function"===typeof C||
"function"===typeof g.getSnapshotBeforeUpdate)||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&"function"!==typeof g.componentWillReceiveProps||(h!==A||p!==k)&&Ng(b,g,d,k);wg=!1;p=b.memoizedState;g.state=p;Cg(b,d,g,e);var x=b.memoizedState;h!==A||p!==x||N.current||wg?("function"===typeof C&&(Gg(b,c,C,d),x=b.memoizedState),(l=wg||Lg(b,c,l,d,p,x,k))?(n||"function"!==typeof g.UNSAFE_componentWillUpdate&&"function"!==typeof g.componentWillUpdate||("function"===typeof g.componentWillUpdate&&g.componentWillUpdate(d,
x,k),"function"===typeof g.UNSAFE_componentWillUpdate&&g.UNSAFE_componentWillUpdate(d,x,k)),"function"===typeof g.componentDidUpdate&&(b.flags|=4),"function"===typeof g.getSnapshotBeforeUpdate&&(b.flags|=256)):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&p===a.memoizedState||(b.flags|=4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&p===a.memoizedState||(b.flags|=256),b.memoizedProps=d,b.memoizedState=x),g.props=d,g.state=x,g.context=k,d=l):("function"!==typeof g.componentDidUpdate||
h===a.memoizedProps&&p===a.memoizedState||(b.flags|=4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&p===a.memoizedState||(b.flags|=256),d=!1)}return qi(a,b,c,d,f,e)}
function qi(a,b,c,d,e,f){oi(a,b);var g=0!==(b.flags&64);if(!d&&!g)return e&&Kf(b,c,!1),hi(a,b,f);d=b.stateNode;ei.current=b;var h=g&&"function"!==typeof c.getDerivedStateFromError?null:d.render();b.flags|=1;null!==a&&g?(b.child=Yg(b,a.child,null,f),b.child=Yg(b,null,h,f)):fi(a,b,h,f);b.memoizedState=d.state;e&&Kf(b,c,!0);return b.child}function ri(a){var b=a.stateNode;b.pendingContext?Hf(a,b.pendingContext,b.pendingContext!==b.context):b.context&&Hf(a,b.context,!1);eh(a,b.containerInfo)}
var si={dehydrated:null,retryLane:0};
function ti(a,b,c){var d=b.pendingProps,e=P.current,f=!1,g;(g=0!==(b.flags&64))||(g=null!==a&&null===a.memoizedState?!1:0!==(e&2));g?(f=!0,b.flags&=-65):null!==a&&null===a.memoizedState||void 0===d.fallback||!0===d.unstable_avoidThisFallback||(e|=1);I(P,e&1);if(null===a){void 0!==d.fallback&&ph(b);a=d.children;e=d.fallback;if(f)return a=ui(b,a,e,c),b.child.memoizedState={baseLanes:c},b.memoizedState=si,a;if("number"===typeof d.unstable_expectedLoadTime)return a=ui(b,a,e,c),b.child.memoizedState={baseLanes:c},
b.memoizedState=si,b.lanes=33554432,a;c=vi({mode:"visible",children:a},b.mode,c,null);c.return=b;return b.child=c}if(null!==a.memoizedState){if(f)return d=wi(a,b,d.children,d.fallback,c),f=b.child,e=a.child.memoizedState,f.memoizedState=null===e?{baseLanes:c}:{baseLanes:e.baseLanes|c},f.childLanes=a.childLanes&~c,b.memoizedState=si,d;c=xi(a,b,d.children,c);b.memoizedState=null;return c}if(f)return d=wi(a,b,d.children,d.fallback,c),f=b.child,e=a.child.memoizedState,f.memoizedState=null===e?{baseLanes:c}:
{baseLanes:e.baseLanes|c},f.childLanes=a.childLanes&~c,b.memoizedState=si,d;c=xi(a,b,d.children,c);b.memoizedState=null;return c}function ui(a,b,c,d){var e=a.mode,f=a.child;b={mode:"hidden",children:b};0===(e&2)&&null!==f?(f.childLanes=0,f.pendingProps=b):f=vi(b,e,0,null);c=Xg(c,e,d,null);f.return=a;c.return=a;f.sibling=c;a.child=f;return c}
function xi(a,b,c,d){var e=a.child;a=e.sibling;c=Tg(e,{mode:"visible",children:c});0===(b.mode&2)&&(c.lanes=d);c.return=b;c.sibling=null;null!==a&&(a.nextEffect=null,a.flags=8,b.firstEffect=b.lastEffect=a);return b.child=c}
function wi(a,b,c,d,e){var f=b.mode,g=a.child;a=g.sibling;var h={mode:"hidden",children:c};0===(f&2)&&b.child!==g?(c=b.child,c.childLanes=0,c.pendingProps=h,g=c.lastEffect,null!==g?(b.firstEffect=c.firstEffect,b.lastEffect=g,g.nextEffect=null):b.firstEffect=b.lastEffect=null):c=Tg(g,h);null!==a?d=Tg(a,d):(d=Xg(d,f,e,null),d.flags|=2);d.return=b;c.return=b;c.sibling=d;b.child=c;return d}function yi(a,b){a.lanes|=b;var c=a.alternate;null!==c&&(c.lanes|=b);sg(a.return,b)}
function zi(a,b,c,d,e,f){var g=a.memoizedState;null===g?a.memoizedState={isBackwards:b,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:e,lastEffect:f}:(g.isBackwards=b,g.rendering=null,g.renderingStartTime=0,g.last=d,g.tail=c,g.tailMode=e,g.lastEffect=f)}
function Ai(a,b,c){var d=b.pendingProps,e=d.revealOrder,f=d.tail;fi(a,b,d.children,c);d=P.current;if(0!==(d&2))d=d&1|2,b.flags|=64;else{if(null!==a&&0!==(a.flags&64))a:for(a=b.child;null!==a;){if(13===a.tag)null!==a.memoizedState&&yi(a,c);else if(19===a.tag)yi(a,c);else if(null!==a.child){a.child.return=a;a=a.child;continue}if(a===b)break a;for(;null===a.sibling;){if(null===a.return||a.return===b)break a;a=a.return}a.sibling.return=a.return;a=a.sibling}d&=1}I(P,d);if(0===(b.mode&2))b.memoizedState=
null;else switch(e){case "forwards":c=b.child;for(e=null;null!==c;)a=c.alternate,null!==a&&null===ih(a)&&(e=c),c=c.sibling;c=e;null===c?(e=b.child,b.child=null):(e=c.sibling,c.sibling=null);zi(b,!1,e,c,f,b.lastEffect);break;case "backwards":c=null;e=b.child;for(b.child=null;null!==e;){a=e.alternate;if(null!==a&&null===ih(a)){b.child=e;break}a=e.sibling;e.sibling=c;c=e;e=a}zi(b,!0,c,null,f,b.lastEffect);break;case "together":zi(b,!1,null,null,void 0,b.lastEffect);break;default:b.memoizedState=null}return b.child}
function hi(a,b,c){null!==a&&(b.dependencies=a.dependencies);Dg|=b.lanes;if(0!==(c&b.childLanes)){if(null!==a&&b.child!==a.child)throw Error(y(153));if(null!==b.child){a=b.child;c=Tg(a,a.pendingProps);b.child=c;for(c.return=b;null!==a.sibling;)a=a.sibling,c=c.sibling=Tg(a,a.pendingProps),c.return=b;c.sibling=null}return b.child}return null}var Bi,Ci,Di,Ei;
Bi=function(a,b){for(var c=b.child;null!==c;){if(5===c.tag||6===c.tag)a.appendChild(c.stateNode);else if(4!==c.tag&&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}c.sibling.return=c.return;c=c.sibling}};Ci=function(){};
Di=function(a,b,c,d){var e=a.memoizedProps;if(e!==d){a=b.stateNode;dh(ah.current);var f=null;switch(c){case "input":e=Ya(a,e);d=Ya(a,d);f=[];break;case "option":e=eb(a,e);d=eb(a,d);f=[];break;case "select":e=m({},e,{value:void 0});d=m({},d,{value:void 0});f=[];break;case "textarea":e=gb(a,e);d=gb(a,d);f=[];break;default:"function"!==typeof e.onClick&&"function"===typeof d.onClick&&(a.onclick=jf)}vb(c,d);var g;c=null;for(l in e)if(!d.hasOwnProperty(l)&&e.hasOwnProperty(l)&&null!=e[l])if("style"===
l){var h=e[l];for(g in h)h.hasOwnProperty(g)&&(c||(c={}),c[g]="")}else"dangerouslySetInnerHTML"!==l&&"children"!==l&&"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&"autoFocus"!==l&&(ca.hasOwnProperty(l)?f||(f=[]):(f=f||[]).push(l,null));for(l in d){var k=d[l];h=null!=e?e[l]:void 0;if(d.hasOwnProperty(l)&&k!==h&&(null!=k||null!=h))if("style"===l)if(h){for(g in h)!h.hasOwnProperty(g)||k&&k.hasOwnProperty(g)||(c||(c={}),c[g]="");for(g in k)k.hasOwnProperty(g)&&h[g]!==k[g]&&(c||
(c={}),c[g]=k[g])}else c||(f||(f=[]),f.push(l,c)),c=k;else"dangerouslySetInnerHTML"===l?(k=k?k.__html:void 0,h=h?h.__html:void 0,null!=k&&h!==k&&(f=f||[]).push(l,k)):"children"===l?"string"!==typeof k&&"number"!==typeof k||(f=f||[]).push(l,""+k):"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&(ca.hasOwnProperty(l)?(null!=k&&"onScroll"===l&&G("scroll",a),f||h===k||(f=[])):"object"===typeof k&&null!==k&&k.$$typeof===Ga?k.toString():(f=f||[]).push(l,k))}c&&(f=f||[]).push("style",
c);var l=f;if(b.updateQueue=l)b.flags|=4}};Ei=function(a,b,c,d){c!==d&&(b.flags|=4)};function Fi(a,b){if(!lh)switch(a.tailMode){case "hidden":b=a.tail;for(var c=null;null!==b;)null!==b.alternate&&(c=b),b=b.sibling;null===c?a.tail=null:c.sibling=null;break;case "collapsed":c=a.tail;for(var d=null;null!==c;)null!==c.alternate&&(d=c),c=c.sibling;null===d?b||null===a.tail?a.tail=null:a.tail.sibling=null:d.sibling=null}}
function Gi(a,b,c){var d=b.pendingProps;switch(b.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:return Ff(b.type)&&Gf(),null;case 3:fh();H(N);H(M);uh();d=b.stateNode;d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null);if(null===a||null===a.child)rh(b)?b.flags|=4:d.hydrate||(b.flags|=256);Ci(b);return null;case 5:hh(b);var e=dh(ch.current);c=b.type;if(null!==a&&null!=b.stateNode)Di(a,b,c,d,e),a.ref!==b.ref&&(b.flags|=128);else{if(!d){if(null===
b.stateNode)throw Error(y(166));return null}a=dh(ah.current);if(rh(b)){d=b.stateNode;c=b.type;var f=b.memoizedProps;d[wf]=b;d[xf]=f;switch(c){case "dialog":G("cancel",d);G("close",d);break;case "iframe":case "object":case "embed":G("load",d);break;case "video":case "audio":for(a=0;a<Xe.length;a++)G(Xe[a],d);break;case "source":G("error",d);break;case "img":case "image":case "link":G("error",d);G("load",d);break;case "details":G("toggle",d);break;case "input":Za(d,f);G("invalid",d);break;case "select":d._wrapperState=
{wasMultiple:!!f.multiple};G("invalid",d);break;case "textarea":hb(d,f),G("invalid",d)}vb(c,f);a=null;for(var g in f)f.hasOwnProperty(g)&&(e=f[g],"children"===g?"string"===typeof e?d.textContent!==e&&(a=["children",e]):"number"===typeof e&&d.textContent!==""+e&&(a=["children",""+e]):ca.hasOwnProperty(g)&&null!=e&&"onScroll"===g&&G("scroll",d));switch(c){case "input":Va(d);cb(d,f,!0);break;case "textarea":Va(d);jb(d);break;case "select":case "option":break;default:"function"===typeof f.onClick&&(d.onclick=
jf)}d=a;b.updateQueue=d;null!==d&&(b.flags|=4)}else{g=9===e.nodeType?e:e.ownerDocument;a===kb.html&&(a=lb(c));a===kb.html?"script"===c?(a=g.createElement("div"),a.innerHTML="<script>\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;e<Xe.length;e++)G(Xe[e],a);e=d;break;case "source":G("error",a);e=d;break;case "img":case "image":case "link":G("error",a);G("load",a);e=d;break;case "details":G("toggle",a);e=d;break;case "input":Za(a,d);e=Ya(a,d);G("invalid",a);break;case "option":e=eb(a,d);break;case "select":a._wrapperState={wasMultiple:!!d.multiple};e=m({},d,{value:void 0});G("invalid",a);break;case "textarea":hb(a,d);e=
gb(a,d);G("invalid",a);break;default:e=d}vb(c,e);var h=e;for(f in h)if(h.hasOwnProperty(f)){var k=h[f];"style"===f?tb(a,k):"dangerouslySetInnerHTML"===f?(k=k?k.__html:void 0,null!=k&&ob(a,k)):"children"===f?"string"===typeof k?("textarea"!==c||""!==k)&&pb(a,k):"number"===typeof k&&pb(a,""+k):"suppressContentEditableWarning"!==f&&"suppressHydrationWarning"!==f&&"autoFocus"!==f&&(ca.hasOwnProperty(f)?null!=k&&"onScroll"===f&&G("scroll",a):null!=k&&qa(a,f,k,g))}switch(c){case "input":Va(a);cb(a,d,!1);
break;case "textarea":Va(a);jb(a);break;case "option":null!=d.value&&a.setAttribute("value",""+Sa(d.value));break;case "select":a.multiple=!!d.multiple;f=d.value;null!=f?fb(a,!!d.multiple,f,!1):null!=d.defaultValue&&fb(a,!!d.multiple,d.defaultValue,!0);break;default:"function"===typeof e.onClick&&(a.onclick=jf)}mf(c,d)&&(b.flags|=4)}null!==b.ref&&(b.flags|=128)}return null;case 6:if(a&&null!=b.stateNode)Ei(a,b,a.memoizedProps,d);else{if("string"!==typeof d&&null===b.stateNode)throw Error(y(166));
c=dh(ch.current);dh(ah.current);rh(b)?(d=b.stateNode,c=b.memoizedProps,d[wf]=b,d.nodeValue!==c&&(b.flags|=4)):(d=(9===c.nodeType?c:c.ownerDocument).createTextNode(d),d[wf]=b,b.stateNode=d)}return null;case 13:H(P);d=b.memoizedState;if(0!==(b.flags&64))return b.lanes=c,b;d=null!==d;c=!1;null===a?void 0!==b.memoizedProps.fallback&&rh(b):c=null!==a.memoizedState;if(d&&!c&&0!==(b.mode&2))if(null===a&&!0!==b.memoizedProps.unstable_avoidThisFallback||0!==(P.current&1))0===V&&(V=3);else{if(0===V||3===V)V=
4;null===U||0===(Dg&134217727)&&0===(Hi&134217727)||Ii(U,W)}if(d||c)b.flags|=4;return null;case 4:return fh(),Ci(b),null===a&&cf(b.stateNode.containerInfo),null;case 10:return rg(b),null;case 17:return Ff(b.type)&&Gf(),null;case 19:H(P);d=b.memoizedState;if(null===d)return null;f=0!==(b.flags&64);g=d.rendering;if(null===g)if(f)Fi(d,!1);else{if(0!==V||null!==a&&0!==(a.flags&64))for(a=b.child;null!==a;){g=ih(a);if(null!==g){b.flags|=64;Fi(d,!1);f=g.updateQueue;null!==f&&(b.updateQueue=f,b.flags|=4);
null===d.lastEffect&&(b.firstEffect=null);b.lastEffect=d.lastEffect;d=c;for(c=b.child;null!==c;)f=c,a=d,f.flags&=2,f.nextEffect=null,f.firstEffect=null,f.lastEffect=null,g=f.alternate,null===g?(f.childLanes=0,f.lanes=a,f.child=null,f.memoizedProps=null,f.memoizedState=null,f.updateQueue=null,f.dependencies=null,f.stateNode=null):(f.childLanes=g.childLanes,f.lanes=g.lanes,f.child=g.child,f.memoizedProps=g.memoizedProps,f.memoizedState=g.memoizedState,f.updateQueue=g.updateQueue,f.type=g.type,a=g.dependencies,
f.dependencies=null===a?null:{lanes:a.lanes,firstContext:a.firstContext}),c=c.sibling;I(P,P.current&1|2);return b.child}a=a.sibling}null!==d.tail&&O()>Ji&&(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;e<f.length;e+=
2){var g=f[e],h=f[e+1];"style"===g?tb(c,h):"dangerouslySetInnerHTML"===g?ob(c,h):"children"===g?pb(c,h):qa(c,g,h,b)}switch(a){case "input":ab(c,d);break;case "textarea":ib(c,d);break;case "select":a=c._wrapperState.wasMultiple,c._wrapperState.wasMultiple=!!d.multiple,f=d.value,null!=f?fb(c,!!d.multiple,f,!1):a!==!!d.multiple&&(null!=d.defaultValue?fb(c,!!d.multiple,d.defaultValue,!0):fb(c,!!d.multiple,d.multiple?[]:"",!1))}}}return;case 6:if(null===b.stateNode)throw Error(y(162));b.stateNode.nodeValue=
b.memoizedProps;return;case 3:c=b.stateNode;c.hydrate&&(c.hydrate=!1,Cc(c.containerInfo));return;case 12:return;case 13:null!==b.memoizedState&&(jj=O(),aj(b.child,!0));kj(b);return;case 19:kj(b);return;case 17:return;case 23:case 24:aj(b,null!==b.memoizedState);return}throw Error(y(163));}function kj(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Ui);b.forEach(function(b){var d=lj.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}}
function mj(a,b){return null!==a&&(a=a.memoizedState,null===a||null!==a.dehydrated)?(b=b.memoizedState,null!==b&&null===b.dehydrated):!1}var nj=Math.ceil,oj=ra.ReactCurrentDispatcher,pj=ra.ReactCurrentOwner,X=0,U=null,Y=null,W=0,qj=0,rj=Bf(0),V=0,sj=null,tj=0,Dg=0,Hi=0,uj=0,vj=null,jj=0,Ji=Infinity;function wj(){Ji=O()+500}var Z=null,Qi=!1,Ri=null,Ti=null,xj=!1,yj=null,zj=90,Aj=[],Bj=[],Cj=null,Dj=0,Ej=null,Fj=-1,Gj=0,Hj=0,Ij=null,Jj=!1;function Hg(){return 0!==(X&48)?O():-1!==Fj?Fj:Fj=O()}
function Ig(a){a=a.mode;if(0===(a&2))return 1;if(0===(a&4))return 99===eg()?1:2;0===Gj&&(Gj=tj);if(0!==kg.transition){0!==Hj&&(Hj=null!==vj?vj.pendingLanes:0);a=Gj;var b=4186112&~Hj;b&=-b;0===b&&(a=4186112&~a,b=a&-a,0===b&&(b=8192));return b}a=eg();0!==(X&4)&&98===a?a=Xc(12,Gj):(a=Sc(a),a=Xc(a,Gj));return a}
function Jg(a,b,c){if(50<Dj)throw Dj=0,Ej=null,Error(y(185));a=Kj(a,b);if(null===a)return null;$c(a,b,c);a===U&&(Hi|=b,4===V&&Ii(a,W));var d=eg();1===b?0!==(X&8)&&0===(X&48)?Lj(a):(Mj(a,c),0===X&&(wj(),ig())):(0===(X&4)||98!==d&&99!==d||(null===Cj?Cj=new Set([a]):Cj.add(a)),Mj(a,c));vj=a}function Kj(a,b){a.lanes|=b;var c=a.alternate;null!==c&&(c.lanes|=b);c=a;for(a=a.return;null!==a;)a.childLanes|=b,c=a.alternate,null!==c&&(c.childLanes|=b),c=a,a=a.return;return 3===c.tag?c.stateNode:null}
function Mj(a,b){for(var c=a.callbackNode,d=a.suspendedLanes,e=a.pingedLanes,f=a.expirationTimes,g=a.pendingLanes;0<g;){var h=31-Vc(g),k=1<<h,l=f[h];if(-1===l){if(0===(k&d)||0!==(k&e)){l=b;Rc(k);var n=F;f[h]=10<=n?l+250:6<=n?l+5E3:-1}}else l<=b&&(a.expiredLanes|=k);g&=~k}d=Uc(a,a===U?W:0);b=F;if(0===d)null!==c&&(c!==Zf&&Pf(c),a.callbackNode=null,a.callbackPriority=0);else{if(null!==c){if(a.callbackPriority===b)return;c!==Zf&&Pf(c)}15===b?(c=Lj.bind(null,a),null===ag?(ag=[c],bg=Of(Uf,jg)):ag.push(c),
c=Zf):14===b?c=hg(99,Lj.bind(null,a)):(c=Tc(b),c=hg(c,Nj.bind(null,a)));a.callbackPriority=b;a.callbackNode=c}}
function Nj(a){Fj=-1;Hj=Gj=0;if(0!==(X&48))throw Error(y(327));var b=a.callbackNode;if(Oj()&&a.callbackNode!==b)return null;var c=Uc(a,a===U?W:0);if(0===c)return null;var d=c;var e=X;X|=16;var f=Pj();if(U!==a||W!==d)wj(),Qj(a,d);do try{Rj();break}catch(h){Sj(a,h)}while(1);qg();oj.current=f;X=e;null!==Y?d=0:(U=null,W=0,d=V);if(0!==(tj&Hi))Qj(a,0);else if(0!==d){2===d&&(X|=64,a.hydrate&&(a.hydrate=!1,qf(a.containerInfo)),c=Wc(a),0!==c&&(d=Tj(a,c)));if(1===d)throw b=sj,Qj(a,0),Ii(a,c),Mj(a,O()),b;a.finishedWork=
a.current.alternate;a.finishedLanes=c;switch(d){case 0:case 1:throw Error(y(345));case 2:Uj(a);break;case 3:Ii(a,c);if((c&62914560)===c&&(d=jj+500-O(),10<d)){if(0!==Uc(a,0))break;e=a.suspendedLanes;if((e&c)!==c){Hg();a.pingedLanes|=a.suspendedLanes&e;break}a.timeoutHandle=of(Uj.bind(null,a),d);break}Uj(a);break;case 4:Ii(a,c);if((c&4186112)===c)break;d=a.eventTimes;for(e=-1;0<c;){var g=31-Vc(c);f=1<<g;g=d[g];g>e&&(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<c){a.timeoutHandle=of(Uj.bind(null,a),c);break}Uj(a);break;case 5:Uj(a);break;default:throw Error(y(329));}}Mj(a,O());return a.callbackNode===b?Nj.bind(null,a):null}function Ii(a,b){b&=~uj;b&=~Hi;a.suspendedLanes|=b;a.pingedLanes&=~b;for(a=a.expirationTimes;0<b;){var c=31-Vc(b),d=1<<c;a[c]=-1;b&=~d}}
function Lj(a){if(0!==(X&48))throw Error(y(327));Oj();if(a===U&&0!==(a.expiredLanes&W)){var b=W;var c=Tj(a,b);0!==(tj&Hi)&&(b=Uc(a,b),c=Tj(a,b))}else b=Uc(a,0),c=Tj(a,b);0!==a.tag&&2===c&&(X|=64,a.hydrate&&(a.hydrate=!1,qf(a.containerInfo)),b=Wc(a),0!==b&&(c=Tj(a,b)));if(1===c)throw c=sj,Qj(a,0),Ii(a,b),Mj(a,O()),c;a.finishedWork=a.current.alternate;a.finishedLanes=b;Uj(a);Mj(a,O());return null}
function Vj(){if(null!==Cj){var a=Cj;Cj=null;a.forEach(function(a){a.expiredLanes|=24&a.pendingLanes;Mj(a,O())})}ig()}function Wj(a,b){var c=X;X|=1;try{return a(b)}finally{X=c,0===X&&(wj(),ig())}}function Xj(a,b){var c=X;X&=-2;X|=8;try{return a(b)}finally{X=c,0===X&&(wj(),ig())}}function ni(a,b){I(rj,qj);qj|=b;tj|=b}function Ki(){qj=rj.current;H(rj)}
function Qj(a,b){a.finishedWork=null;a.finishedLanes=0;var c=a.timeoutHandle;-1!==c&&(a.timeoutHandle=-1,pf(c));if(null!==Y)for(c=Y.return;null!==c;){var d=c;switch(d.tag){case 1:d=d.type.childContextTypes;null!==d&&void 0!==d&&Gf();break;case 3:fh();H(N);H(M);uh();break;case 5:hh(d);break;case 4:fh();break;case 13:H(P);break;case 19:H(P);break;case 10:rg(d);break;case 23:case 24:Ki()}c=c.return}U=a;Y=Tg(a.current,null);W=qj=tj=b;V=0;sj=null;uj=Hi=Dg=0}
function Sj(a,b){do{var c=Y;try{qg();vh.current=Gh;if(yh){for(var d=R.memoizedState;null!==d;){var e=d.queue;null!==e&&(e.pending=null);d=d.next}yh=!1}xh=0;T=S=R=null;zh=!1;pj.current=null;if(null===c||null===c.return){V=1;sj=b;Y=null;break}a:{var f=a,g=c.return,h=c,k=b;b=W;h.flags|=2048;h.firstEffect=h.lastEffect=null;if(null!==k&&"object"===typeof k&&"function"===typeof k.then){var l=k;if(0===(h.mode&2)){var n=h.alternate;n?(h.updateQueue=n.updateQueue,h.memoizedState=n.memoizedState,h.lanes=n.lanes):
(h.updateQueue=null,h.memoizedState=null)}var A=0!==(P.current&1),p=g;do{var C;if(C=13===p.tag){var x=p.memoizedState;if(null!==x)C=null!==x.dehydrated?!0:!1;else{var w=p.memoizedProps;C=void 0===w.fallback?!1:!0!==w.unstable_avoidThisFallback?!0:A?!1:!0}}if(C){var z=p.updateQueue;if(null===z){var u=new Set;u.add(l);p.updateQueue=u}else z.add(l);if(0===(p.mode&2)){p.flags|=64;h.flags|=16384;h.flags&=-2981;if(1===h.tag)if(null===h.alternate)h.tag=17;else{var t=zg(-1,1);t.tag=2;Ag(h,t)}h.lanes|=1;break a}k=
void 0;h=b;var q=f.pingCache;null===q?(q=f.pingCache=new Oi,k=new Set,q.set(l,k)):(k=q.get(l),void 0===k&&(k=new Set,q.set(l,k)));if(!k.has(h)){k.add(h);var v=Yj.bind(null,f,l,h);l.then(v,v)}p.flags|=4096;p.lanes=b;break a}p=p.return}while(null!==p);k=Error((Ra(h.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> 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),1<b.flags&&(null!==
a.lastEffect?a.lastEffect.nextEffect=b:a.firstEffect=b,a.lastEffect=b))}else{c=Li(b);if(null!==c){c.flags&=2047;Y=c;return}null!==a&&(a.firstEffect=a.lastEffect=null,a.flags|=2048)}b=b.sibling;if(null!==b){Y=b;return}Y=b=a}while(null!==b);0===V&&(V=5)}function Uj(a){var b=eg();gg(99,dk.bind(null,a,b));return null}
function dk(a,b){do Oj();while(null!==yj);if(0!==(X&48))throw Error(y(327));var c=a.finishedWork;if(null===c)return null;a.finishedWork=null;a.finishedLanes=0;if(c===a.current)throw Error(y(177));a.callbackNode=null;var d=c.lanes|c.childLanes,e=d,f=a.pendingLanes&~e;a.pendingLanes=e;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=e;a.mutableReadLanes&=e;a.entangledLanes&=e;e=a.entanglements;for(var g=a.eventTimes,h=a.expirationTimes;0<f;){var k=31-Vc(f),l=1<<k;e[k]=0;g[k]=-1;h[k]=-1;f&=~l}null!==
Cj&&0===(d&24)&&Cj.has(a)&&Cj.delete(a);a===U&&(Y=U=null,W=0);1<c.flags?null!==c.lastEffect?(c.lastEffect.nextEffect=c,d=c.firstEffect):d=c:d=c.firstEffect;if(null!==d){e=X;X|=32;pj.current=null;kf=fd;g=Ne();if(Oe(g)){if("selectionStart"in g)h={start:g.selectionStart,end:g.selectionEnd};else a:if(h=(h=g.ownerDocument)&&h.defaultView||window,(l=h.getSelection&&h.getSelection())&&0!==l.rangeCount){h=l.anchorNode;f=l.anchorOffset;k=l.focusNode;l=l.focusOffset;try{h.nodeType,k.nodeType}catch(va){h=null;
break a}var n=0,A=-1,p=-1,C=0,x=0,w=g,z=null;b:for(;;){for(var u;;){w!==h||0!==f&&3!==w.nodeType||(A=n+f);w!==k||0!==l&&3!==w.nodeType||(p=n+l);3===w.nodeType&&(n+=w.nodeValue.length);if(null===(u=w.firstChild))break;z=w;w=u}for(;;){if(w===g)break b;z===h&&++C===f&&(A=n);z===k&&++x===l&&(p=n);if(null!==(u=w.nextSibling))break;w=z;z=w.parentNode}w=u}h=-1===A||-1===p?null:{start:A,end:p}}else h=null;h=h||{start:0,end:0}}else h=null;lf={focusedElem:g,selectionRange:h};fd=!1;Ij=null;Jj=!1;Z=d;do try{ek()}catch(va){if(null===
Z)throw Error(y(330));Wi(Z,va);Z=Z.nextEffect}while(null!==Z);Ij=null;Z=d;do try{for(g=a;null!==Z;){var t=Z.flags;t&16&&pb(Z.stateNode,"");if(t&128){var q=Z.alternate;if(null!==q){var v=q.ref;null!==v&&("function"===typeof v?v(null):v.current=null)}}switch(t&1038){case 2:fj(Z);Z.flags&=-3;break;case 6:fj(Z);Z.flags&=-3;ij(Z.alternate,Z);break;case 1024:Z.flags&=-1025;break;case 1028:Z.flags&=-1025;ij(Z.alternate,Z);break;case 4:ij(Z.alternate,Z);break;case 8:h=Z;cj(g,h);var J=h.alternate;dj(h);null!==
J&&dj(J)}Z=Z.nextEffect}}catch(va){if(null===Z)throw Error(y(330));Wi(Z,va);Z=Z.nextEffect}while(null!==Z);v=lf;q=Ne();t=v.focusedElem;g=v.selectionRange;if(q!==t&&t&&t.ownerDocument&&Me(t.ownerDocument.documentElement,t)){null!==g&&Oe(t)&&(q=g.start,v=g.end,void 0===v&&(v=q),"selectionStart"in t?(t.selectionStart=q,t.selectionEnd=Math.min(v,t.value.length)):(v=(q=t.ownerDocument||document)&&q.defaultView||window,v.getSelection&&(v=v.getSelection(),h=t.textContent.length,J=Math.min(g.start,h),g=void 0===
g.end?J:Math.min(g.end,h),!v.extend&&J>g&&(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;t<q.length;t++)v=q[t],v.element.scrollLeft=v.left,v.element.scrollTop=v.top}fd=!!kf;lf=kf=null;a.current=c;Z=d;do try{for(t=a;null!==Z;){var K=Z.flags;K&36&&Yi(t,Z.alternate,Z);if(K&128){q=void 0;var Q=Z.ref;if(null!==Q){var L=Z.stateNode;switch(Z.tag){case 5:q=L;break;default:q=L}"function"===typeof Q?Q(q):Q.current=q}}Z=Z.nextEffect}}catch(va){if(null===Z)throw Error(y(330));Wi(Z,va);Z=Z.nextEffect}while(null!==Z);Z=null;$f();X=e}else a.current=c;if(xj)xj=!1,yj=a,zj=b;else for(Z=d;null!==Z;)b=
Z.nextEffect,Z.nextEffect=null,Z.flags&8&&(K=Z,K.sibling=null,K.stateNode=null),Z=b;d=a.pendingLanes;0===d&&(Ti=null);1===d?a===Ej?Dj++:(Dj=0,Ej=a):Dj=0;c=c.stateNode;if(Mf&&"function"===typeof Mf.onCommitFiberRoot)try{Mf.onCommitFiberRoot(Lf,c,void 0,64===(c.current.flags&64))}catch(va){}Mj(a,O());if(Qi)throw Qi=!1,a=Ri,Ri=null,a;if(0!==(X&8))return null;ig();return null}
function ek(){for(;null!==Z;){var a=Z.alternate;Jj||null===Ij||(0!==(Z.flags&8)?dc(Z,Ij)&&(Jj=!0):13===Z.tag&&mj(a,Z)&&dc(Z,Ij)&&(Jj=!0));var b=Z.flags;0!==(b&256)&&Xi(a,Z);0===(b&512)||xj||(xj=!0,hg(97,function(){Oj();return null}));Z=Z.nextEffect}}function Oj(){if(90!==zj){var a=97<zj?97:zj;zj=90;return gg(a,fk)}return!1}function $i(a,b){Aj.push(b,a);xj||(xj=!0,hg(97,function(){Oj();return null}))}function Zi(a,b){Bj.push(b,a);xj||(xj=!0,hg(97,function(){Oj();return null}))}
function fk(){if(null===yj)return!1;var a=yj;yj=null;if(0!==(X&48))throw Error(y(331));var b=X;X|=32;var c=Bj;Bj=[];for(var d=0;d<c.length;d+=2){var e=c[d],f=c[d+1],g=e.destroy;e.destroy=void 0;if("function"===typeof g)try{g()}catch(k){if(null===f)throw Error(y(330));Wi(f,k)}}c=Aj;Aj=[];for(d=0;d<c.length;d+=2){e=c[d];f=c[d+1];try{var h=e.create;e.destroy=h()}catch(k){if(null===f)throw Error(y(330));Wi(f,k)}}for(h=a.current.firstEffect;null!==h;)a=h.nextEffect,h.nextEffect=null,h.flags&8&&(h.sibling=
null,h.stateNode=null),h=a;X=b;ig();return!0}function gk(a,b,c){b=Mi(c,b);b=Pi(a,b,1);Ag(a,b);b=Hg();a=Kj(a,1);null!==a&&($c(a,1,b),Mj(a,b))}
function Wi(a,b){if(3===a.tag)gk(a,a,b);else for(var c=a.return;null!==c;){if(3===c.tag){gk(c,a,b);break}else if(1===c.tag){var d=c.stateNode;if("function"===typeof c.type.getDerivedStateFromError||"function"===typeof d.componentDidCatch&&(null===Ti||!Ti.has(d))){a=Mi(b,a);var e=Si(c,a,1);Ag(c,e);e=Hg();c=Kj(c,1);if(null!==c)$c(c,1,e),Mj(c,e);else if("function"===typeof d.componentDidCatch&&(null===Ti||!Ti.has(d)))try{d.componentDidCatch(b,a)}catch(f){}break}}c=c.return}}
function Yj(a,b,c){var d=a.pingCache;null!==d&&d.delete(b);b=Hg();a.pingedLanes|=a.suspendedLanes&c;U===a&&(W&c)===c&&(4===V||3===V&&(W&62914560)===W&&500>O()-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<a.length;e+=2)f=a[e],f._workInProgressVersionPrimary=a[e+1],th.push(f);c=Zg(b,null,d,c);for(b.child=c;c;)c.flags=c.flags&-3|1024,c=c.sibling}else fi(a,b,d,c),sh();b=b.child}return b;case 5:return gh(b),null===a&&
ph(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,nf(d,e)?g=null:null!==f&&nf(d,f)&&(b.flags|=16),oi(a,b),fi(a,b,g,c),b.child;case 6:return null===a&&ph(b),null;case 13:return ti(a,b,c);case 4:return eh(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Yg(b,null,d,c):fi(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),gi(a,b,d,e,c);case 7:return fi(a,b,b.pendingProps,c),b.child;case 8:return fi(a,b,b.pendingProps.children,
c),b.child;case 12:return fi(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;g=b.memoizedProps;f=e.value;var h=b.type._context;I(mg,h._currentValue);h._currentValue=f;if(null!==g)if(h=g.value,f=He(h,f)?0:("function"===typeof d._calculateChangedBits?d._calculateChangedBits(h,f):1073741823)|0,0===f){if(g.children===e.children&&!N.current){b=hi(a,b,c);break a}}else for(h=b.child,null!==h&&(h.return=b);null!==h;){var k=h.dependencies;if(null!==k){g=h.child;for(var l=
k.firstContext;null!==l;){if(l.context===d&&0!==(l.observedBits&f)){1===h.tag&&(l=zg(-1,c&-c),l.tag=2,Ag(h,l));h.lanes|=c;l=h.alternate;null!==l&&(l.lanes|=c);sg(h.return,c);k.lanes|=c;break}l=l.next}}else g=10===h.tag?h.type===b.type?null:h.child:h.child;if(null!==g)g.return=h;else for(g=h;null!==g;){if(g===b){g=null;break}h=g.sibling;if(null!==h){h.return=g.return;g=h;break}g=g.return}h=g}fi(a,b,e.children,c);b=b.child}return b;case 9:return e=b.type,f=b.pendingProps,d=f.children,tg(b,c),e=vg(e,
f.unstable_observedBits),d=d(e),b.flags|=1,fi(a,b,d,c),b.child;case 14:return e=b.type,f=lg(e,b.pendingProps),f=lg(e.type,f),ii(a,b,e,f,d,c);case 15:return ki(a,b,b.type,b.pendingProps,d,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2),b.tag=1,Ff(d)?(a=!0,Jf(b)):a=!1,tg(b,c),Mg(b,d,e),Og(b,d,e,c),qi(null,b,d,!0,a,c);case 19:return Ai(a,b,c);case 23:return mi(a,b,c);case 24:return mi(a,b,c)}throw Error(y(156,b.tag));
};function ik(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.flags=0;this.lastEffect=this.firstEffect=this.nextEffect=null;this.childLanes=this.lanes=0;this.alternate=null}function nh(a,b,c,d){return new ik(a,b,c,d)}function ji(a){a=a.prototype;return!(!a||!a.isReactComponent)}
function hk(a){if("function"===typeof a)return ji(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===Aa)return 11;if(a===Da)return 14}return 2}
function Tg(a,b){var c=a.alternate;null===c?(c=nh(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.nextEffect=null,c.firstEffect=null,c.lastEffect=null);c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};
c.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}
function Vg(a,b,c,d,e,f){var g=2;d=a;if("function"===typeof a)ji(a)&&(g=1);else if("string"===typeof a)g=5;else a:switch(a){case ua:return Xg(c.children,e,f,b);case Ha:g=8;e|=16;break;case wa:g=8;e|=1;break;case xa:return a=nh(12,c,b,e|8),a.elementType=xa,a.type=xa,a.lanes=f,a;case Ba:return a=nh(13,c,b,e),a.type=Ba,a.elementType=Ba,a.lanes=f,a;case Ca:return a=nh(19,c,b,e),a.elementType=Ca,a.lanes=f,a;case Ia:return vi(c,e,f,b);case Ja:return a=nh(24,c,b,e),a.elementType=Ja,a.lanes=f,a;default:if("object"===
typeof a&&null!==a)switch(a.$$typeof){case ya:g=10;break a;case za:g=9;break a;case Aa:g=11;break a;case Da:g=14;break a;case Ea:g=16;d=null;break a;case Fa:g=22;break a}throw Error(y(130,null==a?a:typeof a,""));}b=nh(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Xg(a,b,c,d){a=nh(7,a,d,b);a.lanes=c;return a}function vi(a,b,c,d){a=nh(23,a,d,b);a.elementType=Ia;a.lanes=c;return a}function Ug(a,b,c){a=nh(6,a,null,b);a.lanes=c;return a}
function Wg(a,b,c){b=nh(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}
function jk(a,b,c){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.pendingContext=this.context=null;this.hydrate=c;this.callbackNode=null;this.callbackPriority=0;this.eventTimes=Zc(0);this.expirationTimes=Zc(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=Zc(0);this.mutableSourceEagerHydrationData=null}
function kk(a,b,c){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:ta,key:null==d?null:""+d,children:a,containerInfo:b,implementation:c}}
function lk(a,b,c,d){var e=b.current,f=Hg(),g=Ig(e);a:if(c){c=c._reactInternals;b:{if(Zb(c)!==c||1!==c.tag)throw Error(y(170));var h=c;do{switch(h.tag){case 3:h=h.stateNode.context;break b;case 1:if(Ff(h.type)){h=h.stateNode.__reactInternalMemoizedMergedChildContext;break b}}h=h.return}while(null!==h);throw Error(y(171));}if(1===c.tag){var k=c.type;if(Ff(k)){c=If(c,k,h);break a}}c=h}else c=Cf;null===b.context?b.context=c:b.pendingContext=c;b=zg(f,g);b.payload={element:a};d=void 0===d?null:d;null!==
d&&(b.callback=d);Ag(e,b);Jg(e,g,f);return g}function mk(a){a=a.current;if(!a.child)return null;switch(a.child.tag){case 5:return a.child.stateNode;default:return a.child.stateNode}}function nk(a,b){a=a.memoizedState;if(null!==a&&null!==a.dehydrated){var c=a.retryLane;a.retryLane=0!==c&&c<b?c:b}}function ok(a,b){nk(a,b);(a=a.alternate)&&nk(a,b)}function pk(){return null}
function qk(a,b,c){var d=null!=c&&null!=c.hydrationOptions&&c.hydrationOptions.mutableSources||null;c=new jk(a,b,null!=c&&!0===c.hydrate);b=nh(3,null,null,2===b?7:1===b?3:0);c.current=b;b.stateNode=c;xg(b);a[ff]=c.current;cf(8===a.nodeType?a.parentNode:a);if(d)for(a=0;a<d.length;a++){b=d[a];var e=b._getVersion;e=e(b._source);null==c.mutableSourceEagerHydrationData?c.mutableSourceEagerHydrationData=[b,e]:c.mutableSourceEagerHydrationData.push(b,e)}this._internalRoot=c}
qk.prototype.render=function(a){lk(a,this._internalRoot,null,null)};qk.prototype.unmount=function(){var a=this._internalRoot,b=a.containerInfo;lk(null,a,null,function(){b[ff]=null})};function rk(a){return!(!a||1!==a.nodeType&&9!==a.nodeType&&11!==a.nodeType&&(8!==a.nodeType||" react-mount-point-unstable "!==a.nodeValue))}
function sk(a,b){b||(b=a?9===a.nodeType?a.documentElement:a.firstChild:null,b=!(!b||1!==b.nodeType||!b.hasAttribute("data-reactroot")));if(!b)for(var c;c=a.lastChild;)a.removeChild(c);return new qk(a,0,b?{hydrate:!0}:void 0)}
function tk(a,b,c,d,e){var f=c._reactRootContainer;if(f){var g=f._internalRoot;if("function"===typeof e){var h=e;e=function(){var a=mk(g);h.call(a)}}lk(b,g,a,e)}else{f=c._reactRootContainer=sk(c,d);g=f._internalRoot;if("function"===typeof e){var k=e;e=function(){var a=mk(g);k.call(a)}}Xj(function(){lk(b,g,a,e)})}return mk(g)}ec=function(a){if(13===a.tag){var b=Hg();Jg(a,4,b);ok(a,4)}};fc=function(a){if(13===a.tag){var b=Hg();Jg(a,67108864,b);ok(a,67108864)}};
gc=function(a){if(13===a.tag){var b=Hg(),c=Ig(a);Jg(a,c,b);ok(a,c)}};hc=function(a,b){return b()};
yb=function(a,b,c){switch(b){case "input":ab(a,c);b=c.name;if("radio"===c.type&&null!=b){for(c=a;c.parentNode;)c=c.parentNode;c=c.querySelectorAll("input[name="+JSON.stringify(""+b)+'][type="radio"]');for(b=0;b<c.length;b++){var d=c[b];if(d!==a&&d.form===a.form){var e=Db(d);if(!e)throw Error(y(90));Wa(d);ab(d,e)}}}break;case "textarea":ib(a,c);break;case "select":b=c.value,null!=b&&fb(a,!!c.multiple,b,!1)}};Gb=Wj;
Hb=function(a,b,c,d,e){var f=X;X|=4;try{return gg(98,a.bind(null,b,c,d,e))}finally{X=f,0===X&&(wj(),ig())}};Ib=function(){0===(X&49)&&(Vj(),Oj())};Jb=function(a,b){var c=X;X|=2;try{return a(b)}finally{X=c,0===X&&(wj(),ig())}};function uk(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!rk(b))throw Error(y(200));return kk(a,b,null,c)}var vk={Events:[Cb,ue,Db,Eb,Fb,Oj,{current:!1}]},wk={findFiberByHostInstance:wc,bundleType:0,version:"17.0.1",rendererPackageName:"react-dom"};
var xk={bundleType:wk.bundleType,version:wk.version,rendererPackageName:wk.rendererPackageName,rendererConfig:wk.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ra.ReactCurrentDispatcher,findHostInstanceByFiber:function(a){a=cc(a);return null===a?null:a.stateNode},findFiberByHostInstance:wk.findFiberByHostInstance||
pk,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var yk=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yk.isDisabled&&yk.supportsFiber)try{Lf=yk.inject(xk),Mf=yk}catch(a){}}exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=vk;exports.createPortal=uk;
exports.findDOMNode=function(a){if(null==a)return null;if(1===a.nodeType)return a;var b=a._reactInternals;if(void 0===b){if("function"===typeof a.render)throw Error(y(188));throw Error(y(268,Object.keys(a)));}a=cc(b);a=null===a?null:a.stateNode;return a};exports.flushSync=function(a,b){var c=X;if(0!==(c&48))return a(b);X|=1;try{if(a)return gg(99,a.bind(null,b))}finally{X=c,ig()}};exports.hydrate=function(a,b,c){if(!rk(b))throw Error(y(200));return tk(null,a,b,!0,c)};
exports.render=function(a,b,c){if(!rk(b))throw Error(y(200));return tk(null,a,b,!1,c)};exports.unmountComponentAtNode=function(a){if(!rk(a))throw Error(y(40));return a._reactRootContainer?(Xj(function(){tk(null,null,a,!1,function(){a._reactRootContainer=null;a[ff]=null})}),!0):!1};exports.unstable_batchedUpdates=Wj;exports.unstable_createPortal=function(a,b){return uk(a,b,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null)};
exports.unstable_renderSubtreeIntoContainer=function(a,b,c,d){if(!rk(c))throw Error(y(200));if(null==a||void 0===a._reactInternals)throw Error(y(38));return tk(a,b,c,!1,d)};exports.version="17.0.1";
/***/ }),
/* 58 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__(59);
} else {}
/***/ }),
/* 59 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v0.20.1
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
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<a?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<a?Math.floor(1E3/a):5};var F=new MessageChannel,G=F.port2;F.port1.onmessage=function(){if(null!==B){var a=exports.unstable_now();E=a+D;try{B(!0,a)?G.postMessage(null):(A=!1,B=null)}catch(b){throw G.postMessage(null),b;}}else A=!1};f=function(a){B=a;A||(A=!0,G.postMessage(null))};g=function(a,b){C=
x(function(){a(exports.unstable_now())},b)};h=function(){y(C);C=-1}}function H(a,b){var c=a.length;a.push(b);a:for(;;){var d=c-1>>>1,e=a[d];if(void 0!==e&&0<I(e,b))a[d]=b,a[c]=e,c=d;else break a}}function J(a){a=a[0];return void 0===a?null:a}
function K(a){var b=a[0];if(void 0!==b){var c=a.pop();if(c!==b){a[0]=c;a:for(var d=0,e=a.length;d<e;){var m=2*(d+1)-1,n=a[m],v=m+1,r=a[v];if(void 0!==n&&0>I(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&&0<c?d+c:d):c=d;switch(a){case 1:var e=-1;break;case 2:e=250;break;case 5:e=1073741823;break;case 4:e=1E4;break;default:e=5E3}e=c+e;a={id:N++,callback:b,priorityLevel:a,startTime:c,expirationTime:e,sortIndex:-1};c>d?(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}}};
/***/ }),
/* 60 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (false) { var throwOnDirectAccess, ReactIs; } else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = __webpack_require__(61)();
}
/***/ }),
/* 61 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = __webpack_require__(62);
function emptyFunction() {}
function emptyFunctionWithReset() {}
emptyFunctionWithReset.resetWarningCache = emptyFunction;
module.exports = function() {
function shim(props, propName, componentName, location, propFullName, secret) {
if (secret === ReactPropTypesSecret) {
// It is still safe when called from React.
return;
}
var err = new Error(
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
err.name = 'Invariant Violation';
throw err;
};
shim.isRequired = shim;
function getShim() {
return shim;
};
// Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
var ReactPropTypes = {
array: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
elementType: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim,
exact: getShim,
checkPropTypes: emptyFunctionWithReset,
resetWarningCache: emptyFunction
};
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
/***/ }),
/* 62 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/* 63 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;
exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};
exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};
exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;
/***/ }),
/* 64 */
/***/ (function(module, exports) {
module.exports = function(originalModule) {
if (!originalModule.webpackPolyfill) {
var module = Object.create(originalModule);
// module.parent = undefined by default
if (!module.children) module.children = [];
Object.defineProperty(module, "loaded", {
enumerable: true,
get: function() {
return module.l;
}
});
Object.defineProperty(module, "id", {
enumerable: true,
get: function() {
return module.i;
}
});
Object.defineProperty(module, "exports", {
enumerable: true
});
module.webpackPolyfill = 1;
}
return module;
};
/***/ }),
/* 65 */
/***/ (function(module, exports) {
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
module.exports = _objectWithoutPropertiesLoose;
/***/ }),
/* 66 */
/***/ (function(module, exports, __webpack_require__) {
var CONSTANTS = __webpack_require__(35);
function parser(arrayBuffer) {
var data = {};
var i = 0;
var arr = new Int8Array(arrayBuffer); // Parse header
data.type = String.fromCharCode.apply(null, arr.slice(i, CONSTANTS.HEADER.length));
if (data.type !== CONSTANTS.HEADER) {
throw new Error("Invalid .eqf file.");
}
i += CONSTANTS.HEADER.length; // Skip "<ctrl-z>!--"
i += 4; // Get the presets
data.presets = [];
while (i < arr.length) {
var preset = {}; // Get the name
var nameStart = i;
var nameEnd = nameStart + 257; // Str is fixed length
// Str is null terminated
while (arr[i] !== 0 && i <= nameEnd) {
i++;
}
preset.name = String.fromCharCode.apply(null, arr.slice(nameStart, i));
i = nameEnd; // Skip over any unused bytes
// Get the levels
CONSTANTS.PRESET_VALUES.forEach(function (valueName) {
preset[valueName] = 64 - arr[i++]; // Adjust for inverse values
});
data.presets.push(preset);
}
return data;
}
module.exports = parser;
/***/ }),
/* 67 */
/***/ (function(module, exports, __webpack_require__) {
var CONSTANTS = __webpack_require__(35);
var FILL_SIZE = 4;
var PRESET_LENGTH = 257;
function creator(data) {
var buffer = [];
for (var i = 0; i < CONSTANTS.HEADER.length; i++) {
buffer.push(CONSTANTS.HEADER.charCodeAt(i));
}
buffer.push(26); // <ctrl-z>
var ending = "!--";
for (var i = 0; i < ending.length; i++) {
buffer.push(ending.charCodeAt(i));
}
if (!data.presets) {
throw new Error("Eqf data is missing presets");
}
data.presets.forEach(function (preset) {
var k = 0;
for (; k < preset.name.length; k++) {
buffer.push(preset.name.charCodeAt(k));
}
for (; k < PRESET_LENGTH; k++) {
buffer.push(0);
}
CONSTANTS.PRESET_VALUES.forEach(function (valueName) {
buffer.push(64 - preset[valueName]); // Adjust for inverse values
});
});
return new Uint8Array(buffer).buffer;
}
module.exports = creator;
/***/ }),
/* 68 */
/***/ (function(module, exports, __webpack_require__) {
var content = __webpack_require__(69);
if(typeof content === 'string') content = [[module.i, content, '']];
var transform;
var insertInto;
var options = {"hmr":true}
options.transform = transform
options.insertInto = undefined;
var update = __webpack_require__(11)(content, options);
if(content.locals) module.exports = content.locals;
if(false) {}
/***/ }),
/* 69 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(10)(false);
// imports
// module
exports.push([module.i, "#webamp .gen-text-space{width:5px}#webamp .gen-text-letter{height:7px;display:inline-block}#webamp .gen-window{width:275px;height:116px;display:flex;flex-direction:column}#webamp .gen-top{height:20px;display:flex;flex-direction:row}#webamp .gen-top-left{width:25px;height:20px}#webamp .gen-top-title{line-height:7px;margin-top:2px;padding:0 3px 0 4px}#webamp .gen-top-left-fill{flex-grow:1;height:20px;background-position:0}#webamp .gen-top-right-fill{flex-grow:1;height:20px;background-position:100%}#webamp .gen-top-left-end,#webamp .gen-top-right,#webamp .gen-top-right-end{width:25px;height:20px}#webamp .gen-close{width:9px;height:9px;position:absolute;right:2px;top:3px}#webamp .gen-middle{flex-grow:1;display:flex;flex-direction:row;position:relative}#webamp .gen-middle-left{width:11px}#webamp .gen-middle-left-bottom{width:11px;height:24px;bottom:0;position:absolute}#webamp .gen-middle-center{flex-grow:1;position:relative}#webamp .gen-middle-right{width:8px}#webamp .gen-middle-right-bottom{width:8px;height:24px;bottom:0;position:absolute}#webamp .gen-bottom{height:14px;background-repeat:repeat-x}#webamp .gen-bottom-left{position:absolute;left:0;width:125px;height:14px}#webamp .gen-bottom-right{position:absolute;right:0;width:125px;height:14px}#webamp .gen-bottom-right #gen-resize-target{position:absolute;right:0;bottom:0;height:20px;width:20px}", ""]);
// exports
/***/ }),
/* 70 */
/***/ (function(module, exports) {
/**
* When source maps are enabled, `style-loader` uses a link element with a data-uri to
* embed the css on the page. This breaks all relative urls because now they are relative to a
* bundle instead of the current page.
*
* One solution is to only use full urls, but that may be impossible.
*
* Instead, this function "fixes" the relative urls to be absolute according to the current page location.
*
* A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
*
*/
module.exports = function (css) {
// get current location
var location = typeof window !== "undefined" && window.location;
if (!location) {
throw new Error("fixUrls requires window.location");
}
// blank or null?
if (!css || typeof css !== "string") {
return css;
}
var baseUrl = location.protocol + "//" + location.host;
var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
// convert each url(...)
/*
This regular expression is just a way to recursively match brackets within
a string.
/url\s*\( = Match on the word "url" with any whitespace after it and then a parens
( = Start a capturing group
(?: = Start a non-capturing group
[^)(] = Match anything that isn't a parentheses
| = OR
\( = Match a start parentheses
(?: = Start another non-capturing groups
[^)(]+ = Match anything that isn't a parentheses
| = OR
\( = Match a start parentheses
[^)(]* = Match anything that isn't a parentheses
\) = Match a end parentheses
) = End Group
*\) = Match anything and then a close parens
) = Close non-capturing group
* = Match anything
) = Close capturing group
\) = Match a close parens
/gi = Get all matches, not the first. Be case insensitive.
*/
var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
// strip quotes (if they exist)
var unquotedOrigUrl = origUrl
.trim()
.replace(/^"(.*)"$/, function(o, $1){ return $1; })
.replace(/^'(.*)'$/, function(o, $1){ return $1; });
// already a full url? no change
if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
return fullMatch;
}
// convert the url to a full url
var newUrl;
if (unquotedOrigUrl.indexOf("//") === 0) {
//TODO: should we add protocol?
newUrl = unquotedOrigUrl;
} else if (unquotedOrigUrl.indexOf("/") === 0) {
// path should be relative to the base url
newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
} else {
// path should be relative to current directory
newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
}
// send back the fixed url(...)
return "url(" + JSON.stringify(newUrl) + ")";
});
// send back the fixed css
return fixedCss;
};
/***/ }),
/* 71 */
/***/ (function(module, exports, __webpack_require__) {
var content = __webpack_require__(72);
if(typeof content === 'string') content = [[module.i, content, '']];
var transform;
var insertInto;
var options = {"hmr":true}
options.transform = transform
options.insertInto = undefined;
var update = __webpack_require__(11)(content, options);
if(content.locals) module.exports = content.locals;
if(false) {}
/***/ }),
/* 72 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(10)(false);
// imports
// module
exports.push([module.i, ".webamp-desktop{position:absolute;top:0;left:0;right:0;bottom:0;z-index:-1}", ""]);
// exports
/***/ }),
/* 73 */
/***/ (function(module, exports, __webpack_require__) {
var content = __webpack_require__(74);
if(typeof content === 'string') content = [[module.i, content, '']];
var transform;
var insertInto;
var options = {"hmr":true}
options.transform = transform
options.insertInto = undefined;
var update = __webpack_require__(11)(content, options);
if(content.locals) module.exports = content.locals;
if(false) {}
/***/ }),
/* 74 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(10)(false);
// imports
// module
exports.push([module.i, "#webamp-context-menu .context-menu{left:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:default}#webamp-context-menu .context-menu.bottom{top:12px}#webamp-context-menu .context-menu.top{top:0}#webamp-context-menu .context-menu,#webamp-context-menu .context-menu ul{z-index:50;background-color:#fff;position:absolute;list-style:none;padding:0;margin:0;border:1px solid #a7a394;box-shadow:2px 2px 4px rgba(0,0,0,.5)}#webamp-context-menu .context-menu li{position:relative;font-family:Tahoma;font-size:11px;color:#000;white-space:nowrap;margin:2px;padding:1px 18px 3px;display:block}#webamp-context-menu .context-menu li.checked:before{float:left;content:\"\\2713\";margin-left:-12px}#webamp-context-menu .context-menu li.parent:after{float:right;content:\"\\25B8\";margin-right:-12px}#webamp-context-menu .context-menu li a{text-decoration:none;color:#000;cursor:default}#webamp-context-menu .context-menu li:hover,#webamp-context-menu .context-menu li:hover a{background-color:#224eb7;color:#fff}#webamp-context-menu .context-menu li.hr{padding:2px 0}#webamp-context-menu .context-menu li.hr:hover{background-color:#fff}#webamp-context-menu .context-menu li.hr hr{border:none;height:1px;background-color:#a7a394;margin:0;padding:0}#webamp-context-menu .context-menu ul{display:none;left:100%;margin-left:-3px}#webamp-context-menu .context-menu li:hover>ul{display:block}", ""]);
// exports
/***/ }),
/* 75 */
/***/ (function(module, exports, __webpack_require__) {
var basePropertyOf = __webpack_require__(76);
/** Used to map Latin Unicode letters to basic Latin letters. */
var deburredLetters = {
// Latin-1 Supplement block.
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
'\xc7': 'C', '\xe7': 'c',
'\xd0': 'D', '\xf0': 'd',
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
'\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
'\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
'\xd1': 'N', '\xf1': 'n',
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
'\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
'\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
'\xc6': 'Ae', '\xe6': 'ae',
'\xde': 'Th', '\xfe': 'th',
'\xdf': 'ss',
// Latin Extended-A block.
'\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
'\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
'\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
'\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
'\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
'\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
'\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
'\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
'\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
'\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
'\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
'\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
'\u0134': 'J', '\u0135': 'j',
'\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
'\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
'\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
'\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
'\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
'\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
'\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
'\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
'\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
'\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
'\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
'\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
'\u0163': 't', '\u0165': 't', '\u0167': 't',
'\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
'\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
'\u0174': 'W', '\u0175': 'w',
'\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
'\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
'\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
'\u0132': 'IJ', '\u0133': 'ij',
'\u0152': 'Oe', '\u0153': 'oe',
'\u0149': "'n", '\u017f': 's'
};
/**
* Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
* letters to basic Latin letters.
*
* @private
* @param {string} letter The matched letter to deburr.
* @returns {string} Returns the deburred letter.
*/
var deburrLetter = basePropertyOf(deburredLetters);
module.exports = deburrLetter;
/***/ }),
/* 76 */
/***/ (function(module, exports) {
/**
* The base implementation of `_.propertyOf` without support for deep paths.
*
* @private
* @param {Object} object The object to query.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyOf(object) {
return function(key) {
return object == null ? undefined : object[key];
};
}
module.exports = basePropertyOf;
/***/ }),
/* 77 */
/***/ (function(module, exports, __webpack_require__) {
var baseToString = __webpack_require__(78);
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : baseToString(value);
}
module.exports = toString;
/***/ }),
/* 78 */
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(25),
arrayMap = __webpack_require__(81),
isArray = __webpack_require__(82),
isSymbol = __webpack_require__(83);
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isArray(value)) {
// Recursively convert values (susceptible to call stack limits).
return arrayMap(value, baseToString) + '';
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
module.exports = baseToString;
/***/ }),
/* 79 */
/***/ (function(module, exports, __webpack_require__) {
var freeGlobal = __webpack_require__(80);
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
module.exports = root;
/***/ }),
/* 80 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
module.exports = freeGlobal;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(17)))
/***/ }),
/* 81 */
/***/ (function(module, exports) {
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
module.exports = arrayMap;
/***/ }),
/* 82 */
/***/ (function(module, exports) {
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
module.exports = isArray;
/***/ }),
/* 83 */
/***/ (function(module, exports, __webpack_require__) {
var baseGetTag = __webpack_require__(84),
isObjectLike = __webpack_require__(87);
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && baseGetTag(value) == symbolTag);
}
module.exports = isSymbol;
/***/ }),
/* 84 */
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(25),
getRawTag = __webpack_require__(85),
objectToString = __webpack_require__(86);
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
}
module.exports = baseGetTag;
/***/ }),
/* 85 */
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(25);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
module.exports = getRawTag;
/***/ }),
/* 86 */
/***/ (function(module, exports) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString.call(value);
}
module.exports = objectToString;
/***/ }),
/* 87 */
/***/ (function(module, exports) {
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
module.exports = isObjectLike;
/***/ }),
/* 88 */
/***/ (function(module, exports, __webpack_require__) {
var content = __webpack_require__(89);
if(typeof content === 'string') content = [[module.i, content, '']];
var transform;
var insertInto;
var options = {"hmr":true}
options.transform = transform
options.insertInto = undefined;
var update = __webpack_require__(11)(content, options);
if(content.locals) module.exports = content.locals;
if(false) {}
/***/ }),
/* 89 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(10)(false);
// imports
// module
exports.push([module.i, "#webamp .mini-time{display:block;height:6px;width:25px}#webamp .mini-time.blinking .character:not(.background-character){animation:blink 2s step-start 1s infinite;-webkit-animation:blink 2s step-start 1s infinite}#webamp .mini-time .background-character{z-index:1}#webamp .mini-time .character{position:absolute;top:0;z-index:2}", ""]);
// exports
/***/ }),
/* 90 */
/***/ (function(module, exports, __webpack_require__) {
var content = __webpack_require__(91);
if(typeof content === 'string') content = [[module.i, content, '']];
var transform;
var insertInto;
var options = {"hmr":true}
options.transform = transform
options.insertInto = undefined;
var update = __webpack_require__(11)(content, options);
if(content.locals) module.exports = content.locals;
if(false) {}
/***/ }),
/* 91 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(10)(false);
// imports
// module
exports.push([module.i, "#webamp #main-window{position:absolute;height:116px;width:275px;image-rendering:-moz-crisp-edges;image-rendering:-o-crisp-edges;image-rendering:-webkit-optimize-contrast;image-rendering:pixelated;-ms-interpolation-mode:nearest-neighbor}#webamp #title-bar{position:absolute;top:0;left:0;height:14px;width:275px}#webamp #close,#webamp #minimize,#webamp #option-context,#webamp #shade{position:absolute;height:9px;width:9px;top:3px}#webamp #title-bar #option{width:100%;height:100%}#webamp #title-bar #option-context{left:6px}#webamp #title-bar #minimize{left:244px}#webamp #title-bar #shade{left:254px}#webamp #title-bar #close{left:264px}#webamp #clutter-bar{position:absolute;top:22px;left:10px;height:43px;width:8px}#webamp #clutter-bar div{position:absolute;height:7px;width:8px;left:0}#webamp #clutter-bar #button-o{top:3px;height:8px}#webamp #clutter-bar #button-a{top:11px}#webamp #clutter-bar #button-i{top:18px}#webamp #clutter-bar #button-d{top:25px;height:8px}#webamp #clutter-bar #button-v{top:33px}#webamp #play-pause{position:absolute;top:28px;left:26px;height:9px;width:9px;background-repeat:no-repeat}#webamp #work-indicator.selected,#webamp .play #work-indicator{position:absolute;top:28px;left:24px;height:9px;width:3px}#webamp .webamp-status #time{position:absolute;left:39px;top:26px;height:13px;width:59px}#webamp .stop .webamp-status #time{display:none}#webamp .pause .webamp-status #time{animation:blink 2s step-start 1s infinite;-webkit-animation:blink 2s step-start 1s infinite}#webamp .webamp-status #time #minus-sign{position:absolute;top:6px;left:-1px;width:5px;height:1px}#webamp .webamp-status #time #minute-first-digit{position:absolute;pointer-events:none;left:9px;height:13px;width:9px}#webamp .webamp-status #time #minute-second-digit{position:absolute;pointer-events:none;left:21px;height:13px;width:9px}#webamp .webamp-status #time #second-first-digit{position:absolute;pointer-events:none;left:39px;height:13px;width:9px}#webamp .webamp-status #time #second-second-digit{position:absolute;pointer-events:none;left:51px;height:13px;width:9px}#webamp #main-window #visualizer{position:absolute;top:43px;left:24px}#webamp #main-window.shade #visualizer{top:5px;left:79px}#webamp .text{display:none}#webamp #marquee{top:24px;width:154px;display:block;padding:3px 0}#webamp #marquee,#webamp .media-info #kbps{position:absolute;left:111px;height:6px;overflow:hidden}#webamp .media-info #kbps{top:43px;width:15px}#webamp .stop .media-info #kbps{display:none}#webamp .media-info #khz{position:absolute;left:156px;top:43px;width:10px;height:6px;overflow:hidden}#webamp .stop .media-info #khz{display:none}#webamp .media-info .mono-stereo{position:absolute;left:212px;top:41px;width:57px;height:12px}#webamp .media-info .mono-stereo div{position:absolute;height:12px}#webamp .media-info .mono-stereo #mono{width:27px}#webamp .media-info .mono-stereo #stereo{left:27px;width:29px}#webamp #volume{position:absolute;left:107px;top:57px;height:13px;width:68px;background-position:0 0}#webamp #volume input{height:13px;width:65px;display:block}#webamp #volume input::-webkit-slider-thumb{top:1px;height:11px;width:14px}#webamp #volume input::-moz-range-thumb{top:1px;height:11px;width:14px}#webamp #balance{position:absolute;left:177px;top:57px;height:13px;width:38px;background-position:0 0}#webamp #balance::-webkit-slider-thumb{top:1px;height:11px;width:14px}#webamp #balance::-moz-range-thumb{top:1px;height:11px;width:14px}#webamp .windows{position:absolute;left:219px;top:58px;width:46px;height:12px}#webamp .windows div{position:absolute;width:23px;height:12px}#webamp .windows #equalizer-button{left:0}#webamp .windows #playlist-button{left:23px}#webamp #position{position:absolute;left:16px;top:72px;width:248px;height:10px}#webamp #position::-webkit-slider-thumb{height:10px;width:29px;-webkit-box-sizing:border-box;position:relative}#webamp #position::-moz-range-thumb{height:10px;width:29px}#webamp .stop #position::-webkit-slider-thumb{visibility:hidden}#webamp .stop #position::-moz-range-thumb{visibility:hidden}#webamp .play #position::-webkit-slider-thumb{visibility:visible}#webamp .actions div{height:18px;width:23px;position:absolute}#webamp .actions #previous{top:88px;left:16px}#webamp .actions #play{top:88px;left:39px}#webamp .actions #pause{top:88px;left:62px}#webamp .actions #stop{top:88px;left:85px}#webamp .actions #next{top:88px;left:108px;width:22px}#webamp #eject{position:absolute;top:89px;left:136px;height:16px;width:22px}#webamp .shuffle-repeat{position:absolute;top:89px;left:164px;width:74px}#webamp .shuffle-repeat div{position:absolute;height:15px}#webamp .shuffle-repeat #shuffle{width:47px}#webamp .shuffle-repeat #repeat{left:46px;width:28px}#webamp #about{position:absolute;top:91px;left:253px;height:15px;width:13px}#webamp .digit{position:absolute;display:inline-block;width:9px;height:13px;background-repeat:no-repeat;text-indent:-9999px}#webamp #main-window.shade{height:14px}#webamp .shade #balance,#webamp .shade #volume,#webamp .shade .media-info,#webamp .shade .shuffle-repeat,#webamp .shade .webamp-status,#webamp .shade .windows{display:none}#webamp .shade .actions div{position:absolute}#webamp .shade .actions #previous,#webamp .shade .actions #previous:active{background:none;height:10px;width:7px;top:2px;left:169px}#webamp .shade .actions #play,#webamp .shade .actions #play:active{background:none;height:10px;width:10px;top:2px;left:176px}#webamp .shade .actions #pause,#webamp .shade .actions #pause:active{background:none;height:10px;width:9px;top:2px;left:186px}#webamp .shade .actions #stop,#webamp .shade .actions #stop:active{background:none;height:10px;width:9px;top:2px;left:195px}#webamp .shade .actions #next,#webamp .shade .actions #next:active{background:none;height:10px;width:10px;top:2px;left:204px}#webamp .shade #eject,#webamp .shade #eject:active{height:10px;width:10px;top:2px;left:215px;background:none}#webamp .shade #position{position:absolute;left:226px;top:4px;width:17px;height:7px}#webamp .shade #position::-webkit-slider-thumb{height:7px;width:3px;background:none}#webamp .shade #position::-moz-range-thumb{height:7px;width:3px;background:none}#webamp #main-window .mini-time{position:absolute;top:4px;left:127px}", ""]);
// exports
/***/ }),
/* 92 */
/***/ (function(module, exports, __webpack_require__) {
var content = __webpack_require__(93);
if(typeof content === 'string') content = [[module.i, content, '']];
var transform;
var insertInto;
var options = {"hmr":true}
options.transform = transform
options.insertInto = undefined;
var update = __webpack_require__(11)(content, options);
if(content.locals) module.exports = content.locals;
if(false) {}
/***/ }),
/* 93 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(10)(false);
// imports
// module
exports.push([module.i, "#webamp #playlist-window{display:flex;flex-direction:column}#webamp .playlist-top{width:100%;min-height:20px;max-height:20px;position:relative;display:flex}#webamp .playlist-top-left{width:25px}#webamp .playlist-top-left-spacer{width:12px}#webamp .playlist-top-left-fill{flex-grow:1;background-position:100%}#webamp .playlist-top-right-spacer{width:13px}#webamp .playlist-top-right-fill{flex-grow:1;background-position:100%}#webamp .playlist-top-title{width:100px}#webamp .playlist-top-right{width:25px}#webamp .playlist-middle{flex-grow:1;display:flex;flex-direction:row;overflow:hidden}#webamp .playlist-middle-left{background-repeat:repeat-y;width:12px;min-width:12px}#webamp .playlist-middle-center{flex-grow:1;padding:3px 0;min-width:0}#webamp .playlist-tracks{display:flex;flex:1 0 auto}#webamp .playlist-tracks .track-cell{height:13px;line-height:13px;font-size:9px;letter-spacing:.5px;-webkit-user-select:none;-moz-user-select:none;user-select:none}#webamp .playlist-track-durations>div{padding-right:3px;text-align:right}#webamp .playlist-track-titles{flex:1 1 auto;overflow:hidden}#webamp .playlist-track-titles>div{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#webamp .playlist-middle-right{background-repeat:repeat-y;background-position:100% 0;width:20px;min-width:20px;position:relative;padding-bottom:18px}#webamp .playlist-bottom{width:100%;height:38px;min-height:38px;max-height:38px;position:relative}#webamp .playlist-bottom-left{width:125px;height:100%;position:absolute}#webamp .playlist-menu li{list-style:none;display:none;width:22px;height:18px;padding:0;margin:0}#webamp .playlist-menu li>div{height:100%}#webamp .playlist-menu ul{padding:0;margin:0;position:absolute;bottom:0}#webamp .playlist-menu.selected li{display:block}#webamp .playlist-menu .bar{position:absolute;bottom:0;left:-3px;width:3px;height:54px}#webamp #playlist-add-menu{position:absolute;bottom:12px;left:14px;width:22px;height:18px}#webamp #playlist-remove-menu.playlist-menu .bar{height:72px}#webamp #playlist-remove-menu{position:absolute;bottom:12px;left:43px;width:22px;height:18px}#webamp #playlist-selection-menu{position:absolute;bottom:12px;left:72px;width:22px;height:18px}#webamp #playlist-misc-menu{position:absolute;bottom:12px;left:101px;width:22px;height:18px}#webamp #playlist-list-menu{position:absolute;bottom:12px;right:22px;width:22px;height:18px}#webamp .playlist-bottom-right{width:150px;height:100%;position:absolute;right:0}#webamp .playlist-running-time-display{position:absolute;top:10px;left:7px;height:10px}#webamp .playlist-action-buttons{position:absolute;top:22px;left:3px;display:flex}#webamp .playlist-action-buttons>div{height:10px;width:10px}#webamp #playlist-window .playlist-visualizer{width:75px;height:100%;position:absolute;right:150px}#webamp #playlist-window .mini-time{position:absolute;top:23px;left:66px}#webamp #playlist-window #playlist-resize-target{position:absolute;right:0;bottom:0;height:20px;width:20px}#webamp #playlist-close-button{position:absolute;right:2px;height:9px;width:9px;top:3px}#webamp #playlist-shade-button{position:absolute;right:12px;height:9px;width:9px;top:3px}#webamp #playlist-window-shade{height:14px}#webamp #playlist-window-shade .left,#webamp #playlist-window-shade .right{height:14px;background-repeat:no-repeat}#webamp #playlist-window-shade .right{background-position-x:right}#webamp #playlist-window #playlist-scroll-down-button,#webamp #playlist-window #playlist-scroll-up-button{position:absolute;width:8px;height:5px;right:7px}#webamp #playlist-window #playlist-scroll-up-button{top:2px}#webamp #playlist-window #playlist-scroll-down-button{top:8px}#webamp #playlist-window-shade #playlist-resize-target{position:absolute;right:20px;top:3px;height:9px;width:9px}#webamp #playlist-shade-track-title{position:absolute;top:4px;left:5px}#webamp #playlist-shade-time{position:absolute;top:4px;right:30px}#webamp #playlist-window .visualizer-wrapper{position:absolute;top:12px;left:2px;width:72px;overflow:hidden}", ""]);
// exports
/***/ }),
/* 94 */
/***/ (function(module, exports, __webpack_require__) {
var content = __webpack_require__(95);
if(typeof content === 'string') content = [[module.i, content, '']];
var transform;
var insertInto;
var options = {"hmr":true}
options.transform = transform
options.insertInto = undefined;
var update = __webpack_require__(11)(content, options);
if(content.locals) module.exports = content.locals;
if(false) {}
/***/ }),
/* 95 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(10)(false);
// imports
// module
exports.push([module.i, "#webamp #equalizer-window{height:116px;width:275px}#webamp #equalizer-window.shade{height:14px}#webamp #equalizer-volume{position:absolute;left:61px;top:4px;height:6px;width:97px;background-position:0 0}#webamp #equalizer-volume::-webkit-slider-thumb{height:7px;width:3px}#webamp #equalizer-volume::-moz-range-thumb{height:7px;width:3px}#webamp #equalizer-balance{position:absolute;left:164px;top:4px;height:6px;width:43px;background-position:0 0}#webamp #equalizer-balance::-webkit-slider-thumb{height:7px;width:3px}#webamp #equalizer-balance::-moz-range-thumb{height:7px;width:3px}#webamp .equalizer-top{height:14px;width:275px;position:relative}#webamp #equalizer-close{position:absolute;height:9px;width:9px;left:264px;top:3px}#webamp #equalizer-shade{position:absolute;height:9px;width:9px;left:254px;top:3px}#webamp #on{width:26px;left:14px}#webamp #auto,#webamp #on{position:absolute;height:12px;top:18px}#webamp #auto{width:32px;left:40px}#webamp #presets-context{position:absolute;width:44px;height:12px;top:18px;left:217px}#webamp #presets{width:100%;height:100%}#webamp #eqGraph{position:absolute;width:113px;height:19px;top:17px;left:86px}#webamp #preamp{position:absolute;left:21px;top:38px}#webamp #plus12db{top:36px}#webamp #plus12db,#webamp #zerodb{position:absolute;left:45px;width:22px;height:8px}#webamp #zerodb{top:64px}#webamp #minus12db{position:absolute;left:45px;top:95px;width:22px;height:8px}#webamp #band-60{position:absolute;left:78px;top:38px}#webamp #band-170{position:absolute;left:96px;top:38px}#webamp #band-310{position:absolute;left:114px;top:38px}#webamp #band-600{position:absolute;left:132px;top:38px}#webamp #band-1000{position:absolute;left:150px;top:38px}#webamp #band-3000{position:absolute;left:168px;top:38px}#webamp #band-6000{position:absolute;left:186px;top:38px}#webamp #band-12000{position:absolute;left:204px;top:38px}#webamp #band-14000{position:absolute;left:222px;top:38px}#webamp #band-16000{position:absolute;left:240px;top:38px}", ""]);
// exports
/***/ }),
/* 96 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseAni = void 0;
var riff_file_1 = __webpack_require__(97);
var byte_data_1 = __webpack_require__(16);
var DWORD = { bits: 32, be: false, signed: false, fp: false };
function parseAni(arr) {
var riff = new riff_file_1.RIFFFile();
riff.setSignature(arr);
var signature = riff.signature;
if (signature.format !== "ACON") {
throw new Error("Expected format. Expected \"ACON\", got \"" + signature.format + "\"");
}
// Helper function to get a chunk by chunkId and transform it if it's non-null.
function mapChunk(chunkId, mapper) {
var chunk = riff.findChunk(chunkId);
return chunk == null ? null : mapper(chunk);
}
var metadata = mapChunk("anih", function (c) {
var words = byte_data_1.unpackArray(arr, DWORD, c.chunkData.start, c.chunkData.end);
return {
cbSize: words[0],
nFrames: words[1],
nSteps: words[2],
iWidth: words[3],
iHeight: words[4],
iBitCount: words[5],
nPlanes: words[6],
iDispRate: words[7],
bfAttributes: words[8],
};
});
if (metadata == null) {
throw new Error("Did not find anih");
}
var rate = mapChunk("rate", function (c) {
return byte_data_1.unpackArray(arr, DWORD, c.chunkData.start, c.chunkData.end);
});
// chunkIds are always four chars, hence the trailing space.
var seq = mapChunk("seq ", function (c) {
return byte_data_1.unpackArray(arr, DWORD, c.chunkData.start, c.chunkData.end);
});
var lists = riff.findChunk("LIST", true);
var imageChunk = lists === null || lists === void 0 ? void 0 : lists.find(function (c) { return c.format === "fram"; });
if (imageChunk == null) {
throw new Error("Did not find fram LIST");
}
var images = imageChunk.subChunks.slice(0, metadata.nFrames).map(function (c) {
if (c.chunkId !== "icon") {
throw new Error("Unexpected chunk type in fram: " + c.chunkId);
}
return arr.slice(c.chunkData.start, c.chunkData.end);
});
var title = null;
var artist = null;
var infoChunk = lists === null || lists === void 0 ? void 0 : lists.find(function (c) { return c.format === "INFO"; });
if (infoChunk != null) {
infoChunk.subChunks.forEach(function (c) {
switch (c.chunkId) {
case "INAM":
title = byte_data_1.unpackString(arr, c.chunkData.start, c.chunkData.end);
break;
case "IART":
artist = byte_data_1.unpackString(arr, c.chunkData.start, c.chunkData.end);
break;
default:
// Unexpected subchunk
}
});
}
return { images: images, rate: rate, seq: seq, metadata: metadata, artist: artist, title: title };
}
exports.parseAni = parseAni;
//# sourceMappingURL=parser.js.map
/***/ }),
/* 97 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RIFFFile", function() { return RIFFFile; });
/* harmony import */ var byte_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
/*
* Copyright (c) 2017-2019 Rafael da Silva Rocha.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/**
* @fileoverview The RIFFFile class.
* @see https://github.com/rochars/riff-file
*/
/** @module riff-file */
/**
* A class to perform low-level reading of RIFF/RIFX files.
*/
class RIFFFile {
constructor() {
/**
* The container identifier.
* 'RIFF', 'RIFX' and 'RF64' are supported.
* @type {string}
*/
this.container = '';
/**
* The main chunk size, in bytes.
* @type {number}
*/
this.chunkSize = 0;
/**
* The format identifier.
* @type {string}
*/
this.format = '';
/**
* An object representing the signature of all chunks in the file.
* @type {{
chunkId: string,
chunkSize: number,
format: string,
chunkData: {start: number, end: number},
subChunks: Array
}|null}
*/
this.signature = null;
/**
* @type {number}
* @protected
*/
this.head = 0;
/**
* @type {
{bits: number, be: boolean, signed: boolean, fp: boolean}
}
* @protected
*/
this.uInt32 = { bits: 32, be: false, signed: false, fp: false };
/**
* The list of supported containers.
* Any format different from RIFX will be treated as RIFF.
* @type {!Array<string>}
* @protected
*/
this.supported_containers = ['RIFF', 'RIFX'];
}
/**
* Read the signature of the chunks in a RIFF/RIFX file.
* @param {!Uint8Array} buffer The file bytes.
* @protected
*/
setSignature(buffer) {
this.head = 0;
this.container = this.readString(buffer, 4);
if (this.supported_containers.indexOf(this.container) === -1) {
throw Error('Not a supported format.');
}
this.uInt32.be = this.container === 'RIFX';
this.chunkSize = this.readUInt32(buffer);
this.format = this.readString(buffer, 4);
// The RIFF file signature
this.signature = {
chunkId: this.container,
chunkSize: this.chunkSize,
format: this.format,
subChunks: this.getSubChunksIndex_(buffer),
chunkData: {start: 0, end: this.chunkSize}
};
}
/**
* Find a chunk by its fourCC_ in a array of RIFF chunks.
* @param {string} chunkId The chunk fourCC_.
* @param {boolean} multiple True if there may be multiple chunks
* with the same chunkId.
* @return {Object}
* @protected
*/
findChunk(chunkId, multiple=false) {
/** @type {!Array|null} */
let chunks = this.signature.subChunks;
/** @type {!Array<!Object>} */
let chunk = [];
for (let i=0; i<chunks.length; i++) {
if (chunks[i].chunkId == chunkId) {
if (multiple) {
chunk.push(chunks[i]);
} else {
return chunks[i];
}
}
}
if (chunkId == 'LIST') {
return chunk.length ? chunk : null;
}
return null;
}
/**
* Read bytes as a string from a RIFF chunk.
* @param {!Uint8Array} bytes The bytes.
* @param {number} maxSize the max size of the string.
* @return {string} The string.
* @protected
*/
readString(bytes, maxSize) {
/** @type {string} */
let str = '';
str = Object(byte_data__WEBPACK_IMPORTED_MODULE_0__["unpackString"])(bytes, this.head, this.head + maxSize);
this.head += maxSize;
return str;
}
/**
* Read a number from a chunk.
* @param {!Uint8Array} bytes The chunk bytes.
* @return {number} The number.
* @protected
*/
readUInt32(bytes) {
/** @type {number} */
let value = Object(byte_data__WEBPACK_IMPORTED_MODULE_0__["unpack"])(bytes, this.uInt32, this.head);
this.head += 4;
return value;
}
/**
* Return the sub chunks of a RIFF file.
* @param {!Uint8Array} buffer the RIFF file bytes.
* @return {!Array<Object>} The subchunks of a RIFF/RIFX or LIST chunk.
* @private
*/
getSubChunksIndex_(buffer) {
/** @type {!Array<!Object>} */
let chunks = [];
/** @type {number} */
let i = this.head;
while(i <= buffer.length - 8) {
chunks.push(this.getSubChunkIndex_(buffer, i));
i += 8 + chunks[chunks.length - 1].chunkSize;
i = i % 2 ? i + 1 : i;
}
return chunks;
}
/**
* Return a sub chunk from a RIFF file.
* @param {!Uint8Array} buffer the RIFF file bytes.
* @param {number} index The start index of the chunk.
* @return {!Object} A subchunk of a RIFF/RIFX or LIST chunk.
* @private
*/
getSubChunkIndex_(buffer, index) {
/** @type {!Object} */
let chunk = {
chunkId: this.getChunkId_(buffer, index),
chunkSize: this.getChunkSize_(buffer, index),
};
if (chunk.chunkId == 'LIST') {
chunk.format = Object(byte_data__WEBPACK_IMPORTED_MODULE_0__["unpackString"])(buffer, index + 8, index + 12);
this.head += 4;
chunk.subChunks = this.getSubChunksIndex_(buffer);
} else {
/** @type {number} */
let realChunkSize = chunk.chunkSize % 2 ?
chunk.chunkSize + 1 : chunk.chunkSize;
this.head = index + 8 + realChunkSize;
chunk.chunkData = {
start: index + 8,
end: this.head
};
}
return chunk;
}
/**
* Return the fourCC_ of a chunk.
* @param {!Uint8Array} buffer the RIFF file bytes.
* @param {number} index The start index of the chunk.
* @return {string} The id of the chunk.
* @private
*/
getChunkId_(buffer, index) {
this.head += 4;
return Object(byte_data__WEBPACK_IMPORTED_MODULE_0__["unpackString"])(buffer, index, index + 4);
}
/**
* Return the size of a chunk.
* @param {!Uint8Array} buffer the RIFF file bytes.
* @param {number} index The start index of the chunk.
* @return {number} The size of the chunk without the id and size fields.
* @private
*/
getChunkSize_(buffer, index) {
this.head += 4;
return Object(byte_data__WEBPACK_IMPORTED_MODULE_0__["unpack"])(buffer, this.uInt32, index + 4);
}
}
/***/ }),
/* 98 */
/***/ (function(module, exports, __webpack_require__) {
var content = __webpack_require__(99);
if(typeof content === 'string') content = [[module.i, content, '']];
var transform;
var insertInto;
var options = {"hmr":true}
options.transform = transform
options.insertInto = undefined;
var update = __webpack_require__(11)(content, options);
if(content.locals) module.exports = content.locals;
if(false) {}
/***/ }),
/* 99 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(10)(false);
// imports
// module
exports.push([module.i, "#webamp{position:absolute;top:0;left:0}#webamp canvas{-webkit-user-select:none;-moz-user-select:none;user-select:none}#webamp *{box-sizing:content-box;-webkit-box-sizing:content-box}#webamp :focus{outline:0}#webamp input[type=range]{-webkit-appearance:none;margin:0;padding:0;background:none;border:none}#webamp input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;border:none;border-radius:0;background:none}#webamp input[type=range]::-moz-range-thumb{border:none;border-radius:0;background:none}#webamp input[type=range]::-moz-range-track{border:none;background:none}#webamp input[type=range]:focus{outline:none}#webamp input[type=range]::-moz-focus-outer{border:0}#webamp a:focus{outline:none}@keyframes blink{0%{opacity:1}50%{opacity:0}to{opacity:1}}@-webkit-keyframes blink{0%{opacity:1}50%{opacity:0}to{opacity:1}}#webamp .character{display:inline-block;vertical-align:top;width:5px;height:6px;text-indent:-9999px}#webamp .window{position:absolute;image-rendering:-moz-crisp-edges;image-rendering:-o-crisp-edges;image-rendering:-webkit-optimize-contrast;image-rendering:pixelated;-ms-interpolation-mode:nearest-neighbor;-webkit-transform:translateZ(0)}#webamp .window.doubled{-moz-transform:translateZ(0) scale(2);-moz-transform-origin:top left;-webkit-transform:translateZ(0) scale(2);-webkit-transform-origin:top left}", ""]);
// exports
/***/ }),
/* 100 */
/***/ (function(module, exports, __webpack_require__) {
var content = __webpack_require__(101);
if(typeof content === 'string') content = [[module.i, content, '']];
var transform;
var insertInto;
var options = {"hmr":true}
options.transform = transform
options.insertInto = undefined;
var update = __webpack_require__(11)(content, options);
if(content.locals) module.exports = content.locals;
if(false) {}
/***/ }),
/* 101 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(10)(false);
// imports
// module
exports.push([module.i, "#webamp #balance{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAGkCAMAAABq7Kf7AAACvlBMVEUVfwoWFiMXFyQXGCUYFyUYGCYYkgsZLhwbGyschRIeaRYfHzIjIzgomRwpOCEujhYunBIvL0QvL0kvgBwxMU0xMU4yMU4yMk8zM1AzNFEzNFI0M1E0M1I0NFE0NFM0shU1NVQ1NlM1NlQ2NVM2NVQ2NlU2NlY2NyE3N1c3OFc3OFg4Jh04N1c4N1g4OFc4OFk5Gh05LSA5OVo7TkFCtiZHhidIcy1JSWNMi0BMlSVPU0RPpCNRQkBRmyxSMT5TUm9WqypauihbgTZcmyxcwCpixDFlvjdnoCxnsStp2TBrpU1rwCpuboRuj0Nw1T5xci5yxypz3D50QiR0xzF3JSJ3VCl3oDF3tCt30zB62jB7epB8e458fJB9fZB9fZJ+fpJ/1T6BxyqC3D6Eq1WEtDGEwF2F4jeGi0KGoYiHh5iIoDGJVi6KKSiKRC2KYzaKxDCLfjiLi5yLmCyMjJyNmiyOWxeOjp6OmyyQxzGRODmRTT2RWj2RbkKS4TCTk6KUyjiXXCGXrI+XtDGawmCa4z6bXSGbaSebfieb2jmeYhKeayaeriufFhufKhufPiGfSSGfVyGfbCefgSefkCyfmyygaTqho1Cj4Tik20Wk4jimNDemxzGpfEqprI+p40atkouuV0auag2uwCqwYh+xv16yERayKBayRx6ydiWynCqyriuyxDG3RUu94Ti/bRu/dRC/uyq/0zDAhFPB4kbCb1PCk1fCs1zDciPD1T7FDBLFJxLFQxvFURvFZRvFgCPFnCPFsSrFwCrF2TDGeA/G2jDIxdPI2z7JVyLJgSDJhSnJoCnJtDHJxDHJ3D7Zbx7ZfB/ZjifZlDfZrCfZsTfZwzDZxj7bhC/b1jXfsSjgDhXgHybgLBXgPCbgTB7gWC7gXB7gZy7gch7gfC7gkijgsijgyTDg2zfhmTfhtjfhzD7A/9hgAAAEC0lEQVRo3u3U+VeUZRTA8VeyQtQgKd6XZnGEmXEcmxkLG8YlBdTUCaRGSFFTA02zFBPTssUFF1zac4UKQkXUUrNUIHBLzX0PK3et9L/ouc8z2g+ec2/HX/I93u+ZMz/d877n3Ps5rxYI+J4O+AI+n88Dud0ut8vldDpSUlPtVrvdarNZDEPXAiIx4/V7/Z5Ocs7tcrqcDpGYs1qTYczQ5JDI740+DR7nTEnpYE+1i4dZbRaLoRvaY60fbCl6AP5axoifqEVMi9vFxLZpZ9O11g/HUT2abmixcRpVMFvX2sS1egivVWiarrVLS2yLFxpfomvuQO/sYaNUI0eNhEbcarjo5dc+KEnXNR+s1uv3dZL7cLlgt05HqgO2a7Ulwzp0PUmD1Xr9fo/nSbk0OAGs1gFLs1mSxWoNPUmMyRvAkJjyiCmXw5HSAcasVssTcAFdjkXv6Zc3UC8VQ/KVNptxawyO5fdFXymnHE71SnFPiwXunvR4krbvP6Xd45AS8eLSJKT4BLx4CSkxoT1egoIU6ooXZkhmg/RI8Bm8oIQU7NYDr1sIIAUzMvEywgrSc3jh2QzJdJCexYtCysjsi5WZISGF+g3E66cghQe9iDVoLEMyH6Q+eFFIA57HG5ADkLIGDy3AGjq4SEEaXYg1miGZEVJ/rH8hvYB1G1LBq1gFClL3cCE6VsiQTANJSjIAUn+irLR0LTZryCtEQ3KyBaTi94mKi6YBpLK5aGWls0tISCDpzXSGdI9AynqJSEEaU/w2WvEYgJQzs2z5SqTlZTMlpKIVX6GtKP2SITEkhnQfQuqYO4Eot7uAlDunnGjOOIBU/i1R+TKAtGwr0WqGZDpIU6ZOR5o6RUFa/A3RYoA0bsOWPT8j7dmyQUHasf8o0v4dDIkhMSSGxJAYEkNiSP8zpC+IFKT1m3ejbV4PkCYfaW7+C6m5+YiChE6JuW0MyXSQPifK7QmQancR1UpIh8/8iXbmsIJ09ibaWYbEkBgSQ2JIDOluIT2Vv+AztAVRSDuJaicDpEOnzl1HOnfqkIRUcfoG2mmGZD5I8xd9irRofj5Ayl/XRLTuPQFp0sET19BOHKwQkHpWnPwb7eSPXzMkhsSQ7kNInSOz5qHNUpCqvyOqniQgvb79ONF2CWnpr0TfMyTTQXqLKAKQIguriBYCpPyqTXvRNlUpSE2/oDVVMCTTQfqESH6RItWNRNXvwhep8dgVtGONCtJVIv4imQ/Sx0SRXgCp5ieiGoA08cAlogMSUuVloh8Ykskgdcn7iCgKqYGoZgZAarhA1FApIPWqvEjEkMwH6UOiPICUt7aeaO07AtIb9X8Q1UtIq84TVTIk00FaQqQgrakjWiMh1f1GVLdRQvqdaCNDuqN/AItpcu8L5wnUAAAAAElFTkSuQmCC)}#webamp #balance::-webkit-slider-thumb{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAALBAMAAAC9q6FRAAAAFVBMVEUAAAALDxYvL0RKWmt7hJStvMTa5+opTTwbAAAAMUlEQVQI12NQFAQBIQaxNBBIZGALBYIQAyAtKiqKlwapM2RgcwEBQwZhYxAwZICaBwCdgQ6Jd297uQAAAABJRU5ErkJggg==)}#webamp #balance::-moz-range-thumb{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAALBAMAAAC9q6FRAAAAFVBMVEUAAAALDxYvL0RKWmt7hJStvMTa5+opTTwbAAAAMUlEQVQI12NQFAQBIQaxNBBIZGALBYIQAyAtKiqKlwapM2RgcwEBQwZhYxAwZICaBwCdgQ6Jd297uQAAAABJRU5ErkJggg==)}#webamp #balance:active::-webkit-slider-thumb{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAALBAMAAAC9q6FRAAAAFVBMVEUAAAALDxYZICovL0RKWmva5+r///+U4Y9MAAAAMUlEQVQI12MwFAQBYQbRUBAQZGBlAAIWBiQ6ISEBKw2SV4TTIi4gIMhgJKQopCgoDAB2aAh/NddRQgAAAABJRU5ErkJggg==)}#webamp #balance:active::-moz-range-thumb{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAALBAMAAAC9q6FRAAAAFVBMVEUAAAALDxYZICovL0RKWmva5+r///+U4Y9MAAAAMUlEQVQI12MwFAQBYQbRUBAQZGBlAAIWBiQ6ISEBKw2SV4TTIi4gIMhgJKQopCgoDAB2aAh/NddRQgAAAABJRU5ErkJggg==)}#webamp .actions #previous{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAASCAMAAACHObUhAAAASFBMVEUfHzEgHzIgIDMhITQiITMiITQiIjUjIzYjJDgkIz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment