{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","network.js","../lib/EventDispatcher.js","../lib/Http/BandwidthModule.js","../lib/Http/HttpModule.js","../lib/Http/LatencyModule.js","../lib/Network.js","../lib/Timing.js","../utils/decorators.js","../utils/helpers.js"],"names":["f","exports","module","define","amd","g","window","global","self","this","Network","e","t","n","r","s","o","u","a","require","i","Error","code","l","call","length",1,"_classCallCheck","instance","Constructor","TypeError","_defineDecoratedPropertyDescriptor","target","key","descriptors","_descriptor","descriptor","_key","value","initializer","Object","defineProperty","_createDecoratedClass","defineProperties","initializers","decorators","enumerable","configurable","writable","decorator","undefined","protoProps","staticProps","protoInitializers","staticInitializers","prototype","_utilsDecorators","EventDispatcher","_instanceInitializers","events","callback","_this","Array","isArray","forEach","event","eventCallbacks","_eventCallbacks","indexOf","push","_this2","arguments","callbackIndex","splice","_len","extraParameters","_key2","returnValue","eventCallback","apply","../utils/decorators",2,"_interopRequireDefault","obj","__esModule","default","_inherits","subClass","superClass","create","constructor","setPrototypeOf","__proto__","_get","_x2","_x3","_x4","_again","object","property","receiver","desc","parent","getter","Function","getOwnPropertyDescriptor","get","getPrototypeOf","_HttpModule2","_HttpModule3","_Timing","_Timing2","_utilsHelpers","BandwidthModule","_HttpModule","loadingType","settings","_extendDefaultSettings","data","size","multiplier","_loadingType","on","mark","_timingLabels","start","xhr","_started","readyState","XMLHttpRequest","LOADING","eventsPrefix","_progress","_timeout","_end","progress","end","measure","dataSettings","reqID","_requestID","_intendedEnd","_lastLoadedValue","_speedRecords","_firstProgress","_deferredProgress","defer","_isRestarting","trigger","labels","blob","Blob","ArrayBuffer","type","_newRequest","_sendRequest","_abort","run","progressID","_progressID","markLabel","loaded","instantSpeed","avgMeasure","avgSpeed","instantMeasure","_avgSpeed","../../utils/decorators","../../utils/helpers","../Timing","./HttpModule",3,"_x5","_x6","_EventDispatcher2","_EventDispatcher3","HttpModule","_EventDispatcher","moduleName","endpoint","delay","_moduleName","_requestingOverridden","_requesting","_settings","isObject","assignStrict","_defaultSettings","copy","assign","httpMethod","queryParams","console","warn","validHttpMethods","tokenSuffix","Date","getTime","_lastURLToken","url","keys","param","encodeURIComponent","open","_xhr","OPENED","abort","eventType","addEventListener","args","concat","upload","_len2","_key3","startTimeout","setTimeout","UNSENT","DONE","timeoutStarted","send","lastURLToken","entries","performance","getEntriesByType","filter","entry","name","isRequesting","../EventDispatcher",4,"_x7","LatencyModule","measures","attempts","supportsResourceTiming","_measure","except","_settings2","_requestsLeft","_attemptsLeft","_setRequesting","_latencies","_nextRequest","retry","requestsLeft","_this3","HEADERS_RECEIVED","latency","_getTimingEntry","secureConnectionStart","connectStart","connectEnd","latencies","avgLatency","reduce","b","_settings3","join",5,"_defineProperty","_HttpHttpModule","_HttpHttpModule2","_HttpLatencyModule","_HttpLatencyModule2","_HttpBandwidthModule","_HttpBandwidthModule2","_registerModule","_initModules","getGlobalObject","classes","Timing","moduleNames","_modules","_ret","globalSettings","localSettings","_modulesInitialized","_pendingSettings","v","requesting","_name","hasOwnProperty","moduleCallback","../utils/helpers","./EventDispatcher","./Http/BandwidthModule","./Http/HttpModule","./Http/LatencyModule","./Timing",6,"_support","userTiming","resourceTiming","timing","label","support","marks","_marks","now","measureLabel","markLabelA","markLabelB","_measures","measureWithoutUserTiming","entriesByName","getEntriesByName","duration",7,"isEnumerable",8,"valueOf","JSON","parse","stringify","_assign","strict","sources","source","_len3","properties","objCopy","index","func","_class","_createClass","props"],"mappings":"CAAA,SAAAA,GAAA,GAAA,gBAAAC,UAAA,mBAAAC,QAAAA,OAAAD,QAAAD,QAAA,IAAA,kBAAAG,SAAAA,OAAAC,IAAAD,UAAAH,OAAA,CAAA,GAAAK,EAAAA,GAAA,mBAAAC,QAAAA,OAAA,mBAAAC,QAAAA,OAAA,mBAAAC,MAAAA,KAAAC,KAAAJ,EAAAK,QAAAV,MAAA,WAAA,MAAA,SAAAW,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAC,GAAA,IAA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AASzR,GAAiBX,EAAQqS,GAAS,IAAK,GAAIjT,GAAI,EAAGA,EAAIiT,EAAM5S,OAAQL,IAAK,CAAE,GAAIgB,GAAaiS,EAAMjT,EAAIgB,GAAWU,WAAaV,EAAWU,aAAc,EAAOV,EAAWW,cAAe,EAAU,SAAWX,KAAYA,EAAWY,UAAW,GAAMR,OAAOC,eAAeT,EAAQI,EAAWH,IAAKG,IAAiB,MAAO,UAAUP,EAAasB,EAAYC,GAAiJ,MAA9HD,IAAYR,EAAiBd,EAAY0B,UAAWJ,GAAiBC,GAAaT,EAAiBd,EAAauB,GAAqBvB,KAEjiB5B,GQ74DgB2Q,gBAAAA,ER84DhB3Q,EQz3DgBwL,SAAAA,ER03DhBxL,EQ92DgB2L,KAAAA,ER+2DhB3L,EQz0DgB4L,OAAAA,ER00DhB5L,EQ7zDgByL,aAAAA,ER8zDhBzL,EQjzDgB2O,OAAAA,ERkzDhB3O,EQlyDgBiJ,MAAAA,IR28Db1H,KAAKf,KAAuB,mBAAXF,QAAyBA,OAAyB,mBAATC,MAAuBA,KAAyB,mBAAXF,QAAyBA,qBAEhH,IAAI","file":"network.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})","(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.Network = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n    value: true\n});\n\nvar _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nfunction _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer.call(target); Object.defineProperty(target, key, descriptor); }\n\nvar _utilsDecorators = require('../utils/decorators');\n\n/**\n * A callback used as an event handler.\n * @public\n * @callback EventDispatcher~eventHandler\n * @param {...*} args The extra parameters provided to the `trigger` method.\n * @returns {?boolean} If `false` is explicitly returned, the `trigger` method will return `false`.\n */\n\n/**\n * @class EventDispatcher\n */\n\nvar EventDispatcher = (function () {\n    var _instanceInitializers = {};\n\n    function EventDispatcher() {\n        _classCallCheck(this, EventDispatcher);\n\n        _defineDecoratedPropertyDescriptor(this, '_eventCallbacks', _instanceInitializers);\n    }\n\n    _createDecoratedClass(EventDispatcher, [{\n        key: 'on',\n\n        /**\n         * Attach a callback to one or more events.\n         * @public\n         * @method EventDispatcher#on\n         * @param {string|string[]} events One or multiple event names.\n         * @param {EventDispatcher~eventHandler} callback An event handler.\n         * @returns {EventDispatcher}\n         */\n        value: function on(events, callback) {\n            var _this = this;\n\n            events = Array.isArray(events) ? events : [events];\n\n            events.forEach(function (event) {\n                var eventCallbacks = _this._eventCallbacks[event] = _this._eventCallbacks[event] || [];\n\n                // If the callback isn't already registered, store it.\n                if (! ~eventCallbacks.indexOf(callback)) {\n                    eventCallbacks.push(callback);\n                }\n            });\n\n            return this;\n        }\n\n        /**\n         * Detach a callback from one or more events.\n         * @public\n         * @method EventDispatcher#off\n         * @param {string|string[]} events One or multiple event names.\n         * @param {EventDispatcher~eventHandler} callback An event handler.\n         * @returns {EventDispatcher}\n         */\n    }, {\n        key: 'off',\n        value: function off(events) {\n            var _this2 = this;\n\n            var callback = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n            events = Array.isArray(events) ? events : [events];\n\n            events.forEach(function (event) {\n                var eventCallbacks = _this2._eventCallbacks[event];\n\n                // If there is no specified callback, simply delete all the callbacks binded to the provided event.\n                if (!callback && eventCallbacks) {\n                    delete _this2._eventCallbacks[event];\n                } else {\n                    var callbackIndex = eventCallbacks ? eventCallbacks.indexOf(callback) : -1;\n\n                    // If the callback is registered, remove it from the array.\n                    if (callbackIndex != -1) {\n                        eventCallbacks.splice(callbackIndex, 1);\n                    }\n                }\n            });\n\n            return this;\n        }\n\n        /**\n         * Trigger an event.\n         * @public\n         * @method EventDispatcher#trigger\n         * @param {string} event An event name.\n         * @param {...*} extraParameters Some extra parameters to pass to the event handlers.\n         * @returns {boolean} Returns `false` if one of the event handlers explicitly returned `false`.\n         */\n    }, {\n        key: 'trigger',\n        value: function trigger(event) {\n            for (var _len = arguments.length, extraParameters = Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) {\n                extraParameters[_key2 - 1] = arguments[_key2];\n            }\n\n            var eventCallbacks = this._eventCallbacks[event] || [];\n\n            // A callback can return a boolean value which will be logically compared to the other callbacks values before\n            // being returned by the trigger() method. This allows a callback to send a \"signal\" to the caller, like\n            // cancelling an action.\n            var returnValue = true;\n\n            eventCallbacks.forEach(function (eventCallback) {\n                // A callback must explicitly return false if it wants the trigger() method to return false, undefined will\n                // not work. This avoids crappy callbacks to mess up with the triggering system.\n                var value = eventCallback.apply(undefined, extraParameters);\n                value = value !== false ? true : false;\n\n                returnValue = returnValue && value; // Compare the result of the callback to the actual return value\n            });\n\n            return returnValue;\n        }\n    }, {\n        key: '_eventCallbacks',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return {};\n        },\n        enumerable: true\n    }], null, _instanceInitializers);\n\n    return EventDispatcher;\n})();\n\nexports['default'] = EventDispatcher;\nmodule.exports = exports['default'];\n\n/**\n * All the registered event callbacks, organized by events.\n * @private\n * @member {Object} EventDispatcher#_eventCallbacks\n */\n\n},{\"../utils/decorators\":7}],2:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n    value: true\n});\n\nvar _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })();\n\nvar _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer.call(target); Object.defineProperty(target, key, descriptor); }\n\nvar _HttpModule2 = require('./HttpModule');\n\nvar _HttpModule3 = _interopRequireDefault(_HttpModule2);\n\nvar _Timing = require('../Timing');\n\nvar _Timing2 = _interopRequireDefault(_Timing);\n\nvar _utilsHelpers = require('../../utils/helpers');\n\nvar _utilsDecorators = require('../../utils/decorators');\n\n/**\n * @public\n * @typedef {Object} BandwidthModule~settingsObject\n * @extends HttpModule~settingsObject\n * @property {Object} data\n * @property {number} data.size The amount of data to initially use.\n * @property {number} [data.multiplier=2] If the measure period can't reach the delay defined in the settings, the data amount is multiplied by the following value.\n */\n\n/**\n * Apply a new set of custom settings.\n * @public\n * @method BandwidthModule#settings\n * @param {BandwidthModule~settingsObject} settings A set of custom settings.\n * @returns {BandwidthModule}\n */\n/**\n * Return the current set of settings.\n * @public\n * @method BandwidthModule#settings^2\n * @returns {BandwidthModule~settingsObject}\n */\n\n/**\n * @class BandwidthModule\n * @extends HttpModule\n * @param {string} loadingType The loading type, `upload` or `download`.\n * @param {BandwidthModule~settingsObject} [settings={}] A set of custom settings.\n */\n\nvar BandwidthModule = (function (_HttpModule) {\n    var _instanceInitializers = {};\n    var _instanceInitializers = {};\n\n    _inherits(BandwidthModule, _HttpModule);\n\n    _createDecoratedClass(BandwidthModule, [{\n        key: '_loadingType',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return undefined;\n        },\n\n        /**\n         *\n         * @private\n         * @member {boolean} BandwidthModule#_intendedEnd\n         */\n        enumerable: true\n    }, {\n        key: '_intendedEnd',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return false;\n        },\n\n        /**\n         *\n         * @private\n         * @member {boolean} BandwidthModule#_isRestarting\n         */\n        enumerable: true\n    }, {\n        key: '_isRestarting',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return false;\n        },\n\n        /**\n         * Tracks the value of the `loaded` property for each progress event.\n         * @private\n         * @member {?number} BandwidthModule#_lastLoadedValue\n         */\n        enumerable: true\n    }, {\n        key: '_lastLoadedValue',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return null;\n        },\n\n        /**\n         * The recorded measures of speed.\n         * @private\n         * @member {number[]} BandwidthModule#_speedRecords\n         */\n        enumerable: true\n    }, {\n        key: '_speedRecords',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return [];\n        },\n\n        /**\n         * The average speed.\n         * @private\n         * @member {number} BandwidthModule#_avgSpeed\n         */\n        enumerable: true\n    }, {\n        key: '_avgSpeed',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return undefined;\n        },\n\n        /**\n         * The ID of the current request.\n         * @private\n         * @member {number} BandwidthModule#_requestID\n         */\n        enumerable: true\n    }, {\n        key: '_requestID',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return 0;\n        },\n\n        /**\n         * The ID of the current progress event.\n         * @private\n         * @member {number} BandwidthModule#_progressID\n         */\n        enumerable: true\n    }, {\n        key: '_progressID',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return 0;\n        },\n\n        /**\n         * Defines if measures have started.\n         * @private\n         * @member {boolean} BandwidthModule#_started\n         */\n        enumerable: true\n    }, {\n        key: '_started',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return false;\n        },\n\n        /**\n         * Defines if the current progress event is the first one triggered for the current request.\n         * @private\n         * @member {boolean} BandwidthModule#_firstProgress\n         */\n        enumerable: true\n    }, {\n        key: '_firstProgress',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return true;\n        },\n\n        /**\n         * @private\n         * @member {Defer} BandwidthModule#_deferredProgress\n         */\n        enumerable: true\n    }, {\n        key: '_deferredProgress',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return undefined;\n        },\n\n        /**\n         * Unique labels for each request, exclusively used to make measures.\n         * @private\n         * @member {Object} BandwidthModule#_timingLabels\n         * @property {?string} start\n         * @property {?string} progress\n         * @property {?string} end\n         * @property {?string} measure\n         */\n        enumerable: true\n    }, {\n        key: '_timingLabels',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return {\n                start: null,\n                progress: null,\n                end: null,\n                measure: null\n            };\n        },\n        enumerable: true\n    }], null, _instanceInitializers);\n\n    function BandwidthModule(loadingType) {\n        var _this = this;\n\n        var settings = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n        _classCallCheck(this, BandwidthModule);\n\n        loadingType = ~['upload', 'download'].indexOf(loadingType) ? loadingType : 'download';\n\n        _get(Object.getPrototypeOf(BandwidthModule.prototype), 'constructor', this).call(this, loadingType);\n\n        _defineDecoratedPropertyDescriptor(this, '_loadingType', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_intendedEnd', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_isRestarting', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_lastLoadedValue', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_speedRecords', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_avgSpeed', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_requestID', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_progressID', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_started', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_firstProgress', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_deferredProgress', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_timingLabels', _instanceInitializers);\n\n        this._extendDefaultSettings({\n            data: {\n                // 2 MB for upload, 10 MB for download\n                size: loadingType == 'upload' ? 2 * 1024 * 1024 : 10 * 1024 * 1024,\n                multiplier: 2\n            }\n        }).settings(settings);\n\n        this._loadingType = loadingType;\n\n        // Bind to XHR events\n        this.on('xhr-upload-loadstart', function () {\n            return _Timing2['default'].mark(_this._timingLabels.start);\n        });\n        this.on('xhr-readystatechange', function (xhr) {\n            if (!_this._started && xhr.readyState == XMLHttpRequest.LOADING) {\n                _Timing2['default'].mark(_this._timingLabels.start);\n                _this._started = true;\n            }\n        });\n\n        var eventsPrefix = loadingType == 'upload' ? 'xhr-upload' : 'xhr';\n\n        this.on(eventsPrefix + '-progress', function (xhr, event) {\n            return _this._progress(event);\n        });\n        this.on(eventsPrefix + '-timeout', function () {\n            return _this._timeout();\n        });\n        this.on(eventsPrefix + '-loadend', function () {\n            return _this._end();\n        });\n    }\n\n    /**\n     * Start requesting the server to make measures.\n     * @public\n     * @method BandwidthModule#start\n     * @returns {BandwidthModule}\n     */\n\n    _createDecoratedClass(BandwidthModule, [{\n        key: 'start',\n        value: function start() {\n            var loadingType = this._loadingType,\n                dataSettings = this.settings().data,\n                reqID = this._requestID++;\n\n            this._intendedEnd = false;\n            this._lastLoadedValue = null;\n            this._speedRecords = [];\n            this._started = false;\n            this._firstProgress = true;\n            this._deferredProgress = (0, _utilsHelpers.defer)();\n\n            // Trigger the start event\n            if (!this._isRestarting) {\n                this.trigger('start', dataSettings.size);\n            }\n\n            // Create unique timing labels for the new request\n            var labels = this._timingLabels;\n            labels.start = loadingType + '-' + reqID + '-start';\n            labels.progress = loadingType + '-' + reqID + '-progress';\n            labels.end = loadingType + '-' + reqID + '-end';\n            labels.measure = loadingType + '-' + reqID + '-measure';\n\n            // Generate some random data to upload to the server. Here we're using a Blob instead of an ArrayBuffer because\n            // of a bug in Chrome (tested in v33.0.1750.146), causing a freeze of the page while trying to directly upload\n            // an ArrayBuffer (through an ArrayBufferView). The freeze lasts nearly 4.5s for 10MB of data. Using a Blob\n            // seems to solve the problem.\n            var blob = loadingType == 'upload' ? new Blob([new ArrayBuffer(dataSettings.size)]) : null;\n\n            var type = loadingType == 'download' ? 'GET' : 'POST';\n\n            // Initiate and send a new request\n            this._newRequest(type, {\n                size: dataSettings.size\n            })._sendRequest(blob);\n\n            return this;\n        }\n\n        /**\n         * Abort the measures.\n         * @public\n         * @method BandwidthModule#abort\n         * @returns {BandwidthModule}\n         */\n    }, {\n        key: 'abort',\n        value: function abort() {\n            this._intendedEnd = true;\n            return this._abort();\n        }\n\n        /**\n         * Make bandwidth measures for the current request.\n         * @private\n         * @method BandwidthModule#_progress\n         * @param {ProgressEvent} event The event associated with the progress event of the current request.\n         * @returns {BandwidthModule}\n         */\n    }, {\n        key: '_progress',\n        value: function _progress(event) {\n            var _this2 = this;\n\n            // Ignore the first progress event, it generally contributes to get incoherent values.\n            if (this._firstProgress) return this._firstProgress = false;\n\n            // Execute the previous progress trigger\n            this._deferredProgress.run();\n\n            var labels = this._timingLabels,\n                progressID = this._progressID++,\n                markLabel = labels.progress + '-' + progressID,\n                loaded = event.loaded;\n\n            _Timing2['default'].mark(markLabel);\n\n            // Measure the average speed (B/s) since the request started\n            var avgMeasure = _Timing2['default'].measure(labels.measure + '-avg-' + progressID, labels.start, markLabel),\n                avgSpeed = loaded / avgMeasure * 1000;\n\n            var instantSpeed;\n\n            if (this._lastLoadedValue === null) {\n                // We are executing the first progress event of the current request\n                instantSpeed = avgSpeed; // The instant speed of the first progress event is equal to the average one\n            } else {\n                    // Measure the instant speed (B/s), which defines the speed between two progress events.\n                    var instantMeasure = _Timing2['default'].measure(labels.measure + '-instant-' + progressID,\n                    // Set the mark of the previous progress event as the starting point\n                    labels.progress + '-' + (progressID - 1), markLabel);\n                    instantSpeed = (loaded - this._lastLoadedValue) / instantMeasure * 1000;\n                }\n\n            // Save the `loaded` property of the event for the next progress event\n            this._lastLoadedValue = loaded;\n\n            // Defer measures saving and event triggering, this allows to cancel the last progress event, which can generate\n            // incoherent values.\n            this._deferredProgress = (0, _utilsHelpers.defer)(function () {\n                _this2._avgSpeed = avgSpeed;\n                _this2._speedRecords.push(instantSpeed);\n\n                _this2.trigger('progress', avgSpeed, instantSpeed);\n            });\n\n            return this;\n        }\n\n        /**\n         * Mark the current request as entirely finished (this means it ended after a time out).\n         * @private\n         * @method BandwidthModule#_timeout\n         * @returns {BandwidthModule}\n         */\n    }, {\n        key: '_timeout',\n        value: function _timeout() {\n            this._intendedEnd = true;\n            return this;\n        }\n\n        /**\n         * End the measures.\n         * @private\n         * @method BandwidthModule#_end\n         * @returns {BandwidthModule}\n         */\n    }, {\n        key: '_end',\n        value: function _end() {\n            // A timeout or an abort occured, bypass the further requests and trigger the \"end\" event.\n            if (this._intendedEnd) {\n                this._isRestarting = false;\n                this.trigger('end', this._avgSpeed, this._speedRecords);\n            }\n\n            // The request ended to early, restart it with an increased data size.\n            else {\n                    var dataSettings = this.settings().data,\n                        size = dataSettings.size * dataSettings.multiplier;\n\n                    this.settings({ data: { size: size } });\n                    this.trigger('restart', size);\n\n                    this._isRestarting = true;\n                    this.start();\n                }\n\n            return this;\n        }\n    }], null, _instanceInitializers);\n\n    return BandwidthModule;\n})(_HttpModule3['default']);\n\nexports['default'] = BandwidthModule;\nmodule.exports = exports['default'];\n\n/**\n *\n * @private\n * @member {string} BandwidthModule#_loadingType\n */\n\n},{\"../../utils/decorators\":7,\"../../utils/helpers\":8,\"../Timing\":6,\"./HttpModule\":3}],3:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n    value: true\n});\n\nvar _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })();\n\nvar _get = function get(_x4, _x5, _x6) { var _again = true; _function: while (_again) { var object = _x4, property = _x5, receiver = _x6; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x4 = parent; _x5 = property; _x6 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer.call(target); Object.defineProperty(target, key, descriptor); }\n\nvar _EventDispatcher2 = require('../EventDispatcher');\n\nvar _EventDispatcher3 = _interopRequireDefault(_EventDispatcher2);\n\nvar _utilsHelpers = require('../../utils/helpers');\n\nvar _utilsDecorators = require('../../utils/decorators');\n\n/**\n * @public\n * @typedef {Object} HttpModule~settingsObject\n * @property {string} [endpoint=./network.php] Where is located your `network.php` file.\n * @property {number} [delay=8000] The delay while you want to take measures.\n */\n\n/**\n * @class HttpModule\n * @extends EventDispatcher\n * @param {string} moduleName The name of the instanciated module.\n * @param {HttpModule~settingsObject} [settings={}] A set of custom settings.\n */\n\nvar HttpModule = (function (_EventDispatcher) {\n    var _instanceInitializers = {};\n    var _instanceInitializers = {};\n\n    _inherits(HttpModule, _EventDispatcher);\n\n    _createDecoratedClass(HttpModule, [{\n        key: '_defaultSettings',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return null;\n        },\n\n        /**\n         * The current settings.\n         * @private\n         * @member {?Object} HttpModule#_settings\n         */\n        enumerable: true\n    }, {\n        key: '_settings',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return null;\n        },\n\n        /**\n         * The module name, will be send to the server.\n         * @private\n         * @member {string} HttpModule#_moduleName\n         */\n        enumerable: true\n    }, {\n        key: '_moduleName',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return undefined;\n        },\n\n        /**\n         * The current XMLHttpRequest object.\n         * @private\n         * @member {?XMLHttpRequest} HttpModule#_xhr\n         */\n        enumerable: true\n    }, {\n        key: '_xhr',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return null;\n        },\n\n        /**\n         * An URL token to avoid any caching issues. Also allows to identify the request in the Resource Timing entries.\n         * @private\n         * @member {?string} HttpModule#_lastURLToken\n         */\n        enumerable: true\n    }, {\n        key: '_lastURLToken',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return null;\n        },\n\n        /**\n         * Defines if the module is currently running an HTTP request.\n         * @private\n         * @member {boolean} HttpModule#_requesting\n         */\n        enumerable: true\n    }, {\n        key: '_requesting',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return false;\n        },\n\n        /**\n         * Defines if the requesting status has been overridden by the `_setRequesting` method.\n         * @private\n         * @member {boolean} HttpModule#_requestingOverridden\n         */\n        enumerable: true\n    }, {\n        key: '_requestingOverridden',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return false;\n        },\n        enumerable: true\n    }], null, _instanceInitializers);\n\n    function HttpModule(moduleName) {\n        var _this = this;\n\n        var settings = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n        _classCallCheck(this, HttpModule);\n\n        _get(Object.getPrototypeOf(HttpModule.prototype), 'constructor', this).call(this);\n\n        _defineDecoratedPropertyDescriptor(this, '_defaultSettings', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_settings', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_moduleName', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_xhr', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_lastURLToken', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_requesting', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_requestingOverridden', _instanceInitializers);\n\n        this._extendDefaultSettings({\n            endpoint: './network.php',\n            delay: 8000\n        });\n\n        this.settings(settings);\n\n        this._moduleName = moduleName;\n\n        // Each time a request starts or ends, set the requesting value unless it has been overridden with the\n        // _setRequesting() method.\n        this.on(['xhr-loadstart', 'xhr-upload-loadstart'], function () {\n            if (!_this._requestingOverridden) {\n                _this._requesting = true;\n            }\n        });\n\n        this.on(['xhr-loadend', 'xhr-upload-loadend'], function () {\n            if (!_this._requestingOverridden) {\n                _this._requesting = false;\n            }\n        });\n    }\n\n    /**\n     * Apply a new set of custom settings.\n     * @public\n     * @method HttpModule#settings\n     * @param {HttpModule~settingsObject} settings A set of custom settings.\n     * @returns {HttpModule}\n     */\n    /**\n     * Return the current set of settings.\n     * @public\n     * @method HttpModule#settings^2\n     * @returns {HttpModule~settingsObject}\n     */\n\n    _createDecoratedClass(HttpModule, [{\n        key: 'settings',\n        value: function settings() {\n            var _settings = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];\n\n            if ((0, _utilsHelpers.isObject)(_settings)) {\n                this._settings = (0, _utilsHelpers.assignStrict)(this._defaultSettings || {}, this._settings || {}, _settings);\n                return this;\n            } else {\n                return (0, _utilsHelpers.copy)(this._settings || this._defaultSettings || {});\n            }\n        }\n\n        /**\n         * Return if the module is currently making a request.\n         * @public\n         * @method HttpModule#isRequesting\n         * @returns {boolean} `true` if the module is requesting, otherwise `false`.\n         */\n    }, {\n        key: 'isRequesting',\n        value: function isRequesting() {\n            return this._requesting;\n        }\n\n        /**\n         * Extend the set of default settings.\n         * @protected\n         * @method HttpModule#_extendDefaultSettings\n         * @param {Object} settings The new properties to add to the default settings.\n         * @returns {HttpModule}\n         */\n    }, {\n        key: '_extendDefaultSettings',\n        value: function _extendDefaultSettings(settings) {\n            this._defaultSettings = (0, _utilsHelpers.assign)(this._defaultSettings || {}, settings);\n            return this;\n        }\n\n        /**\n         * Create a new XHR request.\n         * @protected\n         * @method HttpModule#_newRequest\n         * @param {string} httpMethod The HTTP method to use with the request, GET or POST.\n         * @param {Object} queryParams The query parameters to use with the request.\n         * @returns {HttpModule}\n         */\n    }, {\n        key: '_newRequest',\n        value: function _newRequest(httpMethod, queryParams) {\n            var _this2 = this;\n\n            // Check if a callback binded to the \"_newRequest\" event returns false, if it's the case, cancel the request\n            // creation. If the requesting status has been overridden, there's no need to cancel the request since the user\n            // should know what he's doing.\n            if (!this.trigger('_newRequest') && !this._requestingOverridden) {\n                console.warn('To ensure accurate measures, you can only make one request at a time.');\n                return this;\n            }\n\n            var settings = this.settings(),\n                xhr = new XMLHttpRequest(),\n                validHttpMethods = ['GET', 'POST'];\n\n            // Prepare the new request.\n            if (! ~validHttpMethods.indexOf(httpMethod)) {\n                console.warn('The HTTP method must be GET or POST.');\n                return this;\n            }\n\n            queryParams = queryParams || {};\n\n            var tokenSuffix = new Date().getTime();\n            this._lastURLToken = 'network-' + tokenSuffix;\n\n            // Append the query parameters\n            var url = settings.endpoint;\n            url += ~url.indexOf('?') ? '&' : '?';\n            url += 'module=' + this._moduleName;\n\n            Object.keys(queryParams).forEach(function (param) {\n                var value = encodeURIComponent(queryParams[param]);\n                url += '&' + param + '=' + value;\n            });\n\n            url += '&' + this._lastURLToken;\n\n            xhr.open(httpMethod, url);\n\n            // Abort the previous request if it hasn't been sent\n            if (this._xhr && this._xhr.readyState == XMLHttpRequest.OPENED) {\n                this._xhr.abort();\n            }\n\n            // Replace the old request by the new one\n            this._xhr = xhr;\n\n            // Bind all the XHR events\n            var events = ['loadstart', 'progress', 'abort', 'error', 'load', 'timeout', 'loadend', 'readystatechange'];\n\n            events.forEach(function (eventType) {\n                xhr.addEventListener(eventType, function () {\n                    for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) {\n                        args[_key2] = arguments[_key2];\n                    }\n\n                    // A last progress event can be triggered once a request has timed out, ignore it.\n                    if (eventType == 'progress' && !_this2._requesting) return;\n\n                    _this2.trigger.apply(_this2, ['xhr-' + eventType, xhr].concat(args));\n                });\n\n                // The XMLHttpRequestUpload interface supports all the above event types except the \"readystatechange\" one\n                if (eventType != 'readystatechange') {\n                    xhr.upload.addEventListener(eventType, function () {\n                        for (var _len2 = arguments.length, args = Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {\n                            args[_key3] = arguments[_key3];\n                        }\n\n                        _this2.trigger.apply(_this2, ['xhr-upload-' + eventType, xhr].concat(args));\n                    });\n                }\n            });\n\n            // Define the timeout of the request. We don't use the native `timeout` property since it can distort the\n            // measures.\n            // See: https://github.com/nesk/network.js/issues/26\n            var startTimeout = function startTimeout(xhr) {\n                setTimeout(function () {\n                    if (xhr.readyState != XMLHttpRequest.UNSENT && xhr.readyState != XMLHttpRequest.DONE) {\n                        _this2.trigger('xhr-timeout');\n                        _this2.trigger('xhr-upload-timeout');\n                        xhr.abort();\n                    }\n                }, settings.delay);\n            };\n\n            this.on('xhr-upload-loadstart', startTimeout).on('xhr-readystatechange', (function (timeoutStarted) {\n                return function (xhr) {\n                    if (!timeoutStarted && xhr.readyState == XMLHttpRequest.LOADING) {\n                        timeoutStarted = true;\n                        startTimeout(xhr);\n                    }\n                };\n            })(false));\n\n            return this;\n        }\n\n        /**\n         * Send a newly created XHR request.\n         * @protected\n         * @method HttpModule#_sendRequest\n         * @param {?*} [data=null] The data to send with the request.\n         * @returns {HttpModule}\n         */\n    }, {\n        key: '_sendRequest',\n        value: function _sendRequest() {\n            var data = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];\n\n            if (this._xhr && this._xhr.readyState == XMLHttpRequest.OPENED) {\n                this._xhr.send(data);\n            } else {\n                console.warn('A request must have been created before sending any data.');\n            }\n\n            return this;\n        }\n\n        /**\n         * Abort the current request.\n         * @protected\n         * @method HttpModule#_abort\n         * @returns {HttpModule}\n         */\n    }, {\n        key: '_abort',\n        value: function _abort() {\n            if (this._xhr) {\n                this._xhr.abort();\n            }\n\n            return this;\n        }\n\n        /**\n         * Get the Resource Timing entry associated to the current request.\n         * @protected\n         * @method HttpModule#_getTimingEntry\n         * @param {HttpModule~timingCallback} callback A callback used to send back the timing entry.\n         * @returns {HttpModule}\n         */\n    }, {\n        key: '_getTimingEntry',\n        value: function _getTimingEntry(callback) {\n            // The Resource Timing entries aren't immediately available once the 'load' event is triggered by an\n            // XMLHttpRequest, we must wait for another process tick to check for a refreshed list.\n            setTimeout((function (lastURLToken) {\n                return function () {\n                    // Filter the timing entries to return only the one concerned by the last request made\n                    var entries = performance.getEntriesByType('resource').filter(function (entry) {\n                        return ~entry.name.indexOf(lastURLToken);\n                    });\n\n                    /**\n                     * A callback used to send back the timing entry.\n                     * @private\n                     * @callback HttpModule~timingCallback\n                     * @param {PerformanceResourceTiming} entry The Resource Timing entry associated to the current request.\n                     */\n                    callback(entries.length ? entries[0] : null);\n                };\n            })(this._lastURLToken), 0);\n\n            return this;\n        }\n\n        /**\n         * Override the requesting status of the module.\n         * @protected\n         * @method HttpModule#_setRequesting\n         * @param {boolean} isRequesting The requesting status.\n         * @returns {HttpModule}\n         */\n    }, {\n        key: '_setRequesting',\n        value: function _setRequesting(isRequesting) {\n            this._requestingOverridden = true;\n            this._requesting = isRequesting;\n            return this;\n        }\n    }], null, _instanceInitializers);\n\n    return HttpModule;\n})(_EventDispatcher3['default']);\n\nexports['default'] = HttpModule;\nmodule.exports = exports['default'];\n\n/**\n * The default settings.\n * @private\n * @member {?Object} HttpModule#_defaultSettings\n */\n\n},{\"../../utils/decorators\":7,\"../../utils/helpers\":8,\"../EventDispatcher\":1}],4:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n    value: true\n});\n\nvar _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })();\n\nvar _get = function get(_x5, _x6, _x7) { var _again = true; _function: while (_again) { var object = _x5, property = _x6, receiver = _x7; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x5 = parent; _x6 = property; _x7 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer.call(target); Object.defineProperty(target, key, descriptor); }\n\nvar _HttpModule2 = require('./HttpModule');\n\nvar _HttpModule3 = _interopRequireDefault(_HttpModule2);\n\nvar _Timing = require('../Timing');\n\nvar _Timing2 = _interopRequireDefault(_Timing);\n\nvar _utilsHelpers = require('../../utils/helpers');\n\nvar _utilsDecorators = require('../../utils/decorators');\n\n/**\n * @public\n * @typedef {Object} LatencyModule~settingsObject\n * @property {string} [endpoint=./network.php] Where is located your `network.php` file.\n * @property {number} [measures=5] How many measures should be returned.\n * @property {number} [attempts=3] How much attempts to get a valid value should be done for each measure.\n */\n\n/**\n * @class LatencyModule\n * @extends HttpModule\n * @param {LatencyModule~settingsObject} [settings={}] A set of custom settings.\n */\n\nvar LatencyModule = (function (_HttpModule) {\n    var _instanceInitializers = {};\n    var _instanceInitializers = {};\n\n    _inherits(LatencyModule, _HttpModule);\n\n    _createDecoratedClass(LatencyModule, [{\n        key: '_requestsLeft',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return undefined;\n        },\n\n        /**\n         * The total number of attempts left.\n         * @private\n         * @member {number} LatencyModule#_attemptsLeft\n         */\n        enumerable: true\n    }, {\n        key: '_attemptsLeft',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return undefined;\n        },\n\n        /**\n         * The measured latencies.\n         * @private\n         * @member {number[]} LatencyModule#_latencies\n         */\n        enumerable: true\n    }, {\n        key: '_latencies',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return undefined;\n        },\n\n        /**\n         * The ID of the current request.\n         * @private\n         * @member {number} LatencyModule#_requestID\n         */\n        enumerable: true\n    }, {\n        key: '_requestID',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return 0;\n        },\n\n        /**\n         * Unique labels for each request, exclusively used to make measures.\n         * @private\n         * @member {Object} LatencyModule#_requestID\n         * @property {?string} start\n         * @property {?string} end\n         * @property {?string} measure\n         */\n        enumerable: true\n    }, {\n        key: '_timingLabels',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return {\n                start: null,\n                end: null,\n                measure: null\n            };\n        },\n        enumerable: true\n    }], null, _instanceInitializers);\n\n    function LatencyModule() {\n        var _this = this;\n\n        var settings = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n        _classCallCheck(this, LatencyModule);\n\n        _get(Object.getPrototypeOf(LatencyModule.prototype), 'constructor', this).call(this, 'latency');\n\n        _defineDecoratedPropertyDescriptor(this, '_requestsLeft', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_attemptsLeft', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_latencies', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_requestID', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_timingLabels', _instanceInitializers);\n\n        this._extendDefaultSettings({\n            measures: 5,\n            attempts: 3\n        }).settings(settings);\n\n        // Measure the latency with the Resource Timing API once the request is finished\n        if (_Timing2['default'].supportsResourceTiming()) {\n            this.on('xhr-load', function () {\n                return _this._measure();\n            });\n        }\n\n        // If the browser doesn't support the Resource Timing API, we fallback on a Datetime solution.\n        else {\n                // Set a mark when the request starts\n                this.on('xhr-loadstart', function () {\n                    return _Timing2['default'].mark(_this._timingLabels.start);\n                });\n\n                // Then make a measure with the previous mark\n                this.on('xhr-readystatechange', function (xhr) {\n                    return _this._measure(xhr);\n                });\n            }\n    }\n\n    /**\n     * Apply a new set of custom settings.\n     * @public\n     * @method LatencyModule#settings\n     * @param {LatencyModule~settingsObject} settings A set of custom settings.\n     * @returns {LatencyModule}\n     */\n    /**\n     * Return the current set of settings.\n     * @public\n     * @method LatencyModule#settings^2\n     * @returns {LatencyModule~settingsObject}\n     */\n\n    _createDecoratedClass(LatencyModule, [{\n        key: 'settings',\n        value: function settings() {\n            var _settings = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];\n\n            if ((0, _utilsHelpers.isObject)(_settings)) {\n                return _get(Object.getPrototypeOf(LatencyModule.prototype), 'settings', this).call(this, (0, _utilsHelpers.assignStrict)(_settings, {\n                    delay: 0 // We dont want any timeout during a latency calculation\n                }));\n            } else {\n                    return (0, _utilsHelpers.except)(_get(Object.getPrototypeOf(LatencyModule.prototype), 'settings', this).call(this), ['delay']);\n                }\n        }\n\n        /**\n         * Start requesting the server to make measures.\n         * @public\n         * @method LatencyModule#start\n         * @returns {LatencyModule}\n         */\n    }, {\n        key: 'start',\n        value: function start() {\n            // Set the number of requests required to establish the network latency. If the browser doesn't support the\n            // Resource Timing API, add a request that will be ignored to avoid a longer request due to a possible\n            // DNS/whatever fetch.\n\n            var _settings2 = this.settings();\n\n            var measures = _settings2.measures;\n            var attempts = _settings2.attempts;\n\n            this._requestsLeft = measures;\n            this._attemptsLeft = attempts * measures;\n\n            if (!_Timing2['default'].supportsResourceTiming()) {\n                this._requestsLeft++;\n                this._attemptsLeft++;\n            }\n\n            // Override the requesting value since a complete latency request consists off multiple ones\n            this._setRequesting(true);\n\n            this._latencies = [];\n            this._nextRequest();\n\n            return this;\n        }\n\n        /**\n         * Initiate the next request used for latency measures.\n         * @private\n         * @method LatencyModule#_nextRequest\n         * @param {boolean} [retry=false] Defines if the next request is a retry due to a failing request or not.\n         * @returns {LatencyModule}\n         */\n    }, {\n        key: '_nextRequest',\n        value: function _nextRequest() {\n            var _this2 = this;\n\n            var retry = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];\n\n            var reqID = this._requestID++;\n            var requestsLeft = retry ? this._requestsLeft : this._requestsLeft--;\n\n            if (this._attemptsLeft-- && (requestsLeft || retry)) {\n                // Create unique timing labels for the new request\n                var labels = this._timingLabels;\n                labels.start = 'latency-' + reqID + '-start';\n                labels.end = 'latency-' + reqID + '-end';\n                labels.measure = 'latency-' + reqID + '-measure';\n\n                // Create the new request and send it\n                this._newRequest('GET')._sendRequest();\n            } else {\n                // All the requests are finished, set the requesting status to false.\n                this._setRequesting(false);\n\n                // If all the requests have been executed, calculate the average latency. Since the _getTimingEntry() method\n                // is asynchronous, wait for the next process tick to execute the _end() method, to be sure that all the\n                // latencies have been retrieved.\n                setTimeout(function () {\n                    return _this2._end();\n                }, 0);\n            }\n\n            return this;\n        }\n\n        /**\n         * Make latency measures for the last request.\n         * @private\n         * @method LatencyModule#_measure\n         * @param {?XMLHttpRequest} [xhr=null] The concerned XMLHttpRequest if the browser doesn't support the Resource Timing API.\n         * @returns {LatencyModule}\n         */\n    }, {\n        key: '_measure',\n        value: function _measure() {\n            var _this3 = this;\n\n            var xhr = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];\n\n            // With Resource Timing API\n            if (!xhr) {\n                this._getTimingEntry(function (entry) {\n                    // The latency calculation differs between an HTTP and an HTTPS connection\n                    // See: http://www.w3.org/TR/resource-timing/#processing-model\n                    var latency = !entry.secureConnectionStart ? entry.connectEnd - entry.connectStart : entry.secureConnectionStart - entry.connectStart;\n\n                    if (latency) _this3._latencies.push(latency);\n                    _this3._nextRequest(!latency);\n                });\n            }\n\n            // Without Resource Timing API\n            else if (this._requestsLeft < this.settings().measures) {\n\n                    // Measure and save the latency if the headers have been received\n                    if (xhr.readyState == XMLHttpRequest.HEADERS_RECEIVED) {\n                        var labels = this._timingLabels;\n\n                        _Timing2['default'].mark(labels.end);\n                        var latency = _Timing2['default'].measure(labels.measure, labels.start, labels.end);\n\n                        if (latency) this._latencies.push(latency);\n\n                        // Abort the current request before we run a new one\n                        this._abort();\n                        this._nextRequest(!latency);\n                    }\n                }\n\n                // Ignore the first request when using the XHR states. See the comments in the start() method for explanations.\n                else {\n                        this._nextRequest();\n                    }\n\n            return this;\n        }\n\n        /**\n         * End the measures.\n         * @private\n         * @method LatencyModule#_end\n         * @returns {LatencyModule}\n         */\n    }, {\n        key: '_end',\n        value: function _end() {\n            var latencies = this._latencies;\n\n            // Get the average latency\n            var avgLatency = latencies.reduce(function (a, b) {\n                return a + b;\n            }, 0) / (latencies.length || 1);\n            avgLatency = avgLatency || null;\n\n            // If there is not enough measures, display a warning.\n            if (latencies.length < this.settings().measures) {\n                var _settings3 = this.settings();\n\n                var measures = _settings3.measures;\n                var attempts = _settings3.attempts;\n\n                console.warn(['An insufficient number of measures have been processed, this could be due to your web server using', 'persistant connections or to your client settings (measures: ' + measures + ', attempts: ' + attempts + ')'].join(' '));\n            }\n\n            // Trigger the \"end\" event with the average latency and the latency list as parameters\n            this.trigger('end', avgLatency, latencies);\n\n            return this;\n        }\n    }], null, _instanceInitializers);\n\n    return LatencyModule;\n})(_HttpModule3['default']);\n\nexports['default'] = LatencyModule;\nmodule.exports = exports['default'];\n\n/**\n * The total number of requests left.\n * @private\n * @member {number} LatencyModule#_requestsLeft\n */\n\n},{\"../../utils/decorators\":7,\"../../utils/helpers\":8,\"../Timing\":6,\"./HttpModule\":3}],5:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n    value: true\n});\n\nvar _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })();\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nfunction _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer.call(target); Object.defineProperty(target, key, descriptor); }\n\nvar _EventDispatcher = require('./EventDispatcher');\n\nvar _EventDispatcher2 = _interopRequireDefault(_EventDispatcher);\n\nvar _HttpHttpModule = require('./Http/HttpModule');\n\nvar _HttpHttpModule2 = _interopRequireDefault(_HttpHttpModule);\n\nvar _HttpLatencyModule = require('./Http/LatencyModule');\n\nvar _HttpLatencyModule2 = _interopRequireDefault(_HttpLatencyModule);\n\nvar _HttpBandwidthModule = require('./Http/BandwidthModule');\n\nvar _HttpBandwidthModule2 = _interopRequireDefault(_HttpBandwidthModule);\n\nvar _Timing = require('./Timing');\n\nvar _Timing2 = _interopRequireDefault(_Timing);\n\nvar _utilsHelpers = require('../utils/helpers');\n\nvar _utilsDecorators = require('../utils/decorators');\n\n/**\n * @public\n * @typedef {Object} Network~settingsObject\n * @property {LatencyModule~settingsObject} latency\n * @property {BandwidthModule~settingsObject} upload\n * @property {BandwidthModule~settingsObject} download\n * @example\n * {\n *     // Top-level properties are applied to all the modules\n *     endpoint: './my-new-endpoint/',\n *\n *     // Top-level properties will be overridden by the ones specified in each module\n *     latency: {\n *         endpoint: './my-new-latency-endpoint/'\n *     }\n * }\n */\n\n/**\n * @class Network\n * @param {Network~settingsObject} [settings={}] A set of custom settings.\n * @member {LatencyModule} latency The latency module.\n * @member {BandwidthModule} upload The upload module.\n * @member {BandwidthModule} download The download module.\n */\n\nvar Network = (function () {\n    var _instanceInitializers = {};\n    var _instanceInitializers = {};\n\n    _createDecoratedClass(Network, [{\n        key: '_modules',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return {};\n        },\n\n        /**\n         * Defines if the registered modules have been initialized.\n         * @private\n         * @member {boolean} Network#_modulesInitialized\n         */\n        enumerable: true\n    }, {\n        key: '_modulesInitialized',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return false;\n        },\n\n        /**\n         * The settings defined via the constructor, they will be applied once the modules are initialized.\n         * @private\n         * @member {Network~settingsObject} Network#_pendingSettings\n         */\n        enumerable: true\n    }, {\n        key: '_pendingSettings',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return {};\n        },\n\n        /**\n         * Expose all the internal classes to the global scope. Only for testing purposes!\n         * @private\n         * @method Network._exposeInternalClasses\n         * @returns {Network}\n         */\n        enumerable: true\n    }], [{\n        key: '_exposeInternalClasses',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        value: function _exposeInternalClasses() {\n            var global = (0, _utilsHelpers.getGlobalObject)(),\n                classes = { EventDispatcher: _EventDispatcher2['default'], HttpModule: _HttpHttpModule2['default'], LatencyModule: _HttpLatencyModule2['default'], BandwidthModule: _HttpBandwidthModule2['default'], Timing: _Timing2['default'] };\n\n            Object.keys(classes).forEach(function (name) {\n                global[name] = classes[name];\n            });\n\n            return this;\n        }\n    }], _instanceInitializers);\n\n    function Network() {\n        var settings = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n        _classCallCheck(this, Network);\n\n        _defineDecoratedPropertyDescriptor(this, '_modules', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_modulesInitialized', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_pendingSettings', _instanceInitializers);\n\n        this._registerModule('latency', function (settings) {\n            return new _HttpLatencyModule2['default'](settings);\n        })._registerModule('upload', function (settings) {\n            return new _HttpBandwidthModule2['default']('upload', settings);\n        })._registerModule('download', function (settings) {\n            return new _HttpBandwidthModule2['default']('download', settings);\n        });\n\n        this._initModules(this.settings(settings));\n    }\n\n    /**\n     * Apply a new set of custom settings.\n     * @public\n     * @method Network#settings\n     * @param {Network~settingsObject} settings A set of custom settings.\n     * @returns {Network}\n     */\n    /**\n     * Return the current set of settings.\n     * @public\n     * @method Network#settings^2\n     * @returns {Network~settingsObject}\n     */\n\n    _createDecoratedClass(Network, [{\n        key: 'settings',\n        value: function settings() {\n            var _this = this;\n\n            var _settings = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];\n\n            var moduleNames = Object.keys(this._modules);\n\n            if ((0, _utilsHelpers.isObject)(_settings)) {\n                var _ret = (function () {\n                    // Extract the global settings\n                    var globalSettings = (0, _utilsHelpers.except)(_settings, moduleNames);\n\n                    // Extract the local settings\n                    var localSettings = (0, _utilsHelpers.except)(_settings, Object.keys(globalSettings));\n\n                    // Create new settings with the global ones nested in the local ones\n                    _settings = moduleNames.reduce(function (settings, moduleName) {\n                        return (0, _utilsHelpers.assign)(settings, _defineProperty({}, moduleName, globalSettings));\n                    }, {});\n\n                    // Apply the local settings to the new settings\n                    _settings = (0, _utilsHelpers.assign)(_settings, localSettings);\n\n                    // Apply the settings to the modules\n                    if (_this._modulesInitialized) {\n                        Object.keys(_this._modules).forEach(function (name) {\n                            _this._modules[name].settings(_settings[name]);\n                        });\n                    }\n\n                    // If the modules aren't instanciated, store the settings.\n                    else {\n                            _this._pendingSettings = _settings;\n                        }\n\n                    return {\n                        v: _this\n                    };\n                })();\n\n                if (typeof _ret === 'object') return _ret.v;\n            } else {\n                return moduleNames.reduce(function (settings, moduleName) {\n                    return (0, _utilsHelpers.assign)(settings, _defineProperty({}, moduleName, _this._modules[moduleName].settings()));\n                }, {});\n            }\n        }\n\n        /**\n         * Return if a module is currently making a request.\n         * @public\n         * @method Network#isRequesting\n         * @returns {boolean} `true` if a module is requesting, otherwise `false`.\n         */\n    }, {\n        key: 'isRequesting',\n        value: function isRequesting() {\n            var requesting = false;\n\n            for (var _name in this._modules) {\n                if (this._modules.hasOwnProperty(_name)) {\n                    requesting = requesting || this._modules[_name].isRequesting();\n                }\n            }\n\n            return requesting;\n        }\n\n        /**\n         * Register a new module for the current `Network` instance.\n         * @private\n         * @method Network#registerModule\n         * @param {string} name The name of the module. Will be used to create the property `Network.<name>`.\n         * @param {Network~moduleCallback} moduleCallback A callback used to initialize a module with a set of settings.\n         * @returns {Network}\n         */\n    }, {\n        key: '_registerModule',\n        value: function _registerModule(name, moduleCallback) {\n            /**\n             * A callback used to initialize a module with a set of settings.\n             * @private\n             * @callback Network~moduleCallback\n             * @param {Object} settings A set of custom settings.\n             * @returns {HttpModule} An instanciated subclass of `HttpModule`.\n             */\n            this._modules[name] = moduleCallback;\n            return this;\n        }\n\n        /**\n         * Initialize all the registered modules with the settings passed to the constructor.\n         * @private\n         * @method Network#_initModules\n         * @returns {Network}\n         */\n    }, {\n        key: '_initModules',\n        value: function _initModules() {\n            var _this2 = this;\n\n            if (!this._modulesInitialized) {\n                // Initialize the modules with their respective settings\n                Object.keys(this._modules).forEach(function (name) {\n                    _this2._modules[name] = _this2._modules[name](_this2._pendingSettings[name]).on('_newRequest', function () {\n                        return !_this2.isRequesting();\n                    });\n\n                    _this2[name] = _this2._modules[name];\n                });\n\n                this._modulesInitialized = true;\n            }\n\n            return this;\n        }\n    }], null, _instanceInitializers);\n\n    return Network;\n})();\n\nexports['default'] = Network;\nmodule.exports = exports['default'];\n\n/**\n * The registered modules.\n * @private\n * @member {Object} Network#_modules\n */\n\n},{\"../utils/decorators\":7,\"../utils/helpers\":8,\"./EventDispatcher\":1,\"./Http/BandwidthModule\":2,\"./Http/HttpModule\":3,\"./Http/LatencyModule\":4,\"./Timing\":6}],6:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n    value: true\n});\n\nvar _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nfunction _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer.call(target); Object.defineProperty(target, key, descriptor); }\n\nvar _utilsHelpers = require('../utils/helpers');\n\nvar _utilsDecorators = require('../utils/decorators');\n\n/**\n * @private\n * @class Timing\n */\n\nvar Timing = (function () {\n    var _instanceInitializers = {};\n    var _instanceInitializers = {};\n\n    _createDecoratedClass(Timing, [{\n        key: '_support',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return {};\n        },\n\n        /**\n         * All the marks created by the `mark` method.\n         * @private\n         * @member {Object} Timing#_marks\n         */\n        enumerable: true\n    }, {\n        key: '_marks',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return {};\n        },\n\n        /**\n         * All the measures created by the `measure` method.\n         * @private\n         * @member {Object} Timing#_measures\n         */\n        enumerable: true\n    }, {\n        key: '_measures',\n        decorators: [(0, _utilsDecorators.enumerable)(false)],\n        initializer: function initializer() {\n            return {};\n        },\n        enumerable: true\n    }], null, _instanceInitializers);\n\n    function Timing() {\n        _classCallCheck(this, Timing);\n\n        _defineDecoratedPropertyDescriptor(this, '_support', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_marks', _instanceInitializers);\n\n        _defineDecoratedPropertyDescriptor(this, '_measures', _instanceInitializers);\n\n        var global = (0, _utilsHelpers.getGlobalObject)();\n\n        this._support = {\n            performance: !!global.performance,\n            userTiming: global.performance && performance.mark,\n            resourceTiming: global.performance && typeof performance.getEntriesByType == \"function\" && performance.timing\n        };\n    }\n\n    /**\n     * Create a new timing mark.\n     * @public\n     * @method Timing#mark\n     * @param {string} label A label associated to the mark.\n     * @returns {Timing}\n     */\n\n    _createDecoratedClass(Timing, [{\n        key: 'mark',\n        value: function mark(label) {\n            var support = this._support,\n                marks = this._marks;\n\n            if (support.userTiming) {\n                performance.mark(label);\n            }\n\n            if (support.performance) {\n                marks[label] = performance.now();\n            } else {\n                marks[label] = new Date().getTime();\n            }\n\n            return this;\n        }\n\n        /**\n         * Measure the delay between two marks.\n         * @public\n         * @method Timing#measure\n         * @param {string} measureLabel A label associated to the measure.\n         * @param {string} markLabelA The label of the first mark.\n         * @param {string} markLabelB The label of the second mark.\n         * @returns {number} The measured value.\n         */\n    }, {\n        key: 'measure',\n        value: function measure(measureLabel, markLabelA, markLabelB) {\n            var support = this._support,\n                marks = this._marks,\n                measures = this._measures;\n\n            if (typeof measures[measureLabel] == 'undefined') {\n                var measureWithoutUserTiming = marks[markLabelB] - marks[markLabelA];\n\n                if (support.userTiming) {\n                    performance.measure(measureLabel, markLabelA, markLabelB);\n                    var entriesByName = performance.getEntriesByName(measureLabel);\n\n                    // The performance API could return no corresponding entries in Firefox so we must use a fallback.\n                    // See: https://github.com/nesk/network.js/issues/32#issuecomment-118434305\n                    measures[measureLabel] = entriesByName.length ? entriesByName[0].duration : measureWithoutUserTiming;\n                } else {\n                    measures[measureLabel] = measureWithoutUserTiming;\n                }\n            }\n\n            return measures[measureLabel];\n        }\n\n        /**\n         * Determine if the current browser supports the Resource Timing API.\n         * @public\n         * @method Timing#supportsResourceTiming\n         * @returns {boolean} `true` if the Resource Timing API is supported, otherwise `false`.\n         */\n    }, {\n        key: 'supportsResourceTiming',\n        value: function supportsResourceTiming() {\n            return this._support.resourceTiming;\n        }\n    }], null, _instanceInitializers);\n\n    return Timing;\n})();\n\nexports['default'] = new Timing();\nmodule.exports = exports['default'];\n\n/**\n * Defines if the current browser supports some specific Timing APIs.\n * @private\n * @member {Object} Timing#_support\n * @property {boolean} performance `true` if the Performance API is available.\n * @property {boolean} userTiming `true` if the User Timing API is available.\n * @property {boolean} resourceTiming `true` if the Resource Timing API is available.\n */\n\n},{\"../utils/decorators\":7,\"../utils/helpers\":8}],7:[function(require,module,exports){\n/**\n * @callback propertyDecorator\n * @param target\n * @param key\n * @param descriptor\n */\n\n/**\n * Set the enumerability of a property.\n * @private\n * @function enumerable\n * @param {boolean} isEnumerable Whether the property should be enumerable or not.\n * @returns {propertyDecorator}\n */\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.enumerable = enumerable;\n\nfunction enumerable(isEnumerable) {\n  return function (target, key, descriptor) {\n    descriptor.enumerable = isEnumerable;\n    return descriptor;\n  };\n}\n\n},{}],8:[function(require,module,exports){\n(function (global){\n/**\n * Return the global object.\n * @private\n * @function getGlobalObject\n * @return {Object}\n * @see https://gist.github.com/rauschma/1bff02da66472f555c75\n */\n'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n    value: true\n});\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nexports.getGlobalObject = getGlobalObject;\nexports.isObject = isObject;\nexports.copy = copy;\nexports.assign = assign;\nexports.assignStrict = assignStrict;\nexports.except = except;\nexports.defer = defer;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nfunction getGlobalObject() {\n    // Workers don’t have `window`, only `self`.\n    if (typeof self !== 'undefined') {\n        return self;\n    }\n\n    if (typeof global !== 'undefined') {\n        return global;\n    }\n\n    // Not all environments allow `eval` and `Function`, use only as a last resort.\n    return new Function('return this')();\n}\n\n/**\n * Determine if the provided value is an object.\n * @private\n * @function isObject\n * @param {*} obj The value to check.\n * @returns {boolean} `true` if the value is an object, otherwise `false`.\n */\n\nfunction isObject(obj) {\n    return obj != undefined && obj != null && typeof obj.valueOf() == 'object';\n}\n\n/**\n * Make a deep copy of any value.\n * @private\n * @function copy\n * @param {*} value The value to copy.\n * @returns {*} The copied value.\n */\n\nfunction copy(value) {\n    return JSON.parse(JSON.stringify(value));\n}\n\n/**\n * Copy the properties in the source objects over to the destination object.\n * @private\n * @function _assign\n * @param {boolean} strict Given `true`, new properties will not be copied.\n * @param {Object} [target={}] The destination object.\n * @param {...Object} sources The source objects.\n * @returns {Object} The destination object once the properties are copied.\n */\nfunction _assign(strict) {\n    var target = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n    target = copy(target);\n\n    for (var _len = arguments.length, sources = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n        sources[_key - 2] = arguments[_key];\n    }\n\n    sources.forEach(function (source) {\n        Object.keys(source).forEach(function (key) {\n            if (!strict || target.hasOwnProperty(key)) {\n                var value = source[key];\n                target[key] = isObject(value) ? _assign(strict, target[key], value) : value;\n            }\n        });\n    });\n\n    return target;\n}\n\n/**\n * Copy all the properties in the source objects over to the destination object.\n * @private\n * @function assign\n * @param {Object} [target={}] The destination object.\n * @param {...Object} sources The source objects.\n * @returns {Object} The destination object once the properties are copied.\n */\n\nfunction assign() {\n    var target = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n    for (var _len2 = arguments.length, sources = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n        sources[_key2 - 1] = arguments[_key2];\n    }\n\n    return _assign.apply(undefined, [false, target].concat(sources));\n}\n\n/**\n * Copy the properties (but no new ones) in the source objects over to the destination object.\n * @private\n * @function assignStrict\n * @param {Object} [target={}] The destination object.\n * @param {...Object} sources The source objects.\n * @returns {Object} The destination object once the properties are copied.\n */\n\nfunction assignStrict() {\n    var target = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n    for (var _len3 = arguments.length, sources = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n        sources[_key3 - 1] = arguments[_key3];\n    }\n\n    return _assign.apply(undefined, [true, target].concat(sources));\n}\n\n/**\n * Get a copy of an object without some of its properties.\n * @private\n * @function except\n * @param {Object} obj The original object.\n * @param {string[]} properties The properties to exclude from the copied object.\n * @returns {Object} The copied object without the specified properties.\n */\n\nfunction except(obj, properties) {\n    var objCopy = copy(obj);\n\n    properties.forEach(function (index) {\n        return delete objCopy[index];\n    });\n\n    return objCopy;\n}\n\n/**\n * Defer the execution of a function.\n * @private\n * @function defer\n * @param {Function} func The function to defer.\n * @returns {Defer} The Defer object used to execute the function when needed.\n */\n\nfunction defer() {\n    var func = arguments.length <= 0 || arguments[0] === undefined ? function () {} : arguments[0];\n\n    /**\n     * @private\n     * @class Defer\n     */\n    return new ((function () {\n        function _class() {\n            _classCallCheck(this, _class);\n\n            this.func = func;\n        }\n\n        /**\n         * Execute the deferred function.\n         * @public\n         * @method Defer#run\n         */\n\n        _createClass(_class, [{\n            key: 'run',\n            value: function run() {\n                if (this.func) this.func();\n                delete this.func;\n            }\n        }]);\n\n        return _class;\n    })())();\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{}]},{},[5])(5)\n});\n//# sourceMappingURL=network.js.map\n","import {enumerable} from '../utils/decorators';\n\n/**\n * A callback used as an event handler.\n * @public\n * @callback EventDispatcher~eventHandler\n * @param {...*} args The extra parameters provided to the `trigger` method.\n * @returns {?boolean} If `false` is explicitly returned, the `trigger` method will return `false`.\n */\n\n/**\n * @class EventDispatcher\n */\nexport default class EventDispatcher {\n\n    /**\n     * All the registered event callbacks, organized by events.\n     * @private\n     * @member {Object} EventDispatcher#_eventCallbacks\n     */\n    @enumerable(false)\n    _eventCallbacks = {};\n\n    /**\n     * Attach a callback to one or more events.\n     * @public\n     * @method EventDispatcher#on\n     * @param {string|string[]} events One or multiple event names.\n     * @param {EventDispatcher~eventHandler} callback An event handler.\n     * @returns {EventDispatcher}\n     */\n    on(events, callback)\n    {\n        events = Array.isArray(events) ? events : [events];\n\n        events.forEach(event => {\n            var eventCallbacks = this._eventCallbacks[event] = this._eventCallbacks[event] || [];\n\n            // If the callback isn't already registered, store it.\n            if (!~eventCallbacks.indexOf(callback)) {\n                eventCallbacks.push(callback);\n            }\n        });\n\n        return this;\n    }\n\n    /**\n     * Detach a callback from one or more events.\n     * @public\n     * @method EventDispatcher#off\n     * @param {string|string[]} events One or multiple event names.\n     * @param {EventDispatcher~eventHandler} callback An event handler.\n     * @returns {EventDispatcher}\n     */\n    off(events, callback = null)\n    {\n        events = Array.isArray(events) ? events : [events];\n\n        events.forEach(event => {\n            var eventCallbacks = this._eventCallbacks[event];\n\n            // If there is no specified callback, simply delete all the callbacks binded to the provided event.\n            if (!callback && eventCallbacks) {\n                delete this._eventCallbacks[event];\n            } else {\n                var callbackIndex = eventCallbacks ? eventCallbacks.indexOf(callback) : -1;\n\n                // If the callback is registered, remove it from the array.\n                if (callbackIndex != -1) {\n                    eventCallbacks.splice(callbackIndex, 1);\n                }\n            }\n        });\n\n        return this;\n    }\n\n    /**\n     * Trigger an event.\n     * @public\n     * @method EventDispatcher#trigger\n     * @param {string} event An event name.\n     * @param {...*} extraParameters Some extra parameters to pass to the event handlers.\n     * @returns {boolean} Returns `false` if one of the event handlers explicitly returned `false`.\n     */\n    trigger(event, ...extraParameters)\n    {\n        var eventCallbacks = this._eventCallbacks[event] || [];\n\n        // A callback can return a boolean value which will be logically compared to the other callbacks values before\n        // being returned by the trigger() method. This allows a callback to send a \"signal\" to the caller, like\n        // cancelling an action.\n        var returnValue = true;\n\n        eventCallbacks.forEach(eventCallback => {\n            // A callback must explicitly return false if it wants the trigger() method to return false, undefined will\n            // not work. This avoids crappy callbacks to mess up with the triggering system.\n            var value = eventCallback(...extraParameters);\n            value = value !== false ? true : false;\n\n            returnValue = returnValue && value; // Compare the result of the callback to the actual return value\n        });\n\n        return returnValue;\n    }\n\n}\n","import HttpModule from './HttpModule';\nimport Timing from '../Timing';\nimport {defer} from '../../utils/helpers';\nimport {enumerable} from '../../utils/decorators';\n\n/**\n * @public\n * @typedef {Object} BandwidthModule~settingsObject\n * @extends HttpModule~settingsObject\n * @property {Object} data\n * @property {number} data.size The amount of data to initially use.\n * @property {number} [data.multiplier=2] If the measure period can't reach the delay defined in the settings, the data amount is multiplied by the following value.\n */\n\n/**\n * Apply a new set of custom settings.\n * @public\n * @method BandwidthModule#settings\n * @param {BandwidthModule~settingsObject} settings A set of custom settings.\n * @returns {BandwidthModule}\n */\n/**\n * Return the current set of settings.\n * @public\n * @method BandwidthModule#settings^2\n * @returns {BandwidthModule~settingsObject}\n */\n\n/**\n * @class BandwidthModule\n * @extends HttpModule\n * @param {string} loadingType The loading type, `upload` or `download`.\n * @param {BandwidthModule~settingsObject} [settings={}] A set of custom settings.\n */\nexport default class BandwidthModule extends HttpModule {\n\n    /**\n     *\n     * @private\n     * @member {string} BandwidthModule#_loadingType\n     */\n    @enumerable(false)\n    _loadingType = undefined;\n\n    /**\n     *\n     * @private\n     * @member {boolean} BandwidthModule#_intendedEnd\n     */\n    @enumerable(false)\n    _intendedEnd = false;\n\n    /**\n     *\n     * @private\n     * @member {boolean} BandwidthModule#_isRestarting\n     */\n    @enumerable(false)\n    _isRestarting = false;\n\n    /**\n     * Tracks the value of the `loaded` property for each progress event.\n     * @private\n     * @member {?number} BandwidthModule#_lastLoadedValue\n     */\n    @enumerable(false)\n    _lastLoadedValue = null;\n\n    /**\n     * The recorded measures of speed.\n     * @private\n     * @member {number[]} BandwidthModule#_speedRecords\n     */\n    @enumerable(false)\n    _speedRecords = [];\n\n    /**\n     * The average speed.\n     * @private\n     * @member {number} BandwidthModule#_avgSpeed\n     */\n    @enumerable(false)\n    _avgSpeed = undefined;\n\n    /**\n     * The ID of the current request.\n     * @private\n     * @member {number} BandwidthModule#_requestID\n     */\n    @enumerable(false)\n    _requestID = 0;\n\n    /**\n     * The ID of the current progress event.\n     * @private\n     * @member {number} BandwidthModule#_progressID\n     */\n    @enumerable(false)\n    _progressID = 0;\n\n    /**\n     * Defines if measures have started.\n     * @private\n     * @member {boolean} BandwidthModule#_started\n     */\n    @enumerable(false)\n    _started = false;\n\n    /**\n     * Defines if the current progress event is the first one triggered for the current request.\n     * @private\n     * @member {boolean} BandwidthModule#_firstProgress\n     */\n    @enumerable(false)\n    _firstProgress = true;\n\n    /**\n     * @private\n     * @member {Defer} BandwidthModule#_deferredProgress\n     */\n    @enumerable(false)\n    _deferredProgress = undefined;\n\n    /**\n     * Unique labels for each request, exclusively used to make measures.\n     * @private\n     * @member {Object} BandwidthModule#_timingLabels\n     * @property {?string} start\n     * @property {?string} progress\n     * @property {?string} end\n     * @property {?string} measure\n     */\n    @enumerable(false)\n    _timingLabels = {\n        start: null,\n        progress: null,\n        end: null,\n        measure: null\n    };\n\n    constructor(loadingType, settings = {})\n    {\n        loadingType = (~['upload', 'download'].indexOf(loadingType)) ? loadingType : 'download';\n\n        super(loadingType);\n\n        this._extendDefaultSettings({\n            data: {\n                // 2 MB for upload, 10 MB for download\n                size: loadingType == 'upload' ? (2 * 1024 * 1024) : (10 * 1024 * 1024),\n                multiplier: 2\n            }\n        }).settings(settings);\n\n        this._loadingType = loadingType;\n\n        // Bind to XHR events\n        this.on('xhr-upload-loadstart', () => Timing.mark(this._timingLabels.start));\n        this.on('xhr-readystatechange', xhr => {\n            if (!this._started && xhr.readyState == XMLHttpRequest.LOADING) {\n                Timing.mark(this._timingLabels.start);\n                this._started = true;\n            }\n        });\n\n        var eventsPrefix = (loadingType == 'upload') ? 'xhr-upload' : 'xhr';\n\n        this.on(`${eventsPrefix}-progress`, (xhr, event) => this._progress(event));\n        this.on(`${eventsPrefix}-timeout`, () => this._timeout());\n        this.on(`${eventsPrefix}-loadend`, () => this._end());\n    }\n\n    /**\n     * Start requesting the server to make measures.\n     * @public\n     * @method BandwidthModule#start\n     * @returns {BandwidthModule}\n     */\n    start()\n    {\n        var loadingType = this._loadingType,\n            dataSettings = this.settings().data,\n            reqID = this._requestID++;\n\n        this._intendedEnd = false;\n        this._lastLoadedValue = null;\n        this._speedRecords = [];\n        this._started = false;\n        this._firstProgress = true;\n        this._deferredProgress = defer();\n\n        // Trigger the start event\n        if (!this._isRestarting) {\n            this.trigger('start', dataSettings.size);\n        }\n\n        // Create unique timing labels for the new request\n        var labels = this._timingLabels;\n        labels.start = `${loadingType}-${reqID}-start`;\n        labels.progress = `${loadingType}-${reqID}-progress`;\n        labels.end = `${loadingType}-${reqID}-end`;\n        labels.measure = `${loadingType}-${reqID}-measure`;\n\n        // Generate some random data to upload to the server. Here we're using a Blob instead of an ArrayBuffer because\n        // of a bug in Chrome (tested in v33.0.1750.146), causing a freeze of the page while trying to directly upload\n        // an ArrayBuffer (through an ArrayBufferView). The freeze lasts nearly 4.5s for 10MB of data. Using a Blob\n        // seems to solve the problem.\n        var blob = (loadingType == 'upload') ? new Blob([new ArrayBuffer(dataSettings.size)]) : null;\n\n        var type = (loadingType == 'download') ? 'GET' : 'POST';\n\n        // Initiate and send a new request\n        this._newRequest(type, {\n            size: dataSettings.size\n        })._sendRequest(blob);\n\n        return this;\n    }\n\n    /**\n     * Abort the measures.\n     * @public\n     * @method BandwidthModule#abort\n     * @returns {BandwidthModule}\n     */\n    abort()\n    {\n        this._intendedEnd = true;\n        return this._abort();\n    }\n\n    /**\n     * Make bandwidth measures for the current request.\n     * @private\n     * @method BandwidthModule#_progress\n     * @param {ProgressEvent} event The event associated with the progress event of the current request.\n     * @returns {BandwidthModule}\n     */\n    _progress(event)\n    {\n        // Ignore the first progress event, it generally contributes to get incoherent values.\n        if (this._firstProgress) return this._firstProgress = false;\n\n        // Execute the previous progress trigger\n        this._deferredProgress.run();\n\n        var labels = this._timingLabels,\n            progressID = this._progressID++,\n            markLabel = `${labels.progress}-${progressID}`,\n            loaded = event.loaded;\n\n        Timing.mark(markLabel);\n\n        // Measure the average speed (B/s) since the request started\n        var avgMeasure = Timing.measure(\n                `${labels.measure}-avg-${progressID}`,\n                labels.start,\n                markLabel\n            ),\n            avgSpeed = loaded / avgMeasure * 1000;\n\n        var instantSpeed;\n\n        if (this._lastLoadedValue === null) { // We are executing the first progress event of the current request\n            instantSpeed = avgSpeed; // The instant speed of the first progress event is equal to the average one\n        } else {\n            // Measure the instant speed (B/s), which defines the speed between two progress events.\n            var instantMeasure = Timing.measure(\n                `${labels.measure}-instant-${progressID}`,\n                // Set the mark of the previous progress event as the starting point\n                `${labels.progress}-${progressID - 1}`,\n                markLabel\n            );\n            instantSpeed = (loaded - this._lastLoadedValue) / instantMeasure * 1000;\n        }\n\n        // Save the `loaded` property of the event for the next progress event\n        this._lastLoadedValue = loaded;\n\n        // Defer measures saving and event triggering, this allows to cancel the last progress event, which can generate\n        // incoherent values.\n        this._deferredProgress = defer(() => {\n            this._avgSpeed = avgSpeed;\n            this._speedRecords.push(instantSpeed);\n\n            this.trigger('progress', avgSpeed, instantSpeed);\n        });\n\n        return this;\n    }\n\n    /**\n     * Mark the current request as entirely finished (this means it ended after a time out).\n     * @private\n     * @method BandwidthModule#_timeout\n     * @returns {BandwidthModule}\n     */\n    _timeout()\n    {\n        this._intendedEnd = true;\n        return this;\n    }\n\n    /**\n     * End the measures.\n     * @private\n     * @method BandwidthModule#_end\n     * @returns {BandwidthModule}\n     */\n    _end()\n    {\n        // A timeout or an abort occured, bypass the further requests and trigger the \"end\" event.\n        if (this._intendedEnd) {\n            this._isRestarting = false;\n            this.trigger('end', this._avgSpeed, this._speedRecords);\n        }\n\n        // The request ended to early, restart it with an increased data size.\n        else {\n            var dataSettings = this.settings().data,\n                size = dataSettings.size * dataSettings.multiplier;\n\n            this.settings({data: {size}});\n            this.trigger('restart', size);\n\n            this._isRestarting = true;\n            this.start();\n        }\n\n        return this;\n    }\n\n\n}\n","import EventDispatcher from '../EventDispatcher';\nimport {isObject, copy, assign, assignStrict} from '../../utils/helpers';\nimport {enumerable} from '../../utils/decorators';\n\n/**\n * @public\n * @typedef {Object} HttpModule~settingsObject\n * @property {string} [endpoint=./network.php] Where is located your `network.php` file.\n * @property {number} [delay=8000] The delay while you want to take measures.\n */\n\n/**\n * @class HttpModule\n * @extends EventDispatcher\n * @param {string} moduleName The name of the instanciated module.\n * @param {HttpModule~settingsObject} [settings={}] A set of custom settings.\n */\nexport default class HttpModule extends EventDispatcher {\n\n    /**\n     * The default settings.\n     * @private\n     * @member {?Object} HttpModule#_defaultSettings\n     */\n    @enumerable(false)\n    _defaultSettings = null;\n\n    /**\n     * The current settings.\n     * @private\n     * @member {?Object} HttpModule#_settings\n     */\n    @enumerable(false)\n    _settings = null;\n\n    /**\n     * The module name, will be send to the server.\n     * @private\n     * @member {string} HttpModule#_moduleName\n     */\n    @enumerable(false)\n    _moduleName = undefined;\n\n    /**\n     * The current XMLHttpRequest object.\n     * @private\n     * @member {?XMLHttpRequest} HttpModule#_xhr\n     */\n    @enumerable(false)\n    _xhr = null;\n\n    /**\n     * An URL token to avoid any caching issues. Also allows to identify the request in the Resource Timing entries.\n     * @private\n     * @member {?string} HttpModule#_lastURLToken\n     */\n    @enumerable(false)\n    _lastURLToken = null;\n\n    /**\n     * Defines if the module is currently running an HTTP request.\n     * @private\n     * @member {boolean} HttpModule#_requesting\n     */\n    @enumerable(false)\n    _requesting = false;\n\n    /**\n     * Defines if the requesting status has been overridden by the `_setRequesting` method.\n     * @private\n     * @member {boolean} HttpModule#_requestingOverridden\n     */\n    @enumerable(false)\n    _requestingOverridden = false;\n\n    constructor(moduleName, settings = {})\n    {\n        super();\n\n        this._extendDefaultSettings({\n            endpoint: './network.php',\n            delay: 8000\n        });\n\n        this.settings(settings);\n\n        this._moduleName = moduleName;\n\n        // Each time a request starts or ends, set the requesting value unless it has been overridden with the\n        // _setRequesting() method.\n        this.on(['xhr-loadstart', 'xhr-upload-loadstart'], () => {\n            if (!this._requestingOverridden) {\n                this._requesting = true;\n            }\n        });\n\n        this.on(['xhr-loadend', 'xhr-upload-loadend'], () => {\n            if (!this._requestingOverridden) {\n                this._requesting = false;\n            }\n        });\n    }\n\n    /**\n     * Apply a new set of custom settings.\n     * @public\n     * @method HttpModule#settings\n     * @param {HttpModule~settingsObject} settings A set of custom settings.\n     * @returns {HttpModule}\n     */\n    /**\n     * Return the current set of settings.\n     * @public\n     * @method HttpModule#settings^2\n     * @returns {HttpModule~settingsObject}\n     */\n    settings(settings = null)\n    {\n        if (isObject(settings)) {\n            this._settings = assignStrict(this._defaultSettings || {}, this._settings || {}, settings);\n            return this;\n        } else {\n            return copy(this._settings || this._defaultSettings || {});\n        }\n    }\n\n    /**\n     * Return if the module is currently making a request.\n     * @public\n     * @method HttpModule#isRequesting\n     * @returns {boolean} `true` if the module is requesting, otherwise `false`.\n     */\n    isRequesting()\n    {\n        return this._requesting;\n    }\n\n    /**\n     * Extend the set of default settings.\n     * @protected\n     * @method HttpModule#_extendDefaultSettings\n     * @param {Object} settings The new properties to add to the default settings.\n     * @returns {HttpModule}\n     */\n    _extendDefaultSettings(settings)\n    {\n        this._defaultSettings = assign(this._defaultSettings || {}, settings);\n        return this;\n    }\n\n    /**\n     * Create a new XHR request.\n     * @protected\n     * @method HttpModule#_newRequest\n     * @param {string} httpMethod The HTTP method to use with the request, GET or POST.\n     * @param {Object} queryParams The query parameters to use with the request.\n     * @returns {HttpModule}\n     */\n    _newRequest(httpMethod, queryParams)\n    {\n        // Check if a callback binded to the \"_newRequest\" event returns false, if it's the case, cancel the request\n        // creation. If the requesting status has been overridden, there's no need to cancel the request since the user\n        // should know what he's doing.\n        if (!this.trigger('_newRequest') && !this._requestingOverridden) {\n            console.warn('To ensure accurate measures, you can only make one request at a time.');\n            return this;\n        }\n\n        let settings = this.settings(),\n            xhr = new XMLHttpRequest(),\n            validHttpMethods = ['GET', 'POST'];\n\n        // Prepare the new request.\n        if (!~validHttpMethods.indexOf(httpMethod)) {\n            console.warn('The HTTP method must be GET or POST.');\n            return this;\n        }\n\n        queryParams = queryParams || {};\n\n        let tokenSuffix = (new Date).getTime();\n        this._lastURLToken = `network-${tokenSuffix}`;\n\n        // Append the query parameters\n        let url = settings.endpoint;\n        url += ~url.indexOf('?') ? '&' : '?';\n        url += `module=${this._moduleName}`;\n\n        Object.keys(queryParams).forEach(param => {\n            let value = encodeURIComponent(queryParams[param]);\n            url += `&${param}=${value}`;\n        });\n\n        url += `&${this._lastURLToken}`;\n\n        xhr.open(httpMethod, url);\n\n        // Abort the previous request if it hasn't been sent\n        if (this._xhr && this._xhr.readyState == XMLHttpRequest.OPENED) {\n            this._xhr.abort();\n        }\n\n        // Replace the old request by the new one\n        this._xhr = xhr;\n\n        // Bind all the XHR events\n        const events = [\n            'loadstart', 'progress', 'abort', 'error', 'load', 'timeout', 'loadend', 'readystatechange'\n        ];\n\n        events.forEach(eventType => {\n            xhr.addEventListener(eventType, (...args) => {\n                // A last progress event can be triggered once a request has timed out, ignore it.\n                if (eventType == 'progress' && !this._requesting) return;\n\n                this.trigger(`xhr-${eventType}`, xhr, ...args);\n            });\n\n            // The XMLHttpRequestUpload interface supports all the above event types except the \"readystatechange\" one\n            if (eventType != 'readystatechange') {\n                xhr.upload.addEventListener(eventType, (...args) => {\n                    this.trigger(`xhr-upload-${eventType}`, xhr, ...args);\n                });\n            }\n        });\n\n        // Define the timeout of the request. We don't use the native `timeout` property since it can distort the\n        // measures.\n        // See: https://github.com/nesk/network.js/issues/26\n        const startTimeout = xhr => {\n            setTimeout(() => {\n                if (xhr.readyState != XMLHttpRequest.UNSENT && xhr.readyState != XMLHttpRequest.DONE) {\n                    this.trigger('xhr-timeout');\n                    this.trigger('xhr-upload-timeout');\n                    xhr.abort()\n                }\n            }, settings.delay);\n        };\n\n        this.on('xhr-upload-loadstart', startTimeout)\n            .on('xhr-readystatechange', (timeoutStarted => {\n                return xhr => {\n                    if (!timeoutStarted && xhr.readyState == XMLHttpRequest.LOADING) {\n                        timeoutStarted = true;\n                        startTimeout(xhr);\n                    }\n                };\n            })(false));\n\n        return this;\n    }\n\n    /**\n     * Send a newly created XHR request.\n     * @protected\n     * @method HttpModule#_sendRequest\n     * @param {?*} [data=null] The data to send with the request.\n     * @returns {HttpModule}\n     */\n    _sendRequest(data = null)\n    {\n        if (this._xhr && this._xhr.readyState == XMLHttpRequest.OPENED) {\n            this._xhr.send(data);\n        } else {\n            console.warn('A request must have been created before sending any data.');\n        }\n\n        return this;\n    }\n\n    /**\n     * Abort the current request.\n     * @protected\n     * @method HttpModule#_abort\n     * @returns {HttpModule}\n     */\n    _abort()\n    {\n        if (this._xhr) {\n            this._xhr.abort();\n        }\n\n        return this;\n    }\n\n    /**\n     * Get the Resource Timing entry associated to the current request.\n     * @protected\n     * @method HttpModule#_getTimingEntry\n     * @param {HttpModule~timingCallback} callback A callback used to send back the timing entry.\n     * @returns {HttpModule}\n     */\n    _getTimingEntry(callback)\n    {\n        // The Resource Timing entries aren't immediately available once the 'load' event is triggered by an\n        // XMLHttpRequest, we must wait for another process tick to check for a refreshed list.\n        setTimeout((lastURLToken => {\n            return () => {\n                // Filter the timing entries to return only the one concerned by the last request made\n                let entries = performance.getEntriesByType('resource').filter(function(entry) {\n                    return ~entry.name.indexOf(lastURLToken);\n                });\n\n                /**\n                 * A callback used to send back the timing entry.\n                 * @private\n                 * @callback HttpModule~timingCallback\n                 * @param {PerformanceResourceTiming} entry The Resource Timing entry associated to the current request.\n                 */\n                callback(entries.length ? entries[0] : null);\n            };\n        })(this._lastURLToken), 0);\n\n        return this;\n    }\n\n    /**\n     * Override the requesting status of the module.\n     * @protected\n     * @method HttpModule#_setRequesting\n     * @param {boolean} isRequesting The requesting status.\n     * @returns {HttpModule}\n     */\n    _setRequesting(isRequesting)\n    {\n        this._requestingOverridden = true;\n        this._requesting = isRequesting;\n        return this;\n    }\n\n}\n","import HttpModule from './HttpModule';\nimport Timing from '../Timing';\nimport {isObject, assignStrict, except} from '../../utils/helpers';\nimport {enumerable} from '../../utils/decorators';\n\n/**\n * @public\n * @typedef {Object} LatencyModule~settingsObject\n * @property {string} [endpoint=./network.php] Where is located your `network.php` file.\n * @property {number} [measures=5] How many measures should be returned.\n * @property {number} [attempts=3] How much attempts to get a valid value should be done for each measure.\n */\n\n/**\n * @class LatencyModule\n * @extends HttpModule\n * @param {LatencyModule~settingsObject} [settings={}] A set of custom settings.\n */\nexport default class LatencyModule extends HttpModule {\n\n    /**\n     * The total number of requests left.\n     * @private\n     * @member {number} LatencyModule#_requestsLeft\n     */\n    @enumerable(false)\n    _requestsLeft = undefined;\n\n    /**\n     * The total number of attempts left.\n     * @private\n     * @member {number} LatencyModule#_attemptsLeft\n     */\n    @enumerable(false)\n    _attemptsLeft = undefined;\n\n    /**\n     * The measured latencies.\n     * @private\n     * @member {number[]} LatencyModule#_latencies\n     */\n    @enumerable(false)\n    _latencies = undefined;\n\n    /**\n     * The ID of the current request.\n     * @private\n     * @member {number} LatencyModule#_requestID\n     */\n    @enumerable(false)\n    _requestID = 0;\n\n    /**\n     * Unique labels for each request, exclusively used to make measures.\n     * @private\n     * @member {Object} LatencyModule#_requestID\n     * @property {?string} start\n     * @property {?string} end\n     * @property {?string} measure\n     */\n    @enumerable(false)\n    _timingLabels = {\n        start: null,\n        end: null,\n        measure: null\n    };\n\n    constructor(settings = {})\n    {\n        super('latency');\n\n        this._extendDefaultSettings({\n            measures: 5,\n            attempts: 3\n        }).settings(settings);\n\n        // Measure the latency with the Resource Timing API once the request is finished\n        if (Timing.supportsResourceTiming()) {\n            this.on('xhr-load', () => this._measure());\n        }\n\n        // If the browser doesn't support the Resource Timing API, we fallback on a Datetime solution.\n        else {\n            // Set a mark when the request starts\n            this.on('xhr-loadstart', () => Timing.mark(this._timingLabels.start));\n\n            // Then make a measure with the previous mark\n            this.on('xhr-readystatechange', xhr => this._measure(xhr));\n        }\n    }\n\n    /**\n     * Apply a new set of custom settings.\n     * @public\n     * @method LatencyModule#settings\n     * @param {LatencyModule~settingsObject} settings A set of custom settings.\n     * @returns {LatencyModule}\n     */\n    /**\n     * Return the current set of settings.\n     * @public\n     * @method LatencyModule#settings^2\n     * @returns {LatencyModule~settingsObject}\n     */\n    settings(settings = null)\n    {\n        if (isObject(settings)) {\n            return super.settings(assignStrict(settings, {\n                delay: 0 // We dont want any timeout during a latency calculation\n            }));\n        } else {\n            return except(super.settings(), ['delay']);\n        }\n    }\n\n    /**\n     * Start requesting the server to make measures.\n     * @public\n     * @method LatencyModule#start\n     * @returns {LatencyModule}\n     */\n    start()\n    {\n        // Set the number of requests required to establish the network latency. If the browser doesn't support the\n        // Resource Timing API, add a request that will be ignored to avoid a longer request due to a possible\n        // DNS/whatever fetch.\n        let {measures, attempts} = this.settings();\n\n        this._requestsLeft = measures;\n        this._attemptsLeft = attempts * measures;\n\n        if (!Timing.supportsResourceTiming()) {\n            this._requestsLeft++;\n            this._attemptsLeft++;\n        }\n\n        // Override the requesting value since a complete latency request consists off multiple ones\n        this._setRequesting(true);\n\n        this._latencies = [];\n        this._nextRequest();\n\n        return this;\n    }\n\n    /**\n     * Initiate the next request used for latency measures.\n     * @private\n     * @method LatencyModule#_nextRequest\n     * @param {boolean} [retry=false] Defines if the next request is a retry due to a failing request or not.\n     * @returns {LatencyModule}\n     */\n    _nextRequest(retry = false)\n    {\n        const reqID = this._requestID++;\n        let requestsLeft = retry ? this._requestsLeft : this._requestsLeft--;\n\n        if (this._attemptsLeft-- && (requestsLeft || retry)) {\n            // Create unique timing labels for the new request\n            var labels = this._timingLabels;\n            labels.start = `latency-${reqID}-start`;\n            labels.end = `latency-${reqID}-end`;\n            labels.measure = `latency-${reqID}-measure`;\n\n            // Create the new request and send it\n            this._newRequest('GET')._sendRequest();\n        } else {\n            // All the requests are finished, set the requesting status to false.\n            this._setRequesting(false);\n\n            // If all the requests have been executed, calculate the average latency. Since the _getTimingEntry() method\n            // is asynchronous, wait for the next process tick to execute the _end() method, to be sure that all the\n            // latencies have been retrieved.\n            setTimeout(() => this._end(), 0);\n        }\n\n        return this;\n    }\n\n    /**\n     * Make latency measures for the last request.\n     * @private\n     * @method LatencyModule#_measure\n     * @param {?XMLHttpRequest} [xhr=null] The concerned XMLHttpRequest if the browser doesn't support the Resource Timing API.\n     * @returns {LatencyModule}\n     */\n    _measure(xhr = null)\n    {\n        // With Resource Timing API\n        if (!xhr) {\n            this._getTimingEntry(entry => {\n                // The latency calculation differs between an HTTP and an HTTPS connection\n                // See: http://www.w3.org/TR/resource-timing/#processing-model\n                let latency = !entry.secureConnectionStart\n                        ? entry.connectEnd - entry.connectStart\n                        : entry.secureConnectionStart - entry.connectStart;\n\n                if (latency) this._latencies.push(latency);\n                this._nextRequest(!latency);\n            });\n        }\n\n        // Without Resource Timing API\n        else if (this._requestsLeft < this.settings().measures) {\n\n            // Measure and save the latency if the headers have been received\n            if (xhr.readyState == XMLHttpRequest.HEADERS_RECEIVED) {\n                let labels = this._timingLabels;\n\n                Timing.mark(labels.end);\n                let latency = Timing.measure(labels.measure, labels.start, labels.end);\n\n                if (latency) this._latencies.push(latency);\n\n                // Abort the current request before we run a new one\n                this._abort();\n                this._nextRequest(!latency);\n            }\n\n        }\n\n        // Ignore the first request when using the XHR states. See the comments in the start() method for explanations.\n        else {\n            this._nextRequest();\n        }\n\n        return this;\n    }\n\n    /**\n     * End the measures.\n     * @private\n     * @method LatencyModule#_end\n     * @returns {LatencyModule}\n     */\n    _end()\n    {\n        let latencies = this._latencies;\n\n        // Get the average latency\n        let avgLatency = latencies.reduce((a, b) => a + b, 0) / (latencies.length || 1);\n        avgLatency = avgLatency || null;\n\n        // If there is not enough measures, display a warning.\n        if (latencies.length < this.settings().measures) {\n            let {measures, attempts} = this.settings();\n\n            console.warn([\n                'An insufficient number of measures have been processed, this could be due to your web server using',\n                `persistant connections or to your client settings (measures: ${measures}, attempts: ${attempts})`\n            ].join(' '));\n        }\n\n        // Trigger the \"end\" event with the average latency and the latency list as parameters\n        this.trigger('end', avgLatency, latencies);\n\n        return this;\n    }\n\n}\n","import EventDispatcher from './EventDispatcher';\nimport HttpModule from './Http/HttpModule';\nimport LatencyModule from './Http/LatencyModule';\nimport BandwidthModule from './Http/BandwidthModule';\nimport Timing from './Timing';\nimport {getGlobalObject, isObject, assign, except} from '../utils/helpers';\nimport {enumerable} from '../utils/decorators';\n\n/**\n * @public\n * @typedef {Object} Network~settingsObject\n * @property {LatencyModule~settingsObject} latency\n * @property {BandwidthModule~settingsObject} upload\n * @property {BandwidthModule~settingsObject} download\n * @example\n * {\n *     // Top-level properties are applied to all the modules\n *     endpoint: './my-new-endpoint/',\n *\n *     // Top-level properties will be overridden by the ones specified in each module\n *     latency: {\n *         endpoint: './my-new-latency-endpoint/'\n *     }\n * }\n */\n\n/**\n * @class Network\n * @param {Network~settingsObject} [settings={}] A set of custom settings.\n * @member {LatencyModule} latency The latency module.\n * @member {BandwidthModule} upload The upload module.\n * @member {BandwidthModule} download The download module.\n */\nexport default class Network {\n\n    /**\n     * The registered modules.\n     * @private\n     * @member {Object} Network#_modules\n     */\n    @enumerable(false)\n    _modules = {};\n\n    /**\n     * Defines if the registered modules have been initialized.\n     * @private\n     * @member {boolean} Network#_modulesInitialized\n     */\n    @enumerable(false)\n    _modulesInitialized = false;\n\n    /**\n     * The settings defined via the constructor, they will be applied once the modules are initialized.\n     * @private\n     * @member {Network~settingsObject} Network#_pendingSettings\n     */\n    @enumerable(false)\n    _pendingSettings = {};\n\n    /**\n     * Expose all the internal classes to the global scope. Only for testing purposes!\n     * @private\n     * @method Network._exposeInternalClasses\n     * @returns {Network}\n     */\n    @enumerable(false)\n    static _exposeInternalClasses()\n    {\n        let global = getGlobalObject(),\n            classes = {EventDispatcher, HttpModule, LatencyModule, BandwidthModule, Timing};\n\n        Object.keys(classes).forEach(name => {\n            global[name] = classes[name];\n        });\n\n        return this;\n    }\n\n    constructor(settings = {})\n    {\n        this._registerModule('latency', settings => new LatencyModule(settings))\n            ._registerModule('upload', settings => new BandwidthModule('upload', settings))\n            ._registerModule('download', settings => new BandwidthModule('download', settings));\n\n        this._initModules(this.settings(settings));\n    }\n\n    /**\n     * Apply a new set of custom settings.\n     * @public\n     * @method Network#settings\n     * @param {Network~settingsObject} settings A set of custom settings.\n     * @returns {Network}\n     */\n    /**\n     * Return the current set of settings.\n     * @public\n     * @method Network#settings^2\n     * @returns {Network~settingsObject}\n     */\n    settings(settings = null)\n    {\n        let moduleNames = Object.keys(this._modules);\n\n        if (isObject(settings)) {\n            // Extract the global settings\n            let globalSettings = except(settings, moduleNames);\n\n            // Extract the local settings\n            let localSettings = except(settings, Object.keys(globalSettings));\n\n            // Create new settings with the global ones nested in the local ones\n            settings = moduleNames.reduce((settings, moduleName) => {\n                return assign(settings, {[moduleName]: globalSettings});\n            }, {});\n\n            // Apply the local settings to the new settings\n            settings = assign(settings, localSettings);\n\n            // Apply the settings to the modules\n            if (this._modulesInitialized) {\n                Object.keys(this._modules).forEach(name => {\n                    this._modules[name].settings(settings[name]);\n                });\n            }\n\n            // If the modules aren't instanciated, store the settings.\n            else {\n                this._pendingSettings = settings;\n            }\n\n            return this;\n        } else {\n            return moduleNames.reduce((settings, moduleName) => {\n                return assign(settings, {[moduleName]: this._modules[moduleName].settings()});\n            }, {});\n        }\n    }\n\n    /**\n     * Return if a module is currently making a request.\n     * @public\n     * @method Network#isRequesting\n     * @returns {boolean} `true` if a module is requesting, otherwise `false`.\n     */\n    isRequesting()\n    {\n        let requesting = false;\n\n        for (let name in this._modules) {\n            if (this._modules.hasOwnProperty(name)) {\n                requesting = requesting || this._modules[name].isRequesting();\n            }\n        }\n\n        return requesting;\n    }\n\n    /**\n     * Register a new module for the current `Network` instance.\n     * @private\n     * @method Network#registerModule\n     * @param {string} name The name of the module. Will be used to create the property `Network.<name>`.\n     * @param {Network~moduleCallback} moduleCallback A callback used to initialize a module with a set of settings.\n     * @returns {Network}\n     */\n    _registerModule(name, moduleCallback)\n    {\n        /**\n         * A callback used to initialize a module with a set of settings.\n         * @private\n         * @callback Network~moduleCallback\n         * @param {Object} settings A set of custom settings.\n         * @returns {HttpModule} An instanciated subclass of `HttpModule`.\n         */\n        this._modules[name] = moduleCallback;\n        return this;\n    }\n\n    /**\n     * Initialize all the registered modules with the settings passed to the constructor.\n     * @private\n     * @method Network#_initModules\n     * @returns {Network}\n     */\n    _initModules()\n    {\n        if (!this._modulesInitialized) {\n            // Initialize the modules with their respective settings\n            Object.keys(this._modules).forEach(name => {\n                this._modules[name] = this._modules[name](this._pendingSettings[name]).on('_newRequest', () => {\n                    return !this.isRequesting();\n                });\n\n                this[name] = this._modules[name];\n            });\n\n            this._modulesInitialized = true;\n        }\n\n        return this;\n    }\n\n}\n","import {getGlobalObject} from '../utils/helpers';\nimport {enumerable} from '../utils/decorators';\n\n/**\n * @private\n * @class Timing\n */\nclass Timing {\n\n    /**\n     * Defines if the current browser supports some specific Timing APIs.\n     * @private\n     * @member {Object} Timing#_support\n     * @property {boolean} performance `true` if the Performance API is available.\n     * @property {boolean} userTiming `true` if the User Timing API is available.\n     * @property {boolean} resourceTiming `true` if the Resource Timing API is available.\n     */\n    @enumerable(false)\n    _support = {};\n\n    /**\n     * All the marks created by the `mark` method.\n     * @private\n     * @member {Object} Timing#_marks\n     */\n    @enumerable(false)\n    _marks = {};\n\n    /**\n     * All the measures created by the `measure` method.\n     * @private\n     * @member {Object} Timing#_measures\n     */\n    @enumerable(false)\n    _measures = {};\n\n    constructor()\n    {\n        const global = getGlobalObject();\n\n        this._support = {\n            performance: !!global.performance,\n            userTiming: global.performance && performance.mark,\n            resourceTiming: global.performance\n                            && (typeof performance.getEntriesByType == \"function\")\n                            && performance.timing\n        };\n    }\n\n    /**\n     * Create a new timing mark.\n     * @public\n     * @method Timing#mark\n     * @param {string} label A label associated to the mark.\n     * @returns {Timing}\n     */\n    mark(label)\n    {\n        const support = this._support,\n              marks = this._marks;\n\n        if (support.userTiming) {\n            performance.mark(label);\n        }\n\n        if (support.performance) {\n            marks[label] = performance.now();\n        } else {\n            marks[label] = (new Date).getTime();\n        }\n\n        return this;\n    }\n\n    /**\n     * Measure the delay between two marks.\n     * @public\n     * @method Timing#measure\n     * @param {string} measureLabel A label associated to the measure.\n     * @param {string} markLabelA The label of the first mark.\n     * @param {string} markLabelB The label of the second mark.\n     * @returns {number} The measured value.\n     */\n    measure(measureLabel, markLabelA, markLabelB)\n    {\n        const support = this._support,\n              marks = this._marks,\n              measures = this._measures;\n\n        if (typeof measures[measureLabel] == 'undefined') {\n            const measureWithoutUserTiming = marks[markLabelB] - marks[markLabelA];\n\n            if (support.userTiming) {\n                performance.measure(measureLabel, markLabelA, markLabelB);\n                const entriesByName = performance.getEntriesByName(measureLabel);\n\n                // The performance API could return no corresponding entries in Firefox so we must use a fallback.\n                // See: https://github.com/nesk/network.js/issues/32#issuecomment-118434305\n                measures[measureLabel] = entriesByName.length ? entriesByName[0].duration : measureWithoutUserTiming;\n            } else {\n                measures[measureLabel] = measureWithoutUserTiming;\n            }\n        }\n\n        return measures[measureLabel];\n    }\n\n    /**\n     * Determine if the current browser supports the Resource Timing API.\n     * @public\n     * @method Timing#supportsResourceTiming\n     * @returns {boolean} `true` if the Resource Timing API is supported, otherwise `false`.\n     */\n    supportsResourceTiming()\n    {\n        return this._support.resourceTiming;\n    }\n\n}\n\nexport default new Timing();\n","/**\n * @callback propertyDecorator\n * @param target\n * @param key\n * @param descriptor\n */\n\n/**\n * Set the enumerability of a property.\n * @private\n * @function enumerable\n * @param {boolean} isEnumerable Whether the property should be enumerable or not.\n * @returns {propertyDecorator}\n */\nexport function enumerable(isEnumerable) {\n    return function(target, key, descriptor) {\n        descriptor.enumerable = isEnumerable;\n        return descriptor;\n    };\n}\n","/**\n * Return the global object.\n * @private\n * @function getGlobalObject\n * @return {Object}\n * @see https://gist.github.com/rauschma/1bff02da66472f555c75\n */\nexport function getGlobalObject() {\n    // Workers don’t have `window`, only `self`.\n    if (typeof self !== 'undefined') {\n        return self;\n    }\n\n    if (typeof global !== 'undefined') {\n        return global;\n    }\n\n    // Not all environments allow `eval` and `Function`, use only as a last resort.\n    return new Function('return this')();\n}\n\n/**\n * Determine if the provided value is an object.\n * @private\n * @function isObject\n * @param {*} obj The value to check.\n * @returns {boolean} `true` if the value is an object, otherwise `false`.\n */\nexport function isObject(obj)\n{\n    return obj != undefined && obj != null && typeof obj.valueOf() == 'object';\n}\n\n/**\n * Make a deep copy of any value.\n * @private\n * @function copy\n * @param {*} value The value to copy.\n * @returns {*} The copied value.\n */\nexport function copy(value)\n{\n    return JSON.parse(JSON.stringify(value));\n}\n\n/**\n * Copy the properties in the source objects over to the destination object.\n * @private\n * @function _assign\n * @param {boolean} strict Given `true`, new properties will not be copied.\n * @param {Object} [target={}] The destination object.\n * @param {...Object} sources The source objects.\n * @returns {Object} The destination object once the properties are copied.\n */\nfunction _assign(strict, target = {}, ...sources)\n{\n    target = copy(target);\n\n    sources.forEach(source => {\n        Object.keys(source).forEach(key => {\n            if (!strict || target.hasOwnProperty(key)) {\n                let value = source[key];\n                target[key] = isObject(value) ? _assign(strict, target[key], value) : value;\n            }\n        })\n    });\n\n    return target;\n}\n\n/**\n * Copy all the properties in the source objects over to the destination object.\n * @private\n * @function assign\n * @param {Object} [target={}] The destination object.\n * @param {...Object} sources The source objects.\n * @returns {Object} The destination object once the properties are copied.\n */\nexport function assign(target = {}, ...sources)\n{\n    return _assign(false, target, ...sources);\n}\n\n/**\n * Copy the properties (but no new ones) in the source objects over to the destination object.\n * @private\n * @function assignStrict\n * @param {Object} [target={}] The destination object.\n * @param {...Object} sources The source objects.\n * @returns {Object} The destination object once the properties are copied.\n */\nexport function assignStrict(target = {}, ...sources)\n{\n    return _assign(true, target, ...sources);\n}\n\n/**\n * Get a copy of an object without some of its properties.\n * @private\n * @function except\n * @param {Object} obj The original object.\n * @param {string[]} properties The properties to exclude from the copied object.\n * @returns {Object} The copied object without the specified properties.\n */\nexport function except(obj, properties)\n{\n    let objCopy = copy(obj);\n\n    properties.forEach(index => delete objCopy[index]);\n\n    return objCopy;\n}\n\n/**\n * Defer the execution of a function.\n * @private\n * @function defer\n * @param {Function} func The function to defer.\n * @returns {Defer} The Defer object used to execute the function when needed.\n */\nexport function defer(func = () => {})\n{\n    /**\n     * @private\n     * @class Defer\n     */\n    return new class {\n        constructor()\n        {\n            this.func = func;\n        }\n\n        /**\n         * Execute the deferred function.\n         * @public\n         * @method Defer#run\n         */\n        run()\n        {\n            if (this.func) this.func();\n            delete this.func;\n        }\n    };\n}\n"],"sourceRoot":"/source/"}