1337 lines
59 KiB
JavaScript
1337 lines
59 KiB
JavaScript
/******/ (function(modules) { // webpackBootstrap
|
|
/******/ function hotDisposeChunk(chunkId) {
|
|
/******/ delete installedChunks[chunkId];
|
|
/******/ }
|
|
/******/ var parentHotUpdateCallback = this["webpackHotUpdate"];
|
|
/******/ this["webpackHotUpdate"] =
|
|
/******/ function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars
|
|
/******/ hotAddUpdateChunk(chunkId, moreModules);
|
|
/******/ if(parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
|
|
/******/ } ;
|
|
/******/
|
|
/******/ function hotDownloadUpdateChunk(chunkId) { // eslint-disable-line no-unused-vars
|
|
/******/ var head = document.getElementsByTagName("head")[0];
|
|
/******/ var script = document.createElement("script");
|
|
/******/ script.type = "text/javascript";
|
|
/******/ script.charset = "utf-8";
|
|
/******/ script.src = __webpack_require__.p + "" + chunkId + "." + hotCurrentHash + ".hot-update.js";
|
|
/******/ head.appendChild(script);
|
|
/******/ }
|
|
/******/
|
|
/******/ function hotDownloadManifest() { // eslint-disable-line no-unused-vars
|
|
/******/ return new Promise(function(resolve, reject) {
|
|
/******/ if(typeof XMLHttpRequest === "undefined")
|
|
/******/ return reject(new Error("No browser support"));
|
|
/******/ try {
|
|
/******/ var request = new XMLHttpRequest();
|
|
/******/ var requestPath = __webpack_require__.p + "" + hotCurrentHash + ".hot-update.json";
|
|
/******/ request.open("GET", requestPath, true);
|
|
/******/ request.timeout = 10000;
|
|
/******/ request.send(null);
|
|
/******/ } catch(err) {
|
|
/******/ return reject(err);
|
|
/******/ }
|
|
/******/ request.onreadystatechange = function() {
|
|
/******/ if(request.readyState !== 4) return;
|
|
/******/ if(request.status === 0) {
|
|
/******/ // timeout
|
|
/******/ reject(new Error("Manifest request to " + requestPath + " timed out."));
|
|
/******/ } else if(request.status === 404) {
|
|
/******/ // no update available
|
|
/******/ resolve();
|
|
/******/ } else if(request.status !== 200 && request.status !== 304) {
|
|
/******/ // other failure
|
|
/******/ reject(new Error("Manifest request to " + requestPath + " failed."));
|
|
/******/ } else {
|
|
/******/ // success
|
|
/******/ try {
|
|
/******/ var update = JSON.parse(request.responseText);
|
|
/******/ } catch(e) {
|
|
/******/ reject(e);
|
|
/******/ return;
|
|
/******/ }
|
|
/******/ resolve(update);
|
|
/******/ }
|
|
/******/ };
|
|
/******/ });
|
|
/******/ }
|
|
/******/
|
|
/******/
|
|
/******/
|
|
/******/ var hotApplyOnUpdate = true;
|
|
/******/ var hotCurrentHash = "92c8774f2f345bdf48a1"; // eslint-disable-line no-unused-vars
|
|
/******/ var hotCurrentModuleData = {};
|
|
/******/ var hotCurrentChildModule; // eslint-disable-line no-unused-vars
|
|
/******/ var hotCurrentParents = []; // eslint-disable-line no-unused-vars
|
|
/******/ var hotCurrentParentsTemp = []; // eslint-disable-line no-unused-vars
|
|
/******/
|
|
/******/ function hotCreateRequire(moduleId) { // eslint-disable-line no-unused-vars
|
|
/******/ var me = installedModules[moduleId];
|
|
/******/ if(!me) return __webpack_require__;
|
|
/******/ var fn = function(request) {
|
|
/******/ if(me.hot.active) {
|
|
/******/ if(installedModules[request]) {
|
|
/******/ if(installedModules[request].parents.indexOf(moduleId) < 0)
|
|
/******/ installedModules[request].parents.push(moduleId);
|
|
/******/ } else {
|
|
/******/ hotCurrentParents = [moduleId];
|
|
/******/ hotCurrentChildModule = request;
|
|
/******/ }
|
|
/******/ if(me.children.indexOf(request) < 0)
|
|
/******/ me.children.push(request);
|
|
/******/ } else {
|
|
/******/ console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
|
|
/******/ hotCurrentParents = [];
|
|
/******/ }
|
|
/******/ return __webpack_require__(request);
|
|
/******/ };
|
|
/******/ var ObjectFactory = function ObjectFactory(name) {
|
|
/******/ return {
|
|
/******/ configurable: true,
|
|
/******/ enumerable: true,
|
|
/******/ get: function() {
|
|
/******/ return __webpack_require__[name];
|
|
/******/ },
|
|
/******/ set: function(value) {
|
|
/******/ __webpack_require__[name] = value;
|
|
/******/ }
|
|
/******/ };
|
|
/******/ };
|
|
/******/ for(var name in __webpack_require__) {
|
|
/******/ if(Object.prototype.hasOwnProperty.call(__webpack_require__, name) && name !== "e") {
|
|
/******/ Object.defineProperty(fn, name, ObjectFactory(name));
|
|
/******/ }
|
|
/******/ }
|
|
/******/ fn.e = function(chunkId) {
|
|
/******/ if(hotStatus === "ready")
|
|
/******/ hotSetStatus("prepare");
|
|
/******/ hotChunksLoading++;
|
|
/******/ return __webpack_require__.e(chunkId).then(finishChunkLoading, function(err) {
|
|
/******/ finishChunkLoading();
|
|
/******/ throw err;
|
|
/******/ });
|
|
/******/
|
|
/******/ function finishChunkLoading() {
|
|
/******/ hotChunksLoading--;
|
|
/******/ if(hotStatus === "prepare") {
|
|
/******/ if(!hotWaitingFilesMap[chunkId]) {
|
|
/******/ hotEnsureUpdateChunk(chunkId);
|
|
/******/ }
|
|
/******/ if(hotChunksLoading === 0 && hotWaitingFiles === 0) {
|
|
/******/ hotUpdateDownloaded();
|
|
/******/ }
|
|
/******/ }
|
|
/******/ }
|
|
/******/ };
|
|
/******/ return fn;
|
|
/******/ }
|
|
/******/
|
|
/******/ function hotCreateModule(moduleId) { // eslint-disable-line no-unused-vars
|
|
/******/ var hot = {
|
|
/******/ // private stuff
|
|
/******/ _acceptedDependencies: {},
|
|
/******/ _declinedDependencies: {},
|
|
/******/ _selfAccepted: false,
|
|
/******/ _selfDeclined: false,
|
|
/******/ _disposeHandlers: [],
|
|
/******/ _main: hotCurrentChildModule !== moduleId,
|
|
/******/
|
|
/******/ // Module API
|
|
/******/ active: true,
|
|
/******/ accept: function(dep, callback) {
|
|
/******/ if(typeof dep === "undefined")
|
|
/******/ hot._selfAccepted = true;
|
|
/******/ else if(typeof dep === "function")
|
|
/******/ hot._selfAccepted = dep;
|
|
/******/ else if(typeof dep === "object")
|
|
/******/ for(var i = 0; i < dep.length; i++)
|
|
/******/ hot._acceptedDependencies[dep[i]] = callback || function() {};
|
|
/******/ else
|
|
/******/ hot._acceptedDependencies[dep] = callback || function() {};
|
|
/******/ },
|
|
/******/ decline: function(dep) {
|
|
/******/ if(typeof dep === "undefined")
|
|
/******/ hot._selfDeclined = true;
|
|
/******/ else if(typeof dep === "object")
|
|
/******/ for(var i = 0; i < dep.length; i++)
|
|
/******/ hot._declinedDependencies[dep[i]] = true;
|
|
/******/ else
|
|
/******/ hot._declinedDependencies[dep] = true;
|
|
/******/ },
|
|
/******/ dispose: function(callback) {
|
|
/******/ hot._disposeHandlers.push(callback);
|
|
/******/ },
|
|
/******/ addDisposeHandler: function(callback) {
|
|
/******/ hot._disposeHandlers.push(callback);
|
|
/******/ },
|
|
/******/ removeDisposeHandler: function(callback) {
|
|
/******/ var idx = hot._disposeHandlers.indexOf(callback);
|
|
/******/ if(idx >= 0) hot._disposeHandlers.splice(idx, 1);
|
|
/******/ },
|
|
/******/
|
|
/******/ // Management API
|
|
/******/ check: hotCheck,
|
|
/******/ apply: hotApply,
|
|
/******/ status: function(l) {
|
|
/******/ if(!l) return hotStatus;
|
|
/******/ hotStatusHandlers.push(l);
|
|
/******/ },
|
|
/******/ addStatusHandler: function(l) {
|
|
/******/ hotStatusHandlers.push(l);
|
|
/******/ },
|
|
/******/ removeStatusHandler: function(l) {
|
|
/******/ var idx = hotStatusHandlers.indexOf(l);
|
|
/******/ if(idx >= 0) hotStatusHandlers.splice(idx, 1);
|
|
/******/ },
|
|
/******/
|
|
/******/ //inherit from previous dispose call
|
|
/******/ data: hotCurrentModuleData[moduleId]
|
|
/******/ };
|
|
/******/ hotCurrentChildModule = undefined;
|
|
/******/ return hot;
|
|
/******/ }
|
|
/******/
|
|
/******/ var hotStatusHandlers = [];
|
|
/******/ var hotStatus = "idle";
|
|
/******/
|
|
/******/ function hotSetStatus(newStatus) {
|
|
/******/ hotStatus = newStatus;
|
|
/******/ for(var i = 0; i < hotStatusHandlers.length; i++)
|
|
/******/ hotStatusHandlers[i].call(null, newStatus);
|
|
/******/ }
|
|
/******/
|
|
/******/ // while downloading
|
|
/******/ var hotWaitingFiles = 0;
|
|
/******/ var hotChunksLoading = 0;
|
|
/******/ var hotWaitingFilesMap = {};
|
|
/******/ var hotRequestedFilesMap = {};
|
|
/******/ var hotAvailableFilesMap = {};
|
|
/******/ var hotDeferred;
|
|
/******/
|
|
/******/ // The update info
|
|
/******/ var hotUpdate, hotUpdateNewHash;
|
|
/******/
|
|
/******/ function toModuleId(id) {
|
|
/******/ var isNumber = (+id) + "" === id;
|
|
/******/ return isNumber ? +id : id;
|
|
/******/ }
|
|
/******/
|
|
/******/ function hotCheck(apply) {
|
|
/******/ if(hotStatus !== "idle") throw new Error("check() is only allowed in idle status");
|
|
/******/ hotApplyOnUpdate = apply;
|
|
/******/ hotSetStatus("check");
|
|
/******/ return hotDownloadManifest().then(function(update) {
|
|
/******/ if(!update) {
|
|
/******/ hotSetStatus("idle");
|
|
/******/ return null;
|
|
/******/ }
|
|
/******/ hotRequestedFilesMap = {};
|
|
/******/ hotWaitingFilesMap = {};
|
|
/******/ hotAvailableFilesMap = update.c;
|
|
/******/ hotUpdateNewHash = update.h;
|
|
/******/
|
|
/******/ hotSetStatus("prepare");
|
|
/******/ var promise = new Promise(function(resolve, reject) {
|
|
/******/ hotDeferred = {
|
|
/******/ resolve: resolve,
|
|
/******/ reject: reject
|
|
/******/ };
|
|
/******/ });
|
|
/******/ hotUpdate = {};
|
|
/******/ var chunkId = 1;
|
|
/******/ { // eslint-disable-line no-lone-blocks
|
|
/******/ /*globals chunkId */
|
|
/******/ hotEnsureUpdateChunk(chunkId);
|
|
/******/ }
|
|
/******/ if(hotStatus === "prepare" && hotChunksLoading === 0 && hotWaitingFiles === 0) {
|
|
/******/ hotUpdateDownloaded();
|
|
/******/ }
|
|
/******/ return promise;
|
|
/******/ });
|
|
/******/ }
|
|
/******/
|
|
/******/ function hotAddUpdateChunk(chunkId, moreModules) { // eslint-disable-line no-unused-vars
|
|
/******/ if(!hotAvailableFilesMap[chunkId] || !hotRequestedFilesMap[chunkId])
|
|
/******/ return;
|
|
/******/ hotRequestedFilesMap[chunkId] = false;
|
|
/******/ for(var moduleId in moreModules) {
|
|
/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
|
|
/******/ hotUpdate[moduleId] = moreModules[moduleId];
|
|
/******/ }
|
|
/******/ }
|
|
/******/ if(--hotWaitingFiles === 0 && hotChunksLoading === 0) {
|
|
/******/ hotUpdateDownloaded();
|
|
/******/ }
|
|
/******/ }
|
|
/******/
|
|
/******/ function hotEnsureUpdateChunk(chunkId) {
|
|
/******/ if(!hotAvailableFilesMap[chunkId]) {
|
|
/******/ hotWaitingFilesMap[chunkId] = true;
|
|
/******/ } else {
|
|
/******/ hotRequestedFilesMap[chunkId] = true;
|
|
/******/ hotWaitingFiles++;
|
|
/******/ hotDownloadUpdateChunk(chunkId);
|
|
/******/ }
|
|
/******/ }
|
|
/******/
|
|
/******/ function hotUpdateDownloaded() {
|
|
/******/ hotSetStatus("ready");
|
|
/******/ var deferred = hotDeferred;
|
|
/******/ hotDeferred = null;
|
|
/******/ if(!deferred) return;
|
|
/******/ if(hotApplyOnUpdate) {
|
|
/******/ hotApply(hotApplyOnUpdate).then(function(result) {
|
|
/******/ deferred.resolve(result);
|
|
/******/ }, function(err) {
|
|
/******/ deferred.reject(err);
|
|
/******/ });
|
|
/******/ } else {
|
|
/******/ var outdatedModules = [];
|
|
/******/ for(var id in hotUpdate) {
|
|
/******/ if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
|
|
/******/ outdatedModules.push(toModuleId(id));
|
|
/******/ }
|
|
/******/ }
|
|
/******/ deferred.resolve(outdatedModules);
|
|
/******/ }
|
|
/******/ }
|
|
/******/
|
|
/******/ function hotApply(options) {
|
|
/******/ if(hotStatus !== "ready") throw new Error("apply() is only allowed in ready status");
|
|
/******/ options = options || {};
|
|
/******/
|
|
/******/ var cb;
|
|
/******/ var i;
|
|
/******/ var j;
|
|
/******/ var module;
|
|
/******/ var moduleId;
|
|
/******/
|
|
/******/ function getAffectedStuff(updateModuleId) {
|
|
/******/ var outdatedModules = [updateModuleId];
|
|
/******/ var outdatedDependencies = {};
|
|
/******/
|
|
/******/ var queue = outdatedModules.slice().map(function(id) {
|
|
/******/ return {
|
|
/******/ chain: [id],
|
|
/******/ id: id
|
|
/******/ };
|
|
/******/ });
|
|
/******/ while(queue.length > 0) {
|
|
/******/ var queueItem = queue.pop();
|
|
/******/ var moduleId = queueItem.id;
|
|
/******/ var chain = queueItem.chain;
|
|
/******/ module = installedModules[moduleId];
|
|
/******/ if(!module || module.hot._selfAccepted)
|
|
/******/ continue;
|
|
/******/ if(module.hot._selfDeclined) {
|
|
/******/ return {
|
|
/******/ type: "self-declined",
|
|
/******/ chain: chain,
|
|
/******/ moduleId: moduleId
|
|
/******/ };
|
|
/******/ }
|
|
/******/ if(module.hot._main) {
|
|
/******/ return {
|
|
/******/ type: "unaccepted",
|
|
/******/ chain: chain,
|
|
/******/ moduleId: moduleId
|
|
/******/ };
|
|
/******/ }
|
|
/******/ for(var i = 0; i < module.parents.length; i++) {
|
|
/******/ var parentId = module.parents[i];
|
|
/******/ var parent = installedModules[parentId];
|
|
/******/ if(!parent) continue;
|
|
/******/ if(parent.hot._declinedDependencies[moduleId]) {
|
|
/******/ return {
|
|
/******/ type: "declined",
|
|
/******/ chain: chain.concat([parentId]),
|
|
/******/ moduleId: moduleId,
|
|
/******/ parentId: parentId
|
|
/******/ };
|
|
/******/ }
|
|
/******/ if(outdatedModules.indexOf(parentId) >= 0) continue;
|
|
/******/ if(parent.hot._acceptedDependencies[moduleId]) {
|
|
/******/ if(!outdatedDependencies[parentId])
|
|
/******/ outdatedDependencies[parentId] = [];
|
|
/******/ addAllToSet(outdatedDependencies[parentId], [moduleId]);
|
|
/******/ continue;
|
|
/******/ }
|
|
/******/ delete outdatedDependencies[parentId];
|
|
/******/ outdatedModules.push(parentId);
|
|
/******/ queue.push({
|
|
/******/ chain: chain.concat([parentId]),
|
|
/******/ id: parentId
|
|
/******/ });
|
|
/******/ }
|
|
/******/ }
|
|
/******/
|
|
/******/ return {
|
|
/******/ type: "accepted",
|
|
/******/ moduleId: updateModuleId,
|
|
/******/ outdatedModules: outdatedModules,
|
|
/******/ outdatedDependencies: outdatedDependencies
|
|
/******/ };
|
|
/******/ }
|
|
/******/
|
|
/******/ function addAllToSet(a, b) {
|
|
/******/ for(var i = 0; i < b.length; i++) {
|
|
/******/ var item = b[i];
|
|
/******/ if(a.indexOf(item) < 0)
|
|
/******/ a.push(item);
|
|
/******/ }
|
|
/******/ }
|
|
/******/
|
|
/******/ // at begin all updates modules are outdated
|
|
/******/ // the "outdated" status can propagate to parents if they don't accept the children
|
|
/******/ var outdatedDependencies = {};
|
|
/******/ var outdatedModules = [];
|
|
/******/ var appliedUpdate = {};
|
|
/******/
|
|
/******/ var warnUnexpectedRequire = function warnUnexpectedRequire() {
|
|
/******/ console.warn("[HMR] unexpected require(" + result.moduleId + ") to disposed module");
|
|
/******/ };
|
|
/******/
|
|
/******/ for(var id in hotUpdate) {
|
|
/******/ if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
|
|
/******/ moduleId = toModuleId(id);
|
|
/******/ var result;
|
|
/******/ if(hotUpdate[id]) {
|
|
/******/ result = getAffectedStuff(moduleId);
|
|
/******/ } else {
|
|
/******/ result = {
|
|
/******/ type: "disposed",
|
|
/******/ moduleId: id
|
|
/******/ };
|
|
/******/ }
|
|
/******/ var abortError = false;
|
|
/******/ var doApply = false;
|
|
/******/ var doDispose = false;
|
|
/******/ var chainInfo = "";
|
|
/******/ if(result.chain) {
|
|
/******/ chainInfo = "\nUpdate propagation: " + result.chain.join(" -> ");
|
|
/******/ }
|
|
/******/ switch(result.type) {
|
|
/******/ case "self-declined":
|
|
/******/ if(options.onDeclined)
|
|
/******/ options.onDeclined(result);
|
|
/******/ if(!options.ignoreDeclined)
|
|
/******/ abortError = new Error("Aborted because of self decline: " + result.moduleId + chainInfo);
|
|
/******/ break;
|
|
/******/ case "declined":
|
|
/******/ if(options.onDeclined)
|
|
/******/ options.onDeclined(result);
|
|
/******/ if(!options.ignoreDeclined)
|
|
/******/ abortError = new Error("Aborted because of declined dependency: " + result.moduleId + " in " + result.parentId + chainInfo);
|
|
/******/ break;
|
|
/******/ case "unaccepted":
|
|
/******/ if(options.onUnaccepted)
|
|
/******/ options.onUnaccepted(result);
|
|
/******/ if(!options.ignoreUnaccepted)
|
|
/******/ abortError = new Error("Aborted because " + moduleId + " is not accepted" + chainInfo);
|
|
/******/ break;
|
|
/******/ case "accepted":
|
|
/******/ if(options.onAccepted)
|
|
/******/ options.onAccepted(result);
|
|
/******/ doApply = true;
|
|
/******/ break;
|
|
/******/ case "disposed":
|
|
/******/ if(options.onDisposed)
|
|
/******/ options.onDisposed(result);
|
|
/******/ doDispose = true;
|
|
/******/ break;
|
|
/******/ default:
|
|
/******/ throw new Error("Unexception type " + result.type);
|
|
/******/ }
|
|
/******/ if(abortError) {
|
|
/******/ hotSetStatus("abort");
|
|
/******/ return Promise.reject(abortError);
|
|
/******/ }
|
|
/******/ if(doApply) {
|
|
/******/ appliedUpdate[moduleId] = hotUpdate[moduleId];
|
|
/******/ addAllToSet(outdatedModules, result.outdatedModules);
|
|
/******/ for(moduleId in result.outdatedDependencies) {
|
|
/******/ if(Object.prototype.hasOwnProperty.call(result.outdatedDependencies, moduleId)) {
|
|
/******/ if(!outdatedDependencies[moduleId])
|
|
/******/ outdatedDependencies[moduleId] = [];
|
|
/******/ addAllToSet(outdatedDependencies[moduleId], result.outdatedDependencies[moduleId]);
|
|
/******/ }
|
|
/******/ }
|
|
/******/ }
|
|
/******/ if(doDispose) {
|
|
/******/ addAllToSet(outdatedModules, [result.moduleId]);
|
|
/******/ appliedUpdate[moduleId] = warnUnexpectedRequire;
|
|
/******/ }
|
|
/******/ }
|
|
/******/ }
|
|
/******/
|
|
/******/ // Store self accepted outdated modules to require them later by the module system
|
|
/******/ var outdatedSelfAcceptedModules = [];
|
|
/******/ for(i = 0; i < outdatedModules.length; i++) {
|
|
/******/ moduleId = outdatedModules[i];
|
|
/******/ if(installedModules[moduleId] && installedModules[moduleId].hot._selfAccepted)
|
|
/******/ outdatedSelfAcceptedModules.push({
|
|
/******/ module: moduleId,
|
|
/******/ errorHandler: installedModules[moduleId].hot._selfAccepted
|
|
/******/ });
|
|
/******/ }
|
|
/******/
|
|
/******/ // Now in "dispose" phase
|
|
/******/ hotSetStatus("dispose");
|
|
/******/ Object.keys(hotAvailableFilesMap).forEach(function(chunkId) {
|
|
/******/ if(hotAvailableFilesMap[chunkId] === false) {
|
|
/******/ hotDisposeChunk(chunkId);
|
|
/******/ }
|
|
/******/ });
|
|
/******/
|
|
/******/ var idx;
|
|
/******/ var queue = outdatedModules.slice();
|
|
/******/ while(queue.length > 0) {
|
|
/******/ moduleId = queue.pop();
|
|
/******/ module = installedModules[moduleId];
|
|
/******/ if(!module) continue;
|
|
/******/
|
|
/******/ var data = {};
|
|
/******/
|
|
/******/ // Call dispose handlers
|
|
/******/ var disposeHandlers = module.hot._disposeHandlers;
|
|
/******/ for(j = 0; j < disposeHandlers.length; j++) {
|
|
/******/ cb = disposeHandlers[j];
|
|
/******/ cb(data);
|
|
/******/ }
|
|
/******/ hotCurrentModuleData[moduleId] = data;
|
|
/******/
|
|
/******/ // disable module (this disables requires from this module)
|
|
/******/ module.hot.active = false;
|
|
/******/
|
|
/******/ // remove module from cache
|
|
/******/ delete installedModules[moduleId];
|
|
/******/
|
|
/******/ // remove "parents" references from all children
|
|
/******/ for(j = 0; j < module.children.length; j++) {
|
|
/******/ var child = installedModules[module.children[j]];
|
|
/******/ if(!child) continue;
|
|
/******/ idx = child.parents.indexOf(moduleId);
|
|
/******/ if(idx >= 0) {
|
|
/******/ child.parents.splice(idx, 1);
|
|
/******/ }
|
|
/******/ }
|
|
/******/ }
|
|
/******/
|
|
/******/ // remove outdated dependency from module children
|
|
/******/ var dependency;
|
|
/******/ var moduleOutdatedDependencies;
|
|
/******/ for(moduleId in outdatedDependencies) {
|
|
/******/ if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) {
|
|
/******/ module = installedModules[moduleId];
|
|
/******/ if(module) {
|
|
/******/ moduleOutdatedDependencies = outdatedDependencies[moduleId];
|
|
/******/ for(j = 0; j < moduleOutdatedDependencies.length; j++) {
|
|
/******/ dependency = moduleOutdatedDependencies[j];
|
|
/******/ idx = module.children.indexOf(dependency);
|
|
/******/ if(idx >= 0) module.children.splice(idx, 1);
|
|
/******/ }
|
|
/******/ }
|
|
/******/ }
|
|
/******/ }
|
|
/******/
|
|
/******/ // Not in "apply" phase
|
|
/******/ hotSetStatus("apply");
|
|
/******/
|
|
/******/ hotCurrentHash = hotUpdateNewHash;
|
|
/******/
|
|
/******/ // insert new code
|
|
/******/ for(moduleId in appliedUpdate) {
|
|
/******/ if(Object.prototype.hasOwnProperty.call(appliedUpdate, moduleId)) {
|
|
/******/ modules[moduleId] = appliedUpdate[moduleId];
|
|
/******/ }
|
|
/******/ }
|
|
/******/
|
|
/******/ // call accept handlers
|
|
/******/ var error = null;
|
|
/******/ for(moduleId in outdatedDependencies) {
|
|
/******/ if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) {
|
|
/******/ module = installedModules[moduleId];
|
|
/******/ moduleOutdatedDependencies = outdatedDependencies[moduleId];
|
|
/******/ var callbacks = [];
|
|
/******/ for(i = 0; i < moduleOutdatedDependencies.length; i++) {
|
|
/******/ dependency = moduleOutdatedDependencies[i];
|
|
/******/ cb = module.hot._acceptedDependencies[dependency];
|
|
/******/ if(callbacks.indexOf(cb) >= 0) continue;
|
|
/******/ callbacks.push(cb);
|
|
/******/ }
|
|
/******/ for(i = 0; i < callbacks.length; i++) {
|
|
/******/ cb = callbacks[i];
|
|
/******/ try {
|
|
/******/ cb(moduleOutdatedDependencies);
|
|
/******/ } catch(err) {
|
|
/******/ if(options.onErrored) {
|
|
/******/ options.onErrored({
|
|
/******/ type: "accept-errored",
|
|
/******/ moduleId: moduleId,
|
|
/******/ dependencyId: moduleOutdatedDependencies[i],
|
|
/******/ error: err
|
|
/******/ });
|
|
/******/ }
|
|
/******/ if(!options.ignoreErrored) {
|
|
/******/ if(!error)
|
|
/******/ error = err;
|
|
/******/ }
|
|
/******/ }
|
|
/******/ }
|
|
/******/ }
|
|
/******/ }
|
|
/******/
|
|
/******/ // Load self accepted modules
|
|
/******/ for(i = 0; i < outdatedSelfAcceptedModules.length; i++) {
|
|
/******/ var item = outdatedSelfAcceptedModules[i];
|
|
/******/ moduleId = item.module;
|
|
/******/ hotCurrentParents = [moduleId];
|
|
/******/ try {
|
|
/******/ __webpack_require__(moduleId);
|
|
/******/ } catch(err) {
|
|
/******/ if(typeof item.errorHandler === "function") {
|
|
/******/ try {
|
|
/******/ item.errorHandler(err);
|
|
/******/ } catch(err2) {
|
|
/******/ if(options.onErrored) {
|
|
/******/ options.onErrored({
|
|
/******/ type: "self-accept-error-handler-errored",
|
|
/******/ moduleId: moduleId,
|
|
/******/ error: err2,
|
|
/******/ orginalError: err
|
|
/******/ });
|
|
/******/ }
|
|
/******/ if(!options.ignoreErrored) {
|
|
/******/ if(!error)
|
|
/******/ error = err2;
|
|
/******/ }
|
|
/******/ if(!error)
|
|
/******/ error = err;
|
|
/******/ }
|
|
/******/ } else {
|
|
/******/ if(options.onErrored) {
|
|
/******/ options.onErrored({
|
|
/******/ type: "self-accept-errored",
|
|
/******/ moduleId: moduleId,
|
|
/******/ error: err
|
|
/******/ });
|
|
/******/ }
|
|
/******/ if(!options.ignoreErrored) {
|
|
/******/ if(!error)
|
|
/******/ error = err;
|
|
/******/ }
|
|
/******/ }
|
|
/******/ }
|
|
/******/ }
|
|
/******/
|
|
/******/ // handle errors in accept handlers and self accepted module load
|
|
/******/ if(error) {
|
|
/******/ hotSetStatus("fail");
|
|
/******/ return Promise.reject(error);
|
|
/******/ }
|
|
/******/
|
|
/******/ hotSetStatus("idle");
|
|
/******/ return new Promise(function(resolve) {
|
|
/******/ resolve(outdatedModules);
|
|
/******/ });
|
|
/******/ }
|
|
/******/
|
|
/******/ // The module cache
|
|
/******/ var installedModules = {};
|
|
/******/
|
|
/******/ // The require function
|
|
/******/ function __webpack_require__(moduleId) {
|
|
/******/
|
|
/******/ // Check if module is in cache
|
|
/******/ if(installedModules[moduleId]) {
|
|
/******/ return installedModules[moduleId].exports;
|
|
/******/ }
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/ var module = installedModules[moduleId] = {
|
|
/******/ i: moduleId,
|
|
/******/ l: false,
|
|
/******/ exports: {},
|
|
/******/ hot: hotCreateModule(moduleId),
|
|
/******/ parents: (hotCurrentParentsTemp = hotCurrentParents, hotCurrentParents = [], hotCurrentParentsTemp),
|
|
/******/ children: []
|
|
/******/ };
|
|
/******/
|
|
/******/ // Execute the module function
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
|
|
/******/
|
|
/******/ // Flag the module as loaded
|
|
/******/ module.l = true;
|
|
/******/
|
|
/******/ // Return the exports of the module
|
|
/******/ return module.exports;
|
|
/******/ }
|
|
/******/
|
|
/******/
|
|
/******/ // expose the modules object (__webpack_modules__)
|
|
/******/ __webpack_require__.m = modules;
|
|
/******/
|
|
/******/ // expose the module cache
|
|
/******/ __webpack_require__.c = installedModules;
|
|
/******/
|
|
/******/ // identity function for calling harmony imports with the correct context
|
|
/******/ __webpack_require__.i = function(value) { return value; };
|
|
/******/
|
|
/******/ // define getter function for harmony exports
|
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
/******/ Object.defineProperty(exports, name, {
|
|
/******/ configurable: false,
|
|
/******/ enumerable: true,
|
|
/******/ get: getter
|
|
/******/ });
|
|
/******/ }
|
|
/******/ };
|
|
/******/
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
/******/ __webpack_require__.n = function(module) {
|
|
/******/ var getter = module && module.__esModule ?
|
|
/******/ function getDefault() { return module['default']; } :
|
|
/******/ function getModuleExports() { return module; };
|
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
/******/ return getter;
|
|
/******/ };
|
|
/******/
|
|
/******/ // Object.prototype.hasOwnProperty.call
|
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
/******/
|
|
/******/ // __webpack_public_path__
|
|
/******/ __webpack_require__.p = "";
|
|
/******/
|
|
/******/ // __webpack_hash__
|
|
/******/ __webpack_require__.h = function() { return hotCurrentHash; };
|
|
/******/
|
|
/******/ // Load entry module and return exports
|
|
/******/ return hotCreateRequire(13)(__webpack_require__.s = 13);
|
|
/******/ })
|
|
/************************************************************************/
|
|
/******/ ([
|
|
/* 0 */
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_translatable_input__ = __webpack_require__(11);
|
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_translatable_input___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__components_translatable_input__);
|
|
/**
|
|
* 2007-2018 PrestaShop
|
|
*
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* This source file is subject to the Open Software License (OSL 3.0)
|
|
* that is bundled with this package in the file LICENSE.txt.
|
|
* It is also available through the world-wide-web at this URL:
|
|
* https://opensource.org/licenses/OSL-3.0
|
|
* If you did not receive a copy of the license and are unable to
|
|
* obtain it through the world-wide-web, please send an email
|
|
* to license@prestashop.com so we can send you a copy immediately.
|
|
*
|
|
* DISCLAIMER
|
|
*
|
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
|
* versions in the future. If you wish to customize PrestaShop for your
|
|
* needs please refer to http://www.prestashop.com for more information.
|
|
*
|
|
* @author PrestaShop SA <contact@prestashop.com>
|
|
* @copyright 2007-2018 PrestaShop SA
|
|
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
|
* International Registered Trademark & Property of PrestaShop SA
|
|
*/
|
|
|
|
|
|
|
|
var $ = window.$;
|
|
|
|
$(function () {
|
|
new __WEBPACK_IMPORTED_MODULE_0__components_translatable_input___default.a({ localeInputSelector: '.js-locale-input' });
|
|
|
|
var idHookSelect = $('#form_link_block_id_hook');
|
|
if (idHookSelect.hasClass('select2-hidden-accessible')) {
|
|
var targetNode = document.getElementsByTagName('body')[0];
|
|
var observer = new MutationObserver(function (mutationsList, observer) {
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = mutationsList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var mutation = _step.value;
|
|
|
|
if (mutation.type === 'childList' && mutation.addedNodes.length == 1) {
|
|
var node = mutation.addedNodes[0];
|
|
if ($(node).hasClass('select2-container--open')) {
|
|
$('#select2-form_link_block_id_hook-results li').each(function () {
|
|
$(this).attr('data-hook-name', $(this).html());
|
|
});
|
|
}
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
observer.observe(targetNode, { childList: true });
|
|
}
|
|
|
|
var addCustomButton = $('.add-collection-btn');
|
|
addCustomButton.on('click', appendPrototype);
|
|
|
|
var collectionId = addCustomButton.data().collectionId;
|
|
var collection = document.getElementById(collectionId);
|
|
var collectionPrototype = collection.dataset.prototype;
|
|
|
|
if (collection.children.length) {
|
|
$('.custom_collection .col-sm-12').each(function (index, customBlock) {
|
|
appendDeleteButton($(customBlock));
|
|
});
|
|
} else {
|
|
appendPrototype();
|
|
}
|
|
|
|
function appendPrototype(event) {
|
|
if (event) {
|
|
event.preventDefault();
|
|
}
|
|
|
|
var newChild = collectionPrototype.replace(/__name__/g, collection.children.length + 1);
|
|
var $newChild = $(newChild);
|
|
$('#' + collectionId).append($newChild);
|
|
appendDeleteButton($newChild);
|
|
}
|
|
|
|
function appendDeleteButton(customBlock) {
|
|
var collection = customBlock.closest('.custom_collection');
|
|
var $button = $('<button class="remove_custom_url btn btn-primary mt-1">' + collection.data('deleteButtonLabel') + '</button>');
|
|
$button.on('click', function (event) {
|
|
event.preventDefault();
|
|
var $button = $(event.target);
|
|
var $row = $button.closest('.row');
|
|
$row.remove();
|
|
|
|
return false;
|
|
});
|
|
customBlock.find('.locale-input-group').first().closest('.col-sm-12').append($button);
|
|
}
|
|
});
|
|
|
|
/***/ }),
|
|
/* 1 */,
|
|
/* 2 */,
|
|
/* 3 */,
|
|
/* 4 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.EventEmitter = undefined;
|
|
|
|
var _events = __webpack_require__(12);
|
|
|
|
var _events2 = _interopRequireDefault(_events);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
/**
|
|
* We instanciate one EventEmitter (restricted via a const) so that every components
|
|
* register/dispatch on the same one and can communicate with each other.
|
|
*/
|
|
var EventEmitter = exports.EventEmitter = new _events2.default(); /**
|
|
* 2007-2020 PrestaShop SA and Contributors
|
|
*
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* This source file is subject to the Open Software License (OSL 3.0)
|
|
* that is bundled with this package in the file LICENSE.txt.
|
|
* It is also available through the world-wide-web at this URL:
|
|
* https://opensource.org/licenses/OSL-3.0
|
|
* If you did not receive a copy of the license and are unable to
|
|
* obtain it through the world-wide-web, please send an email
|
|
* to license@prestashop.com so we can send you a copy immediately.
|
|
*
|
|
* DISCLAIMER
|
|
*
|
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
|
* versions in the future. If you wish to customize PrestaShop for your
|
|
* needs please refer to https://www.prestashop.com for more information.
|
|
*
|
|
* @author PrestaShop SA <contact@prestashop.com>
|
|
* @copyright 2007-2020 PrestaShop SA and Contributors
|
|
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
|
* International Registered Trademark & Property of PrestaShop SA
|
|
*/
|
|
|
|
exports.default = EventEmitter;
|
|
|
|
/***/ }),
|
|
/* 5 */,
|
|
/* 6 */,
|
|
/* 7 */,
|
|
/* 8 */,
|
|
/* 9 */,
|
|
/* 10 */,
|
|
/* 11 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _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; }; }(); /**
|
|
* 2007-2020 PrestaShop SA and Contributors
|
|
*
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* This source file is subject to the Open Software License (OSL 3.0)
|
|
* that is bundled with this package in the file LICENSE.txt.
|
|
* It is also available through the world-wide-web at this URL:
|
|
* https://opensource.org/licenses/OSL-3.0
|
|
* If you did not receive a copy of the license and are unable to
|
|
* obtain it through the world-wide-web, please send an email
|
|
* to license@prestashop.com so we can send you a copy immediately.
|
|
*
|
|
* DISCLAIMER
|
|
*
|
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
|
* versions in the future. If you wish to customize PrestaShop for your
|
|
* needs please refer to https://www.prestashop.com for more information.
|
|
*
|
|
* @author PrestaShop SA <contact@prestashop.com>
|
|
* @copyright 2007-2020 PrestaShop SA and Contributors
|
|
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
|
* International Registered Trademark & Property of PrestaShop SA
|
|
*/
|
|
|
|
var _eventEmitter = __webpack_require__(4);
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
var _window = window,
|
|
$ = _window.$;
|
|
|
|
/**
|
|
* This class is used to automatically toggle translated inputs (displayed with one
|
|
* input and a language selector using the TranslatableType Symfony form type).
|
|
* Also compatible with TranslatableField changes.
|
|
*/
|
|
|
|
var TranslatableInput = function () {
|
|
function TranslatableInput(options) {
|
|
_classCallCheck(this, TranslatableInput);
|
|
|
|
var opts = options || {};
|
|
|
|
this.localeItemSelector = opts.localeItemSelector || '.js-locale-item';
|
|
this.localeButtonSelector = opts.localeButtonSelector || '.js-locale-btn';
|
|
this.localeInputSelector = opts.localeInputSelector || '.js-locale-input';
|
|
|
|
$('body').on('click', this.localeItemSelector, this.toggleLanguage.bind(this));
|
|
_eventEmitter.EventEmitter.on('languageSelected', this.toggleInputs.bind(this));
|
|
}
|
|
|
|
/**
|
|
* Dispatch event on language selection to update inputs and other components which depend on the locale.
|
|
*
|
|
* @param event
|
|
*/
|
|
|
|
|
|
_createClass(TranslatableInput, [{
|
|
key: 'toggleLanguage',
|
|
value: function toggleLanguage(event) {
|
|
var localeItem = $(event.target);
|
|
var form = localeItem.closest('form');
|
|
_eventEmitter.EventEmitter.emit('languageSelected', {
|
|
selectedLocale: localeItem.data('locale'),
|
|
form: form
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Toggle all translatable inputs in form in which locale was changed
|
|
*
|
|
* @param {Event} event
|
|
*/
|
|
|
|
}, {
|
|
key: 'toggleInputs',
|
|
value: function toggleInputs(event) {
|
|
var form = event.form;
|
|
var selectedLocale = event.selectedLocale;
|
|
|
|
var localeButton = form.find(this.localeButtonSelector);
|
|
var changeLanguageUrl = localeButton.data('change-language-url');
|
|
|
|
localeButton.text(selectedLocale);
|
|
form.find(this.localeInputSelector).addClass('d-none');
|
|
form.find(this.localeInputSelector + '.js-locale-' + selectedLocale).removeClass('d-none');
|
|
|
|
if (changeLanguageUrl) {
|
|
this.saveSelectedLanguage(changeLanguageUrl, selectedLocale);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Save language choice for employee forms.
|
|
*
|
|
* @param {String} changeLanguageUrl
|
|
* @param {String} selectedLocale
|
|
*
|
|
* @private
|
|
*/
|
|
|
|
}, {
|
|
key: 'saveSelectedLanguage',
|
|
value: function saveSelectedLanguage(changeLanguageUrl, selectedLocale) {
|
|
$.post({
|
|
url: changeLanguageUrl,
|
|
data: {
|
|
language_iso_code: selectedLocale
|
|
}
|
|
});
|
|
}
|
|
}]);
|
|
|
|
return TranslatableInput;
|
|
}();
|
|
|
|
exports.default = TranslatableInput;
|
|
|
|
/***/ }),
|
|
/* 12 */
|
|
/***/ (function(module, exports) {
|
|
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
function EventEmitter() {
|
|
this._events = this._events || {};
|
|
this._maxListeners = this._maxListeners || undefined;
|
|
}
|
|
module.exports = EventEmitter;
|
|
|
|
// Backwards-compat with node 0.10.x
|
|
EventEmitter.EventEmitter = EventEmitter;
|
|
|
|
EventEmitter.prototype._events = undefined;
|
|
EventEmitter.prototype._maxListeners = undefined;
|
|
|
|
// By default EventEmitters will print a warning if more than 10 listeners are
|
|
// added to it. This is a useful default which helps finding memory leaks.
|
|
EventEmitter.defaultMaxListeners = 10;
|
|
|
|
// Obviously not all Emitters should be limited to 10. This function allows
|
|
// that to be increased. Set to zero for unlimited.
|
|
EventEmitter.prototype.setMaxListeners = function(n) {
|
|
if (!isNumber(n) || n < 0 || isNaN(n))
|
|
throw TypeError('n must be a positive number');
|
|
this._maxListeners = n;
|
|
return this;
|
|
};
|
|
|
|
EventEmitter.prototype.emit = function(type) {
|
|
var er, handler, len, args, i, listeners;
|
|
|
|
if (!this._events)
|
|
this._events = {};
|
|
|
|
// If there is no 'error' event listener then throw.
|
|
if (type === 'error') {
|
|
if (!this._events.error ||
|
|
(isObject(this._events.error) && !this._events.error.length)) {
|
|
er = arguments[1];
|
|
if (er instanceof Error) {
|
|
throw er; // Unhandled 'error' event
|
|
} else {
|
|
// At least give some kind of context to the user
|
|
var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
|
|
err.context = er;
|
|
throw err;
|
|
}
|
|
}
|
|
}
|
|
|
|
handler = this._events[type];
|
|
|
|
if (isUndefined(handler))
|
|
return false;
|
|
|
|
if (isFunction(handler)) {
|
|
switch (arguments.length) {
|
|
// fast cases
|
|
case 1:
|
|
handler.call(this);
|
|
break;
|
|
case 2:
|
|
handler.call(this, arguments[1]);
|
|
break;
|
|
case 3:
|
|
handler.call(this, arguments[1], arguments[2]);
|
|
break;
|
|
// slower
|
|
default:
|
|
args = Array.prototype.slice.call(arguments, 1);
|
|
handler.apply(this, args);
|
|
}
|
|
} else if (isObject(handler)) {
|
|
args = Array.prototype.slice.call(arguments, 1);
|
|
listeners = handler.slice();
|
|
len = listeners.length;
|
|
for (i = 0; i < len; i++)
|
|
listeners[i].apply(this, args);
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
EventEmitter.prototype.addListener = function(type, listener) {
|
|
var m;
|
|
|
|
if (!isFunction(listener))
|
|
throw TypeError('listener must be a function');
|
|
|
|
if (!this._events)
|
|
this._events = {};
|
|
|
|
// To avoid recursion in the case that type === "newListener"! Before
|
|
// adding it to the listeners, first emit "newListener".
|
|
if (this._events.newListener)
|
|
this.emit('newListener', type,
|
|
isFunction(listener.listener) ?
|
|
listener.listener : listener);
|
|
|
|
if (!this._events[type])
|
|
// Optimize the case of one listener. Don't need the extra array object.
|
|
this._events[type] = listener;
|
|
else if (isObject(this._events[type]))
|
|
// If we've already got an array, just append.
|
|
this._events[type].push(listener);
|
|
else
|
|
// Adding the second element, need to change to array.
|
|
this._events[type] = [this._events[type], listener];
|
|
|
|
// Check for listener leak
|
|
if (isObject(this._events[type]) && !this._events[type].warned) {
|
|
if (!isUndefined(this._maxListeners)) {
|
|
m = this._maxListeners;
|
|
} else {
|
|
m = EventEmitter.defaultMaxListeners;
|
|
}
|
|
|
|
if (m && m > 0 && this._events[type].length > m) {
|
|
this._events[type].warned = true;
|
|
console.error('(node) warning: possible EventEmitter memory ' +
|
|
'leak detected. %d listeners added. ' +
|
|
'Use emitter.setMaxListeners() to increase limit.',
|
|
this._events[type].length);
|
|
if (typeof console.trace === 'function') {
|
|
// not supported in IE 10
|
|
console.trace();
|
|
}
|
|
}
|
|
}
|
|
|
|
return this;
|
|
};
|
|
|
|
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
|
|
EventEmitter.prototype.once = function(type, listener) {
|
|
if (!isFunction(listener))
|
|
throw TypeError('listener must be a function');
|
|
|
|
var fired = false;
|
|
|
|
function g() {
|
|
this.removeListener(type, g);
|
|
|
|
if (!fired) {
|
|
fired = true;
|
|
listener.apply(this, arguments);
|
|
}
|
|
}
|
|
|
|
g.listener = listener;
|
|
this.on(type, g);
|
|
|
|
return this;
|
|
};
|
|
|
|
// emits a 'removeListener' event iff the listener was removed
|
|
EventEmitter.prototype.removeListener = function(type, listener) {
|
|
var list, position, length, i;
|
|
|
|
if (!isFunction(listener))
|
|
throw TypeError('listener must be a function');
|
|
|
|
if (!this._events || !this._events[type])
|
|
return this;
|
|
|
|
list = this._events[type];
|
|
length = list.length;
|
|
position = -1;
|
|
|
|
if (list === listener ||
|
|
(isFunction(list.listener) && list.listener === listener)) {
|
|
delete this._events[type];
|
|
if (this._events.removeListener)
|
|
this.emit('removeListener', type, listener);
|
|
|
|
} else if (isObject(list)) {
|
|
for (i = length; i-- > 0;) {
|
|
if (list[i] === listener ||
|
|
(list[i].listener && list[i].listener === listener)) {
|
|
position = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (position < 0)
|
|
return this;
|
|
|
|
if (list.length === 1) {
|
|
list.length = 0;
|
|
delete this._events[type];
|
|
} else {
|
|
list.splice(position, 1);
|
|
}
|
|
|
|
if (this._events.removeListener)
|
|
this.emit('removeListener', type, listener);
|
|
}
|
|
|
|
return this;
|
|
};
|
|
|
|
EventEmitter.prototype.removeAllListeners = function(type) {
|
|
var key, listeners;
|
|
|
|
if (!this._events)
|
|
return this;
|
|
|
|
// not listening for removeListener, no need to emit
|
|
if (!this._events.removeListener) {
|
|
if (arguments.length === 0)
|
|
this._events = {};
|
|
else if (this._events[type])
|
|
delete this._events[type];
|
|
return this;
|
|
}
|
|
|
|
// emit removeListener for all listeners on all events
|
|
if (arguments.length === 0) {
|
|
for (key in this._events) {
|
|
if (key === 'removeListener') continue;
|
|
this.removeAllListeners(key);
|
|
}
|
|
this.removeAllListeners('removeListener');
|
|
this._events = {};
|
|
return this;
|
|
}
|
|
|
|
listeners = this._events[type];
|
|
|
|
if (isFunction(listeners)) {
|
|
this.removeListener(type, listeners);
|
|
} else if (listeners) {
|
|
// LIFO order
|
|
while (listeners.length)
|
|
this.removeListener(type, listeners[listeners.length - 1]);
|
|
}
|
|
delete this._events[type];
|
|
|
|
return this;
|
|
};
|
|
|
|
EventEmitter.prototype.listeners = function(type) {
|
|
var ret;
|
|
if (!this._events || !this._events[type])
|
|
ret = [];
|
|
else if (isFunction(this._events[type]))
|
|
ret = [this._events[type]];
|
|
else
|
|
ret = this._events[type].slice();
|
|
return ret;
|
|
};
|
|
|
|
EventEmitter.prototype.listenerCount = function(type) {
|
|
if (this._events) {
|
|
var evlistener = this._events[type];
|
|
|
|
if (isFunction(evlistener))
|
|
return 1;
|
|
else if (evlistener)
|
|
return evlistener.length;
|
|
}
|
|
return 0;
|
|
};
|
|
|
|
EventEmitter.listenerCount = function(emitter, type) {
|
|
return emitter.listenerCount(type);
|
|
};
|
|
|
|
function isFunction(arg) {
|
|
return typeof arg === 'function';
|
|
}
|
|
|
|
function isNumber(arg) {
|
|
return typeof arg === 'number';
|
|
}
|
|
|
|
function isObject(arg) {
|
|
return typeof arg === 'object' && arg !== null;
|
|
}
|
|
|
|
function isUndefined(arg) {
|
|
return arg === void 0;
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
/* 13 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__(0);
|
|
|
|
|
|
/***/ })
|
|
/******/ ]); |