@amazon/vinyl-util 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browserTestUtil/index.js +1850 -1850
- package/dist/browserTestUtil/index.js.map +4 -4
- package/dist/browserTestUtil/types/current/index.d.ts +17 -17
- package/dist/browserTestUtil/types/current/index.d.ts.map +1 -1
- package/dist/browserTestUtil/types/current/index.js +17 -17
- package/dist/browserTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/browserTestUtil/types/ts3.7/index.d.ts +17 -17
- package/dist/browserTestUtil/types/ts4.1/index.d.ts +17 -17
- package/dist/browserTestUtil/types/ts4.7/index.d.ts +17 -17
- package/dist/index.cjs +4997 -4967
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +4997 -4967
- package/dist/index.js.map +4 -4
- package/dist/polyfill/index.d.ts +1 -0
- package/dist/polyfill/index.d.ts.map +1 -1
- package/dist/polyfill/index.js +166 -103
- package/dist/polyfill/index.js.map +3 -3
- package/dist/polyfill/tsconfig.tsbuildinfo +1 -1
- package/dist/test/benchmark.es5.js +68 -68
- package/dist/test/benchmark.js +1518 -1517
- package/dist/test/benchmark.js.map +4 -4
- package/dist/testUtil/index.js +418 -418
- package/dist/testUtil/index.js.map +4 -4
- package/dist/testUtil/types/current/index.d.ts +16 -16
- package/dist/testUtil/types/current/index.d.ts.map +1 -1
- package/dist/testUtil/types/current/index.js +16 -16
- package/dist/testUtil/types/current/reporters/LogReporter.d.ts +1 -0
- package/dist/testUtil/types/current/reporters/LogReporter.d.ts.map +1 -1
- package/dist/testUtil/types/current/reporters/LogReporter.js +8 -0
- package/dist/testUtil/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/testUtil/types/current/util/event/createEventSpy.d.ts.map +1 -1
- package/dist/testUtil/types/current/util/event/createEventSpy.js +6 -4
- package/dist/testUtil/types/ts3.7/index.d.ts +16 -16
- package/dist/testUtil/types/ts3.7/reporters/LogReporter.d.ts +1 -0
- package/dist/testUtil/types/ts4.1/index.d.ts +16 -16
- package/dist/testUtil/types/ts4.1/reporters/LogReporter.d.ts +1 -0
- package/dist/testUtil/types/ts4.7/index.d.ts +16 -16
- package/dist/testUtil/types/ts4.7/reporters/LogReporter.d.ts +1 -0
- package/dist/types/current/event/nextEventAsPromise.d.ts +14 -4
- package/dist/types/current/event/nextEventAsPromise.d.ts.map +1 -1
- package/dist/types/current/event/nextEventAsPromise.js +8 -2
- package/dist/types/current/index.d.ts +114 -113
- package/dist/types/current/index.d.ts.map +1 -1
- package/dist/types/current/index.js +114 -113
- package/dist/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/types/current/util/async/poll.d.ts +34 -0
- package/dist/types/current/util/async/poll.d.ts.map +1 -0
- package/dist/types/current/util/async/poll.js +31 -0
- package/dist/types/current/util/async/sleep.d.ts +2 -1
- package/dist/types/current/util/async/sleep.d.ts.map +1 -1
- package/dist/types/current/util/async/timeout.d.ts +32 -10
- package/dist/types/current/util/async/timeout.d.ts.map +1 -1
- package/dist/types/current/util/async/timeout.js +7 -11
- package/dist/types/current/util/map/map.d.ts +1 -2
- package/dist/types/current/util/map/map.d.ts.map +1 -1
- package/dist/types/current/util/url/resolveUrl.d.ts +2 -1
- package/dist/types/current/util/url/resolveUrl.d.ts.map +1 -1
- package/dist/types/current/util/url/resolveUrl.js +9 -3
- package/dist/types/ts3.7/event/nextEventAsPromise.d.ts +14 -4
- package/dist/types/ts3.7/index.d.ts +114 -113
- package/dist/types/ts3.7/util/async/poll.d.ts +34 -0
- package/dist/types/ts3.7/util/async/sleep.d.ts +2 -1
- package/dist/types/ts3.7/util/async/timeout.d.ts +32 -10
- package/dist/types/ts3.7/util/map/map.d.ts +1 -2
- package/dist/types/ts3.7/util/url/resolveUrl.d.ts +2 -1
- package/dist/types/ts4.1/event/nextEventAsPromise.d.ts +14 -4
- package/dist/types/ts4.1/index.d.ts +114 -113
- package/dist/types/ts4.1/util/async/poll.d.ts +34 -0
- package/dist/types/ts4.1/util/async/sleep.d.ts +2 -1
- package/dist/types/ts4.1/util/async/timeout.d.ts +32 -10
- package/dist/types/ts4.1/util/map/map.d.ts +1 -2
- package/dist/types/ts4.1/util/url/resolveUrl.d.ts +2 -1
- package/dist/types/ts4.7/event/nextEventAsPromise.d.ts +14 -4
- package/dist/types/ts4.7/index.d.ts +114 -113
- package/dist/types/ts4.7/util/async/poll.d.ts +34 -0
- package/dist/types/ts4.7/util/async/sleep.d.ts +2 -1
- package/dist/types/ts4.7/util/async/timeout.d.ts +32 -10
- package/dist/types/ts4.7/util/map/map.d.ts +1 -2
- package/dist/types/ts4.7/util/url/resolveUrl.d.ts +2 -1
- package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
|
@@ -1,32 +1,4 @@
|
|
|
1
|
-
"use strict";function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function _wrapNativeSuper(t){var r="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,Wrapper)}function Wrapper(){return _construct(t,arguments,_getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,t)},_wrapNativeSuper(t)}function _construct(t,e,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var p=new(t.bind.apply(t,o));return r&&_setPrototypeOf(p,r.prototype),p}function _isNativeFunction(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(n){return"function"==typeof t}}function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(c.prototype);return _regeneratorDefine2(u,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function d(t,r){return i=t,c=0,u=e,G.n=r,a}};function d(r,n){for(c=r,u=n,t=0;!y&&f&&!o&&t<p.length;t++){var o,i=p[t],d=G.p,l=i[2];r>3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,G.v=n,G.n=i[1]):d<l&&(o=r<3||i[0]>n||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0))}if(o||r>1)return a;throw y=!0,n}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i["return"])&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break}catch(t){i=e,c=1,u=t}finally{f=1}}return{value:t,done:y}}}(r,o,i),!0),u}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(u,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,o,"GeneratorFunction"),_regeneratorDefine2(u),_regeneratorDefine2(u,o,"Generator"),_regeneratorDefine2(u,n,function(){return this}),_regeneratorDefine2(u,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:f}})()}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}_regeneratorDefine2=function _regeneratorDefine(e,r,n,t){function o(r,n){_regeneratorDefine2(e,r,function(e){return this._invoke(r,n,e)})}r?i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(e,r,n,t)}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}_next(void 0)})}}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e))}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t})()}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]}},e:function e(r){throw r},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function s(){t=t.call(r)},n:function n(){var r=t.next();return a=r.done,r},e:function e(r){u=!0,o=r},f:function f(){try{a||null==t["return"]||t["return"]()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}(function(){var __defProp=Object.defineProperty;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty;var __propIsEnum=Object.prototype.propertyIsEnumerable;var __defNormalProp=function __defNormalProp(obj,key,value){return key in obj?__defProp(obj,key,{enumerable:true,configurable:true,writable:true,value:value}):obj[key]=value};var __spreadValues=function __spreadValues(a,b){for(var prop in b||(b={}))if(__hasOwnProp.call(b,prop))__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols){var _iterator=_createForOfIteratorHelper(__getOwnPropSymbols(b)),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var prop=_step.value;if(__propIsEnum.call(b,prop))__defNormalProp(a,prop,b[prop])}}catch(err){_iterator.e(err)}finally{_iterator.f()}}return a};var __objRest=function __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){var _iterator2=_createForOfIteratorHelper(__getOwnPropSymbols(source)),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var prop=_step2.value;if(exclude.indexOf(prop)<0&&__propIsEnum.call(source,prop))target[prop]=source[prop]}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}}return target};var __publicField=function __publicField(obj,key,value){return __defNormalProp(obj,_typeof(key)!=="symbol"?key+"":key,value)};// test/browserTestUtil/mock/createSpyFactory.ts
|
|
2
|
-
var createSpy=jasmine.createSpy;function createSpy2(key){return createSpy(String(key))}// test/browserTestUtil/mock/dom/lib.dom.ts
|
|
3
|
-
var MockAbortSignal=/*#__PURE__*/_createClass(function MockAbortSignal(){_classCallCheck(this,MockAbortSignal);__publicField(this,"aborted",false);__publicField(this,"onabort",null);__publicField(this,"reason");__publicField(this,"throwIfAborted",createSpy2("throwIfAborted"));__publicField(this,"addEventListener",createSpy2("addEventListener"));__publicField(this,"removeEventListener",createSpy2("removeEventListener"));__publicField(this,"dispatchEvent",createSpy2("dispatchEvent"))});var MockMediaSource=/*#__PURE__*/_createClass(function MockMediaSource(){_classCallCheck(this,MockMediaSource);__publicField(this,"activeSourceBuffers");__publicField(this,"duration",0);__publicField(this,"onsourceclose",null);__publicField(this,"onsourceended",null);__publicField(this,"onsourceopen",null);__publicField(this,"readyState","closed");__publicField(this,"sourceBuffers");__publicField(this,"addSourceBuffer",createSpy2("addSourceBuffer"));__publicField(this,"clearLiveSeekableRange",createSpy2("clearLiveSeekableRange"));__publicField(this,"endOfStream",createSpy2("endOfStream"));__publicField(this,"removeSourceBuffer",createSpy2("removeSourceBuffer"));__publicField(this,"setLiveSeekableRange",createSpy2("setLiveSeekableRange"));__publicField(this,"addEventListener",createSpy2("addEventListener"));__publicField(this,"removeEventListener",createSpy2("removeEventListener"));__publicField(this,"dispatchEvent",createSpy2("dispatchEvent"))});// test/browserTestUtil/mock/dom/globals.ts
|
|
4
|
-
var MockMediaSourceGlobal=/*#__PURE__*/function(_MockMediaSource){function MockMediaSourceGlobal(){_classCallCheck(this,MockMediaSourceGlobal);return _callSuper(this,MockMediaSourceGlobal,arguments)}_inherits(MockMediaSourceGlobal,_MockMediaSource);return _createClass(MockMediaSourceGlobal)}(MockMediaSource);__publicField(MockMediaSourceGlobal,"canConstructInDedicatedWorker",false);__publicField(MockMediaSourceGlobal,"isTypeSupported",createSpy2("isTypeSupported"));var MockAbortSignalGlobal=/*#__PURE__*/function(_MockAbortSignal){function MockAbortSignalGlobal(){_classCallCheck(this,MockAbortSignalGlobal);return _callSuper(this,MockAbortSignalGlobal,arguments)}_inherits(MockAbortSignalGlobal,_MockAbortSignal);return _createClass(MockAbortSignalGlobal)}(MockAbortSignal);__publicField(MockAbortSignalGlobal,"abort",createSpy2("abort"));__publicField(MockAbortSignalGlobal,"any",createSpy2("any"));__publicField(MockAbortSignalGlobal,"timeout",createSpy2("timeout"));// test/browserTestUtil/expect/expectNothing.ts
|
|
5
|
-
function expectNothing(){expect(true).toBeTruthy()}// test/browserTestUtil/env/jasmineEnv.ts
|
|
6
|
-
var nextTestTimeoutOverridden=false;function setTestTimeout(timeout){var originalTimeout=null;beforeEach(function(){originalTimeout=jasmine.DEFAULT_TIMEOUT_INTERVAL;if(!nextTestTimeoutOverridden)jasmine.DEFAULT_TIMEOUT_INTERVAL=timeout*1e3});afterEach(function(){if(originalTimeout)jasmine.DEFAULT_TIMEOUT_INTERVAL=originalTimeout;if(nextTestTimeoutOverridden)nextTestTimeoutOverridden=false})}// test/browserTestUtil/benchmark/Benchmark.ts
|
|
7
|
-
var now;if(typeof window!=="undefined"&&typeof window.performance!=="undefined"&&typeof window.performance.now!=="undefined"){now=function now(){return window.performance.now()}}else if(typeof self!=="undefined"&&typeof self.performance!=="undefined"&&typeof self.performance.now!=="undefined"){now=function now(){return self.performance.now()}}else{now=function now(){return Date.now()}}var BenchmarkRunResults=/*#__PURE__*/function(){function BenchmarkRunResults(name){_classCallCheck(this,BenchmarkRunResults);__publicField(this,"name",name);__publicField(this,"cycleResults",[]);__publicField(this,"_totalSamples",0)}return _createClass(BenchmarkRunResults,[{key:"totalSamples",get:function get(){return this._totalSamples}},{key:"cycleResultsNoOutliers",get:function get(){var sD=this.standardDeviation;var avg=average(this.cycleResults);return this.cycleResults.filter(function(e){var zScore=(avg-e)/sD;return Math.abs(zScore)<3})}/**
|
|
8
|
-
* Returns the mean ops per second minus outliers of greater than 3 standard deviations.
|
|
9
|
-
*/},{key:"meanOpsPerSec",get:function get(){return average(this.cycleResultsNoOutliers)}},{key:"standardDeviation",get:function get(){return standardDeviation(this.cycleResults)}},{key:"variance",get:function get(){return this.standardDeviation/this.meanOpsPerSec}/**
|
|
10
|
-
* Returns the mean ops / s ± variance % as a string.
|
|
11
|
-
*/},{key:"meanOpsStr",get:function get(){var mean=this.meanOpsPerSec.toLocaleString(void 0,{maximumSignificantDigits:4});var variance=this.variance.toLocaleString(void 0,{style:"percent"});return"".concat(mean," \xB1").concat(variance)}},{key:"add",value:function add(cycle){var opsPerSecond=cycle.ops/cycle.duration;var index=this.cycleResults.findIndex(function(value){return opsPerSecond<value});if(index<0)index=this.cycleResults.length;this.cycleResults.splice(index,0,opsPerSecond);this._totalSamples+=cycle.ops}},{key:"toString",value:function toString(){if(!this.cycleResults.length)return"No results";return"".concat(this.name,": ").concat(this.meanOpsStr," ops/sec")}}])}();var RunResultsComparison=/*#__PURE__*/function(){function RunResultsComparison(name,results){_classCallCheck(this,RunResultsComparison);__publicField(this,"name",name);/**
|
|
12
|
-
* Sorted by median ops/s from slowest to fastest.
|
|
13
|
-
*/__publicField(this,"results");this.results=results.sort(function(a,b){return a.meanOpsPerSec-b.meanOpsPerSec})}return _createClass(RunResultsComparison,[{key:"logToTable",value:function logToTable(){var _this=this;var r=this.results.map(function(run){var variance=run.variance.toLocaleString(void 0,{style:"percent"});var mean=run.meanOpsPerSec.toLocaleString(void 0,{maximumSignificantDigits:4});return{Name:run.name,Mean:"".concat(mean," \xB1").concat(variance),Samples:run.totalSamples,Compare:_this.runComparisonToString(run)}});var table=r.reduce(function(acc,_a){var _b=_a,Name=_b.Name,x=__objRest(_b,["Name"]);acc[Name]=x;return acc},{});console.log("\n"+this.name);console.table(table)}},{key:"runComparisonToString",value:function runComparisonToString(run){var _a,_b;var baseline=(_b=(_a=this.results[0])==null?void 0:_a.meanOpsPerSec)!=null?_b:0;var fasterPercent=run.meanOpsPerSec/baseline-1;return fasterPercent<0.01?"-":fasterPercent.toLocaleString(void 0,{style:"percent"})+" faster"}}])}();function compareResults(name){for(var _len=arguments.length,results=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){results[_key-1]=arguments[_key]}return new RunResultsComparison(name,results)}var defaultBenchmarkOptions={warmupTime:0.5,maxCycleDuration:0.5,cycles:9};var _Benchmark=/*#__PURE__*/function(){/**
|
|
14
|
-
* Constructs a new Benchmark.
|
|
15
|
-
*
|
|
16
|
-
* @param name The name of the benchmark, to be used when logging.
|
|
17
|
-
* @param executor The method to execute and measure. If this method returns a promise, the
|
|
18
|
-
* promise will be awaited. The executor should either always return a promise, or never.
|
|
19
|
-
* @param options Optional configuration for the benchmark.
|
|
20
|
-
*/function _Benchmark(name,executor,options){_classCallCheck(this,_Benchmark);__publicField(this,"name",name);__publicField(this,"executor",executor);__publicField(this,"options");this.options=__spreadValues(__spreadValues({},defaultBenchmarkOptions),options)}return _createClass(_Benchmark,[{key:"run",value:function(){var _run=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(){var _this2=this;var opts,warmupTimeMs,cycleStart,isAsync,result,resultsPromise;return _regenerator().w(function(_context2){while(1)switch(_context2.n){case 0:opts=this.options;_context2.n=1;return _Benchmark.semaphore;case 1:warmupTimeMs=opts.warmupTime*1e3;cycleStart=now();isAsync=false;case 2:result=this.executor();isAsync=isAsync||result&&typeof result.then==="function";if(!isAsync){_context2.n=3;break}_context2.n=3;return result;case 3:if(now()-cycleStart<warmupTimeMs){_context2.n=2;break}case 4:resultsPromise=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(){var results,i,cycleResults;return _regenerator().w(function(_context){while(1)switch(_context.n){case 0:results=new BenchmarkRunResults(_this2.name);i=0;case 1:if(!(i<opts.cycles)){_context.n=4;break}_context.n=2;return _this2.runCycle(isAsync);case 2:cycleResults=_context.v;results.add(cycleResults);_context.n=3;return nextFrame();case 3:i++;_context.n=1;break;case 4:return _context.a(2,results)}},_callee)}))();_Benchmark.semaphore=resultsPromise;_context2.n=5;return resultsPromise;case 5:return _context2.a(2,_context2.v)}},_callee2,this)}));function run(){return _run.apply(this,arguments)}return run}()/**
|
|
21
|
-
* Runs one cycle. A cycle will repeat the executor approximately `options.maxCycleDuration`
|
|
22
|
-
* seconds.
|
|
23
|
-
*
|
|
24
|
-
* @param isAsync
|
|
25
|
-
* @return Returns the duration (in seconds) and number of operations the cycle repeated.
|
|
26
|
-
*/},{key:"runCycle",value:(function(){var _runCycle=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(isAsync){var cycleMs,ops,cycleStart,result,duration;return _regenerator().w(function(_context3){while(1)switch(_context3.n){case 0:cycleMs=this.options.maxCycleDuration*1e3;ops=0;cycleStart=now();case 1:result=this.executor();if(!isAsync){_context3.n=2;break}_context3.n=2;return result;case 2:ops++;case 3:if(now()-cycleStart<cycleMs){_context3.n=1;break}case 4:duration=(now()-cycleStart)/1e3;return _context3.a(2,{duration:duration,ops:ops})}},_callee3,this)}));function runCycle(_x){return _runCycle.apply(this,arguments)}return runCycle}())}])}();__publicField(_Benchmark,"semaphore",nextFrame());var Benchmark=_Benchmark;function benchmark(name,executor,options){var benchmark2=new Benchmark(name,executor,options);return benchmark2.run().then(function(results){console.log(results.toString());return results})}function nextFrame(){return new Promise(function(resolve){setTimeout(resolve)})}function standardDeviation(values){var avg=average(values);var squareDiffs=values.map(function(value){var diff=value-avg;return diff*diff});var avgSquareDiff=average(squareDiffs);return Math.sqrt(avgSquareDiff)}function average(values){var sum=values.reduce(function(acc,value){return acc+value},0);return sum/values.length}// test/benchmark/setup.ts
|
|
27
|
-
function setupBenchmark(){setTestTimeout(180);afterEach(expectNothing)}var comparisons=[];function addComparison(comparison){comparisons.push(comparison)}function addBenchmarks(name){for(var _len2=arguments.length,results=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){results[_key2-1]=arguments[_key2]}var comparison=compareResults.apply(void 0,[name].concat(results));comparison.logToTable();comparisons.push(comparison)}if(typeof document!=="undefined"){jasmine.getEnv().addReporter({jasmineDone:function jasmineDone(){var _a;console.log("Tests complete");var jasmineContainer=document.getElementsByClassName("jasmine_html-reporter")[0];(_a=jasmineContainer.parentElement)==null?void 0:_a.removeChild(jasmineContainer);var container=createEl("div",document.body);container.id="benchmarkResults";var sortedComparisons=[].concat(comparisons).sort(function(a,b){return a.name>b.name?1:-1});var _iterator3=_createForOfIteratorHelper(sortedComparisons),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var comparison=_step3.value;toTableHtml(comparison,container)}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}}})}function toTableHtml(comparison,parent){var container=createEl("div",parent);container.className="benchmarkComparison";var title=createEl("h2",container);title.innerText=comparison.name;var table=createEl("table",container);var head=createEl("thead",table);var headRow=createEl("tr",head);var name=createEl("th",headRow);name.innerText="Name";var median=createEl("th",headRow);median.innerText="Mean ops/s";var samples=createEl("th",headRow);samples.innerText="Samples";var compare=createEl("th",headRow);compare.innerText="% Comparison";var body=createEl("tbody",table);comparison.results.forEach(function(result){var row=createEl("tr",body);createEl("th",row).innerText=result.name;createEl("td",row).innerText=result.meanOpsStr;createEl("td",row).innerText=result.totalSamples.toLocaleString();createEl("td",row).innerText=comparison.runComparisonToString(result)});return container}function createEl(tagName,parent,options){var element=document.createElement(tagName,options);if(parent)parent.appendChild(element);return element}// src/util/type.ts
|
|
28
|
-
function covariant(){return void 0}// src/util/url/resolveUrl.ts
|
|
29
|
-
function resolveUrl(relative,base){if(relative.indexOf("://")>0)return relative;if(relative.startsWith("//")){var schemeEnd2=base.indexOf("://");return base.substring(0,schemeEnd2+1)+relative}var schemeEnd=base.indexOf("://")+3;var pathStart=base.indexOf("/",schemeEnd);var origin=pathStart===-1?base:base.substring(0,pathStart);if(relative.startsWith("/"))return origin+relative;if(relative==="")return base;var basePath=pathStart===-1?"/":base.substring(pathStart);var lastSlash=basePath.lastIndexOf("/");var dir=basePath.substring(0,lastSlash+1);return origin+resolveDots(dir+relative)}function resolveDots(path){if(path.indexOf(".")===-1)return path;var parts=path.split("/");var out=[];for(var i=0;i<parts.length;i++){var p=parts[i];if(p===".."){if(out.length>1)out.pop()}else if(p!=="."){out.push(p)}}return out.join("/")}// src/error/ErrorOrigin.ts
|
|
1
|
+
"use strict";function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(c.prototype);return _regeneratorDefine2(u,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function d(t,r){return i=t,c=0,u=e,G.n=r,a}};function d(r,n){for(c=r,u=n,t=0;!y&&f&&!o&&t<p.length;t++){var o,i=p[t],d=G.p,l=i[2];r>3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,G.v=n,G.n=i[1]):d<l&&(o=r<3||i[0]>n||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0))}if(o||r>1)return a;throw y=!0,n}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i["return"])&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break}catch(t){i=e,c=1,u=t}finally{f=1}}return{value:t,done:y}}}(r,o,i),!0),u}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(u,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,o,"GeneratorFunction"),_regeneratorDefine2(u),_regeneratorDefine2(u,o,"Generator"),_regeneratorDefine2(u,n,function(){return this}),_regeneratorDefine2(u,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:f}})()}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}_regeneratorDefine2=function _regeneratorDefine(e,r,n,t){function o(r,n){_regeneratorDefine2(e,r,function(e){return this._invoke(r,n,e)})}r?i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(e,r,n,t)}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}_next(void 0)})}}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e))}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e)}function _wrapNativeSuper(t){var r="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,Wrapper)}function Wrapper(){return _construct(t,arguments,_getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,t)},_wrapNativeSuper(t)}function _construct(t,e,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var p=new(t.bind.apply(t,o));return r&&_setPrototypeOf(p,r.prototype),p}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t})()}function _isNativeFunction(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(n){return"function"==typeof t}}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]}},e:function e(r){throw r},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function s(){t=t.call(r)},n:function n(){var r=t.next();return a=r.done,r},e:function e(r){u=!0,o=r},f:function f(){try{a||null==t["return"]||t["return"]()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}(function(){var __defProp=Object.defineProperty;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty;var __propIsEnum=Object.prototype.propertyIsEnumerable;var __defNormalProp=function __defNormalProp(obj,key,value){return key in obj?__defProp(obj,key,{enumerable:true,configurable:true,writable:true,value:value}):obj[key]=value};var __spreadValues=function __spreadValues(a,b){for(var prop in b||(b={}))if(__hasOwnProp.call(b,prop))__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols){var _iterator=_createForOfIteratorHelper(__getOwnPropSymbols(b)),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var prop=_step.value;if(__propIsEnum.call(b,prop))__defNormalProp(a,prop,b[prop])}}catch(err){_iterator.e(err)}finally{_iterator.f()}}return a};var __objRest=function __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){var _iterator2=_createForOfIteratorHelper(__getOwnPropSymbols(source)),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var prop=_step2.value;if(exclude.indexOf(prop)<0&&__propIsEnum.call(source,prop))target[prop]=source[prop]}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}}return target};var __publicField=function __publicField(obj,key,value){return __defNormalProp(obj,_typeof(key)!=="symbol"?key+"":key,value)};// src/error/ErrorOrigin.ts
|
|
30
2
|
var ErrorOrigin={/**
|
|
31
3
|
* The error originated from Vinyl and was reported from the uncaught exception or promise
|
|
32
4
|
* rejection handlers.
|
|
@@ -52,15 +24,10 @@ var ErrorOrigin={/**
|
|
|
52
24
|
* This does not include internal or service errors, only errors from the creation of media keys or media key
|
|
53
25
|
* sessions.
|
|
54
26
|
*/DRM:"drm"};// src/error/ReportableError.ts
|
|
55
|
-
var ReportableError=/*#__PURE__*/function(_Error){function _ReportableError(message){var
|
|
27
|
+
var ReportableError=/*#__PURE__*/function(_Error){function _ReportableError(message){var _this;var origin=arguments.length>1&&arguments[1]!==undefined?arguments[1]:ErrorOrigin.INTERNAL;var level=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"fatal";_classCallCheck(this,_ReportableError);_this=_callSuper(this,_ReportableError,[message]);__publicField(_this,"origin",origin);__publicField(_this,"level",level);Object.setPrototypeOf(_this,_ReportableError.prototype);return _this}_inherits(_ReportableError,_Error);return _createClass(_ReportableError,[{key:Symbol.toStringTag,get:function get(){return"ReportableError"}},{key:"name",get:function get(){return this[Symbol.toStringTag]}/**
|
|
56
28
|
* All ReportableError instances must be serializable.
|
|
57
29
|
*/},{key:"toJSON",value:function toJSON(){return{level:this.level,message:this.message,name:this.name,origin:this.origin,stack:this.stack}}}])}(/*#__PURE__*/_wrapNativeSuper(Error));// src/error/IllegalArgumentError.ts
|
|
58
|
-
var IllegalArgumentError=/*#__PURE__*/function(_ReportableError2){function _IllegalArgumentError(message){var
|
|
59
|
-
function getOrSet(map,key,defaultValue){if(map.has(key)){return map.get(key)}else{var value=defaultValue(key);map.set(key,value);return value}}function flipMap(map){var result=/* @__PURE__ */new Map;var _iterator4=_createForOfIteratorHelper(map),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _step4$value=_slicedToArray(_step4.value,2),key=_step4$value[0],value=_step4$value[1];result.set(value,key)}}catch(err){_iterator4.e(err)}finally{_iterator4.f()}return result}// src/util/string/string.ts
|
|
60
|
-
var locale={variableNotDefined:"Variable '{name}' is not defined"};var DEFAULT_SUBSTITUTE_PATTERN=/\{(\w+)}/g;function substitute(str,variables){var pattern=arguments.length>2&&arguments[2]!==undefined?arguments[2]:DEFAULT_SUBSTITUTE_PATTERN;return str.replace(pattern,function(_,name){if(!(name in variables)){throw new IllegalArgumentError(locale.variableNotDefined.replace("{name}",String(name)))}return String(variables[name])})}var predefinedDecodeEntities=/* @__PURE__ */new Map([["apos","'"],["amp","&"],["lt","<"],["gt",">"],["quot","\""]]);var standardEntityValueToNames=flipMap(predefinedDecodeEntities);// src/util/set/set.ts
|
|
61
|
-
function union(a,b){return/* @__PURE__ */new Set([].concat(_toConsumableArray(a),_toConsumableArray(b)))}// src/util/object/object.ts
|
|
62
|
-
function ownKeys(obj){if(!obj)return/* @__PURE__ */new Set;if(typeof Reflect!=="undefined")return new Set(Reflect.ownKeys(obj));var properties=/* @__PURE__ */new Set;Object.getOwnPropertyNames(obj).forEach(function(item){return properties.add(item)});Object.getOwnPropertySymbols(obj).forEach(function(item){return properties.add(item)});return properties}function isPlainObject(value){if(!value||_typeof(value)!=="object"||Array.isArray(value))return false;var proto=Object.getPrototypeOf(value);return!proto||!Object.getPrototypeOf(proto)}// src/util/serialization/json.ts
|
|
63
|
-
function toJson(value){return toJsonInternal(value,/* @__PURE__ */new Set)}function toJsonInternal(value,visited){switch(_typeof(value)){case"object":return objectToJsonInternal(value,visited);case"undefined":case"boolean":case"number":case"string":return value;case"function":return"[function ".concat(value.name,"]");case"symbol":return"[symbol ".concat(value.toString().slice(7,-1),"]");case"bigint":return value.toString()}}function objectToJsonInternal(value,visited){if(value==null)return value;if(visited.has(value))return"<circular reference: ".concat(String(value),">");visited.add(value);if("toJSON"in value&&typeof value.toJSON==="function")return value.toJSON();if(value instanceof Set){return Array.from(value).map(function(e){return toJsonInternal(e,visited)})}else if(Array.isArray(value)){return value.map(function(e){return toJsonInternal(e,visited)})}else{if(isPlainObject(value)){var o={};for(var key in value){o[key]=toJsonInternal(value[key],visited)}return o}else if(value instanceof Error){return{name:value.name,message:value.message,stack:value.stack}}else{return value.toString()}}}// src/util/collection/LinkedList.ts
|
|
30
|
+
var IllegalArgumentError=/*#__PURE__*/function(_ReportableError2){function _IllegalArgumentError(message){var _this2;var isInternal=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;_classCallCheck(this,_IllegalArgumentError);_this2=_callSuper(this,_IllegalArgumentError,[message,isInternal?ErrorOrigin.INTERNAL:ErrorOrigin.API]);__publicField(_this2,"isInternal",isInternal);Object.setPrototypeOf(_this2,_IllegalArgumentError.prototype);return _this2}_inherits(_IllegalArgumentError,_ReportableError2);return _createClass(_IllegalArgumentError,[{key:Symbol.toStringTag,get:function get(){return"IllegalArgumentError"}}])}(ReportableError);// src/util/collection/LinkedList.ts
|
|
64
31
|
var LinkedList=/*#__PURE__*/function(){function LinkedList(){_classCallCheck(this,LinkedList);__publicField(this,"_head",null);__publicField(this,"_tail",null)}/**
|
|
65
32
|
* Returns the current head.
|
|
66
33
|
*/return _createClass(LinkedList,[{key:"head",get:function get(){return this._head}/**
|
|
@@ -76,7 +43,7 @@ var LinkedList=/*#__PURE__*/function(){function LinkedList(){_classCallCheck(thi
|
|
|
76
43
|
* Appends all given values to the end of this list.
|
|
77
44
|
*
|
|
78
45
|
* @param values
|
|
79
|
-
*/},{key:"pushAll",value:function pushAll(){for(var
|
|
46
|
+
*/},{key:"pushAll",value:function pushAll(){for(var _len=arguments.length,values=new Array(_len),_key=0;_key<_len;_key++){values[_key]=arguments[_key]}for(var _i=0,_values=values;_i<_values.length;_i++){var value=_values[_i];this.push(value)}}/**
|
|
80
47
|
* Appends the given node to the tail of this list.
|
|
81
48
|
* If the node is already at the tail, it will no-op.
|
|
82
49
|
* If the node is in this list, it will be removed.
|
|
@@ -160,8 +127,8 @@ var LinkedList=/*#__PURE__*/function(){function LinkedList(){_classCallCheck(thi
|
|
|
160
127
|
* @param start The starting node. (inclusive)
|
|
161
128
|
* @param end The ending node (exclusive).
|
|
162
129
|
* @param next A method that is given the current node, and returns the next node.
|
|
163
|
-
*/},{key:"createIterator",value:function createIterator(start,end,
|
|
164
|
-
var SignalImpl=/*#__PURE__*/function(){function SignalImpl(){_classCallCheck(this,SignalImpl);__publicField(this,"handlers",new LinkedList)}return _createClass(SignalImpl,[{key:"empty",get:function get(){return this.handlers.empty}},{key:"listen",value:function listen(handler,options){var
|
|
130
|
+
*/},{key:"createIterator",value:function createIterator(start,end,_next){var current=start;return _defineProperty(_defineProperty({},Symbol.iterator,function(){return this}),"next",function next(){if(current===end||!current){return{value:void 0,done:true}}var result={value:current.value,done:false};current=_next(current);while(current==null?void 0:current.removed){current=_next(current)}return result})}}])}();// src/event/Signal.ts
|
|
131
|
+
var SignalImpl=/*#__PURE__*/function(){function SignalImpl(){_classCallCheck(this,SignalImpl);__publicField(this,"handlers",new LinkedList)}return _createClass(SignalImpl,[{key:"empty",get:function get(){return this.handlers.empty}},{key:"listen",value:function listen(handler,options){var _this3=this;var remove2=function remove2(){return _this3.handlers.remove(node)};var node=this.handlers.push((options==null?void 0:options.once)?function(event){remove2();handler(event)}:handler);return remove2}/**
|
|
165
132
|
* Invokes all handlers, providing the given event.
|
|
166
133
|
*
|
|
167
134
|
* Handlers may add/remove callbacks or do a nested dispatch.
|
|
@@ -174,22 +141,14 @@ var SignalImpl=/*#__PURE__*/function(){function SignalImpl(){_classCallCheck(thi
|
|
|
174
141
|
* Removes all handlers.
|
|
175
142
|
*/},{key:"clear",value:function clear(){this.handlers.clear()}/**
|
|
176
143
|
* Same as clear.
|
|
177
|
-
*/},{key:"dispose",value:function dispose(){this.clear()}}])}();function signal(){return new SignalImpl}// src/
|
|
144
|
+
*/},{key:"dispose",value:function dispose(){this.clear()}}])}();function signal(){return new SignalImpl}// src/util/map/map.ts
|
|
145
|
+
function getOrSet(map,key,defaultValue){if(map.has(key)){return map.get(key)}else{var value=defaultValue(key);map.set(key,value);return value}}function flipMap(map){var result=/* @__PURE__ */new Map;var _iterator3=_createForOfIteratorHelper(map),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _step3$value=_slicedToArray(_step3.value,2),key=_step3$value[0],value=_step3$value[1];result.set(value,key)}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}return result}// src/util/type.ts
|
|
146
|
+
function covariant(){return void 0}// src/logging/LogTarget.ts
|
|
178
147
|
var counter=0;function createLogPrefix(target){var name=typeof target==="string"?target:target[Symbol.toStringTag];return"".concat(name,"/").concat(++counter)}// src/event/EventHost.ts
|
|
179
|
-
var EventHostImpl=/*#__PURE__*/function(){function EventHostImpl(){_classCallCheck(this,EventHostImpl);__publicField(this,"logPrefix",createLogPrefix(this));__publicField(this,"signals",/* @__PURE__ */new Map);__publicField(this,"__eventMapType",covariant())}return _createClass(EventHostImpl,[{key:Symbol.toStringTag,get:function get(){return"EventHostImpl"}},{key:"hasAnyListeners",value:function hasAnyListeners(){var
|
|
180
|
-
function remove(array,element){var index=array.indexOf(element);if(index===-1)return false;array.splice(index,1);return true}// src/util/
|
|
181
|
-
function
|
|
182
|
-
function
|
|
183
|
-
var locale2={cyclicRefError:"Cyclic reference found at: {path}",mergeReferenceError:"No merge rule found at {path} for \"{source}\" and reference copy not allowed"};function mergeDeep(sources,options){if(!sources.length)return void 0;var finalOpts=__spreadValues(__spreadValues({},defaultMergeOptions),options);var stack=new PropStack;var n=sources.length;if(n===1)return _mergeDeep(void 0,sources[0],stack,0,finalOpts);var out=_mergeDeep(sources[0],sources[1],stack,1,finalOpts);for(var i=2;i<n;i++){out=_mergeDeep(out,sources[i],stack,i,finalOpts)}return out}var PropStack=/*#__PURE__*/function(){function PropStack(){_classCallCheck(this,PropStack);/**
|
|
184
|
-
* Object references for sourceA.
|
|
185
|
-
*/__publicField(this,"refsA",/* @__PURE__ */new Set);/**
|
|
186
|
-
* Object references for sourceB.
|
|
187
|
-
*/__publicField(this,"refsB",/* @__PURE__ */new Set);__publicField(this,"propStack",[])}/**
|
|
188
|
-
* The property stack, joined by .
|
|
189
|
-
*/return _createClass(PropStack,[{key:"currentPath",get:function get(){return this.propStack.map(function(e){return e[2]}).filter(function(e){return e!=null}).join(".")}},{key:"push",value:function push(sourceA,sourceB,prop){this.propStack.push([sourceA,sourceB,prop]);this.addRef(this.refsA,sourceA);this.addRef(this.refsB,sourceB)}},{key:"pop",value:function pop(){var last=this.propStack.pop();this.refsA["delete"](last[0]);this.refsB["delete"](last[1])}},{key:"addRef",value:function addRef(refSet,source){if(_typeof(source)!=="object")return;if(refSet.has(source)){throw new IllegalArgumentError(substitute(locale2.cyclicRefError,{path:this.currentPath}))}refSet.add(source)}}])}();function _mergeDeep(sourceA,sourceB,propStack,prop,options){if(_typeof(sourceB)!=="object"||sourceB===null)return sourceB;var merge=function merge(sourceA2,sourceB2,prop2){return _mergeDeep(sourceA2,sourceB2,propStack,prop2,options)};var _iterator7=_createForOfIteratorHelper(options.rules),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var rule=_step7.value;if(rule.matches(sourceB)){propStack.push(sourceA,sourceB,prop);var result=rule.merge(rule.matches(sourceA)?sourceA:void 0,sourceB,merge);propStack.pop();return result}}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(!options.allowReferenceCopy){propStack.push(sourceA,sourceB,prop);throw new MergeReferenceError(propStack.currentPath,sourceB)}return sourceB}var MergeReferenceError=/*#__PURE__*/function(_ReportableError3){function _MergeReferenceError(propPath,source){var _this6;_classCallCheck(this,_MergeReferenceError);_this6=_callSuper(this,_MergeReferenceError,[substitute(locale2.mergeReferenceError,{path:propPath,source:source})]);Object.setPrototypeOf(_this6,_MergeReferenceError.prototype);return _this6}_inherits(_MergeReferenceError,_ReportableError3);return _createClass(_MergeReferenceError)}(ReportableError);var cloneableMergeRule={matches:function matches(object){return isCloneable(object)},merge:function merge(_1,sourceB,_2){return sourceB.clone()}};var arrayMergeRule={matches:function matches(object){return Array.isArray(object)},merge:function merge(sourceA,sourceB,_merge){var out=[];if(sourceA){var _iterator8=_createForOfIteratorHelper(sourceA),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var element=_step8.value;out.push(_merge(void 0,element,out.length))}}catch(err){_iterator8.e(err)}finally{_iterator8.f()}}var _iterator9=_createForOfIteratorHelper(sourceB),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _element=_step9.value;out.push(_merge(void 0,_element,out.length))}}catch(err){_iterator9.e(err)}finally{_iterator9.f()}return out}};var plainObjectMergeRule={matches:function matches(object){return isPlainObject(object)},merge:function merge(sourceA,sourceB,_merge2){var out={};var _iterator0=_createForOfIteratorHelper(union(ownKeys(sourceA),ownKeys(sourceB))),_step0;try{for(_iterator0.s();!(_step0=_iterator0.n()).done;){var key=_step0.value;if(sourceA&&key in sourceB&&key in sourceA){out[key]=_merge2(sourceA[key],sourceB[key],key)}else if(sourceA&&key in sourceA){out[key]=_merge2(void 0,sourceA[key],key)}else{out[key]=_merge2(void 0,sourceB[key],key)}}}catch(err){_iterator0.e(err)}finally{_iterator0.f()}return out}};var regexpMergeRule={matches:function matches(object){return object instanceof RegExp},merge:function merge(_1,sourceB,_2){return new RegExp(sourceB.source,sourceB.flags)}};var dateMergeRule={matches:function matches(object){return object instanceof Date},merge:function merge(_1,sourceB,_2){return new Date(sourceB.getTime())}};var mapMergeRule={matches:function matches(object){return object instanceof Map},merge:function merge(sourceA,sourceB,_merge3){var _a;var out=/* @__PURE__ */new Map;var _iterator1=_createForOfIteratorHelper(/* @__PURE__ */new Set([].concat(_toConsumableArray((_a=sourceA==null?void 0:sourceA.keys())!=null?_a:[]),_toConsumableArray(sourceB.keys())))),_step1;try{for(_iterator1.s();!(_step1=_iterator1.n()).done;){var key=_step1.value;if(sourceB.has(key)&&(sourceA==null?void 0:sourceA.has(key))){out.set(key,_merge3(sourceA.get(key),sourceB.get(key),key))}else if(sourceA==null?void 0:sourceA.has(key)){out.set(key,_merge3(void 0,sourceA.get(key),key))}else{out.set(key,_merge3(void 0,sourceB.get(key),key))}}}catch(err){_iterator1.e(err)}finally{_iterator1.f()}return out}};var setMergeRule={matches:function matches(object){return object instanceof Set},merge:function merge(sourceA,sourceB,_merge4){var _a;return new Set([].concat(_toConsumableArray((_a=sourceA==null?void 0:sourceA.values())!=null?_a:[]),_toConsumableArray(sourceB.values())).map(function(element,index){return _merge4(void 0,element,index)}))}};var typedArrayMergeRule={matches:function matches(object){return isTypedArray(object)},merge:function merge(_1,sourceB,_2){return cloneTypedArray(sourceB)}};var urlMergeRule={matches:function matches(object){return object instanceof URL},merge:function merge(_1,sourceB,_2){return new URL(sourceB.toString())}};var defaultMergeOptions={allowReferenceCopy:true,rules:[cloneableMergeRule,arrayMergeRule,plainObjectMergeRule,regexpMergeRule,dateMergeRule,mapMergeRule,setMergeRule,typedArrayMergeRule,urlMergeRule]};// src/error/IllegalStateError.ts
|
|
190
|
-
var IllegalStateError=/*#__PURE__*/function(_ReportableError4){function _IllegalStateError(message){var _this7;_classCallCheck(this,_IllegalStateError);_this7=_callSuper(this,_IllegalStateError,[message]);Object.setPrototypeOf(_this7,_IllegalStateError.prototype);return _this7}_inherits(_IllegalStateError,_ReportableError4);return _createClass(_IllegalStateError,[{key:Symbol.toStringTag,get:function get(){return"IllegalStateError"}}])}(ReportableError);// src/core/disposable.ts
|
|
191
|
-
function isDisposable(value){return value!=null&&typeof value.dispose==="function"&&value.dispose.length===0}// src/util/iteration/iterable.ts
|
|
192
|
-
function mapIter(iterable,transform){var it2=iterable[Symbol.iterator]();return _defineProperty(_defineProperty({},Symbol.iterator,function(){return mapIter(iterable,transform)}),"next",function next(){var result=it2.next();if(result.done)return result;return{value:transform(result.value),done:false}})}// src/util/collection/LruCache.ts
|
|
148
|
+
var EventHostImpl=/*#__PURE__*/function(){function EventHostImpl(){_classCallCheck(this,EventHostImpl);__publicField(this,"logPrefix",createLogPrefix(this));__publicField(this,"signals",/* @__PURE__ */new Map);__publicField(this,"__eventMapType",covariant())}return _createClass(EventHostImpl,[{key:Symbol.toStringTag,get:function get(){return"EventHostImpl"}},{key:"hasAnyListeners",value:function hasAnyListeners(){var _iterator4=_createForOfIteratorHelper(this.signals.values()),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var value=_step4.value;if(!value.empty)return true}}catch(err){_iterator4.e(err)}finally{_iterator4.f()}return false}},{key:"hasListeners",value:function hasListeners(type){var _a;return((_a=this.signals.get(type))==null?void 0:_a.empty)===false}},{key:"on",value:function on(type,handler,options){var sig=getOrSet(this.signals,type,function(){return signal()});return sig.listen(handler,options)}},{key:"dispatch",value:function dispatch(type,event){var _a;(_a=this.signals.get(type))==null?void 0:_a.dispatch(event)}},{key:"dispose",value:function dispose(){var _iterator5=_createForOfIteratorHelper(this.signals.values()),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var signal2=_step5.value;signal2.dispose()}}catch(err){_iterator5.e(err)}finally{_iterator5.f()}this.signals.clear()}}])}();// src/util/collection/array.ts
|
|
149
|
+
function remove(array,element){var index=array.indexOf(element);if(index===-1)return false;array.splice(index,1);return true}// src/util/iteration/iterable.ts
|
|
150
|
+
function mapIter(iterable,transform){var it2=iterable[Symbol.iterator]();return _defineProperty(_defineProperty({},Symbol.iterator,function(){return mapIter(iterable,transform)}),"next",function next(){var result=it2.next();if(result.done)return result;return{value:transform(result.value),done:false}})}// src/error/IllegalStateError.ts
|
|
151
|
+
var IllegalStateError=/*#__PURE__*/function(_ReportableError3){function _IllegalStateError(message){var _this4;_classCallCheck(this,_IllegalStateError);_this4=_callSuper(this,_IllegalStateError,[message]);Object.setPrototypeOf(_this4,_IllegalStateError.prototype);return _this4}_inherits(_IllegalStateError,_ReportableError3);return _createClass(_IllegalStateError,[{key:Symbol.toStringTag,get:function get(){return"IllegalStateError"}}])}(ReportableError);// src/util/collection/LruCache.ts
|
|
193
152
|
var LruCache=/*#__PURE__*/function(){function LruCache(initialCapacity){_classCallCheck(this,LruCache);/**
|
|
194
153
|
* A map of the list nodes.
|
|
195
154
|
*
|
|
@@ -228,18 +187,18 @@ var LruCache=/*#__PURE__*/function(){function LruCache(initialCapacity){_classCa
|
|
|
228
187
|
*
|
|
229
188
|
* @param callback A callback to invoke for every element in the cache.
|
|
230
189
|
* @param thisArg Value to use as this when executing callback
|
|
231
|
-
*/},{key:"forEach",value:function forEach(callback,thisArg){var
|
|
190
|
+
*/},{key:"forEach",value:function forEach(callback,thisArg){var _this5=this;return this.list.forEach(function(entry){callback.call(thisArg,entry[1],entry[0],_this5)})}/**
|
|
232
191
|
* Returns an iterable of key, value pairs for every entry in the map.
|
|
233
192
|
*/},{key:"entries",value:function entries(){return this[Symbol.iterator]()}/**
|
|
234
193
|
* Returns an iterable of keys in the map. This will be ordered from least recently used to
|
|
235
194
|
* most.
|
|
236
|
-
*/},{key:"keys",value:function keys(){return mapIter(this.list,function(
|
|
195
|
+
*/},{key:"keys",value:function keys(){return mapIter(this.list,function(_ref3){var _ref4=_slicedToArray(_ref3,1),key=_ref4[0];return key})}/**
|
|
237
196
|
* Returns an iterable of values in the map. This will be ordered from least recently used to
|
|
238
197
|
* most.
|
|
239
|
-
*/},{key:"values",value:function values(){return mapIter(this.list,function(
|
|
240
|
-
function memoize(inner,keyProvider){var capacity=arguments.length>2&&arguments[2]!==undefined?arguments[2]:500;if(!keyProvider){var cached=false;var value=void 0;var memoized=function memoized(){if(!cached){cached=true;value=inner()}return value};return Object.assign(memoized,{clear:function clear(){cached=false;value=void 0}})}else if(capacity===0){var _memoized=function _memoized(){return inner.apply(void 0,arguments)};return Object.assign(_memoized,{clear:function clear(){}})}else if(capacity===1){var hasValue=false;var cachedKey;var cachedValue;var _memoized2=function _memoized2(){var key=keyProvider.apply(void 0,arguments);if(!hasValue||cachedKey!==key){hasValue=true;cachedKey=key;cachedValue=inner.apply(void 0,arguments)}return cachedValue};return Object.assign(_memoized2,{clear:function clear(){hasValue=false}})}else{var cache=new LruCache(capacity);var _memoized3=function _memoized3(){for(var
|
|
241
|
-
function
|
|
242
|
-
|
|
198
|
+
*/},{key:"values",value:function values(){return mapIter(this.list,function(_ref5){var _ref6=_slicedToArray(_ref5,2),value=_ref6[1];return value})}},{key:Symbol.iterator,value:function value(){return this.list[Symbol.iterator]()}},{key:Symbol.toStringTag,get:function get(){return"LruCache"}}])}();// src/util/fun/memoize.ts
|
|
199
|
+
function memoize(inner,keyProvider){var capacity=arguments.length>2&&arguments[2]!==undefined?arguments[2]:500;if(!keyProvider){var cached=false;var value=void 0;var memoized=function memoized(){if(!cached){cached=true;value=inner()}return value};return Object.assign(memoized,{clear:function clear(){cached=false;value=void 0}})}else if(capacity===0){var _memoized=function _memoized(){return inner.apply(void 0,arguments)};return Object.assign(_memoized,{clear:function clear(){}})}else if(capacity===1){var hasValue=false;var cachedKey;var cachedValue;var _memoized2=function _memoized2(){var key=keyProvider.apply(void 0,arguments);if(!hasValue||cachedKey!==key){hasValue=true;cachedKey=key;cachedValue=inner.apply(void 0,arguments)}return cachedValue};return Object.assign(_memoized2,{clear:function clear(){hasValue=false}})}else{var cache=new LruCache(capacity);var _memoized3=function _memoized3(){for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2]}var key=keyProvider.apply(void 0,args);return getOrSet(cache,key,function(){return inner.apply(void 0,args)})};return Object.assign(_memoized3,{clear:function clear(){cache.clear()}})}}// src/util/string/string.ts
|
|
200
|
+
var locale={variableNotDefined:"Variable '{name}' is not defined"};var DEFAULT_SUBSTITUTE_PATTERN=/\{(\w+)}/g;function substitute(str,variables){var pattern=arguments.length>2&&arguments[2]!==undefined?arguments[2]:DEFAULT_SUBSTITUTE_PATTERN;return str.replace(pattern,function(_,name){if(!(name in variables)){throw new IllegalArgumentError(locale.variableNotDefined.replace("{name}",String(name)))}return String(variables[name])})}var predefinedDecodeEntities=/* @__PURE__ */new Map([["apos","'"],["amp","&"],["lt","<"],["gt",">"],["quot","\""]]);var standardEntityValueToNames=flipMap(predefinedDecodeEntities);// src/core/disposable.ts
|
|
201
|
+
function isDisposable(value){return value!=null&&typeof value.dispose==="function"&&value.dispose.length===0}// src/global/globalRegistry.ts
|
|
243
202
|
var GlobalRegistry=/*#__PURE__*/function(){function GlobalRegistry(){_classCallCheck(this,GlobalRegistry);__publicField(this,"registry",[])}/**
|
|
244
203
|
* Returns the number of references currently in the registry.
|
|
245
204
|
*/return _createClass(GlobalRegistry,[{key:"size",get:function get(){return this.registry.length}/**
|
|
@@ -254,13 +213,54 @@ var GlobalRegistry=/*#__PURE__*/function(){function GlobalRegistry(){_classCallC
|
|
|
254
213
|
* Resets all registered initializers and sets this registry back to its pre-initialized state.
|
|
255
214
|
* This is typically only done within unit tests, but may be called if all players are
|
|
256
215
|
* disposed and the consumer intends to teardown global state.
|
|
257
|
-
*/},{key:"reset",value:function reset(){var
|
|
216
|
+
*/},{key:"reset",value:function reset(){var _iterator6=_createForOfIteratorHelper(this.registry),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var registryElement=_step6.value;registryElement.reset()}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}}}])}();var _registry=null;function getGlobalRegistry(){if(!_registry)_registry=new GlobalRegistry;return _registry}var globalRefDebug=false;var GlobalRefImpl=/*#__PURE__*/function(){function GlobalRefImpl(defaultInitializer){_classCallCheck(this,GlobalRefImpl);__publicField(this,"defaultInitializer",defaultInitializer);__publicField(this,"_value");__publicField(this,"_initialized",false);__publicField(this,"constructing",false);__publicField(this,"initializer");__publicField(this,"lastInitStack",null);this.initializer=defaultInitializer}return _createClass(GlobalRefImpl,[{key:"initialized",get:function get(){return this._initialized}},{key:"value",get:function get(){this.initialize();return this._value}},{key:"reset",value:function reset(){this.initializer=this.defaultInitializer;if(!this._initialized)return;this.assertNotConstructing();this._initialized=false;this.lastInitStack=null;if(isDisposable(this._value)){this._value.dispose()}this._value=void 0}},{key:"initialize",value:function initialize(){if(this._initialized)return;this.assertNotConstructing();this.constructing=true;try{this._value=this.initializer()}catch(error){this.constructing=false;throw error}this.constructing=false;this._initialized=true;if(globalRefDebug){this.lastInitStack=new Error("globalRef initialized").stack}}},{key:"set",value:function set(newInitializer){var _this6=this;this.assertNotInitialized();var overriddenInitializer=function overriddenInitializer(){return newInitializer(_this6.defaultInitializer)};this.initializer=overriddenInitializer;return new GlobalRefOverride(this,overriddenInitializer,function(newInitializer2){_this6.initializer=newInitializer2})}},{key:"assertNotInitialized",value:function assertNotInitialized(){if(this._initialized){var detail=this.lastInitStack?"\nLast initialized at:\n".concat(this.lastInitStack):"";throw new IllegalStateError("Cannot call when initialized".concat(detail))}}},{key:"assertNotConstructing",value:function assertNotConstructing(){if(this.constructing)throw new IllegalStateError("Cannot call during construction")}}])}();var GlobalRefOverride=/*#__PURE__*/function(){function _GlobalRefOverride(original,defaultInitializer,setInitializer){_classCallCheck(this,_GlobalRefOverride);__publicField(this,"original",original);__publicField(this,"defaultInitializer",defaultInitializer);__publicField(this,"setInitializer",setInitializer);__publicField(this,"initializer");this.initializer=defaultInitializer}return _createClass(_GlobalRefOverride,[{key:"initialized",get:function get(){return this.original.initialized}},{key:"value",get:function get(){return this.original.value}},{key:"initialize",value:function initialize(){this.setInitializer(this.initializer);this.original.initialize()}},{key:"reset",value:function reset(){this.initializer=this.defaultInitializer;this.original.reset();this.setInitializer(this.initializer)}},{key:"set",value:function set(newInitializer){var _this7=this;var overriddenInitializer=function overriddenInitializer(){return newInitializer(_this7.defaultInitializer)};this.initializer=overriddenInitializer;this.setInitializer(overriddenInitializer);return new _GlobalRefOverride(this,overriddenInitializer,this.setInitializer)}}])}();function globalRef(init){return getGlobalRegistry().register(new GlobalRefImpl(init))}// src/core/cloneable.ts
|
|
217
|
+
function isCloneable(value){return value!=null&&_typeof(value)==="object"&&"clone"in value&&typeof value.clone==="function"&&value.clone.length===0}// src/util/object/object.ts
|
|
218
|
+
function ownKeys(obj){if(!obj)return/* @__PURE__ */new Set;if(typeof Reflect!=="undefined")return new Set(Reflect.ownKeys(obj));var properties=/* @__PURE__ */new Set;Object.getOwnPropertyNames(obj).forEach(function(item){return properties.add(item)});Object.getOwnPropertySymbols(obj).forEach(function(item){return properties.add(item)});return properties}function isPlainObject(value){if(!value||_typeof(value)!=="object"||Array.isArray(value))return false;var proto=Object.getPrototypeOf(value);return!proto||!Object.getPrototypeOf(proto)}// src/util/serialization/json.ts
|
|
219
|
+
function toJson(value){return toJsonInternal(value,/* @__PURE__ */new Set)}function toJsonInternal(value,visited){switch(_typeof(value)){case"object":return objectToJsonInternal(value,visited);case"undefined":case"boolean":case"number":case"string":return value;case"function":return"[function ".concat(value.name,"]");case"symbol":return"[symbol ".concat(value.toString().slice(7,-1),"]");case"bigint":return value.toString()}}function objectToJsonInternal(value,visited){if(value==null)return value;if(visited.has(value))return"<circular reference: ".concat(String(value),">");visited.add(value);if("toJSON"in value&&typeof value.toJSON==="function")return value.toJSON();if(value instanceof Set){return Array.from(value).map(function(e){return toJsonInternal(e,visited)})}else if(Array.isArray(value)){return value.map(function(e){return toJsonInternal(e,visited)})}else{if(isPlainObject(value)){var o={};for(var key in value){o[key]=toJsonInternal(value[key],visited)}return o}else if(value instanceof Error){return{name:value.name,message:value.message,stack:value.stack}}else{return value.toString()}}}// src/global/environment.ts
|
|
220
|
+
function getLocation(){return(typeof location==="undefined"?"undefined":_typeof(location))==="object"?location:defaultLocation}var defaultLocation={origin:"",search:"",href:""};// src/util/browser/searchParams.ts
|
|
221
|
+
var getSearchParams=memoize(function(){var search=arguments.length>0&&arguments[0]!==undefined?arguments[0]:getLocationSearch();var url=new URL("about:blank");url.search=search;return url.searchParams},function(){var search=arguments.length>0&&arguments[0]!==undefined?arguments[0]:getLocationSearch();return search},1);function getLocationSearch(){return getLocation().search}// src/logging/getLogLevelFromSearch.ts
|
|
258
222
|
function getLogLevelFromSearch(){var search=arguments.length>0&&arguments[0]!==undefined?arguments[0]:getLocationSearch();var defaultLevel=arguments.length>1&&arguments[1]!==undefined?arguments[1]:3;var _a;var str=getSearchParams(search).get("vinylLogLevel");if(!str)return defaultLevel;return(_a=parseLogLevel(str))!=null?_a:defaultLevel}// src/logging/Logger.ts
|
|
259
|
-
var LoggerImpl=/*#__PURE__*/function(_EventHostImpl){function LoggerImpl(){var
|
|
223
|
+
var LoggerImpl=/*#__PURE__*/function(_EventHostImpl){function LoggerImpl(){var _this8;var logLevel=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;_classCallCheck(this,LoggerImpl);_this8=_callSuper(this,LoggerImpl);__publicField(_this8,"logLevel",logLevel);return _this8}_inherits(LoggerImpl,_EventHostImpl);return _createClass(LoggerImpl,[{key:Symbol.toStringTag,get:function get(){return"Logger"}},{key:"log",value:function log(target,level){if(level===5/* NONE */||level<this.logLevel)return;for(var _len3=arguments.length,messages=new Array(_len3>2?_len3-2:0),_key3=2;_key3<_len3;_key3++){messages[_key3-2]=arguments[_key3]}this.dispatch("log",{level:level,messages:toJson(messages),target:target})}}])}(EventHostImpl);var loggerRef=globalRef(function(){return new LoggerImpl(// The logger is initialized to VERBOSE if vinylLogLevel=verbose is in the query string
|
|
260
224
|
// Otherwise use DEBUG.
|
|
261
|
-
getLogLevelFromSearch()===0/* VERBOSE */?0/* VERBOSE */:1/* DEBUG */)});function logDebug(target){var _loggerRef$value;for(var
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
225
|
+
getLogLevelFromSearch()===0/* VERBOSE */?0/* VERBOSE */:1/* DEBUG */)});function logDebug(target){var _loggerRef$value;for(var _len4=arguments.length,messages=new Array(_len4>1?_len4-1:0),_key4=1;_key4<_len4;_key4++){messages[_key4-1]=arguments[_key4]}(_loggerRef$value=loggerRef.value).log.apply(_loggerRef$value,[target,1/* DEBUG */].concat(messages))}var strToLogLevel={verbose:0/* VERBOSE */,debug:1/* DEBUG */,info:2/* INFO */,warn:3/* WARN */,error:4/* ERROR */,none:5/* NONE */};function parseLogLevel(str){var _a;return(_a=strToLogLevel[str.toLowerCase()])!=null?_a:null}// src/util/collection/typedArray.ts
|
|
226
|
+
function cloneTypedArray(array){return new array.constructor(array)}var typedArrayTypes=[Float32Array,Float64Array,Int16Array,Int32Array,Int8Array,Uint16Array,Uint32Array,Uint8Array,Uint8ClampedArray];function isTypedArray(value){return typedArrayTypes.some(function(type){return value instanceof type})}// src/util/set/set.ts
|
|
227
|
+
function union(a,b){return/* @__PURE__ */new Set([].concat(_toConsumableArray(a),_toConsumableArray(b)))}// src/util/object/mergeDeep.ts
|
|
228
|
+
var locale2={cyclicRefError:"Cyclic reference found at: {path}",mergeReferenceError:"No merge rule found at {path} for \"{source}\" and reference copy not allowed"};function mergeDeep(sources,options){if(!sources.length)return void 0;var finalOpts=__spreadValues(__spreadValues({},defaultMergeOptions),options);var stack=new PropStack;var n=sources.length;if(n===1)return _mergeDeep(void 0,sources[0],stack,0,finalOpts);var out=_mergeDeep(sources[0],sources[1],stack,1,finalOpts);for(var i=2;i<n;i++){out=_mergeDeep(out,sources[i],stack,i,finalOpts)}return out}var PropStack=/*#__PURE__*/function(){function PropStack(){_classCallCheck(this,PropStack);/**
|
|
229
|
+
* Object references for sourceA.
|
|
230
|
+
*/__publicField(this,"refsA",/* @__PURE__ */new Set);/**
|
|
231
|
+
* Object references for sourceB.
|
|
232
|
+
*/__publicField(this,"refsB",/* @__PURE__ */new Set);__publicField(this,"propStack",[])}/**
|
|
233
|
+
* The property stack, joined by .
|
|
234
|
+
*/return _createClass(PropStack,[{key:"currentPath",get:function get(){return this.propStack.map(function(e){return e[2]}).filter(function(e){return e!=null}).join(".")}},{key:"push",value:function push(sourceA,sourceB,prop){this.propStack.push([sourceA,sourceB,prop]);this.addRef(this.refsA,sourceA);this.addRef(this.refsB,sourceB)}},{key:"pop",value:function pop(){var last=this.propStack.pop();this.refsA["delete"](last[0]);this.refsB["delete"](last[1])}},{key:"addRef",value:function addRef(refSet,source){if(_typeof(source)!=="object")return;if(refSet.has(source)){throw new IllegalArgumentError(substitute(locale2.cyclicRefError,{path:this.currentPath}))}refSet.add(source)}}])}();function _mergeDeep(sourceA,sourceB,propStack,prop,options){if(_typeof(sourceB)!=="object"||sourceB===null)return sourceB;var merge=function merge(sourceA2,sourceB2,prop2){return _mergeDeep(sourceA2,sourceB2,propStack,prop2,options)};var _iterator7=_createForOfIteratorHelper(options.rules),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var rule=_step7.value;if(rule.matches(sourceB)){propStack.push(sourceA,sourceB,prop);var result=rule.merge(rule.matches(sourceA)?sourceA:void 0,sourceB,merge);propStack.pop();return result}}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(!options.allowReferenceCopy){propStack.push(sourceA,sourceB,prop);throw new MergeReferenceError(propStack.currentPath,sourceB)}return sourceB}var MergeReferenceError=/*#__PURE__*/function(_ReportableError4){function _MergeReferenceError(propPath,source){var _this9;_classCallCheck(this,_MergeReferenceError);_this9=_callSuper(this,_MergeReferenceError,[substitute(locale2.mergeReferenceError,{path:propPath,source:source})]);Object.setPrototypeOf(_this9,_MergeReferenceError.prototype);return _this9}_inherits(_MergeReferenceError,_ReportableError4);return _createClass(_MergeReferenceError)}(ReportableError);var cloneableMergeRule={matches:function matches(object){return isCloneable(object)},merge:function merge(_1,sourceB,_2){return sourceB.clone()}};var arrayMergeRule={matches:function matches(object){return Array.isArray(object)},merge:function merge(sourceA,sourceB,_merge){var out=[];if(sourceA){var _iterator8=_createForOfIteratorHelper(sourceA),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var element=_step8.value;out.push(_merge(void 0,element,out.length))}}catch(err){_iterator8.e(err)}finally{_iterator8.f()}}var _iterator9=_createForOfIteratorHelper(sourceB),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _element=_step9.value;out.push(_merge(void 0,_element,out.length))}}catch(err){_iterator9.e(err)}finally{_iterator9.f()}return out}};var plainObjectMergeRule={matches:function matches(object){return isPlainObject(object)},merge:function merge(sourceA,sourceB,_merge2){var out={};var _iterator0=_createForOfIteratorHelper(union(ownKeys(sourceA),ownKeys(sourceB))),_step0;try{for(_iterator0.s();!(_step0=_iterator0.n()).done;){var key=_step0.value;if(sourceA&&key in sourceB&&key in sourceA){out[key]=_merge2(sourceA[key],sourceB[key],key)}else if(sourceA&&key in sourceA){out[key]=_merge2(void 0,sourceA[key],key)}else{out[key]=_merge2(void 0,sourceB[key],key)}}}catch(err){_iterator0.e(err)}finally{_iterator0.f()}return out}};var regexpMergeRule={matches:function matches(object){return object instanceof RegExp},merge:function merge(_1,sourceB,_2){return new RegExp(sourceB.source,sourceB.flags)}};var dateMergeRule={matches:function matches(object){return object instanceof Date},merge:function merge(_1,sourceB,_2){return new Date(sourceB.getTime())}};var mapMergeRule={matches:function matches(object){return object instanceof Map},merge:function merge(sourceA,sourceB,_merge3){var _a;var out=/* @__PURE__ */new Map;var _iterator1=_createForOfIteratorHelper(/* @__PURE__ */new Set([].concat(_toConsumableArray((_a=sourceA==null?void 0:sourceA.keys())!=null?_a:[]),_toConsumableArray(sourceB.keys())))),_step1;try{for(_iterator1.s();!(_step1=_iterator1.n()).done;){var key=_step1.value;if(sourceB.has(key)&&(sourceA==null?void 0:sourceA.has(key))){out.set(key,_merge3(sourceA.get(key),sourceB.get(key),key))}else if(sourceA==null?void 0:sourceA.has(key)){out.set(key,_merge3(void 0,sourceA.get(key),key))}else{out.set(key,_merge3(void 0,sourceB.get(key),key))}}}catch(err){_iterator1.e(err)}finally{_iterator1.f()}return out}};var setMergeRule={matches:function matches(object){return object instanceof Set},merge:function merge(sourceA,sourceB,_merge4){var _a;return new Set([].concat(_toConsumableArray((_a=sourceA==null?void 0:sourceA.values())!=null?_a:[]),_toConsumableArray(sourceB.values())).map(function(element,index){return _merge4(void 0,element,index)}))}};var typedArrayMergeRule={matches:function matches(object){return isTypedArray(object)},merge:function merge(_1,sourceB,_2){return cloneTypedArray(sourceB)}};var urlMergeRule={matches:function matches(object){return object instanceof URL},merge:function merge(_1,sourceB,_2){return new URL(sourceB.toString())}};var defaultMergeOptions={allowReferenceCopy:true,rules:[cloneableMergeRule,arrayMergeRule,plainObjectMergeRule,regexpMergeRule,dateMergeRule,mapMergeRule,setMergeRule,typedArrayMergeRule,urlMergeRule]};// src/util/url/resolveUrl.ts
|
|
235
|
+
var SCHEME_RE=/^[a-z][a-z0-9+.-]*:/i;function resolveUrl(relative,base){if(SCHEME_RE.test(relative))return relative;if(relative.startsWith("//")){var schemeEnd2=base.indexOf("://");return base.substring(0,schemeEnd2+1)+relative}var schemeEnd=base.indexOf("://")+3;var pathStart=base.indexOf("/",schemeEnd);var origin=pathStart===-1?base:base.substring(0,pathStart);if(relative.startsWith("/"))return origin+relative;if(relative==="")return base;var basePath=pathStart===-1?"/":base.substring(pathStart);var lastSlash=basePath.lastIndexOf("/");var dir=basePath.substring(0,lastSlash+1);return origin+resolveDots(dir+relative)}function resolveDots(path){if(path.indexOf(".")===-1)return path;var parts=path.split("/");var out=[];for(var i=0;i<parts.length;i++){var p=parts[i];if(p===".."){if(out.length>1)out.pop()}else if(p!=="."){out.push(p)}}return out.join("/")}// test/browserTestUtil/benchmark/Benchmark.ts
|
|
236
|
+
var now;if(typeof window!=="undefined"&&typeof window.performance!=="undefined"&&typeof window.performance.now!=="undefined"){now=function now(){return window.performance.now()}}else if(typeof self!=="undefined"&&typeof self.performance!=="undefined"&&typeof self.performance.now!=="undefined"){now=function now(){return self.performance.now()}}else{now=function now(){return Date.now()}}var BenchmarkRunResults=/*#__PURE__*/function(){function BenchmarkRunResults(name){_classCallCheck(this,BenchmarkRunResults);__publicField(this,"name",name);__publicField(this,"cycleResults",[]);__publicField(this,"_totalSamples",0)}return _createClass(BenchmarkRunResults,[{key:"totalSamples",get:function get(){return this._totalSamples}},{key:"cycleResultsNoOutliers",get:function get(){var sD=this.standardDeviation;var avg=average(this.cycleResults);return this.cycleResults.filter(function(e){var zScore=(avg-e)/sD;return Math.abs(zScore)<3})}/**
|
|
237
|
+
* Returns the mean ops per second minus outliers of greater than 3 standard deviations.
|
|
238
|
+
*/},{key:"meanOpsPerSec",get:function get(){return average(this.cycleResultsNoOutliers)}},{key:"standardDeviation",get:function get(){return standardDeviation(this.cycleResults)}},{key:"variance",get:function get(){return this.standardDeviation/this.meanOpsPerSec}/**
|
|
239
|
+
* Returns the mean ops / s ± variance % as a string.
|
|
240
|
+
*/},{key:"meanOpsStr",get:function get(){var mean=this.meanOpsPerSec.toLocaleString(void 0,{maximumSignificantDigits:4});var variance=this.variance.toLocaleString(void 0,{style:"percent"});return"".concat(mean," \xB1").concat(variance)}},{key:"add",value:function add(cycle){var opsPerSecond=cycle.ops/cycle.duration;var index=this.cycleResults.findIndex(function(value){return opsPerSecond<value});if(index<0)index=this.cycleResults.length;this.cycleResults.splice(index,0,opsPerSecond);this._totalSamples+=cycle.ops}},{key:"toString",value:function toString(){if(!this.cycleResults.length)return"No results";return"".concat(this.name,": ").concat(this.meanOpsStr," ops/sec")}}])}();var RunResultsComparison=/*#__PURE__*/function(){function RunResultsComparison(name,results){_classCallCheck(this,RunResultsComparison);__publicField(this,"name",name);/**
|
|
241
|
+
* Sorted by median ops/s from slowest to fastest.
|
|
242
|
+
*/__publicField(this,"results");this.results=results.sort(function(a,b){return a.meanOpsPerSec-b.meanOpsPerSec})}return _createClass(RunResultsComparison,[{key:"logToTable",value:function logToTable(){var _this0=this;var r=this.results.map(function(run){var variance=run.variance.toLocaleString(void 0,{style:"percent"});var mean=run.meanOpsPerSec.toLocaleString(void 0,{maximumSignificantDigits:4});return{Name:run.name,Mean:"".concat(mean," \xB1").concat(variance),Samples:run.totalSamples,Compare:_this0.runComparisonToString(run)}});var table=r.reduce(function(acc,_a){var _b=_a,Name=_b.Name,x=__objRest(_b,["Name"]);acc[Name]=x;return acc},{});console.log("\n"+this.name);console.table(table)}},{key:"runComparisonToString",value:function runComparisonToString(run){var _a,_b;var baseline=(_b=(_a=this.results[0])==null?void 0:_a.meanOpsPerSec)!=null?_b:0;var fasterPercent=run.meanOpsPerSec/baseline-1;return fasterPercent<0.01?"-":fasterPercent.toLocaleString(void 0,{style:"percent"})+" faster"}}])}();function compareResults(name){for(var _len5=arguments.length,results=new Array(_len5>1?_len5-1:0),_key5=1;_key5<_len5;_key5++){results[_key5-1]=arguments[_key5]}return new RunResultsComparison(name,results)}var defaultBenchmarkOptions={warmupTime:0.5,maxCycleDuration:0.5,cycles:9};var _Benchmark=/*#__PURE__*/function(){/**
|
|
243
|
+
* Constructs a new Benchmark.
|
|
244
|
+
*
|
|
245
|
+
* @param name The name of the benchmark, to be used when logging.
|
|
246
|
+
* @param executor The method to execute and measure. If this method returns a promise, the
|
|
247
|
+
* promise will be awaited. The executor should either always return a promise, or never.
|
|
248
|
+
* @param options Optional configuration for the benchmark.
|
|
249
|
+
*/function _Benchmark(name,executor,options){_classCallCheck(this,_Benchmark);__publicField(this,"name",name);__publicField(this,"executor",executor);__publicField(this,"options");this.options=__spreadValues(__spreadValues({},defaultBenchmarkOptions),options)}return _createClass(_Benchmark,[{key:"run",value:function(){var _run=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(){var _this1=this;var opts,warmupTimeMs,cycleStart,isAsync,result,resultsPromise;return _regenerator().w(function(_context2){while(1)switch(_context2.n){case 0:opts=this.options;_context2.n=1;return _Benchmark.semaphore;case 1:warmupTimeMs=opts.warmupTime*1e3;cycleStart=now();isAsync=false;case 2:result=this.executor();isAsync=isAsync||result&&typeof result.then==="function";if(!isAsync){_context2.n=3;break}_context2.n=3;return result;case 3:if(now()-cycleStart<warmupTimeMs){_context2.n=2;break}case 4:resultsPromise=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(){var results,i,cycleResults;return _regenerator().w(function(_context){while(1)switch(_context.n){case 0:results=new BenchmarkRunResults(_this1.name);i=0;case 1:if(!(i<opts.cycles)){_context.n=4;break}_context.n=2;return _this1.runCycle(isAsync);case 2:cycleResults=_context.v;results.add(cycleResults);_context.n=3;return nextFrame();case 3:i++;_context.n=1;break;case 4:return _context.a(2,results)}},_callee)}))();_Benchmark.semaphore=resultsPromise;_context2.n=5;return resultsPromise;case 5:return _context2.a(2,_context2.v)}},_callee2,this)}));function run(){return _run.apply(this,arguments)}return run}()/**
|
|
250
|
+
* Runs one cycle. A cycle will repeat the executor approximately `options.maxCycleDuration`
|
|
251
|
+
* seconds.
|
|
252
|
+
*
|
|
253
|
+
* @param isAsync
|
|
254
|
+
* @return Returns the duration (in seconds) and number of operations the cycle repeated.
|
|
255
|
+
*/},{key:"runCycle",value:(function(){var _runCycle=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(isAsync){var cycleMs,ops,cycleStart,result,duration;return _regenerator().w(function(_context3){while(1)switch(_context3.n){case 0:cycleMs=this.options.maxCycleDuration*1e3;ops=0;cycleStart=now();case 1:result=this.executor();if(!isAsync){_context3.n=2;break}_context3.n=2;return result;case 2:ops++;case 3:if(now()-cycleStart<cycleMs){_context3.n=1;break}case 4:duration=(now()-cycleStart)/1e3;return _context3.a(2,{duration:duration,ops:ops})}},_callee3,this)}));function runCycle(_x){return _runCycle.apply(this,arguments)}return runCycle}())}])}();__publicField(_Benchmark,"semaphore",nextFrame());var Benchmark=_Benchmark;function benchmark(name,executor,options){var benchmark2=new Benchmark(name,executor,options);return benchmark2.run().then(function(results){console.log(results.toString());return results})}function nextFrame(){return new Promise(function(resolve){setTimeout(resolve)})}function standardDeviation(values){var avg=average(values);var squareDiffs=values.map(function(value){var diff=value-avg;return diff*diff});var avgSquareDiff=average(squareDiffs);return Math.sqrt(avgSquareDiff)}function average(values){var sum=values.reduce(function(acc,value){return acc+value},0);return sum/values.length}// test/browserTestUtil/env/jasmineEnv.ts
|
|
256
|
+
var nextTestTimeoutOverridden=false;function setTestTimeout(timeout){var originalTimeout=null;beforeEach(function(){originalTimeout=jasmine.DEFAULT_TIMEOUT_INTERVAL;if(!nextTestTimeoutOverridden)jasmine.DEFAULT_TIMEOUT_INTERVAL=timeout*1e3});afterEach(function(){if(originalTimeout)jasmine.DEFAULT_TIMEOUT_INTERVAL=originalTimeout;if(nextTestTimeoutOverridden)nextTestTimeoutOverridden=false})}// test/browserTestUtil/expect/expectNothing.ts
|
|
257
|
+
function expectNothing(){expect(true).toBeTruthy()}// test/browserTestUtil/mock/createSpyFactory.ts
|
|
258
|
+
var createSpy=jasmine.createSpy;function createSpy2(key){return createSpy(String(key))}// test/browserTestUtil/mock/dom/lib.dom.ts
|
|
259
|
+
var MockAbortSignal=/*#__PURE__*/_createClass(function MockAbortSignal(){_classCallCheck(this,MockAbortSignal);__publicField(this,"aborted",false);__publicField(this,"onabort",null);__publicField(this,"reason");__publicField(this,"throwIfAborted",createSpy2("throwIfAborted"));__publicField(this,"addEventListener",createSpy2("addEventListener"));__publicField(this,"removeEventListener",createSpy2("removeEventListener"));__publicField(this,"dispatchEvent",createSpy2("dispatchEvent"))});var MockMediaSource=/*#__PURE__*/_createClass(function MockMediaSource(){_classCallCheck(this,MockMediaSource);__publicField(this,"activeSourceBuffers");__publicField(this,"duration",0);__publicField(this,"onsourceclose",null);__publicField(this,"onsourceended",null);__publicField(this,"onsourceopen",null);__publicField(this,"readyState","closed");__publicField(this,"sourceBuffers");__publicField(this,"addSourceBuffer",createSpy2("addSourceBuffer"));__publicField(this,"clearLiveSeekableRange",createSpy2("clearLiveSeekableRange"));__publicField(this,"endOfStream",createSpy2("endOfStream"));__publicField(this,"removeSourceBuffer",createSpy2("removeSourceBuffer"));__publicField(this,"setLiveSeekableRange",createSpy2("setLiveSeekableRange"));__publicField(this,"addEventListener",createSpy2("addEventListener"));__publicField(this,"removeEventListener",createSpy2("removeEventListener"));__publicField(this,"dispatchEvent",createSpy2("dispatchEvent"))});// test/browserTestUtil/mock/dom/globals.ts
|
|
260
|
+
var MockMediaSourceGlobal=/*#__PURE__*/function(_MockMediaSource){function MockMediaSourceGlobal(){_classCallCheck(this,MockMediaSourceGlobal);return _callSuper(this,MockMediaSourceGlobal,arguments)}_inherits(MockMediaSourceGlobal,_MockMediaSource);return _createClass(MockMediaSourceGlobal)}(MockMediaSource);__publicField(MockMediaSourceGlobal,"canConstructInDedicatedWorker",false);__publicField(MockMediaSourceGlobal,"isTypeSupported",createSpy2("isTypeSupported"));var MockAbortSignalGlobal=/*#__PURE__*/function(_MockAbortSignal){function MockAbortSignalGlobal(){_classCallCheck(this,MockAbortSignalGlobal);return _callSuper(this,MockAbortSignalGlobal,arguments)}_inherits(MockAbortSignalGlobal,_MockAbortSignal);return _createClass(MockAbortSignalGlobal)}(MockAbortSignal);__publicField(MockAbortSignalGlobal,"abort",createSpy2("abort"));__publicField(MockAbortSignalGlobal,"any",createSpy2("any"));__publicField(MockAbortSignalGlobal,"timeout",createSpy2("timeout"));// test/benchmark/setup.ts
|
|
261
|
+
function setupBenchmark(){setTestTimeout(180);afterEach(expectNothing)}var comparisons=[];function addComparison(comparison){comparisons.push(comparison)}function addBenchmarks(name){for(var _len6=arguments.length,results=new Array(_len6>1?_len6-1:0),_key6=1;_key6<_len6;_key6++){results[_key6-1]=arguments[_key6]}var comparison=compareResults.apply(void 0,[name].concat(results));comparison.logToTable();comparisons.push(comparison)}if(typeof document!=="undefined"){jasmine.getEnv().addReporter({jasmineDone:function jasmineDone(){var _a;console.log("Tests complete");var jasmineContainer=document.getElementsByClassName("jasmine_html-reporter")[0];(_a=jasmineContainer.parentElement)==null?void 0:_a.removeChild(jasmineContainer);var container=createEl("div",document.body);container.id="benchmarkResults";var sortedComparisons=[].concat(comparisons).sort(function(a,b){return a.name>b.name?1:-1});var _iterator10=_createForOfIteratorHelper(sortedComparisons),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var comparison=_step10.value;toTableHtml(comparison,container)}}catch(err){_iterator10.e(err)}finally{_iterator10.f()}}})}function toTableHtml(comparison,parent){var container=createEl("div",parent);container.className="benchmarkComparison";var title=createEl("h2",container);title.innerText=comparison.name;var table=createEl("table",container);var head=createEl("thead",table);var headRow=createEl("tr",head);var name=createEl("th",headRow);name.innerText="Name";var median=createEl("th",headRow);median.innerText="Mean ops/s";var samples=createEl("th",headRow);samples.innerText="Samples";var compare=createEl("th",headRow);compare.innerText="% Comparison";var body=createEl("tbody",table);comparison.results.forEach(function(result){var row=createEl("tr",body);createEl("th",row).innerText=result.name;createEl("td",row).innerText=result.meanOpsStr;createEl("td",row).innerText=result.totalSamples.toLocaleString();createEl("td",row).innerText=comparison.runComparisonToString(result)});return container}function createEl(tagName,parent,options){var element=document.createElement(tagName,options);if(parent)parent.appendChild(element);return element}// test/benchmark/logging/Logging.bench.ts
|
|
262
|
+
describe("Logging",function(){setupBenchmark();it("logDebug",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(){var target,results;return _regenerator().w(function(_context4){while(1)switch(_context4.n){case 0:target={logPrefix:"path"};_context4.n=1;return benchmark("logDebug",function(){logDebug(target,{requestInfo:{fetchId:"lgn9lrwaid8o3utd5r",init:{method:"POST",headers:{"Content-Encoding":"amz-1.0","Content-Type":"application/json","X-Amz-Target":"com.amazon.digitalmusiclocator.DigitalMusicLocatorServiceExternal.getStreamingURLs"},body:"{\"contentIdList\":[{\"identifier\":\"d9e4e337-97ba-41a9-9f31-84a8bf99f1dc\",\"identifierType\":\"COID\"}],\"bitRate\":\"HIGH\",\"deviceToken\":{\"deviceId\":\"lg4msezd1e355heuc5b\",\"deviceTypeId\":\"A16ZV8BU3SN1N3\"},\"appMetadata\":{\"appId\":\"WebCP\",\"https\":true,\"appVersion\":\"1.0.0\"},\"clientMetadata\":{\"clientId\":\"WebCP\",\"clientRequestId\":\"lgn9lrw623mgvi7k3et\"}}",signal:"[object AbortSignal]"},input:"https://example.com/bar/",maxRetries:1,timestamp:/* @__PURE__ */new Date("2023-04-19T05:40:17.914Z"),fetchOptions:{serviceId:null,readErrorBody:1}},attemptInfo:{currentTry:1,timestamp:/* @__PURE__ */new Date("2023-04-19T05:40:17.914Z")},target:"[object FetchProviderImpl]"})});case 1:results=_context4.v;addBenchmarks("logDebug",results);case 2:return _context4.a(2)}},_callee4)})))});// test/benchmark/util/collection/LinkedList.bench.ts
|
|
263
|
+
describe("LinkedList",function(){setupBenchmark();function createList(n){var list=new LinkedList;for(var i=0;i<n;i++){list.push({r:0,a:Math.random(),b:Math.random()})}return list}function createArray(n){var arr=[];for(var i=0;i<n;i++){arr.push({r:0,a:Math.random(),b:Math.random()})}return arr};[100,1e3].forEach(function(size){var list=createList(size);var arr=createArray(size);describe("size: ".concat(size),function(){it("forEach",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(){var name,listResults,arrayResults;return _regenerator().w(function(_context5){while(1)switch(_context5.n){case 0:name="forEach ".concat(size);_context5.n=1;return benchmark("LinkedList ".concat(name),function(){list.forEach(function(e){return e.r=e.a+e.b})});case 1:listResults=_context5.v;_context5.n=2;return benchmark("Array ".concat(name),function(){arr.forEach(function(e){return e.r=e.a+e.b})});case 2:arrayResults=_context5.v;addBenchmarks(name,listResults,arrayResults);case 3:return _context5.a(2)}},_callee5)})));it("unshift",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(){var name,e,listResults,arrayResults;return _regenerator().w(function(_context6){while(1)switch(_context6.n){case 0:name="unshift/shift ".concat(size);e={r:0,a:0,b:0};_context6.n=1;return benchmark("LinkedList ".concat(name),function(){list.unshift(e);list.shift()});case 1:listResults=_context6.v;_context6.n=2;return benchmark("Array ".concat(name),function(){arr.unshift(e);arr.shift()});case 2:arrayResults=_context6.v;addBenchmarks(name,listResults,arrayResults);case 3:return _context6.a(2)}},_callee6)})));it("push",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(){var name,e,listResults,arrayResults;return _regenerator().w(function(_context7){while(1)switch(_context7.n){case 0:name="push/pop ".concat(size);e={r:0,a:0,b:0};_context7.n=1;return benchmark("LinkedList ".concat(name),function(){list.push(e);list.pop()});case 1:listResults=_context7.v;_context7.n=2;return benchmark("Array ".concat(name),function(){arr.push(e);arr.pop()});case 2:arrayResults=_context7.v;addBenchmarks(name,listResults,arrayResults);case 3:return _context7.a(2)}},_callee7)})));it("for of",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(){var name,listResults,arrayResults;return _regenerator().w(function(_context8){while(1)switch(_context8.n){case 0:name="for of ".concat(size);_context8.n=1;return benchmark("LinkedList ".concat(name),function(){var _iterator11=_createForOfIteratorHelper(list),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var e=_step11.value;e.r=e.a+e.b}}catch(err){_iterator11.e(err)}finally{_iterator11.f()}});case 1:listResults=_context8.v;_context8.n=2;return benchmark("Array ".concat(name),function(){var _iterator12=_createForOfIteratorHelper(arr),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var e=_step12.value;e.r=e.a+e.b}}catch(err){_iterator12.e(err)}finally{_iterator12.f()}});case 2:arrayResults=_context8.v;addBenchmarks(name,listResults,arrayResults);case 3:return _context8.a(2)}},_callee8)})))})})});// test/benchmark/util/object/mergeDeep.bench.ts
|
|
264
|
+
describe("mergeDeep",function(){setupBenchmark();it("object merge",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(){var a,b,mergeResultsDeep;return _regenerator().w(function(_context9){while(1)switch(_context9.n){case 0:a={b:{c:3,d:4,e:"test"},f:{g:5,h:true,i:false},j:{k:{m:5}}};b={b:{d:4,f2:"test2"},f:{g:5,h:true,i:false},j:{k:{m:5}}};_context9.n=1;return benchmark("mergeDeep",function(){mergeDeep([a,b])});case 1:mergeResultsDeep=_context9.v;addBenchmarks("merge deep",mergeResultsDeep);case 2:return _context9.a(2)}},_callee9)})))});// test/benchmark/util/serialization/toJson.bench.ts
|
|
265
|
+
describe("json",function(){setupBenchmark();it("toJson",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(){var results;return _regenerator().w(function(_context0){while(1)switch(_context0.n){case 0:_context0.n=1;return benchmark("toJson",function(){toJson({requestInfo:{fetchId:"lgn9lrwaid8o3utd5r",init:{method:"POST",headers:{"Content-Encoding":"amz-1.0","Content-Type":"application/json","X-Amz-Target":"com.amazon.digitalmusiclocator.DigitalMusicLocatorServiceExternal.getStreamingURLs"},body:"{\"contentIdList\":[{\"identifier\":\"d9e4e337-97ba-41a9-9f31-84a8bf99f1dc\",\"identifierType\":\"COID\"}],\"bitRate\":\"HIGH\",\"deviceToken\":{\"deviceId\":\"lg4msezd1e355heuc5b\",\"deviceTypeId\":\"A16ZV8BU3SN1N3\"},\"appMetadata\":{\"appId\":\"WebCP\",\"https\":true,\"appVersion\":\"1.0.0\"},\"clientMetadata\":{\"clientId\":\"WebCP\",\"clientRequestId\":\"lgn9lrw623mgvi7k3et\"}}",signal:"[object AbortSignal]"},input:"https://example.com/bar/",maxRetries:1,timestamp:/* @__PURE__ */new Date("2023-04-19T05:40:17.914Z"),requestOptions:{serviceId:null,readErrorBody:1}},attemptInfo:{currentTry:1,timestamp:/* @__PURE__ */new Date("2023-04-19T05:40:17.914Z")},target:"[object FetchProviderImpl]"})});case 1:results=_context0.v;addBenchmarks("toJson",results);case 2:return _context0.a(2)}},_callee0)})))});// test/benchmark/util/url/resolveUrl.bench.ts
|
|
266
|
+
describe("resolveUrl",function(){setupBenchmark();it("relative path",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(){var name,base,relative,resolveUrlResults,newUrlResults;return _regenerator().w(function(_context1){while(1)switch(_context1.n){case 0:name="relative path";base="https://cdn.example.com/content/audio/";relative="segment_001.mp4";_context1.n=1;return benchmark("resolveUrl ".concat(name),function(){var _o=resolveUrl(relative,base)});case 1:resolveUrlResults=_context1.v;_context1.n=2;return benchmark("new URL ".concat(name),function(){var _o=new URL(relative,base).href});case 2:newUrlResults=_context1.v;addBenchmarks(name,resolveUrlResults,newUrlResults);case 3:return _context1.a(2)}},_callee1)})));it("absolute URI",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(){var name,base,absolute,resolveUrlResults,newUrlResults;return _regenerator().w(function(_context10){while(1)switch(_context10.n){case 0:name="absolute URI";base="https://cdn.example.com/content/audio/";absolute="https://other.example.com/segment.mp4";_context10.n=1;return benchmark("resolveUrl ".concat(name),function(){var _o=resolveUrl(absolute,base)});case 1:resolveUrlResults=_context10.v;_context10.n=2;return benchmark("new URL ".concat(name),function(){var _o=new URL(absolute,base).href});case 2:newUrlResults=_context10.v;addBenchmarks(name,resolveUrlResults,newUrlResults);case 3:return _context10.a(2)}},_callee10)})));it("dot segments",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(){var name,base,relative,resolveUrlResults,newUrlResults;return _regenerator().w(function(_context11){while(1)switch(_context11.n){case 0:name="dot segments";base="https://cdn.example.com/a/b/c/manifest.mpd";relative="../../media/segment.mp4";_context11.n=1;return benchmark("resolveUrl ".concat(name),function(){var _o=resolveUrl(relative,base)});case 1:resolveUrlResults=_context11.v;_context11.n=2;return benchmark("new URL ".concat(name),function(){var _o=new URL(relative,base).href});case 2:newUrlResults=_context11.v;addBenchmarks(name,resolveUrlResults,newUrlResults);case 3:return _context11.a(2)}},_callee11)})));it("chained resolution (DASH BaseURL walk)",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(){var name,manifest,scopes,segment,resolveUrlResults,newUrlResults;return _regenerator().w(function(_context12){while(1)switch(_context12.n){case 0:name="chained resolution";manifest="https://cdn.example.com/manifest.mpd";scopes=["content/","audio/","128k/"];segment="seg_001.m4s";_context12.n=1;return benchmark("resolveUrl ".concat(name),function(){var resolved=manifest;for(var _i2=0,_scopes=scopes;_i2<_scopes.length;_i2++){var scope=_scopes[_i2];resolved=resolveUrl(scope,resolved)}resolveUrl(segment,resolved)});case 1:resolveUrlResults=_context12.v;_context12.n=2;return benchmark("new URL ".concat(name),function(){var resolved=new URL(manifest);for(var _i3=0,_scopes2=scopes;_i3<_scopes2.length;_i3++){var scope=_scopes2[_i3];resolved=new URL(scope,resolved)}var _o=new URL(segment,resolved).href});case 2:newUrlResults=_context12.v;addBenchmarks(name,resolveUrlResults,newUrlResults);case 3:return _context12.a(2)}},_callee12)})))})})();
|