From 8950f3a46e5bf1a8d5bcef42ef7c20ade9f3b98d Mon Sep 17 00:00:00 2001 From: Nigel Megitt Date: Fri, 17 Sep 2021 11:32:56 +0100 Subject: [PATCH] Update dependencies and fix audit vulns --- dist/bin/js/bundle.js | 12 +- package-lock.json | 6662 +++++++++-------------------------------- package.json | 20 +- 3 files changed, 1469 insertions(+), 5225 deletions(-) diff --git a/dist/bin/js/bundle.js b/dist/bin/js/bundle.js index e1326b1..f0e0ebd 100644 --- a/dist/bin/js/bundle.js +++ b/dist/bin/js/bundle.js @@ -26,7 +26,7 @@ return /******/ (() => { // webpackBootstrap /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.default = void 0;\n\nvar _AudioNub2 = _interopRequireDefault(__webpack_require__(/*! ./AudioNub.es6 */ \"./src/AudioNub.es6\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _get(target, property, receiver) { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }\n\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n// import Logger from \"./Logger.es6\";\nvar Logger = __webpack_require__(/*! ./Logger.es6 */ \"./src/Logger.es6\").Logger; // import TextPresenter from \"./TextPresenter.es6\";\n\n\nvar TextPresenter = __webpack_require__(/*! ./TextPresenter.es6 */ \"./src/TextPresenter.es6\").TextPresenter;\n\nvar defaultOutput = null;\n\nvar AdLeafNode = /*#__PURE__*/function (_AudioNub) {\n _inherits(AdLeafNode, _AudioNub);\n\n var _super = _createSuper(AdLeafNode);\n\n function AdLeafNode(parent, node, audioContext) {\n var _this;\n\n _classCallCheck(this, AdLeafNode);\n\n _this = _super.call(this, parent, node, audioContext);\n\n if (!_this._name) {\n _this._name = \"span (anonymous)\";\n }\n\n return _this;\n }\n\n _createClass(AdLeafNode, [{\n key: \"makeDefaultOutput\",\n value: function makeDefaultOutput() {\n if (defaultOutput) {\n defaultOutput.onInactive();\n }\n\n this.onActive();\n defaultOutput = this;\n }\n }, {\n key: \"onActive\",\n value: function onActive() {\n if (!this.isActive) {\n this.output.connect(this.audioContext.destination);\n\n if (defaultOutput && defaultOutput !== this) {\n defaultOutput.onInactive();\n }\n\n Logger.log(\"Active leaf: \".concat(this.pathString));\n }\n\n _get(_getPrototypeOf(AdLeafNode.prototype), \"onActive\", this).call(this);\n\n if (this.value) {\n this.tpKey = TextPresenter.present(this.value, this.pathString);\n }\n }\n }, {\n key: \"onInactive\",\n value: function onInactive() {\n if (this.isActive) {\n if (this.tpKey) {\n TextPresenter.unPresent(this.tpKey);\n }\n\n this.output.disconnect(this.audioContext.destination);\n\n if (defaultOutput && defaultOutput !== this) {\n defaultOutput.onActive();\n }\n\n Logger.log(\"Inactive leaf: \".concat(this.pathString));\n }\n\n _get(_getPrototypeOf(AdLeafNode.prototype), \"onInactive\", this).call(this);\n }\n }]);\n\n return AdLeafNode;\n}(_AudioNub2[\"default\"]);\n\nexports.default = AdLeafNode;\n\n//# sourceURL=webpack://adhere-lib/./src/AdLeafNode.es6?"); +eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.default = void 0;\n\nvar _AudioNub2 = _interopRequireDefault(__webpack_require__(/*! ./AudioNub.es6 */ \"./src/AudioNub.es6\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _get(target, property, receiver) { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }\n\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n// import Logger from \"./Logger.es6\";\nvar Logger = __webpack_require__(/*! ./Logger.es6 */ \"./src/Logger.es6\").Logger; // import TextPresenter from \"./TextPresenter.es6\";\n\n\nvar TextPresenter = __webpack_require__(/*! ./TextPresenter.es6 */ \"./src/TextPresenter.es6\").TextPresenter;\n\nvar defaultOutput = null;\n\nvar AdLeafNode = /*#__PURE__*/function (_AudioNub) {\n _inherits(AdLeafNode, _AudioNub);\n\n var _super = _createSuper(AdLeafNode);\n\n function AdLeafNode(parent, node, audioContext) {\n var _this;\n\n _classCallCheck(this, AdLeafNode);\n\n _this = _super.call(this, parent, node, audioContext);\n\n if (!_this._name) {\n _this._name = \"span (anonymous)\";\n }\n\n return _this;\n }\n\n _createClass(AdLeafNode, [{\n key: \"makeDefaultOutput\",\n value: function makeDefaultOutput() {\n if (defaultOutput) {\n defaultOutput.onInactive();\n }\n\n this.onActive();\n defaultOutput = this;\n }\n }, {\n key: \"onActive\",\n value: function onActive() {\n if (!this.isActive) {\n this.output.connect(this.audioContext.destination);\n\n if (defaultOutput && defaultOutput !== this) {\n defaultOutput.onInactive();\n }\n\n Logger.log(\"Active leaf: \".concat(this.pathString));\n }\n\n _get(_getPrototypeOf(AdLeafNode.prototype), \"onActive\", this).call(this);\n\n if (this.value) {\n this.tpKey = TextPresenter.present(this.value, this.pathString);\n }\n }\n }, {\n key: \"onInactive\",\n value: function onInactive() {\n if (this.isActive) {\n if (this.tpKey) {\n TextPresenter.unPresent(this.tpKey);\n }\n\n this.output.disconnect(this.audioContext.destination);\n\n if (defaultOutput && defaultOutput !== this) {\n defaultOutput.onActive();\n }\n\n Logger.log(\"Inactive leaf: \".concat(this.pathString));\n }\n\n _get(_getPrototypeOf(AdLeafNode.prototype), \"onInactive\", this).call(this);\n }\n }]);\n\n return AdLeafNode;\n}(_AudioNub2[\"default\"]);\n\nexports.default = AdLeafNode;\n\n//# sourceURL=webpack://adhere-lib/./src/AdLeafNode.es6?"); /***/ }), @@ -48,7 +48,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n})); /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.default = void 0;\n\nvar _AudioNub2 = _interopRequireDefault(__webpack_require__(/*! ./AudioNub.es6 */ \"./src/AudioNub.es6\"));\n\nvar _TimingCalculator = _interopRequireDefault(__webpack_require__(/*! ./TimingCalculator.es6 */ \"./src/TimingCalculator.es6\"));\n\nvar _PlaybackProperties = _interopRequireDefault(__webpack_require__(/*! ./PlaybackProperties.es6 */ \"./src/PlaybackProperties.es6\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _get(target, property, receiver) { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }\n\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n// import Logger from \"./Logger.es6\";\nvar Logger = __webpack_require__(/*! ./Logger.es6 */ \"./src/Logger.es6\").Logger;\n\nvar readyStateMap = {\n 0: \"HAVE_NOTHING\",\n 1: \"HAVE_METADATA\",\n 2: \"HAVE_CURRENT_DATA\",\n 3: \"HAVE_FUTURE_DATA\",\n 4: \"HAVE_ENOUGH_DATA\"\n}; // This guy is a little weird - It's the input to it's parent; i.e. in the graph\n// it is the parent, but in the tree (and xml), it's a child.\n// Don't use it for user controlled sources like video elements:\n// instead user AdUserControlledSourceNode for them.\n\nvar AdSourceNode = /*#__PURE__*/function (_AudioNub) {\n _inherits(AdSourceNode, _AudioNub);\n\n var _super = _createSuper(AdSourceNode);\n\n function AdSourceNode(parent, xmlNode, audioContext, mediaPair) {\n var _this;\n\n _classCallCheck(this, AdSourceNode);\n\n _this = _super.call(this, parent, xmlNode, audioContext);\n _this.mediaPair = mediaPair;\n _this.media = mediaPair.media;\n _this.mediaNode = mediaPair.mediaNode;\n\n if (xmlNode.attributes.clipBegin) {\n _this.clipBegin = _TimingCalculator[\"default\"].parseSeconds(xmlNode.attributes.clipBegin) || 0;\n } else {\n _this.clipBegin = 0;\n }\n\n if (xmlNode.attributes.clipEnd) {\n _this.clipEnd = _TimingCalculator[\"default\"].parseSeconds(xmlNode.attributes.clipEnd) || NaN;\n }\n\n return _this;\n }\n\n _createClass(AdSourceNode, [{\n key: \"mediaReadyState\",\n value: function mediaReadyState(m) {\n var readyState = m.readyState;\n return readyStateMap[readyState];\n }\n }, {\n key: \"addDebugEventHandlers\",\n value: function addDebugEventHandlers() {\n var _this2 = this;\n\n var m = this.mediaPair.media;\n\n if (m) {\n m.addEventListener(\"abort\", function () {\n Logger.log(\"Audio source aborted loading. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n m.addEventListener(\"error\", function () {\n Logger.log(\"Audio source error. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n m.addEventListener(\"loadeddata\", function () {\n Logger.log(\"Audio source loaded data. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n m.addEventListener(\"loadstart\", function () {\n Logger.log(\"Audio source loadstart. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n m.addEventListener(\"playing\", function () {\n Logger.log(\"Audio source is playing. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n m.addEventListener(\"progress\", function () {\n Logger.log(\"Audio source making progress. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n m.addEventListener(\"waiting\", function () {\n Logger.log(\"Audio source is waiting for more data. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n }\n }\n }, {\n key: \"end\",\n get: function get() {\n var ret;\n\n var normalEnd = _get(_getPrototypeOf(AdSourceNode.prototype), \"end\", this);\n\n if (this.clipEnd) {\n //The duration of the clip added to the start time, or the span end, whichever comes first.\n ret = Math.min(normalEnd, this.begin + (this.clipEnd - this.clipBegin));\n } else {\n ret = normalEnd;\n } // Logger.log(`AdSourceNode end() super said ${normalEnd} but I'm saying ${ret}`); // DEBUG\n\n\n return ret;\n }\n }, {\n key: \"onActive\",\n value: function onActive() {\n var _this3 = this;\n\n if (this.mediaPair && !this.isActive) {\n Logger.log(\"Active AdSourceNode: \".concat(this.pathString));\n var offset = this.videoMedia.currentTime - this.begin;\n this.media.currentTime = this.clipBegin ? this.clipBegin + offset : offset;\n this.input = this.mediaNode;\n this.gainNode.gain.value = this.gain * _PlaybackProperties[\"default\"].getCurrentGain();\n this.input.connect(this.gainNode);\n Logger.log(\"Connected to media element source with src= \".concat(this.input.mediaElement.currentSrc));\n this.media.play()[\"catch\"](function (e) {\n Logger.log(\"AdSourceNode play rejected with error: \".concat(e, \".\"));\n });\n this.output.connect(this.parent.gainNode); //TODO Make formal with .input\n\n Logger.log(\"Active source into: \".concat(this.parent.name, \"; src: \").concat(this.media.src, \"; from: \").concat(this.media.currentTime, \" including offset of \").concat(offset, \".\"));\n this.startTime = this.media.currentTime;\n this.isActive = true;\n this.gainId = _PlaybackProperties[\"default\"].registerCallback(function (uiGain) {\n //const oldVal = this.gainNode.gain.value;\n //console.info(\"Base gain\", this.gain, \"UI gain\", uiGain);\n _this3.gainNode.gain.value = _this3.gain * uiGain; //console.info(\"Final gain changes from\", oldVal, \"to\", this.gainNode.gain.value);\n });\n }\n }\n }, {\n key: \"onInactive\",\n value: function onInactive() {\n if (this.media && this.isActive) {\n Logger.log(\"Inactive AdSourceNode: \".concat(this.pathString));\n this.media.pause();\n this.input.disconnect(this.gainNode);\n this.input = null;\n this.output.disconnect(this.parent.gainNode);\n Logger.log(\"Inactive source into: \".concat(this.parent.name, \"; src: \").concat(this.media.src));\n this.endTime = this.media.currentTime; // DEBUG: clipBegin/clipEnd\n\n Logger.log( // eslint-disable-next-line max-len\n \"ran source for: \".concat(this.endTime - this.startTime, \" clipBegin: \").concat(this.startTime, \" clipEnd: \").concat(this.endTime));\n this.isActive = false;\n\n _PlaybackProperties[\"default\"].deregisterCallback(this.gainId);\n }\n }\n }, {\n key: \"onPause\",\n value: function onPause() {\n if (this.media && this.isActive) {\n this.media.pause();\n }\n }\n }, {\n key: \"onRestart\",\n value: function onRestart() {\n if (this.media && this.isActive) {\n this.media.play();\n }\n }\n }, {\n key: \"onFinalise\",\n value: function onFinalise() {\n if (this.media) {\n _get(_getPrototypeOf(AdSourceNode.prototype), \"onFinalise\", this).call(this);\n\n var src = this.media.src;\n\n if ((src + \"\").indexOf(\"blob://\") > 0) {\n Logger.log(\"Clear audio src \" + this.media.src);\n this.media.src = \"\";\n URL.revokeObjectURL(src);\n }\n\n if (this.input) {\n this.input.disconnect(this.gainNode);\n }\n }\n }\n }]);\n\n return AdSourceNode;\n}(_AudioNub2[\"default\"]);\n\nexports.default = AdSourceNode;\n\n//# sourceURL=webpack://adhere-lib/./src/AdSourceNode.es6?"); +eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.default = void 0;\n\nvar _AudioNub2 = _interopRequireDefault(__webpack_require__(/*! ./AudioNub.es6 */ \"./src/AudioNub.es6\"));\n\nvar _TimingCalculator = _interopRequireDefault(__webpack_require__(/*! ./TimingCalculator.es6 */ \"./src/TimingCalculator.es6\"));\n\nvar _PlaybackProperties = _interopRequireDefault(__webpack_require__(/*! ./PlaybackProperties.es6 */ \"./src/PlaybackProperties.es6\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _get(target, property, receiver) { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }\n\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n// import Logger from \"./Logger.es6\";\nvar Logger = __webpack_require__(/*! ./Logger.es6 */ \"./src/Logger.es6\").Logger;\n\nvar readyStateMap = {\n 0: \"HAVE_NOTHING\",\n 1: \"HAVE_METADATA\",\n 2: \"HAVE_CURRENT_DATA\",\n 3: \"HAVE_FUTURE_DATA\",\n 4: \"HAVE_ENOUGH_DATA\"\n}; // This guy is a little weird - It's the input to it's parent; i.e. in the graph\n// it is the parent, but in the tree (and xml), it's a child.\n// Don't use it for user controlled sources like video elements:\n// instead user AdUserControlledSourceNode for them.\n\nvar AdSourceNode = /*#__PURE__*/function (_AudioNub) {\n _inherits(AdSourceNode, _AudioNub);\n\n var _super = _createSuper(AdSourceNode);\n\n function AdSourceNode(parent, xmlNode, audioContext, mediaPair) {\n var _this;\n\n _classCallCheck(this, AdSourceNode);\n\n _this = _super.call(this, parent, xmlNode, audioContext);\n _this.mediaPair = mediaPair;\n _this.media = mediaPair.media;\n _this.mediaNode = mediaPair.mediaNode;\n\n if (xmlNode.attributes.clipBegin) {\n _this.clipBegin = _TimingCalculator[\"default\"].parseSeconds(xmlNode.attributes.clipBegin) || 0;\n } else {\n _this.clipBegin = 0;\n }\n\n if (xmlNode.attributes.clipEnd) {\n _this.clipEnd = _TimingCalculator[\"default\"].parseSeconds(xmlNode.attributes.clipEnd) || NaN;\n }\n\n return _this;\n }\n\n _createClass(AdSourceNode, [{\n key: \"mediaReadyState\",\n value: function mediaReadyState(m) {\n var readyState = m.readyState;\n return readyStateMap[readyState];\n }\n }, {\n key: \"addDebugEventHandlers\",\n value: function addDebugEventHandlers() {\n var _this2 = this;\n\n var m = this.mediaPair.media;\n\n if (m) {\n m.addEventListener(\"abort\", function () {\n Logger.log(\"Audio source aborted loading. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n m.addEventListener(\"error\", function () {\n Logger.log(\"Audio source error. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n m.addEventListener(\"loadeddata\", function () {\n Logger.log(\"Audio source loaded data. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n m.addEventListener(\"loadstart\", function () {\n Logger.log(\"Audio source loadstart. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n m.addEventListener(\"playing\", function () {\n Logger.log(\"Audio source is playing. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n m.addEventListener(\"progress\", function () {\n Logger.log(\"Audio source making progress. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n m.addEventListener(\"waiting\", function () {\n Logger.log(\"Audio source is waiting for more data. readyState = \".concat(_this2.mediaReadyState(m)));\n });\n }\n }\n }, {\n key: \"end\",\n get: function get() {\n var ret;\n\n var normalEnd = _get(_getPrototypeOf(AdSourceNode.prototype), \"end\", this);\n\n if (this.clipEnd) {\n //The duration of the clip added to the start time, or the span end, whichever comes first.\n ret = Math.min(normalEnd, this.begin + (this.clipEnd - this.clipBegin));\n } else {\n ret = normalEnd;\n } // Logger.log(`AdSourceNode end() super said ${normalEnd} but I'm saying ${ret}`); // DEBUG\n\n\n return ret;\n }\n }, {\n key: \"onActive\",\n value: function onActive() {\n var _this3 = this;\n\n if (this.mediaPair && !this.isActive) {\n Logger.log(\"Active AdSourceNode: \".concat(this.pathString));\n var offset = this.videoMedia.currentTime - this.begin;\n this.media.currentTime = this.clipBegin ? this.clipBegin + offset : offset;\n this.input = this.mediaNode;\n this.gainNode.gain.value = this.gain * _PlaybackProperties[\"default\"].getCurrentGain();\n this.input.connect(this.gainNode);\n Logger.log(\"Connected to media element source with src= \".concat(this.input.mediaElement.currentSrc));\n this.media.play()[\"catch\"](function (e) {\n Logger.log(\"AdSourceNode play rejected with error: \".concat(e, \".\"));\n });\n this.output.connect(this.parent.gainNode); //TODO Make formal with .input\n\n Logger.log(\"Active source into: \".concat(this.parent.name, \"; src: \").concat(this.media.src, \"; from: \").concat(this.media.currentTime, \" including offset of \").concat(offset, \".\"));\n this.startTime = this.media.currentTime;\n this.isActive = true;\n this.gainId = _PlaybackProperties[\"default\"].registerCallback(function (uiGain) {\n //const oldVal = this.gainNode.gain.value;\n //console.info(\"Base gain\", this.gain, \"UI gain\", uiGain);\n _this3.gainNode.gain.value = _this3.gain * uiGain; //console.info(\"Final gain changes from\", oldVal, \"to\", this.gainNode.gain.value);\n });\n }\n }\n }, {\n key: \"onInactive\",\n value: function onInactive() {\n if (this.media && this.isActive) {\n Logger.log(\"Inactive AdSourceNode: \".concat(this.pathString));\n this.media.pause();\n this.input.disconnect(this.gainNode);\n this.input = null;\n this.output.disconnect(this.parent.gainNode);\n Logger.log(\"Inactive source into: \".concat(this.parent.name, \"; src: \").concat(this.media.src));\n this.endTime = this.media.currentTime; // DEBUG: clipBegin/clipEnd\n\n Logger.log( // eslint-disable-next-line max-len\n \"ran source for: \".concat(this.endTime - this.startTime, \" clipBegin: \").concat(this.startTime, \" clipEnd: \").concat(this.endTime));\n this.isActive = false;\n\n _PlaybackProperties[\"default\"].deregisterCallback(this.gainId);\n }\n }\n }, {\n key: \"onPause\",\n value: function onPause() {\n if (this.media && this.isActive) {\n this.media.pause();\n }\n }\n }, {\n key: \"onRestart\",\n value: function onRestart() {\n if (this.media && this.isActive) {\n this.media.play();\n }\n }\n }, {\n key: \"onFinalise\",\n value: function onFinalise() {\n if (this.media) {\n _get(_getPrototypeOf(AdSourceNode.prototype), \"onFinalise\", this).call(this);\n\n var src = this.media.src;\n\n if ((src + \"\").indexOf(\"blob://\") > 0) {\n Logger.log(\"Clear audio src \" + this.media.src);\n this.media.src = \"\";\n URL.revokeObjectURL(src);\n }\n\n if (this.input) {\n this.input.disconnect(this.gainNode);\n }\n }\n }\n }]);\n\n return AdSourceNode;\n}(_AudioNub2[\"default\"]);\n\nexports.default = AdSourceNode;\n\n//# sourceURL=webpack://adhere-lib/./src/AdSourceNode.es6?"); /***/ }), @@ -59,7 +59,7 @@ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.default = void 0;\n\nvar _AdSourceNode2 = _interopRequireDefault(__webpack_require__(/*! ./AdSourceNode.es6 */ \"./src/AdSourceNode.es6\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n// import Logger from \"./Logger.es6\";\nvar Logger = __webpack_require__(/*! ./Logger.es6 */ \"./src/Logger.es6\").Logger; // This guy is a little weird - It's the input to it's parent; i.e. in the graph\n// it is the parent, but in the tree (and xml), it's a child.\n// This subclass is for user controlled sources like