Code Hs
Code Hs
create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key,
{ enumerable: true, configurable: true, writable: true, value }) : obj[key] =
value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod),
mod.exports;
};
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module, desc) => {
if (module && typeof module === "object" || typeof module === "function") {
for (let key of __getOwnPropNames(module))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module[key], enumerable: !(desc =
__getOwnPropDesc(module, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module) => {
return __reExport(__markAsModule(__defProp(module != null ?
__create(__getProtoOf(module)) : {}, "default", module && module.__esModule &&
"default" in module ? { get: () => module.default, enumerable: true } : { value:
module, enumerable: true })), module);
};
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) :
Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// node_modules/@babel/runtime/helpers/arrayWithHoles.js
var require_arrayWithHoles = __commonJS({
"node_modules/@babel/runtime/helpers/arrayWithHoles.js"(exports, module) {
function _arrayWithHoles(arr) {
if (Array.isArray(arr))
return arr;
}
module.exports = _arrayWithHoles;
module.exports["default"] = module.exports, module.exports.__esModule = true;
}
});
// node_modules/@babel/runtime/helpers/iterableToArrayLimit.js
var require_iterableToArrayLimit = __commonJS({
"node_modules/@babel/runtime/helpers/iterableToArrayLimit.js"(exports, module) {
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" &&
arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null)
return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i)
break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null)
_i["return"]();
} finally {
if (_d)
throw _e;
}
}
return _arr;
}
module.exports = _iterableToArrayLimit;
module.exports["default"] = module.exports, module.exports.__esModule = true;
}
});
// node_modules/@babel/runtime/helpers/arrayLikeToArray.js
var require_arrayLikeToArray = __commonJS({
"node_modules/@babel/runtime/helpers/arrayLikeToArray.js"(exports, module) {
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length)
len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
module.exports = _arrayLikeToArray;
module.exports["default"] = module.exports, module.exports.__esModule = true;
}
});
// node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js
var require_unsupportedIterableToArray = __commonJS({
"node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js"(exports,
module) {
var arrayLikeToArray = require_arrayLikeToArray();
function _unsupportedIterableToArray(o, minLen) {
if (!o)
return;
if (typeof o === "string")
return arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor)
n = o.constructor.name;
if (n === "Map" || n === "Set")
return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
return arrayLikeToArray(o, minLen);
}
module.exports = _unsupportedIterableToArray;
module.exports["default"] = module.exports, module.exports.__esModule = true;
}
});
// node_modules/@babel/runtime/helpers/nonIterableRest.js
var require_nonIterableRest = __commonJS({
"node_modules/@babel/runtime/helpers/nonIterableRest.js"(exports, module) {
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\
nIn order to be iterable, non-array objects must have a [Symbol.iterator]()
method.");
}
module.exports = _nonIterableRest;
module.exports["default"] = module.exports, module.exports.__esModule = true;
}
});
// node_modules/@babel/runtime/helpers/slicedToArray.js
var require_slicedToArray = __commonJS({
"node_modules/@babel/runtime/helpers/slicedToArray.js"(exports, module) {
var arrayWithHoles = require_arrayWithHoles();
var iterableToArrayLimit = require_iterableToArrayLimit();
var unsupportedIterableToArray = require_unsupportedIterableToArray();
var nonIterableRest = require_nonIterableRest();
function _slicedToArray(arr, i) {
return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) ||
unsupportedIterableToArray(arr, i) || nonIterableRest();
}
module.exports = _slicedToArray;
module.exports["default"] = module.exports, module.exports.__esModule = true;
}
});
// node_modules/@babel/runtime/helpers/classCallCheck.js
var require_classCallCheck = __commonJS({
"node_modules/@babel/runtime/helpers/classCallCheck.js"(exports, module) {
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
module.exports = _classCallCheck;
module.exports["default"] = module.exports, module.exports.__esModule = true;
}
});
// node_modules/@babel/runtime/helpers/createClass.js
var require_createClass = __commonJS({
"node_modules/@babel/runtime/helpers/createClass.js"(exports, module) {
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps)
_defineProperties(Constructor.prototype, protoProps);
if (staticProps)
_defineProperties(Constructor, staticProps);
return Constructor;
}
module.exports = _createClass;
module.exports["default"] = module.exports, module.exports.__esModule = true;
}
});
// node_modules/automation-events/build/es5/bundle.js
var require_bundle = __commonJS({
"node_modules/automation-events/build/es5/bundle.js"(exports, module) {
(function(global2, factory) {
typeof exports === "object" && typeof module !== "undefined" ?
factory(exports, require_slicedToArray(), require_classCallCheck(),
require_createClass()) : typeof define === "function" && define.amd ?
define(["exports", "@babel/runtime/helpers/slicedToArray",
"@babel/runtime/helpers/classCallCheck", "@babel/runtime/helpers/createClass"],
factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 ||
self, factory(global2.automationEvents = {}, global2._slicedToArray,
global2._classCallCheck, global2._createClass));
})(exports, function(exports2, _slicedToArray, _classCallCheck, _createClass) {
"use strict";
function _interopDefaultLegacy(e) {
return e && typeof e === "object" && "default" in e ? e : { "default": e };
}
var _slicedToArray__default = /* @__PURE__ */
_interopDefaultLegacy(_slicedToArray);
var _classCallCheck__default = /* @__PURE__ */
_interopDefaultLegacy(_classCallCheck);
var _createClass__default = /* @__PURE__ */
_interopDefaultLegacy(_createClass);
var createExtendedExponentialRampToValueAutomationEvent = function
createExtendedExponentialRampToValueAutomationEvent2(value, endTime, insertTime) {
return {
endTime,
insertTime,
type: "exponentialRampToValue",
value
};
};
var createExtendedLinearRampToValueAutomationEvent = function
createExtendedLinearRampToValueAutomationEvent2(value, endTime, insertTime) {
return {
endTime,
insertTime,
type: "linearRampToValue",
value
};
};
var createSetValueAutomationEvent2 = function
createSetValueAutomationEvent3(value, startTime) {
return {
startTime,
type: "setValue",
value
};
};
var createSetValueCurveAutomationEvent2 = function
createSetValueCurveAutomationEvent3(values, startTime, duration) {
return {
duration,
startTime,
type: "setValueCurve",
values
};
};
var getTargetValueAtTime = function getTargetValueAtTime2(time,
valueAtStartTime, _ref) {
var startTime = _ref.startTime, target = _ref.target, timeConstant =
_ref.timeConstant;
return target + (valueAtStartTime - target) * Math.exp((startTime - time) /
timeConstant);
};
var isExponentialRampToValueAutomationEvent = function
isExponentialRampToValueAutomationEvent2(automationEvent) {
return automationEvent.type === "exponentialRampToValue";
};
var isLinearRampToValueAutomationEvent = function
isLinearRampToValueAutomationEvent2(automationEvent) {
return automationEvent.type === "linearRampToValue";
};
var isAnyRampToValueAutomationEvent = function
isAnyRampToValueAutomationEvent2(automationEvent) {
return isExponentialRampToValueAutomationEvent(automationEvent) ||
isLinearRampToValueAutomationEvent(automationEvent);
};
var isSetValueAutomationEvent = function
isSetValueAutomationEvent2(automationEvent) {
return automationEvent.type === "setValue";
};
var isSetValueCurveAutomationEvent = function
isSetValueCurveAutomationEvent2(automationEvent) {
return automationEvent.type === "setValueCurve";
};
var getValueOfAutomationEventAtIndexAtTime = function
getValueOfAutomationEventAtIndexAtTime2(automationEvents, index, time,
defaultValue) {
var automationEvent = automationEvents[index];
return automationEvent === void 0 ? defaultValue :
isAnyRampToValueAutomationEvent(automationEvent) ||
isSetValueAutomationEvent(automationEvent) ? automationEvent.value :
isSetValueCurveAutomationEvent(automationEvent) ?
automationEvent.values[automationEvent.values.length - 1] :
getTargetValueAtTime(time,
getValueOfAutomationEventAtIndexAtTime2(automationEvents, index - 1,
automationEvent.startTime, defaultValue), automationEvent);
};
var getEndTimeAndValueOfPreviousAutomationEvent = function
getEndTimeAndValueOfPreviousAutomationEvent2(automationEvents, index,
currentAutomationEvent, nextAutomationEvent, defaultValue) {
return currentAutomationEvent === void 0 ? [nextAutomationEvent.insertTime,
defaultValue] : isAnyRampToValueAutomationEvent(currentAutomationEvent) ?
[currentAutomationEvent.endTime, currentAutomationEvent.value] :
isSetValueAutomationEvent(currentAutomationEvent) ?
[currentAutomationEvent.startTime, currentAutomationEvent.value] :
isSetValueCurveAutomationEvent(currentAutomationEvent) ?
[currentAutomationEvent.startTime + currentAutomationEvent.duration,
currentAutomationEvent.values[currentAutomationEvent.values.length - 1]] :
[currentAutomationEvent.startTime,
getValueOfAutomationEventAtIndexAtTime(automationEvents, index - 1,
currentAutomationEvent.startTime, defaultValue)];
};
var isCancelAndHoldAutomationEvent = function
isCancelAndHoldAutomationEvent2(automationEvent) {
return automationEvent.type === "cancelAndHold";
};
var isCancelScheduledValuesAutomationEvent = function
isCancelScheduledValuesAutomationEvent2(automationEvent) {
return automationEvent.type === "cancelScheduledValues";
};
var getEventTime = function getEventTime2(automationEvent) {
if (isCancelAndHoldAutomationEvent(automationEvent) ||
isCancelScheduledValuesAutomationEvent(automationEvent)) {
return automationEvent.cancelTime;
}
if (isExponentialRampToValueAutomationEvent(automationEvent) ||
isLinearRampToValueAutomationEvent(automationEvent)) {
return automationEvent.endTime;
}
return automationEvent.startTime;
};
var getExponentialRampValueAtTime = function
getExponentialRampValueAtTime2(time, startTime, valueAtStartTime, _ref) {
var endTime = _ref.endTime, value = _ref.value;
if (valueAtStartTime === value) {
return value;
}
if (0 < valueAtStartTime && 0 < value || valueAtStartTime < 0 && value < 0)
{
return valueAtStartTime * Math.pow(value / valueAtStartTime, (time -
startTime) / (endTime - startTime));
}
return 0;
};
var getLinearRampValueAtTime = function getLinearRampValueAtTime2(time,
startTime, valueAtStartTime, _ref) {
var endTime = _ref.endTime, value = _ref.value;
return valueAtStartTime + (time - startTime) / (endTime - startTime) *
(value - valueAtStartTime);
};
var interpolateValue = function interpolateValue2(values, theoreticIndex) {
var lowerIndex = Math.floor(theoreticIndex);
var upperIndex = Math.ceil(theoreticIndex);
if (lowerIndex === upperIndex) {
return values[lowerIndex];
}
return (1 - (theoreticIndex - lowerIndex)) * values[lowerIndex] + (1 -
(upperIndex - theoreticIndex)) * values[upperIndex];
};
var getValueCurveValueAtTime = function getValueCurveValueAtTime2(time, _ref)
{
var duration = _ref.duration, startTime = _ref.startTime, values =
_ref.values;
var theoreticIndex = (time - startTime) / duration * (values.length - 1);
return interpolateValue(values, theoreticIndex);
};
var isSetTargetAutomationEvent = function
isSetTargetAutomationEvent2(automationEvent) {
return automationEvent.type === "setTarget";
};
var AutomationEventList2 = /* @__PURE__ */ function(_Symbol$iterator) {
function AutomationEventList3(defaultValue) {
_classCallCheck__default["default"](this, AutomationEventList3);
this._automationEvents = [];
this._currenTime = 0;
this._defaultValue = defaultValue;
}
_createClass__default["default"](AutomationEventList3, [{
key: _Symbol$iterator,
value: function value() {
return this._automationEvents[Symbol.iterator]();
}
}, {
key: "add",
value: function add(automationEvent) {
var eventTime = getEventTime(automationEvent);
if (isCancelAndHoldAutomationEvent(automationEvent) ||
isCancelScheduledValuesAutomationEvent(automationEvent)) {
var index =
this._automationEvents.findIndex(function(currentAutomationEvent) {
if (isCancelScheduledValuesAutomationEvent(automationEvent) &&
isSetValueCurveAutomationEvent(currentAutomationEvent)) {
return currentAutomationEvent.startTime +
currentAutomationEvent.duration >= eventTime;
}
return getEventTime(currentAutomationEvent) >= eventTime;
});
var removedAutomationEvent = this._automationEvents[index];
if (index !== -1) {
this._automationEvents = this._automationEvents.slice(0, index);
}
if (isCancelAndHoldAutomationEvent(automationEvent)) {
var lastAutomationEvent =
this._automationEvents[this._automationEvents.length - 1];
if (removedAutomationEvent !== void 0 &&
isAnyRampToValueAutomationEvent(removedAutomationEvent)) {
if (isSetTargetAutomationEvent(lastAutomationEvent)) {
throw new Error("The internal list is malformed.");
}
var startTime =
isSetValueCurveAutomationEvent(lastAutomationEvent) ? lastAutomationEvent.startTime
+ lastAutomationEvent.duration : getEventTime(lastAutomationEvent);
var startValue =
isSetValueCurveAutomationEvent(lastAutomationEvent) ?
lastAutomationEvent.values[lastAutomationEvent.values.length - 1] :
lastAutomationEvent.value;
var value =
isExponentialRampToValueAutomationEvent(removedAutomationEvent) ?
getExponentialRampValueAtTime(eventTime, startTime, startValue,
removedAutomationEvent) : getLinearRampValueAtTime(eventTime, startTime,
startValue, removedAutomationEvent);
var truncatedAutomationEvent =
isExponentialRampToValueAutomationEvent(removedAutomationEvent) ?
createExtendedExponentialRampToValueAutomationEvent(value, eventTime,
this._currenTime) : createExtendedLinearRampToValueAutomationEvent(value,
eventTime, this._currenTime);
this._automationEvents.push(truncatedAutomationEvent);
}
if (lastAutomationEvent !== void 0 &&
isSetTargetAutomationEvent(lastAutomationEvent)) {
this._automationEvents.push(createSetValueAutomationEvent2(this.getValue(eventTime)
, eventTime));
}
if (lastAutomationEvent !== void 0 &&
isSetValueCurveAutomationEvent(lastAutomationEvent) &&
lastAutomationEvent.startTime + lastAutomationEvent.duration > eventTime) {
this._automationEvents[this._automationEvents.length - 1] =
createSetValueCurveAutomationEvent2(new Float32Array([6, 7]),
lastAutomationEvent.startTime, eventTime - lastAutomationEvent.startTime);
}
}
} else {
var _index =
this._automationEvents.findIndex(function(currentAutomationEvent) {
return getEventTime(currentAutomationEvent) > eventTime;
});
var previousAutomationEvent = _index === -1 ?
this._automationEvents[this._automationEvents.length - 1] :
this._automationEvents[_index - 1];
if (previousAutomationEvent !== void 0 &&
isSetValueCurveAutomationEvent(previousAutomationEvent) &&
getEventTime(previousAutomationEvent) + previousAutomationEvent.duration >
eventTime) {
return false;
}
var persistentAutomationEvent =
isExponentialRampToValueAutomationEvent(automationEvent) ?
createExtendedExponentialRampToValueAutomationEvent(automationEvent.value,
automationEvent.endTime, this._currenTime) :
isLinearRampToValueAutomationEvent(automationEvent) ?
createExtendedLinearRampToValueAutomationEvent(automationEvent.value, eventTime,
this._currenTime) : automationEvent;
if (_index === -1) {
this._automationEvents.push(persistentAutomationEvent);
} else {
if (isSetValueCurveAutomationEvent(automationEvent) && eventTime +
automationEvent.duration > getEventTime(this._automationEvents[_index])) {
return false;
}
this._automationEvents.splice(_index, 0,
persistentAutomationEvent);
}
}
return true;
}
}, {
key: "flush",
value: function flush(time) {
var index =
this._automationEvents.findIndex(function(currentAutomationEvent) {
return getEventTime(currentAutomationEvent) > time;
});
if (index > 1) {
var remainingAutomationEvents = this._automationEvents.slice(index -
1);
var firstRemainingAutomationEvent = remainingAutomationEvents[0];
if (isSetTargetAutomationEvent(firstRemainingAutomationEvent)) {
remainingAutomationEvents.unshift(createSetValueAutomationEvent2(getValueOfAutomati
onEventAtIndexAtTime(this._automationEvents, index - 2,
firstRemainingAutomationEvent.startTime, this._defaultValue),
firstRemainingAutomationEvent.startTime));
}
this._automationEvents = remainingAutomationEvents;
}
}
}, {
key: "getValue",
value: function getValue(time) {
if (this._automationEvents.length === 0) {
return this._defaultValue;
}
var indexOfNextEvent =
this._automationEvents.findIndex(function(automationEvent) {
return getEventTime(automationEvent) > time;
});
var nextAutomationEvent = this._automationEvents[indexOfNextEvent];
var indexOfCurrentEvent = (indexOfNextEvent === -1 ?
this._automationEvents.length : indexOfNextEvent) - 1;
var currentAutomationEvent =
this._automationEvents[indexOfCurrentEvent];
if (currentAutomationEvent !== void 0 &&
isSetTargetAutomationEvent(currentAutomationEvent) && (nextAutomationEvent === void
0 || !isAnyRampToValueAutomationEvent(nextAutomationEvent) ||
nextAutomationEvent.insertTime > time)) {
return getTargetValueAtTime(time,
getValueOfAutomationEventAtIndexAtTime(this._automationEvents, indexOfCurrentEvent
- 1, currentAutomationEvent.startTime, this._defaultValue),
currentAutomationEvent);
}
if (currentAutomationEvent !== void 0 &&
isSetValueAutomationEvent(currentAutomationEvent) && (nextAutomationEvent === void
0 || !isAnyRampToValueAutomationEvent(nextAutomationEvent))) {
return currentAutomationEvent.value;
}
if (currentAutomationEvent !== void 0 &&
isSetValueCurveAutomationEvent(currentAutomationEvent) && (nextAutomationEvent ===
void 0 || !isAnyRampToValueAutomationEvent(nextAutomationEvent) ||
currentAutomationEvent.startTime + currentAutomationEvent.duration > time)) {
if (time < currentAutomationEvent.startTime +
currentAutomationEvent.duration) {
return getValueCurveValueAtTime(time, currentAutomationEvent);
}
return
currentAutomationEvent.values[currentAutomationEvent.values.length - 1];
}
if (currentAutomationEvent !== void 0 &&
isAnyRampToValueAutomationEvent(currentAutomationEvent) && (nextAutomationEvent ===
void 0 || !isAnyRampToValueAutomationEvent(nextAutomationEvent))) {
return currentAutomationEvent.value;
}
if (nextAutomationEvent !== void 0 &&
isExponentialRampToValueAutomationEvent(nextAutomationEvent)) {
var _getEndTimeAndValueOf =
getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents,
indexOfCurrentEvent, currentAutomationEvent, nextAutomationEvent,
this._defaultValue), _getEndTimeAndValueOf2 = _slicedToArray__default["default"]
(_getEndTimeAndValueOf, 2), startTime = _getEndTimeAndValueOf2[0], value =
_getEndTimeAndValueOf2[1];
return getExponentialRampValueAtTime(time, startTime, value,
nextAutomationEvent);
}
if (nextAutomationEvent !== void 0 &&
isLinearRampToValueAutomationEvent(nextAutomationEvent)) {
var _getEndTimeAndValueOf3 =
getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents,
indexOfCurrentEvent, currentAutomationEvent, nextAutomationEvent,
this._defaultValue), _getEndTimeAndValueOf4 = _slicedToArray__default["default"]
(_getEndTimeAndValueOf3, 2), _startTime = _getEndTimeAndValueOf4[0], _value =
_getEndTimeAndValueOf4[1];
return getLinearRampValueAtTime(time, _startTime, _value,
nextAutomationEvent);
}
return this._defaultValue;
}
}]);
return AutomationEventList3;
}(Symbol.iterator);
var createCancelAndHoldAutomationEvent2 = function
createCancelAndHoldAutomationEvent3(cancelTime) {
return {
cancelTime,
type: "cancelAndHold"
};
};
var createCancelScheduledValuesAutomationEvent2 = function
createCancelScheduledValuesAutomationEvent3(cancelTime) {
return {
cancelTime,
type: "cancelScheduledValues"
};
};
var createExponentialRampToValueAutomationEvent2 = function
createExponentialRampToValueAutomationEvent3(value, endTime) {
return {
endTime,
type: "exponentialRampToValue",
value
};
};
var createLinearRampToValueAutomationEvent2 = function
createLinearRampToValueAutomationEvent3(value, endTime) {
return {
endTime,
type: "linearRampToValue",
value
};
};
var createSetTargetAutomationEvent2 = function
createSetTargetAutomationEvent3(target, startTime, timeConstant) {
return {
startTime,
target,
timeConstant,
type: "setTarget"
};
};
exports2.AutomationEventList = AutomationEventList2;
exports2.createCancelAndHoldAutomationEvent =
createCancelAndHoldAutomationEvent2;
exports2.createCancelScheduledValuesAutomationEvent =
createCancelScheduledValuesAutomationEvent2;
exports2.createExponentialRampToValueAutomationEvent =
createExponentialRampToValueAutomationEvent2;
exports2.createLinearRampToValueAutomationEvent =
createLinearRampToValueAutomationEvent2;
exports2.createSetTargetAutomationEvent = createSetTargetAutomationEvent2;
exports2.createSetValueAutomationEvent = createSetValueAutomationEvent2;
exports2.createSetValueCurveAutomationEvent =
createSetValueCurveAutomationEvent2;
Object.defineProperty(exports2, "__esModule", { value: true });
});
}
});
// node_modules/tone/node_modules/tslib/tslib.js
var require_tslib = __commonJS({
"node_modules/tone/node_modules/tslib/tslib.js"(exports, module) {
var __extends2;
var __assign2;
var __rest2;
var __decorate2;
var __param2;
var __metadata2;
var __awaiter2;
var __generator2;
var __exportStar2;
var __values2;
var __read2;
var __spread2;
var __spreadArrays2;
var __spreadArray2;
var __await2;
var __asyncGenerator2;
var __asyncDelegator2;
var __asyncValues2;
var __makeTemplateObject2;
var __importStar2;
var __importDefault2;
var __classPrivateFieldGet2;
var __classPrivateFieldSet2;
var __createBinding2;
(function(factory) {
var root = typeof global === "object" ? global : typeof self === "object" ?
self : typeof this === "object" ? this : {};
if (typeof define === "function" && define.amd) {
define("tslib", ["exports"], function(exports2) {
factory(createExporter(root, createExporter(exports2)));
});
} else if (typeof module === "object" && typeof module.exports === "object")
{
factory(createExporter(root, createExporter(module.exports)));
} else {
factory(createExporter(root));
}
function createExporter(exports2, previous) {
if (exports2 !== root) {
if (typeof Object.create === "function") {
Object.defineProperty(exports2, "__esModule", { value: true });
} else {
exports2.__esModule = true;
}
}
return function(id, v) {
return exports2[id] = previous ? previous(id, v) : v;
};
}
})(function(exporter) {
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof
Array && function(d, b) {
d.__proto__ = b;
} || function(d, b) {
for (var p in b)
if (Object.prototype.hasOwnProperty.call(b, p))
d[p] = b[p];
};
__extends2 = function(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a
constructor or null");
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype,
new __());
};
__assign2 = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
__rest2 = function(s, e) {
var t = {};
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 &&
Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
__decorate2 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc =
Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param2 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
__metadata2 = function(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(metadataKey, metadataValue);
};
__awaiter2 = function(thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) :
adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
__generator2 = function(thisArg, body) {
var _ = { label: 0, sent: function() {
if (t[0] & 1)
throw t[1];
return t[1];
}, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof
Symbol === "function" && (g[Symbol.iterator] = function() {
return this;
}), g;
function verb(n) {
return function(v) {
return step([n, v]);
};
}
function step(op) {
if (f)
throw new TypeError("Generator is already executing.");
while (_)
try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] ||
((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
return t;
if (y = 0, t)
op = [op[0] & 2, t.value];
switch (op[0]) {
case 0:
case 1:
t = op;
break;
case 4:
_.label++;
return { value: op[1], done: false };
case 5:
_.label++;
y = op[1];
op = [0];
continue;
case 7:
op = _.ops.pop();
_.trys.pop();
continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0]
=== 6 || op[0] === 2)) {
_ = 0;
continue;
}
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
_.label = op[1];
break;
}
if (op[0] === 6 && _.label < t[1]) {
_.label = t[1];
t = op;
break;
}
if (t && _.label < t[2]) {
_.label = t[2];
_.ops.push(op);
break;
}
if (t[2])
_.ops.pop();
_.trys.pop();
continue;
}
op = body.call(thisArg, _);
} catch (e) {
op = [6, e];
y = 0;
} finally {
f = t = 0;
}
if (op[0] & 5)
throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
};
__exportStar2 = function(m, o) {
for (var p in m)
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
__createBinding2(o, m, p);
};
__createBinding2 = Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() {
return m[k];
} });
} : function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
o[k2] = m[k];
};
__values2 = function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i =
0;
if (m)
return m.call(o);
if (o && typeof o.length === "number")
return {
next: function() {
if (o && i >= o.length)
o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not
defined.");
};
__read2 = 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 };
} finally {
try {
if (r && !r.done && (m = i["return"]))
m.call(i);
} finally {
if (e)
throw e.error;
}
}
return ar;
};
__spread2 = function() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read2(arguments[i]));
return ar;
};
__spreadArrays2 = function() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
__spreadArray2 = function(to, from, pack) {
if (pack || arguments.length === 2)
for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar)
ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
__await2 = function(v) {
return this instanceof __await2 ? (this.v = v, this) : new __await2(v);
};
__asyncGenerator2 = function(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"),
i[Symbol.asyncIterator] = function() {
return this;
}, i;
function verb(n) {
if (g[n])
i[n] = function(v) {
return new Promise(function(a, b) {
q.push([n, v, a, b]) > 1 || resume(n, v);
});
};
}
function resume(n, v) {
try {
step(g[n](v));
} catch (e) {
settle(q[0][3], e);
}
}
function step(r) {
r.value instanceof __await2 ? Promise.resolve(r.value.v).then(fulfill,
reject) : settle(q[0][2], r);
}
function fulfill(value) {
resume("next", value);
}
function reject(value) {
resume("throw", value);
}
function settle(f, v) {
if (f(v), q.shift(), q.length)
resume(q[0][0], q[0][1]);
}
};
__asyncDelegator2 = function(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function(e) {
throw e;
}), verb("return"), i[Symbol.iterator] = function() {
return this;
}, i;
function verb(n, f) {
i[n] = o[n] ? function(v) {
return (p = !p) ? { value: __await2(o[n](v)), done: n === "return" } :
f ? f(v) : v;
} : f;
}
};
__asyncValues2 = function(o) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values2 === "function" ?
__values2(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"),
verb("return"), i[Symbol.asyncIterator] = function() {
return this;
}, i);
function verb(n) {
i[n] = o[n] && function(v) {
return new Promise(function(resolve, reject) {
v = o[n](v), settle(resolve, reject, v.done, v.value);
});
};
}
function settle(resolve, reject, d, v) {
Promise.resolve(v).then(function(v2) {
resolve({ value: v2, done: d });
}, reject);
}
};
__makeTemplateObject2 = function(cooked, raw) {
if (Object.defineProperty) {
Object.defineProperty(cooked, "raw", { value: raw });
} else {
cooked.raw = raw;
}
return cooked;
};
var __setModuleDefault = Object.create ? function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
} : function(o, v) {
o["default"] = v;
};
__importStar2 = function(mod) {
if (mod && mod.__esModule)
return mod;
var result = {};
if (mod != null) {
for (var k in mod)
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
__createBinding2(result, mod, k);
}
__setModuleDefault(result, mod);
return result;
};
__importDefault2 = function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
__classPrivateFieldGet2 = function(receiver, state, kind, f) {
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !
state.has(receiver))
throw new TypeError("Cannot read private member from an object whose
class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value :
state.get(receiver);
};
__classPrivateFieldSet2 = function(receiver, state, value, kind, f) {
if (kind === "m")
throw new TypeError("Private method is not writable");
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !
state.has(receiver))
throw new TypeError("Cannot write private member to an object whose class
did not declare it");
return kind === "a" ? f.call(receiver, value) : f ? f.value = value :
state.set(receiver, value), value;
};
exporter("__extends", __extends2);
exporter("__assign", __assign2);
exporter("__rest", __rest2);
exporter("__decorate", __decorate2);
exporter("__param", __param2);
exporter("__metadata", __metadata2);
exporter("__awaiter", __awaiter2);
exporter("__generator", __generator2);
exporter("__exportStar", __exportStar2);
exporter("__createBinding", __createBinding2);
exporter("__values", __values2);
exporter("__read", __read2);
exporter("__spread", __spread2);
exporter("__spreadArrays", __spreadArrays2);
exporter("__spreadArray", __spreadArray2);
exporter("__await", __await2);
exporter("__asyncGenerator", __asyncGenerator2);
exporter("__asyncDelegator", __asyncDelegator2);
exporter("__asyncValues", __asyncValues2);
exporter("__makeTemplateObject", __makeTemplateObject2);
exporter("__importStar", __importStar2);
exporter("__importDefault", __importDefault2);
exporter("__classPrivateFieldGet", __classPrivateFieldGet2);
exporter("__classPrivateFieldSet", __classPrivateFieldSet2);
});
}
});
// src/console/index.js
var Console = class {
constructor(options = {}) {
__publicField(this, "onInput", (promptString) => __async(this, null, function*
() {
return yield prompt(promptString);
}));
__publicField(this, "onOutput", window.console.log.bind(window.console));
__publicField(this, "onClear", window.console.clear.bind(window.console));
var _a3, _b, _c, _d;
this.onInput = (_a3 = options.input) != null ? _a3 : (promptString) =>
__async(this, null, function* () {
return yield prompt(promptString);
});
this.onOutput = (_b = options.output) != null ? _b :
window.console.log.bind(window.console);
this.onClear = (_c = options.clear) != null ? _c :
window.console.clear.bind(window.console);
this.promptTransform = (_d = options.prompt) != null ? _d : (promptString,
defaultValue) => {
return promptString;
};
}
configure(options = {}) {
var _a3, _b, _c, _d;
this.onInput = (_a3 = options.input) != null ? _a3 : this.onInput;
this.onOutput = (_b = options.output) != null ? _b : this.onOutput;
this.onClear = (_c = options.clear) != null ? _c : this.onClear;
this.promptTransform = (_d = options.prompt) != null ? _d :
this.promptTransform;
}
readLinePrivate(promptString) {
const input = prompt(this.promptTransform(promptString));
return input;
}
readLinePrivateAsync(promptString) {
const input = this.onInput(promptString);
return input;
}
clear() {
this.onClear();
}
print(...args) {
if (args.length < 1) {
throw new Error("You should pass at least 1 argument to print");
}
this.onOutput(...args);
}
println(value) {
if (arguments.length === 0) {
value = "";
} else if (arguments.length !== 1) {
throw new Error("You should pass exactly 1 argument to println");
}
this.print(value, "\n");
}
readNumber(str, parseFn, errorMsgType, asynchronous) {
const DEFAULT = Symbol();
const MAX_RECURSION_DEPTH = 100;
const ABORT = Symbol("ABORT");
let promptString = str;
let parsedResult;
const parseInput = (result2) => {
if (result2 === null) {
return ABORT;
}
parsedResult = parseFn(result2);
if (!isNaN(parsedResult)) {
return parsedResult;
}
return null;
};
const attemptInput = (promptString2, depth, asynchronous2) => {
if (depth >= MAX_RECURSION_DEPTH) {
return DEFAULT;
}
const result2 = asynchronous2 ? this.readLinePrivateAsync(promptString2) :
this.readLinePrivate(promptString2);
const next = (result3) => {
return attemptInput(`'${result3}' was not ${errorMsgType}. Please try
again.
${str}`, depth + 1, asynchronous2);
};
if (Promise.resolve(result2) === result2) {
return result2.then((result3) => {
const parsedResult2 = parseInput(result3);
if (parsedResult2 === ABORT) {
return null;
}
if (parsedResult2 === null) {
return next(result3);
} else {
return parsedResult2;
}
});
} else {
const parsedResult2 = parseInput(result2);
if (parsedResult2 === ABORT) {
return null;
}
if (parsedResult2 === null) {
return next(result2);
} else {
return parsedResult2;
}
}
};
const result = attemptInput(promptString, 0, asynchronous);
if (result === DEFAULT) {
return 0;
}
if (result === null) {
return null;
}
if (!asynchronous) {
this.print(str);
this.println(result);
}
return result;
}
readLine(str) {
if (arguments.length !== 1) {
throw new Error("You should pass exactly 1 argument to readLine");
}
const result = this.readLinePrivate(str);
this.print(str);
this.println(result);
return result;
}
readLineAsync(_0) {
return __async(this, arguments, function* (str) {
if (arguments.length !== 1) {
throw new Error("You should pass exactly 1 argument to readLineAsync");
}
const result = yield this.readLinePrivateAsync(str);
return result;
});
}
readBoolean(str) {
if (arguments.length !== 1) {
throw new Error("You should pass exactly 1 argument to readBoolean");
}
return this.readNumber(str, (line) => {
if (line === null) {
return NaN;
}
line = line.toLowerCase();
if (line === "true" || line === "yes") {
return true;
}
if (line === "false" || line === "no") {
return false;
}
return NaN;
}, "a boolean (true/false)");
}
readBooleanAsync(_0) {
return __async(this, arguments, function* (str) {
if (arguments.length !== 1) {
throw new Error("You should pass exactly 1 argument to readBooleanAsync");
}
return yield this.readNumber(str, (line) => {
if (line === null) {
return NaN;
}
line = line.toLowerCase();
if (line === "true" || line === "yes") {
return true;
}
if (line === "false" || line === "no") {
return false;
}
return NaN;
}, "a boolean (true/false)", true);
});
}
readInt(str) {
if (arguments.length !== 1) {
throw new Error("You should pass exactly 1 argument to readInt");
}
return this.readNumber(str, function(x) {
var resultInt = parseInt(x);
var resultFloat = parseFloat(x);
if (resultInt === resultFloat) {
return resultInt;
}
return NaN;
}, "an integer");
}
readIntAsync(_0) {
return __async(this, arguments, function* (str) {
if (arguments.length !== 1) {
throw new Error("You should pass exactly 1 argument to readIntAsync");
}
return yield this.readNumber(str, function(x) {
var resultInt = parseInt(x);
var resultFloat = parseFloat(x);
if (resultInt === resultFloat) {
return resultInt;
}
return NaN;
}, "an integer", true);
});
}
readFloat(str) {
if (arguments.length !== 1) {
throw new Error("You should pass exactly 1 argument to readFloat");
}
return this.readNumber(str, parseFloat, "a float");
}
readFloatAsync(_0) {
return __async(this, arguments, function* (str) {
if (arguments.length !== 1) {
throw new Error("You should pass exactly 1 argument to readFloatAsync");
}
return yield this.readNumber(str, parseFloat, "a float", true);
});
}
};
var console_default = Console;
// src/datastructures/grid.js
var Grid = class {
constructor(rows, cols) {
__publicField(this, "type", "Grid");
if (arguments.length !== 2) {
throw new Error("You should pass exactly 2 arguments to `new Grid(rows,
cols)`");
}
if (typeof rows !== "number" || !isFinite(rows)) {
throw new TypeError("Invalid value for `rows`. Make sure you are passing
finite numbers to `new Grid(rows, cols)`.");
}
if (typeof cols !== "number" || !isFinite(cols)) {
throw new TypeError("Invalid value for `cols`. Make sure you are passing
finite numbers to `new Grid(rows, cols)`.");
}
rows = Math.max(0, rows);
cols = Math.max(0, cols);
this.grid = new Array(rows);
for (let i = 0; i < rows; i++) {
this.grid[i] = new Array(cols);
}
}
initFromArray(arr) {
if (arguments.length !== 1) {
throw new Error("You should pass exactly 1 argument to `initFromArray`");
}