/******/ (function(modules) { // webpackBootstrap
/******/ 	// 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: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// 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;
/******/
/******/ 	// 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 = "";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 217);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var global = __webpack_require__(5);
var core = __webpack_require__(28);
var hide = __webpack_require__(17);
var redefine = __webpack_require__(18);
var ctx = __webpack_require__(25);
var PROTOTYPE = 'prototype';

var $export = function $export(type, name, source) {
  var IS_FORCED = type & $export.F;
  var IS_GLOBAL = type & $export.G;
  var IS_STATIC = type & $export.S;
  var IS_PROTO = type & $export.P;
  var IS_BIND = type & $export.B;
  var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];
  var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
  var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
  var key, own, out, exp;
  if (IS_GLOBAL) source = name;
  for (key in source) {
    // contains in native
    own = !IS_FORCED && target && target[key] !== undefined;
    // export native or passed
    out = (own ? target : source)[key];
    // bind timers to global for call from export context
    exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
    // extend global
    if (target) redefine(target, key, out, type & $export.U);
    // export
    if (exports[key] != out) hide(exports, key, exp);
    if (IS_PROTO && expProto[key] != out) expProto[key] = out;
  }
};
global.core = core;
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;

/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

/*!
 * jQuery JavaScript Library v3.3.1
 * https://jquery.com/
 *
 * Includes Sizzle.js
 * https://sizzlejs.com/
 *
 * Copyright JS Foundation and other contributors
 * Released under the MIT license
 * https://jquery.org/license
 *
 * Date: 2018-01-20T17:24Z
 */
(function (global, factory) {

	"use strict";

	if (( false ? "undefined" : _typeof(module)) === "object" && _typeof(module.exports) === "object") {

		// For CommonJS and CommonJS-like environments where a proper `window`
		// is present, execute the factory and get jQuery.
		// For environments that do not have a `window` with a `document`
		// (such as Node.js), expose a factory as module.exports.
		// This accentuates the need for the creation of a real `window`.
		// e.g. var jQuery = require("jquery")(window);
		// See ticket #14549 for more info.
		module.exports = global.document ? factory(global, true) : function (w) {
			if (!w.document) {
				throw new Error("jQuery requires a window with a document");
			}
			return factory(w);
		};
	} else {
		factory(global);
	}

	// Pass this if window is not defined yet
})(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {

	// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
	// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
	// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
	// enough that all such attempts are guarded in a try block.
	"use strict";

	var arr = [];

	var document = window.document;

	var getProto = Object.getPrototypeOf;

	var _slice = arr.slice;

	var concat = arr.concat;

	var push = arr.push;

	var indexOf = arr.indexOf;

	var class2type = {};

	var toString = class2type.toString;

	var hasOwn = class2type.hasOwnProperty;

	var fnToString = hasOwn.toString;

	var ObjectFunctionString = fnToString.call(Object);

	var support = {};

	var isFunction = function isFunction(obj) {

		// Support: Chrome <=57, Firefox <=52
		// In some browsers, typeof returns "function" for HTML <object> elements
		// (i.e., `typeof document.createElement( "object" ) === "function"`).
		// We don't want to classify *any* DOM node as a function.
		return typeof obj === "function" && typeof obj.nodeType !== "number";
	};

	var isWindow = function isWindow(obj) {
		return obj != null && obj === obj.window;
	};

	var preservedScriptAttributes = {
		type: true,
		src: true,
		noModule: true
	};

	function DOMEval(code, doc, node) {
		doc = doc || document;

		var i,
		    script = doc.createElement("script");

		script.text = code;
		if (node) {
			for (i in preservedScriptAttributes) {
				if (node[i]) {
					script[i] = node[i];
				}
			}
		}
		doc.head.appendChild(script).parentNode.removeChild(script);
	}

	function toType(obj) {
		if (obj == null) {
			return obj + "";
		}

		// Support: Android <=2.3 only (functionish RegExp)
		return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
	}
	/* global Symbol */
	// Defining this global in .eslintrc.json would create a danger of using the global
	// unguarded in another place, it seems safer to define global only for this module


	var version = "3.3.1",


	// Define a local copy of jQuery
	jQuery = function jQuery(selector, context) {

		// The jQuery object is actually just the init constructor 'enhanced'
		// Need init if jQuery is called (just allow error to be thrown if not included)
		return new jQuery.fn.init(selector, context);
	},


	// Support: Android <=4.0 only
	// Make sure we trim BOM and NBSP
	rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;

	jQuery.fn = jQuery.prototype = {

		// The current version of jQuery being used
		jquery: version,

		constructor: jQuery,

		// The default length of a jQuery object is 0
		length: 0,

		toArray: function toArray() {
			return _slice.call(this);
		},

		// Get the Nth element in the matched element set OR
		// Get the whole matched element set as a clean array
		get: function get(num) {

			// Return all the elements in a clean array
			if (num == null) {
				return _slice.call(this);
			}

			// Return just the one element from the set
			return num < 0 ? this[num + this.length] : this[num];
		},

		// Take an array of elements and push it onto the stack
		// (returning the new matched element set)
		pushStack: function pushStack(elems) {

			// Build a new jQuery matched element set
			var ret = jQuery.merge(this.constructor(), elems);

			// Add the old object onto the stack (as a reference)
			ret.prevObject = this;

			// Return the newly-formed element set
			return ret;
		},

		// Execute a callback for every element in the matched set.
		each: function each(callback) {
			return jQuery.each(this, callback);
		},

		map: function map(callback) {
			return this.pushStack(jQuery.map(this, function (elem, i) {
				return callback.call(elem, i, elem);
			}));
		},

		slice: function slice() {
			return this.pushStack(_slice.apply(this, arguments));
		},

		first: function first() {
			return this.eq(0);
		},

		last: function last() {
			return this.eq(-1);
		},

		eq: function eq(i) {
			var len = this.length,
			    j = +i + (i < 0 ? len : 0);
			return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
		},

		end: function end() {
			return this.prevObject || this.constructor();
		},

		// For internal use only.
		// Behaves like an Array's method, not like a jQuery method.
		push: push,
		sort: arr.sort,
		splice: arr.splice
	};

	jQuery.extend = jQuery.fn.extend = function () {
		var options,
		    name,
		    src,
		    copy,
		    copyIsArray,
		    clone,
		    target = arguments[0] || {},
		    i = 1,
		    length = arguments.length,
		    deep = false;

		// Handle a deep copy situation
		if (typeof target === "boolean") {
			deep = target;

			// Skip the boolean and the target
			target = arguments[i] || {};
			i++;
		}

		// Handle case when target is a string or something (possible in deep copy)
		if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !isFunction(target)) {
			target = {};
		}

		// Extend jQuery itself if only one argument is passed
		if (i === length) {
			target = this;
			i--;
		}

		for (; i < length; i++) {

			// Only deal with non-null/undefined values
			if ((options = arguments[i]) != null) {

				// Extend the base object
				for (name in options) {
					src = target[name];
					copy = options[name];

					// Prevent never-ending loop
					if (target === copy) {
						continue;
					}

					// Recurse if we're merging plain objects or arrays
					if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {

						if (copyIsArray) {
							copyIsArray = false;
							clone = src && Array.isArray(src) ? src : [];
						} else {
							clone = src && jQuery.isPlainObject(src) ? src : {};
						}

						// Never move original objects, clone them
						target[name] = jQuery.extend(deep, clone, copy);

						// Don't bring in undefined values
					} else if (copy !== undefined) {
						target[name] = copy;
					}
				}
			}
		}

		// Return the modified object
		return target;
	};

	jQuery.extend({

		// Unique for each copy of jQuery on the page
		expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),

		// Assume jQuery is ready without the ready module
		isReady: true,

		error: function error(msg) {
			throw new Error(msg);
		},

		noop: function noop() {},

		isPlainObject: function isPlainObject(obj) {
			var proto, Ctor;

			// Detect obvious negatives
			// Use toString instead of jQuery.type to catch host objects
			if (!obj || toString.call(obj) !== "[object Object]") {
				return false;
			}

			proto = getProto(obj);

			// Objects with no prototype (e.g., `Object.create( null )`) are plain
			if (!proto) {
				return true;
			}

			// Objects with prototype are plain iff they were constructed by a global Object function
			Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
			return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
		},

		isEmptyObject: function isEmptyObject(obj) {

			/* eslint-disable no-unused-vars */
			// See https://github.com/eslint/eslint/issues/6125
			var name;

			for (name in obj) {
				return false;
			}
			return true;
		},

		// Evaluates a script in a global context
		globalEval: function globalEval(code) {
			DOMEval(code);
		},

		each: function each(obj, callback) {
			var length,
			    i = 0;

			if (isArrayLike(obj)) {
				length = obj.length;
				for (; i < length; i++) {
					if (callback.call(obj[i], i, obj[i]) === false) {
						break;
					}
				}
			} else {
				for (i in obj) {
					if (callback.call(obj[i], i, obj[i]) === false) {
						break;
					}
				}
			}

			return obj;
		},

		// Support: Android <=4.0 only
		trim: function trim(text) {
			return text == null ? "" : (text + "").replace(rtrim, "");
		},

		// results is for internal usage only
		makeArray: function makeArray(arr, results) {
			var ret = results || [];

			if (arr != null) {
				if (isArrayLike(Object(arr))) {
					jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
				} else {
					push.call(ret, arr);
				}
			}

			return ret;
		},

		inArray: function inArray(elem, arr, i) {
			return arr == null ? -1 : indexOf.call(arr, elem, i);
		},

		// Support: Android <=4.0 only, PhantomJS 1 only
		// push.apply(_, arraylike) throws on ancient WebKit
		merge: function merge(first, second) {
			var len = +second.length,
			    j = 0,
			    i = first.length;

			for (; j < len; j++) {
				first[i++] = second[j];
			}

			first.length = i;

			return first;
		},

		grep: function grep(elems, callback, invert) {
			var callbackInverse,
			    matches = [],
			    i = 0,
			    length = elems.length,
			    callbackExpect = !invert;

			// Go through the array, only saving the items
			// that pass the validator function
			for (; i < length; i++) {
				callbackInverse = !callback(elems[i], i);
				if (callbackInverse !== callbackExpect) {
					matches.push(elems[i]);
				}
			}

			return matches;
		},

		// arg is for internal usage only
		map: function map(elems, callback, arg) {
			var length,
			    value,
			    i = 0,
			    ret = [];

			// Go through the array, translating each of the items to their new values
			if (isArrayLike(elems)) {
				length = elems.length;
				for (; i < length; i++) {
					value = callback(elems[i], i, arg);

					if (value != null) {
						ret.push(value);
					}
				}

				// Go through every key on the object,
			} else {
				for (i in elems) {
					value = callback(elems[i], i, arg);

					if (value != null) {
						ret.push(value);
					}
				}
			}

			// Flatten any nested arrays
			return concat.apply([], ret);
		},

		// A global GUID counter for objects
		guid: 1,

		// jQuery.support is not used in Core but other projects attach their
		// properties to it so it needs to exist.
		support: support
	});

	if (typeof Symbol === "function") {
		jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
	}

	// Populate the class2type map
	jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) {
		class2type["[object " + name + "]"] = name.toLowerCase();
	});

	function isArrayLike(obj) {

		// Support: real iOS 8.2 only (not reproducible in simulator)
		// `in` check used to prevent JIT error (gh-2145)
		// hasOwn isn't used here due to false negatives
		// regarding Nodelist length in IE
		var length = !!obj && "length" in obj && obj.length,
		    type = toType(obj);

		if (isFunction(obj) || isWindow(obj)) {
			return false;
		}

		return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
	}
	var Sizzle =
	/*!
  * Sizzle CSS Selector Engine v2.3.3
  * https://sizzlejs.com/
  *
  * Copyright jQuery Foundation and other contributors
  * Released under the MIT license
  * http://jquery.org/license
  *
  * Date: 2016-08-08
  */
	function (window) {

		var i,
		    support,
		    Expr,
		    getText,
		    isXML,
		    tokenize,
		    compile,
		    select,
		    outermostContext,
		    sortInput,
		    hasDuplicate,


		// Local document vars
		setDocument,
		    document,
		    docElem,
		    documentIsHTML,
		    rbuggyQSA,
		    rbuggyMatches,
		    matches,
		    contains,


		// Instance-specific data
		expando = "sizzle" + 1 * new Date(),
		    preferredDoc = window.document,
		    dirruns = 0,
		    done = 0,
		    classCache = createCache(),
		    tokenCache = createCache(),
		    compilerCache = createCache(),
		    sortOrder = function sortOrder(a, b) {
			if (a === b) {
				hasDuplicate = true;
			}
			return 0;
		},


		// Instance methods
		hasOwn = {}.hasOwnProperty,
		    arr = [],
		    pop = arr.pop,
		    push_native = arr.push,
		    push = arr.push,
		    slice = arr.slice,

		// Use a stripped-down indexOf as it's faster than native
		// https://jsperf.com/thor-indexof-vs-for/5
		indexOf = function indexOf(list, elem) {
			var i = 0,
			    len = list.length;
			for (; i < len; i++) {
				if (list[i] === elem) {
					return i;
				}
			}
			return -1;
		},
		    booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",


		// Regular expressions

		// http://www.w3.org/TR/css3-selectors/#whitespace
		whitespace = "[\\x20\\t\\r\\n\\f]",


		// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
		identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",


		// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
		attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
		// Operator (capture 2)
		"*([*^$|!~]?=)" + whitespace +
		// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
		"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
		    pseudos = ":(" + identifier + ")(?:\\((" +
		// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
		// 1. quoted (capture 3; capture 4 or capture 5)
		"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
		// 2. simple (capture 6)
		"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
		// 3. anything else (capture 2)
		".*" + ")\\)|)",


		// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
		rwhitespace = new RegExp(whitespace + "+", "g"),
		    rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
		    rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
		    rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
		    rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
		    rpseudo = new RegExp(pseudos),
		    ridentifier = new RegExp("^" + identifier + "$"),
		    matchExpr = {
			"ID": new RegExp("^#(" + identifier + ")"),
			"CLASS": new RegExp("^\\.(" + identifier + ")"),
			"TAG": new RegExp("^(" + identifier + "|[*])"),
			"ATTR": new RegExp("^" + attributes),
			"PSEUDO": new RegExp("^" + pseudos),
			"CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
			"bool": new RegExp("^(?:" + booleans + ")$", "i"),
			// For use in libraries implementing .is()
			// We use this for POS matching in `select`
			"needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
		},
		    rinputs = /^(?:input|select|textarea|button)$/i,
		    rheader = /^h\d$/i,
		    rnative = /^[^{]+\{\s*\[native \w/,


		// Easily-parseable/retrievable ID or TAG or CLASS selectors
		rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
		    rsibling = /[+~]/,


		// CSS escapes
		// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
		runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
		    funescape = function funescape(_, escaped, escapedWhitespace) {
			var high = "0x" + escaped - 0x10000;
			// NaN means non-codepoint
			// Support: Firefox<24
			// Workaround erroneous numeric interpretation of +"0x"
			return high !== high || escapedWhitespace ? escaped : high < 0 ?
			// BMP codepoint
			String.fromCharCode(high + 0x10000) :
			// Supplemental Plane codepoint (surrogate pair)
			String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
		},


		// CSS string/identifier serialization
		// https://drafts.csswg.org/cssom/#common-serializing-idioms
		rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
		    fcssescape = function fcssescape(ch, asCodePoint) {
			if (asCodePoint) {

				// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
				if (ch === "\0") {
					return "\uFFFD";
				}

				// Control characters and (dependent upon position) numbers get escaped as code points
				return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
			}

			// Other potentially-special ASCII characters get backslash-escaped
			return "\\" + ch;
		},


		// Used for iframes
		// See setDocument()
		// Removing the function wrapper causes a "Permission Denied"
		// error in IE
		unloadHandler = function unloadHandler() {
			setDocument();
		},
		    disabledAncestor = addCombinator(function (elem) {
			return elem.disabled === true && ("form" in elem || "label" in elem);
		}, { dir: "parentNode", next: "legend" });

		// Optimize for push.apply( _, NodeList )
		try {
			push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
			// Support: Android<4.0
			// Detect silently failing push.apply
			arr[preferredDoc.childNodes.length].nodeType;
		} catch (e) {
			push = { apply: arr.length ?

				// Leverage slice if possible
				function (target, els) {
					push_native.apply(target, slice.call(els));
				} :

				// Support: IE<9
				// Otherwise append directly
				function (target, els) {
					var j = target.length,
					    i = 0;
					// Can't trust NodeList.length
					while (target[j++] = els[i++]) {}
					target.length = j - 1;
				}
			};
		}

		function Sizzle(selector, context, results, seed) {
			var m,
			    i,
			    elem,
			    nid,
			    match,
			    groups,
			    newSelector,
			    newContext = context && context.ownerDocument,


			// nodeType defaults to 9, since context defaults to document
			nodeType = context ? context.nodeType : 9;

			results = results || [];

			// Return early from calls with invalid selector or context
			if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {

				return results;
			}

			// Try to shortcut find operations (as opposed to filters) in HTML documents
			if (!seed) {

				if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
					setDocument(context);
				}
				context = context || document;

				if (documentIsHTML) {

					// If the selector is sufficiently simple, try using a "get*By*" DOM method
					// (excepting DocumentFragment context, where the methods don't exist)
					if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {

						// ID selector
						if (m = match[1]) {

							// Document context
							if (nodeType === 9) {
								if (elem = context.getElementById(m)) {

									// Support: IE, Opera, Webkit
									// TODO: identify versions
									// getElementById can match elements by name instead of ID
									if (elem.id === m) {
										results.push(elem);
										return results;
									}
								} else {
									return results;
								}

								// Element context
							} else {

								// Support: IE, Opera, Webkit
								// TODO: identify versions
								// getElementById can match elements by name instead of ID
								if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {

									results.push(elem);
									return results;
								}
							}

							// Type selector
						} else if (match[2]) {
							push.apply(results, context.getElementsByTagName(selector));
							return results;

							// Class selector
						} else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {

							push.apply(results, context.getElementsByClassName(m));
							return results;
						}
					}

					// Take advantage of querySelectorAll
					if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {

						if (nodeType !== 1) {
							newContext = context;
							newSelector = selector;

							// qSA looks outside Element context, which is not what we want
							// Thanks to Andrew Dupont for this workaround technique
							// Support: IE <=8
							// Exclude object elements
						} else if (context.nodeName.toLowerCase() !== "object") {

							// Capture the context ID, setting it first if necessary
							if (nid = context.getAttribute("id")) {
								nid = nid.replace(rcssescape, fcssescape);
							} else {
								context.setAttribute("id", nid = expando);
							}

							// Prefix every selector in the list
							groups = tokenize(selector);
							i = groups.length;
							while (i--) {
								groups[i] = "#" + nid + " " + toSelector(groups[i]);
							}
							newSelector = groups.join(",");

							// Expand context for sibling selectors
							newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
						}

						if (newSelector) {
							try {
								push.apply(results, newContext.querySelectorAll(newSelector));
								return results;
							} catch (qsaError) {} finally {
								if (nid === expando) {
									context.removeAttribute("id");
								}
							}
						}
					}
				}
			}

			// All others
			return select(selector.replace(rtrim, "$1"), context, results, seed);
		}

		/**
   * Create key-value caches of limited size
   * @returns {function(string, object)} Returns the Object data after storing it on itself with
   *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
   *	deleting the oldest entry
   */
		function createCache() {
			var keys = [];

			function cache(key, value) {
				// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
				if (keys.push(key + " ") > Expr.cacheLength) {
					// Only keep the most recent entries
					delete cache[keys.shift()];
				}
				return cache[key + " "] = value;
			}
			return cache;
		}

		/**
   * Mark a function for special use by Sizzle
   * @param {Function} fn The function to mark
   */
		function markFunction(fn) {
			fn[expando] = true;
			return fn;
		}

		/**
   * Support testing using an element
   * @param {Function} fn Passed the created element and returns a boolean result
   */
		function assert(fn) {
			var el = document.createElement("fieldset");

			try {
				return !!fn(el);
			} catch (e) {
				return false;
			} finally {
				// Remove from its parent by default
				if (el.parentNode) {
					el.parentNode.removeChild(el);
				}
				// release memory in IE
				el = null;
			}
		}

		/**
   * Adds the same handler for all of the specified attrs
   * @param {String} attrs Pipe-separated list of attributes
   * @param {Function} handler The method that will be applied
   */
		function addHandle(attrs, handler) {
			var arr = attrs.split("|"),
			    i = arr.length;

			while (i--) {
				Expr.attrHandle[arr[i]] = handler;
			}
		}

		/**
   * Checks document order of two siblings
   * @param {Element} a
   * @param {Element} b
   * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
   */
		function siblingCheck(a, b) {
			var cur = b && a,
			    diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;

			// Use IE sourceIndex if available on both nodes
			if (diff) {
				return diff;
			}

			// Check if b follows a
			if (cur) {
				while (cur = cur.nextSibling) {
					if (cur === b) {
						return -1;
					}
				}
			}

			return a ? 1 : -1;
		}

		/**
   * Returns a function to use in pseudos for input types
   * @param {String} type
   */
		function createInputPseudo(type) {
			return function (elem) {
				var name = elem.nodeName.toLowerCase();
				return name === "input" && elem.type === type;
			};
		}

		/**
   * Returns a function to use in pseudos for buttons
   * @param {String} type
   */
		function createButtonPseudo(type) {
			return function (elem) {
				var name = elem.nodeName.toLowerCase();
				return (name === "input" || name === "button") && elem.type === type;
			};
		}

		/**
   * Returns a function to use in pseudos for :enabled/:disabled
   * @param {Boolean} disabled true for :disabled; false for :enabled
   */
		function createDisabledPseudo(disabled) {

			// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
			return function (elem) {

				// Only certain elements can match :enabled or :disabled
				// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
				// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
				if ("form" in elem) {

					// Check for inherited disabledness on relevant non-disabled elements:
					// * listed form-associated elements in a disabled fieldset
					//   https://html.spec.whatwg.org/multipage/forms.html#category-listed
					//   https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
					// * option elements in a disabled optgroup
					//   https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
					// All such elements have a "form" property.
					if (elem.parentNode && elem.disabled === false) {

						// Option elements defer to a parent optgroup if present
						if ("label" in elem) {
							if ("label" in elem.parentNode) {
								return elem.parentNode.disabled === disabled;
							} else {
								return elem.disabled === disabled;
							}
						}

						// Support: IE 6 - 11
						// Use the isDisabled shortcut property to check for disabled fieldset ancestors
						return elem.isDisabled === disabled ||

						// Where there is no isDisabled, check manually
						/* jshint -W018 */
						elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled;
					}

					return elem.disabled === disabled;

					// Try to winnow out elements that can't be disabled before trusting the disabled property.
					// Some victims get caught in our net (label, legend, menu, track), but it shouldn't
					// even exist on them, let alone have a boolean value.
				} else if ("label" in elem) {
					return elem.disabled === disabled;
				}

				// Remaining elements are neither :enabled nor :disabled
				return false;
			};
		}

		/**
   * Returns a function to use in pseudos for positionals
   * @param {Function} fn
   */
		function createPositionalPseudo(fn) {
			return markFunction(function (argument) {
				argument = +argument;
				return markFunction(function (seed, matches) {
					var j,
					    matchIndexes = fn([], seed.length, argument),
					    i = matchIndexes.length;

					// Match elements found at the specified indexes
					while (i--) {
						if (seed[j = matchIndexes[i]]) {
							seed[j] = !(matches[j] = seed[j]);
						}
					}
				});
			});
		}

		/**
   * Checks a node for validity as a Sizzle context
   * @param {Element|Object=} context
   * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
   */
		function testContext(context) {
			return context && typeof context.getElementsByTagName !== "undefined" && context;
		}

		// Expose support vars for convenience
		support = Sizzle.support = {};

		/**
   * Detects XML nodes
   * @param {Element|Object} elem An element or a document
   * @returns {Boolean} True iff elem is a non-HTML XML node
   */
		isXML = Sizzle.isXML = function (elem) {
			// documentElement is verified for cases where it doesn't yet exist
			// (such as loading iframes in IE - #4833)
			var documentElement = elem && (elem.ownerDocument || elem).documentElement;
			return documentElement ? documentElement.nodeName !== "HTML" : false;
		};

		/**
   * Sets document-related variables once based on the current document
   * @param {Element|Object} [doc] An element or document object to use to set the document
   * @returns {Object} Returns the current document
   */
		setDocument = Sizzle.setDocument = function (node) {
			var hasCompare,
			    subWindow,
			    doc = node ? node.ownerDocument || node : preferredDoc;

			// Return early if doc is invalid or already selected
			if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
				return document;
			}

			// Update global variables
			document = doc;
			docElem = document.documentElement;
			documentIsHTML = !isXML(document);

			// Support: IE 9-11, Edge
			// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
			if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {

				// Support: IE 11, Edge
				if (subWindow.addEventListener) {
					subWindow.addEventListener("unload", unloadHandler, false);

					// Support: IE 9 - 10 only
				} else if (subWindow.attachEvent) {
					subWindow.attachEvent("onunload", unloadHandler);
				}
			}

			/* Attributes
   ---------------------------------------------------------------------- */

			// Support: IE<8
			// Verify that getAttribute really returns attributes and not properties
			// (excepting IE8 booleans)
			support.attributes = assert(function (el) {
				el.className = "i";
				return !el.getAttribute("className");
			});

			/* getElement(s)By*
   ---------------------------------------------------------------------- */

			// Check if getElementsByTagName("*") returns only elements
			support.getElementsByTagName = assert(function (el) {
				el.appendChild(document.createComment(""));
				return !el.getElementsByTagName("*").length;
			});

			// Support: IE<9
			support.getElementsByClassName = rnative.test(document.getElementsByClassName);

			// Support: IE<10
			// Check if getElementById returns elements by name
			// The broken getElementById methods don't pick up programmatically-set names,
			// so use a roundabout getElementsByName test
			support.getById = assert(function (el) {
				docElem.appendChild(el).id = expando;
				return !document.getElementsByName || !document.getElementsByName(expando).length;
			});

			// ID filter and find
			if (support.getById) {
				Expr.filter["ID"] = function (id) {
					var attrId = id.replace(runescape, funescape);
					return function (elem) {
						return elem.getAttribute("id") === attrId;
					};
				};
				Expr.find["ID"] = function (id, context) {
					if (typeof context.getElementById !== "undefined" && documentIsHTML) {
						var elem = context.getElementById(id);
						return elem ? [elem] : [];
					}
				};
			} else {
				Expr.filter["ID"] = function (id) {
					var attrId = id.replace(runescape, funescape);
					return function (elem) {
						var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
						return node && node.value === attrId;
					};
				};

				// Support: IE 6 - 7 only
				// getElementById is not reliable as a find shortcut
				Expr.find["ID"] = function (id, context) {
					if (typeof context.getElementById !== "undefined" && documentIsHTML) {
						var node,
						    i,
						    elems,
						    elem = context.getElementById(id);

						if (elem) {

							// Verify the id attribute
							node = elem.getAttributeNode("id");
							if (node && node.value === id) {
								return [elem];
							}

							// Fall back on getElementsByName
							elems = context.getElementsByName(id);
							i = 0;
							while (elem = elems[i++]) {
								node = elem.getAttributeNode("id");
								if (node && node.value === id) {
									return [elem];
								}
							}
						}

						return [];
					}
				};
			}

			// Tag
			Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) {
				if (typeof context.getElementsByTagName !== "undefined") {
					return context.getElementsByTagName(tag);

					// DocumentFragment nodes don't have gEBTN
				} else if (support.qsa) {
					return context.querySelectorAll(tag);
				}
			} : function (tag, context) {
				var elem,
				    tmp = [],
				    i = 0,

				// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
				results = context.getElementsByTagName(tag);

				// Filter out possible comments
				if (tag === "*") {
					while (elem = results[i++]) {
						if (elem.nodeType === 1) {
							tmp.push(elem);
						}
					}

					return tmp;
				}
				return results;
			};

			// Class
			Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
				if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
					return context.getElementsByClassName(className);
				}
			};

			/* QSA/matchesSelector
   ---------------------------------------------------------------------- */

			// QSA and matchesSelector support

			// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
			rbuggyMatches = [];

			// qSa(:focus) reports false when true (Chrome 21)
			// We allow this because of a bug in IE8/9 that throws an error
			// whenever `document.activeElement` is accessed on an iframe
			// So, we allow :focus to pass through QSA all the time to avoid the IE error
			// See https://bugs.jquery.com/ticket/13378
			rbuggyQSA = [];

			if (support.qsa = rnative.test(document.querySelectorAll)) {
				// Build QSA regex
				// Regex strategy adopted from Diego Perini
				assert(function (el) {
					// Select is set to empty string on purpose
					// This is to test IE's treatment of not explicitly
					// setting a boolean content attribute,
					// since its presence should be enough
					// https://bugs.jquery.com/ticket/12359
					docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>";

					// Support: IE8, Opera 11-12.16
					// Nothing should be selected when empty strings follow ^= or $= or *=
					// The test attribute must be unknown in Opera but "safe" for WinRT
					// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
					if (el.querySelectorAll("[msallowcapture^='']").length) {
						rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
					}

					// Support: IE8
					// Boolean attributes and "value" are not treated correctly
					if (!el.querySelectorAll("[selected]").length) {
						rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
					}

					// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
					if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
						rbuggyQSA.push("~=");
					}

					// Webkit/Opera - :checked should return selected option elements
					// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
					// IE8 throws error here and will not see later tests
					if (!el.querySelectorAll(":checked").length) {
						rbuggyQSA.push(":checked");
					}

					// Support: Safari 8+, iOS 8+
					// https://bugs.webkit.org/show_bug.cgi?id=136851
					// In-page `selector#id sibling-combinator selector` fails
					if (!el.querySelectorAll("a#" + expando + "+*").length) {
						rbuggyQSA.push(".#.+[+~]");
					}
				});

				assert(function (el) {
					el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>";

					// Support: Windows 8 Native Apps
					// The type and name attributes are restricted during .innerHTML assignment
					var input = document.createElement("input");
					input.setAttribute("type", "hidden");
					el.appendChild(input).setAttribute("name", "D");

					// Support: IE8
					// Enforce case-sensitivity of name attribute
					if (el.querySelectorAll("[name=d]").length) {
						rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
					}

					// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
					// IE8 throws error here and will not see later tests
					if (el.querySelectorAll(":enabled").length !== 2) {
						rbuggyQSA.push(":enabled", ":disabled");
					}

					// Support: IE9-11+
					// IE's :disabled selector does not pick up the children of disabled fieldsets
					docElem.appendChild(el).disabled = true;
					if (el.querySelectorAll(":disabled").length !== 2) {
						rbuggyQSA.push(":enabled", ":disabled");
					}

					// Opera 10-11 does not throw on post-comma invalid pseudos
					el.querySelectorAll("*,:x");
					rbuggyQSA.push(",.*:");
				});
			}

			if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {

				assert(function (el) {
					// Check to see if it's possible to do matchesSelector
					// on a disconnected node (IE 9)
					support.disconnectedMatch = matches.call(el, "*");

					// This should fail with an exception
					// Gecko does not error, returns false instead
					matches.call(el, "[s!='']:x");
					rbuggyMatches.push("!=", pseudos);
				});
			}

			rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
			rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));

			/* Contains
   ---------------------------------------------------------------------- */
			hasCompare = rnative.test(docElem.compareDocumentPosition);

			// Element contains another
			// Purposefully self-exclusive
			// As in, an element does not contain itself
			contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
				var adown = a.nodeType === 9 ? a.documentElement : a,
				    bup = b && b.parentNode;
				return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
			} : function (a, b) {
				if (b) {
					while (b = b.parentNode) {
						if (b === a) {
							return true;
						}
					}
				}
				return false;
			};

			/* Sorting
   ---------------------------------------------------------------------- */

			// Document order sorting
			sortOrder = hasCompare ? function (a, b) {

				// Flag for duplicate removal
				if (a === b) {
					hasDuplicate = true;
					return 0;
				}

				// Sort on method existence if only one input has compareDocumentPosition
				var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
				if (compare) {
					return compare;
				}

				// Calculate position if both inputs belong to the same document
				compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) :

				// Otherwise we know they are disconnected
				1;

				// Disconnected nodes
				if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {

					// Choose the first element that is related to our preferred document
					if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
						return -1;
					}
					if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
						return 1;
					}

					// Maintain original order
					return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
				}

				return compare & 4 ? -1 : 1;
			} : function (a, b) {
				// Exit early if the nodes are identical
				if (a === b) {
					hasDuplicate = true;
					return 0;
				}

				var cur,
				    i = 0,
				    aup = a.parentNode,
				    bup = b.parentNode,
				    ap = [a],
				    bp = [b];

				// Parentless nodes are either documents or disconnected
				if (!aup || !bup) {
					return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;

					// If the nodes are siblings, we can do a quick check
				} else if (aup === bup) {
					return siblingCheck(a, b);
				}

				// Otherwise we need full lists of their ancestors for comparison
				cur = a;
				while (cur = cur.parentNode) {
					ap.unshift(cur);
				}
				cur = b;
				while (cur = cur.parentNode) {
					bp.unshift(cur);
				}

				// Walk down the tree looking for a discrepancy
				while (ap[i] === bp[i]) {
					i++;
				}

				return i ?
				// Do a sibling check if the nodes have a common ancestor
				siblingCheck(ap[i], bp[i]) :

				// Otherwise nodes in our document sort first
				ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
			};

			return document;
		};

		Sizzle.matches = function (expr, elements) {
			return Sizzle(expr, null, null, elements);
		};

		Sizzle.matchesSelector = function (elem, expr) {
			// Set document vars if needed
			if ((elem.ownerDocument || elem) !== document) {
				setDocument(elem);
			}

			// Make sure that attribute selectors are quoted
			expr = expr.replace(rattributeQuotes, "='$1']");

			if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {

				try {
					var ret = matches.call(elem, expr);

					// IE 9's matchesSelector returns false on disconnected nodes
					if (ret || support.disconnectedMatch ||
					// As well, disconnected nodes are said to be in a document
					// fragment in IE 9
					elem.document && elem.document.nodeType !== 11) {
						return ret;
					}
				} catch (e) {}
			}

			return Sizzle(expr, document, null, [elem]).length > 0;
		};

		Sizzle.contains = function (context, elem) {
			// Set document vars if needed
			if ((context.ownerDocument || context) !== document) {
				setDocument(context);
			}
			return contains(context, elem);
		};

		Sizzle.attr = function (elem, name) {
			// Set document vars if needed
			if ((elem.ownerDocument || elem) !== document) {
				setDocument(elem);
			}

			var fn = Expr.attrHandle[name.toLowerCase()],

			// Don't get fooled by Object.prototype properties (jQuery #13807)
			val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;

			return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
		};

		Sizzle.escape = function (sel) {
			return (sel + "").replace(rcssescape, fcssescape);
		};

		Sizzle.error = function (msg) {
			throw new Error("Syntax error, unrecognized expression: " + msg);
		};

		/**
   * Document sorting and removing duplicates
   * @param {ArrayLike} results
   */
		Sizzle.uniqueSort = function (results) {
			var elem,
			    duplicates = [],
			    j = 0,
			    i = 0;

			// Unless we *know* we can detect duplicates, assume their presence
			hasDuplicate = !support.detectDuplicates;
			sortInput = !support.sortStable && results.slice(0);
			results.sort(sortOrder);

			if (hasDuplicate) {
				while (elem = results[i++]) {
					if (elem === results[i]) {
						j = duplicates.push(i);
					}
				}
				while (j--) {
					results.splice(duplicates[j], 1);
				}
			}

			// Clear input after sorting to release objects
			// See https://github.com/jquery/sizzle/pull/225
			sortInput = null;

			return results;
		};

		/**
   * Utility function for retrieving the text value of an array of DOM nodes
   * @param {Array|Element} elem
   */
		getText = Sizzle.getText = function (elem) {
			var node,
			    ret = "",
			    i = 0,
			    nodeType = elem.nodeType;

			if (!nodeType) {
				// If no nodeType, this is expected to be an array
				while (node = elem[i++]) {
					// Do not traverse comment nodes
					ret += getText(node);
				}
			} else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
				// Use textContent for elements
				// innerText usage removed for consistency of new lines (jQuery #11153)
				if (typeof elem.textContent === "string") {
					return elem.textContent;
				} else {
					// Traverse its children
					for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
						ret += getText(elem);
					}
				}
			} else if (nodeType === 3 || nodeType === 4) {
				return elem.nodeValue;
			}
			// Do not include comment or processing instruction nodes

			return ret;
		};

		Expr = Sizzle.selectors = {

			// Can be adjusted by the user
			cacheLength: 50,

			createPseudo: markFunction,

			match: matchExpr,

			attrHandle: {},

			find: {},

			relative: {
				">": { dir: "parentNode", first: true },
				" ": { dir: "parentNode" },
				"+": { dir: "previousSibling", first: true },
				"~": { dir: "previousSibling" }
			},

			preFilter: {
				"ATTR": function ATTR(match) {
					match[1] = match[1].replace(runescape, funescape);

					// Move the given value to match[3] whether quoted or unquoted
					match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);

					if (match[2] === "~=") {
						match[3] = " " + match[3] + " ";
					}

					return match.slice(0, 4);
				},

				"CHILD": function CHILD(match) {
					/* matches from matchExpr["CHILD"]
     	1 type (only|nth|...)
     	2 what (child|of-type)
     	3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
     	4 xn-component of xn+y argument ([+-]?\d*n|)
     	5 sign of xn-component
     	6 x of xn-component
     	7 sign of y-component
     	8 y of y-component
     */
					match[1] = match[1].toLowerCase();

					if (match[1].slice(0, 3) === "nth") {
						// nth-* requires argument
						if (!match[3]) {
							Sizzle.error(match[0]);
						}

						// numeric x and y parameters for Expr.filter.CHILD
						// remember that false/true cast respectively to 0/1
						match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
						match[5] = +(match[7] + match[8] || match[3] === "odd");

						// other types prohibit arguments
					} else if (match[3]) {
						Sizzle.error(match[0]);
					}

					return match;
				},

				"PSEUDO": function PSEUDO(match) {
					var excess,
					    unquoted = !match[6] && match[2];

					if (matchExpr["CHILD"].test(match[0])) {
						return null;
					}

					// Accept quoted arguments as-is
					if (match[3]) {
						match[2] = match[4] || match[5] || "";

						// Strip excess characters from unquoted arguments
					} else if (unquoted && rpseudo.test(unquoted) && (
					// Get excess from tokenize (recursively)
					excess = tokenize(unquoted, true)) && (
					// advance to the next closing parenthesis
					excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {

						// excess is a negative index
						match[0] = match[0].slice(0, excess);
						match[2] = unquoted.slice(0, excess);
					}

					// Return only captures needed by the pseudo filter method (type and argument)
					return match.slice(0, 3);
				}
			},

			filter: {

				"TAG": function TAG(nodeNameSelector) {
					var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
					return nodeNameSelector === "*" ? function () {
						return true;
					} : function (elem) {
						return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
					};
				},

				"CLASS": function CLASS(className) {
					var pattern = classCache[className + " "];

					return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
						return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
					});
				},

				"ATTR": function ATTR(name, operator, check) {
					return function (elem) {
						var result = Sizzle.attr(elem, name);

						if (result == null) {
							return operator === "!=";
						}
						if (!operator) {
							return true;
						}

						result += "";

						return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false;
					};
				},

				"CHILD": function CHILD(type, what, argument, first, last) {
					var simple = type.slice(0, 3) !== "nth",
					    forward = type.slice(-4) !== "last",
					    ofType = what === "of-type";

					return first === 1 && last === 0 ?

					// Shortcut for :nth-*(n)
					function (elem) {
						return !!elem.parentNode;
					} : function (elem, context, xml) {
						var cache,
						    uniqueCache,
						    outerCache,
						    node,
						    nodeIndex,
						    start,
						    dir = simple !== forward ? "nextSibling" : "previousSibling",
						    parent = elem.parentNode,
						    name = ofType && elem.nodeName.toLowerCase(),
						    useCache = !xml && !ofType,
						    diff = false;

						if (parent) {

							// :(first|last|only)-(child|of-type)
							if (simple) {
								while (dir) {
									node = elem;
									while (node = node[dir]) {
										if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {

											return false;
										}
									}
									// Reverse direction for :only-* (if we haven't yet done so)
									start = dir = type === "only" && !start && "nextSibling";
								}
								return true;
							}

							start = [forward ? parent.firstChild : parent.lastChild];

							// non-xml :nth-child(...) stores cache data on `parent`
							if (forward && useCache) {

								// Seek `elem` from a previously-cached index

								// ...in a gzip-friendly way
								node = parent;
								outerCache = node[expando] || (node[expando] = {});

								// Support: IE <9 only
								// Defend against cloned attroperties (jQuery gh-1709)
								uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});

								cache = uniqueCache[type] || [];
								nodeIndex = cache[0] === dirruns && cache[1];
								diff = nodeIndex && cache[2];
								node = nodeIndex && parent.childNodes[nodeIndex];

								while (node = ++nodeIndex && node && node[dir] || (

								// Fallback to seeking `elem` from the start
								diff = nodeIndex = 0) || start.pop()) {

									// When found, cache indexes on `parent` and break
									if (node.nodeType === 1 && ++diff && node === elem) {
										uniqueCache[type] = [dirruns, nodeIndex, diff];
										break;
									}
								}
							} else {
								// Use previously-cached element index if available
								if (useCache) {
									// ...in a gzip-friendly way
									node = elem;
									outerCache = node[expando] || (node[expando] = {});

									// Support: IE <9 only
									// Defend against cloned attroperties (jQuery gh-1709)
									uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});

									cache = uniqueCache[type] || [];
									nodeIndex = cache[0] === dirruns && cache[1];
									diff = nodeIndex;
								}

								// xml :nth-child(...)
								// or :nth-last-child(...) or :nth(-last)?-of-type(...)
								if (diff === false) {
									// Use the same loop as above to seek `elem` from the start
									while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {

										if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {

											// Cache the index of each encountered element
											if (useCache) {
												outerCache = node[expando] || (node[expando] = {});

												// Support: IE <9 only
												// Defend against cloned attroperties (jQuery gh-1709)
												uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});

												uniqueCache[type] = [dirruns, diff];
											}

											if (node === elem) {
												break;
											}
										}
									}
								}
							}

							// Incorporate the offset, then check against cycle size
							diff -= last;
							return diff === first || diff % first === 0 && diff / first >= 0;
						}
					};
				},

				"PSEUDO": function PSEUDO(pseudo, argument) {
					// pseudo-class names are case-insensitive
					// http://www.w3.org/TR/selectors/#pseudo-classes
					// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
					// Remember that setFilters inherits from pseudos
					var args,
					    fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);

					// The user may use createPseudo to indicate that
					// arguments are needed to create the filter function
					// just as Sizzle does
					if (fn[expando]) {
						return fn(argument);
					}

					// But maintain support for old signatures
					if (fn.length > 1) {
						args = [pseudo, pseudo, "", argument];
						return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
							var idx,
							    matched = fn(seed, argument),
							    i = matched.length;
							while (i--) {
								idx = indexOf(seed, matched[i]);
								seed[idx] = !(matches[idx] = matched[i]);
							}
						}) : function (elem) {
							return fn(elem, 0, args);
						};
					}

					return fn;
				}
			},

			pseudos: {
				// Potentially complex pseudos
				"not": markFunction(function (selector) {
					// Trim the selector passed to compile
					// to avoid treating leading and trailing
					// spaces as combinators
					var input = [],
					    results = [],
					    matcher = compile(selector.replace(rtrim, "$1"));

					return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
						var elem,
						    unmatched = matcher(seed, null, xml, []),
						    i = seed.length;

						// Match elements unmatched by `matcher`
						while (i--) {
							if (elem = unmatched[i]) {
								seed[i] = !(matches[i] = elem);
							}
						}
					}) : function (elem, context, xml) {
						input[0] = elem;
						matcher(input, null, xml, results);
						// Don't keep the element (issue #299)
						input[0] = null;
						return !results.pop();
					};
				}),

				"has": markFunction(function (selector) {
					return function (elem) {
						return Sizzle(selector, elem).length > 0;
					};
				}),

				"contains": markFunction(function (text) {
					text = text.replace(runescape, funescape);
					return function (elem) {
						return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
					};
				}),

				// "Whether an element is represented by a :lang() selector
				// is based solely on the element's language value
				// being equal to the identifier C,
				// or beginning with the identifier C immediately followed by "-".
				// The matching of C against the element's language value is performed case-insensitively.
				// The identifier C does not have to be a valid language name."
				// http://www.w3.org/TR/selectors/#lang-pseudo
				"lang": markFunction(function (lang) {
					// lang value must be a valid identifier
					if (!ridentifier.test(lang || "")) {
						Sizzle.error("unsupported lang: " + lang);
					}
					lang = lang.replace(runescape, funescape).toLowerCase();
					return function (elem) {
						var elemLang;
						do {
							if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {

								elemLang = elemLang.toLowerCase();
								return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
							}
						} while ((elem = elem.parentNode) && elem.nodeType === 1);
						return false;
					};
				}),

				// Miscellaneous
				"target": function target(elem) {
					var hash = window.location && window.location.hash;
					return hash && hash.slice(1) === elem.id;
				},

				"root": function root(elem) {
					return elem === docElem;
				},

				"focus": function focus(elem) {
					return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
				},

				// Boolean properties
				"enabled": createDisabledPseudo(false),
				"disabled": createDisabledPseudo(true),

				"checked": function checked(elem) {
					// In CSS3, :checked should return both checked and selected elements
					// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
					var nodeName = elem.nodeName.toLowerCase();
					return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
				},

				"selected": function selected(elem) {
					// Accessing this property makes selected-by-default
					// options in Safari work properly
					if (elem.parentNode) {
						elem.parentNode.selectedIndex;
					}

					return elem.selected === true;
				},

				// Contents
				"empty": function empty(elem) {
					// http://www.w3.org/TR/selectors/#empty-pseudo
					// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
					//   but not by others (comment: 8; processing instruction: 7; etc.)
					// nodeType < 6 works because attributes (2) do not appear as children
					for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
						if (elem.nodeType < 6) {
							return false;
						}
					}
					return true;
				},

				"parent": function parent(elem) {
					return !Expr.pseudos["empty"](elem);
				},

				// Element/input types
				"header": function header(elem) {
					return rheader.test(elem.nodeName);
				},

				"input": function input(elem) {
					return rinputs.test(elem.nodeName);
				},

				"button": function button(elem) {
					var name = elem.nodeName.toLowerCase();
					return name === "input" && elem.type === "button" || name === "button";
				},

				"text": function text(elem) {
					var attr;
					return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && (

					// Support: IE<8
					// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
					(attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
				},

				// Position-in-collection
				"first": createPositionalPseudo(function () {
					return [0];
				}),

				"last": createPositionalPseudo(function (matchIndexes, length) {
					return [length - 1];
				}),

				"eq": createPositionalPseudo(function (matchIndexes, length, argument) {
					return [argument < 0 ? argument + length : argument];
				}),

				"even": createPositionalPseudo(function (matchIndexes, length) {
					var i = 0;
					for (; i < length; i += 2) {
						matchIndexes.push(i);
					}
					return matchIndexes;
				}),

				"odd": createPositionalPseudo(function (matchIndexes, length) {
					var i = 1;
					for (; i < length; i += 2) {
						matchIndexes.push(i);
					}
					return matchIndexes;
				}),

				"lt": createPositionalPseudo(function (matchIndexes, length, argument) {
					var i = argument < 0 ? argument + length : argument;
					for (; --i >= 0;) {
						matchIndexes.push(i);
					}
					return matchIndexes;
				}),

				"gt": createPositionalPseudo(function (matchIndexes, length, argument) {
					var i = argument < 0 ? argument + length : argument;
					for (; ++i < length;) {
						matchIndexes.push(i);
					}
					return matchIndexes;
				})
			}
		};

		Expr.pseudos["nth"] = Expr.pseudos["eq"];

		// Add button/input type pseudos
		for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
			Expr.pseudos[i] = createInputPseudo(i);
		}
		for (i in { submit: true, reset: true }) {
			Expr.pseudos[i] = createButtonPseudo(i);
		}

		// Easy API for creating new setFilters
		function setFilters() {}
		setFilters.prototype = Expr.filters = Expr.pseudos;
		Expr.setFilters = new setFilters();

		tokenize = Sizzle.tokenize = function (selector, parseOnly) {
			var matched,
			    match,
			    tokens,
			    type,
			    soFar,
			    groups,
			    preFilters,
			    cached = tokenCache[selector + " "];

			if (cached) {
				return parseOnly ? 0 : cached.slice(0);
			}

			soFar = selector;
			groups = [];
			preFilters = Expr.preFilter;

			while (soFar) {

				// Comma and first run
				if (!matched || (match = rcomma.exec(soFar))) {
					if (match) {
						// Don't consume trailing commas as valid
						soFar = soFar.slice(match[0].length) || soFar;
					}
					groups.push(tokens = []);
				}

				matched = false;

				// Combinators
				if (match = rcombinators.exec(soFar)) {
					matched = match.shift();
					tokens.push({
						value: matched,
						// Cast descendant combinators to space
						type: match[0].replace(rtrim, " ")
					});
					soFar = soFar.slice(matched.length);
				}

				// Filters
				for (type in Expr.filter) {
					if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
						matched = match.shift();
						tokens.push({
							value: matched,
							type: type,
							matches: match
						});
						soFar = soFar.slice(matched.length);
					}
				}

				if (!matched) {
					break;
				}
			}

			// Return the length of the invalid excess
			// if we're just parsing
			// Otherwise, throw an error or return tokens
			return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) :
			// Cache the tokens
			tokenCache(selector, groups).slice(0);
		};

		function toSelector(tokens) {
			var i = 0,
			    len = tokens.length,
			    selector = "";
			for (; i < len; i++) {
				selector += tokens[i].value;
			}
			return selector;
		}

		function addCombinator(matcher, combinator, base) {
			var dir = combinator.dir,
			    skip = combinator.next,
			    key = skip || dir,
			    checkNonElements = base && key === "parentNode",
			    doneName = done++;

			return combinator.first ?
			// Check against closest ancestor/preceding element
			function (elem, context, xml) {
				while (elem = elem[dir]) {
					if (elem.nodeType === 1 || checkNonElements) {
						return matcher(elem, context, xml);
					}
				}
				return false;
			} :

			// Check against all ancestor/preceding elements
			function (elem, context, xml) {
				var oldCache,
				    uniqueCache,
				    outerCache,
				    newCache = [dirruns, doneName];

				// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
				if (xml) {
					while (elem = elem[dir]) {
						if (elem.nodeType === 1 || checkNonElements) {
							if (matcher(elem, context, xml)) {
								return true;
							}
						}
					}
				} else {
					while (elem = elem[dir]) {
						if (elem.nodeType === 1 || checkNonElements) {
							outerCache = elem[expando] || (elem[expando] = {});

							// Support: IE <9 only
							// Defend against cloned attroperties (jQuery gh-1709)
							uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});

							if (skip && skip === elem.nodeName.toLowerCase()) {
								elem = elem[dir] || elem;
							} else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {

								// Assign to newCache so results back-propagate to previous elements
								return newCache[2] = oldCache[2];
							} else {
								// Reuse newcache so results back-propagate to previous elements
								uniqueCache[key] = newCache;

								// A match means we're done; a fail means we have to keep checking
								if (newCache[2] = matcher(elem, context, xml)) {
									return true;
								}
							}
						}
					}
				}
				return false;
			};
		}

		function elementMatcher(matchers) {
			return matchers.length > 1 ? function (elem, context, xml) {
				var i = matchers.length;
				while (i--) {
					if (!matchers[i](elem, context, xml)) {
						return false;
					}
				}
				return true;
			} : matchers[0];
		}

		function multipleContexts(selector, contexts, results) {
			var i = 0,
			    len = contexts.length;
			for (; i < len; i++) {
				Sizzle(selector, contexts[i], results);
			}
			return results;
		}

		function condense(unmatched, map, filter, context, xml) {
			var elem,
			    newUnmatched = [],
			    i = 0,
			    len = unmatched.length,
			    mapped = map != null;

			for (; i < len; i++) {
				if (elem = unmatched[i]) {
					if (!filter || filter(elem, context, xml)) {
						newUnmatched.push(elem);
						if (mapped) {
							map.push(i);
						}
					}
				}
			}

			return newUnmatched;
		}

		function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
			if (postFilter && !postFilter[expando]) {
				postFilter = setMatcher(postFilter);
			}
			if (postFinder && !postFinder[expando]) {
				postFinder = setMatcher(postFinder, postSelector);
			}
			return markFunction(function (seed, results, context, xml) {
				var temp,
				    i,
				    elem,
				    preMap = [],
				    postMap = [],
				    preexisting = results.length,


				// Get initial elements from seed or context
				elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),


				// Prefilter to get matcher input, preserving a map for seed-results synchronization
				matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
				    matcherOut = matcher ?
				// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
				postFinder || (seed ? preFilter : preexisting || postFilter) ?

				// ...intermediate processing is necessary
				[] :

				// ...otherwise use results directly
				results : matcherIn;

				// Find primary matches
				if (matcher) {
					matcher(matcherIn, matcherOut, context, xml);
				}

				// Apply postFilter
				if (postFilter) {
					temp = condense(matcherOut, postMap);
					postFilter(temp, [], context, xml);

					// Un-match failing elements by moving them back to matcherIn
					i = temp.length;
					while (i--) {
						if (elem = temp[i]) {
							matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
						}
					}
				}

				if (seed) {
					if (postFinder || preFilter) {
						if (postFinder) {
							// Get the final matcherOut by condensing this intermediate into postFinder contexts
							temp = [];
							i = matcherOut.length;
							while (i--) {
								if (elem = matcherOut[i]) {
									// Restore matcherIn since elem is not yet a final match
									temp.push(matcherIn[i] = elem);
								}
							}
							postFinder(null, matcherOut = [], temp, xml);
						}

						// Move matched elements from seed to results to keep them synchronized
						i = matcherOut.length;
						while (i--) {
							if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {

								seed[temp] = !(results[temp] = elem);
							}
						}
					}

					// Add elements to results, through postFinder if defined
				} else {
					matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
					if (postFinder) {
						postFinder(null, results, matcherOut, xml);
					} else {
						push.apply(results, matcherOut);
					}
				}
			});
		}

		function matcherFromTokens(tokens) {
			var checkContext,
			    matcher,
			    j,
			    len = tokens.length,
			    leadingRelative = Expr.relative[tokens[0].type],
			    implicitRelative = leadingRelative || Expr.relative[" "],
			    i = leadingRelative ? 1 : 0,


			// The foundational matcher ensures that elements are reachable from top-level context(s)
			matchContext = addCombinator(function (elem) {
				return elem === checkContext;
			}, implicitRelative, true),
			    matchAnyContext = addCombinator(function (elem) {
				return indexOf(checkContext, elem) > -1;
			}, implicitRelative, true),
			    matchers = [function (elem, context, xml) {
				var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
				// Avoid hanging onto element (issue #299)
				checkContext = null;
				return ret;
			}];

			for (; i < len; i++) {
				if (matcher = Expr.relative[tokens[i].type]) {
					matchers = [addCombinator(elementMatcher(matchers), matcher)];
				} else {
					matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);

					// Return special upon seeing a positional matcher
					if (matcher[expando]) {
						// Find the next relative operator (if any) for proper handling
						j = ++i;
						for (; j < len; j++) {
							if (Expr.relative[tokens[j].type]) {
								break;
							}
						}
						return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
						// If the preceding token was a descendant combinator, insert an implicit any-element `*`
						tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === " " ? "*" : "" })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));
					}
					matchers.push(matcher);
				}
			}

			return elementMatcher(matchers);
		}

		function matcherFromGroupMatchers(elementMatchers, setMatchers) {
			var bySet = setMatchers.length > 0,
			    byElement = elementMatchers.length > 0,
			    superMatcher = function superMatcher(seed, context, xml, results, outermost) {
				var elem,
				    j,
				    matcher,
				    matchedCount = 0,
				    i = "0",
				    unmatched = seed && [],
				    setMatched = [],
				    contextBackup = outermostContext,

				// We must always have either seed elements or outermost context
				elems = seed || byElement && Expr.find["TAG"]("*", outermost),

				// Use integer dirruns iff this is the outermost matcher
				dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
				    len = elems.length;

				if (outermost) {
					outermostContext = context === document || context || outermost;
				}

				// Add elements passing elementMatchers directly to results
				// Support: IE<9, Safari
				// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
				for (; i !== len && (elem = elems[i]) != null; i++) {
					if (byElement && elem) {
						j = 0;
						if (!context && elem.ownerDocument !== document) {
							setDocument(elem);
							xml = !documentIsHTML;
						}
						while (matcher = elementMatchers[j++]) {
							if (matcher(elem, context || document, xml)) {
								results.push(elem);
								break;
							}
						}
						if (outermost) {
							dirruns = dirrunsUnique;
						}
					}

					// Track unmatched elements for set filters
					if (bySet) {
						// They will have gone through all possible matchers
						if (elem = !matcher && elem) {
							matchedCount--;
						}

						// Lengthen the array for every element, matched or not
						if (seed) {
							unmatched.push(elem);
						}
					}
				}

				// `i` is now the count of elements visited above, and adding it to `matchedCount`
				// makes the latter nonnegative.
				matchedCount += i;

				// Apply set filters to unmatched elements
				// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
				// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
				// no element matchers and no seed.
				// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
				// case, which will result in a "00" `matchedCount` that differs from `i` but is also
				// numerically zero.
				if (bySet && i !== matchedCount) {
					j = 0;
					while (matcher = setMatchers[j++]) {
						matcher(unmatched, setMatched, context, xml);
					}

					if (seed) {
						// Reintegrate element matches to eliminate the need for sorting
						if (matchedCount > 0) {
							while (i--) {
								if (!(unmatched[i] || setMatched[i])) {
									setMatched[i] = pop.call(results);
								}
							}
						}

						// Discard index placeholder values to get only actual matches
						setMatched = condense(setMatched);
					}

					// Add matches to results
					push.apply(results, setMatched);

					// Seedless set matches succeeding multiple successful matchers stipulate sorting
					if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {

						Sizzle.uniqueSort(results);
					}
				}

				// Override manipulation of globals by nested matchers
				if (outermost) {
					dirruns = dirrunsUnique;
					outermostContext = contextBackup;
				}

				return unmatched;
			};

			return bySet ? markFunction(superMatcher) : superMatcher;
		}

		compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
			var i,
			    setMatchers = [],
			    elementMatchers = [],
			    cached = compilerCache[selector + " "];

			if (!cached) {
				// Generate a function of recursive functions that can be used to check each element
				if (!match) {
					match = tokenize(selector);
				}
				i = match.length;
				while (i--) {
					cached = matcherFromTokens(match[i]);
					if (cached[expando]) {
						setMatchers.push(cached);
					} else {
						elementMatchers.push(cached);
					}
				}

				// Cache the compiled function
				cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));

				// Save selector and tokenization
				cached.selector = selector;
			}
			return cached;
		};

		/**
   * A low-level selection function that works with Sizzle's compiled
   *  selector functions
   * @param {String|Function} selector A selector or a pre-compiled
   *  selector function built with Sizzle.compile
   * @param {Element} context
   * @param {Array} [results]
   * @param {Array} [seed] A set of elements to match against
   */
		select = Sizzle.select = function (selector, context, results, seed) {
			var i,
			    tokens,
			    token,
			    type,
			    find,
			    compiled = typeof selector === "function" && selector,
			    match = !seed && tokenize(selector = compiled.selector || selector);

			results = results || [];

			// Try to minimize operations if there is only one selector in the list and no seed
			// (the latter of which guarantees us context)
			if (match.length === 1) {

				// Reduce context if the leading compound selector is an ID
				tokens = match[0] = match[0].slice(0);
				if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {

					context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
					if (!context) {
						return results;

						// Precompiled matchers will still verify ancestry, so step up a level
					} else if (compiled) {
						context = context.parentNode;
					}

					selector = selector.slice(tokens.shift().value.length);
				}

				// Fetch a seed set for right-to-left matching
				i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
				while (i--) {
					token = tokens[i];

					// Abort if we hit a combinator
					if (Expr.relative[type = token.type]) {
						break;
					}
					if (find = Expr.find[type]) {
						// Search, expanding context for leading sibling combinators
						if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {

							// If seed is empty or no tokens remain, we can return early
							tokens.splice(i, 1);
							selector = seed.length && toSelector(tokens);
							if (!selector) {
								push.apply(results, seed);
								return results;
							}

							break;
						}
					}
				}
			}

			// Compile and execute a filtering function if one is not provided
			// Provide `match` to avoid retokenization if we modified the selector above
			(compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
			return results;
		};

		// One-time assignments

		// Sort stability
		support.sortStable = expando.split("").sort(sortOrder).join("") === expando;

		// Support: Chrome 14-35+
		// Always assume duplicates if they aren't passed to the comparison function
		support.detectDuplicates = !!hasDuplicate;

		// Initialize against the default document
		setDocument();

		// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
		// Detached nodes confoundingly follow *each other*
		support.sortDetached = assert(function (el) {
			// Should return 1, but returns 4 (following)
			return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
		});

		// Support: IE<8
		// Prevent attribute/property "interpolation"
		// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
		if (!assert(function (el) {
			el.innerHTML = "<a href='#'></a>";
			return el.firstChild.getAttribute("href") === "#";
		})) {
			addHandle("type|href|height|width", function (elem, name, isXML) {
				if (!isXML) {
					return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
				}
			});
		}

		// Support: IE<9
		// Use defaultValue in place of getAttribute("value")
		if (!support.attributes || !assert(function (el) {
			el.innerHTML = "<input/>";
			el.firstChild.setAttribute("value", "");
			return el.firstChild.getAttribute("value") === "";
		})) {
			addHandle("value", function (elem, name, isXML) {
				if (!isXML && elem.nodeName.toLowerCase() === "input") {
					return elem.defaultValue;
				}
			});
		}

		// Support: IE<9
		// Use getAttributeNode to fetch booleans when getAttribute lies
		if (!assert(function (el) {
			return el.getAttribute("disabled") == null;
		})) {
			addHandle(booleans, function (elem, name, isXML) {
				var val;
				if (!isXML) {
					return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
				}
			});
		}

		return Sizzle;
	}(window);

	jQuery.find = Sizzle;
	jQuery.expr = Sizzle.selectors;

	// Deprecated
	jQuery.expr[":"] = jQuery.expr.pseudos;
	jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
	jQuery.text = Sizzle.getText;
	jQuery.isXMLDoc = Sizzle.isXML;
	jQuery.contains = Sizzle.contains;
	jQuery.escapeSelector = Sizzle.escape;

	var dir = function dir(elem, _dir, until) {
		var matched = [],
		    truncate = until !== undefined;

		while ((elem = elem[_dir]) && elem.nodeType !== 9) {
			if (elem.nodeType === 1) {
				if (truncate && jQuery(elem).is(until)) {
					break;
				}
				matched.push(elem);
			}
		}
		return matched;
	};

	var _siblings = function _siblings(n, elem) {
		var matched = [];

		for (; n; n = n.nextSibling) {
			if (n.nodeType === 1 && n !== elem) {
				matched.push(n);
			}
		}

		return matched;
	};

	var rneedsContext = jQuery.expr.match.needsContext;

	function nodeName(elem, name) {

		return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
	};
	var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;

	// Implement the identical functionality for filter and not
	function winnow(elements, qualifier, not) {
		if (isFunction(qualifier)) {
			return jQuery.grep(elements, function (elem, i) {
				return !!qualifier.call(elem, i, elem) !== not;
			});
		}

		// Single element
		if (qualifier.nodeType) {
			return jQuery.grep(elements, function (elem) {
				return elem === qualifier !== not;
			});
		}

		// Arraylike of elements (jQuery, arguments, Array)
		if (typeof qualifier !== "string") {
			return jQuery.grep(elements, function (elem) {
				return indexOf.call(qualifier, elem) > -1 !== not;
			});
		}

		// Filtered directly for both simple and complex selectors
		return jQuery.filter(qualifier, elements, not);
	}

	jQuery.filter = function (expr, elems, not) {
		var elem = elems[0];

		if (not) {
			expr = ":not(" + expr + ")";
		}

		if (elems.length === 1 && elem.nodeType === 1) {
			return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
		}

		return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
			return elem.nodeType === 1;
		}));
	};

	jQuery.fn.extend({
		find: function find(selector) {
			var i,
			    ret,
			    len = this.length,
			    self = this;

			if (typeof selector !== "string") {
				return this.pushStack(jQuery(selector).filter(function () {
					for (i = 0; i < len; i++) {
						if (jQuery.contains(self[i], this)) {
							return true;
						}
					}
				}));
			}

			ret = this.pushStack([]);

			for (i = 0; i < len; i++) {
				jQuery.find(selector, self[i], ret);
			}

			return len > 1 ? jQuery.uniqueSort(ret) : ret;
		},
		filter: function filter(selector) {
			return this.pushStack(winnow(this, selector || [], false));
		},
		not: function not(selector) {
			return this.pushStack(winnow(this, selector || [], true));
		},
		is: function is(selector) {
			return !!winnow(this,

			// If this is a positional/relative selector, check membership in the returned set
			// so $("p:first").is("p:last") won't return true for a doc with two "p".
			typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
		}
	});

	// Initialize a jQuery object


	// A central reference to the root jQuery(document)
	var rootjQuery,


	// A simple way to check for HTML strings
	// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
	// Strict HTML recognition (#11290: must start with <)
	// Shortcut simple #id case for speed
	rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
	    init = jQuery.fn.init = function (selector, context, root) {
		var match, elem;

		// HANDLE: $(""), $(null), $(undefined), $(false)
		if (!selector) {
			return this;
		}

		// Method init() accepts an alternate rootjQuery
		// so migrate can support jQuery.sub (gh-2101)
		root = root || rootjQuery;

		// Handle HTML strings
		if (typeof selector === "string") {
			if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {

				// Assume that strings that start and end with <> are HTML and skip the regex check
				match = [null, selector, null];
			} else {
				match = rquickExpr.exec(selector);
			}

			// Match html or make sure no context is specified for #id
			if (match && (match[1] || !context)) {

				// HANDLE: $(html) -> $(array)
				if (match[1]) {
					context = context instanceof jQuery ? context[0] : context;

					// Option to run scripts is true for back-compat
					// Intentionally let the error be thrown if parseHTML is not present
					jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));

					// HANDLE: $(html, props)
					if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
						for (match in context) {

							// Properties of context are called as methods if possible
							if (isFunction(this[match])) {
								this[match](context[match]);

								// ...and otherwise set as attributes
							} else {
								this.attr(match, context[match]);
							}
						}
					}

					return this;

					// HANDLE: $(#id)
				} else {
					elem = document.getElementById(match[2]);

					if (elem) {

						// Inject the element directly into the jQuery object
						this[0] = elem;
						this.length = 1;
					}
					return this;
				}

				// HANDLE: $(expr, $(...))
			} else if (!context || context.jquery) {
				return (context || root).find(selector);

				// HANDLE: $(expr, context)
				// (which is just equivalent to: $(context).find(expr)
			} else {
				return this.constructor(context).find(selector);
			}

			// HANDLE: $(DOMElement)
		} else if (selector.nodeType) {
			this[0] = selector;
			this.length = 1;
			return this;

			// HANDLE: $(function)
			// Shortcut for document ready
		} else if (isFunction(selector)) {
			return root.ready !== undefined ? root.ready(selector) :

			// Execute immediately if ready is not present
			selector(jQuery);
		}

		return jQuery.makeArray(selector, this);
	};

	// Give the init function the jQuery prototype for later instantiation
	init.prototype = jQuery.fn;

	// Initialize central reference
	rootjQuery = jQuery(document);

	var rparentsprev = /^(?:parents|prev(?:Until|All))/,


	// Methods guaranteed to produce a unique set when starting from a unique set
	guaranteedUnique = {
		children: true,
		contents: true,
		next: true,
		prev: true
	};

	jQuery.fn.extend({
		has: function has(target) {
			var targets = jQuery(target, this),
			    l = targets.length;

			return this.filter(function () {
				var i = 0;
				for (; i < l; i++) {
					if (jQuery.contains(this, targets[i])) {
						return true;
					}
				}
			});
		},

		closest: function closest(selectors, context) {
			var cur,
			    i = 0,
			    l = this.length,
			    matched = [],
			    targets = typeof selectors !== "string" && jQuery(selectors);

			// Positional selectors never match, since there's no _selection_ context
			if (!rneedsContext.test(selectors)) {
				for (; i < l; i++) {
					for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {

						// Always skip document fragments
						if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :

						// Don't pass non-elements to Sizzle
						cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {

							matched.push(cur);
							break;
						}
					}
				}
			}

			return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
		},

		// Determine the position of an element within the set
		index: function index(elem) {

			// No argument, return index in parent
			if (!elem) {
				return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
			}

			// Index in selector
			if (typeof elem === "string") {
				return indexOf.call(jQuery(elem), this[0]);
			}

			// Locate the position of the desired element
			return indexOf.call(this,

			// If it receives a jQuery object, the first element is used
			elem.jquery ? elem[0] : elem);
		},

		add: function add(selector, context) {
			return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
		},

		addBack: function addBack(selector) {
			return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
		}
	});

	function sibling(cur, dir) {
		while ((cur = cur[dir]) && cur.nodeType !== 1) {}
		return cur;
	}

	jQuery.each({
		parent: function parent(elem) {
			var parent = elem.parentNode;
			return parent && parent.nodeType !== 11 ? parent : null;
		},
		parents: function parents(elem) {
			return dir(elem, "parentNode");
		},
		parentsUntil: function parentsUntil(elem, i, until) {
			return dir(elem, "parentNode", until);
		},
		next: function next(elem) {
			return sibling(elem, "nextSibling");
		},
		prev: function prev(elem) {
			return sibling(elem, "previousSibling");
		},
		nextAll: function nextAll(elem) {
			return dir(elem, "nextSibling");
		},
		prevAll: function prevAll(elem) {
			return dir(elem, "previousSibling");
		},
		nextUntil: function nextUntil(elem, i, until) {
			return dir(elem, "nextSibling", until);
		},
		prevUntil: function prevUntil(elem, i, until) {
			return dir(elem, "previousSibling", until);
		},
		siblings: function siblings(elem) {
			return _siblings((elem.parentNode || {}).firstChild, elem);
		},
		children: function children(elem) {
			return _siblings(elem.firstChild);
		},
		contents: function contents(elem) {
			if (nodeName(elem, "iframe")) {
				return elem.contentDocument;
			}

			// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
			// Treat the template element as a regular one in browsers that
			// don't support it.
			if (nodeName(elem, "template")) {
				elem = elem.content || elem;
			}

			return jQuery.merge([], elem.childNodes);
		}
	}, function (name, fn) {
		jQuery.fn[name] = function (until, selector) {
			var matched = jQuery.map(this, fn, until);

			if (name.slice(-5) !== "Until") {
				selector = until;
			}

			if (selector && typeof selector === "string") {
				matched = jQuery.filter(selector, matched);
			}

			if (this.length > 1) {

				// Remove duplicates
				if (!guaranteedUnique[name]) {
					jQuery.uniqueSort(matched);
				}

				// Reverse order for parents* and prev-derivatives
				if (rparentsprev.test(name)) {
					matched.reverse();
				}
			}

			return this.pushStack(matched);
		};
	});
	var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;

	// Convert String-formatted options into Object-formatted ones
	function createOptions(options) {
		var object = {};
		jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
			object[flag] = true;
		});
		return object;
	}

	/*
  * Create a callback list using the following parameters:
  *
  *	options: an optional list of space-separated options that will change how
  *			the callback list behaves or a more traditional option object
  *
  * By default a callback list will act like an event callback list and can be
  * "fired" multiple times.
  *
  * Possible options:
  *
  *	once:			will ensure the callback list can only be fired once (like a Deferred)
  *
  *	memory:			will keep track of previous values and will call any callback added
  *					after the list has been fired right away with the latest "memorized"
  *					values (like a Deferred)
  *
  *	unique:			will ensure a callback can only be added once (no duplicate in the list)
  *
  *	stopOnFalse:	interrupt callings when a callback returns false
  *
  */
	jQuery.Callbacks = function (options) {

		// Convert options from String-formatted to Object-formatted if needed
		// (we check in cache first)
		options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);

		var // Flag to know if list is currently firing
		firing,


		// Last fire value for non-forgettable lists
		memory,


		// Flag to know if list was already fired
		_fired,


		// Flag to prevent firing
		_locked,


		// Actual callback list
		list = [],


		// Queue of execution data for repeatable lists
		queue = [],


		// Index of currently firing callback (modified by add/remove as needed)
		firingIndex = -1,


		// Fire callbacks
		fire = function fire() {

			// Enforce single-firing
			_locked = _locked || options.once;

			// Execute callbacks for all pending executions,
			// respecting firingIndex overrides and runtime changes
			_fired = firing = true;
			for (; queue.length; firingIndex = -1) {
				memory = queue.shift();
				while (++firingIndex < list.length) {

					// Run callback and check for early termination
					if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {

						// Jump to end and forget the data so .add doesn't re-fire
						firingIndex = list.length;
						memory = false;
					}
				}
			}

			// Forget the data if we're done with it
			if (!options.memory) {
				memory = false;
			}

			firing = false;

			// Clean up if we're done firing for good
			if (_locked) {

				// Keep an empty list if we have data for future add calls
				if (memory) {
					list = [];

					// Otherwise, this object is spent
				} else {
					list = "";
				}
			}
		},


		// Actual Callbacks object
		self = {

			// Add a callback or a collection of callbacks to the list
			add: function add() {
				if (list) {

					// If we have memory from a past run, we should fire after adding
					if (memory && !firing) {
						firingIndex = list.length - 1;
						queue.push(memory);
					}

					(function add(args) {
						jQuery.each(args, function (_, arg) {
							if (isFunction(arg)) {
								if (!options.unique || !self.has(arg)) {
									list.push(arg);
								}
							} else if (arg && arg.length && toType(arg) !== "string") {

								// Inspect recursively
								add(arg);
							}
						});
					})(arguments);

					if (memory && !firing) {
						fire();
					}
				}
				return this;
			},

			// Remove a callback from the list
			remove: function remove() {
				jQuery.each(arguments, function (_, arg) {
					var index;
					while ((index = jQuery.inArray(arg, list, index)) > -1) {
						list.splice(index, 1);

						// Handle firing indexes
						if (index <= firingIndex) {
							firingIndex--;
						}
					}
				});
				return this;
			},

			// Check if a given callback is in the list.
			// If no argument is given, return whether or not list has callbacks attached.
			has: function has(fn) {
				return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
			},

			// Remove all callbacks from the list
			empty: function empty() {
				if (list) {
					list = [];
				}
				return this;
			},

			// Disable .fire and .add
			// Abort any current/pending executions
			// Clear all callbacks and values
			disable: function disable() {
				_locked = queue = [];
				list = memory = "";
				return this;
			},
			disabled: function disabled() {
				return !list;
			},

			// Disable .fire
			// Also disable .add unless we have memory (since it would have no effect)
			// Abort any pending executions
			lock: function lock() {
				_locked = queue = [];
				if (!memory && !firing) {
					list = memory = "";
				}
				return this;
			},
			locked: function locked() {
				return !!_locked;
			},

			// Call all callbacks with the given context and arguments
			fireWith: function fireWith(context, args) {
				if (!_locked) {
					args = args || [];
					args = [context, args.slice ? args.slice() : args];
					queue.push(args);
					if (!firing) {
						fire();
					}
				}
				return this;
			},

			// Call all the callbacks with the given arguments
			fire: function fire() {
				self.fireWith(this, arguments);
				return this;
			},

			// To know if the callbacks have already been called at least once
			fired: function fired() {
				return !!_fired;
			}
		};

		return self;
	};

	function Identity(v) {
		return v;
	}
	function Thrower(ex) {
		throw ex;
	}

	function adoptValue(value, resolve, reject, noValue) {
		var method;

		try {

			// Check for promise aspect first to privilege synchronous behavior
			if (value && isFunction(method = value.promise)) {
				method.call(value).done(resolve).fail(reject);

				// Other thenables
			} else if (value && isFunction(method = value.then)) {
				method.call(value, resolve, reject);

				// Other non-thenables
			} else {

				// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
				// * false: [ value ].slice( 0 ) => resolve( value )
				// * true: [ value ].slice( 1 ) => resolve()
				resolve.apply(undefined, [value].slice(noValue));
			}

			// For Promises/A+, convert exceptions into rejections
			// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
			// Deferred#then to conditionally suppress rejection.
		} catch (value) {

			// Support: Android 4.0 only
			// Strict mode functions invoked without .call/.apply get global-object context
			reject.apply(undefined, [value]);
		}
	}

	jQuery.extend({

		Deferred: function Deferred(func) {
			var tuples = [

			// action, add listener, callbacks,
			// ... .then handlers, argument index, [final state]
			["notify", "progress", jQuery.Callbacks("memory"), jQuery.Callbacks("memory"), 2], ["resolve", "done", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 0, "resolved"], ["reject", "fail", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 1, "rejected"]],
			    _state = "pending",
			    _promise = {
				state: function state() {
					return _state;
				},
				always: function always() {
					deferred.done(arguments).fail(arguments);
					return this;
				},
				"catch": function _catch(fn) {
					return _promise.then(null, fn);
				},

				// Keep pipe for back-compat
				pipe: function pipe() /* fnDone, fnFail, fnProgress */{
					var fns = arguments;

					return jQuery.Deferred(function (newDefer) {
						jQuery.each(tuples, function (i, tuple) {

							// Map tuples (progress, done, fail) to arguments (done, fail, progress)
							var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];

							// deferred.progress(function() { bind to newDefer or newDefer.notify })
							// deferred.done(function() { bind to newDefer or newDefer.resolve })
							// deferred.fail(function() { bind to newDefer or newDefer.reject })
							deferred[tuple[1]](function () {
								var returned = fn && fn.apply(this, arguments);
								if (returned && isFunction(returned.promise)) {
									returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
								} else {
									newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
								}
							});
						});
						fns = null;
					}).promise();
				},
				then: function then(onFulfilled, onRejected, onProgress) {
					var maxDepth = 0;
					function resolve(depth, deferred, handler, special) {
						return function () {
							var that = this,
							    args = arguments,
							    mightThrow = function mightThrow() {
								var returned, then;

								// Support: Promises/A+ section 2.3.3.3.3
								// https://promisesaplus.com/#point-59
								// Ignore double-resolution attempts
								if (depth < maxDepth) {
									return;
								}

								returned = handler.apply(that, args);

								// Support: Promises/A+ section 2.3.1
								// https://promisesaplus.com/#point-48
								if (returned === deferred.promise()) {
									throw new TypeError("Thenable self-resolution");
								}

								// Support: Promises/A+ sections 2.3.3.1, 3.5
								// https://promisesaplus.com/#point-54
								// https://promisesaplus.com/#point-75
								// Retrieve `then` only once
								then = returned && (

								// Support: Promises/A+ section 2.3.4
								// https://promisesaplus.com/#point-64
								// Only check objects and functions for thenability
								(typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then;

								// Handle a returned thenable
								if (isFunction(then)) {

									// Special processors (notify) just wait for resolution
									if (special) {
										then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));

										// Normal processors (resolve) also hook into progress
									} else {

										// ...and disregard older resolution values
										maxDepth++;

										then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
									}

									// Handle all other returned values
								} else {

									// Only substitute handlers pass on context
									// and multiple values (non-spec behavior)
									if (handler !== Identity) {
										that = undefined;
										args = [returned];
									}

									// Process the value(s)
									// Default process is resolve
									(special || deferred.resolveWith)(that, args);
								}
							},


							// Only normal processors (resolve) catch and reject exceptions
							process = special ? mightThrow : function () {
								try {
									mightThrow();
								} catch (e) {

									if (jQuery.Deferred.exceptionHook) {
										jQuery.Deferred.exceptionHook(e, process.stackTrace);
									}

									// Support: Promises/A+ section 2.3.3.3.4.1
									// https://promisesaplus.com/#point-61
									// Ignore post-resolution exceptions
									if (depth + 1 >= maxDepth) {

										// Only substitute handlers pass on context
										// and multiple values (non-spec behavior)
										if (handler !== Thrower) {
											that = undefined;
											args = [e];
										}

										deferred.rejectWith(that, args);
									}
								}
							};

							// Support: Promises/A+ section 2.3.3.3.1
							// https://promisesaplus.com/#point-57
							// Re-resolve promises immediately to dodge false rejection from
							// subsequent errors
							if (depth) {
								process();
							} else {

								// Call an optional hook to record the stack, in case of exception
								// since it's otherwise lost when execution goes async
								if (jQuery.Deferred.getStackHook) {
									process.stackTrace = jQuery.Deferred.getStackHook();
								}
								window.setTimeout(process);
							}
						};
					}

					return jQuery.Deferred(function (newDefer) {

						// progress_handlers.add( ... )
						tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));

						// fulfilled_handlers.add( ... )
						tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));

						// rejected_handlers.add( ... )
						tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
					}).promise();
				},

				// Get a promise for this deferred
				// If obj is provided, the promise aspect is added to the object
				promise: function promise(obj) {
					return obj != null ? jQuery.extend(obj, _promise) : _promise;
				}
			},
			    deferred = {};

			// Add list-specific methods
			jQuery.each(tuples, function (i, tuple) {
				var list = tuple[2],
				    stateString = tuple[5];

				// promise.progress = list.add
				// promise.done = list.add
				// promise.fail = list.add
				_promise[tuple[1]] = list.add;

				// Handle state
				if (stateString) {
					list.add(function () {

						// state = "resolved" (i.e., fulfilled)
						// state = "rejected"
						_state = stateString;
					},

					// rejected_callbacks.disable
					// fulfilled_callbacks.disable
					tuples[3 - i][2].disable,

					// rejected_handlers.disable
					// fulfilled_handlers.disable
					tuples[3 - i][3].disable,

					// progress_callbacks.lock
					tuples[0][2].lock,

					// progress_handlers.lock
					tuples[0][3].lock);
				}

				// progress_handlers.fire
				// fulfilled_handlers.fire
				// rejected_handlers.fire
				list.add(tuple[3].fire);

				// deferred.notify = function() { deferred.notifyWith(...) }
				// deferred.resolve = function() { deferred.resolveWith(...) }
				// deferred.reject = function() { deferred.rejectWith(...) }
				deferred[tuple[0]] = function () {
					deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
					return this;
				};

				// deferred.notifyWith = list.fireWith
				// deferred.resolveWith = list.fireWith
				// deferred.rejectWith = list.fireWith
				deferred[tuple[0] + "With"] = list.fireWith;
			});

			// Make the deferred a promise
			_promise.promise(deferred);

			// Call given func if any
			if (func) {
				func.call(deferred, deferred);
			}

			// All done!
			return deferred;
		},

		// Deferred helper
		when: function when(singleValue) {
			var

			// count of uncompleted subordinates
			remaining = arguments.length,


			// count of unprocessed arguments
			i = remaining,


			// subordinate fulfillment data
			resolveContexts = Array(i),
			    resolveValues = _slice.call(arguments),


			// the master Deferred
			master = jQuery.Deferred(),


			// subordinate callback factory
			updateFunc = function updateFunc(i) {
				return function (value) {
					resolveContexts[i] = this;
					resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;
					if (! --remaining) {
						master.resolveWith(resolveContexts, resolveValues);
					}
				};
			};

			// Single- and empty arguments are adopted like Promise.resolve
			if (remaining <= 1) {
				adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);

				// Use .then() to unwrap secondary thenables (cf. gh-3000)
				if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {

					return master.then();
				}
			}

			// Multiple arguments are aggregated like Promise.all array elements
			while (i--) {
				adoptValue(resolveValues[i], updateFunc(i), master.reject);
			}

			return master.promise();
		}
	});

	// These usually indicate a programmer mistake during development,
	// warn about them ASAP rather than swallowing them by default.
	var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;

	jQuery.Deferred.exceptionHook = function (error, stack) {

		// Support: IE 8 - 9 only
		// Console exists when dev tools are open, which can happen at any time
		if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
			window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
		}
	};

	jQuery.readyException = function (error) {
		window.setTimeout(function () {
			throw error;
		});
	};

	// The deferred used on DOM ready
	var readyList = jQuery.Deferred();

	jQuery.fn.ready = function (fn) {

		readyList.then(fn)

		// Wrap jQuery.readyException in a function so that the lookup
		// happens at the time of error handling instead of callback
		// registration.
		.catch(function (error) {
			jQuery.readyException(error);
		});

		return this;
	};

	jQuery.extend({

		// Is the DOM ready to be used? Set to true once it occurs.
		isReady: false,

		// A counter to track how many items to wait for before
		// the ready event fires. See #6781
		readyWait: 1,

		// Handle when the DOM is ready
		ready: function ready(wait) {

			// Abort if there are pending holds or we're already ready
			if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
				return;
			}

			// Remember that the DOM is ready
			jQuery.isReady = true;

			// If a normal DOM Ready event fired, decrement, and wait if need be
			if (wait !== true && --jQuery.readyWait > 0) {
				return;
			}

			// If there are functions bound, to execute
			readyList.resolveWith(document, [jQuery]);
		}
	});

	jQuery.ready.then = readyList.then;

	// The ready event handler and self cleanup method
	function completed() {
		document.removeEventListener("DOMContentLoaded", completed);
		window.removeEventListener("load", completed);
		jQuery.ready();
	}

	// Catch cases where $(document).ready() is called
	// after the browser event has already occurred.
	// Support: IE <=9 - 10 only
	// Older IE sometimes signals "interactive" too soon
	if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {

		// Handle it asynchronously to allow scripts the opportunity to delay ready
		window.setTimeout(jQuery.ready);
	} else {

		// Use the handy event callback
		document.addEventListener("DOMContentLoaded", completed);

		// A fallback to window.onload, that will always work
		window.addEventListener("load", completed);
	}

	// Multifunctional method to get and set values of a collection
	// The value/s can optionally be executed if it's a function
	var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {
		var i = 0,
		    len = elems.length,
		    bulk = key == null;

		// Sets many values
		if (toType(key) === "object") {
			chainable = true;
			for (i in key) {
				access(elems, fn, i, key[i], true, emptyGet, raw);
			}

			// Sets one value
		} else if (value !== undefined) {
			chainable = true;

			if (!isFunction(value)) {
				raw = true;
			}

			if (bulk) {

				// Bulk operations run against the entire set
				if (raw) {
					fn.call(elems, value);
					fn = null;

					// ...except when executing function values
				} else {
					bulk = fn;
					fn = function fn(elem, key, value) {
						return bulk.call(jQuery(elem), value);
					};
				}
			}

			if (fn) {
				for (; i < len; i++) {
					fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
				}
			}
		}

		if (chainable) {
			return elems;
		}

		// Gets
		if (bulk) {
			return fn.call(elems);
		}

		return len ? fn(elems[0], key) : emptyGet;
	};

	// Matches dashed string for camelizing
	var rmsPrefix = /^-ms-/,
	    rdashAlpha = /-([a-z])/g;

	// Used by camelCase as callback to replace()
	function fcamelCase(all, letter) {
		return letter.toUpperCase();
	}

	// Convert dashed to camelCase; used by the css and data modules
	// Support: IE <=9 - 11, Edge 12 - 15
	// Microsoft forgot to hump their vendor prefix (#9572)
	function camelCase(string) {
		return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
	}
	var acceptData = function acceptData(owner) {

		// Accepts only:
		//  - Node
		//    - Node.ELEMENT_NODE
		//    - Node.DOCUMENT_NODE
		//  - Object
		//    - Any
		return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
	};

	function Data() {
		this.expando = jQuery.expando + Data.uid++;
	}

	Data.uid = 1;

	Data.prototype = {

		cache: function cache(owner) {

			// Check if the owner object already has a cache
			var value = owner[this.expando];

			// If not, create one
			if (!value) {
				value = {};

				// We can accept data for non-element nodes in modern browsers,
				// but we should not, see #8335.
				// Always return an empty object.
				if (acceptData(owner)) {

					// If it is a node unlikely to be stringify-ed or looped over
					// use plain assignment
					if (owner.nodeType) {
						owner[this.expando] = value;

						// Otherwise secure it in a non-enumerable property
						// configurable must be true to allow the property to be
						// deleted when data is removed
					} else {
						Object.defineProperty(owner, this.expando, {
							value: value,
							configurable: true
						});
					}
				}
			}

			return value;
		},
		set: function set(owner, data, value) {
			var prop,
			    cache = this.cache(owner);

			// Handle: [ owner, key, value ] args
			// Always use camelCase key (gh-2257)
			if (typeof data === "string") {
				cache[camelCase(data)] = value;

				// Handle: [ owner, { properties } ] args
			} else {

				// Copy the properties one-by-one to the cache object
				for (prop in data) {
					cache[camelCase(prop)] = data[prop];
				}
			}
			return cache;
		},
		get: function get(owner, key) {
			return key === undefined ? this.cache(owner) :

			// Always use camelCase key (gh-2257)
			owner[this.expando] && owner[this.expando][camelCase(key)];
		},
		access: function access(owner, key, value) {

			// In cases where either:
			//
			//   1. No key was specified
			//   2. A string key was specified, but no value provided
			//
			// Take the "read" path and allow the get method to determine
			// which value to return, respectively either:
			//
			//   1. The entire cache object
			//   2. The data stored at the key
			//
			if (key === undefined || key && typeof key === "string" && value === undefined) {

				return this.get(owner, key);
			}

			// When the key is not a string, or both a key and value
			// are specified, set or extend (existing objects) with either:
			//
			//   1. An object of properties
			//   2. A key and value
			//
			this.set(owner, key, value);

			// Since the "set" path can have two possible entry points
			// return the expected data based on which path was taken[*]
			return value !== undefined ? value : key;
		},
		remove: function remove(owner, key) {
			var i,
			    cache = owner[this.expando];

			if (cache === undefined) {
				return;
			}

			if (key !== undefined) {

				// Support array or space separated string of keys
				if (Array.isArray(key)) {

					// If key is an array of keys...
					// We always set camelCase keys, so remove that.
					key = key.map(camelCase);
				} else {
					key = camelCase(key);

					// If a key with the spaces exists, use it.
					// Otherwise, create an array by matching non-whitespace
					key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
				}

				i = key.length;

				while (i--) {
					delete cache[key[i]];
				}
			}

			// Remove the expando if there's no more data
			if (key === undefined || jQuery.isEmptyObject(cache)) {

				// Support: Chrome <=35 - 45
				// Webkit & Blink performance suffers when deleting properties
				// from DOM nodes, so set to undefined instead
				// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
				if (owner.nodeType) {
					owner[this.expando] = undefined;
				} else {
					delete owner[this.expando];
				}
			}
		},
		hasData: function hasData(owner) {
			var cache = owner[this.expando];
			return cache !== undefined && !jQuery.isEmptyObject(cache);
		}
	};
	var dataPriv = new Data();

	var dataUser = new Data();

	//	Implementation Summary
	//
	//	1. Enforce API surface and semantic compatibility with 1.9.x branch
	//	2. Improve the module's maintainability by reducing the storage
	//		paths to a single mechanism.
	//	3. Use the same single mechanism to support "private" and "user" data.
	//	4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
	//	5. Avoid exposing implementation details on user objects (eg. expando properties)
	//	6. Provide a clear path for implementation upgrade to WeakMap in 2014

	var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
	    rmultiDash = /[A-Z]/g;

	function getData(data) {
		if (data === "true") {
			return true;
		}

		if (data === "false") {
			return false;
		}

		if (data === "null") {
			return null;
		}

		// Only convert to a number if it doesn't change the string
		if (data === +data + "") {
			return +data;
		}

		if (rbrace.test(data)) {
			return JSON.parse(data);
		}

		return data;
	}

	function dataAttr(elem, key, data) {
		var name;

		// If nothing was found internally, try to fetch any
		// data from the HTML5 data-* attribute
		if (data === undefined && elem.nodeType === 1) {
			name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
			data = elem.getAttribute(name);

			if (typeof data === "string") {
				try {
					data = getData(data);
				} catch (e) {}

				// Make sure we set the data so it isn't changed later
				dataUser.set(elem, key, data);
			} else {
				data = undefined;
			}
		}
		return data;
	}

	jQuery.extend({
		hasData: function hasData(elem) {
			return dataUser.hasData(elem) || dataPriv.hasData(elem);
		},

		data: function data(elem, name, _data) {
			return dataUser.access(elem, name, _data);
		},

		removeData: function removeData(elem, name) {
			dataUser.remove(elem, name);
		},

		// TODO: Now that all calls to _data and _removeData have been replaced
		// with direct calls to dataPriv methods, these can be deprecated.
		_data: function _data(elem, name, data) {
			return dataPriv.access(elem, name, data);
		},

		_removeData: function _removeData(elem, name) {
			dataPriv.remove(elem, name);
		}
	});

	jQuery.fn.extend({
		data: function data(key, value) {
			var i,
			    name,
			    data,
			    elem = this[0],
			    attrs = elem && elem.attributes;

			// Gets all values
			if (key === undefined) {
				if (this.length) {
					data = dataUser.get(elem);

					if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
						i = attrs.length;
						while (i--) {

							// Support: IE 11 only
							// The attrs elements can be null (#14894)
							if (attrs[i]) {
								name = attrs[i].name;
								if (name.indexOf("data-") === 0) {
									name = camelCase(name.slice(5));
									dataAttr(elem, name, data[name]);
								}
							}
						}
						dataPriv.set(elem, "hasDataAttrs", true);
					}
				}

				return data;
			}

			// Sets multiple values
			if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") {
				return this.each(function () {
					dataUser.set(this, key);
				});
			}

			return access(this, function (value) {
				var data;

				// The calling jQuery object (element matches) is not empty
				// (and therefore has an element appears at this[ 0 ]) and the
				// `value` parameter was not undefined. An empty jQuery object
				// will result in `undefined` for elem = this[ 0 ] which will
				// throw an exception if an attempt to read a data cache is made.
				if (elem && value === undefined) {

					// Attempt to get data from the cache
					// The key will always be camelCased in Data
					data = dataUser.get(elem, key);
					if (data !== undefined) {
						return data;
					}

					// Attempt to "discover" the data in
					// HTML5 custom data-* attrs
					data = dataAttr(elem, key);
					if (data !== undefined) {
						return data;
					}

					// We tried really hard, but the data doesn't exist.
					return;
				}

				// Set the data...
				this.each(function () {

					// We always store the camelCased key
					dataUser.set(this, key, value);
				});
			}, null, value, arguments.length > 1, null, true);
		},

		removeData: function removeData(key) {
			return this.each(function () {
				dataUser.remove(this, key);
			});
		}
	});

	jQuery.extend({
		queue: function queue(elem, type, data) {
			var queue;

			if (elem) {
				type = (type || "fx") + "queue";
				queue = dataPriv.get(elem, type);

				// Speed up dequeue by getting out quickly if this is just a lookup
				if (data) {
					if (!queue || Array.isArray(data)) {
						queue = dataPriv.access(elem, type, jQuery.makeArray(data));
					} else {
						queue.push(data);
					}
				}
				return queue || [];
			}
		},

		dequeue: function dequeue(elem, type) {
			type = type || "fx";

			var queue = jQuery.queue(elem, type),
			    startLength = queue.length,
			    fn = queue.shift(),
			    hooks = jQuery._queueHooks(elem, type),
			    next = function next() {
				jQuery.dequeue(elem, type);
			};

			// If the fx queue is dequeued, always remove the progress sentinel
			if (fn === "inprogress") {
				fn = queue.shift();
				startLength--;
			}

			if (fn) {

				// Add a progress sentinel to prevent the fx queue from being
				// automatically dequeued
				if (type === "fx") {
					queue.unshift("inprogress");
				}

				// Clear up the last queue stop function
				delete hooks.stop;
				fn.call(elem, next, hooks);
			}

			if (!startLength && hooks) {
				hooks.empty.fire();
			}
		},

		// Not public - generate a queueHooks object, or return the current one
		_queueHooks: function _queueHooks(elem, type) {
			var key = type + "queueHooks";
			return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
				empty: jQuery.Callbacks("once memory").add(function () {
					dataPriv.remove(elem, [type + "queue", key]);
				})
			});
		}
	});

	jQuery.fn.extend({
		queue: function queue(type, data) {
			var setter = 2;

			if (typeof type !== "string") {
				data = type;
				type = "fx";
				setter--;
			}

			if (arguments.length < setter) {
				return jQuery.queue(this[0], type);
			}

			return data === undefined ? this : this.each(function () {
				var queue = jQuery.queue(this, type, data);

				// Ensure a hooks for this queue
				jQuery._queueHooks(this, type);

				if (type === "fx" && queue[0] !== "inprogress") {
					jQuery.dequeue(this, type);
				}
			});
		},
		dequeue: function dequeue(type) {
			return this.each(function () {
				jQuery.dequeue(this, type);
			});
		},
		clearQueue: function clearQueue(type) {
			return this.queue(type || "fx", []);
		},

		// Get a promise resolved when queues of a certain type
		// are emptied (fx is the type by default)
		promise: function promise(type, obj) {
			var tmp,
			    count = 1,
			    defer = jQuery.Deferred(),
			    elements = this,
			    i = this.length,
			    resolve = function resolve() {
				if (! --count) {
					defer.resolveWith(elements, [elements]);
				}
			};

			if (typeof type !== "string") {
				obj = type;
				type = undefined;
			}
			type = type || "fx";

			while (i--) {
				tmp = dataPriv.get(elements[i], type + "queueHooks");
				if (tmp && tmp.empty) {
					count++;
					tmp.empty.add(resolve);
				}
			}
			resolve();
			return defer.promise(obj);
		}
	});
	var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;

	var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");

	var cssExpand = ["Top", "Right", "Bottom", "Left"];

	var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {

		// isHiddenWithinTree might be called from jQuery#filter function;
		// in that case, element will be second argument
		elem = el || elem;

		// Inline style trumps all
		return elem.style.display === "none" || elem.style.display === "" &&

		// Otherwise, check computed style
		// Support: Firefox <=43 - 45
		// Disconnected elements can have computed display: none, so first confirm that elem is
		// in the document.
		jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none";
	};

	var swap = function swap(elem, options, callback, args) {
		var ret,
		    name,
		    old = {};

		// Remember the old values, and insert the new ones
		for (name in options) {
			old[name] = elem.style[name];
			elem.style[name] = options[name];
		}

		ret = callback.apply(elem, args || []);

		// Revert the old values
		for (name in options) {
			elem.style[name] = old[name];
		}

		return ret;
	};

	function adjustCSS(elem, prop, valueParts, tween) {
		var adjusted,
		    scale,
		    maxIterations = 20,
		    currentValue = tween ? function () {
			return tween.cur();
		} : function () {
			return jQuery.css(elem, prop, "");
		},
		    initial = currentValue(),
		    unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),


		// Starting value computation is required for potential unit mismatches
		initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));

		if (initialInUnit && initialInUnit[3] !== unit) {

			// Support: Firefox <=54
			// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
			initial = initial / 2;

			// Trust units reported by jQuery.css
			unit = unit || initialInUnit[3];

			// Iteratively approximate from a nonzero starting point
			initialInUnit = +initial || 1;

			while (maxIterations--) {

				// Evaluate and update our best guess (doubling guesses that zero out).
				// Finish if the scale equals or crosses 1 (making the old*new product non-positive).
				jQuery.style(elem, prop, initialInUnit + unit);
				if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
					maxIterations = 0;
				}
				initialInUnit = initialInUnit / scale;
			}

			initialInUnit = initialInUnit * 2;
			jQuery.style(elem, prop, initialInUnit + unit);

			// Make sure we update the tween properties later on
			valueParts = valueParts || [];
		}

		if (valueParts) {
			initialInUnit = +initialInUnit || +initial || 0;

			// Apply relative offset (+=/-=) if specified
			adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
			if (tween) {
				tween.unit = unit;
				tween.start = initialInUnit;
				tween.end = adjusted;
			}
		}
		return adjusted;
	}

	var defaultDisplayMap = {};

	function getDefaultDisplay(elem) {
		var temp,
		    doc = elem.ownerDocument,
		    nodeName = elem.nodeName,
		    display = defaultDisplayMap[nodeName];

		if (display) {
			return display;
		}

		temp = doc.body.appendChild(doc.createElement(nodeName));
		display = jQuery.css(temp, "display");

		temp.parentNode.removeChild(temp);

		if (display === "none") {
			display = "block";
		}
		defaultDisplayMap[nodeName] = display;

		return display;
	}

	function showHide(elements, show) {
		var display,
		    elem,
		    values = [],
		    index = 0,
		    length = elements.length;

		// Determine new display value for elements that need to change
		for (; index < length; index++) {
			elem = elements[index];
			if (!elem.style) {
				continue;
			}

			display = elem.style.display;
			if (show) {

				// Since we force visibility upon cascade-hidden elements, an immediate (and slow)
				// check is required in this first loop unless we have a nonempty display value (either
				// inline or about-to-be-restored)
				if (display === "none") {
					values[index] = dataPriv.get(elem, "display") || null;
					if (!values[index]) {
						elem.style.display = "";
					}
				}
				if (elem.style.display === "" && isHiddenWithinTree(elem)) {
					values[index] = getDefaultDisplay(elem);
				}
			} else {
				if (display !== "none") {
					values[index] = "none";

					// Remember what we're overwriting
					dataPriv.set(elem, "display", display);
				}
			}
		}

		// Set the display of the elements in a second loop to avoid constant reflow
		for (index = 0; index < length; index++) {
			if (values[index] != null) {
				elements[index].style.display = values[index];
			}
		}

		return elements;
	}

	jQuery.fn.extend({
		show: function show() {
			return showHide(this, true);
		},
		hide: function hide() {
			return showHide(this);
		},
		toggle: function toggle(state) {
			if (typeof state === "boolean") {
				return state ? this.show() : this.hide();
			}

			return this.each(function () {
				if (isHiddenWithinTree(this)) {
					jQuery(this).show();
				} else {
					jQuery(this).hide();
				}
			});
		}
	});
	var rcheckableType = /^(?:checkbox|radio)$/i;

	var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;

	var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;

	// We have to close these tags to support XHTML (#13200)
	var wrapMap = {

		// Support: IE <=9 only
		option: [1, "<select multiple='multiple'>", "</select>"],

		// XHTML parsers do not magically insert elements in the
		// same way that tag soup parsers do. So we cannot shorten
		// this by omitting <tbody> or other required elements.
		thead: [1, "<table>", "</table>"],
		col: [2, "<table><colgroup>", "</colgroup></table>"],
		tr: [2, "<table><tbody>", "</tbody></table>"],
		td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],

		_default: [0, "", ""]
	};

	// Support: IE <=9 only
	wrapMap.optgroup = wrapMap.option;

	wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
	wrapMap.th = wrapMap.td;

	function getAll(context, tag) {

		// Support: IE <=9 - 11 only
		// Use typeof to avoid zero-argument method invocation on host objects (#15151)
		var ret;

		if (typeof context.getElementsByTagName !== "undefined") {
			ret = context.getElementsByTagName(tag || "*");
		} else if (typeof context.querySelectorAll !== "undefined") {
			ret = context.querySelectorAll(tag || "*");
		} else {
			ret = [];
		}

		if (tag === undefined || tag && nodeName(context, tag)) {
			return jQuery.merge([context], ret);
		}

		return ret;
	}

	// Mark scripts as having already been evaluated
	function setGlobalEval(elems, refElements) {
		var i = 0,
		    l = elems.length;

		for (; i < l; i++) {
			dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
		}
	}

	var rhtml = /<|&#?\w+;/;

	function buildFragment(elems, context, scripts, selection, ignored) {
		var elem,
		    tmp,
		    tag,
		    wrap,
		    contains,
		    j,
		    fragment = context.createDocumentFragment(),
		    nodes = [],
		    i = 0,
		    l = elems.length;

		for (; i < l; i++) {
			elem = elems[i];

			if (elem || elem === 0) {

				// Add nodes directly
				if (toType(elem) === "object") {

					// Support: Android <=4.0 only, PhantomJS 1 only
					// push.apply(_, arraylike) throws on ancient WebKit
					jQuery.merge(nodes, elem.nodeType ? [elem] : elem);

					// Convert non-html into a text node
				} else if (!rhtml.test(elem)) {
					nodes.push(context.createTextNode(elem));

					// Convert html into DOM nodes
				} else {
					tmp = tmp || fragment.appendChild(context.createElement("div"));

					// Deserialize a standard representation
					tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
					wrap = wrapMap[tag] || wrapMap._default;
					tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];

					// Descend through wrappers to the right content
					j = wrap[0];
					while (j--) {
						tmp = tmp.lastChild;
					}

					// Support: Android <=4.0 only, PhantomJS 1 only
					// push.apply(_, arraylike) throws on ancient WebKit
					jQuery.merge(nodes, tmp.childNodes);

					// Remember the top-level container
					tmp = fragment.firstChild;

					// Ensure the created nodes are orphaned (#12392)
					tmp.textContent = "";
				}
			}
		}

		// Remove wrapper from fragment
		fragment.textContent = "";

		i = 0;
		while (elem = nodes[i++]) {

			// Skip elements already in the context collection (trac-4087)
			if (selection && jQuery.inArray(elem, selection) > -1) {
				if (ignored) {
					ignored.push(elem);
				}
				continue;
			}

			contains = jQuery.contains(elem.ownerDocument, elem);

			// Append to fragment
			tmp = getAll(fragment.appendChild(elem), "script");

			// Preserve script evaluation history
			if (contains) {
				setGlobalEval(tmp);
			}

			// Capture executables
			if (scripts) {
				j = 0;
				while (elem = tmp[j++]) {
					if (rscriptType.test(elem.type || "")) {
						scripts.push(elem);
					}
				}
			}
		}

		return fragment;
	}

	(function () {
		var fragment = document.createDocumentFragment(),
		    div = fragment.appendChild(document.createElement("div")),
		    input = document.createElement("input");

		// Support: Android 4.0 - 4.3 only
		// Check state lost if the name is set (#11217)
		// Support: Windows Web Apps (WWA)
		// `name` and `type` must use .setAttribute for WWA (#14901)
		input.setAttribute("type", "radio");
		input.setAttribute("checked", "checked");
		input.setAttribute("name", "t");

		div.appendChild(input);

		// Support: Android <=4.1 only
		// Older WebKit doesn't clone checked state correctly in fragments
		support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;

		// Support: IE <=11 only
		// Make sure textarea (and checkbox) defaultValue is properly cloned
		div.innerHTML = "<textarea>x</textarea>";
		support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
	})();
	var documentElement = document.documentElement;

	var rkeyEvent = /^key/,
	    rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
	    rtypenamespace = /^([^.]*)(?:\.(.+)|)/;

	function returnTrue() {
		return true;
	}

	function returnFalse() {
		return false;
	}

	// Support: IE <=9 only
	// See #13393 for more info
	function safeActiveElement() {
		try {
			return document.activeElement;
		} catch (err) {}
	}

	function _on(elem, types, selector, data, fn, one) {
		var origFn, type;

		// Types can be a map of types/handlers
		if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {

			// ( types-Object, selector, data )
			if (typeof selector !== "string") {

				// ( types-Object, data )
				data = data || selector;
				selector = undefined;
			}
			for (type in types) {
				_on(elem, type, selector, data, types[type], one);
			}
			return elem;
		}

		if (data == null && fn == null) {

			// ( types, fn )
			fn = selector;
			data = selector = undefined;
		} else if (fn == null) {
			if (typeof selector === "string") {

				// ( types, selector, fn )
				fn = data;
				data = undefined;
			} else {

				// ( types, data, fn )
				fn = data;
				data = selector;
				selector = undefined;
			}
		}
		if (fn === false) {
			fn = returnFalse;
		} else if (!fn) {
			return elem;
		}

		if (one === 1) {
			origFn = fn;
			fn = function fn(event) {

				// Can use an empty set, since event contains the info
				jQuery().off(event);
				return origFn.apply(this, arguments);
			};

			// Use same guid so caller can remove using origFn
			fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
		}
		return elem.each(function () {
			jQuery.event.add(this, types, fn, data, selector);
		});
	}

	/*
  * Helper functions for managing events -- not part of the public interface.
  * Props to Dean Edwards' addEvent library for many of the ideas.
  */
	jQuery.event = {

		global: {},

		add: function add(elem, types, handler, data, selector) {

			var handleObjIn,
			    eventHandle,
			    tmp,
			    events,
			    t,
			    handleObj,
			    special,
			    handlers,
			    type,
			    namespaces,
			    origType,
			    elemData = dataPriv.get(elem);

			// Don't attach events to noData or text/comment nodes (but allow plain objects)
			if (!elemData) {
				return;
			}

			// Caller can pass in an object of custom data in lieu of the handler
			if (handler.handler) {
				handleObjIn = handler;
				handler = handleObjIn.handler;
				selector = handleObjIn.selector;
			}

			// Ensure that invalid selectors throw exceptions at attach time
			// Evaluate against documentElement in case elem is a non-element node (e.g., document)
			if (selector) {
				jQuery.find.matchesSelector(documentElement, selector);
			}

			// Make sure that the handler has a unique ID, used to find/remove it later
			if (!handler.guid) {
				handler.guid = jQuery.guid++;
			}

			// Init the element's event structure and main handler, if this is the first
			if (!(events = elemData.events)) {
				events = elemData.events = {};
			}
			if (!(eventHandle = elemData.handle)) {
				eventHandle = elemData.handle = function (e) {

					// Discard the second event of a jQuery.event.trigger() and
					// when an event is called after a page has unloaded
					return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
				};
			}

			// Handle multiple events separated by a space
			types = (types || "").match(rnothtmlwhite) || [""];
			t = types.length;
			while (t--) {
				tmp = rtypenamespace.exec(types[t]) || [];
				type = origType = tmp[1];
				namespaces = (tmp[2] || "").split(".").sort();

				// There *must* be a type, no attaching namespace-only handlers
				if (!type) {
					continue;
				}

				// If event changes its type, use the special event handlers for the changed type
				special = jQuery.event.special[type] || {};

				// If selector defined, determine special event api type, otherwise given type
				type = (selector ? special.delegateType : special.bindType) || type;

				// Update special based on newly reset type
				special = jQuery.event.special[type] || {};

				// handleObj is passed to all event handlers
				handleObj = jQuery.extend({
					type: type,
					origType: origType,
					data: data,
					handler: handler,
					guid: handler.guid,
					selector: selector,
					needsContext: selector && jQuery.expr.match.needsContext.test(selector),
					namespace: namespaces.join(".")
				}, handleObjIn);

				// Init the event handler queue if we're the first
				if (!(handlers = events[type])) {
					handlers = events[type] = [];
					handlers.delegateCount = 0;

					// Only use addEventListener if the special events handler returns false
					if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {

						if (elem.addEventListener) {
							elem.addEventListener(type, eventHandle);
						}
					}
				}

				if (special.add) {
					special.add.call(elem, handleObj);

					if (!handleObj.handler.guid) {
						handleObj.handler.guid = handler.guid;
					}
				}

				// Add to the element's handler list, delegates in front
				if (selector) {
					handlers.splice(handlers.delegateCount++, 0, handleObj);
				} else {
					handlers.push(handleObj);
				}

				// Keep track of which events have ever been used, for event optimization
				jQuery.event.global[type] = true;
			}
		},

		// Detach an event or set of events from an element
		remove: function remove(elem, types, handler, selector, mappedTypes) {

			var j,
			    origCount,
			    tmp,
			    events,
			    t,
			    handleObj,
			    special,
			    handlers,
			    type,
			    namespaces,
			    origType,
			    elemData = dataPriv.hasData(elem) && dataPriv.get(elem);

			if (!elemData || !(events = elemData.events)) {
				return;
			}

			// Once for each type.namespace in types; type may be omitted
			types = (types || "").match(rnothtmlwhite) || [""];
			t = types.length;
			while (t--) {
				tmp = rtypenamespace.exec(types[t]) || [];
				type = origType = tmp[1];
				namespaces = (tmp[2] || "").split(".").sort();

				// Unbind all events (on this namespace, if provided) for the element
				if (!type) {
					for (type in events) {
						jQuery.event.remove(elem, type + types[t], handler, selector, true);
					}
					continue;
				}

				special = jQuery.event.special[type] || {};
				type = (selector ? special.delegateType : special.bindType) || type;
				handlers = events[type] || [];
				tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");

				// Remove matching events
				origCount = j = handlers.length;
				while (j--) {
					handleObj = handlers[j];

					if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
						handlers.splice(j, 1);

						if (handleObj.selector) {
							handlers.delegateCount--;
						}
						if (special.remove) {
							special.remove.call(elem, handleObj);
						}
					}
				}

				// Remove generic event handler if we removed something and no more handlers exist
				// (avoids potential for endless recursion during removal of special event handlers)
				if (origCount && !handlers.length) {
					if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {

						jQuery.removeEvent(elem, type, elemData.handle);
					}

					delete events[type];
				}
			}

			// Remove data and the expando if it's no longer used
			if (jQuery.isEmptyObject(events)) {
				dataPriv.remove(elem, "handle events");
			}
		},

		dispatch: function dispatch(nativeEvent) {

			// Make a writable jQuery.Event from the native event object
			var event = jQuery.event.fix(nativeEvent);

			var i,
			    j,
			    ret,
			    matched,
			    handleObj,
			    handlerQueue,
			    args = new Array(arguments.length),
			    handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
			    special = jQuery.event.special[event.type] || {};

			// Use the fix-ed jQuery.Event rather than the (read-only) native event
			args[0] = event;

			for (i = 1; i < arguments.length; i++) {
				args[i] = arguments[i];
			}

			event.delegateTarget = this;

			// Call the preDispatch hook for the mapped type, and let it bail if desired
			if (special.preDispatch && special.preDispatch.call(this, event) === false) {
				return;
			}

			// Determine handlers
			handlerQueue = jQuery.event.handlers.call(this, event, handlers);

			// Run delegates first; they may want to stop propagation beneath us
			i = 0;
			while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
				event.currentTarget = matched.elem;

				j = 0;
				while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {

					// Triggered event must either 1) have no namespace, or 2) have namespace(s)
					// a subset or equal to those in the bound event (both can have no namespace).
					if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {

						event.handleObj = handleObj;
						event.data = handleObj.data;

						ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);

						if (ret !== undefined) {
							if ((event.result = ret) === false) {
								event.preventDefault();
								event.stopPropagation();
							}
						}
					}
				}
			}

			// Call the postDispatch hook for the mapped type
			if (special.postDispatch) {
				special.postDispatch.call(this, event);
			}

			return event.result;
		},

		handlers: function handlers(event, _handlers) {
			var i,
			    handleObj,
			    sel,
			    matchedHandlers,
			    matchedSelectors,
			    handlerQueue = [],
			    delegateCount = _handlers.delegateCount,
			    cur = event.target;

			// Find delegate handlers
			if (delegateCount &&

			// Support: IE <=9
			// Black-hole SVG <use> instance trees (trac-13180)
			cur.nodeType &&

			// Support: Firefox <=42
			// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
			// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
			// Support: IE 11 only
			// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
			!(event.type === "click" && event.button >= 1)) {

				for (; cur !== this; cur = cur.parentNode || this) {

					// Don't check non-elements (#13208)
					// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
					if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
						matchedHandlers = [];
						matchedSelectors = {};
						for (i = 0; i < delegateCount; i++) {
							handleObj = _handlers[i];

							// Don't conflict with Object.prototype properties (#13203)
							sel = handleObj.selector + " ";

							if (matchedSelectors[sel] === undefined) {
								matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
							}
							if (matchedSelectors[sel]) {
								matchedHandlers.push(handleObj);
							}
						}
						if (matchedHandlers.length) {
							handlerQueue.push({ elem: cur, handlers: matchedHandlers });
						}
					}
				}
			}

			// Add the remaining (directly-bound) handlers
			cur = this;
			if (delegateCount < _handlers.length) {
				handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) });
			}

			return handlerQueue;
		},

		addProp: function addProp(name, hook) {
			Object.defineProperty(jQuery.Event.prototype, name, {
				enumerable: true,
				configurable: true,

				get: isFunction(hook) ? function () {
					if (this.originalEvent) {
						return hook(this.originalEvent);
					}
				} : function () {
					if (this.originalEvent) {
						return this.originalEvent[name];
					}
				},

				set: function set(value) {
					Object.defineProperty(this, name, {
						enumerable: true,
						configurable: true,
						writable: true,
						value: value
					});
				}
			});
		},

		fix: function fix(originalEvent) {
			return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
		},

		special: {
			load: {

				// Prevent triggered image.load events from bubbling to window.load
				noBubble: true
			},
			focus: {

				// Fire native event if possible so blur/focus sequence is correct
				trigger: function trigger() {
					if (this !== safeActiveElement() && this.focus) {
						this.focus();
						return false;
					}
				},
				delegateType: "focusin"
			},
			blur: {
				trigger: function trigger() {
					if (this === safeActiveElement() && this.blur) {
						this.blur();
						return false;
					}
				},
				delegateType: "focusout"
			},
			click: {

				// For checkbox, fire native event so checked state will be right
				trigger: function trigger() {
					if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
						this.click();
						return false;
					}
				},

				// For cross-browser consistency, don't fire native .click() on links
				_default: function _default(event) {
					return nodeName(event.target, "a");
				}
			},

			beforeunload: {
				postDispatch: function postDispatch(event) {

					// Support: Firefox 20+
					// Firefox doesn't alert if the returnValue field is not set.
					if (event.result !== undefined && event.originalEvent) {
						event.originalEvent.returnValue = event.result;
					}
				}
			}
		}
	};

	jQuery.removeEvent = function (elem, type, handle) {

		// This "if" is needed for plain objects
		if (elem.removeEventListener) {
			elem.removeEventListener(type, handle);
		}
	};

	jQuery.Event = function (src, props) {

		// Allow instantiation without the 'new' keyword
		if (!(this instanceof jQuery.Event)) {
			return new jQuery.Event(src, props);
		}

		// Event object
		if (src && src.type) {
			this.originalEvent = src;
			this.type = src.type;

			// Events bubbling up the document may have been marked as prevented
			// by a handler lower down the tree; reflect the correct value.
			this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&

			// Support: Android <=2.3 only
			src.returnValue === false ? returnTrue : returnFalse;

			// Create target properties
			// Support: Safari <=6 - 7 only
			// Target should not be a text node (#504, #13143)
			this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;

			this.currentTarget = src.currentTarget;
			this.relatedTarget = src.relatedTarget;

			// Event type
		} else {
			this.type = src;
		}

		// Put explicitly provided properties onto the event object
		if (props) {
			jQuery.extend(this, props);
		}

		// Create a timestamp if incoming event doesn't have one
		this.timeStamp = src && src.timeStamp || Date.now();

		// Mark it as fixed
		this[jQuery.expando] = true;
	};

	// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
	// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
	jQuery.Event.prototype = {
		constructor: jQuery.Event,
		isDefaultPrevented: returnFalse,
		isPropagationStopped: returnFalse,
		isImmediatePropagationStopped: returnFalse,
		isSimulated: false,

		preventDefault: function preventDefault() {
			var e = this.originalEvent;

			this.isDefaultPrevented = returnTrue;

			if (e && !this.isSimulated) {
				e.preventDefault();
			}
		},
		stopPropagation: function stopPropagation() {
			var e = this.originalEvent;

			this.isPropagationStopped = returnTrue;

			if (e && !this.isSimulated) {
				e.stopPropagation();
			}
		},
		stopImmediatePropagation: function stopImmediatePropagation() {
			var e = this.originalEvent;

			this.isImmediatePropagationStopped = returnTrue;

			if (e && !this.isSimulated) {
				e.stopImmediatePropagation();
			}

			this.stopPropagation();
		}
	};

	// Includes all common event props including KeyEvent and MouseEvent specific props
	jQuery.each({
		altKey: true,
		bubbles: true,
		cancelable: true,
		changedTouches: true,
		ctrlKey: true,
		detail: true,
		eventPhase: true,
		metaKey: true,
		pageX: true,
		pageY: true,
		shiftKey: true,
		view: true,
		"char": true,
		charCode: true,
		key: true,
		keyCode: true,
		button: true,
		buttons: true,
		clientX: true,
		clientY: true,
		offsetX: true,
		offsetY: true,
		pointerId: true,
		pointerType: true,
		screenX: true,
		screenY: true,
		targetTouches: true,
		toElement: true,
		touches: true,

		which: function which(event) {
			var button = event.button;

			// Add which for key events
			if (event.which == null && rkeyEvent.test(event.type)) {
				return event.charCode != null ? event.charCode : event.keyCode;
			}

			// Add which for click: 1 === left; 2 === middle; 3 === right
			if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
				if (button & 1) {
					return 1;
				}

				if (button & 2) {
					return 3;
				}

				if (button & 4) {
					return 2;
				}

				return 0;
			}

			return event.which;
		}
	}, jQuery.event.addProp);

	// Create mouseenter/leave events using mouseover/out and event-time checks
	// so that event delegation works in jQuery.
	// Do the same for pointerenter/pointerleave and pointerover/pointerout
	//
	// Support: Safari 7 only
	// Safari sends mouseenter too often; see:
	// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
	// for the description of the bug (it existed in older Chrome versions as well).
	jQuery.each({
		mouseenter: "mouseover",
		mouseleave: "mouseout",
		pointerenter: "pointerover",
		pointerleave: "pointerout"
	}, function (orig, fix) {
		jQuery.event.special[orig] = {
			delegateType: fix,
			bindType: fix,

			handle: function handle(event) {
				var ret,
				    target = this,
				    related = event.relatedTarget,
				    handleObj = event.handleObj;

				// For mouseenter/leave call the handler if related is outside the target.
				// NB: No relatedTarget if the mouse left/entered the browser window
				if (!related || related !== target && !jQuery.contains(target, related)) {
					event.type = handleObj.origType;
					ret = handleObj.handler.apply(this, arguments);
					event.type = fix;
				}
				return ret;
			}
		};
	});

	jQuery.fn.extend({

		on: function on(types, selector, data, fn) {
			return _on(this, types, selector, data, fn);
		},
		one: function one(types, selector, data, fn) {
			return _on(this, types, selector, data, fn, 1);
		},
		off: function off(types, selector, fn) {
			var handleObj, type;
			if (types && types.preventDefault && types.handleObj) {

				// ( event )  dispatched jQuery.Event
				handleObj = types.handleObj;
				jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
				return this;
			}
			if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {

				// ( types-object [, selector] )
				for (type in types) {
					this.off(type, selector, types[type]);
				}
				return this;
			}
			if (selector === false || typeof selector === "function") {

				// ( types [, fn] )
				fn = selector;
				selector = undefined;
			}
			if (fn === false) {
				fn = returnFalse;
			}
			return this.each(function () {
				jQuery.event.remove(this, types, fn, selector);
			});
		}
	});

	var

	/* eslint-disable max-len */

	// See https://github.com/eslint/eslint/issues/3229
	rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,


	/* eslint-enable */

	// Support: IE <=10 - 11, Edge 12 - 13 only
	// In IE/Edge using regex groups here causes severe slowdowns.
	// See https://connect.microsoft.com/IE/feedback/details/1736512/
	rnoInnerhtml = /<script|<style|<link/i,


	// checked="checked" or checked
	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
	    rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;

	// Prefer a tbody over its parent table for containing new rows
	function manipulationTarget(elem, content) {
		if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {

			return jQuery(elem).children("tbody")[0] || elem;
		}

		return elem;
	}

	// Replace/restore the type attribute of script elements for safe DOM manipulation
	function disableScript(elem) {
		elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
		return elem;
	}
	function restoreScript(elem) {
		if ((elem.type || "").slice(0, 5) === "true/") {
			elem.type = elem.type.slice(5);
		} else {
			elem.removeAttribute("type");
		}

		return elem;
	}

	function cloneCopyEvent(src, dest) {
		var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;

		if (dest.nodeType !== 1) {
			return;
		}

		// 1. Copy private data: events, handlers, etc.
		if (dataPriv.hasData(src)) {
			pdataOld = dataPriv.access(src);
			pdataCur = dataPriv.set(dest, pdataOld);
			events = pdataOld.events;

			if (events) {
				delete pdataCur.handle;
				pdataCur.events = {};

				for (type in events) {
					for (i = 0, l = events[type].length; i < l; i++) {
						jQuery.event.add(dest, type, events[type][i]);
					}
				}
			}
		}

		// 2. Copy user data
		if (dataUser.hasData(src)) {
			udataOld = dataUser.access(src);
			udataCur = jQuery.extend({}, udataOld);

			dataUser.set(dest, udataCur);
		}
	}

	// Fix IE bugs, see support tests
	function fixInput(src, dest) {
		var nodeName = dest.nodeName.toLowerCase();

		// Fails to persist the checked state of a cloned checkbox or radio button.
		if (nodeName === "input" && rcheckableType.test(src.type)) {
			dest.checked = src.checked;

			// Fails to return the selected option to the default selected state when cloning options
		} else if (nodeName === "input" || nodeName === "textarea") {
			dest.defaultValue = src.defaultValue;
		}
	}

	function domManip(collection, args, callback, ignored) {

		// Flatten any nested arrays
		args = concat.apply([], args);

		var fragment,
		    first,
		    scripts,
		    hasScripts,
		    node,
		    doc,
		    i = 0,
		    l = collection.length,
		    iNoClone = l - 1,
		    value = args[0],
		    valueIsFunction = isFunction(value);

		// We can't cloneNode fragments that contain checked, in WebKit
		if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
			return collection.each(function (index) {
				var self = collection.eq(index);
				if (valueIsFunction) {
					args[0] = value.call(this, index, self.html());
				}
				domManip(self, args, callback, ignored);
			});
		}

		if (l) {
			fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
			first = fragment.firstChild;

			if (fragment.childNodes.length === 1) {
				fragment = first;
			}

			// Require either new content or an interest in ignored elements to invoke the callback
			if (first || ignored) {
				scripts = jQuery.map(getAll(fragment, "script"), disableScript);
				hasScripts = scripts.length;

				// Use the original fragment for the last item
				// instead of the first because it can end up
				// being emptied incorrectly in certain situations (#8070).
				for (; i < l; i++) {
					node = fragment;

					if (i !== iNoClone) {
						node = jQuery.clone(node, true, true);

						// Keep references to cloned scripts for later restoration
						if (hasScripts) {

							// Support: Android <=4.0 only, PhantomJS 1 only
							// push.apply(_, arraylike) throws on ancient WebKit
							jQuery.merge(scripts, getAll(node, "script"));
						}
					}

					callback.call(collection[i], node, i);
				}

				if (hasScripts) {
					doc = scripts[scripts.length - 1].ownerDocument;

					// Reenable scripts
					jQuery.map(scripts, restoreScript);

					// Evaluate executable scripts on first document insertion
					for (i = 0; i < hasScripts; i++) {
						node = scripts[i];
						if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {

							if (node.src && (node.type || "").toLowerCase() !== "module") {

								// Optional AJAX dependency, but won't run scripts if not present
								if (jQuery._evalUrl) {
									jQuery._evalUrl(node.src);
								}
							} else {
								DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
							}
						}
					}
				}
			}
		}

		return collection;
	}

	function _remove(elem, selector, keepData) {
		var node,
		    nodes = selector ? jQuery.filter(selector, elem) : elem,
		    i = 0;

		for (; (node = nodes[i]) != null; i++) {
			if (!keepData && node.nodeType === 1) {
				jQuery.cleanData(getAll(node));
			}

			if (node.parentNode) {
				if (keepData && jQuery.contains(node.ownerDocument, node)) {
					setGlobalEval(getAll(node, "script"));
				}
				node.parentNode.removeChild(node);
			}
		}

		return elem;
	}

	jQuery.extend({
		htmlPrefilter: function htmlPrefilter(html) {
			return html.replace(rxhtmlTag, "<$1></$2>");
		},

		clone: function clone(elem, dataAndEvents, deepDataAndEvents) {
			var i,
			    l,
			    srcElements,
			    destElements,
			    clone = elem.cloneNode(true),
			    inPage = jQuery.contains(elem.ownerDocument, elem);

			// Fix IE cloning issues
			if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {

				// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
				destElements = getAll(clone);
				srcElements = getAll(elem);

				for (i = 0, l = srcElements.length; i < l; i++) {
					fixInput(srcElements[i], destElements[i]);
				}
			}

			// Copy the events from the original to the clone
			if (dataAndEvents) {
				if (deepDataAndEvents) {
					srcElements = srcElements || getAll(elem);
					destElements = destElements || getAll(clone);

					for (i = 0, l = srcElements.length; i < l; i++) {
						cloneCopyEvent(srcElements[i], destElements[i]);
					}
				} else {
					cloneCopyEvent(elem, clone);
				}
			}

			// Preserve script evaluation history
			destElements = getAll(clone, "script");
			if (destElements.length > 0) {
				setGlobalEval(destElements, !inPage && getAll(elem, "script"));
			}

			// Return the cloned set
			return clone;
		},

		cleanData: function cleanData(elems) {
			var data,
			    elem,
			    type,
			    special = jQuery.event.special,
			    i = 0;

			for (; (elem = elems[i]) !== undefined; i++) {
				if (acceptData(elem)) {
					if (data = elem[dataPriv.expando]) {
						if (data.events) {
							for (type in data.events) {
								if (special[type]) {
									jQuery.event.remove(elem, type);

									// This is a shortcut to avoid jQuery.event.remove's overhead
								} else {
									jQuery.removeEvent(elem, type, data.handle);
								}
							}
						}

						// Support: Chrome <=35 - 45+
						// Assign undefined instead of using delete, see Data#remove
						elem[dataPriv.expando] = undefined;
					}
					if (elem[dataUser.expando]) {

						// Support: Chrome <=35 - 45+
						// Assign undefined instead of using delete, see Data#remove
						elem[dataUser.expando] = undefined;
					}
				}
			}
		}
	});

	jQuery.fn.extend({
		detach: function detach(selector) {
			return _remove(this, selector, true);
		},

		remove: function remove(selector) {
			return _remove(this, selector);
		},

		text: function text(value) {
			return access(this, function (value) {
				return value === undefined ? jQuery.text(this) : this.empty().each(function () {
					if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
						this.textContent = value;
					}
				});
			}, null, value, arguments.length);
		},

		append: function append() {
			return domManip(this, arguments, function (elem) {
				if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
					var target = manipulationTarget(this, elem);
					target.appendChild(elem);
				}
			});
		},

		prepend: function prepend() {
			return domManip(this, arguments, function (elem) {
				if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
					var target = manipulationTarget(this, elem);
					target.insertBefore(elem, target.firstChild);
				}
			});
		},

		before: function before() {
			return domManip(this, arguments, function (elem) {
				if (this.parentNode) {
					this.parentNode.insertBefore(elem, this);
				}
			});
		},

		after: function after() {
			return domManip(this, arguments, function (elem) {
				if (this.parentNode) {
					this.parentNode.insertBefore(elem, this.nextSibling);
				}
			});
		},

		empty: function empty() {
			var elem,
			    i = 0;

			for (; (elem = this[i]) != null; i++) {
				if (elem.nodeType === 1) {

					// Prevent memory leaks
					jQuery.cleanData(getAll(elem, false));

					// Remove any remaining nodes
					elem.textContent = "";
				}
			}

			return this;
		},

		clone: function clone(dataAndEvents, deepDataAndEvents) {
			dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
			deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;

			return this.map(function () {
				return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
			});
		},

		html: function html(value) {
			return access(this, function (value) {
				var elem = this[0] || {},
				    i = 0,
				    l = this.length;

				if (value === undefined && elem.nodeType === 1) {
					return elem.innerHTML;
				}

				// See if we can take a shortcut and just use innerHTML
				if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {

					value = jQuery.htmlPrefilter(value);

					try {
						for (; i < l; i++) {
							elem = this[i] || {};

							// Remove element nodes and prevent memory leaks
							if (elem.nodeType === 1) {
								jQuery.cleanData(getAll(elem, false));
								elem.innerHTML = value;
							}
						}

						elem = 0;

						// If using innerHTML throws an exception, use the fallback method
					} catch (e) {}
				}

				if (elem) {
					this.empty().append(value);
				}
			}, null, value, arguments.length);
		},

		replaceWith: function replaceWith() {
			var ignored = [];

			// Make the changes, replacing each non-ignored context element with the new content
			return domManip(this, arguments, function (elem) {
				var parent = this.parentNode;

				if (jQuery.inArray(this, ignored) < 0) {
					jQuery.cleanData(getAll(this));
					if (parent) {
						parent.replaceChild(elem, this);
					}
				}

				// Force callback invocation
			}, ignored);
		}
	});

	jQuery.each({
		appendTo: "append",
		prependTo: "prepend",
		insertBefore: "before",
		insertAfter: "after",
		replaceAll: "replaceWith"
	}, function (name, original) {
		jQuery.fn[name] = function (selector) {
			var elems,
			    ret = [],
			    insert = jQuery(selector),
			    last = insert.length - 1,
			    i = 0;

			for (; i <= last; i++) {
				elems = i === last ? this : this.clone(true);
				jQuery(insert[i])[original](elems);

				// Support: Android <=4.0 only, PhantomJS 1 only
				// .get() because push.apply(_, arraylike) throws on ancient WebKit
				push.apply(ret, elems.get());
			}

			return this.pushStack(ret);
		};
	});
	var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");

	var getStyles = function getStyles(elem) {

		// Support: IE <=11 only, Firefox <=30 (#15098, #14150)
		// IE throws on elements created in popups
		// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
		var view = elem.ownerDocument.defaultView;

		if (!view || !view.opener) {
			view = window;
		}

		return view.getComputedStyle(elem);
	};

	var rboxStyle = new RegExp(cssExpand.join("|"), "i");

	(function () {

		// Executing both pixelPosition & boxSizingReliable tests require only one layout
		// so they're executed at the same time to save the second computation.
		function computeStyleTests() {

			// This is a singleton, we need to execute it only once
			if (!div) {
				return;
			}

			container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
			div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
			documentElement.appendChild(container).appendChild(div);

			var divStyle = window.getComputedStyle(div);
			pixelPositionVal = divStyle.top !== "1%";

			// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
			reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;

			// Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
			// Some styles come back with percentage values, even though they shouldn't
			div.style.right = "60%";
			pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;

			// Support: IE 9 - 11 only
			// Detect misreporting of content dimensions for box-sizing:border-box elements
			boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;

			// Support: IE 9 only
			// Detect overflow:scroll screwiness (gh-3699)
			div.style.position = "absolute";
			scrollboxSizeVal = div.offsetWidth === 36 || "absolute";

			documentElement.removeChild(container);

			// Nullify the div so it wouldn't be stored in the memory and
			// it will also be a sign that checks already performed
			div = null;
		}

		function roundPixelMeasures(measure) {
			return Math.round(parseFloat(measure));
		}

		var pixelPositionVal,
		    boxSizingReliableVal,
		    scrollboxSizeVal,
		    pixelBoxStylesVal,
		    reliableMarginLeftVal,
		    container = document.createElement("div"),
		    div = document.createElement("div");

		// Finish early in limited (non-browser) environments
		if (!div.style) {
			return;
		}

		// Support: IE <=9 - 11 only
		// Style of cloned element affects source element cloned (#8908)
		div.style.backgroundClip = "content-box";
		div.cloneNode(true).style.backgroundClip = "";
		support.clearCloneStyle = div.style.backgroundClip === "content-box";

		jQuery.extend(support, {
			boxSizingReliable: function boxSizingReliable() {
				computeStyleTests();
				return boxSizingReliableVal;
			},
			pixelBoxStyles: function pixelBoxStyles() {
				computeStyleTests();
				return pixelBoxStylesVal;
			},
			pixelPosition: function pixelPosition() {
				computeStyleTests();
				return pixelPositionVal;
			},
			reliableMarginLeft: function reliableMarginLeft() {
				computeStyleTests();
				return reliableMarginLeftVal;
			},
			scrollboxSize: function scrollboxSize() {
				computeStyleTests();
				return scrollboxSizeVal;
			}
		});
	})();

	function curCSS(elem, name, computed) {
		var width,
		    minWidth,
		    maxWidth,
		    ret,


		// Support: Firefox 51+
		// Retrieving style before computed somehow
		// fixes an issue with getting wrong values
		// on detached elements
		style = elem.style;

		computed = computed || getStyles(elem);

		// getPropertyValue is needed for:
		//   .css('filter') (IE 9 only, #12537)
		//   .css('--customProperty) (#3144)
		if (computed) {
			ret = computed.getPropertyValue(name) || computed[name];

			if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
				ret = jQuery.style(elem, name);
			}

			// A tribute to the "awesome hack by Dean Edwards"
			// Android Browser returns percentage for some values,
			// but width seems to be reliably pixels.
			// This is against the CSSOM draft spec:
			// https://drafts.csswg.org/cssom/#resolved-values
			if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {

				// Remember the original values
				width = style.width;
				minWidth = style.minWidth;
				maxWidth = style.maxWidth;

				// Put in the new values to get a computed value out
				style.minWidth = style.maxWidth = style.width = ret;
				ret = computed.width;

				// Revert the changed values
				style.width = width;
				style.minWidth = minWidth;
				style.maxWidth = maxWidth;
			}
		}

		return ret !== undefined ?

		// Support: IE <=9 - 11 only
		// IE returns zIndex value as an integer.
		ret + "" : ret;
	}

	function addGetHookIf(conditionFn, hookFn) {

		// Define the hook, we'll check on the first run if it's really needed.
		return {
			get: function get() {
				if (conditionFn()) {

					// Hook not needed (or it's not possible to use it due
					// to missing dependency), remove it.
					delete this.get;
					return;
				}

				// Hook needed; redefine it so that the support test is not executed again.
				return (this.get = hookFn).apply(this, arguments);
			}
		};
	}

	var

	// Swappable if display is none or starts with table
	// except "table", "table-cell", or "table-caption"
	// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
	rdisplayswap = /^(none|table(?!-c[ea]).+)/,
	    rcustomProp = /^--/,
	    cssShow = { position: "absolute", visibility: "hidden", display: "block" },
	    cssNormalTransform = {
		letterSpacing: "0",
		fontWeight: "400"
	},
	    cssPrefixes = ["Webkit", "Moz", "ms"],
	    emptyStyle = document.createElement("div").style;

	// Return a css property mapped to a potentially vendor prefixed property
	function vendorPropName(name) {

		// Shortcut for names that are not vendor prefixed
		if (name in emptyStyle) {
			return name;
		}

		// Check for vendor prefixed names
		var capName = name[0].toUpperCase() + name.slice(1),
		    i = cssPrefixes.length;

		while (i--) {
			name = cssPrefixes[i] + capName;
			if (name in emptyStyle) {
				return name;
			}
		}
	}

	// Return a property mapped along what jQuery.cssProps suggests or to
	// a vendor prefixed property.
	function finalPropName(name) {
		var ret = jQuery.cssProps[name];
		if (!ret) {
			ret = jQuery.cssProps[name] = vendorPropName(name) || name;
		}
		return ret;
	}

	function setPositiveNumber(elem, value, subtract) {

		// Any relative (+/-) values have already been
		// normalized at this point
		var matches = rcssNum.exec(value);
		return matches ?

		// Guard against undefined "subtract", e.g., when used as in cssHooks
		Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
	}

	function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
		var i = dimension === "width" ? 1 : 0,
		    extra = 0,
		    delta = 0;

		// Adjustment may not be necessary
		if (box === (isBorderBox ? "border" : "content")) {
			return 0;
		}

		for (; i < 4; i += 2) {

			// Both box models exclude margin
			if (box === "margin") {
				delta += jQuery.css(elem, box + cssExpand[i], true, styles);
			}

			// If we get here with a content-box, we're seeking "padding" or "border" or "margin"
			if (!isBorderBox) {

				// Add padding
				delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);

				// For "border" or "margin", add border
				if (box !== "padding") {
					delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);

					// But still keep track of it otherwise
				} else {
					extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
				}

				// If we get here with a border-box (content + padding + border), we're seeking "content" or
				// "padding" or "margin"
			} else {

				// For "content", subtract padding
				if (box === "content") {
					delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
				}

				// For "content" or "padding", subtract border
				if (box !== "margin") {
					delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
				}
			}
		}

		// Account for positive content-box scroll gutter when requested by providing computedVal
		if (!isBorderBox && computedVal >= 0) {

			// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
			// Assuming integer scroll gutter, subtract the rest and round down
			delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5));
		}

		return delta;
	}

	function getWidthOrHeight(elem, dimension, extra) {

		// Start with computed style
		var styles = getStyles(elem),
		    val = curCSS(elem, dimension, styles),
		    isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
		    valueIsBorderBox = isBorderBox;

		// Support: Firefox <=54
		// Return a confounding non-pixel value or feign ignorance, as appropriate.
		if (rnumnonpx.test(val)) {
			if (!extra) {
				return val;
			}
			val = "auto";
		}

		// Check for style in case a browser which returns unreliable values
		// for getComputedStyle silently falls back to the reliable elem.style
		valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]);

		// Fall back to offsetWidth/offsetHeight when value is "auto"
		// This happens for inline elements with no explicit setting (gh-3571)
		// Support: Android <=4.1 - 4.3 only
		// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
		if (val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {

			val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];

			// offsetWidth/offsetHeight provide border-box values
			valueIsBorderBox = true;
		}

		// Normalize "" and auto
		val = parseFloat(val) || 0;

		// Adjust for the element's box model
		return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,

		// Provide the current computed size to request scroll gutter calculation (gh-3589)
		val) + "px";
	}

	jQuery.extend({

		// Add in style property hooks for overriding the default
		// behavior of getting and setting a style property
		cssHooks: {
			opacity: {
				get: function get(elem, computed) {
					if (computed) {

						// We should always get a number back from opacity
						var ret = curCSS(elem, "opacity");
						return ret === "" ? "1" : ret;
					}
				}
			}
		},

		// Don't automatically add "px" to these possibly-unitless properties
		cssNumber: {
			"animationIterationCount": true,
			"columnCount": true,
			"fillOpacity": true,
			"flexGrow": true,
			"flexShrink": true,
			"fontWeight": true,
			"lineHeight": true,
			"opacity": true,
			"order": true,
			"orphans": true,
			"widows": true,
			"zIndex": true,
			"zoom": true
		},

		// Add in properties whose names you wish to fix before
		// setting or getting the value
		cssProps: {},

		// Get and set the style property on a DOM Node
		style: function style(elem, name, value, extra) {

			// Don't set styles on text and comment nodes
			if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
				return;
			}

			// Make sure that we're working with the right name
			var ret,
			    type,
			    hooks,
			    origName = camelCase(name),
			    isCustomProp = rcustomProp.test(name),
			    style = elem.style;

			// Make sure that we're working with the right name. We don't
			// want to query the value if it is a CSS custom property
			// since they are user-defined.
			if (!isCustomProp) {
				name = finalPropName(origName);
			}

			// Gets hook for the prefixed version, then unprefixed version
			hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];

			// Check if we're setting a value
			if (value !== undefined) {
				type = typeof value === "undefined" ? "undefined" : _typeof(value);

				// Convert "+=" or "-=" to relative numbers (#7345)
				if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
					value = adjustCSS(elem, name, ret);

					// Fixes bug #9237
					type = "number";
				}

				// Make sure that null and NaN values aren't set (#7116)
				if (value == null || value !== value) {
					return;
				}

				// If a number was passed in, add the unit (except for certain CSS properties)
				if (type === "number") {
					value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
				}

				// background-* props affect original clone's values
				if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
					style[name] = "inherit";
				}

				// If a hook was provided, use that value, otherwise just set the specified value
				if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {

					if (isCustomProp) {
						style.setProperty(name, value);
					} else {
						style[name] = value;
					}
				}
			} else {

				// If a hook was provided get the non-computed value from there
				if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {

					return ret;
				}

				// Otherwise just get the value from the style object
				return style[name];
			}
		},

		css: function css(elem, name, extra, styles) {
			var val,
			    num,
			    hooks,
			    origName = camelCase(name),
			    isCustomProp = rcustomProp.test(name);

			// Make sure that we're working with the right name. We don't
			// want to modify the value if it is a CSS custom property
			// since they are user-defined.
			if (!isCustomProp) {
				name = finalPropName(origName);
			}

			// Try prefixed name followed by the unprefixed name
			hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];

			// If a hook was provided get the computed value from there
			if (hooks && "get" in hooks) {
				val = hooks.get(elem, true, extra);
			}

			// Otherwise, if a way to get the computed value exists, use that
			if (val === undefined) {
				val = curCSS(elem, name, styles);
			}

			// Convert "normal" to computed value
			if (val === "normal" && name in cssNormalTransform) {
				val = cssNormalTransform[name];
			}

			// Make numeric if forced or a qualifier was provided and val looks numeric
			if (extra === "" || extra) {
				num = parseFloat(val);
				return extra === true || isFinite(num) ? num || 0 : val;
			}

			return val;
		}
	});

	jQuery.each(["height", "width"], function (i, dimension) {
		jQuery.cssHooks[dimension] = {
			get: function get(elem, computed, extra) {
				if (computed) {

					// Certain elements can have dimension info if we invisibly show them
					// but it must have a current display style that would benefit
					return rdisplayswap.test(jQuery.css(elem, "display")) && (

					// Support: Safari 8+
					// Table columns in Safari have non-zero offsetWidth & zero
					// getBoundingClientRect().width unless display is changed.
					// Support: IE <=11 only
					// Running getBoundingClientRect on a disconnected node
					// in IE throws an error.
					!elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
						return getWidthOrHeight(elem, dimension, extra);
					}) : getWidthOrHeight(elem, dimension, extra);
				}
			},

			set: function set(elem, value, extra) {
				var matches,
				    styles = getStyles(elem),
				    isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
				    subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);

				// Account for unreliable border-box dimensions by comparing offset* to computed and
				// faking a content-box to get border and padding (gh-3699)
				if (isBorderBox && support.scrollboxSize() === styles.position) {
					subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
				}

				// Convert to pixels if value adjustment is needed
				if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {

					elem.style[dimension] = value;
					value = jQuery.css(elem, dimension);
				}

				return setPositiveNumber(elem, value, subtract);
			}
		};
	});

	jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
		if (computed) {
			return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
				return elem.getBoundingClientRect().left;
			})) + "px";
		}
	});

	// These hooks are used by animate to expand properties
	jQuery.each({
		margin: "",
		padding: "",
		border: "Width"
	}, function (prefix, suffix) {
		jQuery.cssHooks[prefix + suffix] = {
			expand: function expand(value) {
				var i = 0,
				    expanded = {},


				// Assumes a single number if not a string
				parts = typeof value === "string" ? value.split(" ") : [value];

				for (; i < 4; i++) {
					expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
				}

				return expanded;
			}
		};

		if (prefix !== "margin") {
			jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
		}
	});

	jQuery.fn.extend({
		css: function css(name, value) {
			return access(this, function (elem, name, value) {
				var styles,
				    len,
				    map = {},
				    i = 0;

				if (Array.isArray(name)) {
					styles = getStyles(elem);
					len = name.length;

					for (; i < len; i++) {
						map[name[i]] = jQuery.css(elem, name[i], false, styles);
					}

					return map;
				}

				return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
			}, name, value, arguments.length > 1);
		}
	});

	function Tween(elem, options, prop, end, easing) {
		return new Tween.prototype.init(elem, options, prop, end, easing);
	}
	jQuery.Tween = Tween;

	Tween.prototype = {
		constructor: Tween,
		init: function init(elem, options, prop, end, easing, unit) {
			this.elem = elem;
			this.prop = prop;
			this.easing = easing || jQuery.easing._default;
			this.options = options;
			this.start = this.now = this.cur();
			this.end = end;
			this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
		},
		cur: function cur() {
			var hooks = Tween.propHooks[this.prop];

			return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
		},
		run: function run(percent) {
			var eased,
			    hooks = Tween.propHooks[this.prop];

			if (this.options.duration) {
				this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
			} else {
				this.pos = eased = percent;
			}
			this.now = (this.end - this.start) * eased + this.start;

			if (this.options.step) {
				this.options.step.call(this.elem, this.now, this);
			}

			if (hooks && hooks.set) {
				hooks.set(this);
			} else {
				Tween.propHooks._default.set(this);
			}
			return this;
		}
	};

	Tween.prototype.init.prototype = Tween.prototype;

	Tween.propHooks = {
		_default: {
			get: function get(tween) {
				var result;

				// Use a property on the element directly when it is not a DOM element,
				// or when there is no matching style property that exists.
				if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
					return tween.elem[tween.prop];
				}

				// Passing an empty string as a 3rd parameter to .css will automatically
				// attempt a parseFloat and fallback to a string if the parse fails.
				// Simple values such as "10px" are parsed to Float;
				// complex values such as "rotate(1rad)" are returned as-is.
				result = jQuery.css(tween.elem, tween.prop, "");

				// Empty strings, null, undefined and "auto" are converted to 0.
				return !result || result === "auto" ? 0 : result;
			},
			set: function set(tween) {

				// Use step hook for back compat.
				// Use cssHook if its there.
				// Use .style if available and use plain properties where available.
				if (jQuery.fx.step[tween.prop]) {
					jQuery.fx.step[tween.prop](tween);
				} else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
					jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
				} else {
					tween.elem[tween.prop] = tween.now;
				}
			}
		}
	};

	// Support: IE <=9 only
	// Panic based approach to setting things on disconnected nodes
	Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
		set: function set(tween) {
			if (tween.elem.nodeType && tween.elem.parentNode) {
				tween.elem[tween.prop] = tween.now;
			}
		}
	};

	jQuery.easing = {
		linear: function linear(p) {
			return p;
		},
		swing: function swing(p) {
			return 0.5 - Math.cos(p * Math.PI) / 2;
		},
		_default: "swing"
	};

	jQuery.fx = Tween.prototype.init;

	// Back compat <1.8 extension point
	jQuery.fx.step = {};

	var fxNow,
	    inProgress,
	    rfxtypes = /^(?:toggle|show|hide)$/,
	    rrun = /queueHooks$/;

	function schedule() {
		if (inProgress) {
			if (document.hidden === false && window.requestAnimationFrame) {
				window.requestAnimationFrame(schedule);
			} else {
				window.setTimeout(schedule, jQuery.fx.interval);
			}

			jQuery.fx.tick();
		}
	}

	// Animations created synchronously will run synchronously
	function createFxNow() {
		window.setTimeout(function () {
			fxNow = undefined;
		});
		return fxNow = Date.now();
	}

	// Generate parameters to create a standard animation
	function genFx(type, includeWidth) {
		var which,
		    i = 0,
		    attrs = { height: type };

		// If we include width, step value is 1 to do all cssExpand values,
		// otherwise step value is 2 to skip over Left and Right
		includeWidth = includeWidth ? 1 : 0;
		for (; i < 4; i += 2 - includeWidth) {
			which = cssExpand[i];
			attrs["margin" + which] = attrs["padding" + which] = type;
		}

		if (includeWidth) {
			attrs.opacity = attrs.width = type;
		}

		return attrs;
	}

	function createTween(value, prop, animation) {
		var tween,
		    collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
		    index = 0,
		    length = collection.length;
		for (; index < length; index++) {
			if (tween = collection[index].call(animation, prop, value)) {

				// We're done with this property
				return tween;
			}
		}
	}

	function defaultPrefilter(elem, props, opts) {
		var prop,
		    value,
		    toggle,
		    hooks,
		    oldfire,
		    propTween,
		    restoreDisplay,
		    display,
		    isBox = "width" in props || "height" in props,
		    anim = this,
		    orig = {},
		    style = elem.style,
		    hidden = elem.nodeType && isHiddenWithinTree(elem),
		    dataShow = dataPriv.get(elem, "fxshow");

		// Queue-skipping animations hijack the fx hooks
		if (!opts.queue) {
			hooks = jQuery._queueHooks(elem, "fx");
			if (hooks.unqueued == null) {
				hooks.unqueued = 0;
				oldfire = hooks.empty.fire;
				hooks.empty.fire = function () {
					if (!hooks.unqueued) {
						oldfire();
					}
				};
			}
			hooks.unqueued++;

			anim.always(function () {

				// Ensure the complete handler is called before this completes
				anim.always(function () {
					hooks.unqueued--;
					if (!jQuery.queue(elem, "fx").length) {
						hooks.empty.fire();
					}
				});
			});
		}

		// Detect show/hide animations
		for (prop in props) {
			value = props[prop];
			if (rfxtypes.test(value)) {
				delete props[prop];
				toggle = toggle || value === "toggle";
				if (value === (hidden ? "hide" : "show")) {

					// Pretend to be hidden if this is a "show" and
					// there is still data from a stopped show/hide
					if (value === "show" && dataShow && dataShow[prop] !== undefined) {
						hidden = true;

						// Ignore all other no-op show/hide data
					} else {
						continue;
					}
				}
				orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
			}
		}

		// Bail out if this is a no-op like .hide().hide()
		propTween = !jQuery.isEmptyObject(props);
		if (!propTween && jQuery.isEmptyObject(orig)) {
			return;
		}

		// Restrict "overflow" and "display" styles during box animations
		if (isBox && elem.nodeType === 1) {

			// Support: IE <=9 - 11, Edge 12 - 15
			// Record all 3 overflow attributes because IE does not infer the shorthand
			// from identically-valued overflowX and overflowY and Edge just mirrors
			// the overflowX value there.
			opts.overflow = [style.overflow, style.overflowX, style.overflowY];

			// Identify a display type, preferring old show/hide data over the CSS cascade
			restoreDisplay = dataShow && dataShow.display;
			if (restoreDisplay == null) {
				restoreDisplay = dataPriv.get(elem, "display");
			}
			display = jQuery.css(elem, "display");
			if (display === "none") {
				if (restoreDisplay) {
					display = restoreDisplay;
				} else {

					// Get nonempty value(s) by temporarily forcing visibility
					showHide([elem], true);
					restoreDisplay = elem.style.display || restoreDisplay;
					display = jQuery.css(elem, "display");
					showHide([elem]);
				}
			}

			// Animate inline elements as inline-block
			if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
				if (jQuery.css(elem, "float") === "none") {

					// Restore the original display value at the end of pure show/hide animations
					if (!propTween) {
						anim.done(function () {
							style.display = restoreDisplay;
						});
						if (restoreDisplay == null) {
							display = style.display;
							restoreDisplay = display === "none" ? "" : display;
						}
					}
					style.display = "inline-block";
				}
			}
		}

		if (opts.overflow) {
			style.overflow = "hidden";
			anim.always(function () {
				style.overflow = opts.overflow[0];
				style.overflowX = opts.overflow[1];
				style.overflowY = opts.overflow[2];
			});
		}

		// Implement show/hide animations
		propTween = false;
		for (prop in orig) {

			// General show/hide setup for this element animation
			if (!propTween) {
				if (dataShow) {
					if ("hidden" in dataShow) {
						hidden = dataShow.hidden;
					}
				} else {
					dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
				}

				// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
				if (toggle) {
					dataShow.hidden = !hidden;
				}

				// Show elements before animating them
				if (hidden) {
					showHide([elem], true);
				}

				/* eslint-disable no-loop-func */

				anim.done(function () {

					/* eslint-enable no-loop-func */

					// The final step of a "hide" animation is actually hiding the element
					if (!hidden) {
						showHide([elem]);
					}
					dataPriv.remove(elem, "fxshow");
					for (prop in orig) {
						jQuery.style(elem, prop, orig[prop]);
					}
				});
			}

			// Per-property setup
			propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
			if (!(prop in dataShow)) {
				dataShow[prop] = propTween.start;
				if (hidden) {
					propTween.end = propTween.start;
					propTween.start = 0;
				}
			}
		}
	}

	function propFilter(props, specialEasing) {
		var index, name, easing, value, hooks;

		// camelCase, specialEasing and expand cssHook pass
		for (index in props) {
			name = camelCase(index);
			easing = specialEasing[name];
			value = props[index];
			if (Array.isArray(value)) {
				easing = value[1];
				value = props[index] = value[0];
			}

			if (index !== name) {
				props[name] = value;
				delete props[index];
			}

			hooks = jQuery.cssHooks[name];
			if (hooks && "expand" in hooks) {
				value = hooks.expand(value);
				delete props[name];

				// Not quite $.extend, this won't overwrite existing keys.
				// Reusing 'index' because we have the correct "name"
				for (index in value) {
					if (!(index in props)) {
						props[index] = value[index];
						specialEasing[index] = easing;
					}
				}
			} else {
				specialEasing[name] = easing;
			}
		}
	}

	function Animation(elem, properties, options) {
		var result,
		    stopped,
		    index = 0,
		    length = Animation.prefilters.length,
		    deferred = jQuery.Deferred().always(function () {

			// Don't match elem in the :animated selector
			delete tick.elem;
		}),
		    tick = function tick() {
			if (stopped) {
				return false;
			}
			var currentTime = fxNow || createFxNow(),
			    remaining = Math.max(0, animation.startTime + animation.duration - currentTime),


			// Support: Android 2.3 only
			// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
			temp = remaining / animation.duration || 0,
			    percent = 1 - temp,
			    index = 0,
			    length = animation.tweens.length;

			for (; index < length; index++) {
				animation.tweens[index].run(percent);
			}

			deferred.notifyWith(elem, [animation, percent, remaining]);

			// If there's more to do, yield
			if (percent < 1 && length) {
				return remaining;
			}

			// If this was an empty animation, synthesize a final progress notification
			if (!length) {
				deferred.notifyWith(elem, [animation, 1, 0]);
			}

			// Resolve the animation and report its conclusion
			deferred.resolveWith(elem, [animation]);
			return false;
		},
		    animation = deferred.promise({
			elem: elem,
			props: jQuery.extend({}, properties),
			opts: jQuery.extend(true, {
				specialEasing: {},
				easing: jQuery.easing._default
			}, options),
			originalProperties: properties,
			originalOptions: options,
			startTime: fxNow || createFxNow(),
			duration: options.duration,
			tweens: [],
			createTween: function createTween(prop, end) {
				var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
				animation.tweens.push(tween);
				return tween;
			},
			stop: function stop(gotoEnd) {
				var index = 0,


				// If we are going to the end, we want to run all the tweens
				// otherwise we skip this part
				length = gotoEnd ? animation.tweens.length : 0;
				if (stopped) {
					return this;
				}
				stopped = true;
				for (; index < length; index++) {
					animation.tweens[index].run(1);
				}

				// Resolve when we played the last frame; otherwise, reject
				if (gotoEnd) {
					deferred.notifyWith(elem, [animation, 1, 0]);
					deferred.resolveWith(elem, [animation, gotoEnd]);
				} else {
					deferred.rejectWith(elem, [animation, gotoEnd]);
				}
				return this;
			}
		}),
		    props = animation.props;

		propFilter(props, animation.opts.specialEasing);

		for (; index < length; index++) {
			result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
			if (result) {
				if (isFunction(result.stop)) {
					jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
				}
				return result;
			}
		}

		jQuery.map(props, createTween, animation);

		if (isFunction(animation.opts.start)) {
			animation.opts.start.call(elem, animation);
		}

		// Attach callbacks from options
		animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);

		jQuery.fx.timer(jQuery.extend(tick, {
			elem: elem,
			anim: animation,
			queue: animation.opts.queue
		}));

		return animation;
	}

	jQuery.Animation = jQuery.extend(Animation, {

		tweeners: {
			"*": [function (prop, value) {
				var tween = this.createTween(prop, value);
				adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
				return tween;
			}]
		},

		tweener: function tweener(props, callback) {
			if (isFunction(props)) {
				callback = props;
				props = ["*"];
			} else {
				props = props.match(rnothtmlwhite);
			}

			var prop,
			    index = 0,
			    length = props.length;

			for (; index < length; index++) {
				prop = props[index];
				Animation.tweeners[prop] = Animation.tweeners[prop] || [];
				Animation.tweeners[prop].unshift(callback);
			}
		},

		prefilters: [defaultPrefilter],

		prefilter: function prefilter(callback, prepend) {
			if (prepend) {
				Animation.prefilters.unshift(callback);
			} else {
				Animation.prefilters.push(callback);
			}
		}
	});

	jQuery.speed = function (speed, easing, fn) {
		var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : {
			complete: fn || !fn && easing || isFunction(speed) && speed,
			duration: speed,
			easing: fn && easing || easing && !isFunction(easing) && easing
		};

		// Go to the end state if fx are off
		if (jQuery.fx.off) {
			opt.duration = 0;
		} else {
			if (typeof opt.duration !== "number") {
				if (opt.duration in jQuery.fx.speeds) {
					opt.duration = jQuery.fx.speeds[opt.duration];
				} else {
					opt.duration = jQuery.fx.speeds._default;
				}
			}
		}

		// Normalize opt.queue - true/undefined/null -> "fx"
		if (opt.queue == null || opt.queue === true) {
			opt.queue = "fx";
		}

		// Queueing
		opt.old = opt.complete;

		opt.complete = function () {
			if (isFunction(opt.old)) {
				opt.old.call(this);
			}

			if (opt.queue) {
				jQuery.dequeue(this, opt.queue);
			}
		};

		return opt;
	};

	jQuery.fn.extend({
		fadeTo: function fadeTo(speed, to, easing, callback) {

			// Show any hidden elements after setting opacity to 0
			return this.filter(isHiddenWithinTree).css("opacity", 0).show()

			// Animate to the value specified
			.end().animate({ opacity: to }, speed, easing, callback);
		},
		animate: function animate(prop, speed, easing, callback) {
			var empty = jQuery.isEmptyObject(prop),
			    optall = jQuery.speed(speed, easing, callback),
			    doAnimation = function doAnimation() {

				// Operate on a copy of prop so per-property easing won't be lost
				var anim = Animation(this, jQuery.extend({}, prop), optall);

				// Empty animations, or finishing resolves immediately
				if (empty || dataPriv.get(this, "finish")) {
					anim.stop(true);
				}
			};
			doAnimation.finish = doAnimation;

			return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
		},
		stop: function stop(type, clearQueue, gotoEnd) {
			var stopQueue = function stopQueue(hooks) {
				var stop = hooks.stop;
				delete hooks.stop;
				stop(gotoEnd);
			};

			if (typeof type !== "string") {
				gotoEnd = clearQueue;
				clearQueue = type;
				type = undefined;
			}
			if (clearQueue && type !== false) {
				this.queue(type || "fx", []);
			}

			return this.each(function () {
				var dequeue = true,
				    index = type != null && type + "queueHooks",
				    timers = jQuery.timers,
				    data = dataPriv.get(this);

				if (index) {
					if (data[index] && data[index].stop) {
						stopQueue(data[index]);
					}
				} else {
					for (index in data) {
						if (data[index] && data[index].stop && rrun.test(index)) {
							stopQueue(data[index]);
						}
					}
				}

				for (index = timers.length; index--;) {
					if (timers[index].elem === this && (type == null || timers[index].queue === type)) {

						timers[index].anim.stop(gotoEnd);
						dequeue = false;
						timers.splice(index, 1);
					}
				}

				// Start the next in the queue if the last step wasn't forced.
				// Timers currently will call their complete callbacks, which
				// will dequeue but only if they were gotoEnd.
				if (dequeue || !gotoEnd) {
					jQuery.dequeue(this, type);
				}
			});
		},
		finish: function finish(type) {
			if (type !== false) {
				type = type || "fx";
			}
			return this.each(function () {
				var index,
				    data = dataPriv.get(this),
				    queue = data[type + "queue"],
				    hooks = data[type + "queueHooks"],
				    timers = jQuery.timers,
				    length = queue ? queue.length : 0;

				// Enable finishing flag on private data
				data.finish = true;

				// Empty the queue first
				jQuery.queue(this, type, []);

				if (hooks && hooks.stop) {
					hooks.stop.call(this, true);
				}

				// Look for any active animations, and finish them
				for (index = timers.length; index--;) {
					if (timers[index].elem === this && timers[index].queue === type) {
						timers[index].anim.stop(true);
						timers.splice(index, 1);
					}
				}

				// Look for any animations in the old queue and finish them
				for (index = 0; index < length; index++) {
					if (queue[index] && queue[index].finish) {
						queue[index].finish.call(this);
					}
				}

				// Turn off finishing flag
				delete data.finish;
			});
		}
	});

	jQuery.each(["toggle", "show", "hide"], function (i, name) {
		var cssFn = jQuery.fn[name];
		jQuery.fn[name] = function (speed, easing, callback) {
			return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
		};
	});

	// Generate shortcuts for custom animations
	jQuery.each({
		slideDown: genFx("show"),
		slideUp: genFx("hide"),
		slideToggle: genFx("toggle"),
		fadeIn: { opacity: "show" },
		fadeOut: { opacity: "hide" },
		fadeToggle: { opacity: "toggle" }
	}, function (name, props) {
		jQuery.fn[name] = function (speed, easing, callback) {
			return this.animate(props, speed, easing, callback);
		};
	});

	jQuery.timers = [];
	jQuery.fx.tick = function () {
		var timer,
		    i = 0,
		    timers = jQuery.timers;

		fxNow = Date.now();

		for (; i < timers.length; i++) {
			timer = timers[i];

			// Run the timer and safely remove it when done (allowing for external removal)
			if (!timer() && timers[i] === timer) {
				timers.splice(i--, 1);
			}
		}

		if (!timers.length) {
			jQuery.fx.stop();
		}
		fxNow = undefined;
	};

	jQuery.fx.timer = function (timer) {
		jQuery.timers.push(timer);
		jQuery.fx.start();
	};

	jQuery.fx.interval = 13;
	jQuery.fx.start = function () {
		if (inProgress) {
			return;
		}

		inProgress = true;
		schedule();
	};

	jQuery.fx.stop = function () {
		inProgress = null;
	};

	jQuery.fx.speeds = {
		slow: 600,
		fast: 200,

		// Default speed
		_default: 400
	};

	// Based off of the plugin by Clint Helfers, with permission.
	// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
	jQuery.fn.delay = function (time, type) {
		time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
		type = type || "fx";

		return this.queue(type, function (next, hooks) {
			var timeout = window.setTimeout(next, time);
			hooks.stop = function () {
				window.clearTimeout(timeout);
			};
		});
	};

	(function () {
		var input = document.createElement("input"),
		    select = document.createElement("select"),
		    opt = select.appendChild(document.createElement("option"));

		input.type = "checkbox";

		// Support: Android <=4.3 only
		// Default value for a checkbox should be "on"
		support.checkOn = input.value !== "";

		// Support: IE <=11 only
		// Must access selectedIndex to make default options select
		support.optSelected = opt.selected;

		// Support: IE <=11 only
		// An input loses its value after becoming a radio
		input = document.createElement("input");
		input.value = "t";
		input.type = "radio";
		support.radioValue = input.value === "t";
	})();

	var boolHook,
	    attrHandle = jQuery.expr.attrHandle;

	jQuery.fn.extend({
		attr: function attr(name, value) {
			return access(this, jQuery.attr, name, value, arguments.length > 1);
		},

		removeAttr: function removeAttr(name) {
			return this.each(function () {
				jQuery.removeAttr(this, name);
			});
		}
	});

	jQuery.extend({
		attr: function attr(elem, name, value) {
			var ret,
			    hooks,
			    nType = elem.nodeType;

			// Don't get/set attributes on text, comment and attribute nodes
			if (nType === 3 || nType === 8 || nType === 2) {
				return;
			}

			// Fallback to prop when attributes are not supported
			if (typeof elem.getAttribute === "undefined") {
				return jQuery.prop(elem, name, value);
			}

			// Attribute hooks are determined by the lowercase version
			// Grab necessary hook if one is defined
			if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
				hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
			}

			if (value !== undefined) {
				if (value === null) {
					jQuery.removeAttr(elem, name);
					return;
				}

				if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
					return ret;
				}

				elem.setAttribute(name, value + "");
				return value;
			}

			if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
				return ret;
			}

			ret = jQuery.find.attr(elem, name);

			// Non-existent attributes return null, we normalize to undefined
			return ret == null ? undefined : ret;
		},

		attrHooks: {
			type: {
				set: function set(elem, value) {
					if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
						var val = elem.value;
						elem.setAttribute("type", value);
						if (val) {
							elem.value = val;
						}
						return value;
					}
				}
			}
		},

		removeAttr: function removeAttr(elem, value) {
			var name,
			    i = 0,


			// Attribute names can contain non-HTML whitespace characters
			// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
			attrNames = value && value.match(rnothtmlwhite);

			if (attrNames && elem.nodeType === 1) {
				while (name = attrNames[i++]) {
					elem.removeAttribute(name);
				}
			}
		}
	});

	// Hooks for boolean attributes
	boolHook = {
		set: function set(elem, value, name) {
			if (value === false) {

				// Remove boolean attributes when set to false
				jQuery.removeAttr(elem, name);
			} else {
				elem.setAttribute(name, name);
			}
			return name;
		}
	};

	jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
		var getter = attrHandle[name] || jQuery.find.attr;

		attrHandle[name] = function (elem, name, isXML) {
			var ret,
			    handle,
			    lowercaseName = name.toLowerCase();

			if (!isXML) {

				// Avoid an infinite loop by temporarily removing this function from the getter
				handle = attrHandle[lowercaseName];
				attrHandle[lowercaseName] = ret;
				ret = getter(elem, name, isXML) != null ? lowercaseName : null;
				attrHandle[lowercaseName] = handle;
			}
			return ret;
		};
	});

	var rfocusable = /^(?:input|select|textarea|button)$/i,
	    rclickable = /^(?:a|area)$/i;

	jQuery.fn.extend({
		prop: function prop(name, value) {
			return access(this, jQuery.prop, name, value, arguments.length > 1);
		},

		removeProp: function removeProp(name) {
			return this.each(function () {
				delete this[jQuery.propFix[name] || name];
			});
		}
	});

	jQuery.extend({
		prop: function prop(elem, name, value) {
			var ret,
			    hooks,
			    nType = elem.nodeType;

			// Don't get/set properties on text, comment and attribute nodes
			if (nType === 3 || nType === 8 || nType === 2) {
				return;
			}

			if (nType !== 1 || !jQuery.isXMLDoc(elem)) {

				// Fix name and attach hooks
				name = jQuery.propFix[name] || name;
				hooks = jQuery.propHooks[name];
			}

			if (value !== undefined) {
				if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
					return ret;
				}

				return elem[name] = value;
			}

			if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
				return ret;
			}

			return elem[name];
		},

		propHooks: {
			tabIndex: {
				get: function get(elem) {

					// Support: IE <=9 - 11 only
					// elem.tabIndex doesn't always return the
					// correct value when it hasn't been explicitly set
					// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
					// Use proper attribute retrieval(#12072)
					var tabindex = jQuery.find.attr(elem, "tabindex");

					if (tabindex) {
						return parseInt(tabindex, 10);
					}

					if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
						return 0;
					}

					return -1;
				}
			}
		},

		propFix: {
			"for": "htmlFor",
			"class": "className"
		}
	});

	// Support: IE <=11 only
	// Accessing the selectedIndex property
	// forces the browser to respect setting selected
	// on the option
	// The getter ensures a default option is selected
	// when in an optgroup
	// eslint rule "no-unused-expressions" is disabled for this code
	// since it considers such accessions noop
	if (!support.optSelected) {
		jQuery.propHooks.selected = {
			get: function get(elem) {

				/* eslint no-unused-expressions: "off" */

				var parent = elem.parentNode;
				if (parent && parent.parentNode) {
					parent.parentNode.selectedIndex;
				}
				return null;
			},
			set: function set(elem) {

				/* eslint no-unused-expressions: "off" */

				var parent = elem.parentNode;
				if (parent) {
					parent.selectedIndex;

					if (parent.parentNode) {
						parent.parentNode.selectedIndex;
					}
				}
			}
		};
	}

	jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
		jQuery.propFix[this.toLowerCase()] = this;
	});

	// Strip and collapse whitespace according to HTML spec
	// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
	function stripAndCollapse(value) {
		var tokens = value.match(rnothtmlwhite) || [];
		return tokens.join(" ");
	}

	function getClass(elem) {
		return elem.getAttribute && elem.getAttribute("class") || "";
	}

	function classesToArray(value) {
		if (Array.isArray(value)) {
			return value;
		}
		if (typeof value === "string") {
			return value.match(rnothtmlwhite) || [];
		}
		return [];
	}

	jQuery.fn.extend({
		addClass: function addClass(value) {
			var classes,
			    elem,
			    cur,
			    curValue,
			    clazz,
			    j,
			    finalValue,
			    i = 0;

			if (isFunction(value)) {
				return this.each(function (j) {
					jQuery(this).addClass(value.call(this, j, getClass(this)));
				});
			}

			classes = classesToArray(value);

			if (classes.length) {
				while (elem = this[i++]) {
					curValue = getClass(elem);
					cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";

					if (cur) {
						j = 0;
						while (clazz = classes[j++]) {
							if (cur.indexOf(" " + clazz + " ") < 0) {
								cur += clazz + " ";
							}
						}

						// Only assign if different to avoid unneeded rendering.
						finalValue = stripAndCollapse(cur);
						if (curValue !== finalValue) {
							elem.setAttribute("class", finalValue);
						}
					}
				}
			}

			return this;
		},

		removeClass: function removeClass(value) {
			var classes,
			    elem,
			    cur,
			    curValue,
			    clazz,
			    j,
			    finalValue,
			    i = 0;

			if (isFunction(value)) {
				return this.each(function (j) {
					jQuery(this).removeClass(value.call(this, j, getClass(this)));
				});
			}

			if (!arguments.length) {
				return this.attr("class", "");
			}

			classes = classesToArray(value);

			if (classes.length) {
				while (elem = this[i++]) {
					curValue = getClass(elem);

					// This expression is here for better compressibility (see addClass)
					cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";

					if (cur) {
						j = 0;
						while (clazz = classes[j++]) {

							// Remove *all* instances
							while (cur.indexOf(" " + clazz + " ") > -1) {
								cur = cur.replace(" " + clazz + " ", " ");
							}
						}

						// Only assign if different to avoid unneeded rendering.
						finalValue = stripAndCollapse(cur);
						if (curValue !== finalValue) {
							elem.setAttribute("class", finalValue);
						}
					}
				}
			}

			return this;
		},

		toggleClass: function toggleClass(value, stateVal) {
			var type = typeof value === "undefined" ? "undefined" : _typeof(value),
			    isValidValue = type === "string" || Array.isArray(value);

			if (typeof stateVal === "boolean" && isValidValue) {
				return stateVal ? this.addClass(value) : this.removeClass(value);
			}

			if (isFunction(value)) {
				return this.each(function (i) {
					jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
				});
			}

			return this.each(function () {
				var className, i, self, classNames;

				if (isValidValue) {

					// Toggle individual class names
					i = 0;
					self = jQuery(this);
					classNames = classesToArray(value);

					while (className = classNames[i++]) {

						// Check each className given, space separated list
						if (self.hasClass(className)) {
							self.removeClass(className);
						} else {
							self.addClass(className);
						}
					}

					// Toggle whole class name
				} else if (value === undefined || type === "boolean") {
					className = getClass(this);
					if (className) {

						// Store className if set
						dataPriv.set(this, "__className__", className);
					}

					// If the element has a class name or if we're passed `false`,
					// then remove the whole classname (if there was one, the above saved it).
					// Otherwise bring back whatever was previously saved (if anything),
					// falling back to the empty string if nothing was stored.
					if (this.setAttribute) {
						this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
					}
				}
			});
		},

		hasClass: function hasClass(selector) {
			var className,
			    elem,
			    i = 0;

			className = " " + selector + " ";
			while (elem = this[i++]) {
				if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
					return true;
				}
			}

			return false;
		}
	});

	var rreturn = /\r/g;

	jQuery.fn.extend({
		val: function val(value) {
			var hooks,
			    ret,
			    valueIsFunction,
			    elem = this[0];

			if (!arguments.length) {
				if (elem) {
					hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];

					if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
						return ret;
					}

					ret = elem.value;

					// Handle most common string cases
					if (typeof ret === "string") {
						return ret.replace(rreturn, "");
					}

					// Handle cases where value is null/undef or number
					return ret == null ? "" : ret;
				}

				return;
			}

			valueIsFunction = isFunction(value);

			return this.each(function (i) {
				var val;

				if (this.nodeType !== 1) {
					return;
				}

				if (valueIsFunction) {
					val = value.call(this, i, jQuery(this).val());
				} else {
					val = value;
				}

				// Treat null/undefined as ""; convert numbers to string
				if (val == null) {
					val = "";
				} else if (typeof val === "number") {
					val += "";
				} else if (Array.isArray(val)) {
					val = jQuery.map(val, function (value) {
						return value == null ? "" : value + "";
					});
				}

				hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];

				// If set returns undefined, fall back to normal setting
				if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
					this.value = val;
				}
			});
		}
	});

	jQuery.extend({
		valHooks: {
			option: {
				get: function get(elem) {

					var val = jQuery.find.attr(elem, "value");
					return val != null ? val :

					// Support: IE <=10 - 11 only
					// option.text throws exceptions (#14686, #14858)
					// Strip and collapse whitespace
					// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
					stripAndCollapse(jQuery.text(elem));
				}
			},
			select: {
				get: function get(elem) {
					var value,
					    option,
					    i,
					    options = elem.options,
					    index = elem.selectedIndex,
					    one = elem.type === "select-one",
					    values = one ? null : [],
					    max = one ? index + 1 : options.length;

					if (index < 0) {
						i = max;
					} else {
						i = one ? index : 0;
					}

					// Loop through all the selected options
					for (; i < max; i++) {
						option = options[i];

						// Support: IE <=9 only
						// IE8-9 doesn't update selected after form reset (#2551)
						if ((option.selected || i === index) &&

						// Don't return options that are disabled or in a disabled optgroup
						!option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {

							// Get the specific value for the option
							value = jQuery(option).val();

							// We don't need an array for one selects
							if (one) {
								return value;
							}

							// Multi-Selects return an array
							values.push(value);
						}
					}

					return values;
				},

				set: function set(elem, value) {
					var optionSet,
					    option,
					    options = elem.options,
					    values = jQuery.makeArray(value),
					    i = options.length;

					while (i--) {
						option = options[i];

						/* eslint-disable no-cond-assign */

						if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
							optionSet = true;
						}

						/* eslint-enable no-cond-assign */
					}

					// Force browsers to behave consistently when non-matching value is set
					if (!optionSet) {
						elem.selectedIndex = -1;
					}
					return values;
				}
			}
		}
	});

	// Radios and checkboxes getter/setter
	jQuery.each(["radio", "checkbox"], function () {
		jQuery.valHooks[this] = {
			set: function set(elem, value) {
				if (Array.isArray(value)) {
					return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
				}
			}
		};
		if (!support.checkOn) {
			jQuery.valHooks[this].get = function (elem) {
				return elem.getAttribute("value") === null ? "on" : elem.value;
			};
		}
	});

	// Return jQuery for attributes-only inclusion


	support.focusin = "onfocusin" in window;

	var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
	    stopPropagationCallback = function stopPropagationCallback(e) {
		e.stopPropagation();
	};

	jQuery.extend(jQuery.event, {

		trigger: function trigger(event, data, elem, onlyHandlers) {

			var i,
			    cur,
			    tmp,
			    bubbleType,
			    ontype,
			    handle,
			    special,
			    lastElement,
			    eventPath = [elem || document],
			    type = hasOwn.call(event, "type") ? event.type : event,
			    namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];

			cur = lastElement = tmp = elem = elem || document;

			// Don't do events on text and comment nodes
			if (elem.nodeType === 3 || elem.nodeType === 8) {
				return;
			}

			// focus/blur morphs to focusin/out; ensure we're not firing them right now
			if (rfocusMorph.test(type + jQuery.event.triggered)) {
				return;
			}

			if (type.indexOf(".") > -1) {

				// Namespaced trigger; create a regexp to match event type in handle()
				namespaces = type.split(".");
				type = namespaces.shift();
				namespaces.sort();
			}
			ontype = type.indexOf(":") < 0 && "on" + type;

			// Caller can pass in a jQuery.Event object, Object, or just an event type string
			event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event);

			// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
			event.isTrigger = onlyHandlers ? 2 : 3;
			event.namespace = namespaces.join(".");
			event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;

			// Clean up the event in case it is being reused
			event.result = undefined;
			if (!event.target) {
				event.target = elem;
			}

			// Clone any incoming data and prepend the event, creating the handler arg list
			data = data == null ? [event] : jQuery.makeArray(data, [event]);

			// Allow special events to draw outside the lines
			special = jQuery.event.special[type] || {};
			if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
				return;
			}

			// Determine event propagation path in advance, per W3C events spec (#9951)
			// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
			if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {

				bubbleType = special.delegateType || type;
				if (!rfocusMorph.test(bubbleType + type)) {
					cur = cur.parentNode;
				}
				for (; cur; cur = cur.parentNode) {
					eventPath.push(cur);
					tmp = cur;
				}

				// Only add window if we got to document (e.g., not plain obj or detached DOM)
				if (tmp === (elem.ownerDocument || document)) {
					eventPath.push(tmp.defaultView || tmp.parentWindow || window);
				}
			}

			// Fire handlers on the event path
			i = 0;
			while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
				lastElement = cur;
				event.type = i > 1 ? bubbleType : special.bindType || type;

				// jQuery handler
				handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle");
				if (handle) {
					handle.apply(cur, data);
				}

				// Native handler
				handle = ontype && cur[ontype];
				if (handle && handle.apply && acceptData(cur)) {
					event.result = handle.apply(cur, data);
					if (event.result === false) {
						event.preventDefault();
					}
				}
			}
			event.type = type;

			// If nobody prevented the default action, do it now
			if (!onlyHandlers && !event.isDefaultPrevented()) {

				if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {

					// Call a native DOM method on the target with the same name as the event.
					// Don't do default actions on window, that's where global variables be (#6170)
					if (ontype && isFunction(elem[type]) && !isWindow(elem)) {

						// Don't re-trigger an onFOO event when we call its FOO() method
						tmp = elem[ontype];

						if (tmp) {
							elem[ontype] = null;
						}

						// Prevent re-triggering of the same event, since we already bubbled it above
						jQuery.event.triggered = type;

						if (event.isPropagationStopped()) {
							lastElement.addEventListener(type, stopPropagationCallback);
						}

						elem[type]();

						if (event.isPropagationStopped()) {
							lastElement.removeEventListener(type, stopPropagationCallback);
						}

						jQuery.event.triggered = undefined;

						if (tmp) {
							elem[ontype] = tmp;
						}
					}
				}
			}

			return event.result;
		},

		// Piggyback on a donor event to simulate a different one
		// Used only for `focus(in | out)` events
		simulate: function simulate(type, elem, event) {
			var e = jQuery.extend(new jQuery.Event(), event, {
				type: type,
				isSimulated: true
			});

			jQuery.event.trigger(e, null, elem);
		}

	});

	jQuery.fn.extend({

		trigger: function trigger(type, data) {
			return this.each(function () {
				jQuery.event.trigger(type, data, this);
			});
		},
		triggerHandler: function triggerHandler(type, data) {
			var elem = this[0];
			if (elem) {
				return jQuery.event.trigger(type, data, elem, true);
			}
		}
	});

	// Support: Firefox <=44
	// Firefox doesn't have focus(in | out) events
	// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
	//
	// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
	// focus(in | out) events fire after focus & blur events,
	// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
	// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
	if (!support.focusin) {
		jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {

			// Attach a single capturing handler on the document while someone wants focusin/focusout
			var handler = function handler(event) {
				jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
			};

			jQuery.event.special[fix] = {
				setup: function setup() {
					var doc = this.ownerDocument || this,
					    attaches = dataPriv.access(doc, fix);

					if (!attaches) {
						doc.addEventListener(orig, handler, true);
					}
					dataPriv.access(doc, fix, (attaches || 0) + 1);
				},
				teardown: function teardown() {
					var doc = this.ownerDocument || this,
					    attaches = dataPriv.access(doc, fix) - 1;

					if (!attaches) {
						doc.removeEventListener(orig, handler, true);
						dataPriv.remove(doc, fix);
					} else {
						dataPriv.access(doc, fix, attaches);
					}
				}
			};
		});
	}
	var location = window.location;

	var nonce = Date.now();

	var rquery = /\?/;

	// Cross-browser xml parsing
	jQuery.parseXML = function (data) {
		var xml;
		if (!data || typeof data !== "string") {
			return null;
		}

		// Support: IE 9 - 11 only
		// IE throws on parseFromString with invalid input.
		try {
			xml = new window.DOMParser().parseFromString(data, "text/xml");
		} catch (e) {
			xml = undefined;
		}

		if (!xml || xml.getElementsByTagName("parsererror").length) {
			jQuery.error("Invalid XML: " + data);
		}
		return xml;
	};

	var rbracket = /\[\]$/,
	    rCRLF = /\r?\n/g,
	    rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
	    rsubmittable = /^(?:input|select|textarea|keygen)/i;

	function buildParams(prefix, obj, traditional, add) {
		var name;

		if (Array.isArray(obj)) {

			// Serialize array item.
			jQuery.each(obj, function (i, v) {
				if (traditional || rbracket.test(prefix)) {

					// Treat each array item as a scalar.
					add(prefix, v);
				} else {

					// Item is non-scalar (array or object), encode its numeric index.
					buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add);
				}
			});
		} else if (!traditional && toType(obj) === "object") {

			// Serialize object item.
			for (name in obj) {
				buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
			}
		} else {

			// Serialize scalar item.
			add(prefix, obj);
		}
	}

	// Serialize an array of form elements or a set of
	// key/values into a query string
	jQuery.param = function (a, traditional) {
		var prefix,
		    s = [],
		    add = function add(key, valueOrFunction) {

			// If value is a function, invoke it and use its return value
			var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;

			s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
		};

		// If an array was passed in, assume that it is an array of form elements.
		if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {

			// Serialize the form elements
			jQuery.each(a, function () {
				add(this.name, this.value);
			});
		} else {

			// If traditional, encode the "old" way (the way 1.3.2 or older
			// did it), otherwise encode params recursively.
			for (prefix in a) {
				buildParams(prefix, a[prefix], traditional, add);
			}
		}

		// Return the resulting serialization
		return s.join("&");
	};

	jQuery.fn.extend({
		serialize: function serialize() {
			return jQuery.param(this.serializeArray());
		},
		serializeArray: function serializeArray() {
			return this.map(function () {

				// Can add propHook for "elements" to filter or add form elements
				var elements = jQuery.prop(this, "elements");
				return elements ? jQuery.makeArray(elements) : this;
			}).filter(function () {
				var type = this.type;

				// Use .is( ":disabled" ) so that fieldset[disabled] works
				return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
			}).map(function (i, elem) {
				var val = jQuery(this).val();

				if (val == null) {
					return null;
				}

				if (Array.isArray(val)) {
					return jQuery.map(val, function (val) {
						return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
					});
				}

				return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
			}).get();
		}
	});

	var r20 = /%20/g,
	    rhash = /#.*$/,
	    rantiCache = /([?&])_=[^&]*/,
	    rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,


	// #7653, #8125, #8152: local protocol detection
	rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
	    rnoContent = /^(?:GET|HEAD)$/,
	    rprotocol = /^\/\//,


	/* Prefilters
  * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  * 2) These are called:
  *    - BEFORE asking for a transport
  *    - AFTER param serialization (s.data is a string if s.processData is true)
  * 3) key is the dataType
  * 4) the catchall symbol "*" can be used
  * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  */
	prefilters = {},


	/* Transports bindings
  * 1) key is the dataType
  * 2) the catchall symbol "*" can be used
  * 3) selection will start with transport dataType and THEN go to "*" if needed
  */
	transports = {},


	// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
	allTypes = "*/".concat("*"),


	// Anchor tag for parsing the document origin
	originAnchor = document.createElement("a");
	originAnchor.href = location.href;

	// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
	function addToPrefiltersOrTransports(structure) {

		// dataTypeExpression is optional and defaults to "*"
		return function (dataTypeExpression, func) {

			if (typeof dataTypeExpression !== "string") {
				func = dataTypeExpression;
				dataTypeExpression = "*";
			}

			var dataType,
			    i = 0,
			    dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];

			if (isFunction(func)) {

				// For each dataType in the dataTypeExpression
				while (dataType = dataTypes[i++]) {

					// Prepend if requested
					if (dataType[0] === "+") {
						dataType = dataType.slice(1) || "*";
						(structure[dataType] = structure[dataType] || []).unshift(func);

						// Otherwise append
					} else {
						(structure[dataType] = structure[dataType] || []).push(func);
					}
				}
			}
		};
	}

	// Base inspection function for prefilters and transports
	function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {

		var inspected = {},
		    seekingTransport = structure === transports;

		function inspect(dataType) {
			var selected;
			inspected[dataType] = true;
			jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
				var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
				if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {

					options.dataTypes.unshift(dataTypeOrTransport);
					inspect(dataTypeOrTransport);
					return false;
				} else if (seekingTransport) {
					return !(selected = dataTypeOrTransport);
				}
			});
			return selected;
		}

		return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
	}

	// A special extend for ajax options
	// that takes "flat" options (not to be deep extended)
	// Fixes #9887
	function ajaxExtend(target, src) {
		var key,
		    deep,
		    flatOptions = jQuery.ajaxSettings.flatOptions || {};

		for (key in src) {
			if (src[key] !== undefined) {
				(flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
			}
		}
		if (deep) {
			jQuery.extend(true, target, deep);
		}

		return target;
	}

	/* Handles responses to an ajax request:
  * - finds the right dataType (mediates between content-type and expected dataType)
  * - returns the corresponding response
  */
	function ajaxHandleResponses(s, jqXHR, responses) {

		var ct,
		    type,
		    finalDataType,
		    firstDataType,
		    contents = s.contents,
		    dataTypes = s.dataTypes;

		// Remove auto dataType and get content-type in the process
		while (dataTypes[0] === "*") {
			dataTypes.shift();
			if (ct === undefined) {
				ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
			}
		}

		// Check if we're dealing with a known content-type
		if (ct) {
			for (type in contents) {
				if (contents[type] && contents[type].test(ct)) {
					dataTypes.unshift(type);
					break;
				}
			}
		}

		// Check to see if we have a response for the expected dataType
		if (dataTypes[0] in responses) {
			finalDataType = dataTypes[0];
		} else {

			// Try convertible dataTypes
			for (type in responses) {
				if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
					finalDataType = type;
					break;
				}
				if (!firstDataType) {
					firstDataType = type;
				}
			}

			// Or just use first one
			finalDataType = finalDataType || firstDataType;
		}

		// If we found a dataType
		// We add the dataType to the list if needed
		// and return the corresponding response
		if (finalDataType) {
			if (finalDataType !== dataTypes[0]) {
				dataTypes.unshift(finalDataType);
			}
			return responses[finalDataType];
		}
	}

	/* Chain conversions given the request and the original response
  * Also sets the responseXXX fields on the jqXHR instance
  */
	function ajaxConvert(s, response, jqXHR, isSuccess) {
		var conv2,
		    current,
		    conv,
		    tmp,
		    prev,
		    converters = {},


		// Work with a copy of dataTypes in case we need to modify it for conversion
		dataTypes = s.dataTypes.slice();

		// Create converters map with lowercased keys
		if (dataTypes[1]) {
			for (conv in s.converters) {
				converters[conv.toLowerCase()] = s.converters[conv];
			}
		}

		current = dataTypes.shift();

		// Convert to each sequential dataType
		while (current) {

			if (s.responseFields[current]) {
				jqXHR[s.responseFields[current]] = response;
			}

			// Apply the dataFilter if provided
			if (!prev && isSuccess && s.dataFilter) {
				response = s.dataFilter(response, s.dataType);
			}

			prev = current;
			current = dataTypes.shift();

			if (current) {

				// There's only work to do if current dataType is non-auto
				if (current === "*") {

					current = prev;

					// Convert response if prev dataType is non-auto and differs from current
				} else if (prev !== "*" && prev !== current) {

					// Seek a direct converter
					conv = converters[prev + " " + current] || converters["* " + current];

					// If none found, seek a pair
					if (!conv) {
						for (conv2 in converters) {

							// If conv2 outputs current
							tmp = conv2.split(" ");
							if (tmp[1] === current) {

								// If prev can be converted to accepted input
								conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
								if (conv) {

									// Condense equivalence converters
									if (conv === true) {
										conv = converters[conv2];

										// Otherwise, insert the intermediate dataType
									} else if (converters[conv2] !== true) {
										current = tmp[0];
										dataTypes.unshift(tmp[1]);
									}
									break;
								}
							}
						}
					}

					// Apply converter (if not an equivalence)
					if (conv !== true) {

						// Unless errors are allowed to bubble, catch and return them
						if (conv && s.throws) {
							response = conv(response);
						} else {
							try {
								response = conv(response);
							} catch (e) {
								return {
									state: "parsererror",
									error: conv ? e : "No conversion from " + prev + " to " + current
								};
							}
						}
					}
				}
			}
		}

		return { state: "success", data: response };
	}

	jQuery.extend({

		// Counter for holding the number of active queries
		active: 0,

		// Last-Modified header cache for next request
		lastModified: {},
		etag: {},

		ajaxSettings: {
			url: location.href,
			type: "GET",
			isLocal: rlocalProtocol.test(location.protocol),
			global: true,
			processData: true,
			async: true,
			contentType: "application/x-www-form-urlencoded; charset=UTF-8",

			/*
   timeout: 0,
   data: null,
   dataType: null,
   username: null,
   password: null,
   cache: null,
   throws: false,
   traditional: false,
   headers: {},
   */

			accepts: {
				"*": allTypes,
				text: "text/plain",
				html: "text/html",
				xml: "application/xml, text/xml",
				json: "application/json, text/javascript"
			},

			contents: {
				xml: /\bxml\b/,
				html: /\bhtml/,
				json: /\bjson\b/
			},

			responseFields: {
				xml: "responseXML",
				text: "responseText",
				json: "responseJSON"
			},

			// Data converters
			// Keys separate source (or catchall "*") and destination types with a single space
			converters: {

				// Convert anything to text
				"* text": String,

				// Text to html (true = no transformation)
				"text html": true,

				// Evaluate text as a json expression
				"text json": JSON.parse,

				// Parse text as xml
				"text xml": jQuery.parseXML
			},

			// For options that shouldn't be deep extended:
			// you can add your own custom options here if
			// and when you create one that shouldn't be
			// deep extended (see ajaxExtend)
			flatOptions: {
				url: true,
				context: true
			}
		},

		// Creates a full fledged settings object into target
		// with both ajaxSettings and settings fields.
		// If target is omitted, writes into ajaxSettings.
		ajaxSetup: function ajaxSetup(target, settings) {
			return settings ?

			// Building a settings object
			ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :

			// Extending ajaxSettings
			ajaxExtend(jQuery.ajaxSettings, target);
		},

		ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
		ajaxTransport: addToPrefiltersOrTransports(transports),

		// Main method
		ajax: function ajax(url, options) {

			// If url is an object, simulate pre-1.5 signature
			if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") {
				options = url;
				url = undefined;
			}

			// Force options to be an object
			options = options || {};

			var transport,


			// URL without anti-cache param
			cacheURL,


			// Response headers
			responseHeadersString,
			    responseHeaders,


			// timeout handle
			timeoutTimer,


			// Url cleanup var
			urlAnchor,


			// Request state (becomes false upon send and true upon completion)
			completed,


			// To know if global events are to be dispatched
			fireGlobals,


			// Loop variable
			i,


			// uncached part of the url
			uncached,


			// Create the final options object
			s = jQuery.ajaxSetup({}, options),


			// Callbacks context
			callbackContext = s.context || s,


			// Context for global events is callbackContext if it is a DOM node or jQuery collection
			globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,


			// Deferreds
			deferred = jQuery.Deferred(),
			    completeDeferred = jQuery.Callbacks("once memory"),


			// Status-dependent callbacks
			_statusCode = s.statusCode || {},


			// Headers (they are sent all at once)
			requestHeaders = {},
			    requestHeadersNames = {},


			// Default abort message
			strAbort = "canceled",


			// Fake xhr
			jqXHR = {
				readyState: 0,

				// Builds headers hashtable if needed
				getResponseHeader: function getResponseHeader(key) {
					var match;
					if (completed) {
						if (!responseHeaders) {
							responseHeaders = {};
							while (match = rheaders.exec(responseHeadersString)) {
								responseHeaders[match[1].toLowerCase()] = match[2];
							}
						}
						match = responseHeaders[key.toLowerCase()];
					}
					return match == null ? null : match;
				},

				// Raw string
				getAllResponseHeaders: function getAllResponseHeaders() {
					return completed ? responseHeadersString : null;
				},

				// Caches the header
				setRequestHeader: function setRequestHeader(name, value) {
					if (completed == null) {
						name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
						requestHeaders[name] = value;
					}
					return this;
				},

				// Overrides response content-type header
				overrideMimeType: function overrideMimeType(type) {
					if (completed == null) {
						s.mimeType = type;
					}
					return this;
				},

				// Status-dependent callbacks
				statusCode: function statusCode(map) {
					var code;
					if (map) {
						if (completed) {

							// Execute the appropriate callbacks
							jqXHR.always(map[jqXHR.status]);
						} else {

							// Lazy-add the new callbacks in a way that preserves old ones
							for (code in map) {
								_statusCode[code] = [_statusCode[code], map[code]];
							}
						}
					}
					return this;
				},

				// Cancel the request
				abort: function abort(statusText) {
					var finalText = statusText || strAbort;
					if (transport) {
						transport.abort(finalText);
					}
					done(0, finalText);
					return this;
				}
			};

			// Attach deferreds
			deferred.promise(jqXHR);

			// Add protocol if not provided (prefilters might expect it)
			// Handle falsy url in the settings object (#10093: consistency with old signature)
			// We also use the url parameter if available
			s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");

			// Alias method option to type as per ticket #12004
			s.type = options.method || options.type || s.method || s.type;

			// Extract dataTypes list
			s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];

			// A cross-domain request is in order when the origin doesn't match the current origin.
			if (s.crossDomain == null) {
				urlAnchor = document.createElement("a");

				// Support: IE <=8 - 11, Edge 12 - 15
				// IE throws exception on accessing the href property if url is malformed,
				// e.g. http://example.com:80x/
				try {
					urlAnchor.href = s.url;

					// Support: IE <=8 - 11 only
					// Anchor's host property isn't correctly set when s.url is relative
					urlAnchor.href = urlAnchor.href;
					s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
				} catch (e) {

					// If there is an error parsing the URL, assume it is crossDomain,
					// it can be rejected by the transport if it is invalid
					s.crossDomain = true;
				}
			}

			// Convert data if not already a string
			if (s.data && s.processData && typeof s.data !== "string") {
				s.data = jQuery.param(s.data, s.traditional);
			}

			// Apply prefilters
			inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);

			// If request was aborted inside a prefilter, stop there
			if (completed) {
				return jqXHR;
			}

			// We can fire global events as of now if asked to
			// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
			fireGlobals = jQuery.event && s.global;

			// Watch for a new set of requests
			if (fireGlobals && jQuery.active++ === 0) {
				jQuery.event.trigger("ajaxStart");
			}

			// Uppercase the type
			s.type = s.type.toUpperCase();

			// Determine if request has content
			s.hasContent = !rnoContent.test(s.type);

			// Save the URL in case we're toying with the If-Modified-Since
			// and/or If-None-Match header later on
			// Remove hash to simplify url manipulation
			cacheURL = s.url.replace(rhash, "");

			// More options handling for requests with no content
			if (!s.hasContent) {

				// Remember the hash so we can put it back
				uncached = s.url.slice(cacheURL.length);

				// If data is available and should be processed, append data to url
				if (s.data && (s.processData || typeof s.data === "string")) {
					cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;

					// #9682: remove data so that it's not used in an eventual retry
					delete s.data;
				}

				// Add or update anti-cache param if needed
				if (s.cache === false) {
					cacheURL = cacheURL.replace(rantiCache, "$1");
					uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached;
				}

				// Put hash and anti-cache on the URL that will be requested (gh-1732)
				s.url = cacheURL + uncached;

				// Change '%20' to '+' if this is encoded form body content (gh-2658)
			} else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
				s.data = s.data.replace(r20, "+");
			}

			// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
			if (s.ifModified) {
				if (jQuery.lastModified[cacheURL]) {
					jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
				}
				if (jQuery.etag[cacheURL]) {
					jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
				}
			}

			// Set the correct header, if data is being sent
			if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
				jqXHR.setRequestHeader("Content-Type", s.contentType);
			}

			// Set the Accepts header for the server, depending on the dataType
			jqXHR.setRequestHeader("Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]);

			// Check for headers option
			for (i in s.headers) {
				jqXHR.setRequestHeader(i, s.headers[i]);
			}

			// Allow custom headers/mimetypes and early abort
			if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {

				// Abort if not done already and return
				return jqXHR.abort();
			}

			// Aborting is no longer a cancellation
			strAbort = "abort";

			// Install callbacks on deferreds
			completeDeferred.add(s.complete);
			jqXHR.done(s.success);
			jqXHR.fail(s.error);

			// Get transport
			transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);

			// If no transport, we auto-abort
			if (!transport) {
				done(-1, "No Transport");
			} else {
				jqXHR.readyState = 1;

				// Send global event
				if (fireGlobals) {
					globalEventContext.trigger("ajaxSend", [jqXHR, s]);
				}

				// If request was aborted inside ajaxSend, stop there
				if (completed) {
					return jqXHR;
				}

				// Timeout
				if (s.async && s.timeout > 0) {
					timeoutTimer = window.setTimeout(function () {
						jqXHR.abort("timeout");
					}, s.timeout);
				}

				try {
					completed = false;
					transport.send(requestHeaders, done);
				} catch (e) {

					// Rethrow post-completion exceptions
					if (completed) {
						throw e;
					}

					// Propagate others as results
					done(-1, e);
				}
			}

			// Callback for when everything is done
			function done(status, nativeStatusText, responses, headers) {
				var isSuccess,
				    success,
				    error,
				    response,
				    modified,
				    statusText = nativeStatusText;

				// Ignore repeat invocations
				if (completed) {
					return;
				}

				completed = true;

				// Clear timeout if it exists
				if (timeoutTimer) {
					window.clearTimeout(timeoutTimer);
				}

				// Dereference transport for early garbage collection
				// (no matter how long the jqXHR object will be used)
				transport = undefined;

				// Cache response headers
				responseHeadersString = headers || "";

				// Set readyState
				jqXHR.readyState = status > 0 ? 4 : 0;

				// Determine if successful
				isSuccess = status >= 200 && status < 300 || status === 304;

				// Get response data
				if (responses) {
					response = ajaxHandleResponses(s, jqXHR, responses);
				}

				// Convert no matter what (that way responseXXX fields are always set)
				response = ajaxConvert(s, response, jqXHR, isSuccess);

				// If successful, handle type chaining
				if (isSuccess) {

					// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
					if (s.ifModified) {
						modified = jqXHR.getResponseHeader("Last-Modified");
						if (modified) {
							jQuery.lastModified[cacheURL] = modified;
						}
						modified = jqXHR.getResponseHeader("etag");
						if (modified) {
							jQuery.etag[cacheURL] = modified;
						}
					}

					// if no content
					if (status === 204 || s.type === "HEAD") {
						statusText = "nocontent";

						// if not modified
					} else if (status === 304) {
						statusText = "notmodified";

						// If we have data, let's convert it
					} else {
						statusText = response.state;
						success = response.data;
						error = response.error;
						isSuccess = !error;
					}
				} else {

					// Extract error from statusText and normalize for non-aborts
					error = statusText;
					if (status || !statusText) {
						statusText = "error";
						if (status < 0) {
							status = 0;
						}
					}
				}

				// Set data for the fake xhr object
				jqXHR.status = status;
				jqXHR.statusText = (nativeStatusText || statusText) + "";

				// Success/Error
				if (isSuccess) {
					deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
				} else {
					deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
				}

				// Status-dependent callbacks
				jqXHR.statusCode(_statusCode);
				_statusCode = undefined;

				if (fireGlobals) {
					globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
				}

				// Complete
				completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);

				if (fireGlobals) {
					globalEventContext.trigger("ajaxComplete", [jqXHR, s]);

					// Handle the global AJAX counter
					if (! --jQuery.active) {
						jQuery.event.trigger("ajaxStop");
					}
				}
			}

			return jqXHR;
		},

		getJSON: function getJSON(url, data, callback) {
			return jQuery.get(url, data, callback, "json");
		},

		getScript: function getScript(url, callback) {
			return jQuery.get(url, undefined, callback, "script");
		}
	});

	jQuery.each(["get", "post"], function (i, method) {
		jQuery[method] = function (url, data, callback, type) {

			// Shift arguments if data argument was omitted
			if (isFunction(data)) {
				type = type || callback;
				callback = data;
				data = undefined;
			}

			// The url can be an options object (which then must have .url)
			return jQuery.ajax(jQuery.extend({
				url: url,
				type: method,
				dataType: type,
				data: data,
				success: callback
			}, jQuery.isPlainObject(url) && url));
		};
	});

	jQuery._evalUrl = function (url) {
		return jQuery.ajax({
			url: url,

			// Make this explicit, since user can override this through ajaxSetup (#11264)
			type: "GET",
			dataType: "script",
			cache: true,
			async: false,
			global: false,
			"throws": true
		});
	};

	jQuery.fn.extend({
		wrapAll: function wrapAll(html) {
			var wrap;

			if (this[0]) {
				if (isFunction(html)) {
					html = html.call(this[0]);
				}

				// The elements to wrap the target around
				wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);

				if (this[0].parentNode) {
					wrap.insertBefore(this[0]);
				}

				wrap.map(function () {
					var elem = this;

					while (elem.firstElementChild) {
						elem = elem.firstElementChild;
					}

					return elem;
				}).append(this);
			}

			return this;
		},

		wrapInner: function wrapInner(html) {
			if (isFunction(html)) {
				return this.each(function (i) {
					jQuery(this).wrapInner(html.call(this, i));
				});
			}

			return this.each(function () {
				var self = jQuery(this),
				    contents = self.contents();

				if (contents.length) {
					contents.wrapAll(html);
				} else {
					self.append(html);
				}
			});
		},

		wrap: function wrap(html) {
			var htmlIsFunction = isFunction(html);

			return this.each(function (i) {
				jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
			});
		},

		unwrap: function unwrap(selector) {
			this.parent(selector).not("body").each(function () {
				jQuery(this).replaceWith(this.childNodes);
			});
			return this;
		}
	});

	jQuery.expr.pseudos.hidden = function (elem) {
		return !jQuery.expr.pseudos.visible(elem);
	};
	jQuery.expr.pseudos.visible = function (elem) {
		return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
	};

	jQuery.ajaxSettings.xhr = function () {
		try {
			return new window.XMLHttpRequest();
		} catch (e) {}
	};

	var xhrSuccessStatus = {

		// File protocol always yields status code 0, assume 200
		0: 200,

		// Support: IE <=9 only
		// #1450: sometimes IE returns 1223 when it should be 204
		1223: 204
	},
	    xhrSupported = jQuery.ajaxSettings.xhr();

	support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
	support.ajax = xhrSupported = !!xhrSupported;

	jQuery.ajaxTransport(function (options) {
		var _callback, errorCallback;

		// Cross domain only allowed if supported through XMLHttpRequest
		if (support.cors || xhrSupported && !options.crossDomain) {
			return {
				send: function send(headers, complete) {
					var i,
					    xhr = options.xhr();

					xhr.open(options.type, options.url, options.async, options.username, options.password);

					// Apply custom fields if provided
					if (options.xhrFields) {
						for (i in options.xhrFields) {
							xhr[i] = options.xhrFields[i];
						}
					}

					// Override mime type if needed
					if (options.mimeType && xhr.overrideMimeType) {
						xhr.overrideMimeType(options.mimeType);
					}

					// X-Requested-With header
					// For cross-domain requests, seeing as conditions for a preflight are
					// akin to a jigsaw puzzle, we simply never set it to be sure.
					// (it can always be set on a per-request basis or even using ajaxSetup)
					// For same-domain requests, won't change header if already provided.
					if (!options.crossDomain && !headers["X-Requested-With"]) {
						headers["X-Requested-With"] = "XMLHttpRequest";
					}

					// Set headers
					for (i in headers) {
						xhr.setRequestHeader(i, headers[i]);
					}

					// Callback
					_callback = function callback(type) {
						return function () {
							if (_callback) {
								_callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;

								if (type === "abort") {
									xhr.abort();
								} else if (type === "error") {

									// Support: IE <=9 only
									// On a manual native abort, IE9 throws
									// errors on any property access that is not readyState
									if (typeof xhr.status !== "number") {
										complete(0, "error");
									} else {
										complete(

										// File: protocol always yields status 0; see #8605, #14207
										xhr.status, xhr.statusText);
									}
								} else {
									complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,

									// Support: IE <=9 only
									// IE9 has no XHR2 but throws on binary (trac-11426)
									// For XHR2 non-text, let the caller handle it (gh-2498)
									(xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
								}
							}
						};
					};

					// Listen to events
					xhr.onload = _callback();
					errorCallback = xhr.onerror = xhr.ontimeout = _callback("error");

					// Support: IE 9 only
					// Use onreadystatechange to replace onabort
					// to handle uncaught aborts
					if (xhr.onabort !== undefined) {
						xhr.onabort = errorCallback;
					} else {
						xhr.onreadystatechange = function () {

							// Check readyState before timeout as it changes
							if (xhr.readyState === 4) {

								// Allow onerror to be called first,
								// but that will not handle a native abort
								// Also, save errorCallback to a variable
								// as xhr.onerror cannot be accessed
								window.setTimeout(function () {
									if (_callback) {
										errorCallback();
									}
								});
							}
						};
					}

					// Create the abort callback
					_callback = _callback("abort");

					try {

						// Do send the request (this may raise an exception)
						xhr.send(options.hasContent && options.data || null);
					} catch (e) {

						// #14683: Only rethrow if this hasn't been notified as an error yet
						if (_callback) {
							throw e;
						}
					}
				},

				abort: function abort() {
					if (_callback) {
						_callback();
					}
				}
			};
		}
	});

	// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
	jQuery.ajaxPrefilter(function (s) {
		if (s.crossDomain) {
			s.contents.script = false;
		}
	});

	// Install script dataType
	jQuery.ajaxSetup({
		accepts: {
			script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
		},
		contents: {
			script: /\b(?:java|ecma)script\b/
		},
		converters: {
			"text script": function textScript(text) {
				jQuery.globalEval(text);
				return text;
			}
		}
	});

	// Handle cache's special case and crossDomain
	jQuery.ajaxPrefilter("script", function (s) {
		if (s.cache === undefined) {
			s.cache = false;
		}
		if (s.crossDomain) {
			s.type = "GET";
		}
	});

	// Bind script tag hack transport
	jQuery.ajaxTransport("script", function (s) {

		// This transport only deals with cross domain requests
		if (s.crossDomain) {
			var script, _callback2;
			return {
				send: function send(_, complete) {
					script = jQuery("<script>").prop({
						charset: s.scriptCharset,
						src: s.url
					}).on("load error", _callback2 = function callback(evt) {
						script.remove();
						_callback2 = null;
						if (evt) {
							complete(evt.type === "error" ? 404 : 200, evt.type);
						}
					});

					// Use native DOM manipulation to avoid our domManip AJAX trickery
					document.head.appendChild(script[0]);
				},
				abort: function abort() {
					if (_callback2) {
						_callback2();
					}
				}
			};
		}
	});

	var oldCallbacks = [],
	    rjsonp = /(=)\?(?=&|$)|\?\?/;

	// Default jsonp settings
	jQuery.ajaxSetup({
		jsonp: "callback",
		jsonpCallback: function jsonpCallback() {
			var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++;
			this[callback] = true;
			return callback;
		}
	});

	// Detect, normalize options and install callbacks for jsonp requests
	jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {

		var callbackName,
		    overwritten,
		    responseContainer,
		    jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s.data) && "data");

		// Handle iff the expected data type is "jsonp" or we have a parameter to set
		if (jsonProp || s.dataTypes[0] === "jsonp") {

			// Get callback name, remembering preexisting value associated with it
			callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;

			// Insert callback into url or form data
			if (jsonProp) {
				s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
			} else if (s.jsonp !== false) {
				s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
			}

			// Use data converter to retrieve json after script execution
			s.converters["script json"] = function () {
				if (!responseContainer) {
					jQuery.error(callbackName + " was not called");
				}
				return responseContainer[0];
			};

			// Force json dataType
			s.dataTypes[0] = "json";

			// Install callback
			overwritten = window[callbackName];
			window[callbackName] = function () {
				responseContainer = arguments;
			};

			// Clean-up function (fires after converters)
			jqXHR.always(function () {

				// If previous value didn't exist - remove it
				if (overwritten === undefined) {
					jQuery(window).removeProp(callbackName);

					// Otherwise restore preexisting value
				} else {
					window[callbackName] = overwritten;
				}

				// Save back as free
				if (s[callbackName]) {

					// Make sure that re-using the options doesn't screw things around
					s.jsonpCallback = originalSettings.jsonpCallback;

					// Save the callback name for future use
					oldCallbacks.push(callbackName);
				}

				// Call if it was a function and we have a response
				if (responseContainer && isFunction(overwritten)) {
					overwritten(responseContainer[0]);
				}

				responseContainer = overwritten = undefined;
			});

			// Delegate to script
			return "script";
		}
	});

	// Support: Safari 8 only
	// In Safari 8 documents created via document.implementation.createHTMLDocument
	// collapse sibling forms: the second one becomes a child of the first one.
	// Because of that, this security measure has to be disabled in Safari 8.
	// https://bugs.webkit.org/show_bug.cgi?id=137337
	support.createHTMLDocument = function () {
		var body = document.implementation.createHTMLDocument("").body;
		body.innerHTML = "<form></form><form></form>";
		return body.childNodes.length === 2;
	}();

	// Argument "data" should be string of html
	// context (optional): If specified, the fragment will be created in this context,
	// defaults to document
	// keepScripts (optional): If true, will include scripts passed in the html string
	jQuery.parseHTML = function (data, context, keepScripts) {
		if (typeof data !== "string") {
			return [];
		}
		if (typeof context === "boolean") {
			keepScripts = context;
			context = false;
		}

		var base, parsed, scripts;

		if (!context) {

			// Stop scripts or inline event handlers from being executed immediately
			// by using document.implementation
			if (support.createHTMLDocument) {
				context = document.implementation.createHTMLDocument("");

				// Set the base href for the created document
				// so any parsed elements with URLs
				// are based on the document's URL (gh-2965)
				base = context.createElement("base");
				base.href = document.location.href;
				context.head.appendChild(base);
			} else {
				context = document;
			}
		}

		parsed = rsingleTag.exec(data);
		scripts = !keepScripts && [];

		// Single tag
		if (parsed) {
			return [context.createElement(parsed[1])];
		}

		parsed = buildFragment([data], context, scripts);

		if (scripts && scripts.length) {
			jQuery(scripts).remove();
		}

		return jQuery.merge([], parsed.childNodes);
	};

	/**
  * Load a url into a page
  */
	jQuery.fn.load = function (url, params, callback) {
		var selector,
		    type,
		    response,
		    self = this,
		    off = url.indexOf(" ");

		if (off > -1) {
			selector = stripAndCollapse(url.slice(off));
			url = url.slice(0, off);
		}

		// If it's a function
		if (isFunction(params)) {

			// We assume that it's the callback
			callback = params;
			params = undefined;

			// Otherwise, build a param string
		} else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") {
			type = "POST";
		}

		// If we have elements to modify, make the request
		if (self.length > 0) {
			jQuery.ajax({
				url: url,

				// If "type" variable is undefined, then "GET" method will be used.
				// Make value of this field explicit since
				// user can override it through ajaxSetup method
				type: type || "GET",
				dataType: "html",
				data: params
			}).done(function (responseText) {

				// Save response for use in complete callback
				response = arguments;

				self.html(selector ?

				// If a selector was specified, locate the right elements in a dummy div
				// Exclude scripts to avoid IE 'Permission Denied' errors
				jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :

				// Otherwise use the full result
				responseText);

				// If the request succeeds, this function gets "data", "status", "jqXHR"
				// but they are ignored because response was set above.
				// If it fails, this function gets "jqXHR", "status", "error"
			}).always(callback && function (jqXHR, status) {
				self.each(function () {
					callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
				});
			});
		}

		return this;
	};

	// Attach a bunch of functions for handling common AJAX events
	jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
		jQuery.fn[type] = function (fn) {
			return this.on(type, fn);
		};
	});

	jQuery.expr.pseudos.animated = function (elem) {
		return jQuery.grep(jQuery.timers, function (fn) {
			return elem === fn.elem;
		}).length;
	};

	jQuery.offset = {
		setOffset: function setOffset(elem, options, i) {
			var curPosition,
			    curLeft,
			    curCSSTop,
			    curTop,
			    curOffset,
			    curCSSLeft,
			    calculatePosition,
			    position = jQuery.css(elem, "position"),
			    curElem = jQuery(elem),
			    props = {};

			// Set position first, in-case top/left are set even on static elem
			if (position === "static") {
				elem.style.position = "relative";
			}

			curOffset = curElem.offset();
			curCSSTop = jQuery.css(elem, "top");
			curCSSLeft = jQuery.css(elem, "left");
			calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;

			// Need to be able to calculate position if either
			// top or left is auto and position is either absolute or fixed
			if (calculatePosition) {
				curPosition = curElem.position();
				curTop = curPosition.top;
				curLeft = curPosition.left;
			} else {
				curTop = parseFloat(curCSSTop) || 0;
				curLeft = parseFloat(curCSSLeft) || 0;
			}

			if (isFunction(options)) {

				// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
				options = options.call(elem, i, jQuery.extend({}, curOffset));
			}

			if (options.top != null) {
				props.top = options.top - curOffset.top + curTop;
			}
			if (options.left != null) {
				props.left = options.left - curOffset.left + curLeft;
			}

			if ("using" in options) {
				options.using.call(elem, props);
			} else {
				curElem.css(props);
			}
		}
	};

	jQuery.fn.extend({

		// offset() relates an element's border box to the document origin
		offset: function offset(options) {

			// Preserve chaining for setter
			if (arguments.length) {
				return options === undefined ? this : this.each(function (i) {
					jQuery.offset.setOffset(this, options, i);
				});
			}

			var rect,
			    win,
			    elem = this[0];

			if (!elem) {
				return;
			}

			// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
			// Support: IE <=11 only
			// Running getBoundingClientRect on a
			// disconnected node in IE throws an error
			if (!elem.getClientRects().length) {
				return { top: 0, left: 0 };
			}

			// Get document-relative position by adding viewport scroll to viewport-relative gBCR
			rect = elem.getBoundingClientRect();
			win = elem.ownerDocument.defaultView;
			return {
				top: rect.top + win.pageYOffset,
				left: rect.left + win.pageXOffset
			};
		},

		// position() relates an element's margin box to its offset parent's padding box
		// This corresponds to the behavior of CSS absolute positioning
		position: function position() {
			if (!this[0]) {
				return;
			}

			var offsetParent,
			    offset,
			    doc,
			    elem = this[0],
			    parentOffset = { top: 0, left: 0 };

			// position:fixed elements are offset from the viewport, which itself always has zero offset
			if (jQuery.css(elem, "position") === "fixed") {

				// Assume position:fixed implies availability of getBoundingClientRect
				offset = elem.getBoundingClientRect();
			} else {
				offset = this.offset();

				// Account for the *real* offset parent, which can be the document or its root element
				// when a statically positioned element is identified
				doc = elem.ownerDocument;
				offsetParent = elem.offsetParent || doc.documentElement;
				while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {

					offsetParent = offsetParent.parentNode;
				}
				if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {

					// Incorporate borders into its offset, since they are outside its content origin
					parentOffset = jQuery(offsetParent).offset();
					parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
					parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
				}
			}

			// Subtract parent offsets and element margins
			return {
				top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
				left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
			};
		},

		// This method will return documentElement in the following cases:
		// 1) For the element inside the iframe without offsetParent, this method will return
		//    documentElement of the parent window
		// 2) For the hidden or detached element
		// 3) For body or html element, i.e. in case of the html node - it will return itself
		//
		// but those exceptions were never presented as a real life use-cases
		// and might be considered as more preferable results.
		//
		// This logic, however, is not guaranteed and can change at any point in the future
		offsetParent: function offsetParent() {
			return this.map(function () {
				var offsetParent = this.offsetParent;

				while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
					offsetParent = offsetParent.offsetParent;
				}

				return offsetParent || documentElement;
			});
		}
	});

	// Create scrollLeft and scrollTop methods
	jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
		var top = "pageYOffset" === prop;

		jQuery.fn[method] = function (val) {
			return access(this, function (elem, method, val) {

				// Coalesce documents and windows
				var win;
				if (isWindow(elem)) {
					win = elem;
				} else if (elem.nodeType === 9) {
					win = elem.defaultView;
				}

				if (val === undefined) {
					return win ? win[prop] : elem[method];
				}

				if (win) {
					win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
				} else {
					elem[method] = val;
				}
			}, method, val, arguments.length);
		};
	});

	// Support: Safari <=7 - 9.1, Chrome <=37 - 49
	// Add the top/left cssHooks using jQuery.fn.position
	// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
	// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
	// getComputedStyle returns percent when specified for top/left/bottom/right;
	// rather than make the css module depend on the offset module, just check for it here
	jQuery.each(["top", "left"], function (i, prop) {
		jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
			if (computed) {
				computed = curCSS(elem, prop);

				// If curCSS returns percentage, fallback to offset
				return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
			}
		});
	});

	// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
	jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
		jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) {

			// Margin is only for outerHeight, outerWidth
			jQuery.fn[funcName] = function (margin, value) {
				var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
				    extra = defaultExtra || (margin === true || value === true ? "margin" : "border");

				return access(this, function (elem, type, value) {
					var doc;

					if (isWindow(elem)) {

						// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
						return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
					}

					// Get document width or height
					if (elem.nodeType === 9) {
						doc = elem.documentElement;

						// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
						// whichever is greatest
						return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
					}

					return value === undefined ?

					// Get width or height on the element, requesting but not forcing parseFloat
					jQuery.css(elem, type, extra) :

					// Set width or height on the element
					jQuery.style(elem, type, value, extra);
				}, type, chainable ? margin : undefined, chainable);
			};
		});
	});

	jQuery.each(("blur focus focusin focusout resize scroll click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup contextmenu").split(" "), function (i, name) {

		// Handle event binding
		jQuery.fn[name] = function (data, fn) {
			return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
		};
	});

	jQuery.fn.extend({
		hover: function hover(fnOver, fnOut) {
			return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
		}
	});

	jQuery.fn.extend({

		bind: function bind(types, data, fn) {
			return this.on(types, null, data, fn);
		},
		unbind: function unbind(types, fn) {
			return this.off(types, null, fn);
		},

		delegate: function delegate(selector, types, data, fn) {
			return this.on(types, selector, data, fn);
		},
		undelegate: function undelegate(selector, types, fn) {

			// ( namespace ) or ( selector, types [, fn] )
			return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
		}
	});

	// Bind a function to a context, optionally partially applying any
	// arguments.
	// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
	// However, it is not slated for removal any time soon
	jQuery.proxy = function (fn, context) {
		var tmp, args, proxy;

		if (typeof context === "string") {
			tmp = fn[context];
			context = fn;
			fn = tmp;
		}

		// Quick check to determine if target is callable, in the spec
		// this throws a TypeError, but we will just return undefined.
		if (!isFunction(fn)) {
			return undefined;
		}

		// Simulated bind
		args = _slice.call(arguments, 2);
		proxy = function proxy() {
			return fn.apply(context || this, args.concat(_slice.call(arguments)));
		};

		// Set the guid of unique handler to the same of original handler, so it can be removed
		proxy.guid = fn.guid = fn.guid || jQuery.guid++;

		return proxy;
	};

	jQuery.holdReady = function (hold) {
		if (hold) {
			jQuery.readyWait++;
		} else {
			jQuery.ready(true);
		}
	};
	jQuery.isArray = Array.isArray;
	jQuery.parseJSON = JSON.parse;
	jQuery.nodeName = nodeName;
	jQuery.isFunction = isFunction;
	jQuery.isWindow = isWindow;
	jQuery.camelCase = camelCase;
	jQuery.type = toType;

	jQuery.now = Date.now;

	jQuery.isNumeric = function (obj) {

		// As of jQuery 3.0, isNumeric is limited to
		// strings and numbers (primitives or objects)
		// that can be coerced to finite numbers (gh-2662)
		var type = jQuery.type(obj);
		return (type === "number" || type === "string") &&

		// parseFloat NaNs numeric-cast false positives ("")
		// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
		// subtraction forces infinities to NaN
		!isNaN(obj - parseFloat(obj));
	};

	// Register as a named AMD module, since jQuery can be concatenated with other
	// files that may use define, but not via a proper concatenation script that
	// understands anonymous AMD modules. A named AMD is safest and most robust
	// way to register. Lowercase jquery is used because AMD module names are
	// derived from file names, and jQuery is normally delivered in a lowercase
	// file name. Do this after creating the global so that if an AMD module wants
	// to call noConflict to hide this version of jQuery, it will work.

	// Note that for maximum portability, libraries that are not jQuery should
	// declare themselves as anonymous modules, and avoid setting a global if an
	// AMD loader is present. jQuery is a special case. For more information, see
	// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon

	if (true) {
		!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
			return jQuery;
		}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
	}

	var

	// Map over jQuery in case of overwrite
	_jQuery = window.jQuery,


	// Map over the $ in case of overwrite
	_$ = window.$;

	jQuery.noConflict = function (deep) {
		if (window.$ === jQuery) {
			window.$ = _$;
		}

		if (deep && window.jQuery === jQuery) {
			window.jQuery = _jQuery;
		}

		return jQuery;
	};

	// Expose jQuery and $ identifiers, even in AMD
	// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
	// and CommonJS for browser emulators (#13566)
	if (!noGlobal) {
		window.jQuery = window.$ = jQuery;
	}

	return jQuery;
});
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(175)(module)))

/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

/**
 *  File    : Utils.js
 *  Created : 01/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(135), __webpack_require__(208), __webpack_require__(206), __webpack_require__(176), __webpack_require__(204), __webpack_require__(205), __webpack_require__(209)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, screenfull, clipboard, i18next, JSZip, JSZipUtils, ScriptJS, WebFont) {

  // In some cases, require.js does not return a valid value for screenfull. Check it:
  if (!screenfull) screenfull = window.screenfull;

  /**
   * Returns the two-digits text expression representing the given number (lesser than 100) zero-padded at left
   * Useful for representing hours, minutes and seconds
   * @param {number} val - The number to be processed
   * @returns {string}
   */
  var _zp = function _zp(val) {
    return ("0" + val).slice(-2);
  };

  /**
   *
   * Miscellaneous utility functions and constants
   * @exports Utils
   * @class
   * @abstract
   */
  var Utils = {
    /**
     * Exports third-party NPM packages used by JClic, so they become available to other scripts through
     * the global variable `JClicObject` (defined in {@link JClic})
     * @example <caption>Example usage of JSZip through JClicObject</caption>
     * var WebFont = window.JClicObject.Utils.pkg.WebFont;
     * WebFont.load({google: {families: ['Roboto']}});
     * @type: {object} */
    pkg: {
      ClipboardJS: clipboard,
      i18next: i18next,
      $: $,
      JSZip: JSZip,
      JSZipUtils: JSZipUtils,
      ScriptJS: ScriptJS,
      WebFont: WebFont
    },
    /**
     * Function obtained from `i18next` that will return the translation of the provided key
     * into the current language.
     * The real function will be initiated by the constructor of `JClicPlayer`. Meanwhile, it returns always `key`.
     * @param {string} key - ID of the expression to be translated
     * @returns {string} - Translated text
     */
    getMsg: function getMsg(key) {
      return key;
    },
    /**
     * List of valid verbosity levels
     * @const {string[]} */
    LOG_LEVELS: ['none', 'error', 'warn', 'info', 'debug', 'trace', 'all'],
    /**
     * Labels printed on logs for each message type
     * @const {string[]}
     */
    LOG_PRINT_LABELS: ['     ', 'ERROR', 'WARN ', 'INFO ', 'DEBUG', 'TRACE', 'ALL  '],
    /**
     * Current verbosity level. Default is 2 (only error and warning messages are printed)
     * @type {number} */
    LOG_LEVEL: 2, // warn
    /**
     * Options of the logging system
     * @type {object} */
    LOG_OPTIONS: {
      prefix: 'JClic',
      timestamp: true,
      popupOnErrors: false,
      chainTo: null,
      pipeTo: null
    },
    /**
     * Initializes the global settings
     * @param {object} options - An object with global settings
     * @returns {object} The normalized `options` object
     */
    init: function init(options) {
      options = Utils.normalizeObject(options);
      if (typeof options.logLevel !== 'undefined') Utils.setLogLevel(options.logLevel);
      if (typeof options.chainLogTo === 'function') Utils.LOG_OPTIONS.chainTo = options.chainLogTo;
      if (typeof options.pipeLogTo === 'function') Utils.LOG_OPTIONS.pipeTo = options.pipeLogTo;
      return options;
    },
    /**
     * Establishes the current verbosity level of the logging system
     * @param {string} level - One of the valid strings in {@link Utils.LOG_LEVELS}
     */
    setLogLevel: function setLogLevel(level) {
      var log = Utils.LOG_LEVELS.indexOf(level);
      if (log >= 0) Utils.LOG_LEVEL = log;
    },
    /**
     * Reports a new message to the logging system
     * @param {string} type - The type of message. Mus be `error`, `warn`, `info`, `debug` or `trace`.
     * @param {string} msg - The main message to be logged. Additional parameters can be added, like
     * in `console.log` (see: {@link https://developer.mozilla.org/en-US/docs/Web/API/Console/log})
     */
    log: function log(type, msg) {
      var level = Utils.LOG_LEVELS.indexOf(type);
      var args = Array.prototype.slice.call(arguments);

      // Check if message should currently be logged
      if (level < 0 || level <= Utils.LOG_LEVEL) {
        if (Utils.LOG_OPTIONS.pipeTo) Utils.LOG_OPTIONS.pipeTo.apply(null, args);else {
          var mainMsg = (Utils.LOG_OPTIONS.prefix || '') + " " + Utils.LOG_PRINT_LABELS[level] + " " + (Utils.LOG_OPTIONS.timestamp ? Utils.getDateTime() : '') + " " + msg;
          console[level === 1 ? 'error' : level === 2 ? 'warn' : 'log'].apply(console, [mainMsg].concat(args.slice(2)));
          // Call chained logger, if anny
          if (Utils.LOG_OPTIONS.chainTo) Utils.LOG_OPTIONS.chainTo.apply(null, args);
        }
      }
    },
    /**
     * Gets a boolean value from a textual expression
     * @param {string} val - The value to be parsed (`true` for true, null or otherwise for `false`)
     * @param {boolean=} [defaultValue=false] - The default value to return when `val` is false
     * @returns {number}
     */
    getBoolean: function getBoolean(val) {
      var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
      return val === 'true' ? true : val === 'false' ? false : defaultValue;
    },
    /**
     * Gets a value from an given expression that can be `null`, `undefined` or empty string ('')
     * @param {?*} val - The expression to parse
     * @param {?*} [defaultValue=null] - The value to return when `val` is `null`, `''` or `undefined`
     * @returns {*}
     */
    getVal: function getVal(val) {
      var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
      return val === '' || val === null || typeof val === 'undefined' ? defaultValue : val;
    },
    /**
     * Gets a number from a string or another number
     * @param {?*} val - The expression to parse
     * @param {number} [defaultValue=0] - The default value
     * @returns {number}
     */
    getNumber: function getNumber(val, defaultValue) {
      return Number(Utils.getVal(val, defaultValue));
    },
    /**
     * Gets the plain percent expression (without decimals) of the given value
     * @param {number} val - The value to be expressed as a percentile
     * @returns {string}
     */
    getPercent: function getPercent(val) {
      return Math.round(val * 100) + "%";
    },
    /**
     * Returns a given time in [00h 00'00"] format
     * @param {number} millis - Amount of milliseconds to be processed
     * @returns {string}
     */
    getHMStime: function getHMStime(millis) {
      var d = new Date(millis);
      var h = d.getUTCHours(),
          m = d.getUTCMinutes(),
          s = d.getUTCSeconds();
      return "" + (h ? h + 'h ' : '') + (h || m ? _zp(m) + '\'' : '') + _zp(s) + "\"";
    },
    /**
     * Returns a formatted string with the provided date and time
     * @param {Date} date - The date to be formatted. When `null` or `undefined`, the current date will be used.
     * @returns {string}
     */
    getDateTime: function getDateTime() {
      var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
      return date.getFullYear() + "/" + _zp(date.getMonth() + 1) + "/" + _zp(date.getDate()) + " " + _zp(date.getHours()) + ":" + _zp(date.getMinutes()) + ":" + _zp(date.getSeconds());
    },
    /** @const {number} */
    'FALSE': 0,
    /** @const {number} */
    'TRUE': 1,
    /** @const {number} */
    'DEFAULT': 2,
    /**
     * Gets a numeric value (0, 1 or 2) from a set of possible values: `false`, `true` and `default`.
     * @param {?string} val - The text to be parsed
     * @returns {number}
     */
    getTriState: function getTriState(val) {
      return val === 'true' ? Utils.TRUE : val === 'false' ? Utils.FALSE : Utils.DEFAULT;
    },
    /**
     * Returns a string with the given `tag` repeated n times
     * @param {string} tag - The tag to be repeated
     * @param {number} repeats - The number of times to repeat the tag
     * @returns {string}
     */
    fillString: function fillString(tag) {
      var repeats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
      return Array(repeats).fill(tag).join('');
    },
    /**
     * Checks if the provided value is 'null' or 'undefined'.
     * @param {*} val - The value to be parsed
     * @returns {boolean}
     */
    isNullOrUndef: function isNullOrUndef(val) {
      return typeof val === 'undefined' || val === null;
    },
    /**
     * Checks if two expressions are equivalent.
     * Returns `true` when both parameters are `null` or `undefined`, and also when both have
     * equivalent values.
     * @param {!*} a
     * @param {!*} b
     * @returns {boolean}
     */
    isEquivalent: function isEquivalent(a, b) {
      return (typeof a === 'undefined' || a === null) && (typeof b === 'undefined' || b === null) || a === b;
    },
    /**
     * Reads paragraphs, identified by `<p></p>` elements, inside XML data
     * @param {object} xml - The DOM-XML element to be parsed
     * @returns {string}
     */
    getXmlText: function getXmlText(xml) {
      var text = '';
      $(xml).children('p').each(function (_n, child) {
        text += "<p>" + child.textContent + "</p>";
      });
      return text;
    },
    /**
     * Parses the provided XML element node, returning a complex object
     * @param {object} xml - The root XML element to parse
     * @returns {object}
     */
    parseXmlNode: function parseXmlNode(xml) {
      // Initialize the resulting object
      var result = {};
      // Direct copy of root element attributes as object properties
      if (xml.attributes) Utils.attrForEach(xml.attributes, function (name, value) {
        return result[name] = /^-?\d*$/.test(value) ? Number(value) : value;
      });
      // Process children elements
      var keys = [];
      for (var n = 0; n < xml.children.length; n++) {
        var child = xml.children[n];
        // Recursive processing of children
        var ch = Utils.parseXmlNode(child);
        // Store the result into a temporary object named as the child node name,
        if (!result[child.nodeName]) {
          // Create object and save key for later processing
          result[child.nodeName] = {};
          keys.push(child.nodeName);
        }
        // Use 'id' (or an incremental number if 'id' is not set) as a key
        if (ch.id) result[child.nodeName][ch.id] = ch;else {
          var _n2 = Object.keys(result[child.nodeName]).length;
          result[child.nodeName][_n2] = ch;
        }
      }
      // Check temporary objects, converting it to an array, a single object or a complex object
      keys.forEach(function (k) {
        // Retrieve temporary object from `keys`
        var kx = Object.keys(result[k]);
        // If all keys are numbers, convert object into an array (or leave it as a single object)
        if (!kx.find(function (kk) {
          return isNaN(kk);
        })) {
          if (kx.length === 1)
            // Array with a single element. Leave it as a simple object:
            result[k] = result[k][0];else {
            // Object with numeric keys. Convert it to array:
            var arr = [];
            kx.forEach(function (kk) {
              return arr.push(result[k][kk]);
            });
            result[k] = arr;
          }
        }
      });
      // Save text content, if any:
      if (xml.children.length === 0 && xml.textContent) result.textContent = xml.textContent;
      return result;
    },
    /**
     * Creates a string suitable to be used in the 'style' attribute of HTML tags, filled with the
     * CSS attributes contained in the provided object.
     * @param {object} cssObj
     * @returns {string}
     */
    cssToString: function cssToString(cssObj) {
      return Object.keys(cssObj).reduce(function (s, key) {
        return "" + s + key + ":" + cssObj[key] + ";";
      }, '');
    },
    /**
     * Converts java-like color codes (like '0xRRGGBB') to valid CSS values like '#RRGGBB' or 'rgba(r,g,b,a)'
     * @param {string=} color - A color, as codified in Java
     * @param {string=} defaultColor - The default color to be used
     * @returns {string}
     */
    checkColor: function checkColor(color) {
      var defaultColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Utils.settings.BoxBase.BACK_COLOR;

      if (typeof color === 'undefined' || color === null) color = defaultColor;
      color = color.replace('0x', '#');
      // Check for Alpha value
      if (color.charAt(0) === '#' && color.length > 7) {
        var alpha = parseInt(color.substring(1, 3), 16) / 255.0;
        color = "rgba(" + parseInt(color.substring(3, 5), 16) + "," + parseInt(color.substring(5, 7), 16) + "," + parseInt(color.substring(7, 9), 16) + "," + alpha + ")";
      }
      return color;
    },
    /**
     * Checks if the provided color has an alpha value less than 1
     * @param {string} color - The color to be analyzed
     * @returns {boolean}
     */
    colorHasTransparency: function colorHasTransparency(color) {
      if (Utils.startsWith(color, 'rgba(')) {
        var alpha = parseInt(color.substr(color.lastIndexOf(',')));
        return typeof alpha === 'number' && alpha < 1.0;
      }
      return false;
    },
    /**
     * Clones the provided object
     * See: https://stackoverflow.com/questions/41474986/how-to-clone-a-javascript-es6-class-instance
     * @param {object} obj
     * @returns {object}
     */
    //cloneObject: obj => Object.assign(Object.create(Object.getPrototypeOf(obj)), obj),
    cloneObject: function cloneObject(obj) {
      return $.extend(true, Object.create(Object.getPrototypeOf(obj)), obj);
    },
    /**
     * Converts string values to number or boolean when needed
     * @param {Object} obj - The object to be processed
     * @returns {Object} - A new object with normalized content
     */
    normalizeObject: function normalizeObject(obj) {
      var result = {};
      if (obj) $.each(obj, function (key, value) {
        var s = void 0;
        if (typeof value === 'string' && (s = value.trim().toLowerCase()) !== '') value = s === 'true' ? true : s === 'false' ? false : isNaN(s) ? value : Number(s);
        result[key] = value;
      });
      return result;
    },
    /**
     * Check if the given char is a separator
     * @param {string} ch - A string with a single character
     * @returns {boolean}
     */
    isSeparator: function isSeparator(ch) {
      return ' .,;-|'.includes(ch);
    },
    /**
     * Rounds `v` to the nearest multiple of `n`
     * @param {number} v
     * @param {number} n - Cannot be zero!
     * @returns {number}
     */
    roundTo: function roundTo(v, n) {
      return Math.round(v / n) * n;
    },
    /**
     * Compares the provided answer against multiple valid options. These valid options are
     * concatenated in a string, separated by pipe chars (`|`). The comparing can be case sensitive.
     * @param {string} answer - The text to check against to
     * @param {string} check - String containing one or multiple options, separated by `|`
     * @param {boolean} checkCase - When true, the comparing will be case-sensitive
     * @returns {boolean}
     */
    compareMultipleOptions: function compareMultipleOptions(answer, check, checkCase) {
      if (answer === null || answer.length === 0 || check === null || check.length === 0) return false;
      if (!checkCase) answer = answer.toUpperCase();
      answer = answer.trim();
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = check.split('|')[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var token = _step.value;

          if (answer === (checkCase ? token : token.toUpperCase()).trim()) return true;
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      return false;
    },
    /**
     * Checks if the given string ends with the specified expression
     * @param {string} text - The string where to find the expression
     * @param {string} expr - The expression to search for.
     * @param {boolean=} trim - When `true`, the `text` string will be trimmed before check
     * @returns {boolean}
     */
    endsWith: function endsWith() {
      var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
      var expr = arguments[1];
      var trim = arguments[2];
      return typeof text === 'string' && (trim ? text.trim() : text).endsWith(expr);
    },
    /**
     * Checks if the given string starts with the specified expression
     * @param {string} text - The string where to find the expression
     * @param {string} expr - The expression to search for.
     * @param {boolean=} trim - When `true`, the `text` string will be trimmed before check
     * @returns {boolean}
     */
    startsWith: function startsWith() {
      var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
      var expr = arguments[1];
      var trim = arguments[2];
      return typeof text === 'string' && (trim ? text.trim() : text).indexOf(expr) === 0;
    },
    /**
     * Replaces all occurrences of the backslash character (`\`) by a regular slash (`/`)
     * This is useful to normalize bad path names present in some old JClic projects
     * @param {String} str - The string to be normalized
     * @returns {string}
     */
    nSlash: function nSlash(str) {
      return str ? str.replace(/\\/g, '/') : str;
    },
    /**
     * Checks if the given expression is an absolute URL
     * @param {string} exp - The expression to be checked
     * @returns {boolean}
     */
    isURL: function isURL(exp) {
      return (/^(filesystem:)?(https?|file|data|ftps?):/i.test(exp)
      );
    },
    /**
     * Gets the base path of the given file path (absolute or full URL). This base path always ends
     * with `/`, meaning it can be concatenated with relative paths without adding a separator.
     * @param {type} path - The full path to be parsed
     * @returns {string}
     */
    getBasePath: function getBasePath(path) {
      var p = path.lastIndexOf('/');
      return p >= 0 ? path.substring(0, p + 1) : '';
    },
    /**
     * Gets the full path of `file` relative to `basePath`
     * @param {string} file - The file name
     * @param {string=} path - The base path
     * @returns {string}
     */
    getRelativePath: function getRelativePath(file, path) {
      return !path || path === '' || file.indexOf(path) !== 0 ? file : file.substr(path.length);
    },
    /**
     * Gets the complete path of a relative or absolute URL, using the provided `basePath`
     * @param {string} basePath - The base URL
     * @param {string} path - The filename
     * @returns {string}
     */
    getPath: function getPath(basePath, path) {
      return Utils.isURL(path) ? path : basePath + path;
    },
    /**
     * Gets a promise with the complete path of a relative or absolute URL, using the provided `basePath`
     * @param {string} basePath - The base URL
     * @param {string} path - The filename
     * @param {?external:JSZip} zip - An optional {@link external:JSZip} object where to look
     * for the file
     * @returns {Promise}
     */
    getPathPromise: function getPathPromise(basePath, path, zip) {
      if (zip) {
        var fName = Utils.getRelativePath(basePath + path, zip.zipBasePath);
        if (zip.files[fName]) {
          return new Promise(function (resolve, reject) {
            zip.file(fName).async('base64').then(function (data) {
              var ext = path.toLowerCase().split('.').pop();
              var mime = Utils.settings.MIME_TYPES[ext] || 'application/octet-stream';
              resolve("data:" + mime + ";base64," + data);
            }).catch(reject);
          });
        }
      }
      return Promise.resolve(Utils.getPath(basePath, path));
    },
    /**
     * Utility object that provides several methods to build simple and complex DOM objects
     * @type {object}
     */
    $HTML: {
      doubleCell: function doubleCell(a, b) {
        return $('<tr/>').append($('<td/>').html(a)).append($('<td/>').html(b));
      },
      p: function p(txt) {
        return $('<p/>').html(txt);
      },
      td: function td(txt, className) {
        return $('<td/>', className ? { class: className } : null).html(txt);
      },
      th: function th(txt, className) {
        return $('<th/>', className ? { class: className } : null).html(txt);
      }
    },
    /**
     * Checks if the current browser allows to put HTML elements in full screen mode
     * @returns {boolean}
     */
    screenFullAllowed: function screenFullAllowed() {
      return screenfull && screenfull.enabled;
    },
    /**
     * Replaces `width`, `height` and `fill` attributes of a simple SVG image
     * with the provided values
     * @param {string} svg - The SVG image as XML string
     * @param {string=} width - Optional setting for "width" property
     * @param {string=} height - Optional setting for "height" property
     * @param {string=} fill - Optional setting for "fill" property
     * @returns {string} - The resulting svg code
     */
    getSvg: function getSvg(svg, width, height, fill) {
      if (width) svg = svg.replace(/width=\"\d*\"/, "width=\"" + width + "\"");
      if (height) svg = svg.replace(/height=\"\d*\"/, "height=\"" + height + "\"");
      if (fill) svg = svg.replace(/fill=\"[#A-Za-z0-9]*\"/, "fill=\"" + fill + "\"");
      return svg;
    },
    /**
     * Encodes a svg expression into a {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs|data URI}
     * suitable for the `src` property of `img` elements, optionally changing its original size and fill values.
     * @param {string} svg - The SVG image as XML string
     * @param {string=} width - Optional setting for "width" property
     * @param {string=} height - Optional setting for "height" property
     * @param {string=} fill - Optional setting for "fill" property
     * @returns {string} - The resulting Data URI
     */
    svgToURI: function svgToURI(svg, width, height, fill) {
      return 'data:image/svg+xml;base64,' + btoa(Utils.getSvg(svg, width, height, fill));
    },
    /**
     * Converts the given expression into a valid value for CSS size values
     * @param {string|number} exp - The expression to be evaluated (can be a valid value, `null` or `undefined`)
     * @param {Object} css - An optional Object where the resulting expression (if any) will be saved
     * @param {string} key - The key under which the result will be stored in `css`
     * @param {string} def - Default value to be used when `exp` is `null` or `undefined`
     * @returns {string} - A valid CSS value, or `null` if it can't be found. Default units are `px`
     */
    toCssSize: function toCssSize(exp, css, key, def) {
      var result = typeof exp === 'undefined' || exp === null ? null : isNaN(exp) ? exp : exp + "px";
      if (css && key && (result || def)) css[key] = result !== null ? result : def;
      return result;
    },
    /**
     * Gets a clip of the give image data, in a URL base64 encoded format
     * @param {object} img - The binary data of the realized image, usually obtained from a {@link MediaBagElement}
     * @param {AWT.Rectangle} rect - A rectangle containing the requested clip
     * @returns {string} - The URL with the image clip, as a PNG file encoded in base64
     */
    getImgClipUrl: function getImgClipUrl(img, rect) {
      var canvas = document.createElement('canvas');
      canvas.width = rect.dim.width;
      canvas.height = rect.dim.height;
      var ctx = canvas.getContext('2d');
      var result = '';
      try {
        ctx.drawImage(img, rect.pos.x, rect.pos.y, rect.dim.width, rect.dim.height, 0, 0, rect.dim.width, rect.dim.height);
        result = canvas.toDataURL();
      } catch (err) {
        // catch 'tainted canvases may not be exported' and other errors
        Utils.log('error', err);
      }
      return result;
    },
    /**
     * Finds the nearest `head` or root node of a given HTMLElement, useful to place `<style/>` elements when
     * the main component of JClic is behind a shadow-root.
     * This method will be replaced by a call to [Node.getRootNode()](https://developer.mozilla.org/en-US/docs/Web/API/Node/getRootNode)
     * when fully supported by all major browsers.
     * @param {Node=} el - The element from which to start the search
     * @returns {Node}
     */
    getRootHead: function getRootHead(el) {
      if (el) {
        // Skip HTMLElements
        while (el.parentElement) {
          el = el.parentElement;
        } // Get the parent node of the last HTMLElement
        if (el instanceof HTMLElement) el = el.parentNode || el;
        // If the root node has a `head`, take it
        el = el['head'] || el;
      }
      return el || document.head;
    },
    /**
     * Appends a stylesheet element to the `head` or root node nearest to the given `HTMLElement`.
     * @param {String} css - The content of the stylesheet
     * @param {PlayStation=} ps - An optional `PlayStation` (currently a {@link JClicPlayer}) used as a base to find the root node
     * @returns {HTMLStyleElement} - The appended style element
     */
    appendStyleAtHead: function appendStyleAtHead(css, ps) {
      var root = Utils.getRootHead(ps && ps.$topDiv ? ps.$topDiv[0] : null);
      var style = document.createElement('style');
      style.type = 'text/css';
      style.appendChild(document.createTextNode(css));
      return root.appendChild(style);
    },
    /**
     * Traverses all the attributes defined in an Element, calling a function with its name and value as a parameters
     * @param {external:NamedNodeMap} attributes - The [Element.attributes](https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes)
     * object to be traversed
     * @param {function} callback - The function to be called for each [Attr](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap)
     * object. It should take two parametres: `name` and `value`
     */
    attrForEach: function attrForEach(attributes, callback) {
      for (var i = 0; i < attributes.length; i++) {
        callback(attributes[i].name, attributes[i].value);
      }
    },

    /**
     * Global constants
     * @const
     */
    settings: {
      // layout constants
      AB: 0, BA: 1, AUB: 2, BUA: 3,
      LAYOUT_NAMES: ['AB', 'BA', 'AUB', 'BUA'],
      DEFAULT_WIDTH: 400,
      DEFAULT_HEIGHT: 300,
      MINIMUM_WIDTH: 40,
      MINIMUM_HEIGHT: 40,
      DEFAULT_NAME: '---',
      DEFAULT_MARGIN: 8,
      DEFAULT_SHUFFLES: 31,
      DEFAULT_GRID_ELEMENT_SIZE: 20,
      MIN_CELL_SIZE: 10,
      //DEFAULT_BG_COLOR: '#D3D3D3', // LightGray
      DEFAULT_BG_COLOR: '#C0C0C0', // LightGray
      ACTIONS: {
        ACTION_MATCH: 'MATCH', ACTION_PLACE: 'PLACE',
        ACTION_WRITE: 'WRITE', ACTION_SELECT: 'SELECT', ACTION_HELP: 'HELP'
      },
      PREVIOUS: 0, MAIN: 1, END: 2, END_ERROR: 3, NUM_MSG: 4,
      MSG_TYPE: ['previous', 'initial', 'final', 'finalError'],
      RANDOM_CHARS: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
      NUM_COUNTERS: 3,
      MAX_RECORD_LENGTH: 20,
      // BoxBase defaults
      BoxBase: {
        REDUCE_FONT_STEP: 1.0,
        MIN_FONT_SIZE: 8,
        STROKE: 1,
        AC_MARGIN: 6,
        //BACK_COLOR: 'lightgray',
        BACK_COLOR: '#C0C0C0',
        TEXT_COLOR: 'black',
        SHADOW_COLOR: 'gray',
        INACTIVE_COLOR: 'gray',
        ALTERNATIVE_COLOR: 'gray',
        BORDER_COLOR: 'black',
        BORDER_STROKE_WIDTH: 0.75,
        MARKER_STROKE_WIDTH: 2.75
      },
      FILE_TYPES: {
        image: 'gif,jpg,png,jpeg,bmp,ico,svg',
        audio: 'wav,mp3,ogg,oga,au,aiff,flac',
        video: 'avi,mov,mpeg,mp4,ogv,m4v,webm',
        font: 'ttf,otf,eot,woff,woff2',
        midi: 'mid,midi',
        anim: 'swf',
        // Used in custom skins
        xml: 'xml'
      },
      MIME_TYPES: {
        xml: 'text/xml',
        gif: 'image/gif',
        jpg: 'image/jpeg',
        jpeg: 'image/jpeg',
        png: 'image/png',
        bmp: 'image/bmp',
        svg: 'image/svg+xml',
        ico: 'image/x-icon',
        wav: 'audio/wav',
        mp3: 'audio/mpeg',
        mp4: 'video/mp4',
        m4v: 'video/mp4',
        ogg: 'audio/ogg',
        oga: 'audio/ogg',
        ogv: 'video/ogg',
        webm: 'video/webm',
        au: 'audio/basic',
        aiff: 'audio/x-aiff',
        flac: 'audio/flac',
        avi: 'video/avi',
        mov: 'video/quicktime',
        mpeg: 'video/mpeg',
        ttf: 'application/font-sfnt',
        otf: 'application/font-sfnt',
        eot: ' application/vnd.ms-fontobject',
        woff: 'application/font-woff',
        woff2: 'application/font-woff2',
        swf: 'application/x-shockwave-flash'
      },
      // Global settings susceptible to be modified
      COMPRESS_IMAGES: true,
      // Keyboard key codes
      VK: {
        LEFT: 37,
        UP: 38,
        RIGHT: 39,
        DOWN: 40
      },
      // Flag to indicate that we are running on a touch device
      TOUCH_DEVICE: false,
      // Amount of time (in milliseconds) to wait before a media resource is loaded
      LOAD_TIMEOUT: 10000,
      // Number of points to be calculated as polygon vertexs when simplifying bezier curves
      BEZIER_POINTS: 4,
      // Check if canvas accessibility features are enabled
      // See: http://codepen.io/francesc/pen/amwvRp
      CANVAS_HITREGIONS: typeof CanvasRenderingContext2D !== 'undefined' && typeof CanvasRenderingContext2D.prototype.addHitRegion === 'function',
      CANVAS_HITREGIONS_FOCUS: typeof CanvasRenderingContext2D !== 'undefined' && typeof CanvasRenderingContext2D.prototype.drawFocusIfNeeded === 'function'
    },
    //
    // Functions useful to deal with caret position in `contentEditable` DOM elements
    //
    /**
     * Gets the caret position within the given element. Thanks to
     * {@link http://stackoverflow.com/users/96100/tim-down|Tim Down} answers in:
     * {@link http://stackoverflow.com/questions/4811822/get-a-ranges-start-and-end-offsets-relative-to-its-parent-container}
     * and {@link http://stackoverflow.com/questions/6240139/highlight-text-range-using-javascript/6242538}
     * @param {object} element - A DOM element
     * @returns {number}
     */
    getCaretCharacterOffsetWithin: function getCaretCharacterOffsetWithin(element) {
      var caretOffset = 0;
      var doc = element.ownerDocument || element.document;
      var win = doc.defaultView || doc.parentWindow;
      var sel = void 0;
      if (typeof win.getSelection !== "undefined") {
        sel = win.getSelection();
        if (sel.rangeCount > 0) {
          var range = win.getSelection().getRangeAt(0);
          var preCaretRange = range.cloneRange();
          preCaretRange.selectNodeContents(element);
          preCaretRange.setEnd(range.endContainer, range.endOffset);
          caretOffset = preCaretRange.toString().length;
        }
      } else if ((sel = doc.selection) && sel.type !== "Control") {
        var textRange = sel.createRange();
        var preCaretTextRange = doc.body.createTextRange();
        preCaretTextRange.moveToElementText(element);
        preCaretTextRange.setEndPoint("EndToEnd", textRange);
        caretOffset = preCaretTextRange.text.length;
      }
      return caretOffset;
    },
    /**
     * Utility function called by {@link Utils~getCaretCharacterOffsetWithin}
     * @param {object} node - A text node
     * @returns {object[]}
     */
    getTextNodesIn: function getTextNodesIn(node) {
      var textNodes = [];
      if (node.nodeType === 3) {
        textNodes.push(node);
      } else {
        var children = node.childNodes;
        for (var i = 0, len = children.length; i < len; ++i) {
          textNodes.push.apply(textNodes, Utils.getTextNodesIn(children[i]));
        }
      }
      return textNodes;
    },
    /**
     * Sets the selection range (or the cursor position, when `start` and `end` are the same) to a
     * specific position inside a DOM element.
     * @param {object} el - The DOM element where to set the cursor
     * @param {number} start - The start position of the selection (or cursor position)
     * @param {type} end - The end position of the selection. When null or identical to `start`,
     * indicates a cursor position.
     */
    setSelectionRange: function setSelectionRange(el, start, end) {
      if (Utils.isNullOrUndef(end)) end = start;
      if (document.createRange && window.getSelection) {
        var range = document.createRange();
        range.selectNodeContents(el);
        var textNodes = Utils.getTextNodesIn(el);
        var foundStart = false;
        var charCount = 0,
            endCharCount = void 0,
            textNode = void 0;

        for (var i = 0; i < textNodes.length; i++) {
          textNode = textNodes[i];
          endCharCount = charCount + textNode.length;
          if (!foundStart && start >= charCount && (start < endCharCount || start === endCharCount && i + 1 <= textNodes.length)) {
            range.setStart(textNode, start - charCount);
            foundStart = true;
          }
          if (foundStart && end <= endCharCount) {
            range.setEnd(textNode, end - charCount);
            break;
          }
          charCount = endCharCount;
        }
        var sel = window.getSelection();
        sel.removeAllRanges();
        sel.addRange(range);
      } else if (document.selection && document.body.createTextRange) {
        var textRange = document.body.createTextRange();
        textRange.moveToElementText(el);
        textRange.collapse(true);
        textRange.moveEnd('character', end);
        textRange.moveStart('character', start);
        textRange.select();
      }
    }
  };

  return Utils;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : AWT.js
 *  Created : 12/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2), __webpack_require__(209)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Utils, WebFont) {

  /**
   * This object contains utility clases for painting graphics and images,
   * as found in the Java [Abstract Window Toolkit](http://docs.oracle.com/javase/7/docs/api/java/awt/package-summary.html)
   *
   * The objects defined here are: {@link Font}, {@link Gradient}, {@link Stroke},
   * {@link Point}, {@link Dimension}, {@link Shape}, {@link Rectangle},
   * {@link Ellipse}, {@link Path}, {@link PathStroke}, {@link Action},
   * {@link Timer} and {@link Container}.
   */

  /**
   * Font contains properties and provides methods to manage fonts
   * @class
   */
  var Font = function () {
    /**
     * Font constructor
     * @param {string=} [family='Arial']
     * @param {number=} [size=17]
     * @param {number=} [bold=0]
     * @param {number=} [italic=0]
     * @param {string=} [variant='']
     */
    function Font(family, size, bold, italic, variant) {
      _classCallCheck(this, Font);

      if (family) this.family = family;
      if (typeof size === 'number') this.size = size;
      if (bold) this.bold = bold;
      if (italic) this.italic = italic;
      if (variant) this.variant = variant;
      this._metrics = { ascent: -1, descent: -1, height: -1 };
    }

    /**
     * Finds the XML elements with typeface specifications, checks its value against the font
     * substitution list, replacing the `family` attribute and loading the alternative font when needed.
     * @param {external:jQuery} $tree - The xml element to be processed
     * @param {Object=} options - Optional param that can contain a `fontSubstitutions` attribute with
     * a substition table to be added to {@link Font.SUBSTITUTIONS}
     */


    _createClass(Font, [{
      key: "setProperties",


      /**
       * Reads the properties of this Font from an XML element
       * @param {external:jQuery} $xml - The xml element to be parsed
       * @returns {Font}
       */
      value: function setProperties($xml) {
        if ($xml.attr('family')) this.family = $xml.attr('family');
        if ($xml.attr('size')) this.size = Number($xml.attr('size'));
        if ($xml.attr('bold')) this.bold = Utils.getBoolean($xml.attr('bold'));
        if ($xml.attr('italic')) this.italic = Utils.getBoolean($xml.attr('italic'));
        if ($xml.attr('variant')) this.variant = $xml.attr('variant');
        return this;
      }

      /**
       * Allows to change the `size` member, recalculating the vertical metrics.
       * @param {number} size - The new size to set
       * @returns {Font}
       */

    }, {
      key: "setSize",
      value: function setSize(size) {
        var currentSize = this.size;
        this.size = size;
        if (currentSize !== size) this._metrics.height = -1;
        return this;
      }

      /**
       * Increases or decreases the current font size by the specified amount
       * @param {number} amount - The amount to increase or decrease current size
       * @returns {Font}
       */

    }, {
      key: "zoom",
      value: function zoom(amount) {
        return this.setSize(this.size + amount);
      }

      /**
       * Calculates the vertical font metrics and returns its height
       * @returns {number} - The font height
       */

    }, {
      key: "getHeight",
      value: function getHeight() {
        var _this = this;

        if (this._metrics.height < 0) {
          // Look for an equivalent font already calculated
          var font = Font.ALREADY_CALCULATED_FONTS.find(function (font) {
            return font.equals(_this);
          });
          if (font) Object.assign(this._metrics, font._metrics);

          if (this._metrics.height < 0) {
            this._calcHeight();
            if (this._metrics.height > 0) Font.ALREADY_CALCULATED_FONTS.push(this);
          }
        }
        return this._metrics.height;
      }

      /**
       * Translates the Font properties into CSS statements
       * @param {Object} css - The object where to add CSS properties. When null or undefined, a new
       * object will be created and returned.
       * @returns {Object} - A set of CSS property-values pairs, ready to be used by JQuery
       * [.css(properties)](http://api.jquery.com/css/#css-properties).
       */

    }, {
      key: "toCss",
      value: function toCss(css) {
        if (!css) css = {};
        css['font-family'] = this.family;
        css['font-size'] = this.size + "px";
        if (this.hasOwnProperty('bold')) css['font-weight'] = this.bold ? 'bold' : 'normal';
        if (this.hasOwnProperty('italic')) css['font-style'] = this.italic ? 'italic' : 'normal';
        if (this.hasOwnProperty('variant')) css['font-variant'] = this.variant;
        return css;
      }

      /**
       * Gets the codification of this font in a single string, suitable to be used in a `font`
       * CSS attribute.
       * @returns {String} - A string with all the CSS font properties concatenated
       */

    }, {
      key: "cssFont",
      value: function cssFont() {
        return (this.italic ? 'italic ' : 'normal') + " " + (this.variant === '' ? 'normal' : this.variant) + " " + (this.bold ? 'bold ' : 'normal') + " " + this.size + "pt " + this.family;
      }

      /**
       * The {@link https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics TextMetrics} object used
       * by {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D CanvasRenderingContext2D}
       * does not provide a `heigth` value for rendered text.
       * This {@link http://stackoverflow.com/questions/1134586/how-can-you-find-the-height-of-text-on-an-html-canvas stackoverflow question}
       * has an excellent response by Daniel Earwicker explaining how to measure the
       * vertical dimension of rendered text using a `span` element.
       * The code has been slighty adapted to deal with Font objects.
       *
       * _Warning_: Do not call this method direcly. Use {@link Font#getHeight getHeight()} instead
       * 
       * @returns {Font}
       */

    }, {
      key: "_calcHeight",
      value: function _calcHeight() {
        var $text = $('<span/>').html('Hg').css(this.toCss()),
            $block = $('<div/>').css({ display: 'inline-block', width: '1px', height: '0px' }),
            $div = $('<div/>').append($text, $block);

        $('body').append($div);
        try {
          $block.css({ verticalAlign: 'baseline' });
          this._metrics.ascent = $block.offset().top - $text.offset().top;
          $block.css({ verticalAlign: 'bottom' });
          this._metrics.height = $block.offset().top - $text.offset().top;
          this._metrics.descent = this._metrics.height - this._metrics.ascent;
        } finally {
          $div.remove();
        }
        return this;
      }

      /**
       * Checks if two Font objects are equivalent
       * @param {Font} font - The Font object to compare against this one
       * @returns {Boolean} - `true` if both objects are equivalent, `false` otherwise
       */

    }, {
      key: "equals",
      value: function equals(font) {
        return this.family === font.family && this.size === font.size && this.bold === font.bold && this.italic === font.italic && this.variant === font.variant;
      }
    }], [{
      key: "checkTree",
      value: function checkTree($tree, options) {
        var substitutions = Font.SUBSTITUTIONS;
        // Load own fonts and remove it from the substitution table
        if (options && options.ownFonts) {
          options.ownFonts.forEach(function (name) {
            // Check WebFont as a workaround to avoid problems with a different version of `webfontloader` in agora.xtec.cat
            if (Font.ALREADY_LOADED_FONTS.indexOf(name) < 0 && WebFont && WebFont.load) {
              WebFont.load({ custom: { families: [name] } });
              Font.ALREADY_LOADED_FONTS.push(name);
              delete substitutions[name.trim().toLowerCase()];
            }
          });
        }

        // Add custom font substitutions
        if (options && options.fontSubstitutions)
          //substitutions = Object.assign({}, substitutions, options.fontSubstitutions)
          substitutions = $.extend(Object.create(substitutions), options.fontSubstitutions);

        $tree.find('style[family],font[family]').each(function (_n, style) {
          var $style = $(style),
              name = $style.attr('family').trim().toLowerCase();
          if (name in substitutions) {
            var newName = substitutions[name];
            if (newName !== '') {
              Font.loadGoogleFont(newName);
              $style.attr('family', newName);
            }
          }
        });
      }

      /**
       * Try to load a specific font from [http://www.google.com/fonts]
       * @param {string} name - The font family name
       */

    }, {
      key: "loadGoogleFont",
      value: function loadGoogleFont(name) {
        // Check WebFont as a workaround to avoid problems with a different version of `webfontloader` in agora.xtec.cat
        if (name && !Font.ALREADY_LOADED_FONTS.includes(name) && WebFont && WebFont.load) {
          WebFont.load({ google: { families: [name] } });
          Font.ALREADY_LOADED_FONTS.push(name);
        }
      }

      /**
       * Try to load a set of Google fonts
       * @param {string[]} fonts - An array of font names
       */

    }, {
      key: "loadGoogleFonts",
      value: function loadGoogleFonts(fonts) {
        if (fonts && fonts.forEach) fonts.forEach(function (name) {
          return Font.loadGoogleFont(name);
        });
      }
    }]);

    return Font;
  }();

  /**
   * Array of font objects with already calculated heights */


  Font.ALREADY_CALCULATED_FONTS = [];

  /**
   * Array of font names already loaded from Google Fonts */
  Font.ALREADY_LOADED_FONTS = [];

  /**
   * Google Fonts equivalent for special fonts used in some JClic projects.
   * More substitutions can be added to the list for specific projects indicating a
   * `fontSubstitutions` object in the `data-options` attribute of the HTML `div` element
   * containing the player.
   * For example:
   * `<div class ="JClic" data-project="demo.jclic" data-options='{"fontSubstitutions":{"arial":"Arimo"}}'/>`
   */
  Font.SUBSTITUTIONS = {
    'abc': 'Kalam',
    'a.c.m.e. secret agent': 'Permanent Marker',
    'comic sans ms': 'Patrick Hand',
    'impact': 'Oswald',
    'massallera': 'Vibur',
    'memima': 'Vibur',
    'memima_n1': 'Vibur',
    'memima_n2': 'Vibur',
    'memimas-regularalternate': 'Vibur',
    'palmemim': 'Vibur',
    'zurichcalligraphic': 'Felipa'
  };

  Object.assign(Font.prototype, {
    /**
     * The `font-family` property
     * @name Font#family
     * @type {string} */
    family: 'Arial',
    /**
     * The font size
     * __Warning__: Do not change `size` directly. Use the {@link Font#setSize|setSize()}
     * method instead.
     * @name Font#size
     * @type {number} */
    size: 17,
    /**
     * The font _bold_ value
     * @name Font#bold
     * @type {number} */
    bold: 0,
    /**
     * The font _italic_ value
     * @name Font#italic
     * @type {number} */
    italic: 0,
    /**
     * The font _variant_ value
     * @name Font#variant
     * @type {string}*/
    variant: '',
    /**
     * The font *_metrics* property contains the values for `ascent`, `descent` and `height`
     * attributes. Vertical font metrics are calculated in
     * {@link Font#_calcHeight|calcHeight()} as needed.
     * @name Font#_metrics
     * @private
     * @type {{ascent: number, descent: number, height: number}} */
    _metrics: { ascent: -1, descent: -1, height: -1 }
  });

  /**
   * Contains parameters and methods to draw complex color gradients
   * @class
   */

  var Gradient = function () {
    /**
     * Gradient constructor
     * @param {string} c1 - The initial color, in any CSS-valid form.
     * @param {string} c2 - The final color, in any CSS-valid form.
     * @param {number=} [angle=0] - The inclination of the gradient relative to the horizontal line.
     * @param {number=} [cycles=1] - The number of times the gradient will be repeated.
     */
    function Gradient(c1, c2, angle, cycles) {
      _classCallCheck(this, Gradient);

      if (c1) this.c1 = c1;
      if (c2) this.c2 = c2;
      if (typeof angle === 'number') this.angle = angle % 360;
      if (typeof cycles === 'number') this.cycles = cycles;
    }

    /**
     * Reads the properties of this Gradient from an XML element
     * @param {external:jQuery} $xml - The xml element to be parsed
     * @returns {Gradient}
     */


    _createClass(Gradient, [{
      key: "setProperties",
      value: function setProperties($xml) {
        this.c1 = Utils.checkColor($xml.attr('source'), 'black');
        this.c2 = Utils.checkColor($xml.attr('dest'), 'white');
        this.angle = Number($xml.attr('angle') || 0) % 360;
        this.cycles = Number($xml.attr('cycles') || 1);
        return this;
      }

      /**
       * Creates a {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasGradient|CanvasGradient}
       * based on the provided context and rectangle.
       * @param {external:CanvasRenderingContext2D} ctx - The 2D rendering context
       * @param {Rectangle} rect - The rectangle where this gradient will be applied to
       * @returns {Gradient}
       */

    }, {
      key: "getGradient",
      value: function getGradient(ctx, rect) {
        var p2 = rect.getOppositeVertex(),
            gradient = ctx.createLinearGradient(rect.pos.x, rect.pos.y, p2.x, p2.y),
            step = 1 / Math.max(this.cycles, 1);
        for (var i = 0; i <= this.cycles; i++) {
          gradient.addColorStop(i * step, i % 2 ? this.c1 : this.c2);
        }return gradient;
      }

      /**
       * Gets the CSS 'linear-gradient' expression of this Gradient
       * @returns {string} - A string ready to be used as a value for the `linear-gradient` CSS attribute
       */

    }, {
      key: "getCss",
      value: function getCss() {
        var result = "linear-gradient(" + (this.angle + 90) + "deg, " + this.c1 + ", " + this.c2;
        for (var i = 1; i < this.cycles; i++) {
          result = result + ", " + (i % 2 > 0 ? this.c1 : this.c2);
        }return result + ")";
      }

      /**
       * Checks if any of the gradient colors has transparency
       * @returns {boolean} - `true` if this gradient uses colors with transparency, `false` otherwise.
       */

    }, {
      key: "hasTransparency",
      value: function hasTransparency() {
        return Utils.colorHasTransparency(this.c1) || Utils.colorHasTransparency(this.c2);
      }
    }]);

    return Gradient;
  }();

  Object.assign(Gradient.prototype, {
    /**
     * Initial color
     * @name Gradient#c1
     * @type {string} */
    c1: 'white',
    /**
     * Final color
     * @name Gradient#c2
     * @type {string} */
    c2: 'black',
    /**
     * Tilt angle
     * @name Gradient#angle
     * @type {number} */
    angle: 0,
    /**
     * Number of repetitions of the gradient
     * @name Gradient#cycles
     * @type {number} */
    cycles: 1
  });

  /**
   * Contains properties used to draw lines in HTML `canvas` elements.
   * @see {@link http://bucephalus.org/text/CanvasHandbook/CanvasHandbook.html#line-caps-and-joins}
   * @class
   */

  var Stroke = function () {
    /**
     * Stroke constructor
     * @param {number=} [lineWidth=1] - The line width of the stroke
     * @param {string=} [lineCap='butt'] - The line ending type. Possible values are: `butt`, `round`
     * and `square`.
     * @param {string=} [lineJoin='miter'] - The type of drawing used when two lines join. Possible
     * values are: `round`, `bevel` and `miter`.
     * @param {number=} [miterLimit=10] - The ratio between the miter length and half `lineWidth`.
     */
    function Stroke(lineWidth, lineCap, lineJoin, miterLimit) {
      _classCallCheck(this, Stroke);

      if (typeof lineWidth === 'number') this.lineWidth = lineWidth;
      if (lineCap) this.lineCap = lineCap;
      if (lineJoin) this.lineJoin = lineJoin;
      if (typeof miterLimit === 'number') this.miterLimit = miterLimit;
    }

    /**
     * Sets the properties of this stroke to a CanvasRenderingContext2D
     * @param {external:CanvasRenderingContext2D} ctx - The canvas 2D rendering context
     * @returns {external:CanvasRenderingContext2D}
     */


    _createClass(Stroke, [{
      key: "setStroke",
      value: function setStroke(ctx) {
        ctx.lineWidth = this.lineWidth;
        ctx.lineCap = this.lineCap;
        ctx.lineJoin = this.lineJoin;
        ctx.miterLimit = this.miterLimit;
        return ctx;
      }
    }]);

    return Stroke;
  }();

  Object.assign(Stroke.prototype, {
    /**
     * The line width
     * @name Stroke#lineWidth
     * @type {number} */
    lineWidth: 1.0,
    /**
     * The line ending type (`butt`, `round` or `square`)
     * @name Stroke#lineCap
     * @type {string} */
    lineCap: 'butt',
    /**
     * The drawing used when two lines join (`round`, `bevel` or `miter`)
     * @name Stroke#lineJoin
     * @type {string} */
    lineJoin: 'miter',
    /**
     * Ratio between the miter length and half `lineWidth`
     * @name Stroke#miterLimit
     * @type {number} */
    miterLimit: 10.0
  });

  /**
   * Contains the `x` andy `y` coordinates of a point, and provides some useful methods.
   * @class
   */

  var Point = function () {
    /**
     * Point constructor
     * @param {number|Point} x - When `x` is an `Point` object, a clone of it will be created.
     * @param {number=} y - Not used when `x` is an `Point`
     */
    function Point(x, y) {
      _classCallCheck(this, Point);

      if (x instanceof Point) {
        // Special case: constructor passing another point as unique parameter
        this.x = x.x;
        this.y = x.y;
      } else {
        this.x = x || 0;
        this.y = y || 0;
      }
    }

    /**
     * Reads the properties of this Point from an XML element
     * @param {external:jQuery} $xml - The xml element to be parsed
     * @returns {Point}
     */


    _createClass(Point, [{
      key: "setProperties",
      value: function setProperties($xml) {
        this.x = Number($xml.attr('x'));
        this.y = Number($xml.attr('y'));
        return this;
      }

      /**
       * Moves this Point to a new position, by a specified displacement
       * @param {Point|Dimension} delta - The amount to move
       * @returns {Point}
       */

    }, {
      key: "moveBy",
      value: function moveBy(delta) {
        this.x += delta.x || delta.width || 0;
        this.y += delta.y || delta.height || 0;
        return this;
      }

      /**
       * Moves this Point to a new position
       * @param {number|Point} newPos - The new position, or a x coordinate
       * @param {number=} y - `null` or `undefined` when `newPos` is a Point
       * @returns {Point}
       */

    }, {
      key: "moveTo",
      value: function moveTo(newPos, y) {
        if (typeof newPos === 'number') {
          this.x = newPos;
          this.y = y;
        } else {
          this.x = newPos.x;
          this.y = newPos.y;
        }
        return this;
      }

      /**
       * Multiplies the `x` and `y` coordinates by a specified `delta`
       * @param {Point|Dimension} delta - The amount to multiply by.
       * @returns {Point}
       */

    }, {
      key: "multBy",
      value: function multBy(delta) {
        this.x *= delta.x || delta.width || 0;
        this.y *= delta.y || delta.height || 0;
        return this;
      }

      /**
       * Checks if two points are at the same place
       * @param {Point} p - The Point to check against to
       * @returns {boolean}
       */

    }, {
      key: "equals",
      value: function equals(p) {
        return this.x === p.x && this.y === p.y;
      }

      /**
       * Calculates the distance between two points
       * @param {Point} point - The Point to calculate the distance against to
       * @returns {number} - The distance between the two points.
       */

    }, {
      key: "distanceTo",
      value: function distanceTo(point) {
        return Math.sqrt(Math.pow(this.x - point.x, 2), Math.pow(this.y - point.y, 2));
      }

      /**
       * Clones this point
       * @returns {Point}
       */

    }, {
      key: "clone",
      value: function clone() {
        return new Point(this);
      }
    }]);

    return Point;
  }();

  Object.assign(Point.prototype, {
    /**
     * @name Point#x
     * @type {number} */
    x: 0,
    /**
     * @name Point#y
     * @type {number} */
    y: 0
  });

  /**
   * This class encapsulates `width` and `height` properties.
   * @class
   */

  var Dimension = function () {
    /**
     * Dimension constructor
     * @param {number|Point} w - The width of this Dimension, or the upper-left vertex of a
     * virtual Rectangle
     * @param {number|Point} h - The height of this Dimension, or the bottom-right vertex of a
     * virtual Rectangle
     */
    function Dimension(w, h) {
      _classCallCheck(this, Dimension);

      if (w instanceof Point && h instanceof Point) {
        this.width = h.x - w.x;
        this.height = h.y - w.y;
      } else {
        this.width = w || 0;
        this.height = h || 0;
      }
    }

    /**
     * Reads the properties of this Dimension from an XML element
     * @param {external:jQuery} $xml - The xml element to be parsed
     * @returns {Dimension}
     */


    _createClass(Dimension, [{
      key: "setProperties",
      value: function setProperties($xml) {
        this.width = Number($xml.attr('width'));
        this.height = Number($xml.attr('height'));
        return this;
      }

      /**
       * Check if two dimensions are equivalent
       * @param {Dimension} d
       * @returns {Boolean}
       */

    }, {
      key: "equals",
      value: function equals(d) {
        return this.width === d.width && this.height === d.height;
      }

      /**
       * Multiplies the `w` and `h` co-ordinates by a specified `delta`
       * @param {Point|Dimension} delta
       * @returns {Dimension}
       */

    }, {
      key: "multBy",
      value: function multBy(delta) {
        this.width *= delta.x || delta.width || 0;
        this.height *= delta.y || delta.height || 0;
        return this;
      }

      /**
       * Sets new values for width and height.
       * `width` can be a number or another `Dimension` object
       * @param {number|Dimension} width - The new width, or a full Dimension to copy it from.
       * @param {number=} height - Not used when `width` is a Dimension
       * @returns {Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(width, height) {
        if (width instanceof Dimension) {
          height = width.height;
          width = width.width;
        }
        this.width = width;
        this.height = height;
        return this;
      }

      /**
       * Calculates the area of a Rectangle with this dimension
       * @return {number} The resulting area
       */

    }, {
      key: "getSurface",
      value: function getSurface() {
        return this.width * this.height;
      }
    }]);

    return Dimension;
  }();

  Object.assign(Dimension.prototype, {
    /**
     * @name Dimension#width
     * @type {number} */
    width: 0,
    /**
     * @name Dimension#height
     * @type {number} */
    height: 0
  });

  /**
   * Shape is a generic abstract class for rectangles, ellipses and stroke-free shapes.
   * @abstract
   * @class
   */

  var Shape = function () {
    /**
     * Shape  constructor
     * @param {Point} pos - The top-left coordinates of this Shape
     */
    function Shape(pos) {
      _classCallCheck(this, Shape);

      this.pos = pos || new Point();
    }

    /**
     * Shifts the shape a specified amount in horizontal and vertical directions
     * @param {Point|Dimension} delta - The amount to shift the Shape
     * @returns {Shape}
     */


    _createClass(Shape, [{
      key: "moveBy",
      value: function moveBy(delta) {
        this.pos.moveBy(delta);
        return this;
      }

      /**
       * Moves this shape to a new position
       * @param {Point} newPos - The new position of the shape
       * @returns {Shape}
       */

    }, {
      key: "moveTo",
      value: function moveTo(newPos) {
        this.pos.moveTo(newPos);
        return this;
      }

      /**
       * Gets the enclosing {@link Rectangle} of this Shape.
       * @returns {Rectangle}
       */

    }, {
      key: "getBounds",
      value: function getBounds() {
        return new Rectangle(this.pos);
      }

      /**
       * Checks if two shapes are equivalent.
       * @param {Shape} p - The Shape to compare against
       * @returns {boolean}
       */

    }, {
      key: "equals",
      value: function equals(p) {
        return this.pos.equals(p.pos);
      }

      /**
       * Multiplies the dimension of the Shape by the specified `delta` amount.
       * @param {Point|Dimension} _delta - Object containing the X and Y ratio to be scaled.
       * @returns {Shape}
       */

    }, {
      key: "scaleBy",
      value: function scaleBy(_delta) {
        // Nothing to scale in abstract shapes
        return this;
      }

      /**
       * Gets a clone of this shape moved to the `pos` component of the rectangle and scaled
       * by its `dim` value.
       * @param {Rectangle} rect - The rectangle to be taken as a base for moving and scaling
       * this shape.
       * @returns {Shape}
       */

    }, {
      key: "getShape",
      value: function getShape(rect) {
        return this.clone().scaleBy(rect.dim).moveBy(rect.pos);
      }

      /**
       * Checks if the provided {@link Point} is inside this shape.
       * @param {Point} _p - The point to check
       * @returns {boolean}
       */

    }, {
      key: "contains",
      value: function contains(_p) {
        // Nothing to check in abstract shapes
        return false;
      }

      /**
       * Checks if the provided {@link Rectangle} `r` intersects with this shape.
       * @param {Rectangle} _r
       * @returns {boolean}
       */

    }, {
      key: "intersects",
      value: function intersects(_r) {
        // Nothing to check in abstract shapes
        return false;
      }

      /**
       * Fills the Shape with the current style in the provided HTML canvas context
       * @param {external:CanvasRenderingContext2D} ctx - The canvas 2D rendering context where to fill this shape.
       * @param {Rectangle=} dirtyRegion - The context region to be updated. Used as clipping
       * region when drawing.
       * @returns {external:CanvasRenderingContext2D} - The provided rendering context
       */

    }, {
      key: "fill",
      value: function fill(ctx, dirtyRegion) {
        ctx.save();
        if (dirtyRegion && dirtyRegion.getSurface() > 0) {
          // Clip the dirty region
          ctx.beginPath();
          ctx.rect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
          ctx.clip();
        }
        // Prepare shape path and fill
        this.preparePath(ctx);
        ctx.fill();
        ctx.restore();
        return ctx;
      }

      /**
       * Draws this shape in the provided HTML canvas 2D rendering context.
       * @param {external:CanvasRenderingContext2D} ctx - The canvas 2D rendering context where to draw the shape.
       * @returns {external:CanvasRenderingContext2D} - The provided rendering context
       */

    }, {
      key: "stroke",
      value: function stroke(ctx) {
        this.preparePath(ctx);
        ctx.stroke();
        return ctx;
      }

      /**
       * Prepares an HTML canvas 2D rendering context with a path that can be used to stroke a line,
       * to fill a surface or to define a clipping region.
       * @param {external:CanvasRenderingContext2D} ctx
       * @returns {external:CanvasRenderingContext2D} - The provided rendering context
       */

    }, {
      key: "preparePath",
      value: function preparePath(ctx) {
        // Nothing to do in abstract shapes
        return ctx;
      }

      /**
       * Creates a clipping region on the specified HTML canvas 2D rendering context
       * @param {external:CanvasRenderingContext2D} ctx - The rendering context
       * @param {string=} [fillRule='nonzero'] - Can be 'nonzero' (default when not set) or 'evenodd'
       * @returns {external:CanvasRenderingContext2D} - The provided rendering context
       */

    }, {
      key: "clip",
      value: function clip(ctx, fillRule) {
        this.preparePath(ctx);
        ctx.clip(fillRule || 'nonzero');
        return ctx;
      }

      /**
       * Shorthand method for determining if a Shape is an {@link Rectangle}
       * @returns {Boolean}
       */

    }, {
      key: "isRect",
      value: function isRect() {
        return false;
      }

      /**
       * Overwrites the original 'Object.toString' method with a more descriptive text
       * @returns {String}
       */

    }, {
      key: "toString",
      value: function toString() {
        return "Shape enclosed in " + this.getBounds().getCoords();
      }
    }]);

    return Shape;
  }();

  Object.assign(Shape.prototype, {
    /**
     * The current position of the shape
     * @name Shape#pos
     * @type {Point} */
    pos: new Point()
  });

  /**
   * The rectangular {@link Shape} accepts five different sets of parameters:
   * @example
   * // Calling Rectangle() with different sets of parameters
   * // An Point and an Dimension:
   * new Rectangle(pos, dim)
   * // Another Rectangle, to be cloned:
   * new Rectangle(rect)
   * // Two Point objects containing the coordinates of upper-left and lower-right vertexs:
   * new Rectangle(p0, p1)
   * // An array of four numbers with the coordinates of the same vertexs:
   * new Rectangle([x0, y0, x1, y1])
   * // Four single numbers, meaning the same coordinates as above:
   * new Rectangle(x0, y0, x1, y1)
   * @class
   * @extends Shape
   */

  var Rectangle = function (_Shape) {
    _inherits(Rectangle, _Shape);

    /**
     * Rectangle constructor
     * @param {Point|Rectangle|number|number[]} pos
     * @param {Dimension|number=} dim
     * @param {number=} w
     * @param {number=} h
     */
    function Rectangle(pos, dim, w, h) {
      _classCallCheck(this, Rectangle);

      var p = pos,
          d = dim;
      // Special case: constructor with a Rectangle as a unique parameter
      if (pos instanceof Rectangle) {
        d = new Dimension(pos.dim.width, pos.dim.height);
        p = new Point(pos.pos.x, pos.pos.y);
      } else if (pos instanceof Point) {
        p = new Point(pos.x, pos.y);
        if (dim instanceof Dimension) d = new Dimension(dim.width, dim.height);
      } else if (pos instanceof Array) {
        // Assume `pos` is an array of numbers indicating: x0, y0, x1, y1
        p = new Point(pos[0], pos[1]);
        d = new Dimension(pos[2] - pos[0], pos[3] - pos[1]);
      } else if (typeof w === 'number' && typeof h === 'number') {
        // width and height passed. Treat all parameters as co-ordinates:
        p = new Point(pos, dim);
        d = new Dimension(w, h);
      }

      var _this2 = _possibleConstructorReturn(this, (Rectangle.__proto__ || Object.getPrototypeOf(Rectangle)).call(this, p));

      if (d instanceof Dimension) _this2.dim = d;else if (d instanceof Point) _this2.dim = new Dimension(d.x - _this2.pos.x, d.y - _this2.pos.y);else _this2.dim = new Dimension();
      return _this2;
    }

    /**
     * Gets the enclosing {@link Rectangle} of this Shape.
     * @returns {Rectangle}
     */


    _createClass(Rectangle, [{
      key: "getBounds",
      value: function getBounds() {
        return this;
      }

      /**
       * Sets this Rectangle the position and dimension of another one
       * @param {Rectangle} rect
       * @returns {Rectangle}
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect) {
        if (!rect) rect = new Rectangle();
        this.pos.x = rect.pos.x;
        this.pos.y = rect.pos.y;
        this.dim.width = rect.dim.width;
        this.dim.height = rect.dim.height;
        return this;
      }

      /**
       * Checks if two shapes are equivalent.
       * @param {Shape} r - The Shape to compare against
       * @returns {boolean}
       */

    }, {
      key: "equals",
      value: function equals(r) {
        return r instanceof Rectangle && this.pos.equals(r.pos) && this.dim.equals(r.dim);
      }

      /**
       * Clones this Rectangle
       * @returns {Rectangle}
       */

    }, {
      key: "clone",
      value: function clone() {
        return new Rectangle(this);
      }

      /**
       * Multiplies the dimension of the Shape by the specified `delta` amount.
       * @param {Point|Dimension} delta - Object containing the X and Y ratio to be scaled.
       * @returns {Rectangle}
       */

    }, {
      key: "scaleBy",
      value: function scaleBy(delta) {
        this.pos.multBy(delta);
        this.dim.multBy(delta);
        return this;
      }

      /**
       * Expands the boundaries of this shape. This affects the current position and dimension.
       * @param {number} dx - The amount to grow (or decrease) in horizontal direction
       * @param {number} dy - The amount to grow (or decrease) in vertical direction
       * @returns {Rectangle}
       */

    }, {
      key: "grow",
      value: function grow(dx, dy) {
        this.pos.x -= dx;
        this.pos.y -= dy;
        this.dim.width += 2 * dx;
        this.dim.height += 2 * dy;
        return this;
      }

      /**
       * Gets the {@link Point} corresponding to the lower-right vertex of the Rectangle.
       * @returns {Point}
       */

    }, {
      key: "getOppositeVertex",
      value: function getOppositeVertex() {
        return new Point(this.pos.x + this.dim.width, this.pos.y + this.dim.height);
      }

      /**
       * Adds the boundaries of another shape to the current one
       * @param {Shape} shape - The {@link Shape} to be added
       * @returns {Rectangle}
       */

    }, {
      key: "add",
      value: function add(shape) {
        var myP2 = this.getOppositeVertex(),
            rectP2 = shape.getBounds().getOppositeVertex();

        this.pos.moveTo(Math.min(this.pos.x, shape.getBounds().pos.x), Math.min(this.pos.y, shape.getBounds().pos.y));
        this.dim.setDimension(Math.max(myP2.x, rectP2.x) - this.pos.x, Math.max(myP2.y, rectP2.y) - this.pos.y);
        return this;
      }

      //
      // Inherits the documentation of `contains` in Shape

    }, {
      key: "contains",
      value: function contains(p) {
        var p2 = this.getOppositeVertex();
        return p.x >= this.pos.x && p.x <= p2.x && p.y >= this.pos.y && p.y <= p2.y;
      }

      //
      // Inherits the documentation of `intersects` in Shape

    }, {
      key: "intersects",
      value: function intersects(r) {
        var p1 = this.pos,
            p2 = this.getOppositeVertex(),
            r1 = r.pos,
            r2 = r.getOppositeVertex();
        return r2.x >= p1.x && r1.x <= p2.x && r2.y >= p1.y && r1.y <= p2.y;
      }

      //
      // Inherits the documentation of `preparePath` in Shape

    }, {
      key: "preparePath",
      value: function preparePath(ctx) {
        ctx.beginPath();
        ctx.rect(this.pos.x, this.pos.y, this.dim.width, this.dim.height);
        return ctx;
      }

      //
      // Inherits the documentation of `getSurface` in Shape

    }, {
      key: "getSurface",
      value: function getSurface() {
        return this.dim.getSurface();
      }

      //
      // Inherits the documentation of `isEmpty` in Shape

    }, {
      key: "isEmpty",
      value: function isEmpty() {
        return this.getSurface() === 0;
      }

      //
      // Inherits the documentation of `isRect` in Shape

    }, {
      key: "isRect",
      value: function isRect() {
        return true;
      }

      //
      // Inherits the documentation of `toString` in Shape

    }, {
      key: "toString",
      value: function toString() {
        return "Rectangle " + this.getCoords();
      }

      /**
       * Gets a string with the co-ordinates of the upper-left and lower-right vertexs of this rectangle,
       * (with values rounded to int)
       * @returns {String}
       */

    }, {
      key: "getCoords",
      value: function getCoords() {
        return "[" + Math.round(this.pos.x) + "," + Math.round(this.pos.y) + "," + Math.round(this.pos.x + this.dim.width) + "," + Math.round(this.pos.y + this.dim.height) + "]";
      }
    }]);

    return Rectangle;
  }(Shape);

  Object.assign(Rectangle.prototype, {
    /**
     * The {@link Dimension} of the Rectangle
     * @name Rectangle#dim
     * @type {Dimension} */
    dim: new Dimension()
  });

  /**
   * The Ellipse shape has the same constructor options as {@link Rectangle}
   * @class
   * @extends Rectangle
   */

  var Ellipse = function (_Rectangle) {
    _inherits(Ellipse, _Rectangle);

    /**
     * Ellipse constructor
     * @param {Point|Rectangle|number|number[]} pos
     * @param {Dimension|number=} dim
     * @param {number=} w
     * @param {number=} h
     */
    function Ellipse(pos, dim, w, h) {
      _classCallCheck(this, Ellipse);

      return _possibleConstructorReturn(this, (Ellipse.__proto__ || Object.getPrototypeOf(Ellipse)).call(this, pos, dim, w, h));
    }

    //
    // Inherits the documentation of `preparePath` in Rectangle


    _createClass(Ellipse, [{
      key: "preparePath",
      value: function preparePath(ctx) {

        // Using the solution 'drawEllipseWithBezier' proposed by Steve Tranby in:
        // [http://jsbin.com/sosugenegi/1/edit] as a response to:
        // [http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas]
        // Thanks Steve!!

        var kappa = 0.5522848,
            ox = kappa * this.dim.width / 2,
            // control point offset horizontal
        oy = kappa * this.dim.height / 2,
            // control point offset vertical
        xe = this.pos.x + this.dim.width,
            // x-end
        ye = this.pos.y + this.dim.height,
            // y-end
        xm = this.pos.x + this.dim.width / 2,
            // x-middle
        ym = this.pos.y + this.dim.height / 2; // y-middle

        ctx.beginPath();
        ctx.moveTo(this.pos.x, ym);
        ctx.bezierCurveTo(this.pos.x, ym - oy, xm - ox, this.pos.y, xm, this.pos.y);
        ctx.bezierCurveTo(xm + ox, this.pos.y, xe, ym - oy, xe, ym);
        ctx.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);
        ctx.bezierCurveTo(xm - ox, ye, this.pos.x, ym + oy, this.pos.x, ym);
        ctx.closePath();
        return ctx;
      }

      //
      // Inherits the documentation of `contains` in Shape

    }, {
      key: "contains",
      value: function contains(p) {
        // First check if the point is inside the enclosing rectangle
        var result = _get(Ellipse.prototype.__proto__ || Object.getPrototypeOf(Ellipse.prototype), "contains", this).call(this, p);
        if (result) {
          var rx = this.dim.width / 2,
              ry = this.dim.height / 2,
              cx = this.pos.x + rx,
              cy = this.pos.y + ry;
          // Apply the general equation of an ellipse
          // See: [http://math.stackexchange.com/questions/76457/check-if-a-point-is-within-an-ellipse]
          // rx and ry are > 0 because we are inside the enclosing rect,
          // so don't care about division by zero
          result = Math.pow(p.x - cx, 2) / Math.pow(rx, 2) + Math.pow(p.y - cy, 2) / Math.pow(ry, 2) <= 1;
        }
        return result;
      }

      //
      // Inherits the documentation of `getSurface` in Rectangle

    }, {
      key: "getSurface",
      value: function getSurface() {
        return Math.PI * this.dim.width / 2 * this.dim.height / 2;
      }

      //
      // Inherits the documentation of `equals` in Rectangle

    }, {
      key: "equals",
      value: function equals(e) {
        return e instanceof Ellipse && _get(Ellipse.prototype.__proto__ || Object.getPrototypeOf(Ellipse.prototype), "equals", this).call(this, e);
      }

      //
      // Inherits the documentation of `clone` in Rectangle

    }, {
      key: "clone",
      value: function clone() {
        return new Ellipse(this.pos, this.dim);
      }

      //
      // Inherits the documentation of `isRect` in Rectangle

    }, {
      key: "isRect",
      value: function isRect() {
        return false;
      }

      //
      // Inherits the documentation of `toString` in Shape

    }, {
      key: "toString",
      value: function toString() {
        return "Ellipse enclosed in " + this.getCoords();
      }
    }]);

    return Ellipse;
  }(Rectangle);

  /**
   * A `Path` is a {@link Shape} formed by a serie of strokes, represented by
   * {@link PathStroke} objects
   * @class
   * @extends Shape
   */


  var Path = function (_Shape2) {
    _inherits(Path, _Shape2);

    /**
     * Path constructor
     * @param {PathStroke[]} strokes - The array of {@link PathStroke} objects defining this Path.
     */
    function Path(strokes) {
      _classCallCheck(this, Path);

      // Deep copy of the array of strokes
      var _this4 = _possibleConstructorReturn(this, (Path.__proto__ || Object.getPrototypeOf(Path)).call(this));

      if (strokes) {
        _this4.strokes = [];
        // In [Shaper](Shaper.html) objects, strokes have `action` instead of `type` and `data` instead of `points`
        strokes.forEach(function (str) {
          return _this4.strokes.push(new PathStroke(str.type || str.action, str.points || str.data));
        });
      }
      // Calculate the enclosing rectangle
      _this4.enclosing = new Rectangle();
      _this4.enclosingPoints = [];
      _this4.calcEnclosingRect();
      _this4.pos = _this4.enclosing.pos;
      return _this4;
    }

    //
    // Inherits the documentation of `clone` in Shape


    _createClass(Path, [{
      key: "clone",
      value: function clone() {
        return new Path(this.strokes.map(function (str) {
          return str.clone();
        }));
      }

      /**
       * Adds a {@link PathStroke} to `strokes`
       * @param {PathStroke} stroke
       */

    }, {
      key: "addStroke",
      value: function addStroke(stroke) {
        this.strokes.push(stroke);
        return this;
      }

      /**
       * Calculates the polygon and the rectangle that (approximately) encloses this shape
       * @returns {Rectangle}
       */

    }, {
      key: "calcEnclosingRect",
      value: function calcEnclosingRect() {
        var _this5 = this;

        this.enclosingPoints = [];
        var last = new Point();
        this.strokes.forEach(function (str) {
          str.getEnclosingPoints(last).forEach(function (pt) {
            last = new Point(pt);
            _this5.enclosingPoints.push(last);
          });
        });

        var l = this.enclosingPoints.length;
        if (l > 1 && this.enclosingPoints[0].equals(this.enclosingPoints[l - 1])) {
          this.enclosingPoints.pop();
          l--;
        }
        var p0 = new Point(this.enclosingPoints[0]),
            p1 = new Point(this.enclosingPoints[0]);

        for (var k = 1; k < l; k++) {
          var p = this.enclosingPoints[k];
          // Check if `p` is at left or above `p0`
          p0.x = Math.min(p.x, p0.x);
          p0.y = Math.min(p.y, p0.y);
          // Check if `p` is at right or below `p1`
          p1.x = Math.max(p.x, p1.x);
          p1.y = Math.max(p.y, p1.y);
        }
        this.enclosing.setBounds(new Rectangle(p0, new Dimension(p0, p1)));
        return this.enclosing;
      }

      //
      // Inherits the documentation of `getBounds` in Shape

    }, {
      key: "getBounds",
      value: function getBounds() {
        return this.enclosing;
      }

      //
      // Inherits the documentation of `moveBy` in Shape

    }, {
      key: "moveBy",
      value: function moveBy(delta) {
        this.strokes.forEach(function (str) {
          return str.moveBy(delta);
        });
        this.enclosingPoints.forEach(function (pt) {
          return pt.moveBy(delta);
        });
        this.enclosing.moveBy(delta);
        return this;
      }

      //
      // Inherits the documentation of `moveTo` in Shape

    }, {
      key: "moveTo",
      value: function moveTo(newPos) {
        return this.moveBy(new Dimension(newPos.x - this.pos.x, newPos.y - this.pos.y));
      }

      //
      // Inherits the documentation of `equals` in Shape
      // TODO: Implement comparision of complex paths

    }, {
      key: "equals",
      value: function equals(_p) {
        return false;
      }

      //
      // Inherits the documentation of `scaleBy` in Shape

    }, {
      key: "scaleBy",
      value: function scaleBy(delta) {
        this.strokes.forEach(function (str) {
          return str.multBy(delta);
        });
        this.enclosingPoints.forEach(function (pt) {
          return pt.multBy(delta);
        });
        this.enclosing.scaleBy(delta);
        return this;
      }

      //
      // Inherits the documentation of `contains` in Shape

    }, {
      key: "contains",
      value: function contains(p) {
        var result = this.enclosing.contains(p);
        if (result) {
          // Let's see if the point really lies inside the polygon formed by enclosingPoints
          // Using the "Ray casting algorithm" described in [https://en.wikipedia.org/wiki/Point_in_polygon]
          var N = this.enclosingPoints.length;
          var xinters = 0,
              counter = 0,
              p1 = this.enclosingPoints[0];

          for (var i = 1; i <= N; i++) {
            var p2 = this.enclosingPoints[i % N];
            if (p.y > Math.min(p1.y, p2.y)) {
              if (p.y <= Math.max(p1.y, p2.y)) {
                if (p.x <= Math.max(p1.x, p2.x)) {
                  if (p1.y !== p2.y) {
                    xinters = (p.y - p1.y) * (p2.x - p1.x) / (p2.y - p1.y) + p1.x;
                    if (p1.x === p2.x || p.x <= xinters) counter++;
                  }
                }
              }
            }
            p1 = p2;
          }
          if (counter % 2 === 0) result = false;
        }
        return result;
      }

      //
      // Inherits the documentation of `intersects` in Shape
      // TODO: Implement a check algorithm based on the real shape

    }, {
      key: "intersects",
      value: function intersects(r) {
        return this.enclosing.intersects(r);
      }

      //
      // Inherits the documentation of `preparePath` in Shape

    }, {
      key: "preparePath",
      value: function preparePath(ctx) {
        // TODO: Implement filling paths
        ctx.beginPath();
        this.strokes.forEach(function (str) {
          return str.stroke(ctx);
        });
        return ctx;
      }
    }]);

    return Path;
  }(Shape);

  Object.assign(Path.prototype, {
    /**
     * The strokes forming this Path.
     * @name Path#strokes
     * @type {PathStroke[]} */
    strokes: [],
    /**
     * The {@link Rectangle} enclosing this Path (when drawing, this Rectangle don't include border width!)
     * @name Path#enclosing
     * @type {Rectangle} */
    enclosing: new Rectangle(),
    /**
     * Set of vertexs of a polygon close to the real path of this shape
     * @name Path#enclosingPoints
     * @type {Point[]} */
    enclosingPoints: []
  });

  /**
   * PathStroke is the basic component of {@link Path} objects
   * @class
   */

  var PathStroke = function () {
    /**
     * PathStroke constructor
     * @param {string} type - The type of stroke. Possible values are: `M` (move to), `L` (line to),
     * `Q` (quadratic to), `B` (bezier to) and `X` (close path).
     * @param {Point[]} points - The array of {@link Point} objects used in this Stroke.
     */
    function PathStroke(type, points) {
      _classCallCheck(this, PathStroke);

      this.type = type;
      // Points are deep cloned, to avoid change the original values
      if (points && points.length > 0) {
        // Check if 'points' is an array of objects of type 'Point'
        if (points[0] instanceof Point) this.points = points.map(function (p) {
          return new Point(p);
        });
        // otherwise assume that 'points' contains just numbers
        // to be readed in pairs of x and y co-ordinates
        else {
            this.points = [];
            for (var i = 0; i < points.length; i += 2) {
              this.points.push(new Point(points[i], points[i + 1]));
            }
          }
      }
    }

    /**
     * Calculates some of the points included in a quadratic Bézier curve
     * The number of points being calculated is defined in Utils.settings.BEZIER_POINTS
     * @see {@link https://en.wikipedia.org/wiki/B%C3%A9zier_curve}
     * @see {@link https://www.jasondavies.com/animated-bezier/}
     *
     * @param {Point} p0 - Starting point of the quadratic Bézier curve
     * @param {Point} p1 - Control point
     * @param {Point} p2 - Ending point
     * @param {number=} numPoints - The number of intermediate points to calculate. When not defined,
     * the value will be obtained from {@link Utils.settings.BEZIER_POINTS}.
     * @returns {Point[]} - Array with some intermediate points from the resulting Bézier curve
     */


    _createClass(PathStroke, [{
      key: "clone",


      /**
       * Clones this PathStroke
       * @returns {PathStroke}
       */
      value: function clone() {
        // The constructors of PathStroke always make a deep copy of the `points` array
        return new PathStroke(this.type, this.points);
      }

      /**
       * Increments or decrements by `delta` the x and y coordinates of all points
       * @param {Point|Dimension} delta - The amount to add to the `x` and `y`
       * coordinates of each point.
       */

    }, {
      key: "moveBy",
      value: function moveBy(delta) {
        if (this.points) this.points.forEach(function (pt) {
          return pt.moveBy(delta);
        });
        return this;
      }

      /**
       * Multiplies each point coordinates by the `x` and `y` (or `w` and `h`) values of the
       * passed {@link Point} or {@link Dimension}.
       * @param {Point|Dimension} delta
       */

    }, {
      key: "multBy",
      value: function multBy(delta) {
        if (this.points) this.points.forEach(function (pt) {
          return pt.multBy(delta);
        });
        return this;
      }

      /**
       * Draws this PathStroke in the provided HTML canvas context
       * @param {external:CanvasRenderingContext2D} ctx - The HTML canvas 2D rendering context
       */

    }, {
      key: "stroke",
      value: function stroke(ctx) {
        switch (this.type) {
          case 'M':
            ctx.moveTo(this.points[0].x, this.points[0].y);
            break;
          case 'L':
            ctx.lineTo(this.points[0].x, this.points[0].y);
            break;
          case 'Q':
            ctx.quadraticCurveTo(this.points[0].x, this.points[0].y, this.points[1].x, this.points[1].y);
            break;
          case 'B':
            ctx.bezierCurveTo(this.points[0].x, this.points[0].y, this.points[1].x, this.points[1].y, this.points[2].x, this.points[2].y);
            break;
          case 'X':
            ctx.closePath();
            break;
        }
        return ctx;
      }

      /**
       * Gets the set of points that will be included as a vertexs on the owner's shape
       * enclosing polygon.
       * @param {Point} from - The starting point for this stroke
       * @returns {Point[]}
       */

    }, {
      key: "getEnclosingPoints",
      value: function getEnclosingPoints(from) {
        var result = [];
        switch (this.type) {
          case 'M':
          case 'L':
            result.push(this.points[0]);
            break;
          case 'Q':
            result = PathStroke.getQuadraticPoints(from, this.points[0], this.points[1]);
            result.push(this.points[1]);
            break;
          case 'B':
            result = PathStroke.getCubicPoints(from, this.points[0], this.points[1], this.points[2]);
            result.push(this.points[2]);
            break;
        }
        return result;
      }
    }], [{
      key: "getQuadraticPoints",
      value: function getQuadraticPoints(p0, p1, p2, numPoints) {
        if (!numPoints) numPoints = Utils.settings.BEZIER_POINTS;
        var result = [],
            pxa = new Point(),
            pxb = new Point();
        for (var i = 0; i < numPoints; i++) {
          var n = (i + 1) / (numPoints + 1);
          pxa.x = p0.x + (p1.x - p0.x) * n;
          pxa.y = p0.y - (p0.y - p1.y) * n;
          pxb.x = p1.x + (p2.x - p1.x) * n;
          pxb.y = p1.y + (p2.y - p1.y) * n;
          result.push(new Point(pxa.x + (pxb.x - pxa.x) * n, pxa.y - (pxa.y - pxb.y) * n));
        }
        return result;
      }

      /**
       * Calculates some of the points included in a cubic Bézier (curve with two control points)
       * The number of points being calculated is defined in Utils.settings.BEZIER_POINTS
       * @param {Point} p0 - Starting point of the cubic Bézier curve
       * @param {Point} p1 - First control point
       * @param {Point} p2 - Second control point
       * @param {Point} p3 - Ending point
       * @param {number=} numPoints - The number of intermediate points to calculate. When not defined,
       * the value will be obtained from {@link Utils.settings.BEZIER_POINTS}.
       * @returns {Point[]} - Array with some intermediate points from the resulting Bézier curve
       */

    }, {
      key: "getCubicPoints",
      value: function getCubicPoints(p0, p1, p2, p3, numPoints) {
        var result = [];
        if (!numPoints) numPoints = Utils.settings.BEZIER_POINTS;
        var pr = PathStroke.getQuadraticPoints(p0, p1, p2, numPoints);
        var pq = PathStroke.getQuadraticPoints(p1, p2, p3, numPoints);
        for (var i = 0; i < numPoints; i++) {
          var n = (i + 1) / (numPoints + 1);
          result.push(new Point(pr[i].x + (pq[i].x - pr[i].x) * n, pr[i].y - (pr[0].y - pq[0].y) * n));
        }
        return result;
      }
    }]);

    return PathStroke;
  }();

  Object.assign(PathStroke.prototype, {
    /**
     * The Stroke type. Possible values are: `M` (move to), `L` (line to), `Q` (quadratic to),
     * `B` (bezier to) and `X` (close path).
     * @name PathStroke#type
     * @type {string} */
    type: 'X',
    /**
     * The array of points used by this stroke. Can be `null`.
     * @name PathStroke#points
     * @type {Point[]} */
    points: null
  });

  /**
   * This class encapsulates actions that can be linked to buttons, menus and other active objects
   * @class
   */

  var Action = function () {
    /**
     * Action constructor
     * @param {string} name - The name of this Action
     * @param {function} actionPerformed - The callback to be triggered by this Action
     */
    function Action(name, actionPerformed) {
      _classCallCheck(this, Action);

      this.name = name;
      this.actionPerformed = actionPerformed;
      this._statusListeners = [];
    }

    /**
     * Here is where subclasses must define the callback to be triggered when
     * this Action object is called
     * @param {Action} _thisAction - Pointer to this Action object
     * @param {object} _event - The original action event that has originated this action
     */


    _createClass(Action, [{
      key: "actionPerformed",
      value: function actionPerformed(_thisAction, _event) {
        return this;
      }

      /**
       * This is the method to be passed to DOM event triggers
       * @example
       * const myFunc = () => { alert('Hello!') }
       * const myAction = new Action('hello', myFunc)
       * $( "#foo" ).bind( "click", myAction.processEvent)
       * @param {object} event - The event object passed by the DOM event trigger
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        return this.actionPerformed(this, event);
      }

      /**
       * Adds a status listener
       * @param {function} listener - The callback method to be called when the status of this
       * Action changes
       */

    }, {
      key: "addStatusListener",
      value: function addStatusListener(listener) {
        this._statusListeners.push(listener);
      }

      /**
       * Removes a previously registered status listener
       * @param {function} listener - The listener to be removed
       */

    }, {
      key: "removeStatusListener",
      value: function removeStatusListener(listener) {
        this._statusListeners = this._statusListeners.map(function (l) {
          return l !== listener;
        });
      }

      /**
       * Enables or disables this action
       * @param {boolean} enabled
       */

    }, {
      key: "setEnabled",
      value: function setEnabled(enabled) {
        var _this6 = this;

        this.enabled = enabled;
        this._statusListeners.forEach(function (listener) {
          return listener.call(_this6, _this6);
        });
        return this;
      }
    }]);

    return Action;
  }();

  Object.assign(Action.prototype, {
    /**
     * The action's name
     * @name Action#name
     * @type {string} */
    name: null,
    /**
     * An optional description
     * @name Action#description
     * @type {string} */
    description: null,
    /**
     * Action status. `true` means enabled, `false` disabled
     * @name Action#enabled
     * @type {boolean} */
    enabled: false,
    /**
     * Array of callback functions to be triggered when the `enabled` flag changes
     * @name Action#_statusListeners
     * @private
     * @type {function[]} */
    _statusListeners: null
  });

  /**
   * This class provides a timer that will launch a function at specific intervals
   * @class
   */

  var Timer = function () {
    /**
     * Timer constructor
     * @param {function} actionPerformed - The function to be triggered when the timer is enabled.
     * @param {number} interval - The interval between action calls, specified in milliseconds.
     * @param {boolean=} [enabled=false] - Flag to indicate if the timer will be initially enabled.
     */
    function Timer(actionPerformed, interval, enabled) {
      _classCallCheck(this, Timer);

      this.actionPerformed = actionPerformed;
      this.interval = interval;
      this.setEnabled(enabled === true);
    }

    /**
     * Here is where subclasses must define the function to be performed when this timer ticks.
     * @param {Timer} _thisTimer
     */


    _createClass(Timer, [{
      key: "actionPerformed",
      value: function actionPerformed(_thisTimer) {
        return this;
      }

      /**
       * This is the method called by `window.setInterval`
       * @param {Event} _event
       */

    }, {
      key: "processTimer",
      value: function processTimer(_event) {
        this.ticks++;
        if (!this.repeats) this.stop();
        return this.actionPerformed.call(this);
      }

      /**
       * Enables or disables this timer
       * @param {boolean} enabled - Indicates if the timer should be enabled or disabled
       * @param {boolean=} [retainCounter=false] - When `true`, the ticks counter will not be cleared
       */

    }, {
      key: "setEnabled",
      value: function setEnabled(enabled, retainCounter) {
        var _this7 = this;

        if (!retainCounter) this.ticks = 0;
        if (enabled && this.timer !== null) {
          // Timer already running
          return;
        }

        if (enabled) {
          this.timer = window.setInterval(function () {
            return _this7.processTimer(null);
          }, this.interval);
        } else {
          if (this.timer !== null) {
            window.clearInterval(this.timer);
            this.timer = null;
          }
        }
        return this;
      }

      /**
       * Checks if this timer is running
       * @returns {Boolean}
       */

    }, {
      key: "isRunning",
      value: function isRunning() {
        return this.timer !== null;
      }

      /**
       * Starts this timer
       * @param {boolean=} [retainCounter=false] - When `true`, the ticks counter will not be cleared
       */

    }, {
      key: "start",
      value: function start(retainCounter) {
        return this.setEnabled(true, retainCounter);
      }

      /**
       * Stops this timer
       * @param {boolean=} [retainCounter=false] - When `true`, the ticks counter will not be cleared
       */

    }, {
      key: "stop",
      value: function stop(retainCounter) {
        return this.setEnabled(false, retainCounter);
      }
    }]);

    return Timer;
  }();

  Object.assign(Timer.prototype, {
    /**
     * The timer interval, in milliseconds
     * @name Timer#interval
     * @type {number} */
    interval: 0,
    /**
     * The ticks counter
     * @name Timer#ticks
     * @type {number} */
    ticks: 0,
    /**
     * The object returned by `window.setInterval`
     * @name Timer#timer
     * @type {object} */
    timer: null,
    /**
     * When `true`, the timer should repeat until `stop` is called
     * @name Timer#repeats
     * @type {boolean} */
    repeats: true
  });

  /**
   * Logic object that takes care of an "invalidated" rectangle that will be repainted
   * at the next update of a 2D object, usually an HTML Canvas.
   * Container has the same constructor options as {@link Rectangle}
   * @class
   * @extends Rectangle
   */

  var Container = function (_Rectangle2) {
    _inherits(Container, _Rectangle2);

    /**
     * Container constructor
     * @param {Point|Rectangle|number|number[]} pos
     * @param {Dimension|number=} dim
     * @param {number=} w
     * @param {number=} h
     */
    function Container(pos, dim, w, h) {
      _classCallCheck(this, Container);

      return _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).call(this, pos, dim, w, h));
    }

    /**
     * Adds the provided rectangle to the invalidated area.
     * @param {Rectangle} rect
     */


    _createClass(Container, [{
      key: "invalidate",
      value: function invalidate(rect) {
        if (rect) {
          if (this.invalidatedRect === null) this.invalidatedRect = rect.clone();else this.invalidatedRect.add(rect);
        } else this.invalidatedRect = null;
        return this;
      }

      /**
       * Updates the invalidated area
       */

    }, {
      key: "update",
      value: function update() {
        this.updateContent(this.invalidatedRect);
        this.invalidatedRect = null;
        return this;
      }

      /**
       * Containers should implement this method to update its graphic contents. It should
       * be called from {@link Container~update}
       * @param {Shape} _dirtyRegion - Specifies the area to be updated. When `null`, it's the whole
       * Container.
       */

    }, {
      key: "updateContent",
      value: function updateContent(_dirtyRegion) {
        // To be overrided by subclasses. Here does nothing.
        return this;
      }
    }]);

    return Container;
  }(Rectangle);

  Object.assign(Container.prototype, {
    /**
     * The currently "invalidated" area
     * @name Container#invalidatedRect
     * @type {Rectangle} */
    invalidatedRect: null
  });

  // Returns a composite object with all classes
  return {
    Font: Font,
    Gradient: Gradient,
    Stroke: Stroke,
    Point: Point,
    Dimension: Dimension,
    Shape: Shape,
    Rectangle: Rectangle,
    Ellipse: Ellipse,
    Path: Path,
    PathStroke: PathStroke,
    Action: Action,
    Timer: Timer,
    Container: Container
  };
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var isObject = __webpack_require__(7);
module.exports = function (it) {
  if (!isObject(it)) throw TypeError(it + ' is not an object!');
  return it;
};

/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self
// eslint-disable-next-line no-new-func
: Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef

/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = function (exec) {
  try {
    return !!exec();
  } catch (e) {
    return true;
  }
};

/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

module.exports = function (it) {
  return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) === 'object' ? it !== null : typeof it === 'function';
};

/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var store = __webpack_require__(77)('wks');
var uid = __webpack_require__(45);
var _Symbol = __webpack_require__(5).Symbol;
var USE_SYMBOL = typeof _Symbol == 'function';

var $exports = module.exports = function (name) {
  return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : uid)('Symbol.' + name));
};

$exports.store = store;

/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var support = __webpack_require__(41);
var base64 = __webpack_require__(183);
var nodejsUtils = __webpack_require__(94);
var setImmediate = __webpack_require__(434);
var external = __webpack_require__(71);

/**
 * Convert a string that pass as a "binary string": it should represent a byte
 * array but may have > 255 char codes. Be sure to take only the first byte
 * and returns the byte array.
 * @param {String} str the string to transform.
 * @return {Array|Uint8Array} the string in a binary format.
 */
function string2binary(str) {
    var result = null;
    if (support.uint8array) {
        result = new Uint8Array(str.length);
    } else {
        result = new Array(str.length);
    }
    return stringToArrayLike(str, result);
}

/**
 * Create a new blob with the given content and the given type.
 * @param {String|ArrayBuffer} part the content to put in the blob. DO NOT use
 * an Uint8Array because the stock browser of android 4 won't accept it (it
 * will be silently converted to a string, "[object Uint8Array]").
 *
 * Use only ONE part to build the blob to avoid a memory leak in IE11 / Edge:
 * when a large amount of Array is used to create the Blob, the amount of
 * memory consumed is nearly 100 times the original data amount.
 *
 * @param {String} type the mime type of the blob.
 * @return {Blob} the created blob.
 */
exports.newBlob = function (part, type) {
    exports.checkSupport("blob");

    try {
        // Blob constructor
        return new Blob([part], {
            type: type
        });
    } catch (e) {

        try {
            // deprecated, browser only, old way
            var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder;
            var builder = new Builder();
            builder.append(part);
            return builder.getBlob(type);
        } catch (e) {

            // well, fuck ?!
            throw new Error("Bug : can't construct the Blob.");
        }
    }
};
/**
 * The identity function.
 * @param {Object} input the input.
 * @return {Object} the same input.
 */
function identity(input) {
    return input;
}

/**
 * Fill in an array with a string.
 * @param {String} str the string to use.
 * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated).
 * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array.
 */
function stringToArrayLike(str, array) {
    for (var i = 0; i < str.length; ++i) {
        array[i] = str.charCodeAt(i) & 0xFF;
    }
    return array;
}

/**
 * An helper for the function arrayLikeToString.
 * This contains static informations and functions that
 * can be optimized by the browser JIT compiler.
 */
var arrayToStringHelper = {
    /**
     * Transform an array of int into a string, chunk by chunk.
     * See the performances notes on arrayLikeToString.
     * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.
     * @param {String} type the type of the array.
     * @param {Integer} chunk the chunk size.
     * @return {String} the resulting string.
     * @throws Error if the chunk is too big for the stack.
     */
    stringifyByChunk: function stringifyByChunk(array, type, chunk) {
        var result = [],
            k = 0,
            len = array.length;
        // shortcut
        if (len <= chunk) {
            return String.fromCharCode.apply(null, array);
        }
        while (k < len) {
            if (type === "array" || type === "nodebuffer") {
                result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len))));
            } else {
                result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len))));
            }
            k += chunk;
        }
        return result.join("");
    },
    /**
     * Call String.fromCharCode on every item in the array.
     * This is the naive implementation, which generate A LOT of intermediate string.
     * This should be used when everything else fail.
     * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.
     * @return {String} the result.
     */
    stringifyByChar: function stringifyByChar(array) {
        var resultStr = "";
        for (var i = 0; i < array.length; i++) {
            resultStr += String.fromCharCode(array[i]);
        }
        return resultStr;
    },
    applyCanBeUsed: {
        /**
         * true if the browser accepts to use String.fromCharCode on Uint8Array
         */
        uint8array: function () {
            try {
                return support.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1;
            } catch (e) {
                return false;
            }
        }(),
        /**
         * true if the browser accepts to use String.fromCharCode on nodejs Buffer.
         */
        nodebuffer: function () {
            try {
                return support.nodebuffer && String.fromCharCode.apply(null, nodejsUtils.allocBuffer(1)).length === 1;
            } catch (e) {
                return false;
            }
        }()
    }
};

/**
 * Transform an array-like object to a string.
 * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.
 * @return {String} the result.
 */
function arrayLikeToString(array) {
    // Performances notes :
    // --------------------
    // String.fromCharCode.apply(null, array) is the fastest, see
    // see http://jsperf.com/converting-a-uint8array-to-a-string/2
    // but the stack is limited (and we can get huge arrays !).
    //
    // result += String.fromCharCode(array[i]); generate too many strings !
    //
    // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2
    // TODO : we now have workers that split the work. Do we still need that ?
    var chunk = 65536,
        type = exports.getTypeOf(array),
        canUseApply = true;
    if (type === "uint8array") {
        canUseApply = arrayToStringHelper.applyCanBeUsed.uint8array;
    } else if (type === "nodebuffer") {
        canUseApply = arrayToStringHelper.applyCanBeUsed.nodebuffer;
    }

    if (canUseApply) {
        while (chunk > 1) {
            try {
                return arrayToStringHelper.stringifyByChunk(array, type, chunk);
            } catch (e) {
                chunk = Math.floor(chunk / 2);
            }
        }
    }

    // no apply or chunk error : slow and painful algorithm
    // default browser on android 4.*
    return arrayToStringHelper.stringifyByChar(array);
}

exports.applyFromCharCode = arrayLikeToString;

/**
 * Copy the data from an array-like to an other array-like.
 * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array.
 * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated.
 * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array.
 */
function arrayLikeToArrayLike(arrayFrom, arrayTo) {
    for (var i = 0; i < arrayFrom.length; i++) {
        arrayTo[i] = arrayFrom[i];
    }
    return arrayTo;
}

// a matrix containing functions to transform everything into everything.
var transform = {};

// string to ?
transform["string"] = {
    "string": identity,
    "array": function array(input) {
        return stringToArrayLike(input, new Array(input.length));
    },
    "arraybuffer": function arraybuffer(input) {
        return transform["string"]["uint8array"](input).buffer;
    },
    "uint8array": function uint8array(input) {
        return stringToArrayLike(input, new Uint8Array(input.length));
    },
    "nodebuffer": function nodebuffer(input) {
        return stringToArrayLike(input, nodejsUtils.allocBuffer(input.length));
    }
};

// array to ?
transform["array"] = {
    "string": arrayLikeToString,
    "array": identity,
    "arraybuffer": function arraybuffer(input) {
        return new Uint8Array(input).buffer;
    },
    "uint8array": function uint8array(input) {
        return new Uint8Array(input);
    },
    "nodebuffer": function nodebuffer(input) {
        return nodejsUtils.newBufferFrom(input);
    }
};

// arraybuffer to ?
transform["arraybuffer"] = {
    "string": function string(input) {
        return arrayLikeToString(new Uint8Array(input));
    },
    "array": function array(input) {
        return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength));
    },
    "arraybuffer": identity,
    "uint8array": function uint8array(input) {
        return new Uint8Array(input);
    },
    "nodebuffer": function nodebuffer(input) {
        return nodejsUtils.newBufferFrom(new Uint8Array(input));
    }
};

// uint8array to ?
transform["uint8array"] = {
    "string": arrayLikeToString,
    "array": function array(input) {
        return arrayLikeToArrayLike(input, new Array(input.length));
    },
    "arraybuffer": function arraybuffer(input) {
        return input.buffer;
    },
    "uint8array": identity,
    "nodebuffer": function nodebuffer(input) {
        return nodejsUtils.newBufferFrom(input);
    }
};

// nodebuffer to ?
transform["nodebuffer"] = {
    "string": arrayLikeToString,
    "array": function array(input) {
        return arrayLikeToArrayLike(input, new Array(input.length));
    },
    "arraybuffer": function arraybuffer(input) {
        return transform["nodebuffer"]["uint8array"](input).buffer;
    },
    "uint8array": function uint8array(input) {
        return arrayLikeToArrayLike(input, new Uint8Array(input.length));
    },
    "nodebuffer": identity
};

/**
 * Transform an input into any type.
 * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer.
 * If no output type is specified, the unmodified input will be returned.
 * @param {String} outputType the output type.
 * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert.
 * @throws {Error} an Error if the browser doesn't support the requested output type.
 */
exports.transformTo = function (outputType, input) {
    if (!input) {
        // undefined, null, etc
        // an empty string won't harm.
        input = "";
    }
    if (!outputType) {
        return input;
    }
    exports.checkSupport(outputType);
    var inputType = exports.getTypeOf(input);
    var result = transform[inputType][outputType](input);
    return result;
};

/**
 * Return the type of the input.
 * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer.
 * @param {Object} input the input to identify.
 * @return {String} the (lowercase) type of the input.
 */
exports.getTypeOf = function (input) {
    if (typeof input === "string") {
        return "string";
    }
    if (Object.prototype.toString.call(input) === "[object Array]") {
        return "array";
    }
    if (support.nodebuffer && nodejsUtils.isBuffer(input)) {
        return "nodebuffer";
    }
    if (support.uint8array && input instanceof Uint8Array) {
        return "uint8array";
    }
    if (support.arraybuffer && input instanceof ArrayBuffer) {
        return "arraybuffer";
    }
};

/**
 * Throw an exception if the type is not supported.
 * @param {String} type the type to check.
 * @throws {Error} an Error if the browser doesn't support the requested type.
 */
exports.checkSupport = function (type) {
    var supported = support[type.toLowerCase()];
    if (!supported) {
        throw new Error(type + " is not supported by this platform");
    }
};

exports.MAX_VALUE_16BITS = 65535;
exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1

/**
 * Prettify a string read as binary.
 * @param {string} str the string to prettify.
 * @return {string} a pretty string.
 */
exports.pretty = function (str) {
    var res = '',
        code,
        i;
    for (i = 0; i < (str || "").length; i++) {
        code = str.charCodeAt(i);
        res += '\\x' + (code < 16 ? "0" : "") + code.toString(16).toUpperCase();
    }
    return res;
};

/**
 * Defer the call of a function.
 * @param {Function} callback the function to call asynchronously.
 * @param {Array} args the arguments to give to the callback.
 */
exports.delay = function (callback, args, self) {
    setImmediate(function () {
        callback.apply(self || null, args || []);
    });
};

/**
 * Extends a prototype with an other, without calling a constructor with
 * side effects. Inspired by nodejs' `utils.inherits`
 * @param {Function} ctor the constructor to augment
 * @param {Function} superCtor the parent constructor to use
 */
exports.inherits = function (ctor, superCtor) {
    var Obj = function Obj() {};
    Obj.prototype = superCtor.prototype;
    ctor.prototype = new Obj();
};

/**
 * Merge the objects passed as parameters into a new one.
 * @private
 * @param {...Object} var_args All objects to merge.
 * @return {Object} a new object with the data of the others.
 */
exports.extend = function () {
    var result = {},
        i,
        attr;
    for (i = 0; i < arguments.length; i++) {
        // arguments is not enumerable in some browsers
        for (attr in arguments[i]) {
            if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") {
                result[attr] = arguments[i][attr];
            }
        }
    }
    return result;
};

/**
 * Transform arbitrary content into a Promise.
 * @param {String} name a name for the content being processed.
 * @param {Object} inputData the content to process.
 * @param {Boolean} isBinary true if the content is not an unicode string
 * @param {Boolean} isOptimizedBinaryString true if the string content only has one byte per character.
 * @param {Boolean} isBase64 true if the string content is encoded with base64.
 * @return {Promise} a promise in a format usable by JSZip.
 */
exports.prepareContent = function (name, inputData, isBinary, isOptimizedBinaryString, isBase64) {

    // if inputData is already a promise, this flatten it.
    var promise = external.Promise.resolve(inputData).then(function (data) {

        var isBlob = support.blob && (data instanceof Blob || ['[object File]', '[object Blob]'].indexOf(Object.prototype.toString.call(data)) !== -1);

        if (isBlob && typeof FileReader !== "undefined") {
            return new external.Promise(function (resolve, reject) {
                var reader = new FileReader();

                reader.onload = function (e) {
                    resolve(e.target.result);
                };
                reader.onerror = function (e) {
                    reject(e.target.error);
                };
                reader.readAsArrayBuffer(data);
            });
        } else {
            return data;
        }
    });

    return promise.then(function (data) {
        var dataType = exports.getTypeOf(data);

        if (!dataType) {
            return external.Promise.reject(new Error("Can't read the data of '" + name + "'. Is it " + "in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
        }
        // special case : it's way easier to work with Uint8Array than with ArrayBuffer
        if (dataType === "arraybuffer") {
            data = exports.transformTo("uint8array", data);
        } else if (dataType === "string") {
            if (isBase64) {
                data = base64.decode(data);
            } else if (isBinary) {
                // optimizedBinaryString === true means that the file has already been filtered with a 0xFF mask
                if (isOptimizedBinaryString !== true) {
                    // this is a string, not in a base64 format.
                    // Be sure that this is a correct "binary string"
                    data = string2binary(data);
                }
            }
        }
        return data;
    });
};

/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(6)(function () {
  return Object.defineProperty({}, 'a', { get: function get() {
      return 7;
    } }).a != 7;
});

/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var anObject = __webpack_require__(4);
var IE8_DOM_DEFINE = __webpack_require__(141);
var toPrimitive = __webpack_require__(29);
var dP = Object.defineProperty;

exports.f = __webpack_require__(10) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  anObject(O);
  P = toPrimitive(P, true);
  anObject(Attributes);
  if (IE8_DOM_DEFINE) try {
    return dP(O, P, Attributes);
  } catch (e) {/* empty */}
  if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  if ('value' in Attributes) O[P] = Attributes.value;
  return O;
};

/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 7.1.15 ToLength
var toInteger = __webpack_require__(31);
var min = Math.min;
module.exports = function (it) {
  return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};

/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : Activity.js
 *  Created : 07/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2), __webpack_require__(3), __webpack_require__(136), __webpack_require__(73), __webpack_require__(138), __webpack_require__(57), __webpack_require__(212), __webpack_require__(213), __webpack_require__(491), __webpack_require__(492)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Utils, AWT, EventSounds, ActiveBoxContent, ActiveBagContent, BoxBase, AutoContentProvider, TextGridContent, Evaluator, TextActivityDocument) {

  // Direct access to global setings
  var K = Utils.settings;

  // Event used for detecting touch devices
  var TOUCH_TEST_EVENT = 'touchstart';

  /**
   * Activity is the abstract base class of JClic activities. It defines also the inner class
   * {@link Activity.ActivityPanel}, wich is responsible for user interaction with the activity
   * content.
   * Activities should extend both `Activity` and `ActivityPanel` classes in order to become fully
   * operative.
   * @exports Activity
   * @class
   * @abstract
   */

  var Activity = function () {
    /**
     * Activity constructor
     * @param {JClicProject} project - The {@link JClicProject} to which this activity belongs
     */
    function Activity(project) {
      _classCallCheck(this, Activity);

      this.project = project;
      this.eventSounds = new EventSounds(this.project.settings.eventSounds);
      this.messages = {};
      this.abc = {};
    }

    /**
     * Factory constructor that returns a specific type of Activity based on the `class` attribute
     * declared in the $xml parameter.
     * @param {external:jQuery} $xml - The XML element to be parsed
     * @param {JClicProject} project - The {@link JClicProject} to which this activity belongs
     * @returns {Activity}
     */


    _createClass(Activity, [{
      key: "setProperties",


      /**
       * Loads this object settings from an XML element
       * @param {external:jQuery} $xml - The jQuery XML element to parse
       */
      value: function setProperties($xml) {
        var _this = this;

        // Read attributes
        Utils.attrForEach($xml.get(0).attributes, function (name, val) {
          switch (name) {
            // Generic attributes:
            case 'name':
              val = Utils.nSlash(val);
            /* falls through */
            case 'code':
            case 'type':
            case 'description':
              _this[name] = val;
              break;

            case 'class':
              _this.className = val.replace(/^edu\.xtec\.jclic\.activities\./, '@');
              break;

            case 'inverse':
              _this.invAss = Utils.getBoolean(val, false);
              break;

            case 'autoJump':
            case 'forceOkToAdvance':
            case 'amongParagraphs':
              _this[name] = Utils.getBoolean(val, false);
              break;
          }
        });

        // Read specific nodes
        $xml.children().each(function (_n, child) {
          var $node = $(child);
          switch (child.nodeName) {
            case 'settings':
              // Read more attributes
              Utils.attrForEach($node.get(0).attributes, function (name, val) {
                switch (name) {
                  case 'infoUrl':
                  case 'infoCmd':
                    _this[name] = val;
                    break;

                  case 'margin':
                  case 'maxTime':
                  case 'maxActions':
                    _this[name] = Number(val);
                    break;

                  case 'report':
                    _this.includeInReports = Utils.getBoolean(val, false);
                    break;
                  case 'countDownTime':
                  case 'countDownActions':
                  case 'reportActions':
                  case 'useOrder':
                  case 'dragCells':
                    _this[name] = Utils.getBoolean(val, false);
                    break;
                }
              });

              // Read elements of _settings_
              $node.children().each(function (_n, child) {
                var $node = $(child);
                switch (child.nodeName) {
                  case 'skin':
                    _this.skinFileName = $node.attr('file');
                    break;

                  case 'helpWindow':
                    _this.helpMsg = Utils.getXmlText(_this);
                    _this.showSolution = Utils.getBoolean($node.attr('showSolution'), false);
                    _this.helpWindow = _this.helpMsg !== null || _this.showSolution;
                    break;

                  case 'container':
                    // Read settings related to the 'container'
                    // (the main panel containing the activity and other elements)
                    _this.bgColor = Utils.checkColor($node.attr('bgColor'), Utils.settings.BoxBase.BACK_COLOR);

                    $node.children().each(function (_n, child) {
                      var $child = $(child);
                      switch (child.nodeName) {
                        case 'image':
                          _this.bgImageFile = $child.attr('name');
                          _this.tiledBgImg = Utils.getBoolean($child.attr('tiled'), false);
                          break;
                        case 'counters':
                          _this.bTimeCounter = Utils.getBoolean($child.attr('time'), true);
                          _this.bActionsCounter = Utils.getBoolean($child.attr('actions'), true);
                          _this.bScoreCounter = Utils.getBoolean($child.attr('score'), true);
                          break;
                        case 'gradient':
                          _this.bgGradient = new AWT.Gradient().setProperties($child);
                          break;
                      }
                    });
                    break;

                  case 'window':
                    // Read settings related to the 'window'
                    // (the panel where the activity deploys its content)
                    _this.activityBgColor = Utils.checkColor($node.attr('bgColor'), K.DEFAULT_BG_COLOR);
                    _this.transparentBg = Utils.getBoolean($node.attr('transparent'), false);
                    _this.border = Utils.getBoolean($node.attr('border'), false);
                    $node.children().each(function (_n, child) {
                      var $child = $(child);
                      switch (child.nodeName) {
                        case 'gradient':
                          _this.activityBgGradient = new AWT.Gradient().setProperties($child);
                          break;
                        case 'position':
                          _this.absolutePosition = new AWT.Point().setProperties($child);
                          _this.absolutePositioned = true;
                          break;
                        case 'size':
                          _this.windowSize = new AWT.Dimension().setProperties($child);
                          break;
                      }
                    });
                    break;

                  case 'eventSounds':
                    // eventSounds is already created in constructor,
                    // just read properties
                    _this.eventSounds.setProperties($node);
                    break;
                }
              });
              break;

            case 'messages':
              $node.children('cell').each(function (_n, child) {
                var m = _this.readMessage($(child));
                // Possible message types are: `initial`, `final`, `previous`, `finalError`
                _this.messages[m.type] = m;
              });
              break;

            case 'automation':
              // Read the automation settings ('Arith' or other automation engines)
              _this.acp = AutoContentProvider.getProvider($node, _this.project);
              break;

            // Settings specific to panel-type activities (puzzles, associations...)
            case 'cells':
              // Read the [ActiveBagContent](ActiveBagContent.html) objects
              var cellSet = new ActiveBagContent().setProperties($node, _this.project.mediaBag);
              // Valid ids:
              // - Panel activities: 'primary', 'secondary', solvedPrimary'
              // - Textpanel activities: 'acrossClues', 'downClues', 'answers'
              _this.abc[cellSet.id] = cellSet;
              break;

            case 'scramble':
              // Read the 'scramble' mode
              _this.shuffles = Number($node.attr('times'));
              _this.scramble.primary = Utils.getBoolean($node.attr('primary'));
              _this.scramble.secondary = Utils.getBoolean($node.attr('secondary'));
              break;

            case 'layout':
              Utils.attrForEach($node.get(0).attributes, function (name, value) {
                switch (name) {
                  case 'position':
                    _this.boxGridPos = value;
                    break;
                  case 'wildTransparent':
                  case 'upperCase':
                  case 'checkCase':
                    _this[name] = Utils.getBoolean(value);
                }
              });
              break;

            // Element specific to {@link Menu} activities:
            case 'menuElement':
              _this.menuElements.push({
                caption: $node.attr('caption') || '',
                icon: $node.attr('icon') || null,
                projectPath: $node.attr('path') || null,
                sequence: $node.attr('sequence') || null,
                description: $node.attr('description') || ''
              });
              break;

            // Element specific to {@link CrossWord} and
            // {@link WordSearch} activities:
            case 'textGrid':
              // Read the 'textGrid' element into a {@link TextGridContent}
              _this.tgc = new TextGridContent().setProperties($node);
              break;

            // Read the clues of {@link WordSearch} activities
            case 'clues':
              // Read the array of clues
              _this.clues = [];
              _this.clueItems = [];
              $node.children('clue').each(function (n, child) {
                _this.clueItems[n] = Number($(child).attr('id'));
                _this.clues[n] = child.textContent;
              });
              break;

            // Elements specific to text activities:
            case 'checkButton':
              _this.checkButtonText = child.textContent || 'check';
              break;

            case 'prevScreen':
              _this.prevScreen = true;
              _this.prevScreenMaxTime = $node.attr('maxTime') || -1;
              $node.children().each(function (_n, child) {
                switch (child.nodeName) {
                  case 'style':
                    _this.prevScreenStyle = new BoxBase().setProperties($(child));
                    break;
                  case 'p':
                    if (_this.prevScreenText === null) _this.prevScreenText = '';
                    _this.prevScreenText += "<p>" + child.textContent + "</p>";
                    break;
                }
              });
              break;

            case 'evaluator':
              _this.ev = Evaluator.getEvaluator($node);
              break;

            case 'document':
              // Read main document of text activities
              _this.document = new TextActivityDocument().setProperties($node, _this.project.mediaBag);
              break;
          }
        });
        return this;
      }

      /**
       * Read an activity message from an XML element
       * @param {external:jQuery} $xml - The XML element to be parsed
       * @returns {ActiveBoxContent}
       */

    }, {
      key: "readMessage",
      value: function readMessage($xml) {
        var msg = new ActiveBoxContent().setProperties($xml, this.project.mediaBag);
        //
        // Allowed types are: `initial`, `final`, `previous`, `finalError`
        msg.type = $xml.attr('type');
        if (Utils.isNullOrUndef(msg.bb)) msg.bb = new BoxBase(null);
        return msg;
      }

      /**
       * Initialises the {@link AutoContentProvider}, when defined.
       */

    }, {
      key: "initAutoContentProvider",
      value: function initAutoContentProvider() {
        if (this.acp !== null) this.acp.init();
      }

      /**
       * Preloads the media content of the activity.
       * @param {PlayStation} ps - The {@link PlayStation} used to realize the media objects.
       */

    }, {
      key: "prepareMedia",
      value: function prepareMedia(ps) {
        this.eventSounds.realize(ps, this.project.mediaBag);
        $.each(this.messages, function (_key, msg) {
          if (msg !== null) msg.prepareMedia(ps);
        });
        $.each(this.abc, function (_key, abc) {
          if (abc !== null) abc.prepareMedia(ps);
        });
        return true;
      }

      /**
       * Whether the activity allows the user to request the solution.
       * @returns {boolean}
       */

    }, {
      key: "helpSolutionAllowed",
      value: function helpSolutionAllowed() {
        return false;
      }

      /**
       * Whether the activity allows the user to request help.
       * @returns {boolean}
       */

    }, {
      key: "helpWindowAllowed",
      value: function helpWindowAllowed() {
        return this.helpWindow && (this.helpSolutionAllowed() && this.showSolution || this.helpMsg !== null);
      }

      /**
       * Retrieves the minimum number of actions needed to solve this activity.
       * @returns {number}
       */

    }, {
      key: "getMinNumActions",
      value: function getMinNumActions() {
        return 0;
      }

      /**
       * When this method returns `true`, the automatic jump to the next activity must be paused at
       * this activity.
       * @returns {boolean}
       */

    }, {
      key: "mustPauseSequence",
      value: function mustPauseSequence() {
        return this.getMinNumActions() !== 0;
      }

      /**
       * Whether or not the activity can be reset
       * @returns {boolean}
       */

    }, {
      key: "canReinit",
      value: function canReinit() {
        return true;
      }

      /**
       * Whether or not the activity has additional information to be shown.
       * @returns {boolean}
       */

    }, {
      key: "hasInfo",
      value: function hasInfo() {
        return this.infoUrl !== null && this.infoUrl.length > 0 || this.infoCmd !== null && this.infoCmd.length > 0;
      }

      /**
       * Whether or not the activity uses random to scramble internal components
       * @returns {boolean}
       */

    }, {
      key: "hasRandom",
      value: function hasRandom() {
        return false;
      }

      /**
       * When `true`, the activity must always be scrambled
       * @returns {boolean}
       */

    }, {
      key: "shuffleAlways",
      value: function shuffleAlways() {
        return false;
      }

      /**
       * When `true`, the activity makes use of the keyboard
       * @returns {boolean}
       */

    }, {
      key: "needsKeyboard",
      value: function needsKeyboard() {
        return false;
      }

      /**
       * Called when the activity must be disposed
       */

    }, {
      key: "end",
      value: function end() {
        this.eventSounds.close();
        this.clear();
      }

      /**
       * Called when the activity must reset its internal components
       */

    }, {
      key: "clear",
      value: function clear() {}

      /**
       *
       * Getter method for `windowSize`
       * @returns {AWT.Dimension}
       */

    }, {
      key: "getWindowSize",
      value: function getWindowSize() {
        return new AWT.Dimension(this.windowSize);
      }

      /**
       * Setter method for `windowSize`
       * @param {AWT.Dimension} windowSize
       */

    }, {
      key: "setWindowSize",
      value: function setWindowSize(windowSize) {
        this.windowSize = new AWT.Dimension(windowSize);
      }

      /**
       * Builds the {@link Activity.Panel} object.
       * Subclasses must update the `Panel` member of its prototypes to produce specific panels.
       * @param {PlayStation} ps - The {@link PlayStation} used to build media objects.
       * @returns {ActivityPanel}
       */

    }, {
      key: "getActivityPanel",
      value: function getActivityPanel(ps) {
        return new this.constructor.Panel(this, ps);
      }
    }], [{
      key: "getActivity",
      value: function getActivity($xml, project) {
        var act = null;
        if ($xml && project) {
          var className = ($xml.attr('class') || '').replace(/^edu\.xtec\.jclic\.activities\./, '@'),
              cl = Activity.CLASSES[className];
          if (cl) {
            act = new cl(project);
            act.setProperties($xml);
          } else Utils.log('error', "Unknown activity class: " + className);
        }
        return act;
      }
    }]);

    return Activity;
  }();

  /**
   * Classes derived from `Activity` should register themselves by adding a field to
   * `Activity.CLASSES` using its name as identifier and the class constructor as a value.
   * @example
   * // To be included at the end of MyActivity class:
   * Activity.CLASSES['custom@myActivity'] = MyActivity
   * @type {object}
   */


  Activity.CLASSES = {
    '@panels.Menu': Activity
  };

  Object.assign(Activity.prototype, {
    /**
     * The {@link JClicProject} to which this activity belongs
     * @name Activity#project
     * @type {JClicProject} */
    project: null,
    /**
     * The Activity name
     * @name Activity#name
     * @type {string} */
    name: K.DEFAULT_NAME,
    /**
     * The class name of this Activity
     * @name Activity#className
     * @type {string} */
    className: null,
    /**
     * Code used in reports to filter queries. Default is `null`.
     * @name Activity#code
     * @type {string} */
    code: null,
    /**
     * Type of activity, used in text activities to distinguish between different variants of the
     * same activity. Possible values are: `orderWords`, `orderParagraphs`, `identifyWords` and
     * `identifyChars`.
     * @name Activity#type
     * @type {string} */
    type: null,
    /**
     * A short description of the activity
     * @name Activity#description
     * @type {string} */
    description: null,
    /**
     * The space between the activity components measured in pixels.
     * @name Activity#margin
     * @type {number} */
    margin: K.DEFAULT_MARGIN,
    /**
     * The background color of the activity panel
     * @name Activity#bgColor
     * @type {string} */
    bgColor: K.DEFAULT_BG_COLOR,
    /**
     * When set, gradient used to draw the activity window background
     * @name Activity#bgGradient
     * @type {AWT.Gradient} */
    bgGradient: null,
    /**
     * Whether the bgImage (if any) has to be tiled across the panel background
     * @name Activity#tiledBgImg
     * @type {boolean} */
    tiledBgImg: false,
    /**
     * Filename of the image used as a panel background.
     * @name Activity#bgImageFile
     * @type {string} */
    bgImageFile: null,
    /**
     * Whether to draw a border around the activity panel
     * @name Activity#border
     * @type {boolean} */
    border: true,
    /**
     * Whether to place the activity panel at the point specified by `absolutePosition` or leave
     * it centered on the main player's window.
     * @name Activity#absolutePositioned
     * @type {boolean} */
    absolutePositioned: false,
    /**
     * The position of the activity panel on the player.
     * @name Activity#absolutePosition
     * @type {AWT.Point} */
    absolutePosition: null,
    /**
     * Whether to generate usage reports
     * @name Activity#includeInReports
     * @type {boolean} */
    includeInReports: true,
    /**
     * Whether to send action events to the {@link Reporter}
     * @name Activity#reportActions
     * @type {boolean} */
    reportActions: false,
    /**
     * Whether to allow help about the activity or not.
     * @name Activity#helpWindow
     * @type {boolean} */
    helpWindow: false,
    /**
     * Whether to show the solution on the help window.
     * @name Activity#showSolution
     * @type {boolean} */
    showSolution: false,
    /**
     * Message to be shown in the help window when `showSolution` is `false`.
     * @name Activity#helpMsg
     * @type {string} */
    helpMsg: '',
    /**
     * Specific set of {@link EventSounds} used in the activity. The default is `null`, meaning
     * to use the default event sounds.
     * @name Activity#eventSounds
     * @type {EventSounds} */
    eventSounds: null,
    /**
     * Wheter the activity must be solved in a specific order or not.
     * @name Activity#useOrder
     * @type {boolean} */
    useOrder: false,
    /**
     * Wheter the cells of the activity will be dragged across the screen.
     * When `false`, a line will be painted to link elements.
     * @name Activity#dragCells
     * @type {boolean} */
    dragCells: false,
    /**
     * File name of the Skin used by the activity. The default value is `null`, meaning that the
     * activity will use the skin specified for the project.
     * @name Activity#skinFileName
     * @type {string} */
    skinFileName: null,
    /**
     * Maximum amount of time (seconds) to solve the activity. The default value is 0, meaning
     * unlimited time.
     * @name Activity#maxTime
     * @type {number}*/
    maxTime: 0,
    /**
     * Whether the time counter should display a countdown when `maxTime > 0`
     * @name Activity#countDownTime
     * @type {boolean} */
    countDownTime: false,
    /**
     * Maximum number of actions allowed to solve the activity. The default value is 0, meaning
     * unlimited actions.
     * @name Activity#maxActions
     * @type {number}*/
    maxActions: 0,
    /**
     * Whether the actions counter should display a countdown when `maxActions > 0`
     * @name Activity#countDownActions
     * @type {boolean} */
    countDownActions: false,
    /**
     * URL to be launched when the user clicks on the 'info' button. Default is `null`.
     * @name Activity#infoUrl
     * @type {string} */
    infoUrl: null,
    /**
     * System command to be launched when the user clicks on the 'info' button. Default is `null`.
     * Important: this parameter is currently not being used
     * @name Activity#infoCmd
     * @type {string} */
    infoCmd: null,
    /**
     * The content of the initial, final, previous and error messages shown by the activity.
     * @name Activity#messages
     * @type {ActiveBoxContent[]} */
    messages: null,
    /**
     * Preferred dimension of the activity window
     * @name Activity#windowSize
     * @type {AWT.Dimension} */
    windowSize: new AWT.Dimension(K.DEFAULT_WIDTH, K.DEFAULT_HEIGHT),
    /**
     * Whether the activity window has transparent background.
     * @name Activity#transparentBg
     * @type {boolean} */
    transparentBg: false,
    /**
     * The background color of the activity
     * @name Activity#activityBgColor
     * @type {string} */
    activityBgColor: K.DEFAULT_BG_COLOR,
    /**
     * Gradient used to draw backgrounds inside the activity.
     * @name Activity#activityBgGradient
     * @type {AWT.Gradient} */
    activityBgGradient: null,
    /**
     * Whether to display or not the 'time' counter
     * @name Activity#bTimeCounter
     * @type {boolean} */
    bTimeCounter: true,
    /**
     * Whether to display or not the 'score' counter
     * @name Activity#bScoreCounter
     * @type {boolean} */
    bScoreCounter: true,
    /**
     * Whether to display or not the 'actions' counter
     * @name Activity#bActionsCounter
     * @type {boolean} */
    bActionsCounter: true,
    /**
     * Special object used to generate random content at the start of the activity
     * @name Activity#acp
     * @type {AutoContentProvider} */
    acp: null,
    //
    // Fields used only in certain activity types
    // ------------------------------------------
    //
    /**
     * Array of bags with the description of the content to be displayed on panels and cells.
     * @name Activity#abc
     * @type {ActiveBagContent[]} */
    abc: null,
    /**
     * Content of the grid of letters used in crosswords and scrambled letters
     * @name Activity#tgc
     * @type {TextGridContent} */
    tgc: null,
    /**
     * Relative position of the text grid (uses the same position codes as box grids)
     * @name Activity#boxGridPos
     * @type {string} */
    boxGridPos: 'AB',
    /**
     * Number of times to shuffle the cells at the beginning of the activity
     * @name Activity#shuffles
     * @type {number} */
    shuffles: K.DEFAULT_SHUFFLES,
    /**
     * @typedef Activity~scrambleType
     * @type {object}
     * @property {boolean} primary
     * @property {boolean} secondary */
    /**
     * Object that indicates if box grids A and B must be scrambled.
     * @name Activity#scramble
     * @type {Activity~scrambleType} */
    scramble: { primary: true, secondary: true },
    /**
     * Flag to indicate "inverse resolution" in complex associations
     * @name Activity#invAss
     * @type {boolean} */
    invAss: false,
    /**
     * Array of menu elements, used in activities of type {@link Menu}
     * @name Activity#menuElements
     * @type {array} */
    menuElements: null
  });

  /**
   * This object is responsible for rendering the contents of the activity on the screen and
   * managing user's interaction.
   * Each type of Activity must implement its own `ActivityPanel`.
   * In JClic, {@link http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/Activity.Panel.html Activity.Panel}
   * extends {@link http://docs.oracle.com/javase/7/docs/api/javax/swing/JPanel.html javax.swing.JPanel}.
   * In this implementation, the JPanel will be replaced by an HTML `div` tag.
   * @class
   * @extends AWT.Container
   */

  var ActivityPanel = function (_AWT$Container) {
    _inherits(ActivityPanel, _AWT$Container);

    /**
     * ActivityPanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * {@link http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html PlayStation}
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function ActivityPanel(act, ps, $div) {
      _classCallCheck(this, ActivityPanel);

      var _this2 = _possibleConstructorReturn(this, (ActivityPanel.__proto__ || Object.getPrototypeOf(ActivityPanel)).call(this));
      // ActivityPanel extends AWT.Container


      _this2.act = act;
      _this2.ps = ps;
      _this2.minimumSize = new AWT.Dimension(100, 100);
      _this2.preferredSize = new AWT.Dimension(500, 400);
      if ($div) _this2.$div = $div;else _this2.$div = $('<div/>', { class: 'JClicActivity', 'aria-label': ps.getMsg('Activity panel') });
      _this2.accessibleCanvas = Utils.settings.CANVAS_HITREGIONS;
      _this2.act.initAutoContentProvider();
      return _this2;
    }

    /**
     * Sets the size and position of this activity panel
     * @param {AWT.Rectangle} rect
     */


    _createClass(ActivityPanel, [{
      key: "setBounds",
      value: function setBounds(rect) {
        this.pos.x = rect.pos.x;
        this.pos.y = rect.pos.y;
        this.dim.width = rect.dim.width;
        this.dim.height = rect.dim.height;

        this.invalidate(rect);
        this.$div.css({
          position: 'relative',
          left: rect.pos.x,
          top: rect.pos.y,
          width: rect.dim.width,
          height: rect.dim.height
        });
      }

      /**
       * Prepares the visual components of the activity
       */

    }, {
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        this.playing = false;
        this.skin = null;
        if (this.act.skinFileName && this.act.skinFileName.length > 0 && this.act.skinFileName !== this.act.project.settings.skinFileName) this.skin = this.act.project.mediaBag.getSkinElement(this.act.skinFileName, this.ps);

        this.bgImage = null;
        if (this.act.bgImageFile && this.act.bgImageFile.length > 0) {
          var mbe = this.act.project.mediaBag.getElement(this.act.bgImageFile, true);
          if (mbe) this.bgImage = mbe.data;
        }

        this.backgroundColor = this.act.activityBgColor;

        if (this.act.transparentBg) this.backgroundTransparent = true;

        // TODO: fix bevel-border type
        if (this.act.border) this.border = true;

        var cssAct = {
          display: 'block',
          'background-color': this.backgroundTransparent ? 'transparent' : this.backgroundColor

          // Border shadow style Material Design, inspired in [http://codepen.io/Stenvh/pen/EaeWqW]
        };if (this.border) {
          cssAct['box-shadow'] = '0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)';
          cssAct['border-radius'] = '2px';
          cssAct['color'] = '#272727';
        }

        if (this.act.activityBgGradient) cssAct['background-image'] = this.act.activityBgGradient.getCss();

        this.$div.css(cssAct);
      }

      /**
       * Activities should implement this method to update the graphic content of its panel. The method
       * will be called from {@link AWT.Container#update} when needed.
       * @param {AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
       * it's the whole panel.
       */

    }, {
      key: "updateContent",
      value: function updateContent(dirtyRegion) {
        // To be overridden by subclasses. Here does nothing.
        return _get(ActivityPanel.prototype.__proto__ || Object.getPrototypeOf(ActivityPanel.prototype), "updateContent", this).call(this, dirtyRegion);
      }

      /**
       * Plays the specified event sound
       * @param {string} event - The type of event to be performed
       */

    }, {
      key: "playEvent",
      value: function playEvent(event) {
        this.act.eventSounds.play(event);
      }

      /**
       * Basic initialization procedure, common to all activities.
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        if (this.playing) {
          this.playing = false;
          this.ps.reportEndActivity(this.act, this.solved);
        }
        this.solved = false;
        this.ps.reportNewActivity(this.act, 0);
        this.attachEvents();
        this.enableCounters();
      }

      /**
       * Called when the activity starts playing
       */

    }, {
      key: "startActivity",
      value: function startActivity() {
        this.playing = true;
      }

      /**
       * Called by {@link JClicPlayer} when this activity panel is fully visible, just after the
       * initialization process.
       */

    }, {
      key: "activityReady",
      value: function activityReady() {}
      // To be overrided by subclasses


      /**
       * Displays help about the activity
       */

    }, {
      key: "showHelp",
      value: function showHelp() {}
      // To be overrided by subclasses


      /**
       * Sets the real dimension of this ActivityPanel.
       * @param {AWT.Dimension} maxSize - The maximum surface available for the activity panel
       * @returns {AWT.Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(maxSize) {
        return new AWT.Dimension(Math.min(maxSize.width, this.act.windowSize.width), Math.min(maxSize.height, this.act.windowSize.height));
      }

      /**
       * Attaches the events specified in the `events` member to the `$div` member
       */

    }, {
      key: "attachEvents",
      value: function attachEvents() {
        var _this3 = this;

        this.events.forEach(function (ev) {
          return _this3.attachEvent(_this3.$div, ev);
        });
        // Prepare handler to check if we are in a touch device
        if (!K.TOUCH_DEVICE && $.inArray(TOUCH_TEST_EVENT, this.events) === -1) this.attachEvent(this.$div, TOUCH_TEST_EVENT);
      }

      /**
       * Attaches a single event to the specified object
       * @param {external:jQuery} $obj - The object to which the event will be attached
       * @param {string} evt - The event name
       */

    }, {
      key: "attachEvent",
      value: function attachEvent($obj, evt) {
        var _this4 = this;

        $obj.on(evt, this, function (event) {
          if (event.type === TOUCH_TEST_EVENT) {
            if (!K.TOUCH_DEVICE) K.TOUCH_DEVICE = true;
            if ($.inArray(TOUCH_TEST_EVENT, _this4.events) === -1) {
              // Disconnect handler
              $obj.off(TOUCH_TEST_EVENT);
              return;
            }
          }
          return event.data.processEvent.call(event.data, event);
        });
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events.
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(_event) {
        return false;
      }

      /**
       * Fits the panel within the `proposed` rectangle. The panel can occupy more space, but always
       * not surpassing the `bounds` rectangle.
       * @param {AWT.Rectangle} proposed - The proposed rectangle
       * @param {AWT.Rectangle} bounds - The maximum allowed bounds
       */

    }, {
      key: "fitTo",
      value: function fitTo(proposed, bounds) {
        var _this5 = this;

        var origin = new AWT.Point();
        if (this.act.absolutePositioned && this.act.absolutePosition !== null) {
          origin.x = Math.max(0, this.act.absolutePosition.x + proposed.pos.x);
          origin.y = Math.max(0, this.act.absolutePosition.y + proposed.pos.y);
          proposed.dim.width -= this.act.absolutePosition.x;
          proposed.dim.height -= this.act.absolutePosition.y;
        }
        var d = this.setDimension(new AWT.Dimension(Math.max(2 * this.act.margin + Utils.settings.MINIMUM_WIDTH, proposed.dim.width), Math.max(2 * this.act.margin + Utils.settings.MINIMUM_HEIGHT, proposed.dim.height)));
        if (!this.act.absolutePositioned) {
          origin.moveTo(Math.max(0, proposed.pos.x + (proposed.dim.width - d.width) / 2), Math.max(0, proposed.pos.y + (proposed.dim.height - d.height) / 2));
        }
        if (origin.x + d.width > bounds.dim.width) origin.x = Math.max(0, bounds.dim.width - d.width);
        if (origin.y + d.height > bounds.dim.height) origin.y = Math.max(0, bounds.dim.height - d.height);
        this.setBounds(new AWT.Rectangle(origin.x, origin.y, d.width, d.height));

        // Build accessible components at the end of current tree
        window.setTimeout(function () {
          return _this5.buildAccessibleComponents();
        }, 0);
      }

      /**
       * 
       * Builds the accessible components needed for this ActivityPanel
       * This method is called when all main elements are placed and visible, when the activity is ready
       * to start or when resized.
       */

    }, {
      key: "buildAccessibleComponents",
      value: function buildAccessibleComponents() {
        // Clear existing elements
        if (this.accessibleCanvas && this.$canvas && this.$canvas.children().length > 0) {
          this.$canvas.get(-1).getContext('2d').clearHitRegions();
          this.$canvas.empty();
        }
        // Create accessible elements in subclasses
      }

      /**
       *  Forces the ending of the activity.
       */

    }, {
      key: "forceFinishActivity",
      value: function forceFinishActivity() {}
      // to be overrided by subclasses


      /**
       * Ordinary ending of the activity, usually called form `processEvent`
       * @param {boolean} result - `true` if the activity was successfully completed, `false` otherwise
       */

    }, {
      key: "finishActivity",
      value: function finishActivity(result) {
        this.playing = false;
        this.solved = result;

        if (this.bc !== null) this.bc.end();

        if (result) {
          this.setAndPlayMsg('final', 'finishedOk');
        } else {
          this.setAndPlayMsg('finalError', 'finishedError');
        }
        this.ps.activityFinished(this.solved);
        this.ps.reportEndActivity(this.act, this.solved);
      }

      /**
       * Sets the message to be displayed in the skin message box and optionally plays a sound event.
       * @param {string} msgCode - Type of message (initial, final, finalError...)
       * @param {string=} eventSoundsCode - Optional name of the event sound to be played.
       */

    }, {
      key: "setAndPlayMsg",
      value: function setAndPlayMsg(msgCode, eventSoundsCode) {
        var msg = this.act.messages[msgCode] || null;
        this.ps.setMsg(msg);
        if (msg === null || msg.mediaContent === null) this.playEvent(eventSoundsCode);
      }

      /**
       * Ends the activity
       */

    }, {
      key: "end",
      value: function end() {
        this.forceFinishActivity();
        if (this.playing) {
          if (this.bc !== null) this.bc.end();
          this.ps.reportEndActivity(this.act, this.solved);
          this.playing = false;
          this.solved = false;
        }
        this.clear();
      }

      /**
       * Miscellaneous cleaning operations
       */

    }, {
      key: "clear",
      value: function clear() {}
      // to be overridden by subclasses


      /**
       * Enables or disables the three counters (time, score and actions)
       * @param {boolean} eTime - Whether to enable or disable the time counter
       * @param {boolean} eScore - Whether to enable or disable the score counter
       * @param {boolean} eActions - Whether to enable or disable the actions counter
       */

    }, {
      key: "enableCounters",
      value: function enableCounters(eTime, eScore, eActions) {
        if (typeof eTime === 'undefined') eTime = this.act.bTimeCounter;
        if (typeof eScore === 'undefined') eScore = this.act.bScoreCounter;
        if (typeof eActions === 'undefined') eActions = this.act.bActionsCounter;

        this.ps.setCounterEnabled('time', eTime);
        if (this.act.countDownTime) this.ps.setCountDown('time', this.act.maxTime);
        this.ps.setCounterEnabled('score', eScore);
        this.ps.setCounterEnabled('actions', eActions);
        if (this.act.countDownActions) this.ps.setCountDown('actions', this.act.maxActions);
      }

      /**
       * Shuffles the contents of the activity
       * @param {ActiveBoxBag[]} bg - The sets of boxes to be shuffled
       * @param {boolean} visible - The shuffle process must be animated on the screen (not yet implemented!)
       * @param {boolean} fitInArea - Shuffled pieces cannot go out of the current area
       */

    }, {
      key: "shuffle",
      value: function shuffle(bg, visible, fitInArea) {
        var steps = this.act.shuffles;
        var i = steps;

        var _loop = function _loop() {
          var k = i > steps ? steps : i;
          bg.forEach(function (abb) {
            if (abb) abb.scrambleCells(k, fitInArea);
          });
          i -= steps;
        };

        while (i > 0) {
          _loop();
        }
      }
    }]);

    return ActivityPanel;
  }(AWT.Container);

  Object.assign(ActivityPanel.prototype, {
    /**
     * The Activity this panel is related to
     * @name ActivityPanel#act
     * @type {Activity} */
    act: null,
    /**
     * The jQuery div element used by this panel
     * @name ActivityPanel#$div
     * @type {external:jQuery} */
    $div: null,
    /**
     * The jQuery main canvas element used by this panel
     * @name ActivityPanel#$canvas
     * @type {external:jQuery} */
    $canvas: null,
    /**
     * True when the navigator implements canvas hit regions
     * See: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Hit_regions_and_accessibility
     * @name ActivityPanel#accessibleCanvas
     * @type {boolean}
     */
    accessibleCanvas: false,
    /**
     * The realized current {@link Skin}
     * @name ActivityPanel#skin
     * @type {Skin} */
    skin: null,
    /**
     * Background element (currently a `span`) used to place animated GIFs when needed
     * @name ActivityPanel#$animatedBg
     * @type {external:jQuery} */
    $animatedBg: null,
    /**
     * Additional background element for animated GIFs, used in associations
     * @name ActivityPanel#$animatedBgB
     * @type {external:jQuery} */
    $animatedBgB: null,
    /**
     * `true` when the activity is solved, `false` otherwise
     * @name ActivityPanel#solved
     * @type {boolean} */
    solved: false,
    /**
     * The realized image used as a background
     * @name ActivityPanel#bgImage
     * @type {external:HTMLImageElement} */
    bgImage: null,
    /**
     * `true` while the activity is playing
     * @name ActivityPanel#playing
     * @type {boolean} */
    playing: false,
    /**
     * `true` if the activity is running for first time (not due to a click on the `replay` button)
     * @name ActivityPanel#firstRun
     * @type {boolean} */
    firstRun: true,
    /**
     * Currently selected item. Used in some types of activities.
     * @name ActivityPanel#currentItem
     * @type {number} */
    currentItem: 0,
    /**
     * The object used to connect cells and other elements in some types of activity
     * @name ActivityPanel#bc
     * @type {BoxConnector} */
    bc: null,
    /**
     * The PlayStation used to realize media objects and communicate with the player services
     * (usually a {@link JClicPlayer}
     * @name ActivityPanel#ps
     * @type {PlayStation} */
    ps: null,
    /**
     * The minimum size of this kind of ActivityPanel
     * @name ActivityPanel#minimumSize
     * @type {AWT.Dimension} */
    minimumSize: null,
    /**
     * The preferred size of this kind of ActivityPanel
     * @name ActivityPanel#preferredSize
     * @type {AWT.Dimension} */
    preferredSize: null,
    /**
     * List of events intercepted by this ActivityPanel. Current events are: 'keydown', 'keyup',
     * 'keypress', 'mousedown', 'mouseup', 'click', 'dblclick', 'mousemove', 'mouseenter',
     * 'mouseleave', 'mouseover', 'mouseout', 'touchstart', 'touchend', 'touchmove' and 'touchcancel'.
     * @name ActivityPanel#events
     * @type {string[]} */
    events: ['click'],
    backgroundColor: null,
    backgroundTransparent: false,
    border: null
  });

  /**
   * The panel class associated to each type of activity
   * @type {class} */
  Activity.Panel = ActivityPanel;

  return Activity;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 7.1.13 ToObject(argument)
var defined = __webpack_require__(30);
module.exports = function (it) {
  return Object(defined(it));
};

/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = function (it) {
  if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  return it;
};

/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
  return hasOwnProperty.call(it, key);
};

/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var dP = __webpack_require__(11);
var createDesc = __webpack_require__(44);
module.exports = __webpack_require__(10) ? function (object, key, value) {
  return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
  object[key] = value;
  return object;
};

/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var global = __webpack_require__(5);
var hide = __webpack_require__(17);
var has = __webpack_require__(16);
var SRC = __webpack_require__(45)('src');
var TO_STRING = 'toString';
var $toString = Function[TO_STRING];
var TPL = ('' + $toString).split(TO_STRING);

__webpack_require__(28).inspectSource = function (it) {
  return $toString.call(it);
};

(module.exports = function (O, key, val, safe) {
  var isFunction = typeof val == 'function';
  if (isFunction) has(val, 'name') || hide(val, 'name', key);
  if (O[key] === val) return;
  if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
  if (O === global) {
    O[key] = val;
  } else if (!safe) {
    delete O[key];
    hide(O, key, val);
  } else if (O[key]) {
    O[key] = val;
  } else {
    hide(O, key, val);
  }
  // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, TO_STRING, function toString() {
  return typeof this == 'function' && this[SRC] || $toString.call(this);
});

/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var fails = __webpack_require__(6);
var defined = __webpack_require__(30);
var quot = /"/g;
// B.2.3.2.1 CreateHTML(string, tag, attribute, value)
var createHTML = function createHTML(string, tag, attribute, value) {
  var S = String(defined(string));
  var p1 = '<' + tag;
  if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '&quot;') + '"';
  return p1 + '>' + S + '</' + tag + '>';
};
module.exports = function (NAME, exec) {
  var O = {};
  O[NAME] = exec(createHTML);
  $export($export.P + $export.F * fails(function () {
    var test = ''[NAME]('"');
    return test !== test.toLowerCase() || test.split('"').length > 3;
  }), 'String', O);
};

/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(67);
var defined = __webpack_require__(30);
module.exports = function (it) {
  return IObject(defined(it));
};

/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var pIE = __webpack_require__(68);
var createDesc = __webpack_require__(44);
var toIObject = __webpack_require__(20);
var toPrimitive = __webpack_require__(29);
var has = __webpack_require__(16);
var IE8_DOM_DEFINE = __webpack_require__(141);
var gOPD = Object.getOwnPropertyDescriptor;

exports.f = __webpack_require__(10) ? gOPD : function getOwnPropertyDescriptor(O, P) {
  O = toIObject(O);
  P = toPrimitive(P, true);
  if (IE8_DOM_DEFINE) try {
    return gOPD(O, P);
  } catch (e) {/* empty */}
  if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
};

/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has = __webpack_require__(16);
var toObject = __webpack_require__(14);
var IE_PROTO = __webpack_require__(102)('IE_PROTO');
var ObjectProto = Object.prototype;

module.exports = Object.getPrototypeOf || function (O) {
  O = toObject(O);
  if (has(O, IE_PROTO)) return O[IE_PROTO];
  if (typeof O.constructor == 'function' && O instanceof O.constructor) {
    return O.constructor.prototype;
  }return O instanceof Object ? ObjectProto : null;
};

/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/**
 * A worker that does nothing but passing chunks to the next one. This is like
 * a nodejs stream but with some differences. On the good side :
 * - it works on IE 6-9 without any issue / polyfill
 * - it weights less than the full dependencies bundled with browserify
 * - it forwards errors (no need to declare an error handler EVERYWHERE)
 *
 * A chunk is an object with 2 attributes : `meta` and `data`. The former is an
 * object containing anything (`percent` for example), see each worker for more
 * details. The latter is the real data (String, Uint8Array, etc).
 *
 * @constructor
 * @param {String} name the name of the stream (mainly used for debugging purposes)
 */

function GenericWorker(name) {
    // the name of the worker
    this.name = name || "default";
    // an object containing metadata about the workers chain
    this.streamInfo = {};
    // an error which happened when the worker was paused
    this.generatedError = null;
    // an object containing metadata to be merged by this worker into the general metadata
    this.extraStreamInfo = {};
    // true if the stream is paused (and should not do anything), false otherwise
    this.isPaused = true;
    // true if the stream is finished (and should not do anything), false otherwise
    this.isFinished = false;
    // true if the stream is locked to prevent further structure updates (pipe), false otherwise
    this.isLocked = false;
    // the event listeners
    this._listeners = {
        'data': [],
        'end': [],
        'error': []
    };
    // the previous worker, if any
    this.previous = null;
}

GenericWorker.prototype = {
    /**
     * Push a chunk to the next workers.
     * @param {Object} chunk the chunk to push
     */
    push: function push(chunk) {
        this.emit("data", chunk);
    },
    /**
     * End the stream.
     * @return {Boolean} true if this call ended the worker, false otherwise.
     */
    end: function end() {
        if (this.isFinished) {
            return false;
        }

        this.flush();
        try {
            this.emit("end");
            this.cleanUp();
            this.isFinished = true;
        } catch (e) {
            this.emit("error", e);
        }
        return true;
    },
    /**
     * End the stream with an error.
     * @param {Error} e the error which caused the premature end.
     * @return {Boolean} true if this call ended the worker with an error, false otherwise.
     */
    error: function error(e) {
        if (this.isFinished) {
            return false;
        }

        if (this.isPaused) {
            this.generatedError = e;
        } else {
            this.isFinished = true;

            this.emit("error", e);

            // in the workers chain exploded in the middle of the chain,
            // the error event will go downward but we also need to notify
            // workers upward that there has been an error.
            if (this.previous) {
                this.previous.error(e);
            }

            this.cleanUp();
        }
        return true;
    },
    /**
     * Add a callback on an event.
     * @param {String} name the name of the event (data, end, error)
     * @param {Function} listener the function to call when the event is triggered
     * @return {GenericWorker} the current object for chainability
     */
    on: function on(name, listener) {
        this._listeners[name].push(listener);
        return this;
    },
    /**
     * Clean any references when a worker is ending.
     */
    cleanUp: function cleanUp() {
        this.streamInfo = this.generatedError = this.extraStreamInfo = null;
        this._listeners = [];
    },
    /**
     * Trigger an event. This will call registered callback with the provided arg.
     * @param {String} name the name of the event (data, end, error)
     * @param {Object} arg the argument to call the callback with.
     */
    emit: function emit(name, arg) {
        if (this._listeners[name]) {
            for (var i = 0; i < this._listeners[name].length; i++) {
                this._listeners[name][i].call(this, arg);
            }
        }
    },
    /**
     * Chain a worker with an other.
     * @param {Worker} next the worker receiving events from the current one.
     * @return {worker} the next worker for chainability
     */
    pipe: function pipe(next) {
        return next.registerPrevious(this);
    },
    /**
     * Same as `pipe` in the other direction.
     * Using an API with `pipe(next)` is very easy.
     * Implementing the API with the point of view of the next one registering
     * a source is easier, see the ZipFileWorker.
     * @param {Worker} previous the previous worker, sending events to this one
     * @return {Worker} the current worker for chainability
     */
    registerPrevious: function registerPrevious(previous) {
        if (this.isLocked) {
            throw new Error("The stream '" + this + "' has already been used.");
        }

        // sharing the streamInfo...
        this.streamInfo = previous.streamInfo;
        // ... and adding our own bits
        this.mergeStreamInfo();
        this.previous = previous;
        var self = this;
        previous.on('data', function (chunk) {
            self.processChunk(chunk);
        });
        previous.on('end', function () {
            self.end();
        });
        previous.on('error', function (e) {
            self.error(e);
        });
        return this;
    },
    /**
     * Pause the stream so it doesn't send events anymore.
     * @return {Boolean} true if this call paused the worker, false otherwise.
     */
    pause: function pause() {
        if (this.isPaused || this.isFinished) {
            return false;
        }
        this.isPaused = true;

        if (this.previous) {
            this.previous.pause();
        }
        return true;
    },
    /**
     * Resume a paused stream.
     * @return {Boolean} true if this call resumed the worker, false otherwise.
     */
    resume: function resume() {
        if (!this.isPaused || this.isFinished) {
            return false;
        }
        this.isPaused = false;

        // if true, the worker tried to resume but failed
        var withError = false;
        if (this.generatedError) {
            this.error(this.generatedError);
            withError = true;
        }
        if (this.previous) {
            this.previous.resume();
        }

        return !withError;
    },
    /**
     * Flush any remaining bytes as the stream is ending.
     */
    flush: function flush() {},
    /**
     * Process a chunk. This is usually the method overridden.
     * @param {Object} chunk the chunk to process.
     */
    processChunk: function processChunk(chunk) {
        this.push(chunk);
    },
    /**
     * Add a key/value to be added in the workers chain streamInfo once activated.
     * @param {String} key the key to use
     * @param {Object} value the associated value
     * @return {Worker} the current worker for chainability
     */
    withStreamInfo: function withStreamInfo(key, value) {
        this.extraStreamInfo[key] = value;
        this.mergeStreamInfo();
        return this;
    },
    /**
     * Merge this worker's streamInfo into the chain's streamInfo.
     */
    mergeStreamInfo: function mergeStreamInfo() {
        for (var key in this.extraStreamInfo) {
            if (!this.extraStreamInfo.hasOwnProperty(key)) {
                continue;
            }
            this.streamInfo[key] = this.extraStreamInfo[key];
        }
    },

    /**
     * Lock the stream to prevent further updates on the workers chain.
     * After calling this method, all calls to pipe will fail.
     */
    lock: function lock() {
        if (this.isLocked) {
            throw new Error("The stream '" + this + "' has already been used.");
        }
        this.isLocked = true;
        if (this.previous) {
            this.previous.lock();
        }
    },

    /**
     *
     * Pretty print the workers chain.
     */
    toString: function toString() {
        var me = "Worker " + this.name;
        if (this.previous) {
            return this.previous + " -> " + me;
        } else {
            return me;
        }
    }
};

module.exports = GenericWorker;

/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : boxes/BoxBag.js
 *  Created : 21/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2016 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(99), __webpack_require__(3), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, AbstractBox, AWT, Utils) {

  /**
   * BoxBag is a class derived from {@link AbstractBox} that contains a collection of "boxes"
   * (objects also derived from {@link AbstractBox}). This class implements methods to add, remove
   * and retrieve boxes, and to manage some of its properties like visibility, status, location and size.
   * @exports BoxBag
   * @class
   * @extends AbstractBox
   */
  var BoxBag = function (_AbstractBox) {
    _inherits(BoxBag, _AbstractBox);

    /**
     * BoxBag constructor
     * @param {?AbstractBox} parent - The AbstractBox to which this box bag belongs
     * @param {?AWT.Container} container - The container where this box bag is placed.
     * @param {?BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
     */
    function BoxBag(parent, container, boxBase) {
      _classCallCheck(this, BoxBag);

      var _this = _possibleConstructorReturn(this, (BoxBag.__proto__ || Object.getPrototypeOf(BoxBag)).call(this, parent, container, boxBase));
      // BoxBag extends AbstractBox


      _this.preferredBounds = new AWT.Rectangle();
      _this.cells = [];
      return _this;
    }

    /**
     * Static method that sets the position and dimension of a `Resizable` object based on a
     * preferred maximum dimension and a margin.
     * @param {AWT.Dimension} preferredMaxSize - The preferred maximum size
     * @param {Resizable} rs - A resizable object implementing the methods described in the
     * {@link http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/boxes/Resizable.html Resizable}
     * interface of JClic. Currently a {@link BoxBag} or {@link TextGrid}.
     * @param {number} margin - The margin between the available area and the BoxBag
     * @returns {AWT.Dimension} - The resulting size of the container
     */


    _createClass(BoxBag, [{
      key: "getPreferredSize",


      /**
       * Gets the preferred size of this `BoxBag`
       * @returns {AWT.Dimension}
       */
      value: function getPreferredSize() {
        return this.preferredBounds.dim;
      }

      /**
       * Gets the minimum size requested by this `BoxBag`
       * @returns {AWT.Dimension}
       */

    }, {
      key: "getMinimumSize",
      value: function getMinimumSize() {
        var d = this.getPreferredSize();
        return new AWT.Dimension(Math.max(Utils.settings.MIN_CELL_SIZE, d.width), Math.max(Utils.settings.MIN_CELL_SIZE, d.height));
      }

      /**
       * Scales the current size of this box bag, multiplying all values by a specific factor
       * @param {number} scale - The scale factor
       * @returns {AWT.Dimension}
       */

    }, {
      key: "getScaledSize",
      value: function getScaledSize(scale) {
        var d = this.getPreferredSize();
        return new AWT.Dimension(Math.round(scale * d.width), Math.round(scale * d.height));
      }

      /**
       * Adds an {@link AbstractBox} to the collection of cells
       * @param {AbstractBox} bx - The box to add
       */

    }, {
      key: "addBox",
      value: function addBox(bx) {
        this.cells.push(bx);
        bx.setParent(this);

        if (this.cells.length === 1) AWT.Rectangle.prototype.setBounds.call(this, bx);else this.add(bx);

        this.preferredBounds.setBounds(this.getBounds());
      }

      /**
       * Returns the index of a specific box in the `cells` array
       * @param {AbstractBox} bx
       * @returns {number}
       */

    }, {
      key: "boxIndex",
      value: function boxIndex(bx) {
        return bx === null ? -1 : this.cells.indexOf(bx);
      }

      /**
       * Returns the box at a specific index in the `cells` array
       * @param {number} n - The index
       * @returns {AbstractBox}
       */

    }, {
      key: "getBox",
      value: function getBox(n) {
        return n < 0 || n >= this.cells.length ? null : this.cells[n];
      }

      /**
       * Gets the background box
       * @returns {AbstractBox}
       */

    }, {
      key: "getBackgroundBox",
      value: function getBackgroundBox() {
        return this.backgroundBox;
      }

      /**
       * Sets the background box
       * @param {AbstractBox} bx
       */

    }, {
      key: "setBackgroundBox",
      value: function setBackgroundBox(bx) {
        this.backgroundBox = bx;
        if (bx !== null) {
          bx.setParent(this);
          bx.isBackground = true;
        }
        // Add the `backgroundbox` rectangle to the global BoxBag rectangle
        AWT.Rectangle.prototype.add.call(this, bx);
        this.preferredBounds.setBounds(this.getBounds());
      }

      /**
       * Recalculates the total size of this BoxBag (useful after direct additions o deletions of
       * elements in the `cells` array).
       * Updates `preferredBounds` and the current position and size of the box bag.
       */

    }, {
      key: "recalcSize",
      value: function recalcSize() {
        var r = this.backgroundBox ? new AWT.Rectangle(this.backgroundBox.pos, this.backgroundBox.dim) : null;
        this.cells.forEach(function (cell) {
          if (!r) r = new AWT.Rectangle(cell.pos, cell.dim);else r.add(cell);
        });
        if (!r) r = new AWT.Rectangle(this.pos.x, this.pos.y, 0, 0);
        this.preferredBounds.setRect(r);
        this.x = r.pos.x;
        this.y = r.pos.y;
        this.dim.width = r.dim.width;
        this.dim.height = r.dim.height;
      }

      /**
       * Returns the number of cells stored in this BoxBag
       * @returns {number}
       */

    }, {
      key: "getNumCells",
      value: function getNumCells() {
        return this.cells.length;
      }

      /**
       * Sets the specified key - value pair to all cells of this bag.
       * @param {string} key - The key to be established
       * @param {} value - The value, of any type
       */

    }, {
      key: "setCellAttr",
      value: function setCellAttr(key, value) {
        this.cells.forEach(function (bx) {
          return bx[key] = value;
        });
        if (this.backgroundBox) this.backgroundBox[key] = value;
      }

      /**
       * Overrides {@link AbstractBox#setBorder} iterating over all the cells stored in this box bag.
       * @override
       * @param {boolean} newVal - Whether to set or unset the border
       */

    }, {
      key: "setBorder",
      value: function setBorder(newVal) {
        this.cells.forEach(function (bx) {
          return bx.setBorder(newVal);
        });
      }

      /**
       * Overrides {@link AbstractBox#setVisible} iterating over all the cells stored in this box bag.
       * @override
       * @param {boolean} newVal - Whether to set the cells visible or not
       */

    }, {
      key: "setVisible",
      value: function setVisible(newVal) {
        this.cells.forEach(function (bx) {
          return bx.setVisible(newVal);
        });
      }

      /**
       * Overrides {@link AbstractBox#setAlternative} iterating over all the cells stored in this box bag.
       * @override
       * @param {boolean} newVal - Whether to set or unset the cells in "alternative" mode
       */

    }, {
      key: "setAlternative",
      value: function setAlternative(newVal) {
        _get(BoxBag.prototype.__proto__ || Object.getPrototypeOf(BoxBag.prototype), "setAlternative", this).call(this, newVal);
        this.cells.forEach(function (bx) {
          return bx.setAlternative(newVal);
        });
      }

      /**
       * Overrides {@link AbstractBox#setBounds} adjusting the position and size of all cells
       * @override
       * @param {(AWT.Rectangle|number)} rect - An AWT.Rectangle object, or the `x` coordinate of the
       * upper-left corner of a new rectangle.
       * @param {number=} ry - `y` coordinate of the upper-left corner of the new rectangle.
       * @param {number=} rw - Width of the new rectangle.
       * @param {number=} rh - Height of the new rectangle.
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect, ry, rw, rh) {
        var _this2 = this;

        if (typeof rect === 'number') {
          // Arguments are co-ordinates and size
          rect = new AWT.Rectangle(rect, ry, rw, rh);
        }
        if (rect.getSurface() > 0 && !rect.equals(this)) {
          var scaleW = rect.dim.width / this.dim.width,
              scaleH = rect.dim.height / this.dim.height,
              dx = rect.pos.x - this.pos.x,
              dy = rect.pos.y - this.pos.y;
          this.cells.forEach(function (bx) {
            var p = new AWT.Point(bx.pos.x - _this2.pos.x, bx.pos.y - _this2.pos.y);
            bx.setBounds(dx + _this2.pos.x + scaleW * p.x, dy + _this2.pos.y + scaleH * p.y, scaleW * bx.dim.width, scaleH * bx.dim.height);
          });
          if (this.backgroundBox !== null) {
            var bx = this.backgroundBox,
                p = new AWT.Point(bx.pos.x - this.pos.x, bx.pos.y - this.pos.y);
            bx.setBounds(dx + this.pos.x + scaleW * p.x, dy + this.pos.y + scaleH * p.y, scaleW * bx.dim.width, scaleH * bx.dim.height);
          }
        }
        _get(BoxBag.prototype.__proto__ || Object.getPrototypeOf(BoxBag.prototype), "setBounds", this).call(this, rect);
      }

      /**
       * Performs graphics operations for each cell.
       * Overrides {@link AbstractBox#update}
       * @override
       * @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context used to draw the
       * box contents.
       * @param {AWT.Rectangle=} dirtyRegion - The area that must be repainted. `null` refers to the whole box.
       */

    }, {
      key: "update",
      value: function update(ctx, dirtyRegion) {
        if (this.isEmpty() || !this.isVisible() || this.isTemporaryHidden()) return false;

        if (dirtyRegion && !this.intersects(dirtyRegion)) return false;

        if (this.backgroundBox !== null) this.backgroundBox.update(ctx, dirtyRegion);

        this.cells.forEach(function (bx) {
          if (!bx.isMarked()) bx.update(ctx, dirtyRegion);
        });

        // Make a second loop to repaint marked cells
        this.cells.forEach(function (bx) {
          if (bx.isMarked()) bx.update(ctx, dirtyRegion);
        });
        return true;
      }

      /**
       * Finds the first visible {@link AbstractBox} located under the specified point
       * @param {AWT.Point} p
       * @returns {AbstractBox}
       */

    }, {
      key: "findBox",
      value: function findBox(p) {
        var result = null;
        for (var i = this.cells.length - 1; i >= 0; i--) {
          var bx = this.getBox(i);
          if (bx.isVisible() && bx.contains(p)) {
            result = bx;
            break;
          }
        }
        return result;
      }

      /**
       * Count the number of cells of this BoxBag that are in "inactive" state
       * @returns {number}
       */

    }, {
      key: "countInactiveCells",
      value: function countInactiveCells() {
        return this.cells.reduce(function (n, bx) {
          return bx.isInactive() ? ++n : n;
        }, 0);
      }
    }], [{
      key: "layoutSingle",
      value: function layoutSingle(preferredMaxSize, rs, margin) {

        // Avoid exceptions when rs is null
        if (!rs) return preferredMaxSize;

        // optimal, maximal and minimal dimensions
        var d = rs.getPreferredSize(),
            minSize = rs.getMinimumSize(),
            maxSize = preferredMaxSize;

        // remove margins
        maxSize.width -= 2 * margin;
        maxSize.height -= 2 * margin;
        // correct maxSize if less than minSize
        if (minSize.width > maxSize.width || minSize.height > maxSize.height) {
          maxSize = minSize;
        }
        // compute scale factor
        var scale = d.width > maxSize.width ? maxSize.width / d.width : 1;
        if (scale * d.height > maxSize.height) scale = maxSize.height / d.height;

        // resize the `Resizable` object
        d = rs.getScaledSize(scale);
        rs.setBounds(margin, margin, d.width, d.height);

        // restore margins
        d.width += 2 * margin;
        d.height += 2 * margin;

        return d;
      }

      /**
       * Static method that sets the position and dimension of two `Resizable` objects based on a
       * preferred maximum size, a layout schema and a margin.
       * @param {AWT.Dimension} desiredMaxSize - The preferred maximum size
       * @param {Resizable} rsA - First resizable object implementing the methods described in the
       * {@link http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/boxes/Resizable.html Resizable}
       * interface of JClic. Currently a {@link BoxBag} or {@link TextGrid}.
       * @param {Resizable} rsB - Second resizable object
       * @param {string} boxGridPos - The layout schema. Possible values are:
       * - "AB" (_A_ at left, _B_ at right)
       * - "BA" (_B_ at left, _A_ at right)
       * - "AUB" (_A_ above _B_)
       * - "BUA" (_A_ below _B_).
       * @param {number} margin - The margin between the available area and the BoxBag
       * @returns {AWT.Dimension} - The resulting size of the container
       */

    }, {
      key: "layoutDouble",
      value: function layoutDouble(desiredMaxSize, rsA, rsB, boxGridPos, margin) {
        // number of horizontal and vertical grid lines
        var isHLayout = false,
            nbh = 1,
            nbv = 1;
        switch (boxGridPos) {
          case 'AB':
          case 'BA':
            nbh = 2;
            nbv = 1;
            isHLayout = true;
            break;
          case 'AUB':
          case 'BUA':
            nbh = 1;
            nbv = 2;
            isHLayout = false;
            break;
        }
        var ra = rsA.getBounds(),
            rb = rsB.getBounds();

        // optimal dimensions
        var da = rsA.getPreferredSize(),
            db = rsB.getPreferredSize();

        var d = new AWT.Dimension(isHLayout ? da.width + db.width : Math.max(da.width, db.width), isHLayout ? Math.max(da.height, db.height) : da.height + db.height);

        // minimal dimensions
        var minSizeA = rsA.getMinimumSize(),
            minSizeB = rsB.getMinimumSize(),
            minSize = new AWT.Dimension(isHLayout ? minSizeA.width + minSizeB.width : Math.max(minSizeA.width, minSizeB.width), isHLayout ? Math.max(minSizeA.height, minSizeB.height) : minSizeA.height + minSizeB.height),
            maxSize = desiredMaxSize;

        // remove margins
        maxSize.width -= (1 + nbh) * margin;
        maxSize.height -= (1 + nbv) * margin;

        // correct maxSize if less than minSize
        if (minSize.width > maxSize.width || minSize.height > maxSize.height) maxSize.setDimension(minSize);

        // compute scale factor
        var scale = d.width > maxSize.width ? maxSize.width / d.width : 1;
        if (scale * d.height > maxSize.height) scale = maxSize.height / d.height;

        //
        // correct possible minimal infractions
        // ...
        // resize
        da = rsA.getScaledSize(scale);
        db = rsB.getScaledSize(scale);

        // set margins to center one box relative to the other
        var dah = db.width > da.width ? (db.width - da.width) / 2 : 0,
            dbh = da.width > db.width ? (da.width - db.width) / 2 : 0,
            dav = db.height > da.height ? (db.height - da.height) / 2 : 0,
            dbv = da.height > db.height ? (da.height - db.height) / 2 : 0;

        switch (boxGridPos) {
          case 'AB':
            rsA.setBounds(margin, margin + dav, da.width, da.height);
            rsB.setBounds(2 * margin + da.width, margin + dbv, db.width, db.height);
            break;
          case 'BA':
            rsB.setBounds(margin, margin + dbv, db.width, db.height);
            rsA.setBounds(2 * margin + db.width, margin + dav, da.width, da.height);
            break;
          case 'AUB':
            rsA.setBounds(margin + dah, margin, da.width, da.height);
            rsB.setBounds(margin + dbh, 2 * margin + da.height, db.width, db.height);
            break;
          case 'BUA':
            rsB.setBounds(margin + dbh, margin, db.width, db.height);
            rsA.setBounds(margin + dah, 2 * margin + db.height, da.width, da.height);
            break;
          default:
            rsA.setBounds(Math.round(margin + scale * ra.pos.x), Math.round(margin + scale * ra.pos.y), da.width, da.height);
            rsB.setBounds(Math.round(margin + scale * rb.pos.x), Math.round(margin + scale * rb.pos.y), da.width, da.height);
            break;
        }

        // recompute 'd' adding margins
        var r = new AWT.Rectangle(rsA.getBounds());
        r.add(rsB.getBounds());
        d.width = r.dim.width + 2 * margin;
        d.height = r.dim.height + 2 * margin;

        return d;
      }
    }]);

    return BoxBag;
  }(AbstractBox);

  Object.assign(BoxBag.prototype, {
    /**
     * The array of cells
     * @name BoxBag#cells
     * @type {AbstractBox[]} */
    cells: [],
    /**
     * Rectangle containing the preferred bounds of the BoxBag
     * @name BoxBag#preferredBounds
     * @type {AWT.Rectangle} */
    preferredBounds: new AWT.Rectangle(),
    /**
     * An optional box used as a background by this BoxBag
     * @name BoxBag#backgroundBox
     * @type {AbstractBox} */
    backgroundBox: null
  });

  return BoxBag;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// optional / simple context binding
var aFunction = __webpack_require__(15);
module.exports = function (fn, that, length) {
  aFunction(fn);
  if (that === undefined) return fn;
  switch (length) {
    case 1:
      return function (a) {
        return fn.call(that, a);
      };
    case 2:
      return function (a, b) {
        return fn.call(that, a, b);
      };
    case 3:
      return function (a, b, c) {
        return fn.call(that, a, b, c);
      };
  }
  return function () /* ...args */{
    return fn.apply(that, arguments);
  };
};

/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var toString = {}.toString;

module.exports = function (it) {
  return toString.call(it).slice(8, -1);
};

/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var fails = __webpack_require__(6);

module.exports = function (method, arg) {
  return !!method && fails(function () {
    // eslint-disable-next-line no-useless-call
    arg ? method.call(null, function () {/* empty */}, 1) : method.call(null);
  });
};

/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var core = module.exports = { version: '2.5.3' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef

/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(7);
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function (it, S) {
  if (!isObject(it)) return it;
  var fn, val;
  if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
  if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  throw TypeError("Can't convert object to primitive value");
};

/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 7.2.1 RequireObjectCoercible(argument)
module.exports = function (it) {
  if (it == undefined) throw TypeError("Can't call method on  " + it);
  return it;
};

/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
module.exports = function (it) {
  return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};

/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// most Object methods by ES6 should accept primitives
var $export = __webpack_require__(0);
var core = __webpack_require__(28);
var fails = __webpack_require__(6);
module.exports = function (KEY, exec) {
  var fn = (core.Object || {})[KEY] || Object[KEY];
  var exp = {};
  exp[KEY] = exec(fn);
  $export($export.S + $export.F * fails(function () {
    fn(1);
  }), 'Object', exp);
};

/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 0 -> Array#forEach
// 1 -> Array#map
// 2 -> Array#filter
// 3 -> Array#some
// 4 -> Array#every
// 5 -> Array#find
// 6 -> Array#findIndex
var ctx = __webpack_require__(25);
var IObject = __webpack_require__(67);
var toObject = __webpack_require__(14);
var toLength = __webpack_require__(12);
var asc = __webpack_require__(119);
module.exports = function (TYPE, $create) {
  var IS_MAP = TYPE == 1;
  var IS_FILTER = TYPE == 2;
  var IS_SOME = TYPE == 3;
  var IS_EVERY = TYPE == 4;
  var IS_FIND_INDEX = TYPE == 6;
  var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  var create = $create || asc;
  return function ($this, callbackfn, that) {
    var O = toObject($this);
    var self = IObject(O);
    var f = ctx(callbackfn, that, 3);
    var length = toLength(self.length);
    var index = 0;
    var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
    var val, res;
    for (; length > index; index++) {
      if (NO_HOLES || index in self) {
        val = self[index];
        res = f(val, index, O);
        if (TYPE) {
          if (IS_MAP) result[index] = res; // map
          else if (res) switch (TYPE) {
              case 3:
                return true; // some
              case 5:
                return val; // find
              case 6:
                return index; // findIndex
              case 2:
                result.push(val); // filter
            } else if (IS_EVERY) return false; // every
        }
      }
    }return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
  };
};

/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : skins/Skin.js
 *  Created : 29/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(135), __webpack_require__(208), __webpack_require__(2), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, screenfull, clipboard, Utils, AWT) {

  // In some cases, require.js does not return a valid value for screenfull. Check it:
  if (!screenfull) screenfull = window.screenfull;

  /**
   * This abstract class manages the layout, position ans size of the visual components of JClic:
   * player window, message box, counters, buttons, status... and also the appearance of the main
   * container.
   * The basic implementation of Skin is {@link DefaultSkin}.
   * @exports Skin
   * @class
   * @abstract
   * @extends AWT.Container
   */

  var Skin = function (_AWT$Container) {
    _inherits(Skin, _AWT$Container);

    /**
     * Skin constructor
     * @param {PlayStation} ps - The `PlayStation` (currently a {@link JClicPlayer}) used to load and
     * realize the media objects needed tot build the Skin.
     * @param {string=} name - The skin name
     * @param {object=} options - Optional parameter with additional options
     */
    function Skin(ps) {
      var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

      _classCallCheck(this, Skin);

      // Save parameters for later use
      var _this = _possibleConstructorReturn(this, (Skin.__proto__ || Object.getPrototypeOf(Skin)).call(this));

      // Skin extends [AWT.Container](AWT.html)


      _this.ps = ps;
      if (name !== null) _this.name = name;
      _this.options = options;

      if (!Skin.registerStyleSheet(_this.skinId, ps)) {
        var css = _this._getStyleSheets('default');
        var twoThirds = _this._getStyleSheets('twoThirds');
        if (twoThirds.length > 0) css += " @media (max-width:" + _this.twoThirdsMedia.width + "px),(max-height:" + _this.twoThirdsMedia.height + "px){" + twoThirds + "}";
        var half = _this._getStyleSheets('half');
        if (half.length > 0) css += " @media (max-width:" + _this.halfMedia.width + "px),(max-height:" + _this.halfMedia.height + "px){" + half + "}";
        Utils.appendStyleAtHead(css.replace(/\.ID/g, "." + _this.skinId), ps);
      }

      var msg = '';

      _this.$div = $('<div/>', { class: _this.skinId });
      _this.$playerCnt = $('<div/>', { class: 'JClicPlayerCnt' });

      // Add waiting panel and progress bar
      _this.$progress = $('<progress/>', { class: 'progressBar' }).css({ display: 'none' });
      _this.$waitPanel = $('<div/>').css({ display: 'none', 'background-color': 'rgba(255, 255, 255, .60)', 'z-index': 99 }).append($('<div/>', { class: 'waitPanel' }).css({ display: 'flex', 'flex-direction': 'column' }).append($('<div/>', { class: 'animImgBox' }).append($(_this.waitImgBig), $(_this.waitImgSmall))).append(_this.$progress));
      _this.$playerCnt.append(_this.$waitPanel);

      _this.buttons = Utils.cloneObject(Skin.prototype.buttons);
      _this.counters = Utils.cloneObject(Skin.prototype.counters);
      _this.msgArea = Utils.cloneObject(Skin.prototype.msgArea);

      // Create dialog overlay and panel
      _this.$dlgOverlay = $('<div/>', { class: 'dlgOverlay' }).css({
        'z-index': 98,
        position: 'fixed',
        left: 0,
        top: 0,
        width: '100%',
        height: '100%',
        display: 'none',
        'background-color': 'rgba(30,30,30,0.7)'
      }).on('click', function () {
        if (!_this._isModalDlg)
          // Non-modal dialogs are closed on click outside the main area
          _this._closeDlg(true);
        return false;
      });

      var $dlgDiv = $('<div/>', {
        class: 'dlgDiv',
        role: 'dialog',
        'aria-labelledby': ps.getUniqueId('ReportsLb'),
        'aria-describedby': ps.getUniqueId('ReportsCnt')
      }).css({
        display: 'inline-block',
        position: 'relative',
        top: '50%',
        left: '50%',
        transform: 'translate(-50%, -50%)'
      }).on('click', function () {
        // Clicks not passed to parent
        return false;
      });

      _this.$dlgMainPanel = $('<div/>', { class: 'dlgMainPanel', id: ps.getUniqueId('ReportsCnt') });
      _this.$dlgBottomPanel = $('<div/>', { class: 'dlgBottomPanel', role: 'navigation' });

      // Basic dialog structure:
      _this.$div.append(_this.$playerCnt, _this.$dlgOverlay.append($dlgDiv.append(_this.$dlgMainPanel, _this.$dlgBottomPanel)));

      msg = ps.getMsg('JClic logo');
      _this.$infoHead = $('<div/>', { class: 'infoHead' }).append($('<div/>', { class: 'headTitle unselectableText' }).append($(_this.appLogo, { 'aria-label': msg }).css({ width: '1.5em', height: '1.5em', 'vertical-align': 'bottom' }).dblclick(function () {
        // Double click on JClic logo is a hidden method to increase verbosity on Javascript console
        Utils.setLogLevel('all');
        Utils.log('trace', 'Log level set to "trace"');
      })).append($('<span/>').html('JClic.js'))).append($('<p/>').css({ 'margin-top': 0, 'margin-left': '3.5em' }).append($('<a/>', { href: 'http://clic.xtec.cat/repo/index.html?page=info' }).html('http://clic.xtec.cat')).append($('<br>')).append($('<span/>').html(ps.getMsg('Version') + ' ' + _this.ps.JClicVersion)));

      _this.$reportsPanel = $('<div/>', { class: 'reportsPanel', role: 'document' });

      msg = ps.getMsg('Copy data to clipboard');
      _this.$copyBtn = $('<button/>', { title: msg, 'aria-label': msg }).append($(_this.copyIcon).css({ width: '26px', height: '26px' })).on('click', function () {
        clipboard.copy({
          'text/plain': "===> " + ps.getMsg('The data has been copied in HTML format. Please paste them into a spreadsheet or in a rich text editor') + " <===",
          'text/html': _this.$reportsPanel.html()
        });
        _this.$copyBtn.parent().append($('<div/>', { class: 'smallPopup' }).html(ps.getMsg('The data has been copied to clipboard')).fadeIn().delay(3000).fadeOut(function () {
          $(this).remove();
        }));
      });

      msg = ps.getMsg('Close');
      _this.$closeDlgBtn = $('<button/>', { title: msg, 'aria-label': msg }).append($(_this.closeDialogIcon).css({ width: '26px', height: '26px' })).on('click', function () {
        return _this._closeDlg(true);
      });

      msg = ps.getMsg('OK');
      _this.$okDlgBtn = $('<button/>', { title: msg, 'aria-label': msg }).append($(_this.okDialogIcon).css({ width: '26px', height: '26px' })).on('click', function () {
        return _this._closeDlg(true);
      });

      msg = ps.getMsg('Cancel');
      _this.$cancelDlgBtn = $('<button/>', { title: msg, 'aria-label': msg }).append($(_this.closeDialogIcon).css({ width: '26px', height: '26px' })).on('click', function () {
        return _this._closeDlg(false);
      });

      // Registers this Skin in the list of realized Skin objects
      Skin.skinStack.push(_this);
      return _this;
    }

    /**
     * Checks if the provided stylesheet ID is already registered in the root node where the current player is placed
     * @param {String} skinId - The unique identifier of the skin to check
     * @param {PlayStation=} ps - An optional `PlayStation` (currently a {@link JClicPlayer}) used as a base to find the root node
     * @returns {Boolean} - _true_ when the skin stylesheet is already defined in the current root node, _false_ otherwise
     */


    _createClass(Skin, [{
      key: "_getStyleSheets",


      /**
       * Returns the CSS styles used by this skin. This method should be called only from
       * the `Skin` constructor, and overridded by subclasses if needed.
       * @param {string} media - A specific media size. Possible values are: 'default', 'half' and 'twoThirds'
       * @returns {string}
       */
      value: function _getStyleSheets() {
        var media = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';

        return media === 'default' ? this.basicCSS + this.waitAnimCSS + this.reportsCSS : '';
      }

      /**
       * Attaches a {@link JClicPlayer} object to this Skin
       * @param {JClicPlayer} player
       */

    }, {
      key: "attach",
      value: function attach(player) {
        this.detach();
        if (player !== null && player.skin !== null) player.skin.detach();
        this.player = player;
        this.$playerCnt.prepend(player.$div);
        this.setSkinSizes();
        player.$mainContainer.append(this.$div);
      }

      /**
       * Sets the 'size' CSS values (max, min and compulsory) to the main `div` of this skin
       * @param {boolean} full - `true` when the skin is in full screen mode
       */

    }, {
      key: "setSkinSizes",
      value: function setSkinSizes(full) {
        var css = {},
            topHeight = this.player.$topDiv.height(),
            nilValue = this.player.fullScreenChecked ? 'inherit' : null;

        // When `full` no set, detect the current status with screenfull
        if (typeof full === 'undefined') full = screenfull && screenfull.enabled && screenfull.isFullscreen;

        Utils.toCssSize(full ? '100vw' : this.ps.options.minWidth, css, 'min-width', nilValue);
        Utils.toCssSize(full ? '100vh' : this.ps.options.minHeight, css, 'min-height', nilValue);
        Utils.toCssSize(full ? '100vw' : this.ps.options.maxWidth, css, 'max-width', nilValue);
        Utils.toCssSize(full ? '100vh' : this.ps.options.maxHeight, css, 'max-height', nilValue);
        Utils.toCssSize(full ? '100vw' : this.ps.options.width, css, 'width', '100%');
        Utils.toCssSize(full ? '100vh' : this.ps.options.height, css, 'height', topHeight > 0 ? '100%' : '100vh');
        this.$div.css(css);
      }

      /**
       * Detaches the `player` element from this Skin
       */

    }, {
      key: "detach",
      value: function detach() {
        if (this.player !== null) {
          this.player.$div.remove();
          this.$div.detach();
          this.player = null;
        }
      }

      /**
       * Updates the graphic contents of this skin.
       * This method should be called from {@link Skin#update}
       * @override
       * @param {AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`, it's the
       * whole panel.
       */

    }, {
      key: "updateContent",
      value: function updateContent(dirtyRegion) {
        if (this.$msgBoxDivCanvas) {
          var ctx = this.$msgBoxDivCanvas.get(-1).getContext('2d');
          ctx.clearRect(0, 0, ctx.canvas.clientWidth, ctx.canvas.clientHeight);
          this.msgBox.update(ctx, dirtyRegion);
        }
        return _get(Skin.prototype.__proto__ || Object.getPrototypeOf(Skin.prototype), "updateContent", this).call(this);
      }

      /**
       * Resets all counters
       * @param {boolean} bEnabled - Leave it enabled/disabled
       */

    }, {
      key: "resetAllCounters",
      value: function resetAllCounters(bEnabled) {
        $.each(this.counters, function (_name, counter) {
          if (counter !== null) {
            counter.value = 0;
            counter.countDown = 0;
            counter.enabled = bEnabled;
            counter.refreshDisplay();
          }
        });
      }

      /**
       * Sets/unsets the 'wait' state
       * @param {boolean} status - Whether to set or unset the wait status. When `undefined`, the
       * `waitCursorCount` member is evaluated to decide if the wait state should be activated or deactivated.
       */

    }, {
      key: "setWaitCursor",
      value: function setWaitCursor(status) {
        if (typeof status === 'undefined') {
          if (this.$waitPanel) this.$waitPanel.css({
            display: this.waitCursorCount > 0 ? 'initial' : 'none'
          });
        } else {
          switch (status) {
            case true:
              this.waitCursorCount++;
              break;
            case false:
              if (--this.waitCursorCount < 0) this.waitCursorCount = 0;
              break;
            case 'reset':
              this.waitCursorCount = 0;
              break;
          }
          this.setWaitCursor();
        }
      }

      /**
       * Sets the current value of the progress bar
       * @param {number} val - The current value. Should be less or equal than `max`. When -1, the progress bar will be hidden.
       * @param {number=} max - Optional parameter representing the maximum value. When passed, the progress bar will be displayed.
       */

    }, {
      key: "setProgress",
      value: function setProgress(val, max) {
        if (this.$progress) {
          this.currentProgress = val;
          if (val < 0) this.$progress.css({ display: 'none' });else {
            if (max) {
              this.maxProgress = max;
              this.$progress.attr('max', max).css({ display: 'initial' });
            }
            this.$progress.attr('value', val);
          }
          Utils.log('trace', "Progress: " + this.currentProgress + "/" + this.maxProgress);
        }
      }

      /**
       * Increments the progress bar value by the specified amount, only when the progress bar is running.
       * @param {number=} val - The amount to increment. When not defined, it's 1.
       */

    }, {
      key: "incProgress",
      value: function incProgress(val) {
        if (this.currentProgress >= 0) this.setProgress(this.currentProgress + (val || 1));
      }

      /**
       * Shows a window with clues or help for the current activity
       * @param {external:jQuery} _$hlpComponent - A JQuery DOM element with the information to be shown.
       * It can be a string or number. When `null`, the help window (if any) must be closed.
       */

    }, {
      key: "showHelp",
      value: function showHelp(_$hlpComponent) {}
      // TODO: Implement HelpWindow


      /**
       * Shows a "dialog" panel, useful for displaying information or prompt something to users
       * @param {boolean} modal - When `true`, the dialog should be closed by any click outside the main panel
       * @param {object} options - This object should have two components: `main` and `bottom`, both
       * containing a jQuery HTML element (or array of elements) to be placed on the main and bottom panels
       * of the dialog.
       * @returns {Promise} - A Promise that will be fulfilled when the dialog is closed.
       */

    }, {
      key: "showDlg",
      value: function showDlg(modal, options) {
        var _this2 = this;

        return new Promise(function (resolve, reject) {
          _this2._dlgOkValue = 'ok';
          _this2._dlgCancelValue = 'cancelled';
          _this2._isModalDlg = modal;

          _this2.$dlgMainPanel.children().detach();
          _this2.$dlgBottomPanel.children().detach();
          if (options.main) _this2.$dlgMainPanel.append(options.main);
          if (options.bottom) _this2.$dlgBottomPanel.append(options.bottom);

          _this2._closeDlg = function (resolved) {
            if (resolved && resolve) resolve(_this2._dlgOkValue);else if (!resolved && reject) reject(_this2._dlgCancelValue);
            _this2.$dlgOverlay.css({ display: 'none' });
            _this2.enableMainButtons(true);
            _this2._closeDlg = Skin.prototype._closeDlg;
          };
          _this2.enableMainButtons(false);
          _this2.$dlgOverlay.css({ display: 'initial' });
        });
      }

      /**
       * Enables or disables the `tabindex` attribute of the main buttons. Useful when a modal dialog
       * overlay is active, to avoid direct access to controls not related with the dialog.
       * @param {boolean} status - `true` to make main controls navigable, `false` otherwise
       */

    }, {
      key: "enableMainButtons",
      value: function enableMainButtons(status) {
        this.$playerCnt.find('button').attr('tabindex', status ? '0' : '-1');
      }

      /**
       * Called when the dialog must be closed, usually only by Skin members.
       * This method is re-defined on each call to `showDlg`, so the `resolve` and `reject`
       * functions can be safely called.
       */

    }, {
      key: "_closeDlg",
      value: function _closeDlg() {}
      // Do nothing


      /**
       * Displays a dialog with a report of the current results achieved by the user.
       * @param {Reporter} reporter - The reporter system currently in use
       * @returns {Promise} - The Promise returned by {@link Skin.showDlg}.
       */

    }, {
      key: "showReports",
      value: function showReports(reporter) {
        this.$reportsPanel.html(this.$printReport(reporter));
        return this.showDlg(false, {
          main: [this.$infoHead, this.$reportsPanel],
          bottom: [this.$copyBtn, this.$closeDlgBtn]
        });
      }

      /**
       * Formats the current report in a DOM tree, ready to be placed in `$reportsPanel`
       * @param {Reporter} reporter - The reporter system currently in use
       * @returns {external:jQuery[]} - An array of jQuery objects containing the full report
       */

    }, {
      key: "$printReport",
      value: function $printReport(reporter) {
        var _this3 = this;

        var result = [];
        if (reporter) {
          var $html = Utils.$HTML,
              report = reporter.getData(),
              started = new Date(report.started);

          result.push($('<div/>', { class: 'subTitle', id: this.ps.getUniqueId('ReportsLb') }).html(this.ps.getMsg('Current results')));

          var $t = $('<table/>', { class: 'JCGlobalResults' });
          $t.append($html.doubleCell(this.ps.getMsg('Session started:'), started.toLocaleDateString() + " " + started.toLocaleTimeString()), $html.doubleCell(this.ps.getMsg('Reports system:'), this.ps.getMsg(report.descriptionKey) + " " + report.descriptionDetail));
          if (report.userId) $t.append($html.doubleCell(this.ps.getMsg('User:'), report.userId));else if (report.user) // SCORM user
            $t.append($html.doubleCell(this.ps.getMsg('User:'), report.user));

          if (report.sequences > 0) {
            if (report.sessions.length > 1) $t.append($html.doubleCell(this.ps.getMsg('Projects:'), report.sessions.length));
            $t.append($html.doubleCell(this.ps.getMsg('Sequences:'), report.sequences), $html.doubleCell(this.ps.getMsg('Activities done:'), report.activitiesDone), $html.doubleCell(this.ps.getMsg('Activities played at least once:'), report.playedOnce + "/" + report.reportable + " (" + Utils.getPercent(report.ratioPlayed / 100) + ")"));
            if (report.activitiesDone > 0) {
              $t.append($html.doubleCell(this.ps.getMsg('Activities solved:'), report.activitiesSolved + " (" + Utils.getPercent(report.ratioSolved / 100) + ")"));
              if (report.actScore > 0) $t.append($html.doubleCell(this.ps.getMsg('Partial score:'), Utils.getPercent(report.partialScore / 100) + " " + this.ps.getMsg('(out of played activities)')), $html.doubleCell(this.ps.getMsg('Global score:'), Utils.getPercent(report.globalScore / 100) + " " + this.ps.getMsg('(out of all project activities)')));
              $t.append($html.doubleCell(this.ps.getMsg('Total time in activities:'), Utils.getHMStime(report.time * 1000)), $html.doubleCell(this.ps.getMsg('Actions done:'), report.actions));
            }
            result.push($t);

            report.sessions.forEach(function (sr) {
              if (sr.sequences.length > 0) {
                var _$t = $('<table/>', { class: 'JCDetailed' });
                result.push($('<p/>').html(report.sessions.length > 1 ? _this3.ps.getMsg('Project') + " " + sr.projectName : ''));
                _$t.append($('<thead/>').append($('<tr/>').append($html.th(_this3.ps.getMsg('sequence')), $html.th(_this3.ps.getMsg('activity')), $html.th(_this3.ps.getMsg('OK')), $html.th(_this3.ps.getMsg('actions')), $html.th(_this3.ps.getMsg('score')), $html.th(_this3.ps.getMsg('time')))));

                sr.sequences.forEach(function (seq) {
                  var $tr = $('<tr/>').append($('<td/>', { rowspan: seq.activities.length }).html(seq.sequence));
                  seq.activities.forEach(function (act) {
                    if (act.closed) {
                      $tr.append($html.td(act.name));
                      $tr.append(act.solved ? $html.td(_this3.ps.getMsg('YES'), 'ok') : $html.td(_this3.ps.getMsg('NO'), 'no'));
                      $tr.append($html.td(act.actions));
                      $tr.append($html.td(Utils.getPercent(act.precision / 100)));
                      $tr.append($html.td(Utils.getHMStime(act.time * 1000)));
                    } else {
                      $tr.append($html.td(act.name, 'incomplete'));
                      for (var r = 0; r < 4; r++) {
                        $tr.append($html.td('-', 'incomplete'));
                      }
                    }
                    _$t.append($tr);
                    $tr = $('<tr/>');
                  });
                });

                _$t.append($('<tr/>').append($html.td(_this3.ps.getMsg('Total:')), $html.td(sr.played + " (" + Utils.getPercent(sr.ratioPlayed / 100) + ")"), $html.td(sr.solved + " (" + Utils.getPercent(sr.ratioSolved / 100) + ")"), $html.td(sr.actions), $html.td(Utils.getPercent(sr.score / 100)), $html.td(Utils.getHMStime(sr.time * 1000))));

                result.push(_$t);
              }
            }, this);
          } else result.push($('<p/>').html(this.ps.getMsg('No activities done!')));
        }
        return result;
      }

      /**
       * Enables or disables a specific counter
       * @param {string} counter - Which counter
       * @param {boolean} bEnabled - When `true`, the counter will be enabled.
       */

    }, {
      key: "enableCounter",
      value: function enableCounter(counter, bEnabled) {
        if (this.counters[counter]) this.counters[counter].setEnabled(bEnabled);
      }

      /**
       * Main method used to build the content of the skin. Resizes and places internal objects.
       */

    }, {
      key: "doLayout",
      value: function doLayout() {
        var _this4 = this;

        // Resize player
        this.player.doLayout();

        // Build ths canvas at the end of current thread, thus avoiding
        // invalid sizes due to incomplete layout of DOM objects
        if (this.$msgBoxDiv) window.setTimeout(function () {

          // Temporary remove canvas to let div get its natural size:
          if (_this4.$msgBoxDivCanvas) _this4.$msgBoxDivCanvas.remove();

          // Get current size of message box div without canvas
          var msgWidth = _this4.$msgBoxDiv.outerWidth(),
              msgHeight = _this4.$msgBoxDiv.outerHeight();

          // Replace existing canvas if size has changed
          if (_this4.$msgBoxDivCanvas === null || _this4.msgBox.dim.widht !== msgWidth || _this4.msgBox.dim.height !== msgHeight) {
            _this4.$msgBoxDivCanvas = $("<canvas width=\"" + msgWidth + "\" height=\"" + msgHeight + "\"/>");
            _this4.msgBox.setBounds(new AWT.Rectangle(0, 0, msgWidth + 1, msgHeight));
            _this4.msgBox.buildAccessibleElement(_this4.$msgBoxDivCanvas, _this4.$msgBoxDiv);
          }
          // restore canvas
          _this4.$msgBoxDiv.append(_this4.$msgBoxDivCanvas);
          _this4.updateContent();
        }, 0);
      }

      /**
       * adjusts the skin to the dimension of its `$div` container
       * @returns {AWT.Dimension} the new dimension of the skin
       */

    }, {
      key: "fit",
      value: function fit() {
        this.doLayout();
        return new AWT.Dimension(this.$div.width(), this.$div.height());
      }

      /**
       * Sets or unsets the player in fullscreen mode, when allowed, using the
       * {@link https://github.com/sindresorhus/screenfull.js|screenfull.js} library.
       * @param {boolean} status - Whether to set or unset the player in fullscreen mode. When `null`
       * or `undefined`, the status toggles between fullscreen and windowed modes.
       * @returns {boolean} `true` if the request was successful, `false` otherwise.
       */

    }, {
      key: "setScreenFull",
      value: function setScreenFull(status) {
        if (screenfull && screenfull.enabled && (status === true && !screenfull.isFullscreen || status === false && !screenfull.isFullScreen || status !== true && status !== false)) {
          // Save current value of fullScreen for later use
          var full = screenfull.isFullscreen;
          screenfull.toggle(this.player.$mainContainer.get(-1));
          this.player.fullScreenChecked = true;
          // Firefox don't updates `document.fullscreenElement` in real time, so use the saved value instead
          this.setSkinSizes(!full);
        }
      }

      /**
       * Method used to notify this skin that a specific action has changed its enabled/disabled status
       * @param {AWT.Action} _action - The action originating the change event
       */

    }, {
      key: "actionStatusChanged",
      value: function actionStatusChanged(act) {
        if (act.name && this.buttons[act.name]) this.setEnabled(this.buttons[act.name], act.enabled);
      }

      /**
       * Enables or disables an object
       * @param {external:jQuery} $object - A JQuery DOM element
       * @override
       * @param {boolean} enabled
       */

    }, {
      key: "setEnabled",
      value: function setEnabled($object, enabled) {
        if ($object && enabled) $object.removeAttr('disabled');else if ($object) $object.attr('disabled', true);
      }

      /**
       * Compares two Skin objects
       * @param {Skin} skin - The Skin to compare against this
       * @returns {boolean} - `true` if both skins are equivalent.
       */

    }, {
      key: "equals",
      value: function equals(skin) {
        return skin && this.name === skin.name && this.ps === skin.ps;
      }

      /**
       * Gets the {@link ActiveBox} used to display the main messages of activities
       * @returns {ActiveBox}
       */

    }, {
      key: "getMsgBox",
      value: function getMsgBox() {
        // Method to be implemented by subclasses
        return null;
      }
    }], [{
      key: "registerStyleSheet",
      value: function registerStyleSheet(skinId, ps) {
        var result = false;
        var root = Utils.getRootHead(ps);
        if (!root['__JClicID']) root.__JClicID = "SK" + Skin.lastId++;

        var styles = Skin.rootStyles[root.__JClicID];
        if (!styles) {
          styles = [];
          Skin.rootStyles[root.__JClicID] = styles;
        }

        if (styles.indexOf(skinId) < 0) {
          Utils.log('trace', "Stylesheet \"" + skinId + "\" has been registered for root node labeled as \"" + root.__JClicID + "\"");
          styles.push(skinId);
        } else result = true;

        return result;
      }

      /**
       * Gets the specified Skin from `skinStack`, or creates a new one if not found.
       * This function should be used only through `Skin.getSkin`
       * @param {string} skinName - The name of the searched skin
       * @param {PlayStation} ps - The PlayStation (usually a {@link JClicPlayer}) used to build the new skin.
       * @param {object=} options - Optional parameter with additional options
       * @returns {Skin}
       */

    }, {
      key: "getSkin",
      value: function getSkin() {
        var skinName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
        var ps = arguments[1];
        var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

        skinName = skinName || 'default';

        // Correct old skin names
        if (skinName.charAt(0, 1) === '@' && skinName.substr(-4) === '.xml') skinName = skinName.substr(1, skinName.length - 5);

        // look for the skin in the stack of realized skins
        if (skinName && ps) {
          // TODO: Check also `options`!
          var sk = Skin.skinStack.find(function (s) {
            return s.name === skinName && s.ps === ps;
          });
          if (sk) return sk;
        }

        // Locates the class of the requested Skin (or [DefaultSkin](DefaultSkin.html)
        // if not specified). When not found, a new one is created and registered in `skinStack`
        var cl = Skin.CLASSES[skinName];
        if (!cl) {
          // Process custom skin XML files
          var mbe = ps.project.mediaBag.getElement(skinName, false);
          if (mbe && mbe.data) options = Object.assign({}, options, mbe.data);

          if (!ps.zip && options.class === 'edu.xtec.jclic.skins.BasicSkin' && options.image && ps.project.mediaBag.getElement(options.image, false) && ps.project.mediaBag.getElement(options.image, false).data) cl = Skin.CLASSES.custom;else {
            Utils.log('warn', "Unknown skin class: " + skinName);
            cl = Skin.CLASSES.default;
          }
        }

        // Build and return the requested skin
        return new cl(ps, skinName, options);
      }
    }]);

    return Skin;
  }(AWT.Container);

  /**
   * Collection of realized __Skin__ objects.
   * @type {Skin[]}
   */


  Skin.skinStack = [];

  /**
   * Collection of skin style sheets already registered on the current document
   * @type {Object}
   */
  Skin.rootStyles = {};

  /**
   * Counter used to label root nodes with unique IDs
   * @type {Number}
   */
  Skin.lastId = 1;

  /**
   * List of classes derived from Skin. It should be filled by real skin classes at declaration time.
   * @type {object}
   */
  Skin.CLASSES = {};

  Object.assign(Skin.prototype, {
    /**
     * Class name of this skin. It will be used as a base selector in the definition of all CSS styles.
     * @name Skin#skinId
     * @type {string} */
    skinId: 'JClicBasicSkin',
    /**
     * The HTML div object used by this Skin
     * @name Skin#$div
     * @type {external:jQuery} */
    $div: null,
    /**
     * The HTML div where JClic Player will be placed
     * @name Skin#$playerCnt
     * @type {external:jQuery} */
    $playerCnt: null,
    /**
     * Current name of the skin.
     * @name Skin#name
     * @type {string} */
    name: 'default',
    /**
     * Specific options of this skin
     * @name Skin#options
     * @type {object} */
    options: {},
    /**
     * Name of the XML file used to retrieve the skin settings.
     * @name Skin#fileName
     * @type {string} */
    fileName: '',
    /**
     * Waiting panel, displayed while loading resources.
     * @name Skin#$waitPanel
     * @type {external:jQuery} */
    $waitPanel: null,
    /**
     * Graphic indicator of loading progress
     * @name Skin#$progress
     * @type {external:jQuery} */
    $progress: null,
    /**
     * Current value of the progress bar
     * @name Skin#currentProgress
     * @type {number} */
    currentProgress: -1,
    /**
     * Max value of the progress bar
     * @name Skin#maxProgress
     * @type {number} */
    maxProgress: 0,
    /**
     * The box used to display the main messages of JClic activities
     * @name DefaultSkin#msgBox
     * @type {ActiveBox} */
    msgBox: null,
    /**
     * The `div` DOM object where `msgBox` is located
     * @name DefaultSkin#$msgBoxDiv
     * @type {external:jQuery} */
    $msgBoxDiv: null,
    /*
     * An HTML `canvas` object created in `$msgBoxDiv`
     * @name DefaultSkin#$msgBoxDivCanvas
     * @type {external:jQuery} */
    $msgBoxDivCanvas: null,
    /**
     * Main panel used to display modal and non-modal dialogs
     * @name Skin#$dlgOverlay
     * @type {external:jQuery} */
    $dlgOverlay: null,
    /**
     * Main panel of dialogs, where relevant information must be placed
     * @name Skin#$dlgMainPanel
     * @type {external:jQuery} */
    $dlgMainPanel: null,
    /**
     * Bottom panel of dialogs, used for action buttons
     * @name Skin#$dlgBottomPanel
     * @type {external:jQuery} */
    $dlgBottomPanel: null,
    /**
     * Element usually used as header in dialogs, with JClic logo, name and version
     * @name Skin#infoHead
     * @type {external:jQuery} */
    $infoHead: null,
    /**
     * Iconic button used to copy content to clipboard
     * @name Skin#$copyBtn
     * @type {external:jQuery} */
    $copyBtn: null,
    /**
     * Iconic button used to close the dialog
     * @name Skin#$closeDlgBtn
     * @type {external:jQuery} */
    $closeDlgBtn: null,
    /**
     * OK dialog button
     * @name Skin#$okDlgBtn
     * @type {external:jQuery} */
    $okDlgBtn: null,
    /**
     * Cancel dialog button
     * @name Skin#$cancelDlgBtn
     * @type {external:jQuery} */
    $cancelDlgBtn: null,
    /**
     * Value to be returned by the dialog promise when the presented task is fulfilled
     * @name Skin#_dlgOkValue
     * @type {Object} */
    _dlgOkValue: null,
    /**
     * Value to be returned in user-canceled dialogs
     * @name Skin#_dlgCancelValue
     * @type {Object} */
    _dlgCancelValue: null,
    /**
     * Flag indicating if the current dialog is modal or not
     * @name Skin#_isModalDlg
     * @type {boolean} */
    _isModalDlg: false,
    /**
     * Div inside {@link $dlgOverlay} where JClicPlayer will place the information to be shown
     * @name Skin#$reportsPanel
     * @type {external:jQuery} */
    $reportsPanel: null,
    /**
     * The basic collection of buttons that most skins implement
     * @name Skin#buttons
     * @type {object} */
    buttons: {
      'prev': null,
      'next': null,
      'return': null,
      'reset': null,
      'info': null,
      'help': null,
      'audio': null,
      'about': null,
      'fullscreen': null,
      'close': null
    },
    /**
     * The collection of counters
     * @name Skin#counters
     * @type {object} */
    counters: {
      'actions': null,
      'score': null,
      'time': null
    },
    /**
     * The collection of message areas
     * @name Skin#msgArea
     * @type {object} */
    msgArea: {
      'main': null,
      'aux': null,
      'mem': null
    },
    /**
     * The {@link JClicPlayer} object associated to this skin
     * @name Skin#player
     * @type {JClicPlayer} */
    player: null,
    /**
     * The {@link http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html|PlayStation}
     * used by this Skin. Usually, the same as `player`
     * @name Skin#ps
     * @type {PlayStation} */
    ps: null,
    /**
     * Counter to be incremented or decremented as `waitCursor` is requested or released.
     * @name Skin#waitCursorCount
     * @type {number} */
    waitCursorCount: 0,
    //
    // Buttons and other graphical resources used by this skin.
    //
    /**
     * Main styles
     * @name Skin#basicCSS
     * @type {string} */
    basicCSS: '\
.ID {width:100%; background-color:#3F51B5; display:-webkit-flex; display:flex; -webkit-flex-direction:column; flex-direction:column;}\
.ID .JClicPlayerCnt {background-color:lightblue; margin:18px; -webkit-flex-grow:1; flex-grow:1; position:relative;}\
.ID .JClicPlayerCnt > div {position:absolute; width:100%; height:100%;}\
.ID button:not(.StockBtn) {background:transparent; padding:0; border:none;}\
.ID .unselectableText {-webkit-user-select:none; -moz-user-select:none; -ms-user-select:none; user-select: none;}\
.ID .progressBar {width: 250px}',
    /**
     * Waiting screen styles
     * @name Skin#waitAnimCSS
     * @type {string} */
    waitAnimCSS: '\
.ID .waitPanel {display:-webkit-flex; display:flex; width:100%; height:100%; -webkit-justify-content:center; justify-content:center; -webkit-align-items:center; align-items:center;}\
.ID .animImgBox {position:relative; width:300px; height:300px; max-width:80%; max-height:80%;}\
.ID .animImgBox svg {position:absolute; width:100%; height:100%; animation-iteration-count:infinite; animation-timing-function:linear;}\
.ID #waitImgBig {animation-duration:0.8s; animation-name:rotate-right;}\
@keyframes rotate-right {from {transform:rotate(0);} to {transform:rotate(1turn);}}\
.ID #waitImgSmall {animation-duration:0.6s; animation-name:rotate-left;}\
@keyframes rotate-left {from {transform:rotate(0);} to {transform:rotate(-1turn);}}',
    /**
     * Animated image displayed while loading resources
     * Based on Ryan Allen's [svg-spinner](http://articles.dappergentlemen.com/2015/01/13/svg-spinner/)
     * @name Skin#waitImgBig
     * @type {string} */
    waitImgBig: '<svg id="waitImgBig" viewBox="0 0 80 80" xmlns="http://www.w3.org/2000/svg">\
<path fill="#3F51B5" d="m 65.99,40.19 c -0.42,5.33 7.80,4.94 8.11,0.20 C 74.50,34.37 66.35,8.59 42.92,\
7.98 15.90,7.29 9.96,29.50 9.94,39.41 15.33,-1.66 68.61,7.048 65.99,40.19 Z" />\
</svg>',
    /**
     * Animated image displayed while loading resources (small)
     * @name Skin#waitImgSmall
     * @type {string} */
    waitImgSmall: '<svg id="waitImgSmall" viewBox="0 0 80 80" xmlns="http://www.w3.org/2000/svg">\
<path fill="#3F51B5"d="m 57.00,39.43 c -0.28,-3.53 5.16,-3.27 5.37,-0.13 0.26,3.99 -5.13,21.04 -20.63,\
21.44 C 23.85,61.19 19.93,46.50 19.92,39.94 23.48,67.11 58.73,61.35 57.00,39.43 Z"/>\
</svg>',
    /**
     * Reports screen styles
     * @name Skin#reportsCSS
     * @type {string} */
    reportsCSS: '\
.ID .dlgDiv {background-color:#efefef; color:#757575; font-family:Roboto,sans-serif; font-size:10pt; line-height:normal;}\
.ID .dlgDiv a,a:visited,a:active,a:hover {text-decoration:none; color:inherit;}\
.ID .dlgMainPanel {padding:1em 2em; max-height:calc(100vh - 8em); max-width:calc(100vw - 2em); min-width:20em; overflow:auto;}\
.ID .dlgMainPanel .headTitle {font-size:2.5em; font-weight:bold; margin:auto;}\
.ID .dlgMainPanel .subTitle {font-size:1.4em; font-weight:bold; margin-bottom:0.5em;}\
.ID .dlgMainPanel p {font-size:1.1em; margin-bottom:0.5em;}\
.ID .dlgMainPanel table {table-layout:fixed; width:40em; margin:0.5em 0 1.7em 0; border-collapse:collapse;}\
.ID .dlgMainPanel select {min-width:20em; font-size:1.2em; font-family:Roboto,sans-serif; color:#757575;}\
.ID .dlgMainPanel input {margin-left:1em; font-size:1.2em; font-family:Roboto,sans-serif; border-color:lightgray;}\
.ID .infoHead {padding:1em 0em 0.5em;}\
.ID .JCGlobalResults td {padding:0.4em; border-bottom:1px solid #b6b6b6;}\
.ID .JCGlobalResults td:first-child {font-weight:600; width:14em;}\
.ID .JCDetailed td,th {border-bottom:1px solid #b6b6b6; padding:0.3em 0.4em; vertical-align:top; text-align:center; overflow:hidden; text-overflow:ellipsis;}\
.ID .JCDetailed thead {font-weight:600;}\
.ID .JCDetailed th:first-child {width:7em;}\
.ID .JCDetailed th:nth-last-child(4) {width:4em;}\
.ID .JCDetailed th:nth-last-child(-n+3) {width:4.1em; text-align:right;}\
.ID .JCDetailed td:nth-last-child(-n+3) {text-align:right;}\
.ID .JCDetailed .ok {color:#4bae4f; font-weight:600;}\
.ID .JCDetailed .no {color:#f34235; font-weight:600;}\
.ID .JCDetailed tr:last-child {font-weight:bold;}\
.ID .JCDetailed .incomplete {font-style:italic;}\
.ID .dlgBottomPanel {height:3.5em; background-color:white; padding:0.5em; font-weight:bold; text-align:right; border-top:1px solid #eee; position:relative;}\
.ID .dlgBottomPanel .smallPopup {background-color:#222; color:#ddd; padding:0.5em; font-size:0.9em; position:absolute; right:6em; top:1em;}\
.ID .dlgBottomPanel button {display:inline-block; padding:10px; cursor:pointer; line-height:0;}\
.ID .dlgBottomPanel button:hover {background-color:#eee; border-radius:80px;}\
.ID .dlgBottomPanel button:active {background-color:#b3e5fc;}',
    //
    // Icons used in buttons:
    //
    /**
     * Icon for 'close dialog' button
     * @name Skin#closeDialogIcon
     * @type {string} */
    closeDialogIcon: '<svg fill="#757575" viewBox="0 0 24 24" width="36" height="36" xmlns="http://www.w3.org/2000/svg">\
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>\
</svg>',
    /**
     * Icon for 'ok' button
     * @name Skin#okDialogIcon
     * @type {string} */
    okDialogIcon: '<svg fill="#757575" viewBox="0 0 24 24" width="36" height="36" xmlns="http://www.w3.org/2000/svg">\
<path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>\
</svg>',
    /**
     * Icon for 'copy' button
     * @name Skin#copyIcon
     * @type {string} */
    copyIcon: '<svg fill="#757575" viewBox="0 0 24 24" width="36" height="36" xmlns="http://www.w3.org/2000/svg">\
<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/>\
</svg>',
    /**
     * JClic logo
     * @name Skin#appLogo
     * @type {string} */
    appLogo: '<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><g transform="matrix(.02081 0 0-.02081 5 62.33)">\
<path d="m1263 1297l270 1003 996-267-267-990c-427-1583-2420-1046-1999 519 3 11 999-266 999-266z" fill="none" stroke="#9d6329" stroke-linejoin="round" stroke-linecap="round" stroke-width="180" stroke-miterlimit="3.864"/>\
<path d="m1263 1297l270 1003 996-267-267-990c-427-1583-2420-1046-1998 519 3 11 999-266 999-266" fill="#f89c0e"/>\
<path d="m357 2850l1000-268-267-992-1000 266 267 994z" fill="none" stroke="#86882b" stroke-linejoin="round" stroke-linecap="round" stroke-width="180" stroke-miterlimit="3.864"/>\n\
<path d="m357 2850l1000-268-267-992-1000 266 267 994" fill="#d9e70c"/>\n\
</g></svg>',
    /**
     * Screen sizes (width and height) below which will half sized elements will be used
     * @name DefaultSkin#halfMedia
     * @type {object} */
    halfMedia: { width: 376, height: 282 },
    /**
     * Screen sizes (width and height) below which will two-thirds sized elements will be used
     * @name DefaultSkin#twoThirdsMedia
     * @type {object} */
    twoThirdsMedia: { width: 420, height: 315 }
  });

  return Skin;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : boxes/ActiveBoxGrid.js
 *  Created : 19/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2016 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(516), __webpack_require__(74), __webpack_require__(3), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, ActiveBoxBag, ActiveBox, AWT, Utils) {

  /**
   * This class extends {@link ActiveBoxBag} with constructors that take an argument of type
   * {@link Shaper} used to build all its {@link ActiveBox}components. It also maintains information
   * about the number of "rows" and "columns", useful to compute valid (integer) values when
   * resizing or moving its components.
   * @exports ActiveBoxGrid
   * @class
   * @extends ActiveBoxBag
   */
  var ActiveBoxGrid = function (_ActiveBoxBag) {
    _inherits(ActiveBoxGrid, _ActiveBoxBag);

    /**
     * ActiveBxGrid constructor
     * @param {?AbstractBox} parent - The AbstractBox to which this box grid belongs
     * @param {?AWT.Container} container - The container where this box grid is placed.
     * @param {?BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
     * @param {number} px - `X` coordinate of the upper left corner of this box grid
     * @param {number} py - `Y` coordinate of the upper left corner of this box grid
     * @param {number} setWidth - Total width of the box grid
     * @param {number} setHeight - Total height of the box grid
     * @param {Shaper} sh - Shaper used to build the ActiveBox objects
     */
    function ActiveBoxGrid(parent, container, boxBase, px, py, setWidth, setHeight, sh) {
      _classCallCheck(this, ActiveBoxGrid);

      var _this = _possibleConstructorReturn(this, (ActiveBoxGrid.__proto__ || Object.getPrototypeOf(ActiveBoxGrid)).call(this, parent, container, boxBase));
      // ActiveBoxGrid derives from ActiveBoxBag


      _this.nCols = sh.nCols;
      _this.nRows = sh.nRows;

      // This will be the enclosing rectangle of this ActiveBox bag
      var r = new AWT.Rectangle(new AWT.Point(px, py), new AWT.Dimension(Math.round(setWidth / _this.nCols) * _this.nCols, Math.round(setHeight / _this.nRows) * _this.nRows));

      // Create all the [ActiveBox](ActiveBox.html) objects based on the
      // shapes provided by the [Shaper](Shaper.html)
      for (var i = 0; i < sh.nCells; i++) {
        var tmpSh = sh.getShape(i, r),
            bx = new ActiveBox(_this, container, boxBase, i, tmpSh.getBounds());
        if (!sh.rectangularShapes) bx.setShape(tmpSh);
        _this.addActiveBox(bx);
      }

      // If the Shaper has `remainder` (extra space), set the background box of this
      // [BoxBag](BoxBag.html)
      if (sh.hasRemainder) {
        var _tmpSh = sh.getRemainderShape(r),
            _bx = new ActiveBox(_this, container, boxBase, 0, _tmpSh.getBounds());
        _bx.setShape(_tmpSh);
        _this.setBackgroundBox(_bx);
      }
      return _this;
    }

    /**
     * This factory constructor creates a new empty grid with the number of cells indicated by the
     * {@link ActiveBagContent} `abc`, not filling the cells with any content.
     * @param {?AbstractBox} parent - The AbstractBox to which this box grid belongs
     * @param {?AWT.Container} container - The container where this box grid is placed.
     * @param {number} px - `X` coordinate of the upper left corner of this box grid
     * @param {number} py - `Y` coordinate of the upper left corner of this box grid
     * @param {ActiveBagContent} abc - Used only to get the number of cells and the shaper (when `sh` is `null`)
     * @param {?Shaper} sh - Shaper used to build the ActiveBox objects
     * @param {?BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
     * of this box grid are defined.
     * @returns {ActiveBoxGrid}
     */


    _createClass(ActiveBoxGrid, [{
      key: "getMinimumSize",


      /**
       * Gets the minimum size of this grid
       * @returns {AWT.Dimension}
       */
      value: function getMinimumSize() {
        return new AWT.Dimension(Utils.settings.MIN_CELL_SIZE * this.nCols, Utils.settings.MIN_CELL_SIZE * this.nRows);
      }

      /**
       * Gets a scaled size of this grid, rounded to the nearest integer values
       * @param {number} scale - The scale factor
       * @returns {AWT.Dimension}
       */

    }, {
      key: "getScaledSize",
      value: function getScaledSize(scale) {
        return new AWT.Dimension(Utils.roundTo(scale * this.preferredBounds.dim.width, this.nCols), Utils.roundTo(scale * this.preferredBounds.dim.height, this.nRows));
      }

      /**
       * Returns the logical coordinates of the provided {@link ActiveBox}.
       * The units of the result are not pixels, but ordinal numbers (relative positions) of columns
       * and rows in the grid.
       * @param {ActiveBox} bx - The box to process
       * @returns {AWT.Point}
       */

    }, {
      key: "getCoord",
      value: function getCoord(bx) {
        return new AWT.Point(bx.idLoc % this.nCols, Math.floor(bx.idLoc / this.nCols));
      }

      /**
       * Calculates the logical distance between two {@link ActiveBox} objects.
       * Resulting units are not pixels, but ordinal numbers (relative positions) of columns and rows
       * in the grid.
       * @param {ActiveBox} src - First box
       * @param {ActiveBox} dest - Second box
       * @returns {AWT.Point}
       */

    }, {
      key: "getCoordDist",
      value: function getCoordDist(src, dest) {
        var ptSrc = this.getCoord(src),
            ptDest = this.getCoord(dest);
        return new AWT.Point(ptDest.x - ptSrc.x, ptDest.y - ptSrc.y);
      }
    }], [{
      key: "createEmptyGrid",
      value: function createEmptyGrid(parent, container, px, py, abc, sh, boxBase) {
        var result = abc ? new ActiveBoxGrid(parent, container, boxBase || abc.bb, px, py, abc.getTotalWidth(), abc.getTotalHeight(), sh || abc.getShaper()) : null;

        if (result) result.setBorder(abc.border);

        return result;
      }
    }]);

    return ActiveBoxGrid;
  }(ActiveBoxBag);

  Object.assign(ActiveBoxGrid.prototype, {
    /**
     * Number of columns of this box grid
     * @name ActiveBoxGrid#nCols
     * @type {number} */
    nCols: 1,
    /**
     * Number of rows of this box grid
     * @name ActiveBoxGrid#nRows
     * @type {number} */
    nRows: 1
  });

  return ActiveBoxGrid;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

if (__webpack_require__(10)) {
  var LIBRARY = __webpack_require__(46);
  var global = __webpack_require__(5);
  var fails = __webpack_require__(6);
  var $export = __webpack_require__(0);
  var $typed = __webpack_require__(87);
  var $buffer = __webpack_require__(125);
  var ctx = __webpack_require__(25);
  var anInstance = __webpack_require__(52);
  var propertyDesc = __webpack_require__(44);
  var hide = __webpack_require__(17);
  var redefineAll = __webpack_require__(54);
  var toInteger = __webpack_require__(31);
  var toLength = __webpack_require__(12);
  var toIndex = __webpack_require__(167);
  var toAbsoluteIndex = __webpack_require__(48);
  var toPrimitive = __webpack_require__(29);
  var has = __webpack_require__(16);
  var classof = __webpack_require__(69);
  var isObject = __webpack_require__(7);
  var toObject = __webpack_require__(14);
  var isArrayIter = __webpack_require__(116);
  var create = __webpack_require__(49);
  var getPrototypeOf = __webpack_require__(22);
  var gOPN = __webpack_require__(50).f;
  var getIterFn = __webpack_require__(118);
  var uid = __webpack_require__(45);
  var wks = __webpack_require__(8);
  var createArrayMethod = __webpack_require__(33);
  var createArrayIncludes = __webpack_require__(78);
  var speciesConstructor = __webpack_require__(85);
  var ArrayIterators = __webpack_require__(121);
  var Iterators = __webpack_require__(61);
  var $iterDetect = __webpack_require__(82);
  var setSpecies = __webpack_require__(51);
  var arrayFill = __webpack_require__(120);
  var arrayCopyWithin = __webpack_require__(157);
  var $DP = __webpack_require__(11);
  var $GOPD = __webpack_require__(21);
  var dP = $DP.f;
  var gOPD = $GOPD.f;
  var RangeError = global.RangeError;
  var TypeError = global.TypeError;
  var Uint8Array = global.Uint8Array;
  var ARRAY_BUFFER = 'ArrayBuffer';
  var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER;
  var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';
  var PROTOTYPE = 'prototype';
  var ArrayProto = Array[PROTOTYPE];
  var $ArrayBuffer = $buffer.ArrayBuffer;
  var $DataView = $buffer.DataView;
  var arrayForEach = createArrayMethod(0);
  var arrayFilter = createArrayMethod(2);
  var arraySome = createArrayMethod(3);
  var arrayEvery = createArrayMethod(4);
  var arrayFind = createArrayMethod(5);
  var arrayFindIndex = createArrayMethod(6);
  var arrayIncludes = createArrayIncludes(true);
  var arrayIndexOf = createArrayIncludes(false);
  var arrayValues = ArrayIterators.values;
  var arrayKeys = ArrayIterators.keys;
  var arrayEntries = ArrayIterators.entries;
  var arrayLastIndexOf = ArrayProto.lastIndexOf;
  var arrayReduce = ArrayProto.reduce;
  var arrayReduceRight = ArrayProto.reduceRight;
  var arrayJoin = ArrayProto.join;
  var arraySort = ArrayProto.sort;
  var arraySlice = ArrayProto.slice;
  var arrayToString = ArrayProto.toString;
  var arrayToLocaleString = ArrayProto.toLocaleString;
  var ITERATOR = wks('iterator');
  var TAG = wks('toStringTag');
  var TYPED_CONSTRUCTOR = uid('typed_constructor');
  var DEF_CONSTRUCTOR = uid('def_constructor');
  var ALL_CONSTRUCTORS = $typed.CONSTR;
  var TYPED_ARRAY = $typed.TYPED;
  var VIEW = $typed.VIEW;
  var WRONG_LENGTH = 'Wrong length!';

  var $map = createArrayMethod(1, function (O, length) {
    return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length);
  });

  var LITTLE_ENDIAN = fails(function () {
    // eslint-disable-next-line no-undef
    return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
  });

  var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () {
    new Uint8Array(1).set({});
  });

  var toOffset = function toOffset(it, BYTES) {
    var offset = toInteger(it);
    if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!');
    return offset;
  };

  var validate = function validate(it) {
    if (isObject(it) && TYPED_ARRAY in it) return it;
    throw TypeError(it + ' is not a typed array!');
  };

  var allocate = function allocate(C, length) {
    if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) {
      throw TypeError('It is not a typed array constructor!');
    }return new C(length);
  };

  var speciesFromList = function speciesFromList(O, list) {
    return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list);
  };

  var fromList = function fromList(C, list) {
    var index = 0;
    var length = list.length;
    var result = allocate(C, length);
    while (length > index) {
      result[index] = list[index++];
    }return result;
  };

  var addGetter = function addGetter(it, key, internal) {
    dP(it, key, { get: function get() {
        return this._d[internal];
      } });
  };

  var $from = function from(source /* , mapfn, thisArg */) {
    var O = toObject(source);
    var aLen = arguments.length;
    var mapfn = aLen > 1 ? arguments[1] : undefined;
    var mapping = mapfn !== undefined;
    var iterFn = getIterFn(O);
    var i, length, values, result, step, iterator;
    if (iterFn != undefined && !isArrayIter(iterFn)) {
      for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) {
        values.push(step.value);
      }O = values;
    }
    if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2);
    for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) {
      result[i] = mapping ? mapfn(O[i], i) : O[i];
    }
    return result;
  };

  var $of = function of() /* ...items */{
    var index = 0;
    var length = arguments.length;
    var result = allocate(this, length);
    while (length > index) {
      result[index] = arguments[index++];
    }return result;
  };

  // iOS Safari 6.x fails here
  var TO_LOCALE_BUG = !!Uint8Array && fails(function () {
    arrayToLocaleString.call(new Uint8Array(1));
  });

  var $toLocaleString = function toLocaleString() {
    return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments);
  };

  var proto = {
    copyWithin: function copyWithin(target, start /* , end */) {
      return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined);
    },
    every: function every(callbackfn /* , thisArg */) {
      return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
    },
    fill: function fill(value /* , start, end */) {
      // eslint-disable-line no-unused-vars
      return arrayFill.apply(validate(this), arguments);
    },
    filter: function filter(callbackfn /* , thisArg */) {
      return speciesFromList(this, arrayFilter(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined));
    },
    find: function find(predicate /* , thisArg */) {
      return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
    },
    findIndex: function findIndex(predicate /* , thisArg */) {
      return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
    },
    forEach: function forEach(callbackfn /* , thisArg */) {
      arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
    },
    indexOf: function indexOf(searchElement /* , fromIndex */) {
      return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
    },
    includes: function includes(searchElement /* , fromIndex */) {
      return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
    },
    join: function join(separator) {
      // eslint-disable-line no-unused-vars
      return arrayJoin.apply(validate(this), arguments);
    },
    lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) {
      // eslint-disable-line no-unused-vars
      return arrayLastIndexOf.apply(validate(this), arguments);
    },
    map: function map(mapfn /* , thisArg */) {
      return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined);
    },
    reduce: function reduce(callbackfn /* , initialValue */) {
      // eslint-disable-line no-unused-vars
      return arrayReduce.apply(validate(this), arguments);
    },
    reduceRight: function reduceRight(callbackfn /* , initialValue */) {
      // eslint-disable-line no-unused-vars
      return arrayReduceRight.apply(validate(this), arguments);
    },
    reverse: function reverse() {
      var that = this;
      var length = validate(that).length;
      var middle = Math.floor(length / 2);
      var index = 0;
      var value;
      while (index < middle) {
        value = that[index];
        that[index++] = that[--length];
        that[length] = value;
      }return that;
    },
    some: function some(callbackfn /* , thisArg */) {
      return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
    },
    sort: function sort(comparefn) {
      return arraySort.call(validate(this), comparefn);
    },
    subarray: function subarray(begin, end) {
      var O = validate(this);
      var length = O.length;
      var $begin = toAbsoluteIndex(begin, length);
      return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))(O.buffer, O.byteOffset + $begin * O.BYTES_PER_ELEMENT, toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin));
    }
  };

  var $slice = function slice(start, end) {
    return speciesFromList(this, arraySlice.call(validate(this), start, end));
  };

  var $set = function set(arrayLike /* , offset */) {
    validate(this);
    var offset = toOffset(arguments[1], 1);
    var length = this.length;
    var src = toObject(arrayLike);
    var len = toLength(src.length);
    var index = 0;
    if (len + offset > length) throw RangeError(WRONG_LENGTH);
    while (index < len) {
      this[offset + index] = src[index++];
    }
  };

  var $iterators = {
    entries: function entries() {
      return arrayEntries.call(validate(this));
    },
    keys: function keys() {
      return arrayKeys.call(validate(this));
    },
    values: function values() {
      return arrayValues.call(validate(this));
    }
  };

  var isTAIndex = function isTAIndex(target, key) {
    return isObject(target) && target[TYPED_ARRAY] && (typeof key === 'undefined' ? 'undefined' : _typeof(key)) != 'symbol' && key in target && String(+key) == String(key);
  };
  var $getDesc = function getOwnPropertyDescriptor(target, key) {
    return isTAIndex(target, key = toPrimitive(key, true)) ? propertyDesc(2, target[key]) : gOPD(target, key);
  };
  var $setDesc = function defineProperty(target, key, desc) {
    if (isTAIndex(target, key = toPrimitive(key, true)) && isObject(desc) && has(desc, 'value') && !has(desc, 'get') && !has(desc, 'set')
    // TODO: add validation descriptor w/o calling accessors
    && !desc.configurable && (!has(desc, 'writable') || desc.writable) && (!has(desc, 'enumerable') || desc.enumerable)) {
      target[key] = desc.value;
      return target;
    }return dP(target, key, desc);
  };

  if (!ALL_CONSTRUCTORS) {
    $GOPD.f = $getDesc;
    $DP.f = $setDesc;
  }

  $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', {
    getOwnPropertyDescriptor: $getDesc,
    defineProperty: $setDesc
  });

  if (fails(function () {
    arrayToString.call({});
  })) {
    arrayToString = arrayToLocaleString = function toString() {
      return arrayJoin.call(this);
    };
  }

  var $TypedArrayPrototype$ = redefineAll({}, proto);
  redefineAll($TypedArrayPrototype$, $iterators);
  hide($TypedArrayPrototype$, ITERATOR, $iterators.values);
  redefineAll($TypedArrayPrototype$, {
    slice: $slice,
    set: $set,
    constructor: function constructor() {/* noop */},
    toString: arrayToString,
    toLocaleString: $toLocaleString
  });
  addGetter($TypedArrayPrototype$, 'buffer', 'b');
  addGetter($TypedArrayPrototype$, 'byteOffset', 'o');
  addGetter($TypedArrayPrototype$, 'byteLength', 'l');
  addGetter($TypedArrayPrototype$, 'length', 'e');
  dP($TypedArrayPrototype$, TAG, {
    get: function get() {
      return this[TYPED_ARRAY];
    }
  });

  // eslint-disable-next-line max-statements
  module.exports = function (KEY, BYTES, wrapper, CLAMPED) {
    CLAMPED = !!CLAMPED;
    var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array';
    var GETTER = 'get' + KEY;
    var SETTER = 'set' + KEY;
    var TypedArray = global[NAME];
    var Base = TypedArray || {};
    var TAC = TypedArray && getPrototypeOf(TypedArray);
    var FORCED = !TypedArray || !$typed.ABV;
    var O = {};
    var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE];
    var getter = function getter(that, index) {
      var data = that._d;
      return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN);
    };
    var setter = function setter(that, index, value) {
      var data = that._d;
      if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff;
      data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN);
    };
    var addElement = function addElement(that, index) {
      dP(that, index, {
        get: function get() {
          return getter(this, index);
        },
        set: function set(value) {
          return setter(this, index, value);
        },
        enumerable: true
      });
    };
    if (FORCED) {
      TypedArray = wrapper(function (that, data, $offset, $length) {
        anInstance(that, TypedArray, NAME, '_d');
        var index = 0;
        var offset = 0;
        var buffer, byteLength, length, klass;
        if (!isObject(data)) {
          length = toIndex(data);
          byteLength = length * BYTES;
          buffer = new $ArrayBuffer(byteLength);
        } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) {
          buffer = data;
          offset = toOffset($offset, BYTES);
          var $len = data.byteLength;
          if ($length === undefined) {
            if ($len % BYTES) throw RangeError(WRONG_LENGTH);
            byteLength = $len - offset;
            if (byteLength < 0) throw RangeError(WRONG_LENGTH);
          } else {
            byteLength = toLength($length) * BYTES;
            if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH);
          }
          length = byteLength / BYTES;
        } else if (TYPED_ARRAY in data) {
          return fromList(TypedArray, data);
        } else {
          return $from.call(TypedArray, data);
        }
        hide(that, '_d', {
          b: buffer,
          o: offset,
          l: byteLength,
          e: length,
          v: new $DataView(buffer)
        });
        while (index < length) {
          addElement(that, index++);
        }
      });
      TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$);
      hide(TypedArrayPrototype, 'constructor', TypedArray);
    } else if (!fails(function () {
      TypedArray(1);
    }) || !fails(function () {
      new TypedArray(-1); // eslint-disable-line no-new
    }) || !$iterDetect(function (iter) {
      new TypedArray(); // eslint-disable-line no-new
      new TypedArray(null); // eslint-disable-line no-new
      new TypedArray(1.5); // eslint-disable-line no-new
      new TypedArray(iter); // eslint-disable-line no-new
    }, true)) {
      TypedArray = wrapper(function (that, data, $offset, $length) {
        anInstance(that, TypedArray, NAME);
        var klass;
        // `ws` module bug, temporarily remove validation length for Uint8Array
        // https://github.com/websockets/ws/pull/645
        if (!isObject(data)) return new Base(toIndex(data));
        if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) {
          return $length !== undefined ? new Base(data, toOffset($offset, BYTES), $length) : $offset !== undefined ? new Base(data, toOffset($offset, BYTES)) : new Base(data);
        }
        if (TYPED_ARRAY in data) return fromList(TypedArray, data);
        return $from.call(TypedArray, data);
      });
      arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) {
        if (!(key in TypedArray)) hide(TypedArray, key, Base[key]);
      });
      TypedArray[PROTOTYPE] = TypedArrayPrototype;
      if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray;
    }
    var $nativeIterator = TypedArrayPrototype[ITERATOR];
    var CORRECT_ITER_NAME = !!$nativeIterator && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined);
    var $iterator = $iterators.values;
    hide(TypedArray, TYPED_CONSTRUCTOR, true);
    hide(TypedArrayPrototype, TYPED_ARRAY, NAME);
    hide(TypedArrayPrototype, VIEW, true);
    hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray);

    if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) {
      dP(TypedArrayPrototype, TAG, {
        get: function get() {
          return NAME;
        }
      });
    }

    O[NAME] = TypedArray;

    $export($export.G + $export.W + $export.F * (TypedArray != Base), O);

    $export($export.S, NAME, {
      BYTES_PER_ELEMENT: BYTES
    });

    $export($export.S + $export.F * fails(function () {
      Base.of.call(TypedArray, 1);
    }), NAME, {
      from: $from,
      of: $of
    });

    if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES);

    $export($export.P, NAME, proto);

    setSpecies(NAME);

    $export($export.P + $export.F * FORCED_SET, NAME, { set: $set });

    $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators);

    if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString;

    $export($export.P + $export.F * fails(function () {
      new TypedArray(1).slice();
    }), NAME, { slice: $slice });

    $export($export.P + $export.F * (fails(function () {
      return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString();
    }) || !fails(function () {
      TypedArrayPrototype.toLocaleString.call([1, 2]);
    })), NAME, { toLocaleString: $toLocaleString });

    Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator;
    if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator);
  };
} else module.exports = function () {/* empty */};

/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var Map = __webpack_require__(162);
var $export = __webpack_require__(0);
var shared = __webpack_require__(77)('metadata');
var store = shared.store || (shared.store = new (__webpack_require__(165))());

var getOrCreateMetadataMap = function getOrCreateMetadataMap(target, targetKey, create) {
  var targetMetadata = store.get(target);
  if (!targetMetadata) {
    if (!create) return undefined;
    store.set(target, targetMetadata = new Map());
  }
  var keyMetadata = targetMetadata.get(targetKey);
  if (!keyMetadata) {
    if (!create) return undefined;
    targetMetadata.set(targetKey, keyMetadata = new Map());
  }return keyMetadata;
};
var ordinaryHasOwnMetadata = function ordinaryHasOwnMetadata(MetadataKey, O, P) {
  var metadataMap = getOrCreateMetadataMap(O, P, false);
  return metadataMap === undefined ? false : metadataMap.has(MetadataKey);
};
var ordinaryGetOwnMetadata = function ordinaryGetOwnMetadata(MetadataKey, O, P) {
  var metadataMap = getOrCreateMetadataMap(O, P, false);
  return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey);
};
var ordinaryDefineOwnMetadata = function ordinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
  getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue);
};
var ordinaryOwnMetadataKeys = function ordinaryOwnMetadataKeys(target, targetKey) {
  var metadataMap = getOrCreateMetadataMap(target, targetKey, false);
  var keys = [];
  if (metadataMap) metadataMap.forEach(function (_, key) {
    keys.push(key);
  });
  return keys;
};
var toMetaKey = function toMetaKey(it) {
  return it === undefined || (typeof it === 'undefined' ? 'undefined' : _typeof(it)) == 'symbol' ? it : String(it);
};
var exp = function exp(O) {
  $export($export.S, 'Reflect', O);
};

module.exports = {
  store: store,
  map: getOrCreateMetadataMap,
  has: ordinaryHasOwnMetadata,
  get: ordinaryGetOwnMetadata,
  set: ordinaryDefineOwnMetadata,
  keys: ordinaryOwnMetadataKeys,
  key: toMetaKey,
  exp: exp
};

/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
 * @license  MIT
 */
/* eslint-disable no-proto */



var base64 = __webpack_require__(423);
var ieee754 = __webpack_require__(424);
var isArray = __webpack_require__(177);

exports.Buffer = Buffer;
exports.SlowBuffer = SlowBuffer;
exports.INSPECT_MAX_BYTES = 50;

/**
 * If `Buffer.TYPED_ARRAY_SUPPORT`:
 *   === true    Use Uint8Array implementation (fastest)
 *   === false   Use Object implementation (most compatible, even IE6)
 *
 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
 * Opera 11.6+, iOS 4.2+.
 *
 * Due to various browser bugs, sometimes the Object implementation will be used even
 * when the browser supports typed arrays.
 *
 * Note:
 *
 *   - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
 *     See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
 *
 *   - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
 *
 *   - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
 *     incorrect length in some situations.

 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
 * get the Object implementation, which is slower but behaves correctly.
 */
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ? global.TYPED_ARRAY_SUPPORT : typedArraySupport();

/*
 * Export kMaxLength after typed array support is determined.
 */
exports.kMaxLength = kMaxLength();

function typedArraySupport() {
  try {
    var arr = new Uint8Array(1);
    arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function foo() {
        return 42;
      } };
    return arr.foo() === 42 && // typed array instances can be augmented
    typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
    arr.subarray(1, 1).byteLength === 0; // ie10 has broken `subarray`
  } catch (e) {
    return false;
  }
}

function kMaxLength() {
  return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff;
}

function createBuffer(that, length) {
  if (kMaxLength() < length) {
    throw new RangeError('Invalid typed array length');
  }
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    // Return an augmented `Uint8Array` instance, for best performance
    that = new Uint8Array(length);
    that.__proto__ = Buffer.prototype;
  } else {
    // Fallback: Return an object instance of the Buffer class
    if (that === null) {
      that = new Buffer(length);
    }
    that.length = length;
  }

  return that;
}

/**
 * The Buffer constructor returns instances of `Uint8Array` that have their
 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
 * returns a single octet.
 *
 * The `Uint8Array` prototype remains unmodified.
 */

function Buffer(arg, encodingOrOffset, length) {
  if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
    return new Buffer(arg, encodingOrOffset, length);
  }

  // Common case.
  if (typeof arg === 'number') {
    if (typeof encodingOrOffset === 'string') {
      throw new Error('If encoding is specified then the first argument must be a string');
    }
    return allocUnsafe(this, arg);
  }
  return from(this, arg, encodingOrOffset, length);
}

Buffer.poolSize = 8192; // not used by this implementation

// TODO: Legacy, not needed anymore. Remove in next major version.
Buffer._augment = function (arr) {
  arr.__proto__ = Buffer.prototype;
  return arr;
};

function from(that, value, encodingOrOffset, length) {
  if (typeof value === 'number') {
    throw new TypeError('"value" argument must not be a number');
  }

  if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
    return fromArrayBuffer(that, value, encodingOrOffset, length);
  }

  if (typeof value === 'string') {
    return fromString(that, value, encodingOrOffset);
  }

  return fromObject(that, value);
}

/**
 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
 * if value is a number.
 * Buffer.from(str[, encoding])
 * Buffer.from(array)
 * Buffer.from(buffer)
 * Buffer.from(arrayBuffer[, byteOffset[, length]])
 **/
Buffer.from = function (value, encodingOrOffset, length) {
  return from(null, value, encodingOrOffset, length);
};

if (Buffer.TYPED_ARRAY_SUPPORT) {
  Buffer.prototype.__proto__ = Uint8Array.prototype;
  Buffer.__proto__ = Uint8Array;
  if (typeof Symbol !== 'undefined' && Symbol.species && Buffer[Symbol.species] === Buffer) {
    // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
    Object.defineProperty(Buffer, Symbol.species, {
      value: null,
      configurable: true
    });
  }
}

function assertSize(size) {
  if (typeof size !== 'number') {
    throw new TypeError('"size" argument must be a number');
  } else if (size < 0) {
    throw new RangeError('"size" argument must not be negative');
  }
}

function alloc(that, size, fill, encoding) {
  assertSize(size);
  if (size <= 0) {
    return createBuffer(that, size);
  }
  if (fill !== undefined) {
    // Only pay attention to encoding if it's a string. This
    // prevents accidentally sending in a number that would
    // be interpretted as a start offset.
    return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);
  }
  return createBuffer(that, size);
}

/**
 * Creates a new filled Buffer instance.
 * alloc(size[, fill[, encoding]])
 **/
Buffer.alloc = function (size, fill, encoding) {
  return alloc(null, size, fill, encoding);
};

function allocUnsafe(that, size) {
  assertSize(size);
  that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
  if (!Buffer.TYPED_ARRAY_SUPPORT) {
    for (var i = 0; i < size; ++i) {
      that[i] = 0;
    }
  }
  return that;
}

/**
 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
 * */
Buffer.allocUnsafe = function (size) {
  return allocUnsafe(null, size);
};
/**
 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
 */
Buffer.allocUnsafeSlow = function (size) {
  return allocUnsafe(null, size);
};

function fromString(that, string, encoding) {
  if (typeof encoding !== 'string' || encoding === '') {
    encoding = 'utf8';
  }

  if (!Buffer.isEncoding(encoding)) {
    throw new TypeError('"encoding" must be a valid string encoding');
  }

  var length = byteLength(string, encoding) | 0;
  that = createBuffer(that, length);

  var actual = that.write(string, encoding);

  if (actual !== length) {
    // Writing a hex string, for example, that contains invalid characters will
    // cause everything after the first invalid character to be ignored. (e.g.
    // 'abxxcd' will be treated as 'ab')
    that = that.slice(0, actual);
  }

  return that;
}

function fromArrayLike(that, array) {
  var length = array.length < 0 ? 0 : checked(array.length) | 0;
  that = createBuffer(that, length);
  for (var i = 0; i < length; i += 1) {
    that[i] = array[i] & 255;
  }
  return that;
}

function fromArrayBuffer(that, array, byteOffset, length) {
  array.byteLength; // this throws if `array` is not a valid ArrayBuffer

  if (byteOffset < 0 || array.byteLength < byteOffset) {
    throw new RangeError('\'offset\' is out of bounds');
  }

  if (array.byteLength < byteOffset + (length || 0)) {
    throw new RangeError('\'length\' is out of bounds');
  }

  if (byteOffset === undefined && length === undefined) {
    array = new Uint8Array(array);
  } else if (length === undefined) {
    array = new Uint8Array(array, byteOffset);
  } else {
    array = new Uint8Array(array, byteOffset, length);
  }

  if (Buffer.TYPED_ARRAY_SUPPORT) {
    // Return an augmented `Uint8Array` instance, for best performance
    that = array;
    that.__proto__ = Buffer.prototype;
  } else {
    // Fallback: Return an object instance of the Buffer class
    that = fromArrayLike(that, array);
  }
  return that;
}

function fromObject(that, obj) {
  if (Buffer.isBuffer(obj)) {
    var len = checked(obj.length) | 0;
    that = createBuffer(that, len);

    if (that.length === 0) {
      return that;
    }

    obj.copy(that, 0, 0, len);
    return that;
  }

  if (obj) {
    if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) {
      if (typeof obj.length !== 'number' || isnan(obj.length)) {
        return createBuffer(that, 0);
      }
      return fromArrayLike(that, obj);
    }

    if (obj.type === 'Buffer' && isArray(obj.data)) {
      return fromArrayLike(that, obj.data);
    }
  }

  throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');
}

function checked(length) {
  // Note: cannot use `length < kMaxLength()` here because that fails when
  // length is NaN (which is otherwise coerced to zero.)
  if (length >= kMaxLength()) {
    throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes');
  }
  return length | 0;
}

function SlowBuffer(length) {
  if (+length != length) {
    // eslint-disable-line eqeqeq
    length = 0;
  }
  return Buffer.alloc(+length);
}

Buffer.isBuffer = function isBuffer(b) {
  return !!(b != null && b._isBuffer);
};

Buffer.compare = function compare(a, b) {
  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
    throw new TypeError('Arguments must be Buffers');
  }

  if (a === b) return 0;

  var x = a.length;
  var y = b.length;

  for (var i = 0, len = Math.min(x, y); i < len; ++i) {
    if (a[i] !== b[i]) {
      x = a[i];
      y = b[i];
      break;
    }
  }

  if (x < y) return -1;
  if (y < x) return 1;
  return 0;
};

Buffer.isEncoding = function isEncoding(encoding) {
  switch (String(encoding).toLowerCase()) {
    case 'hex':
    case 'utf8':
    case 'utf-8':
    case 'ascii':
    case 'latin1':
    case 'binary':
    case 'base64':
    case 'ucs2':
    case 'ucs-2':
    case 'utf16le':
    case 'utf-16le':
      return true;
    default:
      return false;
  }
};

Buffer.concat = function concat(list, length) {
  if (!isArray(list)) {
    throw new TypeError('"list" argument must be an Array of Buffers');
  }

  if (list.length === 0) {
    return Buffer.alloc(0);
  }

  var i;
  if (length === undefined) {
    length = 0;
    for (i = 0; i < list.length; ++i) {
      length += list[i].length;
    }
  }

  var buffer = Buffer.allocUnsafe(length);
  var pos = 0;
  for (i = 0; i < list.length; ++i) {
    var buf = list[i];
    if (!Buffer.isBuffer(buf)) {
      throw new TypeError('"list" argument must be an Array of Buffers');
    }
    buf.copy(buffer, pos);
    pos += buf.length;
  }
  return buffer;
};

function byteLength(string, encoding) {
  if (Buffer.isBuffer(string)) {
    return string.length;
  }
  if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
    return string.byteLength;
  }
  if (typeof string !== 'string') {
    string = '' + string;
  }

  var len = string.length;
  if (len === 0) return 0;

  // Use a for loop to avoid recursion
  var loweredCase = false;
  for (;;) {
    switch (encoding) {
      case 'ascii':
      case 'latin1':
      case 'binary':
        return len;
      case 'utf8':
      case 'utf-8':
      case undefined:
        return utf8ToBytes(string).length;
      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        return len * 2;
      case 'hex':
        return len >>> 1;
      case 'base64':
        return base64ToBytes(string).length;
      default:
        if (loweredCase) return utf8ToBytes(string).length; // assume utf8
        encoding = ('' + encoding).toLowerCase();
        loweredCase = true;
    }
  }
}
Buffer.byteLength = byteLength;

function slowToString(encoding, start, end) {
  var loweredCase = false;

  // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  // property of a typed array.

  // This behaves neither like String nor Uint8Array in that we set start/end
  // to their upper/lower bounds if the value passed is out of range.
  // undefined is handled specially as per ECMA-262 6th Edition,
  // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  if (start === undefined || start < 0) {
    start = 0;
  }
  // Return early if start > this.length. Done here to prevent potential uint32
  // coercion fail below.
  if (start > this.length) {
    return '';
  }

  if (end === undefined || end > this.length) {
    end = this.length;
  }

  if (end <= 0) {
    return '';
  }

  // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  end >>>= 0;
  start >>>= 0;

  if (end <= start) {
    return '';
  }

  if (!encoding) encoding = 'utf8';

  while (true) {
    switch (encoding) {
      case 'hex':
        return hexSlice(this, start, end);

      case 'utf8':
      case 'utf-8':
        return utf8Slice(this, start, end);

      case 'ascii':
        return asciiSlice(this, start, end);

      case 'latin1':
      case 'binary':
        return latin1Slice(this, start, end);

      case 'base64':
        return base64Slice(this, start, end);

      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        return utf16leSlice(this, start, end);

      default:
        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
        encoding = (encoding + '').toLowerCase();
        loweredCase = true;
    }
  }
}

// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
// Buffer instances.
Buffer.prototype._isBuffer = true;

function swap(b, n, m) {
  var i = b[n];
  b[n] = b[m];
  b[m] = i;
}

Buffer.prototype.swap16 = function swap16() {
  var len = this.length;
  if (len % 2 !== 0) {
    throw new RangeError('Buffer size must be a multiple of 16-bits');
  }
  for (var i = 0; i < len; i += 2) {
    swap(this, i, i + 1);
  }
  return this;
};

Buffer.prototype.swap32 = function swap32() {
  var len = this.length;
  if (len % 4 !== 0) {
    throw new RangeError('Buffer size must be a multiple of 32-bits');
  }
  for (var i = 0; i < len; i += 4) {
    swap(this, i, i + 3);
    swap(this, i + 1, i + 2);
  }
  return this;
};

Buffer.prototype.swap64 = function swap64() {
  var len = this.length;
  if (len % 8 !== 0) {
    throw new RangeError('Buffer size must be a multiple of 64-bits');
  }
  for (var i = 0; i < len; i += 8) {
    swap(this, i, i + 7);
    swap(this, i + 1, i + 6);
    swap(this, i + 2, i + 5);
    swap(this, i + 3, i + 4);
  }
  return this;
};

Buffer.prototype.toString = function toString() {
  var length = this.length | 0;
  if (length === 0) return '';
  if (arguments.length === 0) return utf8Slice(this, 0, length);
  return slowToString.apply(this, arguments);
};

Buffer.prototype.equals = function equals(b) {
  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer');
  if (this === b) return true;
  return Buffer.compare(this, b) === 0;
};

Buffer.prototype.inspect = function inspect() {
  var str = '';
  var max = exports.INSPECT_MAX_BYTES;
  if (this.length > 0) {
    str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
    if (this.length > max) str += ' ... ';
  }
  return '<Buffer ' + str + '>';
};

Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
  if (!Buffer.isBuffer(target)) {
    throw new TypeError('Argument must be a Buffer');
  }

  if (start === undefined) {
    start = 0;
  }
  if (end === undefined) {
    end = target ? target.length : 0;
  }
  if (thisStart === undefined) {
    thisStart = 0;
  }
  if (thisEnd === undefined) {
    thisEnd = this.length;
  }

  if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
    throw new RangeError('out of range index');
  }

  if (thisStart >= thisEnd && start >= end) {
    return 0;
  }
  if (thisStart >= thisEnd) {
    return -1;
  }
  if (start >= end) {
    return 1;
  }

  start >>>= 0;
  end >>>= 0;
  thisStart >>>= 0;
  thisEnd >>>= 0;

  if (this === target) return 0;

  var x = thisEnd - thisStart;
  var y = end - start;
  var len = Math.min(x, y);

  var thisCopy = this.slice(thisStart, thisEnd);
  var targetCopy = target.slice(start, end);

  for (var i = 0; i < len; ++i) {
    if (thisCopy[i] !== targetCopy[i]) {
      x = thisCopy[i];
      y = targetCopy[i];
      break;
    }
  }

  if (x < y) return -1;
  if (y < x) return 1;
  return 0;
};

// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
//
// Arguments:
// - buffer - a Buffer to search
// - val - a string, Buffer, or number
// - byteOffset - an index into `buffer`; will be clamped to an int32
// - encoding - an optional encoding, relevant is val is a string
// - dir - true for indexOf, false for lastIndexOf
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
  // Empty buffer means no match
  if (buffer.length === 0) return -1;

  // Normalize byteOffset
  if (typeof byteOffset === 'string') {
    encoding = byteOffset;
    byteOffset = 0;
  } else if (byteOffset > 0x7fffffff) {
    byteOffset = 0x7fffffff;
  } else if (byteOffset < -0x80000000) {
    byteOffset = -0x80000000;
  }
  byteOffset = +byteOffset; // Coerce to Number.
  if (isNaN(byteOffset)) {
    // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
    byteOffset = dir ? 0 : buffer.length - 1;
  }

  // Normalize byteOffset: negative offsets start from the end of the buffer
  if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
  if (byteOffset >= buffer.length) {
    if (dir) return -1;else byteOffset = buffer.length - 1;
  } else if (byteOffset < 0) {
    if (dir) byteOffset = 0;else return -1;
  }

  // Normalize val
  if (typeof val === 'string') {
    val = Buffer.from(val, encoding);
  }

  // Finally, search either indexOf (if dir is true) or lastIndexOf
  if (Buffer.isBuffer(val)) {
    // Special case: looking for empty string/buffer always fails
    if (val.length === 0) {
      return -1;
    }
    return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
  } else if (typeof val === 'number') {
    val = val & 0xFF; // Search for a byte value [0-255]
    if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') {
      if (dir) {
        return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
      } else {
        return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
      }
    }
    return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
  }

  throw new TypeError('val must be string, number or Buffer');
}

function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
  var indexSize = 1;
  var arrLength = arr.length;
  var valLength = val.length;

  if (encoding !== undefined) {
    encoding = String(encoding).toLowerCase();
    if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {
      if (arr.length < 2 || val.length < 2) {
        return -1;
      }
      indexSize = 2;
      arrLength /= 2;
      valLength /= 2;
      byteOffset /= 2;
    }
  }

  function read(buf, i) {
    if (indexSize === 1) {
      return buf[i];
    } else {
      return buf.readUInt16BE(i * indexSize);
    }
  }

  var i;
  if (dir) {
    var foundIndex = -1;
    for (i = byteOffset; i < arrLength; i++) {
      if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
        if (foundIndex === -1) foundIndex = i;
        if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
      } else {
        if (foundIndex !== -1) i -= i - foundIndex;
        foundIndex = -1;
      }
    }
  } else {
    if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
    for (i = byteOffset; i >= 0; i--) {
      var found = true;
      for (var j = 0; j < valLength; j++) {
        if (read(arr, i + j) !== read(val, j)) {
          found = false;
          break;
        }
      }
      if (found) return i;
    }
  }

  return -1;
}

Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
  return this.indexOf(val, byteOffset, encoding) !== -1;
};

Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
  return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
};

Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
  return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
};

function hexWrite(buf, string, offset, length) {
  offset = Number(offset) || 0;
  var remaining = buf.length - offset;
  if (!length) {
    length = remaining;
  } else {
    length = Number(length);
    if (length > remaining) {
      length = remaining;
    }
  }

  // must be an even number of digits
  var strLen = string.length;
  if (strLen % 2 !== 0) throw new TypeError('Invalid hex string');

  if (length > strLen / 2) {
    length = strLen / 2;
  }
  for (var i = 0; i < length; ++i) {
    var parsed = parseInt(string.substr(i * 2, 2), 16);
    if (isNaN(parsed)) return i;
    buf[offset + i] = parsed;
  }
  return i;
}

function utf8Write(buf, string, offset, length) {
  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
}

function asciiWrite(buf, string, offset, length) {
  return blitBuffer(asciiToBytes(string), buf, offset, length);
}

function latin1Write(buf, string, offset, length) {
  return asciiWrite(buf, string, offset, length);
}

function base64Write(buf, string, offset, length) {
  return blitBuffer(base64ToBytes(string), buf, offset, length);
}

function ucs2Write(buf, string, offset, length) {
  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
}

Buffer.prototype.write = function write(string, offset, length, encoding) {
  // Buffer#write(string)
  if (offset === undefined) {
    encoding = 'utf8';
    length = this.length;
    offset = 0;
    // Buffer#write(string, encoding)
  } else if (length === undefined && typeof offset === 'string') {
    encoding = offset;
    length = this.length;
    offset = 0;
    // Buffer#write(string, offset[, length][, encoding])
  } else if (isFinite(offset)) {
    offset = offset | 0;
    if (isFinite(length)) {
      length = length | 0;
      if (encoding === undefined) encoding = 'utf8';
    } else {
      encoding = length;
      length = undefined;
    }
    // legacy write(string, encoding, offset, length) - remove in v0.13
  } else {
    throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
  }

  var remaining = this.length - offset;
  if (length === undefined || length > remaining) length = remaining;

  if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
    throw new RangeError('Attempt to write outside buffer bounds');
  }

  if (!encoding) encoding = 'utf8';

  var loweredCase = false;
  for (;;) {
    switch (encoding) {
      case 'hex':
        return hexWrite(this, string, offset, length);

      case 'utf8':
      case 'utf-8':
        return utf8Write(this, string, offset, length);

      case 'ascii':
        return asciiWrite(this, string, offset, length);

      case 'latin1':
      case 'binary':
        return latin1Write(this, string, offset, length);

      case 'base64':
        // Warning: maxLength not taken into account in base64Write
        return base64Write(this, string, offset, length);

      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        return ucs2Write(this, string, offset, length);

      default:
        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
        encoding = ('' + encoding).toLowerCase();
        loweredCase = true;
    }
  }
};

Buffer.prototype.toJSON = function toJSON() {
  return {
    type: 'Buffer',
    data: Array.prototype.slice.call(this._arr || this, 0)
  };
};

function base64Slice(buf, start, end) {
  if (start === 0 && end === buf.length) {
    return base64.fromByteArray(buf);
  } else {
    return base64.fromByteArray(buf.slice(start, end));
  }
}

function utf8Slice(buf, start, end) {
  end = Math.min(buf.length, end);
  var res = [];

  var i = start;
  while (i < end) {
    var firstByte = buf[i];
    var codePoint = null;
    var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;

    if (i + bytesPerSequence <= end) {
      var secondByte, thirdByte, fourthByte, tempCodePoint;

      switch (bytesPerSequence) {
        case 1:
          if (firstByte < 0x80) {
            codePoint = firstByte;
          }
          break;
        case 2:
          secondByte = buf[i + 1];
          if ((secondByte & 0xC0) === 0x80) {
            tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;
            if (tempCodePoint > 0x7F) {
              codePoint = tempCodePoint;
            }
          }
          break;
        case 3:
          secondByte = buf[i + 1];
          thirdByte = buf[i + 2];
          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
            tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;
            if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
              codePoint = tempCodePoint;
            }
          }
          break;
        case 4:
          secondByte = buf[i + 1];
          thirdByte = buf[i + 2];
          fourthByte = buf[i + 3];
          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
            tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;
            if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
              codePoint = tempCodePoint;
            }
          }
      }
    }

    if (codePoint === null) {
      // we did not generate a valid codePoint so insert a
      // replacement char (U+FFFD) and advance only 1 byte
      codePoint = 0xFFFD;
      bytesPerSequence = 1;
    } else if (codePoint > 0xFFFF) {
      // encode to utf16 (surrogate pair dance)
      codePoint -= 0x10000;
      res.push(codePoint >>> 10 & 0x3FF | 0xD800);
      codePoint = 0xDC00 | codePoint & 0x3FF;
    }

    res.push(codePoint);
    i += bytesPerSequence;
  }

  return decodeCodePointsArray(res);
}

// Based on http://stackoverflow.com/a/22747272/680742, the browser with
// the lowest limit is Chrome, with 0x10000 args.
// We go 1 magnitude less, for safety
var MAX_ARGUMENTS_LENGTH = 0x1000;

function decodeCodePointsArray(codePoints) {
  var len = codePoints.length;
  if (len <= MAX_ARGUMENTS_LENGTH) {
    return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
  }

  // Decode in chunks to avoid "call stack size exceeded".
  var res = '';
  var i = 0;
  while (i < len) {
    res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
  }
  return res;
}

function asciiSlice(buf, start, end) {
  var ret = '';
  end = Math.min(buf.length, end);

  for (var i = start; i < end; ++i) {
    ret += String.fromCharCode(buf[i] & 0x7F);
  }
  return ret;
}

function latin1Slice(buf, start, end) {
  var ret = '';
  end = Math.min(buf.length, end);

  for (var i = start; i < end; ++i) {
    ret += String.fromCharCode(buf[i]);
  }
  return ret;
}

function hexSlice(buf, start, end) {
  var len = buf.length;

  if (!start || start < 0) start = 0;
  if (!end || end < 0 || end > len) end = len;

  var out = '';
  for (var i = start; i < end; ++i) {
    out += toHex(buf[i]);
  }
  return out;
}

function utf16leSlice(buf, start, end) {
  var bytes = buf.slice(start, end);
  var res = '';
  for (var i = 0; i < bytes.length; i += 2) {
    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
  }
  return res;
}

Buffer.prototype.slice = function slice(start, end) {
  var len = this.length;
  start = ~~start;
  end = end === undefined ? len : ~~end;

  if (start < 0) {
    start += len;
    if (start < 0) start = 0;
  } else if (start > len) {
    start = len;
  }

  if (end < 0) {
    end += len;
    if (end < 0) end = 0;
  } else if (end > len) {
    end = len;
  }

  if (end < start) end = start;

  var newBuf;
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    newBuf = this.subarray(start, end);
    newBuf.__proto__ = Buffer.prototype;
  } else {
    var sliceLen = end - start;
    newBuf = new Buffer(sliceLen, undefined);
    for (var i = 0; i < sliceLen; ++i) {
      newBuf[i] = this[i + start];
    }
  }

  return newBuf;
};

/*
 * Need to make sure that buffer isn't trying to write out of bounds.
 */
function checkOffset(offset, ext, length) {
  if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');
  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');
}

Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
  offset = offset | 0;
  byteLength = byteLength | 0;
  if (!noAssert) checkOffset(offset, byteLength, this.length);

  var val = this[offset];
  var mul = 1;
  var i = 0;
  while (++i < byteLength && (mul *= 0x100)) {
    val += this[offset + i] * mul;
  }

  return val;
};

Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
  offset = offset | 0;
  byteLength = byteLength | 0;
  if (!noAssert) {
    checkOffset(offset, byteLength, this.length);
  }

  var val = this[offset + --byteLength];
  var mul = 1;
  while (byteLength > 0 && (mul *= 0x100)) {
    val += this[offset + --byteLength] * mul;
  }

  return val;
};

Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 1, this.length);
  return this[offset];
};

Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 2, this.length);
  return this[offset] | this[offset + 1] << 8;
};

Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 2, this.length);
  return this[offset] << 8 | this[offset + 1];
};

Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length);

  return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;
};

Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length);

  return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
};

Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
  offset = offset | 0;
  byteLength = byteLength | 0;
  if (!noAssert) checkOffset(offset, byteLength, this.length);

  var val = this[offset];
  var mul = 1;
  var i = 0;
  while (++i < byteLength && (mul *= 0x100)) {
    val += this[offset + i] * mul;
  }
  mul *= 0x80;

  if (val >= mul) val -= Math.pow(2, 8 * byteLength);

  return val;
};

Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
  offset = offset | 0;
  byteLength = byteLength | 0;
  if (!noAssert) checkOffset(offset, byteLength, this.length);

  var i = byteLength;
  var mul = 1;
  var val = this[offset + --i];
  while (i > 0 && (mul *= 0x100)) {
    val += this[offset + --i] * mul;
  }
  mul *= 0x80;

  if (val >= mul) val -= Math.pow(2, 8 * byteLength);

  return val;
};

Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 1, this.length);
  if (!(this[offset] & 0x80)) return this[offset];
  return (0xff - this[offset] + 1) * -1;
};

Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 2, this.length);
  var val = this[offset] | this[offset + 1] << 8;
  return val & 0x8000 ? val | 0xFFFF0000 : val;
};

Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 2, this.length);
  var val = this[offset + 1] | this[offset] << 8;
  return val & 0x8000 ? val | 0xFFFF0000 : val;
};

Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length);

  return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
};

Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length);

  return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
};

Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length);
  return ieee754.read(this, offset, true, 23, 4);
};

Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length);
  return ieee754.read(this, offset, false, 23, 4);
};

Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 8, this.length);
  return ieee754.read(this, offset, true, 52, 8);
};

Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
  if (!noAssert) checkOffset(offset, 8, this.length);
  return ieee754.read(this, offset, false, 52, 8);
};

function checkInt(buf, value, offset, ext, max, min) {
  if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
  if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
  if (offset + ext > buf.length) throw new RangeError('Index out of range');
}

Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
  value = +value;
  offset = offset | 0;
  byteLength = byteLength | 0;
  if (!noAssert) {
    var maxBytes = Math.pow(2, 8 * byteLength) - 1;
    checkInt(this, value, offset, byteLength, maxBytes, 0);
  }

  var mul = 1;
  var i = 0;
  this[offset] = value & 0xFF;
  while (++i < byteLength && (mul *= 0x100)) {
    this[offset + i] = value / mul & 0xFF;
  }

  return offset + byteLength;
};

Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
  value = +value;
  offset = offset | 0;
  byteLength = byteLength | 0;
  if (!noAssert) {
    var maxBytes = Math.pow(2, 8 * byteLength) - 1;
    checkInt(this, value, offset, byteLength, maxBytes, 0);
  }

  var i = byteLength - 1;
  var mul = 1;
  this[offset + i] = value & 0xFF;
  while (--i >= 0 && (mul *= 0x100)) {
    this[offset + i] = value / mul & 0xFF;
  }

  return offset + byteLength;
};

Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
  value = +value;
  offset = offset | 0;
  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
  this[offset] = value & 0xff;
  return offset + 1;
};

function objectWriteUInt16(buf, value, offset, littleEndian) {
  if (value < 0) value = 0xffff + value + 1;
  for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
    buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;
  }
}

Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
  value = +value;
  offset = offset | 0;
  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = value & 0xff;
    this[offset + 1] = value >>> 8;
  } else {
    objectWriteUInt16(this, value, offset, true);
  }
  return offset + 2;
};

Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
  value = +value;
  offset = offset | 0;
  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = value >>> 8;
    this[offset + 1] = value & 0xff;
  } else {
    objectWriteUInt16(this, value, offset, false);
  }
  return offset + 2;
};

function objectWriteUInt32(buf, value, offset, littleEndian) {
  if (value < 0) value = 0xffffffff + value + 1;
  for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
    buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff;
  }
}

Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
  value = +value;
  offset = offset | 0;
  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset + 3] = value >>> 24;
    this[offset + 2] = value >>> 16;
    this[offset + 1] = value >>> 8;
    this[offset] = value & 0xff;
  } else {
    objectWriteUInt32(this, value, offset, true);
  }
  return offset + 4;
};

Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
  value = +value;
  offset = offset | 0;
  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = value >>> 24;
    this[offset + 1] = value >>> 16;
    this[offset + 2] = value >>> 8;
    this[offset + 3] = value & 0xff;
  } else {
    objectWriteUInt32(this, value, offset, false);
  }
  return offset + 4;
};

Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
  value = +value;
  offset = offset | 0;
  if (!noAssert) {
    var limit = Math.pow(2, 8 * byteLength - 1);

    checkInt(this, value, offset, byteLength, limit - 1, -limit);
  }

  var i = 0;
  var mul = 1;
  var sub = 0;
  this[offset] = value & 0xFF;
  while (++i < byteLength && (mul *= 0x100)) {
    if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
      sub = 1;
    }
    this[offset + i] = (value / mul >> 0) - sub & 0xFF;
  }

  return offset + byteLength;
};

Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
  value = +value;
  offset = offset | 0;
  if (!noAssert) {
    var limit = Math.pow(2, 8 * byteLength - 1);

    checkInt(this, value, offset, byteLength, limit - 1, -limit);
  }

  var i = byteLength - 1;
  var mul = 1;
  var sub = 0;
  this[offset + i] = value & 0xFF;
  while (--i >= 0 && (mul *= 0x100)) {
    if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
      sub = 1;
    }
    this[offset + i] = (value / mul >> 0) - sub & 0xFF;
  }

  return offset + byteLength;
};

Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
  value = +value;
  offset = offset | 0;
  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
  if (value < 0) value = 0xff + value + 1;
  this[offset] = value & 0xff;
  return offset + 1;
};

Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
  value = +value;
  offset = offset | 0;
  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = value & 0xff;
    this[offset + 1] = value >>> 8;
  } else {
    objectWriteUInt16(this, value, offset, true);
  }
  return offset + 2;
};

Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
  value = +value;
  offset = offset | 0;
  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = value >>> 8;
    this[offset + 1] = value & 0xff;
  } else {
    objectWriteUInt16(this, value, offset, false);
  }
  return offset + 2;
};

Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
  value = +value;
  offset = offset | 0;
  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = value & 0xff;
    this[offset + 1] = value >>> 8;
    this[offset + 2] = value >>> 16;
    this[offset + 3] = value >>> 24;
  } else {
    objectWriteUInt32(this, value, offset, true);
  }
  return offset + 4;
};

Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
  value = +value;
  offset = offset | 0;
  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
  if (value < 0) value = 0xffffffff + value + 1;
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = value >>> 24;
    this[offset + 1] = value >>> 16;
    this[offset + 2] = value >>> 8;
    this[offset + 3] = value & 0xff;
  } else {
    objectWriteUInt32(this, value, offset, false);
  }
  return offset + 4;
};

function checkIEEE754(buf, value, offset, ext, max, min) {
  if (offset + ext > buf.length) throw new RangeError('Index out of range');
  if (offset < 0) throw new RangeError('Index out of range');
}

function writeFloat(buf, value, offset, littleEndian, noAssert) {
  if (!noAssert) {
    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38);
  }
  ieee754.write(buf, value, offset, littleEndian, 23, 4);
  return offset + 4;
}

Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
  return writeFloat(this, value, offset, true, noAssert);
};

Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
  return writeFloat(this, value, offset, false, noAssert);
};

function writeDouble(buf, value, offset, littleEndian, noAssert) {
  if (!noAssert) {
    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308);
  }
  ieee754.write(buf, value, offset, littleEndian, 52, 8);
  return offset + 8;
}

Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
  return writeDouble(this, value, offset, true, noAssert);
};

Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
  return writeDouble(this, value, offset, false, noAssert);
};

// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
Buffer.prototype.copy = function copy(target, targetStart, start, end) {
  if (!start) start = 0;
  if (!end && end !== 0) end = this.length;
  if (targetStart >= target.length) targetStart = target.length;
  if (!targetStart) targetStart = 0;
  if (end > 0 && end < start) end = start;

  // Copy 0 bytes; we're done
  if (end === start) return 0;
  if (target.length === 0 || this.length === 0) return 0;

  // Fatal error conditions
  if (targetStart < 0) {
    throw new RangeError('targetStart out of bounds');
  }
  if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds');
  if (end < 0) throw new RangeError('sourceEnd out of bounds');

  // Are we oob?
  if (end > this.length) end = this.length;
  if (target.length - targetStart < end - start) {
    end = target.length - targetStart + start;
  }

  var len = end - start;
  var i;

  if (this === target && start < targetStart && targetStart < end) {
    // descending copy from end
    for (i = len - 1; i >= 0; --i) {
      target[i + targetStart] = this[i + start];
    }
  } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
    // ascending copy from start
    for (i = 0; i < len; ++i) {
      target[i + targetStart] = this[i + start];
    }
  } else {
    Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
  }

  return len;
};

// Usage:
//    buffer.fill(number[, offset[, end]])
//    buffer.fill(buffer[, offset[, end]])
//    buffer.fill(string[, offset[, end]][, encoding])
Buffer.prototype.fill = function fill(val, start, end, encoding) {
  // Handle string cases:
  if (typeof val === 'string') {
    if (typeof start === 'string') {
      encoding = start;
      start = 0;
      end = this.length;
    } else if (typeof end === 'string') {
      encoding = end;
      end = this.length;
    }
    if (val.length === 1) {
      var code = val.charCodeAt(0);
      if (code < 256) {
        val = code;
      }
    }
    if (encoding !== undefined && typeof encoding !== 'string') {
      throw new TypeError('encoding must be a string');
    }
    if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
      throw new TypeError('Unknown encoding: ' + encoding);
    }
  } else if (typeof val === 'number') {
    val = val & 255;
  }

  // Invalid ranges are not set to a default, so can range check early.
  if (start < 0 || this.length < start || this.length < end) {
    throw new RangeError('Out of range index');
  }

  if (end <= start) {
    return this;
  }

  start = start >>> 0;
  end = end === undefined ? this.length : end >>> 0;

  if (!val) val = 0;

  var i;
  if (typeof val === 'number') {
    for (i = start; i < end; ++i) {
      this[i] = val;
    }
  } else {
    var bytes = Buffer.isBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString());
    var len = bytes.length;
    for (i = 0; i < end - start; ++i) {
      this[i + start] = bytes[i % len];
    }
  }

  return this;
};

// HELPER FUNCTIONS
// ================

var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;

function base64clean(str) {
  // Node strips out invalid characters like \n and \t from the string, base64-js does not
  str = stringtrim(str).replace(INVALID_BASE64_RE, '');
  // Node converts strings with length < 2 to ''
  if (str.length < 2) return '';
  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  while (str.length % 4 !== 0) {
    str = str + '=';
  }
  return str;
}

function stringtrim(str) {
  if (str.trim) return str.trim();
  return str.replace(/^\s+|\s+$/g, '');
}

function toHex(n) {
  if (n < 16) return '0' + n.toString(16);
  return n.toString(16);
}

function utf8ToBytes(string, units) {
  units = units || Infinity;
  var codePoint;
  var length = string.length;
  var leadSurrogate = null;
  var bytes = [];

  for (var i = 0; i < length; ++i) {
    codePoint = string.charCodeAt(i);

    // is surrogate component
    if (codePoint > 0xD7FF && codePoint < 0xE000) {
      // last char was a lead
      if (!leadSurrogate) {
        // no lead yet
        if (codePoint > 0xDBFF) {
          // unexpected trail
          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
          continue;
        } else if (i + 1 === length) {
          // unpaired lead
          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
          continue;
        }

        // valid lead
        leadSurrogate = codePoint;

        continue;
      }

      // 2 leads in a row
      if (codePoint < 0xDC00) {
        if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
        leadSurrogate = codePoint;
        continue;
      }

      // valid surrogate pair
      codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
    } else if (leadSurrogate) {
      // valid bmp char, but last char was a lead
      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
    }

    leadSurrogate = null;

    // encode utf8
    if (codePoint < 0x80) {
      if ((units -= 1) < 0) break;
      bytes.push(codePoint);
    } else if (codePoint < 0x800) {
      if ((units -= 2) < 0) break;
      bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);
    } else if (codePoint < 0x10000) {
      if ((units -= 3) < 0) break;
      bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
    } else if (codePoint < 0x110000) {
      if ((units -= 4) < 0) break;
      bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
    } else {
      throw new Error('Invalid code point');
    }
  }

  return bytes;
}

function asciiToBytes(str) {
  var byteArray = [];
  for (var i = 0; i < str.length; ++i) {
    // Node's code seems to be doing this and not & 0x7F..
    byteArray.push(str.charCodeAt(i) & 0xFF);
  }
  return byteArray;
}

function utf16leToBytes(str, units) {
  var c, hi, lo;
  var byteArray = [];
  for (var i = 0; i < str.length; ++i) {
    if ((units -= 2) < 0) break;

    c = str.charCodeAt(i);
    hi = c >> 8;
    lo = c % 256;
    byteArray.push(lo);
    byteArray.push(hi);
  }

  return byteArray;
}

function base64ToBytes(str) {
  return base64.toByteArray(base64clean(str));
}

function blitBuffer(src, dst, offset, length) {
  for (var i = 0; i < length; ++i) {
    if (i + offset >= dst.length || i >= src.length) break;
    dst[i + offset] = src[i];
  }
  return i;
}

function isnan(val) {
  return val !== val; // eslint-disable-line no-self-compare
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(43)))

/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var META = __webpack_require__(45)('meta');
var isObject = __webpack_require__(7);
var has = __webpack_require__(16);
var setDesc = __webpack_require__(11).f;
var id = 0;
var isExtensible = Object.isExtensible || function () {
  return true;
};
var FREEZE = !__webpack_require__(6)(function () {
  return isExtensible(Object.preventExtensions({}));
});
var setMeta = function setMeta(it) {
  setDesc(it, META, { value: {
      i: 'O' + ++id, // object ID
      w: {} // weak collections IDs
    } });
};
var fastKey = function fastKey(it, create) {
  // return primitive with prefix
  if (!isObject(it)) return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  if (!has(it, META)) {
    // can't set metadata to uncaught frozen object
    if (!isExtensible(it)) return 'F';
    // not necessary to add metadata
    if (!create) return 'E';
    // add missing metadata
    setMeta(it);
    // return object ID
  }return it[META].i;
};
var getWeak = function getWeak(it, create) {
  if (!has(it, META)) {
    // can't set metadata to uncaught frozen object
    if (!isExtensible(it)) return true;
    // not necessary to add metadata
    if (!create) return false;
    // add missing metadata
    setMeta(it);
    // return hash weak collections IDs
  }return it[META].w;
};
// add metadata on freeze-family methods calling
var onFreeze = function onFreeze(it) {
  if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
  return it;
};
var meta = module.exports = {
  KEY: META,
  NEED: false,
  fastKey: fastKey,
  getWeak: getWeak,
  onFreeze: onFreeze
};

/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 22.1.3.31 Array.prototype[@@unscopables]
var UNSCOPABLES = __webpack_require__(8)('unscopables');
var ArrayProto = Array.prototype;
if (ArrayProto[UNSCOPABLES] == undefined) __webpack_require__(17)(ArrayProto, UNSCOPABLES, {});
module.exports = function (key) {
  ArrayProto[UNSCOPABLES][key] = true;
};

/***/ }),
/* 41 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {

exports.base64 = true;
exports.array = true;
exports.string = true;
exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined";
exports.nodebuffer = typeof Buffer !== "undefined";
// contains true if JSZip can read/generate Uint8Array, false otherwise.
exports.uint8array = typeof Uint8Array !== "undefined";

if (typeof ArrayBuffer === "undefined") {
    exports.blob = false;
} else {
    var buffer = new ArrayBuffer(0);
    try {
        exports.blob = new Blob([buffer], {
            type: "application/zip"
        }).size === 0;
    } catch (e) {
        try {
            var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder;
            var builder = new Builder();
            builder.append(buffer);
            exports.blob = builder.getBlob('application/zip').size === 0;
        } catch (e) {
            exports.blob = false;
        }
    }
}

try {
    exports.nodestream = !!__webpack_require__(178).Readable;
} catch (e) {
    exports.nodestream = false;
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(38).Buffer))

/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var TYPED_OK = typeof Uint8Array !== 'undefined' && typeof Uint16Array !== 'undefined' && typeof Int32Array !== 'undefined';

function _has(obj, key) {
  return Object.prototype.hasOwnProperty.call(obj, key);
}

exports.assign = function (obj /*from1, from2, from3, ...*/) {
  var sources = Array.prototype.slice.call(arguments, 1);
  while (sources.length) {
    var source = sources.shift();
    if (!source) {
      continue;
    }

    if ((typeof source === 'undefined' ? 'undefined' : _typeof(source)) !== 'object') {
      throw new TypeError(source + 'must be non-object');
    }

    for (var p in source) {
      if (_has(source, p)) {
        obj[p] = source[p];
      }
    }
  }

  return obj;
};

// reduce buffer size, avoiding mem copy
exports.shrinkBuf = function (buf, size) {
  if (buf.length === size) {
    return buf;
  }
  if (buf.subarray) {
    return buf.subarray(0, size);
  }
  buf.length = size;
  return buf;
};

var fnTyped = {
  arraySet: function arraySet(dest, src, src_offs, len, dest_offs) {
    if (src.subarray && dest.subarray) {
      dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
      return;
    }
    // Fallback to ordinary array
    for (var i = 0; i < len; i++) {
      dest[dest_offs + i] = src[src_offs + i];
    }
  },
  // Join array of chunks to single array.
  flattenChunks: function flattenChunks(chunks) {
    var i, l, len, pos, chunk, result;

    // calculate data length
    len = 0;
    for (i = 0, l = chunks.length; i < l; i++) {
      len += chunks[i].length;
    }

    // join chunks
    result = new Uint8Array(len);
    pos = 0;
    for (i = 0, l = chunks.length; i < l; i++) {
      chunk = chunks[i];
      result.set(chunk, pos);
      pos += chunk.length;
    }

    return result;
  }
};

var fnUntyped = {
  arraySet: function arraySet(dest, src, src_offs, len, dest_offs) {
    for (var i = 0; i < len; i++) {
      dest[dest_offs + i] = src[src_offs + i];
    }
  },
  // Join array of chunks to single array.
  flattenChunks: function flattenChunks(chunks) {
    return [].concat.apply([], chunks);
  }
};

// Enable/Disable typed arrays use, for testing
//
exports.setTyped = function (on) {
  if (on) {
    exports.Buf8 = Uint8Array;
    exports.Buf16 = Uint16Array;
    exports.Buf32 = Int32Array;
    exports.assign(exports, fnTyped);
  } else {
    exports.Buf8 = Array;
    exports.Buf16 = Array;
    exports.Buf32 = Array;
    exports.assign(exports, fnUntyped);
  }
};

exports.setTyped(TYPED_OK);

/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var g;

// This works in non-strict mode
g = function () {
	return this;
}();

try {
	// This works if eval is allowed (see CSP)
	g = g || Function("return this")() || (1, eval)("this");
} catch (e) {
	// This works if the window reference is available
	if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
}

// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}

module.exports = g;

/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = function (bitmap, value) {
  return {
    enumerable: !(bitmap & 1),
    configurable: !(bitmap & 2),
    writable: !(bitmap & 4),
    value: value
  };
};

/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var id = 0;
var px = Math.random();
module.exports = function (key) {
  return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};

/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = false;

/***/ }),
/* 47 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = __webpack_require__(143);
var enumBugKeys = __webpack_require__(103);

module.exports = Object.keys || function keys(O) {
  return $keys(O, enumBugKeys);
};

/***/ }),
/* 48 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var toInteger = __webpack_require__(31);
var max = Math.max;
var min = Math.min;
module.exports = function (index, length) {
  index = toInteger(index);
  return index < 0 ? max(index + length, 0) : min(index, length);
};

/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = __webpack_require__(4);
var dPs = __webpack_require__(144);
var enumBugKeys = __webpack_require__(103);
var IE_PROTO = __webpack_require__(102)('IE_PROTO');
var Empty = function Empty() {/* empty */};
var PROTOTYPE = 'prototype';

// Create object with fake `null` prototype: use iframe Object with cleared prototype
var _createDict = function createDict() {
  // Thrash, waste and sodomy: IE GC bug
  var iframe = __webpack_require__(100)('iframe');
  var i = enumBugKeys.length;
  var lt = '<';
  var gt = '>';
  var iframeDocument;
  iframe.style.display = 'none';
  __webpack_require__(104).appendChild(iframe);
  iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  // createDict = iframe.contentWindow.Object;
  // html.removeChild(iframe);
  iframeDocument = iframe.contentWindow.document;
  iframeDocument.open();
  iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  iframeDocument.close();
  _createDict = iframeDocument.F;
  while (i--) {
    delete _createDict[PROTOTYPE][enumBugKeys[i]];
  }return _createDict();
};

module.exports = Object.create || function create(O, Properties) {
  var result;
  if (O !== null) {
    Empty[PROTOTYPE] = anObject(O);
    result = new Empty();
    Empty[PROTOTYPE] = null;
    // add "__proto__" for Object.getPrototypeOf polyfill
    result[IE_PROTO] = O;
  } else result = _createDict();
  return Properties === undefined ? result : dPs(result, Properties);
};

/***/ }),
/* 50 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var $keys = __webpack_require__(143);
var hiddenKeys = __webpack_require__(103).concat('length', 'prototype');

exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  return $keys(O, hiddenKeys);
};

/***/ }),
/* 51 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var global = __webpack_require__(5);
var dP = __webpack_require__(11);
var DESCRIPTORS = __webpack_require__(10);
var SPECIES = __webpack_require__(8)('species');

module.exports = function (KEY) {
  var C = global[KEY];
  if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
    configurable: true,
    get: function get() {
      return this;
    }
  });
};

/***/ }),
/* 52 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = function (it, Constructor, name, forbiddenField) {
  if (!(it instanceof Constructor) || forbiddenField !== undefined && forbiddenField in it) {
    throw TypeError(name + ': incorrect invocation!');
  }return it;
};

/***/ }),
/* 53 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var ctx = __webpack_require__(25);
var call = __webpack_require__(155);
var isArrayIter = __webpack_require__(116);
var anObject = __webpack_require__(4);
var toLength = __webpack_require__(12);
var getIterFn = __webpack_require__(118);
var BREAK = {};
var RETURN = {};
var _exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
  var iterFn = ITERATOR ? function () {
    return iterable;
  } : getIterFn(iterable);
  var f = ctx(fn, that, entries ? 2 : 1);
  var index = 0;
  var length, step, iterator, result;
  if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
  // fast case for arrays with default iterator
  if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
    result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
    if (result === BREAK || result === RETURN) return result;
  } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
    result = call(iterator, f, step.value, entries);
    if (result === BREAK || result === RETURN) return result;
  }
};
_exports.BREAK = BREAK;
_exports.RETURN = RETURN;

/***/ }),
/* 54 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var redefine = __webpack_require__(18);
module.exports = function (target, src, safe) {
  for (var key in src) {
    redefine(target, key, src[key], safe);
  }return target;
};

/***/ }),
/* 55 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// a duplex stream is just a stream that is both readable and writable.
// Since JS doesn't have multiple prototypal inheritance, this class
// prototypally inherits from Readable, and then parasitically from
// Writable.



/*<replacement>*/

var objectKeys = Object.keys || function (obj) {
  var keys = [];
  for (var key in obj) {
    keys.push(key);
  }return keys;
};
/*</replacement>*/

module.exports = Duplex;

/*<replacement>*/
var processNextTick = __webpack_require__(127);
/*</replacement>*/

/*<replacement>*/
var util = __webpack_require__(70);
util.inherits = __webpack_require__(64);
/*</replacement>*/

var Readable = __webpack_require__(179);
var Writable = __webpack_require__(128);

util.inherits(Duplex, Readable);

var keys = objectKeys(Writable.prototype);
for (var v = 0; v < keys.length; v++) {
  var method = keys[v];
  if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
}

function Duplex(options) {
  if (!(this instanceof Duplex)) return new Duplex(options);

  Readable.call(this, options);
  Writable.call(this, options);

  if (options && options.readable === false) this.readable = false;

  if (options && options.writable === false) this.writable = false;

  this.allowHalfOpen = true;
  if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;

  this.once('end', onend);
}

// the no-half-open enforcer
function onend() {
  // if we allow half-open state, or if the writable side ended,
  // then we're ok.
  if (this.allowHalfOpen || this._writableState.ended) return;

  // no more data can be written.
  // But allow more writes to happen in this tick.
  processNextTick(onEndNT, this);
}

function onEndNT(self) {
  self.end();
}

function forEach(xs, f) {
  for (var i = 0, l = xs.length; i < l; i++) {
    f(xs[i], i);
  }
}

/***/ }),
/* 56 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
var _extends = Object.assign || function (target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i];for (var key in source) {
      if (Object.prototype.hasOwnProperty.call(source, key)) {
        target[key] = source[key];
      }
    }
  }return target;
};

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

function _toConsumableArray(arr) {
  if (Array.isArray(arr)) {
    for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
      arr2[i] = arr[i];
    }return arr2;
  } else {
    return Array.from(arr);
  }
}

var consoleLogger = {
  type: 'logger',

  log: function log(args) {
    this.output('log', args);
  },
  warn: function warn(args) {
    this.output('warn', args);
  },
  error: function error(args) {
    this.output('error', args);
  },
  output: function output(type, args) {
    var _console;

    /* eslint no-console: 0 */
    if (console && console[type]) (_console = console)[type].apply(_console, _toConsumableArray(args));
  }
};

var Logger = function () {
  function Logger(concreteLogger) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    _classCallCheck(this, Logger);

    this.init(concreteLogger, options);
  }

  Logger.prototype.init = function init(concreteLogger) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    this.prefix = options.prefix || 'i18next:';
    this.logger = concreteLogger || consoleLogger;
    this.options = options;
    this.debug = options.debug;
  };

  Logger.prototype.setDebug = function setDebug(bool) {
    this.debug = bool;
  };

  Logger.prototype.log = function log() {
    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    return this.forward(args, 'log', '', true);
  };

  Logger.prototype.warn = function warn() {
    for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
      args[_key2] = arguments[_key2];
    }

    return this.forward(args, 'warn', '', true);
  };

  Logger.prototype.error = function error() {
    for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
      args[_key3] = arguments[_key3];
    }

    return this.forward(args, 'error', '');
  };

  Logger.prototype.deprecate = function deprecate() {
    for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
      args[_key4] = arguments[_key4];
    }

    return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
  };

  Logger.prototype.forward = function forward(args, lvl, prefix, debugOnly) {
    if (debugOnly && !this.debug) return null;
    if (typeof args[0] === 'string') args[0] = '' + prefix + this.prefix + ' ' + args[0];
    return this.logger[lvl](args);
  };

  Logger.prototype.create = function create(moduleName) {
    return new Logger(this.logger, _extends({ prefix: this.prefix + ':' + moduleName + ':' }, this.options));
  };

  return Logger;
}();

exports.default = new Logger();

/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : boxes/BoxBase.js
 *  Created : 12/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2016 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Utils, AWT) {

  var defaultValues = Utils.settings.BoxBase;

  /**
   * This class contains all the main visual attributes needed to draw {@link AbstractBox} objects:
   * background and foreground colors, gradients, colors for special states (inactive, alternative,
   * disabled...), margins, fonts, border strokes, etc.
   *
   * Objects derived from {@link AbstractBox} can have inheritance: boxes that act as "containers"
   * of other boxes (like {@link BoxBag}). Most of the attributes of `BoxBase` can be `null`,
   * meaning that the value of the ancestor -or the default value if the box has no ancestors- must
   * be used.
   * @exports BoxBase
   * @class
   */

  var BoxBase = function () {
    /**
     * BoxBase constructor
     * @param {BoxBase=} parent - Another BoxBase object used to determine the value of properties not
     * locally set.
     */
    function BoxBase(parent) {
      _classCallCheck(this, BoxBase);

      this.parent = parent || null;
    }

    /**
     * Loads the BoxBase settings from a specific JQuery XML element
     * @param {external:jQuery} $xml - The XML element to parse
     */


    _createClass(BoxBase, [{
      key: "setProperties",
      value: function setProperties($xml) {
        var _this = this;

        //
        // Read attributes
        Utils.attrForEach($xml.get(0).attributes, function (name, val) {
          switch (name) {
            case 'shadow':
            case 'transparent':
              _this[name] = Utils.getBoolean(val, false);
              break;
            case 'margin':
              _this[name] = Number(val);
              break;
            case 'borderStroke':
              _this.borderStroke = new AWT.Stroke(Number(val));
              break;
            case 'markerStroke':
              _this.markerStroke = new AWT.Stroke(Number(val));
              break;
          }
        });
        //
        // Read inner elements
        $xml.children().each(function (_n, child) {
          var $node = $(child);
          switch (child.nodeName) {
            case 'font':
              _this.font = new AWT.Font().setProperties($node);
              break;

            case 'gradient':
              _this.bgGradient = new AWT.Gradient().setProperties($node);
              break;

            case 'color':
              _this.textColor = Utils.checkColor($node.attr('foreground'), _this.textColor);
              _this.backColor = Utils.checkColor($node.attr('background'), _this.backColor);
              _this.shadowColor = Utils.checkColor($node.attr('shadow'), _this.shadowColor);
              _this.inactiveColor = Utils.checkColor($node.attr('inactive'), _this.inactiveColor);
              _this.alternativeColor = Utils.checkColor($node.attr('alternative'), _this.alternativeColor);
              _this.borderColor = Utils.checkColor($node.attr('border'), _this.borderColor);
              break;
          }
        });
        return this;
      }

      /**
       * Gets the value of the specified property, scanning down to parents and prototype if not defined.
       * @param {string} property - The property to retrieve
       * @returns {*} - The object or value associated to this property
       */

    }, {
      key: "get",
      value: function get(property) {
        if (this.hasOwnProperty(property) || this.parent === null) return this[property];else return this.parent.get(property);
      }

      /**
       * Sets the value of a specific property.
       * @param {string} property - The property name.
       * @param {*} value - Depends on the type of property
       */

    }, {
      key: "set",
      value: function set(property, value) {
        this[property] = value;
        return this;
      }

      /**
       * Gets the value of the specified property, scanning down to parents if not defined, and returning
       * always an own property (not from prototype)
       * @param {string} property - The property to retrieve
       * @returns {*} - The object associated to this property
       */

    }, {
      key: "getOwn",
      value: function getOwn(property) {
        if (this.hasOwnProperty(property)) return this[property];else if (this.parent !== null) return this.parent.getOwn(property);else {
          if (_typeof(this[property]) === 'object') this[property] = Utils.cloneObject(BoxBase.prototype[property]);else this[property] = BoxBase.prototype[property];
        }
        return this[property];
      }

      /**
       * Gets the properties defined in this BoxBase as a collection of CSS attributes
       * @param {object=} css - An optional set of initial CSS properties
       * @param {boolean} inactive - When `true`, get CSS attributes for an inactive cell
       * @param {boolean} inverse - When `true`, get CSS attributes for an inverse cell
       * @param {boolean} alternative - When `true`, get CSS attributes for an alternative cell
       * @returns {object}
       */

    }, {
      key: "getCSS",
      value: function getCSS(css, inactive, inverse, alternative) {
        // (css will be created by [AWT.Font.toCss](AWT.html) if null or undefined)
        var font = this.get('font');
        css = font.toCss(css);

        css['color'] = inverse ? this.get('backColor') : alternative ? this.get('alternativeColor') : this.get('textColor');

        var transparent = this.get('transparent');
        css['background-color'] = transparent ? 'transparent' : inactive ? this.get('inactiveColor') : inverse ? this.get('textColor') : this.get('backColor');

        var bgGradient = this.get('bgGradient');
        if (bgGradient && !transparent) css['background-image'] = bgGradient.getCss();

        if (this.shadow === 1) {
          var delta = Math.max(1, Math.round(font.size / 10));
          var color = this.get('shadowColor');
          css['text-shadow'] = delta + "px " + delta + "px 3px " + color;
        }
        return css;
      }

      /**
       * This utility method computes the width and height of text lines rendered on an HTML
       * __canvas__ element, reducing the font size of the BoxBase as needed when they exceed the maximum
       * width and/or height.
       * @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context used to draw the text.
       * @param {string} text - The text to drawn.
       * @param {number} maxWidth - Maximum width
       * @param {number} maxHeight - Maximum height
       * @returns {object[]} - An array of objects representing lines of text. Each object has a `text`
       * member with the text displayed in the line, and a `size` member with the line {@link AWT.Dimension}
       */

    }, {
      key: "prepareText",
      value: function prepareText(ctx, text, maxWidth, maxHeight) {
        var result = [],
            font = this.get('font'),
            height = font.getHeight();
        var totalHeight = 0;

        // divide the text in lines
        var lines = text.trim().split('\n');
        ctx.font = font.cssFont();
        for (var l = 0; l < lines.length; l++) {
          var line = lines[l].trim();
          var width = ctx.measureText(line).width;
          if (width > maxWidth) {
            // retain the last string offset that was inside maxWidth
            var lastOK = 0,
                lastOKWidth = 0;
            for (var p = 0; p < line.length; p++) {
              // Find next separator
              if (Utils.isSeparator(line[p])) {
                var w = ctx.measureText(line.substr(0, p).trim()).width;
                if (w > maxWidth) break;
                lastOK = p;
                lastOKWidth = w;
              }
            }
            if (lastOK > 0) {
              // Add a new line with the tail of the line
              lines.splice(l + 1, 0, line.substr(lastOK + 1).trim());
              // Adjust the current line
              line = lines[l] = line.substr(0, lastOK).trim();
              width = lastOKWidth;
            } else {
              // No solution found. Try resizing down the font.
              if (font.size > defaultValues.MIN_FONT_SIZE) {
                this.getOwn('font').zoom(-1);
                return this.prepareText(ctx, text, maxWidth, maxHeight);
              }
            }
          }

          // Add the line and the calculated dimension to `result`
          result.push({
            text: line,
            size: new AWT.Dimension(width, height)
          });

          totalHeight += height;

          if (totalHeight > maxHeight && font.size > defaultValues.MIN_FONT_SIZE) {
            // Max height exceeded. Try resizing down the font
            this.getOwn('font').zoom(-1);
            return this.prepareText(ctx, text, maxWidth, maxHeight);
          }
        }
        return result;
      }
    }]);

    return BoxBase;
  }();

  Object.assign(BoxBase.prototype, {
    /**
     * The parent BoxBase object
     * @name BoxBase#parent
     * @type {BoxBase} */
    parent: null,
    /**
     * Default values
     * @name BoxBase#defaultValues
     * @type {object} */
    default: defaultValues,
    /**
     * Font size can be dynamically reduced to fit the available space if any element using this
     * `BoxBase` requests it. When this happen, this field contains the real font currently used
     * to draw text.
     * @name BoxBase#font
     * @type {AWT.Font} */
    font: new AWT.Font(),
    /**
     * The current font size of this BoxBase. Can be dynamically adjusted when drawing.
     * @name BoxBase#dynFontSize
     * @type {number} */
    dynFontSize: 0,
    /**
     * Counts the number of times the `dynFontSize` has been reset. This is useful to avoid excessive
     * recursive loops searching the optimal font size.
     * @name BoxBase#resetFontCounter
     * @type {number} */
    resetFontCounter: 0,
    /**
     * The background color
     * @name BoxBase#backColor
     * @type {string} */
    backColor: defaultValues.BACK_COLOR,
    /**
     * The background gradient. Default is `null`.
     * @name BoxBase#bgGradient
     * @type {AWT.Gradient} */
    bgGradient: null,
    /**
     * The color used to write text.
     * @name BoxBase#textColor
     * @type {string} */
    textColor: defaultValues.TEXT_COLOR,
    /**
     * The color used to draw a shadow below regular text.
     * @name BoxBase#shadowColor
     * @type {string} */
    shadowColor: defaultValues.SHADOW_COLOR,
    /**
     * The color of the border.
     * @name BoxBase#borderColor
     * @type {string} */
    borderColor: defaultValues.BORDER_COLOR,
    /**
     * The color used to draw text when a cell is in `inactive` state.
     * @name BoxBase#inactiveColor
     * @type {string} */
    inactiveColor: defaultValues.INACTIVE_COLOR,
    /**
     * The color used to draw text when a cell is in `alternative` state.
     * @name BoxBase#alternativeColor
     * @type {string} */
    alternativeColor: defaultValues.ALTERNATIVE_COLOR,
    /**
     * Whether the text should have a shadow or not
     * @name BoxBase#shadow
     * @type {boolean} */
    shadow: false,
    /**
     * Whether the cell's background (and its hosted component, if any) should be transparent
     * @name BoxBase#transparent
     * @type {boolean} */
    transparent: false,
    /**
     * Wheter the cell's background should be painted or not. This property has no effect on
     * hosted components.
     * @name BoxBase#dontFill
     * @type {boolean} */
    dontFill: false,
    /**
     * The margin to respect between text elements and the limits of the cell or other elements.
     * @name BoxBase#textMargin
     * @type {number} */
    textMargin: defaultValues.AC_MARGIN,
    /**
     * The stroke used to draw the border.
     * @name BoxBase#borderStroke
     * @type {AWT.Stroke} */
    borderStroke: new AWT.Stroke(defaultValues.BORDER_STROKE_WIDTH),
    /**
     * The stroke used to draw a border around marked cells.
     * @name BoxBase#markerStroke
     * @type {AWT.Stroke} */
    markerStroke: new AWT.Stroke(defaultValues.MARKER_STROKE_WIDTH)
  });

  BoxBase.prototype.defaultBoxBase = new BoxBase();

  return BoxBase;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 58 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : boxes/BoxConnector.js
 *  Created : 26/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2016 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function (AWT) {

  /**
   * BoxConnector allows users to visually connect two {@link ActiveBox} objects of an
   * {@link ActivityPanel}. There are two modes of operation:
   *
   * - Drawing a line between an origin point (usually the point where the user clicks on) and a
   * destination point.
   * - Dragging the ActiveBox from one location to another.
   *
   * The connecting lines can have arrowheads at its endings.
   * @exports BoxConnector
   * @class
   */
  var BoxConnector = function () {
    /**
     * BoxConnector constructor
     * @param {AWT.Container} parent - The Container to which this BoxConnector belongs
     * @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context where to draw
     */
    function BoxConnector(parent, ctx) {
      _classCallCheck(this, BoxConnector);

      this.parent = parent;
      this.ctx = ctx;
      this.dim = new AWT.Dimension(ctx.canvas.width, ctx.canvas.height);
      this.origin = new AWT.Point();
      this.dest = new AWT.Point();
      this.relativePos = new AWT.Point();
    }

    /**
     * Displaces the ending point of the connector
     * @param {number} dx - Displacement on the X axis
     * @param {number} dy - Displacement on the Y axis
     */


    _createClass(BoxConnector, [{
      key: 'moveBy',
      value: function moveBy(dx, dy) {
        this.moveTo(AWT.Point(this.dest.x + dx, this.dest.y + dy));
      }

      /**
       * Moves the ending point of the connector to a new position
       * @param {AWT.Point} pt - The new position
       * @param {boolean} forcePaint - When `true`, forces the repaint of all the area also if there is
       * no movement at all.
       */

    }, {
      key: 'moveTo',
      value: function moveTo(pt, forcePaint) {
        if (!this.active || !forcePaint && this.dest.equals(pt)) return;

        // Restore the background
        if (this.bgRect) {
          if (this.bgImg) {
            this.ctx.putImageData(this.bgImg, 0, 0, this.bgRect.pos.x, this.bgRect.pos.y, this.bgRect.dim.width, this.bgRect.dim.height);
          } else if (this.parent) this.parent.updateContent();
        }

        this.dest.moveTo(pt);

        // Calculate the bounds of the invalidated area after the move:
        // Start with the origin point or box area
        var pt1 = new AWT.Point(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);
        this.bgRect = new AWT.Rectangle(pt1, this.bx ? this.bx.dim : new AWT.Dimension());
        //  Add the destination point or box area
        var pt2 = new AWT.Point(pt.x - this.relativePos.x, pt.y - this.relativePos.y);
        this.bgRect.add(new AWT.Rectangle(pt2, this.bx ? this.bx.dim : new AWT.Dimension()));
        // Add a generous border around the area
        this.bgRect.grow(10, 10);

        if (this.bx !== null) {
          // Move the ActiveBox
          this.bx.moveTo(new AWT.Point(pt.x - this.relativePos.x, pt.y - this.relativePos.y));
          this.bx.setTemporaryHidden(false);
          this.bx.update(this.ctx, null);
          this.bx.setTemporaryHidden(true);
        } else {
          // Draw the connecting line
          this.drawLine();
          this.linePainted = true;
        }
      }

      /**
       * Starts the box connector operation
       * @param {AWT.Point} pt - Starting point
       * @param {ActiveBox=} box -  Passed only when the BoxConnector runs in drag&drop mode
       */

    }, {
      key: 'begin',
      value: function begin(pt, box) {
        if (this.active) this.end();
        this.origin.moveTo(pt);
        this.dest.moveTo(pt);
        this.linePainted = false;
        this.active = true;

        if (box) {
          // Remember what box will be moved, hide it from the panel and repaint all
          this.bx = box;
          this.relativePos.moveTo(pt.x - box.pos.x, pt.y - box.pos.y);
          this.bx.setFocused(true);
          this.bx.setTemporaryHidden(true);
          this.linePainted = false;
          this.parent.invalidate().update();
        }

        // Save the full image currently displayed on the panel (with the box hidden)
        try {
          this.bgImg = this.ctx.getImageData(0, 0, this.dim.width, this.dim.height);
        } catch (ex) {
          // Avoid "canvas tainted by cross-origin data" errors
          // Setting bgImg to null is less efficient, but works
          this.bgImg = null;
        }
        this.bgRect = null;

        // Make a first movement to make the box appear
        if (box) this.moveTo(pt, true);
      }

      /**
       * Finalizes the operation of this box connector until a new call to `begin`
       */

    }, {
      key: 'end',
      value: function end() {
        if (!this.active) return;

        this.active = false;
        this.linePainted = false;
        this.bgRect = null;
        this.bgImg = null;

        if (this.bx) {
          // Restore the original position and attributes of the box
          this.bx.setFocused(false);
          this.bx.moveTo(this.origin.x - this.relativePos.x, this.origin.y - this.relativePos.y);
          this.bx.setTemporaryHidden(false);
          this.bx = null;
          this.relativePos.moveTo(0, 0);
        }

        // Repaint all
        this.ctx.clearRect(0, 0, this.dim.width, this.dim.height);
        this.parent.invalidate().update();
      }

      /**
       * Strokes a line between `origin` and `dest`, optionally ended with an arrowhead.
       */

    }, {
      key: 'drawLine',
      value: function drawLine() {
        if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {
          this.ctx.strokeStyle = this.xorColor;
          this.ctx.globalCompositeOperation = this.compositeOp;
        } else this.ctx.strokeStyle = this.lineColor;

        this.ctx.lineWidth = this.lineWidth;

        this.ctx.beginPath();
        this.ctx.moveTo(this.origin.x, this.origin.y);
        this.ctx.lineTo(this.dest.x, this.dest.y);
        this.ctx.stroke();

        if (this.arrow) {
          // Draws the arrow head
          var beta = Math.atan2(this.origin.x - this.dest.x, this.dest.x - this.origin.x),
              arp = new AWT.Point(this.dest.x - this.arrowLength * Math.cos(beta + this.arrowAngle), this.dest.y + this.arrowLength * Math.sin(beta + this.arrowAngle));
          this.ctx.beginPath();
          this.ctx.moveTo(this.dest.x, this.dest.y);
          this.ctx.lineTo(arp.x, arp.y);
          this.ctx.stroke();

          arp.moveTo(this.dest.x - this.arrowLength * Math.cos(beta - this.arrowAngle), this.dest.y + this.arrowLength * Math.sin(beta - this.arrowAngle));
          this.ctx.beginPath();
          this.ctx.moveTo(this.dest.x, this.dest.y);
          this.ctx.lineTo(arp.x, arp.y);
          this.ctx.stroke();
        }
        if (this.compositeOp !== DEFAULT_COMPOSITE_OP) {
          // reset default settings
          this.ctx.globalCompositeOperation = DEFAULT_COMPOSITE_OP;
        }
      }
    }]);

    return BoxConnector;
  }();

  var DEFAULT_COMPOSITE_OP = 'source-over';

  Object.assign(BoxConnector.prototype, {
    /**
     * The background image, saved and redrawn on each movement
     * @name BoxConnector#bgImg
     * @type {external:HTMLImageElement} */
    bgImg: null,
    /**
     * The rectangle of {@link ActivityPanel} saved in `bgImg`
     * @name BoxConnector#bgRect
     * @type {AWT.Rectangle} */
    bgRect: null,
    /**
     * Initial position of the connector
     * @name BoxConnector#origin
     * @type {AWT.Point} */
    origin: null,
    /**
     * Current (while moving) and final position of the connector
     * @name BoxConnector#dest
     * @type {AWT.Point} */
    dest: null,
    /**
     * When `true`, the connector must end on arrowhead
     * @name BoxConnector#arrow
     * @type {boolean} */
    arrow: false,
    /**
     * `true` while the connector is active
     * @name BoxConnector#active
     * @type {boolean} */
    active: false,
    /**
     * `true` while the line has already been painted (used for XOR expressions)
     * @name BoxConnector#linePainted
     * @type {boolean} */
    linePainted: false,
    /**
     * The arrowhead length (in pixels)
     * @name BoxConnector#arrowLength
     * @type {number} */
    arrowLength: 10,
    /**
     * The arrowhead angle
     * @name BoxConnector#arrowAngle
     * @type {number} */
    arrowAngle: Math.PI / 6,
    /**
     * The main color used in XOR operations
     * @name BoxConnector#lineColor
     * @type {string} */
    lineColor: 'black',
    /**
     * The complementary color used in XOR operations
     * @name BoxConnector#xorColor
     * @type {string} */
    xorColor: 'white',
    /**
     * The global composite operator used when drawing in XOR mode. Default is "difference".
     * For a list of possible values see:
     * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation}
     * @name BoxConnector#compositeOp
     * @type {string} */
    compositeOp: 'difference',
    /**
     * The default {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation composite operator}
     * ("source-over").
     * @name BoxConnector#DEFAULT_COMPOSITE_OP
     * @static
     * @type {string} */
    DEFAULT_COMPOSITE_OP: DEFAULT_COMPOSITE_OP,
    /**
     * Relative position of point B regarding A
     * @name BoxConnector#relativePos
     * @type {AWT.Point} */
    relativePos: null,
    /**
     * The ActiveBox to connect or move
     * @name BoxConnector#bx
     * @type {ActiveBox} */
    bx: null,
    /**
     * The Graphics context where the BoxConnector will paint
     * @name BoxConnector#ctx
     * @type {external:CanvasRenderingContext2D} */
    ctx: null,
    /**
     * The dimension of the HTML canvas where to draw
     * @name BoxConnector#dim
     * @type {AWT.Dimension} */
    dim: null,
    /**
     * The container to which this connector belongs
     * @name BoxConnector#parent
     * @type {AWT.Container} */
    parent: null,
    /**
     * Width of the connector line
     * @name BoxConnector#lineWidth
     * @type {number} */
    lineWidth: 1.5
  });

  return BoxConnector;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 59 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var def = __webpack_require__(11).f;
var has = __webpack_require__(16);
var TAG = __webpack_require__(8)('toStringTag');

module.exports = function (it, tag, stat) {
  if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
};

/***/ }),
/* 60 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var defined = __webpack_require__(30);
var fails = __webpack_require__(6);
var spaces = __webpack_require__(106);
var space = '[' + spaces + ']';
var non = '\u200B\x85';
var ltrim = RegExp('^' + space + space + '*');
var rtrim = RegExp(space + space + '*$');

var exporter = function exporter(KEY, exec, ALIAS) {
  var exp = {};
  var FORCE = fails(function () {
    return !!spaces[KEY]() || non[KEY]() != non;
  });
  var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY];
  if (ALIAS) exp[ALIAS] = fn;
  $export($export.P + $export.F * FORCE, 'String', exp);
};

// 1 -> String#trimLeft
// 2 -> String#trimRight
// 3 -> String#trim
var trim = exporter.trim = function (string, TYPE) {
  string = String(defined(string));
  if (TYPE & 1) string = string.replace(ltrim, '');
  if (TYPE & 2) string = string.replace(rtrim, '');
  return string;
};

module.exports = exporter;

/***/ }),
/* 61 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = {};

/***/ }),
/* 62 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var isObject = __webpack_require__(7);
module.exports = function (it, TYPE) {
  if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
  return it;
};

/***/ }),
/* 63 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var utils = __webpack_require__(9);
var support = __webpack_require__(41);
var nodejsUtils = __webpack_require__(94);
var GenericWorker = __webpack_require__(23);

/**
 * The following functions come from pako, from pako/lib/utils/strings
 * released under the MIT license, see pako https://github.com/nodeca/pako/
 */

// Table with utf8 lengths (calculated by first byte of sequence)
// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
// because max possible codepoint is 0x10ffff
var _utf8len = new Array(256);
for (var i = 0; i < 256; i++) {
    _utf8len[i] = i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1;
}
_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start

// convert string to array (typed, when possible)
var string2buf = function string2buf(str) {
    var buf,
        c,
        c2,
        m_pos,
        i,
        str_len = str.length,
        buf_len = 0;

    // count binary size
    for (m_pos = 0; m_pos < str_len; m_pos++) {
        c = str.charCodeAt(m_pos);
        if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {
            c2 = str.charCodeAt(m_pos + 1);
            if ((c2 & 0xfc00) === 0xdc00) {
                c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);
                m_pos++;
            }
        }
        buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
    }

    // allocate buffer
    if (support.uint8array) {
        buf = new Uint8Array(buf_len);
    } else {
        buf = new Array(buf_len);
    }

    // convert
    for (i = 0, m_pos = 0; i < buf_len; m_pos++) {
        c = str.charCodeAt(m_pos);
        if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {
            c2 = str.charCodeAt(m_pos + 1);
            if ((c2 & 0xfc00) === 0xdc00) {
                c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);
                m_pos++;
            }
        }
        if (c < 0x80) {
            /* one byte */
            buf[i++] = c;
        } else if (c < 0x800) {
            /* two bytes */
            buf[i++] = 0xC0 | c >>> 6;
            buf[i++] = 0x80 | c & 0x3f;
        } else if (c < 0x10000) {
            /* three bytes */
            buf[i++] = 0xE0 | c >>> 12;
            buf[i++] = 0x80 | c >>> 6 & 0x3f;
            buf[i++] = 0x80 | c & 0x3f;
        } else {
            /* four bytes */
            buf[i++] = 0xf0 | c >>> 18;
            buf[i++] = 0x80 | c >>> 12 & 0x3f;
            buf[i++] = 0x80 | c >>> 6 & 0x3f;
            buf[i++] = 0x80 | c & 0x3f;
        }
    }

    return buf;
};

// Calculate max possible position in utf8 buffer,
// that will not break sequence. If that's not possible
// - (very small limits) return max size as is.
//
// buf[] - utf8 bytes array
// max   - length limit (mandatory);
var utf8border = function utf8border(buf, max) {
    var pos;

    max = max || buf.length;
    if (max > buf.length) {
        max = buf.length;
    }

    // go back from last position, until start of sequence found
    pos = max - 1;
    while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) {
        pos--;
    }

    // Fuckup - very small and broken sequence,
    // return max, because we should return something anyway.
    if (pos < 0) {
        return max;
    }

    // If we came to start of buffer - that means vuffer is too small,
    // return max too.
    if (pos === 0) {
        return max;
    }

    return pos + _utf8len[buf[pos]] > max ? pos : max;
};

// convert array to string
var buf2string = function buf2string(buf) {
    var str, i, out, c, c_len;
    var len = buf.length;

    // Reserve max possible length (2 words per char)
    // NB: by unknown reasons, Array is significantly faster for
    //     String.fromCharCode.apply than Uint16Array.
    var utf16buf = new Array(len * 2);

    for (out = 0, i = 0; i < len;) {
        c = buf[i++];
        // quick process ascii
        if (c < 0x80) {
            utf16buf[out++] = c;continue;
        }

        c_len = _utf8len[c];
        // skip 5 & 6 byte codes
        if (c_len > 4) {
            utf16buf[out++] = 0xfffd;i += c_len - 1;continue;
        }

        // apply mask on first byte
        c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;
        // join the rest
        while (c_len > 1 && i < len) {
            c = c << 6 | buf[i++] & 0x3f;
            c_len--;
        }

        // terminated by end of string?
        if (c_len > 1) {
            utf16buf[out++] = 0xfffd;continue;
        }

        if (c < 0x10000) {
            utf16buf[out++] = c;
        } else {
            c -= 0x10000;
            utf16buf[out++] = 0xd800 | c >> 10 & 0x3ff;
            utf16buf[out++] = 0xdc00 | c & 0x3ff;
        }
    }

    // shrinkBuf(utf16buf, out)
    if (utf16buf.length !== out) {
        if (utf16buf.subarray) {
            utf16buf = utf16buf.subarray(0, out);
        } else {
            utf16buf.length = out;
        }
    }

    // return String.fromCharCode.apply(null, utf16buf);
    return utils.applyFromCharCode(utf16buf);
};

// That's all for the pako functions.


/**
 * Transform a javascript string into an array (typed if possible) of bytes,
 * UTF-8 encoded.
 * @param {String} str the string to encode
 * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string.
 */
exports.utf8encode = function utf8encode(str) {
    if (support.nodebuffer) {
        return nodejsUtils.newBufferFrom(str, "utf-8");
    }

    return string2buf(str);
};

/**
 * Transform a bytes array (or a representation) representing an UTF-8 encoded
 * string into a javascript string.
 * @param {Array|Uint8Array|Buffer} buf the data de decode
 * @return {String} the decoded string.
 */
exports.utf8decode = function utf8decode(buf) {
    if (support.nodebuffer) {
        return utils.transformTo("nodebuffer", buf).toString("utf-8");
    }

    buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf);

    return buf2string(buf);
};

/**
 * A worker to decode utf8 encoded binary chunks into string chunks.
 * @constructor
 */
function Utf8DecodeWorker() {
    GenericWorker.call(this, "utf-8 decode");
    // the last bytes if a chunk didn't end with a complete codepoint.
    this.leftOver = null;
}
utils.inherits(Utf8DecodeWorker, GenericWorker);

/**
 * @see GenericWorker.processChunk
 */
Utf8DecodeWorker.prototype.processChunk = function (chunk) {

    var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk.data);

    // 1st step, re-use what's left of the previous chunk
    if (this.leftOver && this.leftOver.length) {
        if (support.uint8array) {
            var previousData = data;
            data = new Uint8Array(previousData.length + this.leftOver.length);
            data.set(this.leftOver, 0);
            data.set(previousData, this.leftOver.length);
        } else {
            data = this.leftOver.concat(data);
        }
        this.leftOver = null;
    }

    var nextBoundary = utf8border(data);
    var usableData = data;
    if (nextBoundary !== data.length) {
        if (support.uint8array) {
            usableData = data.subarray(0, nextBoundary);
            this.leftOver = data.subarray(nextBoundary, data.length);
        } else {
            usableData = data.slice(0, nextBoundary);
            this.leftOver = data.slice(nextBoundary, data.length);
        }
    }

    this.push({
        data: exports.utf8decode(usableData),
        meta: chunk.meta
    });
};

/**
 * @see GenericWorker.flush
 */
Utf8DecodeWorker.prototype.flush = function () {
    if (this.leftOver && this.leftOver.length) {
        this.push({
            data: exports.utf8decode(this.leftOver),
            meta: {}
        });
        this.leftOver = null;
    }
};
exports.Utf8DecodeWorker = Utf8DecodeWorker;

/**
 * A worker to endcode string chunks into utf8 encoded binary chunks.
 * @constructor
 */
function Utf8EncodeWorker() {
    GenericWorker.call(this, "utf-8 encode");
}
utils.inherits(Utf8EncodeWorker, GenericWorker);

/**
 * @see GenericWorker.processChunk
 */
Utf8EncodeWorker.prototype.processChunk = function (chunk) {
    this.push({
        data: exports.utf8encode(chunk.data),
        meta: chunk.meta
    });
};
exports.Utf8EncodeWorker = Utf8EncodeWorker;

/***/ }),
/* 64 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


if (typeof Object.create === 'function') {
  // implementation from standard node.js 'util' module
  module.exports = function inherits(ctor, superCtor) {
    ctor.super_ = superCtor;
    ctor.prototype = Object.create(superCtor.prototype, {
      constructor: {
        value: ctor,
        enumerable: false,
        writable: true,
        configurable: true
      }
    });
  };
} else {
  // old school shim for old browsers
  module.exports = function inherits(ctor, superCtor) {
    ctor.super_ = superCtor;
    var TempCtor = function TempCtor() {};
    TempCtor.prototype = superCtor.prototype;
    ctor.prototype = new TempCtor();
    ctor.prototype.constructor = ctor;
  };
}

/***/ }),
/* 65 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : shapers/Shaper.js
 *  Created : 13/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Utils, AWT) {

  /**
   * The function of this class and its subclasses is to draw a set of "shapes" that will be used to
   * place {@link ActiveBox} objects at a specific position, and to determine its dimension and
   * appearance.
   * @exports Shaper
   * @class
   */
  var Shaper = function () {
    /**
     * Shaper constructor
     * @param {number} nx - Number of columns (in grid-based shapers)
     * @param {number} ny - Number of rows (in grid-based shapers)
     */
    function Shaper(nx, ny) {
      _classCallCheck(this, Shaper);

      this.reset(nx, ny);
    }

    /**
     * Factory constructor that returns a Shaper of the requested class.
     * @param {string} className - The class name of the requested Shaper.
     * @param {number} nx - Number of columns (in grid-based shapers)
     * @param {number} ny - Number of rows (in grid-based shapers)
     * @returns {Shaper}
     */


    _createClass(Shaper, [{
      key: "reset",


      /**
       * Initializes this Shaper to default values
       * @param {number} nCols - Number of columns
       * @param {number} nRows - Number of rows
       */
      value: function reset(nCols, nRows) {
        this.nCols = nCols;
        this.nRows = nRows;
        this.nCells = nRows * nCols;
        this.initiated = false;
        this.shapeData = [];
        for (var i = 0; i < this.nCells; i++) {
          this.shapeData[i] = new AWT.Shape();
        }
      }

      /**
       * Loads this shaper settings from a specific JQuery XML element
       * @param {external:jQuery} $xml - The XML element with the shaper data
       */

    }, {
      key: "setProperties",
      value: function setProperties($xml) {
        var _this = this;

        Utils.attrForEach($xml.get(0).attributes, function (name, value) {
          switch (name) {
            case 'class':
              _this.className = value;
              break;
            case 'cols':
              _this.nCols = Number(value);
              break;
            case 'rows':
              _this.nRows = Number(value);
              break;
            case 'baseWidthFactor':
            case 'toothHeightFactor':
            case 'scaleX':
            case 'scaleY':
              _this[name] = Number(value);
              break;
            case 'randomLines':
            case 'showEnclosure':
              _this[name] = Utils.getBoolean(value, true);
              break;
          }
        });

        // Reads the 'enclosing'
        // (main shape area where the other shape elements are placed)
        $xml.children('enclosing:first').each(function (_n, child) {
          $(child).children('shape:first').each(function (_n, child2) {
            var sh = Shaper.readShapeData(child2, _this.scaleX, _this.scaleY);
            _this.enclosing = sh;
            _this.showEnclosure = true;
            _this.hasRemainder = true;
          });
        });

        // Read the shape elements
        $xml.children('shape').each(function (n, child) {
          _this.shapeData[n] = Shaper.readShapeData(child, _this.scaleX, _this.scaleY);
        });

        // Correction needed for '@Holes' shaper
        if (this.shapeData.length > 0 /* && this.shapeData.length !== this.nRows * this.nCols */) {
            //this.nRows = this.shapeData.length
            //this.nCols = 1
            //this.nCells = this.nCols * this.nRows
            this.nCells = this.shapeData.length;
          }
        return this;
      }

      /**
       * Reads an individual shape from an XML element.
       * Shapes are arrays of `stroke` objects.
       * Each `stroke` has an `action` (_move to_, _line to_, _quad to_...) and associated `data`.
       * @param {external:jQuery} $xml - The XML element with the shape data
       * @param {number} scaleX
       * @param {number} scaleY
       * @returns {AWT.Shape}
       */

    }, {
      key: "buildShapes",


      /**
       * Builds the individual shapes that will form this Shaper
       */
      value: function buildShapes() {}

      /**
       * Gets a clone of the nth Shape object, scaled and located inside a Rectangle
       * @param {number} n
       * @param {AWT.Rectangle} rect
       * @returns {AWT.Shape}
       */

    }, {
      key: "getShape",
      value: function getShape(n, rect) {
        if (!this.initiated) this.buildShapes();
        if (n >= this.nCells || this.shapeData[n] === null) return null;
        return this.shapeData[n].getShape(rect);
      }

      /**
       * Gets the nth Shape data object
       * @param {number} n
       * @returns {object}
       */

    }, {
      key: "getShapeData",
      value: function getShapeData(n) {
        return n >= 0 && n < this.shapeData.length ? this.shapeData[n] : null;
      }

      /**
       * Gets the AWT.Rectangle that contains all shapes of this Shaper.
       * @returns {AWT.Rectangle}
       */

    }, {
      key: "getEnclosingShapeData",
      value: function getEnclosingShapeData() {
        return new AWT.Rectangle(0, 0, 1, 1);
      }

      /**
       * When `hasRemainder` is true, this method gets the rectangle containing the full surface where
       * the Shaper develops.
       * @param {AWT.Rectangle} rect - The frame where to move and scale all the shapes
       * @returns {AWT.Rectangle}
       */

    }, {
      key: "getRemainderShape",
      value: function getRemainderShape(rect) {
        if (!this.hasRemainder) return null;

        if (!this.initiated) this.buildShapes();

        var sh = this.getEnclosingShapeData();
        var r = sh ? sh.getShape(rect) : new AWT.Rectangle();
        for (var i = 0; i < this.nCells; i++) {
          if (this.shapeData[i]) r.add(this.shapeData[i].getShape(rect), false);
        }
        return r;
      }
    }], [{
      key: "getShaper",
      value: function getShaper(className, nx, ny) {
        var cl = Shaper.CLASSES[(className || '').replace(/^edu\.xtec\.jclic\.shapers\./, '@')];
        if (!cl) Utils.log('error', "Unknown shaper: " + className);
        return cl ? new cl(nx, ny) : null;
      }
    }, {
      key: "readShapeData",
      value: function readShapeData(xml, scaleX, scaleY) {
        var shd = [];
        var result = null;
        $.each(xml.textContent.split('|'), function (_n, txt) {
          var sd = txt.split(':');
          // Possible strokes are: `rectangle`, `ellipse`, `M`, `L`, `Q`, `B`, `X`
          // Also possible, but not currently used in JClic: `roundRectangle` and `pie`
          var data = sd.length > 1 ? sd[1].split(',') : null;
          //
          // Data should be always divided by the scale (X or Y)
          if (data) data = data.map(function (d, n) {
            return d / (n % 2 ? scaleY : scaleX);
          });

          switch (sd[0]) {
            case 'rectangle':
              result = new AWT.Rectangle(data[0], data[1], data[2], data[3]);
              break;
            case 'ellipse':
              result = new AWT.Ellipse(data[0], data[1], data[2], data[3]);
              break;
            default:
              // It's an `AWT.PathStroke`
              shd.push(new AWT.PathStroke(sd[0], data));
              break;
          }
        });

        return !result && shd.length > 0 ? new AWT.Path(shd) : result;
      }
    }]);

    return Shaper;
  }();

  /**
   * List of known classes derived from Shaper. It should be filled by real shaper classes at
   * declaration time.
   * @type {object} */


  Shaper.CLASSES = {};

  Object.assign(Shaper.prototype, {
    /**
     * This shaper class name
     * @name Shaper#className
     * @type {string} */
    className: 'Shaper',
    /**
     * Number of columns (useful in grid-based shapers)
     * @name Shaper#nCols
     * @type {number} */
    nCols: 0,
    /**
     * Number of rows (useful in grid-based shapers)
     * @name Shaper#nRows
     * @type {number} */
    nRows: 0,
    /**
     * Number of cells managed by this shaper
     * @name Shaper#nCells
     * @type {number} */
    nCells: 0,
    /**
     * Contains the specific definition of each shape
     * @name Shaper#shapeData
     * @type {object} */
    shapeData: null,
    /**
     * Flag used to check if the `Shaper` has been initialized against a real surface
     * @name Shaper#initiated
     * @type {boolean} */
    initiated: false,
    //
    // Fields used only in JigSaw shapers
    /**
     * In {@link JigSaw}, ratio between the base width of the tooth and the total length of the side.
     * @name Shaper#baseWidthFactor
     * @type {number} */
    baseWidthFactor: 1.0 / 3,
    /**
     * In {@link JigSaw}, ratio between the tooth height and the total length of the side.
     * @name Shaper#toothHeightFactor
     * @type {number} */
    toothHeightFactor: 1.0 / 6,
    /**
     * In {@link JigSaw}, whether the tooths take random directions or not
     * @name Shaper#randomLines
     * @type {boolean} */
    randomLines: false,
    //
    // Fields used only in the `Holes` shaper
    /**
     * In {@link Holes}, scale to be applied to horizontal positions and lengths to achieve the real
     * value of the shape placed on a real surface.
     * @name Shaper#scaleX
     * @type {number} */
    scaleX: 1.0,
    /**
     * In {@link Holes}, scale to be applied to vertical positions and lengths to achieve the real
     * value of the shape placed on a real surface.
     * @name Shaper#scaleY
     * @type {number} */
    scaleY: 1.0,
    /**
     * In {@link Holes}, the enclosing area where all shapes are placed.
     * @name Shaper#enclosing
     * @type {AWT.Shape} */
    enclosing: null,
    /**
     * In {@link Holes}, when `true`, the enclosing area will be drawn
     * @name Shaper#showEnclosure
     * @type {boolean} */
    showEnclosure: false,
    /**
     * Flag indicating if this shaper organizes its cells in rows and columns
     * @name Shaper#rectangularShapes
     * @type {boolean} */
    rectangularShapes: false,
    /**
     * Flag indicating if this Shaper deploys over a surface biggest than the rectangle enclosing
     * all its shapes
     * @name Shaper#hasRemainder
     * @type {boolean} */
    hasRemainder: false
  });

  return Shaper;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 66 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : skins/DefaultSkin.js
 *  Created : 12/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(135), __webpack_require__(3), __webpack_require__(34), __webpack_require__(74), __webpack_require__(214), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, screenfull, AWT, Skin, ActiveBox, Counter, Utils) {

  // In some cases, require.js does not return a valid value for screenfull. Check it:
  if (!screenfull) screenfull = window.screenfull;

  /**
   * This is the default {@link Skin} used by JClic.js
   * @exports DefaultSkin
   * @class
   * @extends Skin
   */

  var DefaultSkin = function (_Skin) {
    _inherits(DefaultSkin, _Skin);

    /**
     * DefaultSkin constructor
     * @param {PlayStation} ps - The PlayStation (currently a {@link JClicPlayer}) used to load and
     * realize the media objects needed tot build the Skin.
     * @param {string=} name - The skin class name
     * @param {object=} options - Optional parameter with additional options, used by subclasses
     * this skin. When `null` or `undefined`, a new one will be created.
     */
    function DefaultSkin(ps) {
      var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

      _classCallCheck(this, DefaultSkin);

      var _this = _possibleConstructorReturn(this, (DefaultSkin.__proto__ || Object.getPrototypeOf(DefaultSkin)).call(this, ps, name, options));
      // DefaultSkin extends [Skin](Skin.html)


      var msg = '';

      AWT.Font.loadGoogleFonts(_this.cssFonts);

      // Create the main container for buttons, counters and message box
      _this.$ctrlCnt = $('<div/>', { class: 'JClicCtrlCnt unselectableText', role: 'navigation' });
      _this.$div.append(_this.$ctrlCnt);

      // Add `prev` button
      msg = ps.getMsg('Previous activity');
      _this.buttons.prev = $('<button/>', { class: 'JClicBtn', title: msg, 'aria-label': msg }).append($(Utils.getSvg(_this.prevIcon, _this.iconWidth, _this.iconHeight, _this.iconFill))).on('click', function (evt) {
        if (_this.ps) _this.ps.actions.prev.processEvent(evt);
      });
      _this.$ctrlCnt.append(_this.buttons.prev);

      // Add message box
      _this.msgBox = new ActiveBox();
      _this.msgBox.role = 'message';
      _this.$msgBoxDiv = $('<div/>', { class: 'JClicMsgBox' }).click(function () {
        _this.msgBox.playMedia(ps);
        return false;
      });
      _this.$ctrlCnt.append(_this.$msgBoxDiv);

      // Add `next` button
      msg = ps.getMsg('Next activity');
      _this.buttons.next = $('<button/>', { class: 'JClicBtn', title: msg, 'aria-label': msg }).append($(Utils.getSvg(_this.nextIcon, _this.iconWidth, _this.iconHeight, _this.iconFill))).on('click', function (evt) {
        if (_this.ps) _this.ps.actions.next.processEvent(evt);
      });
      _this.$ctrlCnt.append(_this.buttons.next);

    
      // Add `full screen` button
      if (screenfull && screenfull.enabled) {
        msg = ps.getMsg('Toggle full screen');
        _this.buttons.fullscreen = $('<button/>', { class: 'JClicBtn', title: msg, 'aria-label': msg }).append($('<img/>', { src: Utils.svgToURI(_this.fullScreenIcon, _this.iconWidth, _this.iconHeight, _this.iconFill) })).on('click', function () {
          _this.setScreenFull(null);
        });
        _this.$ctrlCnt.append(_this.buttons.fullscreen);
      }

      // Add `close` button
      if (typeof _this.ps.options.closeFn === 'function') {
        msg = ps.getMsg('Close');
        var closeFn = _this.ps.options.closeFn;
        _this.buttons.close = $('<button/>', { class: 'JClicBtn', title: msg, 'aria-label': msg }).append($(Utils.getSvg(_this.closeIcon, _this.iconWidth, _this.iconHeight, _this.iconFill))).on('click', function () {
          Utils.log('info', 'Closing the player');
          closeFn();
        });
        _this.$ctrlCnt.append(_this.buttons.close);
      }

      // Workaround for a bug in Edge and Explorer: SVG objects not implementing `blur` and `focus` methods
      // See: [https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8479637/]
      // This affects Polymer `iron-overlay-behavior`. See: [https://github.com/PolymerElements/iron-overlay-behavior/pull/211]
      var nilFunc = null;
      $.each(_this.buttons, function (_key, value) {
        if (value && (typeof value[0].focus !== 'function' || typeof value[0].blur !== 'function')) {
          if (nilFunc === null) nilFunc = function nilFunc() {
            return Utils.log('error', '"blur" and "focus" not defined for SVG objects in Explorer/Edge');
          };
          value[0].focus = value[0].blur = nilFunc;
        }
      });
      return _this;
    }

    /**
     * Returns the CSS styles used by this skin. This method should be called only from
     * the `Skin` constructor, and overridded by subclasses if needed.
     * @param {string} media - A specific media size. Possible values are: 'default', 'half' and 'twoThirds'
     * @returns {string}
     */


    _createClass(DefaultSkin, [{
      key: "_getStyleSheets",
      value: function _getStyleSheets() {
        var media = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';

        return "" + _get(DefaultSkin.prototype.__proto__ || Object.getPrototypeOf(DefaultSkin.prototype), "_getStyleSheets", this).call(this, media) + (media === 'default' ? this.mainCSS : media === 'half' ? this.mainCSSHalf : media === 'twoThirds' ? this.mainCSSTwoThirds : '');
      }

      /**
       * Main method used to build the content of the skin. Resizes and places internal objects.
       * @override
       */

    }, {
      key: "doLayout",
      value: function doLayout() {
        // Call method on ancestor
        _get(DefaultSkin.prototype.__proto__ || Object.getPrototypeOf(DefaultSkin.prototype), "doLayout", this).call(this);

        // Set the fullScreen icon
        if (this.buttons.fullscreen) this.buttons.fullscreen.find('img').get(-1).src = Utils.svgToURI(this[screenfull.isFullscreen ? 'fullScreenExitIcon' : 'fullScreenIcon'], this.iconWidth, this.iconHeight, this.iconFill);
      }

      /**
       * Gets the {@link ActiveBox} used to display the main messages of activities
       * @returns {ActiveBox}
       */

    }, {
      key: "getMsgBox",
      value: function getMsgBox() {
        return this.msgBox;
      }

      /**
       * Enables or disables the `tabindex` attribute of the main buttons. Useful when a modal dialog
       * overlay is active, to avoid direct access to controls not related with the dialog.
       * @param {boolean} status - `true` to make main controls navigable, `false` otherwise
       */

    }, {
      key: "enableMainButtons",
      value: function enableMainButtons(status) {
        this.$ctrlCnt.find('.JClicBtn,.JClicCountCnt').attr('tabindex', status ? '0' : '-1');
      }
    }]);

    return DefaultSkin;
  }(Skin);

  Object.assign(DefaultSkin.prototype, {
    /**
     * Class name of this skin. It will be used as a base selector in the definition of all CSS styles.
     * @name DefaultSkin#skinId
     * @override
     * @type {string}
     */
    skinId: 'JClicDefaultSkin',
    /**
     * The HTML div where buttons, counters and message box are placed
     * @name DefaultSkin#$ctrlCnt
     * @type {external:jQuery} */
    $ctrlCnt: null,
    /**
     * Space (pixels) between the components of this {@link Skin}
     * @name DefaultSkin#margin
     * @type {number} */
    margin: 18,
    /**
     * Height of {@link DefaultSkin#msgBox}
     * @name DefaultSkin#msgBoxHeight
     * @type {number} */
    msgBoxHeight: 60,
    /**
     * Width of counters, in pixels
     * @name DefaultSkin#countersWidth
     * @type {number} */
    countersWidth: 60,
    /**
     * Height of counters, in pixels
     * @name DefaultSkin#countersHeight
     * @type {number} */
    countersHeight: 20,
    //
    //Buttons and other graphical resources used by this skin.
    //
    /**
     * Styles used in this skin
     * @name DefaultSkin#mainCSS
     * @type {string} */
    mainCSS: '\
.ID .JClicCtrlCnt {margin:0 9px 18px 9px; display:-webkit-flex; display:flex; -webkit-flex-direction:row; flex-direction:row; -webkit-align-items:center; align-items:center;}\
.ID .JClicCountCnt {display:-webkit-flex; display:flex; -webkit-flex-direction:column; flex-direction:column;}\
.ID .JClicMsgBox {height:60px; -webkit-flex-grow:1; flex-grow:1; background-color:lightblue;}\
.ID .JClicBtn {cursor:pointer; line-height:0;}\
.ID .JClicBtn:disabled {cursor:inherit; opacity:0.3;}\
.ID .JClicCounter {width:40px; height:20px; padding-left:20px; color:white; cursor:pointer; font-family:Roboto,Sans-serif; font-size:18px; text-align:center; background-repeat:no-repeat; background-position:left}',
    /**
     * Styles used in this skin, sized to half its regular size
     * @name DefaultSkin#mainCSSHalf
     * @type {string} */
    mainCSSHalf: '\
.ID .JClicPlayerCnt {margin:9px;}\
.ID .JClicCtrlCnt {margin:0 4px 9px 4px;}\
.ID .JClicCtrlCnt button svg,img {width:18px; height:18px;}\
.ID .JClicMsgBox {height:30px;}\
.ID .JClicCounter {width:20px; height:10px; margin-left:-15px; transform:scale(0.5);}',
    /**
     * Styles used in this skin, sized to two thirds of its regular size
     * @name DefaultSkin#mainCSSTwoThirds
     * @type {string} */
    mainCSSTwoThirds: '\
.ID .JClicPlayerCnt {margin:12px;}\
.ID .JClicCtrlCnt {margin: 0 6px 12px 6px;}\
.ID .JClicCtrlCnt button svg,img {width:24px; height:24px;}\
.ID .JClicMsgBox {height:40px;}\
.ID .JClicCounter {width:27px; height:13px; margin-left:-10px; transform:scale(0.666);}',
    /**
     * Fonts used in this skin
     * @name DefaultSkin#cssFonts
     * @type {string[]} */
    cssFonts: ['Roboto'],
    //
    // Default settings for icons (can be overridden in subclasses):
    /**
     * Icon width
     * @name DefaultSkin#iconWidth
     * @type {number} */
    iconWidth: 36,
    /**
     * Icon height
     * @name DefaultSkin#iconHeight
     * @type {number} */
    iconHeight: 36,
    /**
     * Fill color for icons
     * @name DefaultSkin#iconFill
     * @type {string} */
    iconFill: '#FFFFFF',
    //
    // SVG images for action buttons
    // Based on [Google Material design Icons](https://google.github.io/material-design-icons/)
    //
    /**
     * Icon for 'previous activity' button
     * @name DefaultSkin#prevIcon
     * @type {string} */
    prevIcon: '<svg fill="#FFFFFF" viewBox="0 0 24 24" width="36" height="36" xmlns="http://www.w3.org/2000/svg">\
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>\
</svg>',
    /**
     * Icon for 'next activity' button
     * @name DefaultSkin#nextIcon
     * @type {string} */
    nextIcon: '<svg fill="#FFFFFF" viewBox="0 0 24 24" width="36" height="36" xmlns="http://www.w3.org/2000/svg">\
<path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>\
</svg>',
    /**
     * Full screen on icon
     * @name DefaultSkin#fullScreenIcon
     * @type {string} */
    fullScreenIcon: '<svg fill="#FFFFFF" viewBox="0 0 24 24" width="36" height="36" xmlns="http://www.w3.org/2000/svg">\
<path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/>\
</svg>',
    /**
     * Full screen off icon
     * @name DefaultSkin#fullScreenExitIcon
     * @type {string} */
    fullScreenExitIcon: '<svg fill="#FFFFFF" viewBox="0 0 24 24" width="36" height="36" xmlns="http://www.w3.org/2000/svg">\
<path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/>\
</svg>',
    /**
     * Close button
     * @name DefaultSkin#closeIcon
     * @type {string} */
    closeIcon: '<svg fill="#FFFFFF" viewBox="0 0 24 24" width="36" height="36" xmlns="http://www.w3.org/2000/svg">\
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>\
</svg>',
    /**
     * Info button
     * @name DefaultSkin#infoIcon
     * @type {string} */
    infoIcon: '<svg fill="#FFFFFF" viewBox="0 0 24 24" width="36" height="36" xmlns="http://www.w3.org/2000/svg">\
<path d="M11 17h2v-6h-2v6zm1-15C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zM11 9h2V7h-2v2z"/>\
</svg>',
    /**
     * Reports button
     * @name DefaultSkin#reportsIcon
     * @type {string} */
    reportsIcon: '<svg fill="#FFFFFF" viewBox="0 0 24 24" width="36" height="36" xmlns="http://www.w3.org/2000/svg">\
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z"/>\
</svg>',
    //
    // Settings for counters:
    /**
     * Counter icon width
     * @name DefaultSkin#counterIconWidth
     * @type {number} */
    counterIconWidth: 18,
    /**
     * Counter icon height
     * @name DefaultSkin#counterIconHeight
     * @type {number} */
    counterIconHeight: 18,
    /**
     * Counter icon fill color
     * @name DefaultSkin#counterIconFill
     * @type {string} */
    counterIconFill: '#FFFFFF',
    // Counters:
    /**
     * Time icon
     * @name DefaultSkin#timeIcon
     * @type {string} */
    timeIcon: '<svg fill="#FFFFFF" viewBox="0 0 24 24" width="18" height="18" xmlns="http://www.w3.org/2000/svg">\
<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/>\
<path d="M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"/>\
</svg>',
    /**
     * Score icon
     * @name DefaultSkin#scoreIcon
     * @type {string} */
    scoreIcon: '<svg fill="#FFFFFF" viewBox="0 0 24 24" width="18" height="18" xmlns="http://www.w3.org/2000/svg">\
<path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>\
</svg>',
    /**
     * Actions icon
     * @name DefaultSkin#actionsIcon
     * @type {string} */
    actionsIcon: '<svg fill="#FFFFFF" viewBox="0 0 24 24" width="18" height="18" xmlns="http://www.w3.org/2000/svg">\
<path d="M13.49 5.48c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm-3.6 13.9l1-4.4 2.1 2v6h2v-7.5l-2.1-2 .6-3c1.3 1.5 3.3 2.5 5.5 2.5v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1l-5.2 2.2v4.7h2v-3.4l1.8-.7-1.6 8.1-4.9-1-.4 2 7 1.4z"/>\
</svg>'
  });

  // Register this class in the list of available skins
  Skin.CLASSES['default'] = DefaultSkin;

  return DefaultSkin;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 67 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(26);
// eslint-disable-next-line no-prototype-builtins
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  return cof(it) == 'String' ? it.split('') : Object(it);
};

/***/ }),
/* 68 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


exports.f = {}.propertyIsEnumerable;

/***/ }),
/* 69 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// getting tag from 19.1.3.6 Object.prototype.toString()
var cof = __webpack_require__(26);
var TAG = __webpack_require__(8)('toStringTag');
// ES3 wrong here
var ARG = cof(function () {
  return arguments;
}()) == 'Arguments';

// fallback for IE11 Script Access Denied error
var tryGet = function tryGet(it, key) {
  try {
    return it[key];
  } catch (e) {/* empty */}
};

module.exports = function (it) {
  var O, T, B;
  return it === undefined ? 'Undefined' : it === null ? 'Null'
  // @@toStringTag case
  : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
  // builtinTag case
  : ARG ? cof(O)
  // ES3 arguments fallback
  : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
};

/***/ }),
/* 70 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

// 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.

// NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.

function isArray(arg) {
  if (Array.isArray) {
    return Array.isArray(arg);
  }
  return objectToString(arg) === '[object Array]';
}
exports.isArray = isArray;

function isBoolean(arg) {
  return typeof arg === 'boolean';
}
exports.isBoolean = isBoolean;

function isNull(arg) {
  return arg === null;
}
exports.isNull = isNull;

function isNullOrUndefined(arg) {
  return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;

function isNumber(arg) {
  return typeof arg === 'number';
}
exports.isNumber = isNumber;

function isString(arg) {
  return typeof arg === 'string';
}
exports.isString = isString;

function isSymbol(arg) {
  return (typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'symbol';
}
exports.isSymbol = isSymbol;

function isUndefined(arg) {
  return arg === void 0;
}
exports.isUndefined = isUndefined;

function isRegExp(re) {
  return objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;

function isObject(arg) {
  return (typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'object' && arg !== null;
}
exports.isObject = isObject;

function isDate(d) {
  return objectToString(d) === '[object Date]';
}
exports.isDate = isDate;

function isError(e) {
  return objectToString(e) === '[object Error]' || e instanceof Error;
}
exports.isError = isError;

function isFunction(arg) {
  return typeof arg === 'function';
}
exports.isFunction = isFunction;

function isPrimitive(arg) {
  return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || (typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'symbol' || // ES6 symbol
  typeof arg === 'undefined';
}
exports.isPrimitive = isPrimitive;

exports.isBuffer = Buffer.isBuffer;

function objectToString(o) {
  return Object.prototype.toString.call(o);
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(38).Buffer))

/***/ }),
/* 71 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* global Promise */


// load the global object first:
// - it should be better integrated in the system (unhandledRejection in node)
// - the environment may have a custom Promise implementation (see zone.js)

var ES6Promise = null;
if (typeof Promise !== "undefined") {
    ES6Promise = Promise;
} else {
    ES6Promise = __webpack_require__(448);
}

/**
 * Let the user use/change some implementations.
 */
module.exports = {
    Promise: ES6Promise
};

/***/ }),
/* 72 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

var EventEmitter = function () {
  function EventEmitter() {
    _classCallCheck(this, EventEmitter);

    this.observers = {};
  }

  EventEmitter.prototype.on = function on(events, listener) {
    var _this = this;

    events.split(' ').forEach(function (event) {
      _this.observers[event] = _this.observers[event] || [];
      _this.observers[event].push(listener);
    });
  };

  EventEmitter.prototype.off = function off(event, listener) {
    var _this2 = this;

    if (!this.observers[event]) {
      return;
    }

    this.observers[event].forEach(function () {
      if (!listener) {
        delete _this2.observers[event];
      } else {
        var index = _this2.observers[event].indexOf(listener);
        if (index > -1) {
          _this2.observers[event].splice(index, 1);
        }
      }
    });
  };

  EventEmitter.prototype.emit = function emit(event) {
    for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      args[_key - 1] = arguments[_key];
    }

    if (this.observers[event]) {
      var cloned = [].concat(this.observers[event]);
      cloned.forEach(function (observer) {
        observer.apply(undefined, args);
      });
    }

    if (this.observers['*']) {
      var _cloned = [].concat(this.observers['*']);
      _cloned.forEach(function (observer) {
        var _ref;

        observer.apply(observer, (_ref = [event]).concat.apply(_ref, args));
      });
    }
  };

  return EventEmitter;
}();

exports.default = EventEmitter;

/***/ }),
/* 73 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : boxes/ActiveBoxContent.js
 *  Created : 13/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2016 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(3), __webpack_require__(2), __webpack_require__(57), __webpack_require__(97)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, AWT, Utils, BoxBase, MediaContent) {

  /**
   * This class defines a content that can be displayed by {@link ActiveBox} objects. This content
   * can be a text, an image, a fragment of an image or a combination of text and images. The style
   * (colors, font and size, borders, shadows, margins, etc.) are specified in the `bb` attribute,
   * always pointing to a {@link BoxBase} object.
   * @exports ActiveBoxContent
   * @class
   */
  var ActiveBoxContent = function () {
    /**
     * ActiveBoxContent constructor
     * @param {string=} id - An optional identifier.
     */
    function ActiveBoxContent(id) {
      _classCallCheck(this, ActiveBoxContent);

      if (typeof id !== 'undefined') this.id = id;
      this.imgAlign = { h: 'middle', v: 'middle' };
      this.txtAlign = { h: 'middle', v: 'middle' };
    }

    /**
     *
     * Loads settings from a specific JQuery XML element
     * @param {external:jQuery} $xml - The XML element to be parsed
     * @param {MediaBag} mediaBag - The media bag used to retrieve images and other media
     */


    _createClass(ActiveBoxContent, [{
      key: "setProperties",
      value: function setProperties($xml, mediaBag) {
        var _this = this;

        //
        // Read attributes
        Utils.attrForEach($xml.get(0).attributes, function (name, val) {
          switch (name) {
            case 'id':
            case 'item':
              _this[name] = Number(val);
              break;

            case 'width':
            case 'height':
              if (_this.dimension === null) _this.dimension = new AWT.Dimension(0, 0);
              _this.dimension[name] = Number(val);
              break;

            case 'txtAlign':
            case 'imgAlign':
              _this[name] = _this.readAlign(val);
              break;

            case 'hAlign':
              // Old style
              _this['txtAlign'] = _this.readAlign(val + ',center');
              _this['imgAlign'] = _this.readAlign(val + ',center');
              break;

            case 'border':
            case 'avoidOverlapping':
              _this[name] = Utils.getBoolean(val);
              break;

            case 'image':
              _this.imgName = Utils.nSlash(val);
              break;
          }
        });

        //
        // Read inner elements
        $xml.children().each(function (_n, child) {
          var $node = $(child);
          switch (child.nodeName) {
            case 'style':
              _this.bb = new BoxBase(null).setProperties($node);
              break;
            case 'media':
              _this.mediaContent = new MediaContent().setProperties($node);
              break;
            case 'p':
              if (_this.text === null) _this.text = '';else _this.text += '\n';
              _this.text += child.textContent;
              break;
          }
        });

        if (mediaBag) this.realizeContent(mediaBag);

        return this;
      }

      /**
       * Decode expressions with combined values of horizontal and vertical alignments in the form:
       * "(left|middle|right),(top|middle|bottom)"
       * @param {string} str - The string to parse
       * @returns {ActiveBoxContent~alignType}
       */

    }, {
      key: "readAlign",
      value: function readAlign(str) {
        var align = { h: 'center', v: 'center' };
        if (str) {
          var v = str.split(',');
          align.h = v[0].replace('middle', 'center');
          align.v = v[1].replace('middle', 'center');
        }
        return align;
      }

      /**
       * Checks if this is an empty content (`text` and `img` are _null_)
       */

    }, {
      key: "isEmpty",
      value: function isEmpty() {
        return this.text === null && this.img === null;
      }

      /**
       * Checks if two contents are equivalent
       * @param {ActiveBoxContent} abc - The content to compare with this.
       * @param {boolean} checkCase - When `true` the comparing will be case-sensitive.
       * @returns {boolean}
       */

    }, {
      key: "isEquivalent",
      value: function isEquivalent(abc, checkCase) {
        if (abc === this) return true;
        var result = false;
        if (abc !== null) {
          if (this.isEmpty() && abc.isEmpty()) result = this.id === abc.id;else result = (this.text === null ? abc.text === null : checkCase ? this.text === abc.text : this.text.toLocaleLowerCase() === abc.text.toLocaleLowerCase()) && (this.mediaContent === null ? abc.mediaContent === null : this.mediaContent.isEquivalent(abc.mediaContent)) && this.img === abc.img && (this.imgClip === null ? abc.imgClip === null : this.imgClip.equals(abc.imgClip));
        }
        return result;
      }

      /**
       * Sets the text content of this ActiveBox
       * @param {string} tx
       */

    }, {
      key: "setTextContent",
      value: function setTextContent(tx) {
        // only plain text allowed!
        if (tx !== null) {
          this.text = tx;
          this.checkHtmlText();
        } else {
          this.text = null;
          this.innerHtmlText = null;
        }
      }

      /**
       * Checks if cell's text uses HTML, initializing the `innerHtmlText` member as needed.
       */

    }, {
      key: "checkHtmlText",
      value: function checkHtmlText() {
        this.innerHtmlText = null;
        if (Utils.startsWith(this.text, '<html>', true)) {
          var htmlText = this.text.trim();
          var s = htmlText.toLocaleLowerCase();
          if (s.indexOf('<body') === -1) {
            var s2 = s.indexOf('</html>');
            if (s2 >= 0) this.innerHtmlText = htmlText.substr(6, s2);
          }
        }
      }

      /**
       * Sets a fragment of a main image as a graphic content of this cell.
       * Cells cannot have two graphic contents, so `imgName` (the specific image of this cell) should
       * be cleared with this setting.
       * @param {external:HTMLImageElement} img - The image data
       * @param {AWT.Shape} imgClip - A shape that clips the portion of image assigned to this content.
       * @param {string=} animatedGifFile - When `img` is an animated GIF, its file name
       */

    }, {
      key: "setImgContent",
      value: function setImgContent(img, imgClip, animatedGifFile) {
        this.img = img;
        this.imgName = null;
        this.imgClip = imgClip;
        if (animatedGifFile) this.animatedGifFile = animatedGifFile;
      }

      /**
       * Prepares the media content
       * @param {PlayStation} playStation - Usually a {@link JClicPlayer}
       */

    }, {
      key: "prepareMedia",
      value: function prepareMedia(playStation) {
        if (!this.amp && this.mediaContent && this.mediaContent.mediaType === 'PLAY_VIDEO') {
          this.amp = playStation.getActiveMediaPlayer(this.mediaContent);
          this.amp.realize();
        }
      }

      /**
       * Reads and initializes the image associated to this content
       * @param {MediaBag} mediaBag - The media bag of the current project.
       */

    }, {
      key: "realizeContent",
      value: function realizeContent(mediaBag) {
        var _this2 = this;

        if (this.imgName !== null && this.imgName.length > 0) {
          this.mbe = mediaBag.getElement(this.imgName, true);
          if (this.mbe) {
            this.mbe.build(function () {
              _this2.img = _this2.mbe.data;
              _this2.animatedGifFile = _this2.mbe.animated ? _this2.mbe.getFullPath() : null;
            });
          }
        }
        if (this.mediaContent !== null) {
          if (this.imgName === null && (this.text === null || this.text.length === 0)) {
            this.img = this.mediaContent.getIcon();
            this.animatedGifFile = null;
          }
        }
        this.checkHtmlText(mediaBag);
      }

      /**
       * Gets a string representing this content, useful for checking if two different contents are
       * equivalent.
       * @returns {string}
       */

    }, {
      key: "getDescription",
      value: function getDescription() {
        var result = this.text && this.text.length > 0 ? this.text : '';
        if (this.imgName) result = "" + result + (result.length > 0 ? ' ' : '') + Utils.getMsg('image') + " " + this.imgName;
        if (this.imgClip) result = "" + result + (result.length > 0 ? ' ' : '') + this.imgClip.toString();

        if (this.mediaContent) result = "" + result + (result.length > 0 ? ' ' : '') + this.mediaContent.getDescription();

        return result;
      }

      /**
       * 
       * Overwrites the original `Object.toString` method, returning `getDescription` instead
       * @returns {String}
       */

    }, {
      key: "toString",
      value: function toString() {
        var result = this.text && this.text.length > 0 ? this.text : '';
        if (this.imgName) result = "" + result + (result.length > 0 ? ' ' : '') + Utils.getMsg('image') + " " + this.imgName;
        if (this.imgClip) result = "" + result + (result.length > 0 ? ' ' : '') + Utils.getMsg('image fragment');

        return result;
      }
    }]);

    return ActiveBoxContent;
  }();

  Object.assign(ActiveBoxContent.prototype, {
    /**
     * The {@link BoxBase} attribute of this content. Can be `null`, meaning {@link ActiveBox} will
     * try to find a suitable style scanning down through its own BoxBase, their parent's and, finally,
     * the default values defined in `BoxBase.prototype`.
     * @name ActiveBoxContent#bb
     * @type {BoxBase} */
    bb: null,
    /**
     * Optimal dimension of any {@link ActiveBox} taking this content.
     * @name ActiveBoxContent#dimension
     * @type {AWT.Dimension} */
    dimension: null,
    /**
     * The {@link ActiveBox} can have or not a border despite the settings of {@link BoxBase}.
     * The default value `null` means not to take in consideration this setting.
     * @name ActiveBoxContent#border
     * @type {(null|boolean)} */
    border: null,
    /**
     * The text to display on the {@link ActiveBox}. It can have up to two paragraphs.
     * @name ActiveBoxContent#text
     * @type {string} */
    text: null,
    /**
     * The name of the image file to display on the {@link ActiveBox}.
     * @name ActiveBoxContent#imgName
     * @type {string} */
    imgName: null,
    /**
     * An optional shape used to clip the image.
     * @name ActiveBoxContent#imgClip
     * @type {AWT.Shape} */
    imgClip: null,
    /**
     * The media content associated with this object.
     * @name ActiveBoxContent#mediaContent
     * @type {MediaContent} */
    mediaContent: null,
    /**
     * @typedef ActiveBoxContent~alignType
     * @type {object}
     * @property {string} h - Valid values are: `left`, `middle`, `right`
     * @property {string} v - Valud values are: `top`, `middle`, `bottom` */
    /**
     * The horizontal and vertical alignment of the image inside the cell.
     * @name ActiveBoxContent#imgAlign
     * @type {ActiveBoxContent~alignType} */
    imgAlign: null,
    /**
     * The horizontal and vertical alignment of the text inside the cell.
     * Valid values are: `left`, `middle`, `right`, `top` and `bottom`.
     * @name ActiveBoxContent#txtAlign
     * @type {ActiveBoxContent~alignType} */
    txtAlign: null,
    /**
     * Whether to avoid overlapping of image and text inside the cell when both are present.
     * @name ActiveBoxContent#avoidOverlapping
     * @type {boolean} */
    avoidOverlapping: false,
    /**
     * Numeric identifier used in activities to resolve relationships between cells
     * @name ActiveBoxContent#id
     * @type {number} */
    id: -1,
    /**
     * Numeric identifier used in activities to resolve relationships between cells
     * @name ActiveBoxContent#item
     * @type {number} */
    item: -1,
    //
    // Transient properties build and modified at run-time
    /**
     * The realized image used by this box content.
     * @name ActiveBoxContent#img
     * @type {external:HTMLImageElement} */
    img: null,
    /**
     * When `img` is an animated GIF file, this field should contain its file name
     * @name ActiveBoxContent#animatedGifFile
     * @type {string} */
    animatedGifFile: null,
    /**
     * When not null, this content should be treated as an HTML element
     * @name ActiveBoxContent#innerHtmlText
     * @type {string} */
    innerHtmlText: null,
    /**
     * The {@link ActiveMediaPlayer} associated with this content. Updated at run-time.
     * @name ActiveBoxContent#amp
     * @type {ActiveMediaPlayer} */
    amp: null,
    /**
     * The {@link MediaBagElement} associated with this content, if any. Updated at run-time.
     * @name ActiveBoxContent#mbe
     * @type {MediaBagElement} */
    mbe: null
  });

  /**
   * An empty ActiveBoxContent
   * @type {ActiveBoxContent} */
  ActiveBoxContent.EMPTY_CONTENT = new ActiveBoxContent();

  return ActiveBoxContent;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 74 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : boxes/ActiveBox.js
 *  Created : 18/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(99), __webpack_require__(73), __webpack_require__(138), __webpack_require__(3), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, AbstractBox, ActiveBoxContent, ActiveBagContent, AWT, Utils) {

  /**
   * Objects of this class are widely used in JClic activities: cells in puzzles and associations,
   * messages and other objects are active boxes.
   *
   * The specific content, size and location of `ActiveBox` objects is determined by its
   * {@link ActiveBoxContent} member. Most ActiveBoxes have only one content, but some of them can
   * have a secondary or "alternative" content stored in the `altContent` field. This content is
   * used only when the `alternative` flag of the ActiveBox is `on`.
   *
   * Active boxes can host video and interactive media content (specified in the `mediaContent`
   * member of the {@link ActiveBoxContent} through its `hostedMediaPlayer` member.
   * @exports ActiveBox
   * @class
   * @extends AbstractBox
   */
  var ActiveBox = function (_AbstractBox) {
    _inherits(ActiveBox, _AbstractBox);

    /**
     * ActiveBox constructor
     * @param {?AbstractBox} parent - The AbstractBox to which this ActiveBox belongs
     * @param {?AWT.Container} container - The container where this box is placed.
     * @param {?BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
     * of this box are defined.
     * @param {number=} setIdLoc - A numeric identifier, used to locate this box in a set of sibling objects.
     * @param {AWT.Rectangle=} rect - The initial bounds of the box.
     */
    function ActiveBox(parent, container, boxBase, setIdLoc, rect) {
      _classCallCheck(this, ActiveBox);

      var _this = _possibleConstructorReturn(this, (ActiveBox.__proto__ || Object.getPrototypeOf(ActiveBox)).call(this, parent, container, boxBase));
      // ActiveBox extends AbstractBox


      _this.clear();
      if (typeof setIdLoc === 'number') {
        _this.idLoc = setIdLoc;
        _this.idAss = 0;
        _this.idOrder = 0;
      }
      if (rect) _this.setBounds(rect);
      return _this;
    }

    /**
     * Factory constructor that creates a new cell inside a JQuery DOM element.
     * @param {external:jQuery} $dom - The DOM element that will act as a container
     * @param {ActiveBoxContent} abc - The cell's content. Must not be null and have the `dimension`
     * member initialized.
     * @returns {ActiveBox}
     */


    _createClass(ActiveBox, [{
      key: "getCurrentContent",


      /**
       * Returns the current content used by the box
       * @returns {ActiveBoxContent}
       */
      value: function getCurrentContent() {
        return this.isAlternative() ? this.altContent : this.content;
      }

      /**
       * Returns the current content, creating an empty one if needed.
       * @returns {ActiveBoxContent}
       */

    }, {
      key: "getContent",
      value: function getContent() {
        if (!this.content) this.setContent(new ActiveBoxContent());
        return this.content;
      }

      /**
       * Clears the current content
       */

    }, {
      key: "clear",
      value: function clear() {
        this.content = null;
        this.altContent = null;
        this.idOrder = -1;
        this.setInactive(true);
        if (!this.hasHostedComponent) this.setHostedComponent(null);
        this.setHostedMediaPlayer(null);
        if (this.$accessibleElement) this.$accessibleElement.html('');
        if (this.tmpTrans) this.tmpTrans = false;
        this.invalidate();
      }

      /**
       * Checks if two ActiveBox objects have equivalent content
       * @param {ActiveBox} bx - The ActiveBox to check against this.
       * @param {boolean=} checkCase - When `true`, the comparing will be case-sensitive.
       * @returns {boolean} - `true` if both cells are equivalent.
       */

    }, {
      key: "isEquivalent",
      value: function isEquivalent(bx, checkCase) {
        return bx !== null && this.content !== null && this.content.isEquivalent(bx.content, checkCase);
      }

      /**
       * Same functionality as {@link ActiveBox#isEquivalent isEquivalent}, but comparing the current content.
       * @param {ActiveBox} bx - The ActiveBox to check against this.
       * @param {boolean=} checkCase - When `true`, the comparing will be case-sensitive.
       * @returns {boolean}
       */

    }, {
      key: "isCurrentContentEquivalent",
      value: function isCurrentContentEquivalent(bx, checkCase) {
        return bx !== null && this.getCurrentContent() !== null && this.getCurrentContent().isEquivalent(bx.getCurrentContent(), checkCase);
      }

      /**
       * Swaps the location of two active boxes
       * @param {ActiveBox} bx - The ActiveBox to swap with this one.
       */

    }, {
      key: "exchangeLocation",
      value: function exchangeLocation(bx) {
        var pt = new AWT.Point(this.pos),
            idLoc0 = this.idLoc;
        this.moveTo(bx.pos);
        bx.moveTo(pt);
        this.idLoc = bx.idLoc;
        bx.idLoc = idLoc0;
      }

      /**
       * Copy the content of another ActiveBox into this one
       * @param {ActiveBox} bx - The ActiveBox from which to take the content
       */

    }, {
      key: "copyContent",
      value: function copyContent(bx) {
        this.idOrder = bx.idOrder;
        this.idAss = bx.idAss;
        this.content = bx.content;
        this.altContent = bx.altContent;
        if (this.content) {
          if (this.content.bb) this.setBoxBase(this.content.bb);
          if (this.content.border !== null && bx.hasBorder() !== this.content.border) this.setBorder(this.content.border);
        }
        this.setInactive(bx.isInactive());
        this.setInverted(bx.isInverted());
        this.setAlternative(bx.isAlternative());
        this.setHostedComponent(bx.getHostedComponent());
        this.hasHostedComponent = bx.hasHostedComponent;
        this.setHostedMediaPlayer(bx.hostedMediaPlayer);
        if (this.hostedMediaPlayer) this.hostedMediaPlayer.setVisualComponentVisible(!this.isInactive() && this.isVisible());
        if (this.$accessibleElement) this.$accessibleElement.html(this.toString());
      }

      /**
       *
       * Exhanges the content of this ActiveBox with another one
       * @param {ActiveBox} bx - The ActiveBox with which to exchange the content.
       */

    }, {
      key: "exchangeContent",
      value: function exchangeContent(bx) {
        var bx0 = new ActiveBox(this.getParent(), this.getContainerX(), this.boxBase);
        bx0.copyContent(this);
        this.copyContent(bx);
        bx.copyContent(bx0);
      }

      /**
       *
       * Sets the text content of this ActiveBox.
       * @param {strint} tx - The text to set.
       */

    }, {
      key: "setTextContent",
      value: function setTextContent(tx) {
        // only plain text!
        if (!tx) tx = '';
        if (!this.content) this.content = new ActiveBoxContent();
        this.content.text = tx;
        this.content.mediaContent = null;
        this.content.img = null;

        this.setHostedComponent(null);
        this.setInactive(false);
        this.checkHostedComponent();
        this.setHostedMediaPlayer(null);

        if (this.$accessibleElement) this.$accessibleElement.html(this.toString());
      }

      /**
       * Sets the default value to `idAss`
       */

    }, {
      key: "setDefaultIdAss",
      value: function setDefaultIdAss() {
        this.idAss = this.content === null ? -1 : this.content.id;
      }

      /**
       * Checks if this ActiveBox is at its original place.
       * @returns {boolean}
       */

    }, {
      key: "isAtPlace",
      value: function isAtPlace() {
        return this.idOrder === this.idLoc;
      }

      /**
       * Sets the {@link ActiveBoxContent} of this ActiveBox
       * @param {(ActiveBoxContent|ActiveBagContent)} abc - Object containing the content to set.
       * @param {number} i - When `abc` is an {@link ActiveBagContent}, this field indicates an
       * index in the content array.
       */

    }, {
      key: "setContent",
      value: function setContent(abc, i) {
        if (abc instanceof ActiveBagContent) {
          if (i < 0) i = this.idOrder;
          if (i >= abc.getNumCells()) return;
          if (abc.bb !== this.boxBase) this.setBoxBase(abc.bb);

          // `abc` is now an [ActiveBoxContent](ActiveBoxContent.html)
          abc = abc.getActiveBoxContent(i);
        }
        this.setHostedComponent(null);
        this.setHostedMediaPlayer(null);
        this.content = abc;
        if (abc) {
          if (abc.animatedGifFile && !this.specialShape) {
            var url = "url(" + abc.animatedGifFile + ")";
            var $hc = $('<span/>').css({
              'background-image': url,
              'background-position': 'center',
              'background-repeat': 'no-repeat'
            });
            // Save background image for later use
            $hc.data('background-image', url);

            if (abc.imgClip !== null) {
              $hc.css({
                'background-origin': 'border-box',
                'background-position': -abc.imgClip.pos.x + "px " + -abc.imgClip.pos.y + "px"
                // TODO: Use background-size only when the original image must be compressed
                //,'background-size': abc.imgClip.dim.width + 'px ' + abc.imgClip.dim.height + 'px'
              });
            }
            this.setHostedComponent($hc);
          }

          if (abc.bb !== this.boxBase) this.setBoxBase(abc.bb);

          if (abc.innerHtmlText) this.setHostedComponent($('<div/>').html(abc.innerHtmlText));

          if (abc.hasOwnProperty('border') && this.hasBorder() !== abc.border) this.setBorder(abc.border);
          this.setInactive(false);
          if (abc.amp) this.setHostedMediaPlayer(abc.amp);
          this.checkHostedComponent();
          this.checkAutoStartMedia();
        } else this.clear();

        this.invalidate();
        if (this.$accessibleElement) this.$accessibleElement.html(this.toString());
      }

      /**
       * Sets the {@link ActiveBoxContent} that will act as an alternative content (`altContent` field)
       * of this ActiveBox,
       * @param {(ActiveBoxContent|ActiveBagContent)} abc - Object containing the content to set.
       * @param {number} i - When `abc` is an {@link ActiveBagContent}, this field indicates an
       * index in the content array.
       */

    }, {
      key: "setAltContent",
      value: function setAltContent(abc, i) {
        if (abc instanceof ActiveBagContent) {
          if (i < 0) i = this.idOrder;
          // `abc` is now an [ActiveBoxContent](ActiveBoxContent.html)
          abc = abc.getActiveBoxContent(i);
        }
        this.altContent = abc;
        this.checkHostedComponent();
        if (this.isAlternative() && this.hostedMediaPlayer) this.setHostedMediaPlayer(null);

        if (this.$accessibleElement) {
          this.$accessibleElement.html(this.toString());
          this.$accessibleElement.prop('disabled', true);
        }
      }

      /**
       * Sets the current content of this ActiveBox
       * @param {ActiveBoxContent} abc - The content to set.
       */

    }, {
      key: "setCurrentContent",
      value: function setCurrentContent(abc) {
        if (this.isAlternative()) this.setAltContent(abc);else this.setContent(abc);
        this.invalidate();
      }

      /**
       * Puts this ActiveBox in "alternative" mode, meaning that `altContent` will be used instead of `content`
       */

    }, {
      key: "switchToAlt",
      value: function switchToAlt() {
        if (this.isAlternative() || !this.altContent || this.altContent.isEmpty()) return false;
        this.setHostedComponent(null);
        this.setHostedMediaPlayer(null);
        this.setAlternative(true);
        this.tmpTrans = false;
        this.checkHostedComponent();
        this.checkAutoStartMedia();

        if (this.$accessibleElement) this.$accessibleElement.html(this.toString());

        return true;
      }

      /**
       * Checks the presence of content susceptible to be treated as HTML DOM embedded in this ActiveBox.
       * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Drawing_DOM_objects_into_a_canvas}
       */

    }, {
      key: "checkHostedComponent",
      value: function checkHostedComponent() {
        if (this.hasHostedComponent) return;
        var abc = this.getCurrentContent(),
            bb = this.getBoxBaseResolve();
        if (!this.isInactive() && abc && abc.innerHtmlText) bb.getCSS()['text-align'] = abc.txtAlign.h.replace('middle', 'center');
      }

      /**
       * Checks if the call has a {@link MediaContent} set to `autostart`, and launches it when found.
       */

    }, {
      key: "checkAutoStartMedia",
      value: function checkAutoStartMedia() {
        var cnt = this.getContent();
        if (cnt && cnt.mediaContent && cnt.mediaContent.autoStart && cnt.amp) {
          cnt.amp.playNow(this);
        }
      }

      /**
       * Draws the content of this Activebox on the specified canvas context.
       * @override
       * @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context used to draw the
       * box content.
       * @param {AWT.Rectangle=} dirtyRegion - The area that must be repainted. `null` refers to the whole box.
       */

    }, {
      key: "updateContent",
      value: function updateContent(ctx, dirtyRegion) {

        var abc = this.getCurrentContent(),
            bb = this.getBoxBaseResolve();

        if (this.isInactive() || !abc || this.dim.width < 2 || this.dim.height < 2) return true;

        if (dirtyRegion && !this.intersects(dirtyRegion)) return false;

        var imgRect = null;

        if (abc.img && !this.tmpTrans) {
          try {
            if (abc.imgClip) {
              var r = abc.imgClip.getBounds();
              var img = abc.img;
              if (!abc.imgClip.isRect()) {
                // Prepare a temporary `canvas` object that will contain the clipped image
                var tmpCanvas = document.createElement('canvas');
                tmpCanvas.width = r.pos.x + r.dim.width;
                tmpCanvas.height = r.pos.y + r.dim.height;
                var tmpCtx = tmpCanvas.getContext('2d');
                // Set the clipping region
                abc.imgClip.clip(tmpCtx);
                // Draw the original image
                tmpCtx.drawImage(abc.img, 0, 0);
                // Use the temporary canvas as a source image
                // (as seen on: [http://stackoverflow.com/questions/7242006/html5-copy-a-canvas-to-image-and-back])
                img = tmpCanvas;
              }
              ctx.drawImage(img, Math.max(0, r.pos.x), Math.max(0, r.pos.y), Math.min(img.width, r.dim.width), Math.min(img.height, r.dim.height), this.pos.x, this.pos.y, this.dim.width, this.dim.height);
            } else {
              var imgw = abc.img.naturalWidth || this.dim.width,
                  imgh = abc.img.naturalHeight || this.dim.height,
                  compress = false,
                  scale = 1.0;
              if (Utils.settings.COMPRESS_IMAGES && this.dim.width > 0 && this.dim.height > 0 && (imgw > this.dim.width || imgh > this.dim.height)) {

                scale = Math.min(this.dim.width / imgw, this.dim.height / imgh);
                imgw *= scale;
                imgh *= scale;
                compress = true;
              }
              var xs = abc.imgAlign.h === 'left' ? 0 : abc.imgAlign.h === 'right' ? this.dim.width - imgw : (this.dim.width - imgw) / 2;
              var ys = abc.imgAlign.v === 'top' ? 0 : abc.imgAlign.v === 'bottom' ? this.dim.height - imgh : (this.dim.height - imgh) / 2;
              if (compress) {
                ctx.drawImage(abc.img, this.pos.x + xs, this.pos.y + ys, imgw, imgh);
              } else ctx.drawImage(abc.img, this.pos.x + xs, this.pos.y + ys);

              if (abc.avoidOverlapping && abc.text) imgRect = new AWT.Rectangle(Math.max(0, xs), Math.max(0, ys), Math.min(this.dim.width, imgw), Math.min(this.dim.height, imgh));
            }
          } catch (ex) {
            Utils.log('warn', "Unable to draw image \"" + abc.imgName + "\": " + ex.message);
          }
        }
        if (abc.text && abc.text.length > 0) {
          var px = this.pos.x,
              py = this.pos.y,
              pWidth = this.dim.width,
              pHeight = this.dim.height;

          if (imgRect) {
            // There is an image in the ActiveBox
            // Try to compute the current space available for text
            var prx = [0, imgRect.pos.x, imgRect.pos.x + imgRect.dim.width, pWidth],
                pry = [0, imgRect.pos.y, imgRect.pos.y + imgRect.dim.height, pHeight],
                rr = [
            // Calc four rectangles inside BoxBag, sourronding imgRect
            // Top rectangle:
            new AWT.Rectangle(prx[0], pry[0], prx[3], pry[1]),
            // Bottom rectangle:
            new AWT.Rectangle(prx[0], pry[2], prx[3], pry[3] - pry[2]),
            // Left rectangle:
            new AWT.Rectangle(prx[0], pry[0], prx[1], pry[3]),
            // Right rectangle:
            new AWT.Rectangle(prx[2], pry[0], prx[3] - prx[2], pry[3])];
            //
            // Find the rectangle with highest surface, and in accordance
            // with the `txtAlign` values of the current
            // [ActiveBoxContent](ActiveBoxContent)
            var rmax = rr[0];
            var maxSurface = rmax.dim.width * rmax.dim.height;
            for (var i = 1; i < rr.length; i++) {
              var s = rr[i].dim.width * rr[i].dim.height;
              if (s > maxSurface - 1) {
                if (Math.abs(s - maxSurface) <= 1) {
                  var b = false;
                  switch (i) {
                    case 1:
                      b = abc.txtAlign.v === 'bottom';
                      break;
                    case 2:
                      b = abc.txtAlign.h === 'left';
                      break;
                    case 3:
                      b = abc.txtAlign.h === 'right';
                      break;
                  }
                  if (!b) continue;
                }
                maxSurface = s;
                rmax = rr[i];
              }
            }
            // Finally, this is the surface available to draw text:
            px += rmax.pos.x;
            py += rmax.pos.y;
            pWidth = rmax.dim.width;
            pHeight = rmax.dim.height;
          }

          // Calc available width and height, discounting margins
          var availWidth = Math.max(5, pWidth - 2 * bb.textMargin),
              availHeight = Math.max(5, pHeight - 2 * bb.textMargin);

          // Calc the size of each line
          var lines = bb.prepareText(ctx, abc.text, availWidth, availHeight);

          ctx.font = bb.font.cssFont();
          ctx.textBaseline = 'hanging';
          var lineHeight = bb.font.getHeight(),
              totalHeight = lineHeight * lines.length;

          // Calc the vertical co-ordinate of the first line
          // Default is 'middle'

          var y = py + bb.textMargin + (abc.txtAlign.v === 'top' ? 0 : abc.txtAlign.v === 'bottom' ? availHeight - totalHeight : (availHeight - totalHeight) / 2);

          for (var l = 0; l < lines.length; l++, y += lineHeight) {
            // Calc the horizontal position of each line
            // Default is 'middle'
            var x = px + bb.textMargin + (abc.txtAlign.h === 'left' ? 0 : abc.txtAlign.h === 'right' ? availWidth - lines[l].size.width : (availWidth - lines[l].size.width) / 2);

            if (bb.shadow) {
              // Render text shadow
              var d = Math.max(1, bb.font.size / 10);
              ctx.fillStyle = bb.shadowColor;
              ctx.fillText(lines[l].text, x + d, y + d);
            }
            // Render text
            ctx.fillStyle = this.isInverted() ? bb.backColor : this.isAlternative() ? bb.alternativeColor : bb.textColor;
            ctx.fillText(lines[l].text, x, y);
          }
        }
        return true;
      }

      /**
       * Gets the `description` field of the current {@link ActiveBoxContent}
       * @returns {string}
       */

    }, {
      key: "getDescription",
      value: function getDescription() {
        return this.content ? this.content.getDescription() : '';
      }

      /**
       * Gets a descriptive text for this ActiveBox
       * @returns {String}
       */

    }, {
      key: "toString",
      value: function toString() {
        return (this.role !== 'cell' ? Utils.getMsg(this.role) : '') + (this.getCurrentContent() || '-').toString();
      }

      /**
       * Plays the action or media associated with this ActiveBox
       * @param {PlayStation} ps - Usually, a {@link JClicPlayer}
       * @param {function[]} delayedActions - If set, store the the action in this array for future execution
       */

    }, {
      key: "playMedia",
      value: function playMedia(ps) {
        var delayedActions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

        var abc = this.getCurrentContent();
        if (abc && abc.mediaContent) {
          Utils.log('debug', "Playing: " + abc.mediaContent.toString());
          ps.playMedia(abc.mediaContent, this, delayedActions);
          return true;
        }
        return false;
      }

      /**
       * Sets the hosted media player of this ActiveBox
       * @param {ActiveMediaPlayer} amp - The media player.
       */

    }, {
      key: "setHostedMediaPlayer",
      value: function setHostedMediaPlayer(amp) {
        var old = this.hostedMediaPlayer;
        this.hostedMediaPlayer = amp;
        if (old && old !== amp) old.linkTo(null);
        if (amp) amp.linkTo(this);
      }

      /**
       * Sets a new size and/or dimension to this box.
       * @override
       * @param {(AWT.Rectangle|number)} rect - An AWT.Rectangle object, or the `x` coordinate of the
       * upper-left corner of a new rectangle.
       * @param {number=} y - `y` coordinate of the upper-left corner of the new rectangle.
       * @param {number=} w - Width of the new rectangle.
       * @param {number=} h - Height of the new rectangle.
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect, y, w, h) {
        if (typeof rect === 'number')
          // arguments are co-ordinates and size
          rect = new AWT.Rectangle(rect, y, w, h);
        // Rectangle comparision
        if (this.equals(rect)) return;
        _get(ActiveBox.prototype.__proto__ || Object.getPrototypeOf(ActiveBox.prototype), "setBounds", this).call(this, rect);
        if (this.hostedMediaPlayer) this.hostedMediaPlayer.checkVisualComponentBounds(this);
      }

      /**
       * Places and resizes {@link AbstractBox#$hostedComponent $hostedComponent}, based on the size
       * and position of this box.
       * @override
       * @param {boolean} sizeChanged - `true` when this {@link ActiveBox} has changed its size
       */

    }, {
      key: "setHostedComponentBounds",
      value: function setHostedComponentBounds(sizeChanged) {
        if (this.$hostedComponent) {
          _get(ActiveBox.prototype.__proto__ || Object.getPrototypeOf(ActiveBox.prototype), "setHostedComponentBounds", this).call(this, sizeChanged);
          var abc = this.getCurrentContent();
          if (sizeChanged && abc && abc.animatedGifFile && abc.img) {
            var img = abc.img,
                w = Math.max(img.naturalWidth, this.dim.width),
                h = Math.max(img.naturalHeight, this.dim.height);
            var scale = 1,
                bgSize = '';
            if (abc.imgClip) {
              var r = abc.imgClip.getBounds();
              if (this.dim.width < r.dim.width || this.dim.height < r.dim.height) {
                scale = Math.min(this.dim.width / r.dim.width, this.dim.height / r.dim.height);
                bgSize = w * scale + "px " + h * scale + "px";
              }
              this.$hostedComponent.css({
                'background-position': -abc.imgClip.pos.x * scale + "px " + -abc.imgClip.pos.y * scale + "px",
                'background-size': bgSize
              });
            } else {
              if (this.dim.width < w || this.dim.height < h) {
                scale = Math.min(this.dim.width / w, this.dim.height / h);
                bgSize = w * scale + "px " + h * scale + "px";
              }
              this.$hostedComponent.css({
                'background-size': bgSize
              });
            }
          }
        }
      }

      /**
       * Builds a hidden `buton` that will act as a accessible element associated to the canvas area
       * of this ActiveBox.
       * The button will be created only when `CanvasRenderingContext2D` has a method named `addHitRegion`.
       * See https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Hit_regions_and_accessibility
       * for more information and supported browsers.
       * @param {external:jQuery} $canvas - The `canvas` where this `ActiveBox` will deploy, wrapped up in a jQuery object
       * @param {external:jQuery} $clickReceiver - The DOM element that will be notified  when `$accessibleElement` is activated.
       * @param {external:jQuery=} $canvasGroup - Optional DOM element containing the accessible element. Useful to group cells in associations. When `null`, the element belongs to $canvas.
       * @param {string=} eventType - Type of event sent to $clickReceiver. Default is `click`.
       * @returns {external:jQuery} - The accessible element associated to this ActiveBox.
       */

    }, {
      key: "buildAccessibleElement",
      value: function buildAccessibleElement($canvas, $clickReceiver, $canvasGroup, eventType) {
        var _this2 = this;

        if (Utils.settings.CANVAS_HITREGIONS) {
          if (this.$accessibleElement) this.$accessibleElement.remove();

          var canvas = $canvas.get(-1);
          if (canvas.width > 0 && canvas.height > 0) {
            var id = Math.round(Math.random() * 100000),
                disabled = this.isInactive() && !this.accessibleAlwaysActive;
            this.$accessibleElement = $('<button/>', {
              tabindex: disabled ? -1 : 0,
              id: "AE" + id,
              disabled: disabled
            }).html(this.toString()).click(function (ev) {
              // Check if event was produced by a mouse click
              if (ev.originalEvent && (ev.originalEvent.pageX !== 0 || ev.originalEvent.pageY !== 0)) {
                // Mouse clicks should be processed odirectly by the canvas, so ignore this accessible event
                return true;
              }
              Utils.log('debug', "Click on accessible element: " + _this2.toString());
              var $event = $.Event(eventType || 'click'),
                  bounds = _this2.getBounds(),
                  offset = $canvas.offset();
              $event.pageX = offset.left + bounds.pos.x + bounds.dim.width / 2;
              $event.pageY = offset.top + bounds.pos.y + bounds.dim.height / 2;
              $clickReceiver.trigger($event);
              return false;
            });
            var $dest = $canvasGroup || $canvas;
            $dest.append(this.$accessibleElement);
            var elem = this.$accessibleElement.get(-1);
            try {
              var ctx = canvas.getContext('2d');
              this.shape.preparePath(ctx);
              ctx.addHitRegion({ id: "REG" + id, control: elem });
              if (Utils.settings.CANVAS_HITREGIONS_FOCUS) ctx.drawFocusIfNeeded(elem);
            } catch (ex) {
              Utils.log('error', "Unable to build accessible element for canvas in: " + this.toString() + " (" + ex + ")");
            }
          }
        }
        return this.$accessibleElement;
      }
    }], [{
      key: "createCell",
      value: function createCell($dom, abc) {
        if (abc && abc.dimension) {
          var box = new ActiveBox(),
              $canvas = $('<canvas width="' + abc.dimension.width + '" height="' + abc.dimension.height + '"/>'),
              rect = new AWT.Rectangle(0, 0, abc.dimension.width, abc.dimension.height);
          box.container = new AWT.Container();
          box.container.$div = $dom;
          box.setContent(abc);
          box.setBounds(rect);
          $dom.append($canvas);
          box.update($canvas.get(-1).getContext('2d'), rect);
          return box;
        }
      }
    }]);

    return ActiveBox;
  }(AbstractBox);

  Object.assign(ActiveBox.prototype, {
    /**
     * Identifier used to set the relative position of this box in a set.
     * @name ActiveBox#idOrder
     * @type {number} */
    idOrder: -1,
    /**
     * Identifier used to set a relative position in the space.
     * @name ActiveBox#idLoc
     * @type {number} */
    idLoc: -1,
    /**
     * Identifier used to establish relationships between cells of different sets (in associations)
     * @name ActiveBox#idAss
     * @type {number} */
    idAss: -1,
    /**
     * Backup of the original position of the cell, useful when the real position must be restored after a temporary change.
     * @name ActiveBox#pos0
     * @type {AWT.Point} */
    pos0: null,
    /**
     * Main content of this box
     * @name ActiveBox#content
     * @type {ActiveBoxContent} */
    content: null,
    /**
     * Alternative content of this box
     * @name ActiveBox#altContent
     * @type {ActiveBoxContent} */
    altContent: null,
    /**
     * Flag to check if this box has a 'hosted component'
     * @name ActiveBox#hostedComponent
     * @type {boolean} */
    hasHostedComponent: false,
    /**
     * The media player associated to this box
     * @name ActiveBox#hostedMediaPlayer
     * @type {ActiveMediaPlayer} */
    hostedMediaPlayer: null,
    /**
     * Indicates that this box is used as a background. When drawing, the clipping region must be respected.
     * @name ActiveBox#isBackground
     * @type {boolean} */
    isBackground: false
  });

  return ActiveBox;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 75 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : shapers/Rectangular.js
 *  Created : 19/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2016 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(65), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Shaper, AWT) {
  /**
   *
   * This is the simplest {@link Shaper}. It divides the graphic object in a set of rectangular
   * shapes distributed in the specified number of rows and columns.
   * @exports Rectangular
   * @class
   * @extends Shaper
   */
  var Rectangular = function (_Shaper) {
    _inherits(Rectangular, _Shaper);

    /**
     * Rectangular constructor
     * @param {number} nx - Number of columns
     * @param {number} ny - Number of rows
     */
    function Rectangular(nx, ny) {
      _classCallCheck(this, Rectangular);

      return _possibleConstructorReturn(this, (Rectangular.__proto__ || Object.getPrototypeOf(Rectangular)).call(this, nx, ny));
    }

    /**
     * Builds the rectangular shapes based on the number of rows and columns
     * @override
     */


    _createClass(Rectangular, [{
      key: "buildShapes",
      value: function buildShapes() {
        var w = 1 / this.nCols,
            h = 1 / this.nRows;
        for (var y = 0; y < this.nRows; y++) {
          for (var x = 0; x < this.nCols; x++) {
            this.shapeData[y * this.nCols + x] = new AWT.Rectangle(new AWT.Point(x * w, y * h), new AWT.Dimension(w, h));
          }
        }
        this.initiated = true;
      }
    }]);

    return Rectangular;
  }(Shaper);

  Object.assign(Rectangular.prototype, {
    /**
     * Overrides same flag in {@link Shaper#rectangularShapes}
     * @name Rectangular#rectangularShapes
     * @override
     * @type {boolean} */
    rectangularShapes: true
  });

  // Register this class in the list of known shapers
  Shaper.CLASSES['@Rectangular'] = Rectangular;

  return Rectangular;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 76 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/text/TextActivityBase.js
 *  Created : 16/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define, setTimeout, clearTimeout */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(3), __webpack_require__(74), __webpack_require__(57)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, AWT, ActiveBox, BoxBase) {

  /**
   * This class and its visual component {@link TextActivityBasePanel} are the base for text
   * activities like {@link FillInBlanks}, {@link IdentifyText}, {@link OrderText} and {@link Complete}.
   * @exports TextActivityBase
   * @class
   * @extends Activity
   */
  var TextActivityBase = function (_Activity) {
    _inherits(TextActivityBase, _Activity);

    /**
     * TextActivityBase constructor
     * @param {JClicProject} project - The project to which this activity belongs
     */
    function TextActivityBase(project) {
      _classCallCheck(this, TextActivityBase);

      return _possibleConstructorReturn(this, (TextActivityBase.__proto__ || Object.getPrototypeOf(TextActivityBase)).call(this, project));
    }

    /**
     * Retrieves the minimum number of actions needed to solve this activity
     * @override
     * @returns {number}
     */


    _createClass(TextActivityBase, [{
      key: "getMinNumActions",
      value: function getMinNumActions() {
        return this.document ? this.document.numTargets : 0;
      }
    }]);

    return TextActivityBase;
  }(Activity);

  Object.assign(TextActivityBase.prototype, {
    /**
     * This is the object used to evaluate user's answers in text activities.
     * @name TextActivityBase#ev
     * @type {Evaluator} */
    ev: null,
    /**
     * This is the label used by text activities for the `check` button, when present.
     * @name TextActivityBase#checkButtonText
     * @type {string} */
    checkButtonText: null,
    /**
     * When `true`, a text will be shown before the beginning of the activity.
     * @name TextActivityBase#prevScreen
     * @type {boolean} */
    prevScreen: false,
    /**
     * Optional text to be shown before the beginning of the activity. When `null`, this text is
     * the main document.
     * @name TextActivityBase#prevScreenText
     * @type {string} */
    prevScreenText: null,
    /**
     * The style of the optional text to be shown before the beginning of the activity.
     * @name TextActivityBase#prevScreenStyle
     * @type {BoxBase} */
    prevScreenStyle: null,
    /**
     * Maximum amount of time for showing the previous document.
     * @name TextActivityBase#prevScreenMaxTime
     * @type {number} */
    prevScreenMaxTime: -1
  });

  /**
   * The {@link ActivityPanel} where text activities (based on {@link TextActivityBase}) are played.
   * @class
   * @extends ActivityPanel
   */

  var TextActivityBasePanel = function (_Activity$Panel) {
    _inherits(TextActivityBasePanel, _Activity$Panel);

    /**
     * TextActivityBasePanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function TextActivityBasePanel(act, ps, $div) {
      _classCallCheck(this, TextActivityBasePanel);

      var _this2 = _possibleConstructorReturn(this, (TextActivityBasePanel.__proto__ || Object.getPrototypeOf(TextActivityBasePanel)).call(this, act, ps, $div));

      _this2.targets = [];
      return _this2;
    }

    /**
     * Fills a jQuery DOM element (usually a 'div') with the specified {@link TextActivityDocument}.
     * @param {external:jQuery} $div - The jQuery DOM object to be filled with the document.
     * @param {TextActivityDocument} doc - The document
     */


    _createClass(TextActivityBasePanel, [{
      key: "setDocContent",
      value: function setDocContent($div, doc) {
        var _this3 = this;

        // Empties the container of any pre-existing content
        // and sets the background and other attributes indicated by the main
        // style of the document.
        // It also sets the 'overflow' CSS attribute to 'auto', which will display a
        // vertical scroll bar when needed
        $div.empty().css(doc.style['default'].css).css({ display: 'flex', 'flex-direction': 'column' });

        var $scroller = $('<div/>').css({ 'flex-grow': 1, overflow: 'auto' });
        var $doc = $('<div/>', { class: 'JClicTextDocument' }).css({ 'padding': 4 }).css(doc.style['default'].css);

        var currentPStyle = null;
        var popupSpans = [];

        //
        // Process paragraphs
        doc.p.forEach(function (p) {
          // Creates a new DOM paragraph
          var $p = $('<p/>').css({ margin: 0 });
          var empty = true;

          // Check if the paragraph has its own style
          if (p.style) {
            currentPStyle = doc.style[p.style].css;
            $p.css(currentPStyle);
          } else currentPStyle = null;

          // Check if the paragraph has a special alignment
          if (p.Alignment) {
            var al = Number(p.Alignment);
            $p.css({ 'text-align': al === 1 ? 'center' : al === 2 ? 'right' : 'left' });
          }

          // Process the paragraph elements
          p.elements.forEach(function (element) {
            // Elements will be inserted as 'span' DOM elements, or as simple text if they don't
            // have specific attributes.
            var $span = $('<span/>');
            switch (element.objectType) {
              case 'text':
                if (element.attr) {
                  // Text uses a specific style and/or individual attributes
                  $span.html(element.text);
                  if (element.attr.style) {
                    $span.css(doc.style[element.attr.style].css);
                  }
                  if (element.attr.css) {
                    $span.css(element.attr.css);
                  }
                  $p.append($span);
                } else {
                  $p.append(element.text);
                }
                break;

              case 'cell':
                // Create a new ActiveBox based on this ActiveBoxContent
                var box = ActiveBox.createCell($span.css({ position: 'relative' }), element);
                $span.css({ 'display': 'inline-block', 'vertical-align': 'middle' });
                if (element.mediaContent) {
                  $span.on('click', function (event) {
                    event.preventDefault();
                    _this3.ps.stopMedia(1);
                    box.playMedia(_this3.ps);
                    return false;
                  });
                }
                $p.append($span);
                break;

              case 'target':
                if (_this3.showingPrevScreen) {
                  $span.text(element.text);
                  $p.append($span);
                  break;
                }

                var target = element;
                var $popup = null;
                // Process target popups
                if (target.infoMode !== 'no_info' && target.popupContent) {
                  $popup = $('<span/>').css({ position: 'absolute', 'padding-top': '2pt', display: 'none' });
                  // Create a new ActiveBox based on popupContent
                  var popupBox = ActiveBox.createCell($popup, target.popupContent);
                  if (target.popupContent.mediaContent) {
                    $popup.on('click', function (event) {
                      event.preventDefault();
                      _this3.ps.stopMedia(1);
                      if (popupBox) popupBox.playMedia(_this3.ps);else if (target.popupContent.mediaContent) _this3.ps.playMedia(target.popupContent.mediaContent);
                      return false;
                    });
                  }
                  target.$popup = $popup;
                  // Save for later setting of top-margin
                  popupSpans.push({ p: $p, span: $popup, box: popupBox });
                }

                $span = _this3.$createTargetElement(target, $span);
                target.num = _this3.targets.length;
                target.pos = target.num;
                _this3.targets.push(target);
                if ($span) {
                  $span.css(doc.style['default'].css);
                  if (currentPStyle) $span.css(currentPStyle);
                  if (_this3.targetsMarked) {
                    if (target.attr) {
                      // Default style name for targets is 'target'
                      if (!target.attr.style) target.attr.style = 'target';
                      $span.css(doc.style[target.attr.style].css);
                      // Check if target has specific attributes
                      if (target.attr.css) $span.css(target.attr.css);
                    } else if (doc.style['target']) $span.css(doc.style['target'].css);
                  } else {
                    target.targetStatus = 'HIDDEN';
                  }

                  // Catch on-demand popups with `F1`, cancel with `Escape`
                  if ($popup !== null && target.infoMode === 'onDemand') {
                    $span.keydown(function (ev) {
                      if (ev.key === target.popupKey) {
                        ev.preventDefault();
                        _this3.showPopup($popup, target.popupMaxTime, target.popupDelay);
                      } else if (ev.key === 'Escape') {
                        ev.preventDefault();
                        _this3.showPopup(null);
                      }
                    });
                  }
                }

                if ($popup && $span) {
                  if (target.isList) $p.append($span).append($popup);else $p.append($popup).append($span);
                } else if ($span) $p.append($span);

                target.$p = $p;
                break;
            }
            empty = false;
          });
          if (empty)
            // Don't leave paragraphs empty
            $p.html('&nbsp;');

          // Adds the paragraph to the DOM element
          $doc.append($p);
        });

        $div.append($scroller.append($doc));

        if (this.act.checkButtonText && !this.showingPrevScreen) {
          this.$checkButton = $('<button/>', { class: 'StockBtn' }).html(this.act.checkButtonText).css({ width: '100%', 'flex-shrink': 0 }).on('click', function () {
            return _this3.evaluatePanel();
          });
          $div.append(this.$checkButton);
        }

        // Place popups below its target baseline
        popupSpans.forEach(function (pspan) {
          return pspan.span.css({ 'margin-top': pspan.p.css('font-size') });
        });

        // Init Evaluator
        if (this.act.ev) this.act.ev.init(this.act.project.settings.locales);

        return $div;
      }

      /**
       * Creates a target DOM element.
       * This method can be overridden in subclasses to create specific types of targets.
       * @param {TextActivityDocument.TextTarget} target - The target related to the DOM object to be created
       * @param {external:jQuery} $span -  - An initial DOM object (usually a `span`) that can be used
       * to store the target, or replaced by another type of object.
       * @returns {external:jQuery} - The jQuery DOM element loaded with the target data.
       */

    }, {
      key: "$createTargetElement",
      value: function $createTargetElement(target, $span) {
        $span.text(target.text);
        target.$span = $span;
        return $span;
      }

      /**
       * Basic initialization procedure, common to all activities.
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        if (this.act.prevScreen) this.preInitActivity();else this.startActivity();
      }

      /**
       * Called when the activity starts playing
       * @override
       */

    }, {
      key: "startActivity",
      value: function startActivity() {
        _get(TextActivityBasePanel.prototype.__proto__ || Object.getPrototypeOf(TextActivityBasePanel.prototype), "initActivity", this).call(this);
        this.setAndPlayMsg('initial', 'start');
        this.setDocContent(this.$div, this.act.document);
        this.playing = true;
      }

      /**
       * Called when the text activity has a 'previous screen' information to be shown before the
       * activity starts
       */

    }, {
      key: "preInitActivity",
      value: function preInitActivity() {
        var _this4 = this;

        if (!this.act.prevScreen) return;

        var prevScreenEnd = function prevScreenEnd() {
          _this4.showingPrevScreen = false;
          _this4.$div.unbind('click');
          if (_this4.prevScreenTimer) {
            clearTimeout(_this4.prevScreenTimer);
            _this4.prevScreenTimer = null;
          }
          _this4.startActivity();
          return true;
        };

        this.showingPrevScreen = true;
        this.$div.empty();

        if (!this.act.prevScreenText) {
          this.setDocContent(this.$div, this.act.document);
        } else {
          if (!this.act.prevScreenStyle) this.act.prevScreenStyle = new BoxBase();
          this.$div.css(this.act.prevScreenStyle.getCSS()).css('overflow', 'auto');
          var $html = $('<div/>', { class: 'JClicTextDocument' }).css({ 'padding': 4 }).css(this.act.prevScreenStyle.getCSS()).append(this.act.prevScreenText);
          this.$div.append($html);
        }

        this.enableCounters(true, false, false);
        this.ps.setCounterValue('time', 0);

        this.ps.setMsg(this.act.messages['previous']);

        if (this.act.prevScreenMaxTime > 0) {
          this.ps.setCountDown('time', this.act.prevScreenMaxTime);
          this.prevScreenTimer = setTimeout(prevScreenEnd, this.act.prevScreenMaxTime * 1000);
        }

        this.$div.on('click', prevScreenEnd);
        this.ps.playMsg();
      }

      /**
       * Called when the user clicks on the check button
       * @returns {boolean} - `true` when the panel is OK, `false` otherwise.
       */

    }, {
      key: "evaluatePanel",
      value: function evaluatePanel() {
        this.finishActivity(true);
        return true;
      }

      /**
       * Ordinary ending of the activity, usually called form `processEvent`
       * @override
       * @param {boolean} result - `true` if the activity was successfully completed, `false` otherwise
       */

    }, {
      key: "finishActivity",
      value: function finishActivity(result) {
        if (this.$checkButton) this.$checkButton.prop('disabled', true);
        this.targets.forEach(function (t) {
          if (t.$comboList) t.$comboList.attr('disabled', true);
        });
        this.showPopup(null);
        _get(TextActivityBasePanel.prototype.__proto__ || Object.getPrototypeOf(TextActivityBasePanel.prototype), "finishActivity", this).call(this, result);
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events
       * @override
       * @param {HTMLEvent} _event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(_event) {
        return this.playing;
      }

      /**
       * @param {external:jQuery} $popup - The popup to display, or _null _ to just hide the current popup
       * @param {number} maxTime - The maximum time to mantain the popup on screen, in seconds
       * @param {number} waitTime - When set, indicates the number of seconds to wait before show the popup
       */

    }, {
      key: "showPopup",
      value: function showPopup($popup, maxTime, waitTime) {
        var _this5 = this;

        // Hide current popup
        if (this.$currentPopup) {
          this.$currentPopup.css({ display: 'none' });
          this.$currentPopup = null;
          if (this.currentPopupTimer) {
            window.clearTimeout(this.currentPopupTimer);
            this.currentPopupTimer = 0;
          }
        }

        // Clear popupWaitTimer
        if (this.popupWaitTimer) {
          window.clearTimeout(this.popupWaitTimer);
          this.popupWaitTimer = 0;
        }

        // Prepare popup timer
        if (waitTime) {
          this.popupWaitTimer = window.setTimeout(function () {
            _this5.showPopup($popup, maxTime);
          }, waitTime * 1000);
          return;
        }

        if ($popup) {
          $popup.css({ display: '' });
          $popup.click();

          this.$currentPopup = $popup;
          if (maxTime) {
            this.currentPopupTimer = window.setTimeout(function () {
              $popup.css({ display: 'none' });
              if (_this5.$currentPopup === $popup) {
                _this5.$currentPopup = null;
                _this5.currentPopupTimer = 0;
              }
            }, maxTime * 1000);
          }
        }
      }
    }]);

    return TextActivityBasePanel;
  }(Activity.Panel);

  Object.assign(TextActivityBasePanel.prototype, {
    /**
     * Array of jQuery DOM elements (usually of type 'span') containing the targets of this activity
     * @name TextActivityBasePanel#targets
     * @type {external:jQuery[]} */
    targets: null,
    /**
     * Flag indicating if targets must be visually marked at the beginning of the activity.
     * Should be `true` except for {@link IdentifyText} activities.
     * @name TextActivityBasePanel#targetsMarked
     * @type {boolean} */
    targetsMarked: true,
    /**
     * The button used to check the activity, only when `Activity.checkButtonText` is not null
     * @name TextActivityBasePanel#$checkButton
     * @type {external:jQuery}*/
    $checkButton: null,
    /**
     * System timer used to close the previous document when act.maxTime is reached.
     * @name TextActivityBasePanel#prevScreenTimer
     * @type {number} */
    prevScreenTimer: null,
    /**
     * The popup currently been displayed
     * @name TextActivityBasePanel#$currentPopup
     * @type {external:jQuery} */
    $currentPopup: null,
    /**
     * A timer controlling the time the current popup will be displayed
     * @name TextActivityBasePanel#currentPopupTimer
     * @type {number} */
    currentPopupTimer: 0,
    /**
     * A timer prepared to display a popup after a while
     * @name TextActivityBasePanel#popupWaitTimer
     * @type {number} */
    popupWaitTimer: 0
  });

  /**
   * Panel class associated to this type of activity: {@link TextActivityBasePanel}
   * @type {class} */
  TextActivityBase.Panel = TextActivityBasePanel;

  return TextActivityBase;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 77 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var global = __webpack_require__(5);
var SHARED = '__core-js_shared__';
var store = global[SHARED] || (global[SHARED] = {});
module.exports = function (key) {
  return store[key] || (store[key] = {});
};

/***/ }),
/* 78 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// false -> Array#indexOf
// true  -> Array#includes
var toIObject = __webpack_require__(20);
var toLength = __webpack_require__(12);
var toAbsoluteIndex = __webpack_require__(48);
module.exports = function (IS_INCLUDES) {
  return function ($this, el, fromIndex) {
    var O = toIObject($this);
    var length = toLength(O.length);
    var index = toAbsoluteIndex(fromIndex, length);
    var value;
    // Array#includes uses SameValueZero equality algorithm
    // eslint-disable-next-line no-self-compare
    if (IS_INCLUDES && el != el) while (length > index) {
      value = O[index++];
      // eslint-disable-next-line no-self-compare
      if (value != value) return true;
      // Array#indexOf ignores holes, Array#includes - not
    } else for (; length > index; index++) {
      if (IS_INCLUDES || index in O) {
        if (O[index] === el) return IS_INCLUDES || index || 0;
      }
    }return !IS_INCLUDES && -1;
  };
};

/***/ }),
/* 79 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


exports.f = Object.getOwnPropertySymbols;

/***/ }),
/* 80 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 7.2.2 IsArray(argument)
var cof = __webpack_require__(26);
module.exports = Array.isArray || function isArray(arg) {
  return cof(arg) == 'Array';
};

/***/ }),
/* 81 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 7.2.8 IsRegExp(argument)
var isObject = __webpack_require__(7);
var cof = __webpack_require__(26);
var MATCH = __webpack_require__(8)('match');
module.exports = function (it) {
  var isRegExp;
  return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
};

/***/ }),
/* 82 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var ITERATOR = __webpack_require__(8)('iterator');
var SAFE_CLOSING = false;

try {
  var riter = [7][ITERATOR]();
  riter['return'] = function () {
    SAFE_CLOSING = true;
  };
  // eslint-disable-next-line no-throw-literal
  Array.from(riter, function () {
    throw 2;
  });
} catch (e) {/* empty */}

module.exports = function (exec, skipClosing) {
  if (!skipClosing && !SAFE_CLOSING) return false;
  var safe = false;
  try {
    var arr = [7];
    var iter = arr[ITERATOR]();
    iter.next = function () {
      return { done: safe = true };
    };
    arr[ITERATOR] = function () {
      return iter;
    };
    exec(arr);
  } catch (e) {/* empty */}
  return safe;
};

/***/ }),
/* 83 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// 21.2.5.3 get RegExp.prototype.flags

var anObject = __webpack_require__(4);
module.exports = function () {
  var that = anObject(this);
  var result = '';
  if (that.global) result += 'g';
  if (that.ignoreCase) result += 'i';
  if (that.multiline) result += 'm';
  if (that.unicode) result += 'u';
  if (that.sticky) result += 'y';
  return result;
};

/***/ }),
/* 84 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var hide = __webpack_require__(17);
var redefine = __webpack_require__(18);
var fails = __webpack_require__(6);
var defined = __webpack_require__(30);
var wks = __webpack_require__(8);

module.exports = function (KEY, length, exec) {
  var SYMBOL = wks(KEY);
  var fns = exec(defined, SYMBOL, ''[KEY]);
  var strfn = fns[0];
  var rxfn = fns[1];
  if (fails(function () {
    var O = {};
    O[SYMBOL] = function () {
      return 7;
    };
    return ''[KEY](O) != 7;
  })) {
    redefine(String.prototype, KEY, strfn);
    hide(RegExp.prototype, SYMBOL, length == 2
    // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
    // 21.2.5.11 RegExp.prototype[@@split](string, limit)
    ? function (string, arg) {
      return rxfn.call(string, this, arg);
    }
    // 21.2.5.6 RegExp.prototype[@@match](string)
    // 21.2.5.9 RegExp.prototype[@@search](string)
    : function (string) {
      return rxfn.call(string, this);
    });
  }
};

/***/ }),
/* 85 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 7.3.20 SpeciesConstructor(O, defaultConstructor)
var anObject = __webpack_require__(4);
var aFunction = __webpack_require__(15);
var SPECIES = __webpack_require__(8)('species');
module.exports = function (O, D) {
  var C = anObject(O).constructor;
  var S;
  return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
};

/***/ }),
/* 86 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var global = __webpack_require__(5);
var $export = __webpack_require__(0);
var redefine = __webpack_require__(18);
var redefineAll = __webpack_require__(54);
var meta = __webpack_require__(39);
var forOf = __webpack_require__(53);
var anInstance = __webpack_require__(52);
var isObject = __webpack_require__(7);
var fails = __webpack_require__(6);
var $iterDetect = __webpack_require__(82);
var setToStringTag = __webpack_require__(59);
var inheritIfRequired = __webpack_require__(107);

module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
  var Base = global[NAME];
  var C = Base;
  var ADDER = IS_MAP ? 'set' : 'add';
  var proto = C && C.prototype;
  var O = {};
  var fixMethod = function fixMethod(KEY) {
    var fn = proto[KEY];
    redefine(proto, KEY, KEY == 'delete' ? function (a) {
      return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
    } : KEY == 'has' ? function has(a) {
      return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
    } : KEY == 'get' ? function get(a) {
      return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
    } : KEY == 'add' ? function add(a) {
      fn.call(this, a === 0 ? 0 : a);return this;
    } : function set(a, b) {
      fn.call(this, a === 0 ? 0 : a, b);return this;
    });
  };
  if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
    new C().entries().next();
  }))) {
    // create collection constructor
    C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
    redefineAll(C.prototype, methods);
    meta.NEED = true;
  } else {
    var instance = new C();
    // early implementations not supports chaining
    var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
    // V8 ~  Chromium 40- weak-collections throws on primitives, but should return false
    var THROWS_ON_PRIMITIVES = fails(function () {
      instance.has(1);
    });
    // most early implementations doesn't supports iterables, most modern - not close it correctly
    var ACCEPT_ITERABLES = $iterDetect(function (iter) {
      new C(iter);
    }); // eslint-disable-line no-new
    // for early implementations -0 and +0 not the same
    var BUGGY_ZERO = !IS_WEAK && fails(function () {
      // V8 ~ Chromium 42- fails only with 5+ elements
      var $instance = new C();
      var index = 5;
      while (index--) {
        $instance[ADDER](index, index);
      }return !$instance.has(-0);
    });
    if (!ACCEPT_ITERABLES) {
      C = wrapper(function (target, iterable) {
        anInstance(target, C, NAME);
        var that = inheritIfRequired(new Base(), target, C);
        if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
        return that;
      });
      C.prototype = proto;
      proto.constructor = C;
    }
    if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
      fixMethod('delete');
      fixMethod('has');
      IS_MAP && fixMethod('get');
    }
    if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
    // weak collections should not contains .clear method
    if (IS_WEAK && proto.clear) delete proto.clear;
  }

  setToStringTag(C, NAME);

  O[NAME] = C;
  $export($export.G + $export.W + $export.F * (C != Base), O);

  if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);

  return C;
};

/***/ }),
/* 87 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var global = __webpack_require__(5);
var hide = __webpack_require__(17);
var uid = __webpack_require__(45);
var TYPED = uid('typed_array');
var VIEW = uid('view');
var ABV = !!(global.ArrayBuffer && global.DataView);
var CONSTR = ABV;
var i = 0;
var l = 9;
var Typed;

var TypedArrayConstructors = 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array'.split(',');

while (i < l) {
  if (Typed = global[TypedArrayConstructors[i++]]) {
    hide(Typed.prototype, TYPED, true);
    hide(Typed.prototype, VIEW, true);
  } else CONSTR = false;
}

module.exports = {
  ABV: ABV,
  CONSTR: CONSTR,
  TYPED: TYPED,
  VIEW: VIEW
};

/***/ }),
/* 88 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// Forced replacement prototype accessors methods

module.exports = __webpack_require__(46) || !__webpack_require__(6)(function () {
  var K = Math.random();
  // In FF throws only define methods
  // eslint-disable-next-line no-undef, no-useless-call
  __defineSetter__.call(null, K, function () {/* empty */});
  delete __webpack_require__(5)[K];
});

/***/ }),
/* 89 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://tc39.github.io/proposal-setmap-offrom/

var $export = __webpack_require__(0);

module.exports = function (COLLECTION) {
  $export($export.S, COLLECTION, { of: function of() {
      var length = arguments.length;
      var A = new Array(length);
      while (length--) {
        A[length] = arguments[length];
      }return new this(A);
    } });
};

/***/ }),
/* 90 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://tc39.github.io/proposal-setmap-offrom/

var $export = __webpack_require__(0);
var aFunction = __webpack_require__(15);
var ctx = __webpack_require__(25);
var forOf = __webpack_require__(53);

module.exports = function (COLLECTION) {
  $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
      var mapFn = arguments[1];
      var mapping, A, n, cb;
      aFunction(this);
      mapping = mapFn !== undefined;
      if (mapping) aFunction(mapFn);
      if (source == undefined) return new this();
      A = [];
      if (mapping) {
        n = 0;
        cb = ctx(mapFn, arguments[2], 2);
        forOf(source, false, function (nextItem) {
          A.push(cb(nextItem, n++));
        });
      } else {
        forOf(source, false, A.push, A);
      }
      return new this(A);
    } });
};

/***/ }),
/* 91 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 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.

module.exports = Stream;

var EE = __webpack_require__(92).EventEmitter;
var inherits = __webpack_require__(64);

inherits(Stream, EE);
Stream.Readable = __webpack_require__(425);
Stream.Writable = __webpack_require__(430);
Stream.Duplex = __webpack_require__(431);
Stream.Transform = __webpack_require__(432);
Stream.PassThrough = __webpack_require__(433);

// Backwards-compat with node 0.4.x
Stream.Stream = Stream;

// old-style streams.  Note that the pipe method (the only relevant
// part of this class) is overridden in the Readable class.

function Stream() {
  EE.call(this);
}

Stream.prototype.pipe = function (dest, options) {
  var source = this;

  function ondata(chunk) {
    if (dest.writable) {
      if (false === dest.write(chunk) && source.pause) {
        source.pause();
      }
    }
  }

  source.on('data', ondata);

  function ondrain() {
    if (source.readable && source.resume) {
      source.resume();
    }
  }

  dest.on('drain', ondrain);

  // If the 'end' option is not supplied, dest.end() will be called when
  // source gets the 'end' or 'close' events.  Only dest.end() once.
  if (!dest._isStdio && (!options || options.end !== false)) {
    source.on('end', onend);
    source.on('close', onclose);
  }

  var didOnEnd = false;
  function onend() {
    if (didOnEnd) return;
    didOnEnd = true;

    dest.end();
  }

  function onclose() {
    if (didOnEnd) return;
    didOnEnd = true;

    if (typeof dest.destroy === 'function') dest.destroy();
  }

  // don't leave dangling pipes when there are errors.
  function onerror(er) {
    cleanup();
    if (EE.listenerCount(this, 'error') === 0) {
      throw er; // Unhandled stream error in pipe.
    }
  }

  source.on('error', onerror);
  dest.on('error', onerror);

  // remove all the event listeners that were added.
  function cleanup() {
    source.removeListener('data', ondata);
    dest.removeListener('drain', ondrain);

    source.removeListener('end', onend);
    source.removeListener('close', onclose);

    source.removeListener('error', onerror);
    dest.removeListener('error', onerror);

    source.removeListener('end', cleanup);
    source.removeListener('close', cleanup);

    dest.removeListener('close', cleanup);
  }

  source.on('end', cleanup);
  source.on('close', cleanup);

  dest.on('close', cleanup);

  dest.emit('pipe', source);

  // Allow for unix-like usage: A.pipe(B).pipe(C)
  return dest;
};

/***/ }),
/* 92 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

// 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 === 'undefined' ? 'undefined' : _typeof(arg)) === 'object' && arg !== null;
}

function isUndefined(arg) {
  return arg === void 0;
}

/***/ }),
/* 93 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// shim for using process in browser
var process = module.exports = {};

// cached from whatever global is present so that test runners that stub it
// don't break things.  But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals.  It's inside a
// function because try/catches deoptimize in certain engines.

var cachedSetTimeout;
var cachedClearTimeout;

function defaultSetTimout() {
    throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout() {
    throw new Error('clearTimeout has not been defined');
}
(function () {
    try {
        if (typeof setTimeout === 'function') {
            cachedSetTimeout = setTimeout;
        } else {
            cachedSetTimeout = defaultSetTimout;
        }
    } catch (e) {
        cachedSetTimeout = defaultSetTimout;
    }
    try {
        if (typeof clearTimeout === 'function') {
            cachedClearTimeout = clearTimeout;
        } else {
            cachedClearTimeout = defaultClearTimeout;
        }
    } catch (e) {
        cachedClearTimeout = defaultClearTimeout;
    }
})();
function runTimeout(fun) {
    if (cachedSetTimeout === setTimeout) {
        //normal enviroments in sane situations
        return setTimeout(fun, 0);
    }
    // if setTimeout wasn't available but was latter defined
    if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
        cachedSetTimeout = setTimeout;
        return setTimeout(fun, 0);
    }
    try {
        // when when somebody has screwed with setTimeout but no I.E. maddness
        return cachedSetTimeout(fun, 0);
    } catch (e) {
        try {
            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
            return cachedSetTimeout.call(null, fun, 0);
        } catch (e) {
            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
            return cachedSetTimeout.call(this, fun, 0);
        }
    }
}
function runClearTimeout(marker) {
    if (cachedClearTimeout === clearTimeout) {
        //normal enviroments in sane situations
        return clearTimeout(marker);
    }
    // if clearTimeout wasn't available but was latter defined
    if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
        cachedClearTimeout = clearTimeout;
        return clearTimeout(marker);
    }
    try {
        // when when somebody has screwed with setTimeout but no I.E. maddness
        return cachedClearTimeout(marker);
    } catch (e) {
        try {
            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
            return cachedClearTimeout.call(null, marker);
        } catch (e) {
            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
            // Some versions of I.E. have different rules for clearTimeout vs setTimeout
            return cachedClearTimeout.call(this, marker);
        }
    }
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;

function cleanUpNextTick() {
    if (!draining || !currentQueue) {
        return;
    }
    draining = false;
    if (currentQueue.length) {
        queue = currentQueue.concat(queue);
    } else {
        queueIndex = -1;
    }
    if (queue.length) {
        drainQueue();
    }
}

function drainQueue() {
    if (draining) {
        return;
    }
    var timeout = runTimeout(cleanUpNextTick);
    draining = true;

    var len = queue.length;
    while (len) {
        currentQueue = queue;
        queue = [];
        while (++queueIndex < len) {
            if (currentQueue) {
                currentQueue[queueIndex].run();
            }
        }
        queueIndex = -1;
        len = queue.length;
    }
    currentQueue = null;
    draining = false;
    runClearTimeout(timeout);
}

process.nextTick = function (fun) {
    var args = new Array(arguments.length - 1);
    if (arguments.length > 1) {
        for (var i = 1; i < arguments.length; i++) {
            args[i - 1] = arguments[i];
        }
    }
    queue.push(new Item(fun, args));
    if (queue.length === 1 && !draining) {
        runTimeout(drainQueue);
    }
};

// v8 likes predictible objects
function Item(fun, array) {
    this.fun = fun;
    this.array = array;
}
Item.prototype.run = function () {
    this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};

function noop() {}

process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;

process.listeners = function (name) {
    return [];
};

process.binding = function (name) {
    throw new Error('process.binding is not supported');
};

process.cwd = function () {
    return '/';
};
process.chdir = function (dir) {
    throw new Error('process.chdir is not supported');
};
process.umask = function () {
    return 0;
};

/***/ }),
/* 94 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {

module.exports = {
    /**
     * True if this is running in Nodejs, will be undefined in a browser.
     * In a browser, browserify won't include this file and the whole module
     * will be resolved an empty object.
     */
    isNode: typeof Buffer !== "undefined",
    /**
     * Create a new nodejs Buffer from an existing content.
     * @param {Object} data the data to pass to the constructor.
     * @param {String} encoding the encoding to use.
     * @return {Buffer} a new Buffer.
     */
    newBufferFrom: function newBufferFrom(data, encoding) {
        // XXX We can't use `Buffer.from` which comes from `Uint8Array.from`
        // in nodejs v4 (< v.4.5). It's not the expected implementation (and
        // has a different signature).
        // see https://github.com/nodejs/node/issues/8053
        // A condition on nodejs' version won't solve the issue as we don't
        // control the Buffer polyfills that may or may not be used.
        return new Buffer(data, encoding);
    },
    /**
     * Create a new nodejs Buffer with the specified size.
     * @param {Integer} size the size of the buffer.
     * @return {Buffer} a new Buffer.
     */
    allocBuffer: function allocBuffer(size) {
        if (Buffer.alloc) {
            return Buffer.alloc(size);
        } else {
            return new Buffer(size);
        }
    },
    /**
     * Find out if an object is a Buffer.
     * @param {Object} b the object to test.
     * @return {Boolean} true if the object is a Buffer, false otherwise.
     */
    isBuffer: function isBuffer(b) {
        return Buffer.isBuffer(b);
    },

    isStream: function isStream(obj) {
        return obj && typeof obj.on === "function" && typeof obj.pause === "function" && typeof obj.resume === "function";
    }
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(38).Buffer))

/***/ }),
/* 95 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef

/***/ }),
/* 96 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.makeString = makeString;
exports.copy = copy;
exports.setPath = setPath;
exports.pushPath = pushPath;
exports.getPath = getPath;
exports.deepExtend = deepExtend;
exports.regexEscape = regexEscape;
exports.escape = escape;
function makeString(object) {
  if (object == null) return '';
  /* eslint prefer-template: 0 */
  return '' + object;
}

function copy(a, s, t) {
  a.forEach(function (m) {
    if (s[m]) t[m] = s[m];
  });
}

function getLastOfPath(object, path, Empty) {
  function cleanKey(key) {
    return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;
  }

  function canNotTraverseDeeper() {
    return !object || typeof object === 'string';
  }

  var stack = typeof path !== 'string' ? [].concat(path) : path.split('.');
  while (stack.length > 1) {
    if (canNotTraverseDeeper()) return {};

    var key = cleanKey(stack.shift());
    if (!object[key] && Empty) object[key] = new Empty();
    object = object[key];
  }

  if (canNotTraverseDeeper()) return {};
  return {
    obj: object,
    k: cleanKey(stack.shift())
  };
}

function setPath(object, path, newValue) {
  var _getLastOfPath = getLastOfPath(object, path, Object),
      obj = _getLastOfPath.obj,
      k = _getLastOfPath.k;

  obj[k] = newValue;
}

function pushPath(object, path, newValue, concat) {
  var _getLastOfPath2 = getLastOfPath(object, path, Object),
      obj = _getLastOfPath2.obj,
      k = _getLastOfPath2.k;

  obj[k] = obj[k] || [];
  if (concat) obj[k] = obj[k].concat(newValue);
  if (!concat) obj[k].push(newValue);
}

function getPath(object, path) {
  var _getLastOfPath3 = getLastOfPath(object, path),
      obj = _getLastOfPath3.obj,
      k = _getLastOfPath3.k;

  if (!obj) return undefined;
  return obj[k];
}

function deepExtend(target, source, overwrite) {
  /* eslint no-restricted-syntax: 0 */
  for (var prop in source) {
    if (prop in target) {
      // If we reached a leaf string in target or source then replace with source or skip depending on the 'overwrite' switch
      if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) {
        if (overwrite) target[prop] = source[prop];
      } else {
        deepExtend(target[prop], source[prop], overwrite);
      }
    } else {
      target[prop] = source[prop];
    }
  }
  return target;
}

function regexEscape(str) {
  /* eslint no-useless-escape: 0 */
  return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
}

/* eslint-disable */
var _entityMap = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': '&quot;',
  "'": '&#39;',
  "/": '&#x2F;'
};
/* eslint-enable */

function escape(data) {
  if (typeof data === 'string') {
    return data.replace(/[&<>"'\/]/g, function (s) {
      return _entityMap[s];
    });
  }

  return data;
}

/***/ }),
/* 97 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : media/MediaContent.js
 *  Created : 13/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(3), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, AWT, Utils) {

  /**
   * This object contains a description of any multimedia content (sound, video, MIDI, voice
   * recording..) or special actions (jump to another point in the sequence, link to an URL, etc.)
   * associated to an {@link ActiveBox} object.
   * @exports MediaContent
   * @class
   */
  var MediaContent = function () {
    /**
     * MediaContent constructor
     * @param {string} type - The type of media. Valid values are: `UNKNOWN`, `PLAY_AUDIO`, `PLAY_VIDEO`,
     * `PLAY_MIDI`, `PLAY_CDAUDIO`, `RECORD_AUDIO`, `PLAY_RECORDED_AUDIO`, `RUN_CLIC_ACTIVITY`,
     * `RUN_CLIC_PACKAGE`, `RUN_EXTERNAL`, `URL`, `EXIT` and `RETURN`
     * @param {string=} mediaFileName - Optional parameter indicating the media file name
     */
    function MediaContent(type, mediaFileName) {
      _classCallCheck(this, MediaContent);

      this.mediaType = type;
      if (mediaFileName) this.mediaFileName = mediaFileName;
    }

    /**
     * Loads the MediaContent settings from a specific JQuery XML element
     * @param {external:jQuery} $xml
     */


    _createClass(MediaContent, [{
      key: "setProperties",
      value: function setProperties($xml) {
        var _this = this;

        Utils.attrForEach($xml.get(0).attributes, function (name, val) {
          switch (name) {
            case 'type':
              _this['mediaType'] = val;
              break;
            case 'file':
              _this['mediaFileName'] = Utils.nSlash(val);
              break;
            case 'params':
              _this['externalParam'] = Utils.nSlash(val);
              break;

            case 'pFrom':
              _this['absLocationFrom'] = val;
              break;

            case 'buffer':
              _this['recBuffer'] = Number(val);
              break;
            case 'level':
            case 'from':
            case 'to':
            case 'length':
              _this[name] = Number(val);
              break;

            case 'px':
            case 'py':
              if (_this.absLocation === null) _this.absLocation = new AWT.Point(0, 0);
              if (name === 'px') _this.absLocation.x = Number(val);else _this.absLocation.y = Number(val);
              break;

            case 'stretch':
            case 'free':
            case 'catchMouseEvents':
            case 'loop':
            case 'autostart':
              _this[name] = Utils.getBoolean(val);
              break;
          }
        });
        return this;
      }

      /**
       * Compares this object with another MediaContent.
       * @param {MediaContent} mc - The Media Content to compare against to.
       * @returns {boolean} - `true` when both objects are equivalent.
       */

    }, {
      key: "isEquivalent",
      value: function isEquivalent(mc) {
        return this.mediaType === mc.mediaType && (this.mediaFileName === mc.mediaFileName || this.mediaFileName !== null && mc.mediaFileName !== null && this.mediaFileName.toLocaleLowerCase() === mc.mediaFileName.toLocaleLowerCase()) && this.from === mc.from && this.to === mc.to && this.recBuffer === mc.recBuffer;
      }

      /**
       * Gets a string representing this media content, useful for checking if two different elements
       * are equivalent.
       * @returns {string}
       */

    }, {
      key: "getDescription",
      value: function getDescription() {
        var result = "" + this.mediaType;
        if (this.mediaFileName) result = result + " " + this.mediaFileName + (this.from >= 0 ? " from:" + this.from : '') + (this.to >= 0 ? " to:" + this.to : '');else if (this.externalParam) result = result + " " + this.externalParam;
        return result;
      }

      /**
       * Returns a simplified description of this media content. Useful for accessibility methods.
       * @returns {string} 
       */

    }, {
      key: "toString",
      value: function toString() {
        return "" + this.mediaType + (this.mediaFileName ? " " + this.mediaFileName : '');
      }

      /**
       * Returns an image to be used as icon for representing this media content.
       * @returns {external:HTMLImageElement}
       */

    }, {
      key: "getIcon",
      value: function getIcon() {
        var icon = null;
        switch (this.mediaType) {
          case 'PLAY_AUDIO':
          case 'PLAY_RECORDED_AUDIO':
            icon = 'audio';
            break;
          case 'RECORD_AUDIO':
            icon = 'mic';
            break;
          case 'PLAY_VIDEO':
            icon = 'movie';
            break;
          case 'PLAY_MIDI':
            icon = 'music';
            break;
          case 'URL':
            icon = 'url';
            break;
          default:
            icon = 'default';
            break;
        }
        return icon ? MediaContent.ICONS[icon] : null;
      }
    }]);

    return MediaContent;
  }();

  Object.assign(MediaContent.prototype, {
    /**
     * The type of media. Valid values are: `UNKNOWN`, `PLAY_AUDIO`, `PLAY_VIDEO`,
     * `PLAY_MIDI`, `PLAY_CDAUDIO`, `RECORD_AUDIO`, `PLAY_RECORDED_AUDIO`, `RUN_CLIC_ACTIVITY`,
     * `RUN_CLIC_PACKAGE`, `RUN_EXTERNAL`, `URL`, `EXIT` and `RETURN`
     * @name MediaContent#mediaType
     * @type {string} */
    mediaType: 'UNKNOWN',
    /**
     * The priority level is important when different medias want to play together. Objects with
     * highest priority level can mute lower ones.
     * @name MediaContent#level
     * @type {number} */
    level: 1,
    /**
     * Media file name
     * @name MediaContent#mediaFileName
     * @type {String} */
    mediaFileName: null,
    /**
     * Optional parameters passed to external calls
     * @name MediaContent#externalParams
     * @type {string} */
    externalParam: null,
    /**
     * Special setting used to play only a fragment of media. `-1` means not used (plays full
     * length, from the beginning)
     * @name MediaContent#from
     * @type {number} */
    from: -1,
    /**
     * Special setting used to play only a fragment of media. `-1` means not used (plays to the end
     * of the media)
     * @name MediaContent#to
     * @type {number} */
    to: -1,
    /**
     * When `mediaType` is `RECORD_AUDIO`, this member stores the maximum length of the recorded
     * sound, in seconds.
     * @name MediaContent#length
     * @type {number} */
    length: 3,
    /**
     * When `mediaType` is `RECORD_AUDIO`, this member stores the buffer ID where the recording
     * will be stored.
     * @name MediaContent#recBuffer
     * @type {number} */
    recBuffer: 0,
    /**
     * Whether to stretch or not the video size to fit the cell space.
     * @name MediaContent#stretch
     * @type {boolean} */
    stretch: false,
    /**
     * When `true`, the video plays out of the cell, centered on the activity window.
     * @name MediaContent#free
     * @type {boolean} */
    free: false,
    /**
     * Places the video window at a specific location.
     * @name MediaContent#absLocation
     * @type {AWT.Point} */
    absLocation: null,
    /**
     * When {@link MediaContent#absLocation} is not `null`, this field indicates from where to
     * measure its coordinates. Valid values are: `BOX`, `WINDOW` or `FRAME`.
     * @name MediaContent#absLocationFrom
     * @type {string} */
    absLocationFrom: null,
    /**
     * `true` when the video window must catch mouse clicks.
     * @name MediaContent#catchMouseEvents
     * @type {boolean} */
    catchMouseEvents: false,
    /**
     * Whether to repeat the media in loop, or just one time.
     * @name MediaContent#loop
     * @type {boolean} */
    loop: false,
    /**
     * When `true`, the media will automatically start playing when the associated {@link ActiveBox}
     * become active.
     * @name MediaContent#autoStart
     * @type {boolean} */
    autoStart: false
  });

  /**
   * Default icons for media types.
   * @type {object} */
  var ICONS = {
    default: 'data:image/svg+xml;base64,' + 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGhlaWdodD0iNDgiIHZp' + 'ZXdCb3g9IjAgMCA0OCA0OCIgd2lkdGg9IjQ4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAw' + 'MC9zdmciPjxwYXRoIGQ9Ik0yOC44IDEyTDI4IDhIMTB2MzRoNFYyOGgxMS4ybC44IDRoMTRWMTJ6' + 'Ij48L3BhdGg+PC9zdmc+Cg==',
    audio: 'data:image/svg+xml;base64,' + 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGZpbGw9IiMwMDAwMDAi' + 'IGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjQ4IiB4bWxucz0iaHR0cDov' + 'L3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0zIDl2Nmg0bDUgNVY0TDcgOUgzem0xMy41' + 'IDNjMC0xLjc3LTEuMDItMy4yOS0yLjUtNC4wM3Y4LjA1YzEuNDgtLjczIDIuNS0yLjI1IDIuNS00' + 'LjAyek0xNCAzLjIzdjIuMDZjMi44OS44NiA1IDMuNTQgNSA2Ljcxcy0yLjExIDUuODUtNSA2Ljcx' + 'djIuMDZjNC4wMS0uOTEgNy00LjQ5IDctOC43N3MtMi45OS03Ljg2LTctOC43N3oiPjwvcGF0aD48' + 'cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIj48L3BhdGg+PC9zdmc+Cg==',
    movie: 'data:image/svg+xml;base64,' + 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGZpbGw9IiMwMDAwMDAi' + 'IGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjQ4IiB4bWxucz0iaHR0cDov' + 'L3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xOCA0bDIgNGgtM2wtMi00aC0ybDIgNGgt' + 'M2wtMi00SDhsMiA0SDdMNSA0SDRjLTEuMSAwLTEuOTkuOS0xLjk5IDJMMiAxOGMwIDEuMS45IDIg' + 'MiAyaDE2YzEuMSAwIDItLjkgMi0yVjRoLTR6Ij48L3BhdGg+PHBhdGggZD0iTTAgMGgyNHYyNEgw' + 'eiIgZmlsbD0ibm9uZSI+PC9wYXRoPjwvc3ZnPgo=',
    mic: 'data:image/svg+xml;base64,' + 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGZpbGw9IiMwMDAwMDAi' + 'IGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjQ4IiB4bWxucz0iaHR0cDov' + 'L3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMiAxNGMxLjY2IDAgMi45OS0xLjM0IDIu' + 'OTktM0wxNSA1YzAtMS42Ni0xLjM0LTMtMy0zUzkgMy4zNCA5IDV2NmMwIDEuNjYgMS4zNCAzIDMg' + 'M3ptNS4zLTNjMCAzLTIuNTQgNS4xLTUuMyA1LjFTNi43IDE0IDYuNyAxMUg1YzAgMy40MSAyLjcy' + 'IDYuMjMgNiA2LjcyVjIxaDJ2LTMuMjhjMy4yOC0uNDggNi0zLjMgNi02LjcyaC0xLjd6Ij48L3Bh' + 'dGg+PHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSI+PC9wYXRoPjwvc3ZnPgo=',
    music: 'data:image/svg+xml;base64,' + 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGZpbGw9IiMwMDAwMDAi' + 'IGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjQ4IiB4bWxucz0iaHR0cDov' + 'L3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUi' + 'PjwvcGF0aD48cGF0aCBkPSJNMTIgM3YxMC41NWMtLjU5LS4zNC0xLjI3LS41NS0yLS41NS0yLjIx' + 'IDAtNCAxLjc5LTQgNHMxLjc5IDQgNCA0IDQtMS43OSA0LTRWN2g0VjNoLTZ6Ij48L3BhdGg+PC9z' + 'dmc+Cg==',
    url: 'data:image/svg+xml;base64,' + 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGZpbGw9IiMwMDAwMDAi' + 'IGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjQ4IiB4bWxucz0iaHR0cDov' + 'L3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUi' + 'PjwvcGF0aD48cGF0aCBkPSJNMTIgMkM2LjQ4IDIgMiA2LjQ4IDIgMTJzNC40OCAxMCAxMCAxMCAx' + 'MC00LjQ4IDEwLTEwUzE3LjUyIDIgMTIgMnptLTEgMTcuOTNjLTMuOTUtLjQ5LTctMy44NS03LTcu' + 'OTMgMC0uNjIuMDgtMS4yMS4yMS0xLjc5TDkgMTV2MWMwIDEuMS45IDIgMiAydjEuOTN6bTYuOS0y' + 'LjU0Yy0uMjYtLjgxLTEtMS4zOS0xLjktMS4zOWgtMXYtM2MwLS41NS0uNDUtMS0xLTFIOHYtMmgy' + 'Yy41NSAwIDEtLjQ1IDEtMVY3aDJjMS4xIDAgMi0uOSAyLTJ2LS40MWMyLjkzIDEuMTkgNSA0LjA2' + 'IDUgNy40MSAwIDIuMDgtLjggMy45Ny0yLjEgNS4zOXoiPjwvcGF0aD48L3N2Zz4K'

    /**
     * Collection of icon {@link external:HTMLImageElement} objects
     * @name MediaContent.ICONS
     * @type {object} */
  };MediaContent.ICONS = {};

  // Load the icons
  $.each(ICONS, function (key, value) {
    var img = new Image();
    img.src = value;
    MediaContent.ICONS[key] = img;
  });

  return MediaContent;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 98 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : bags/JumpInfo.js
 *  Created : 05/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2016 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Utils) {

  /**
   * This class contains information about what things JClic sequence manager has to do in certain
   * circumstances, such as:
   * - an activity finishes
   * - the user clicks on the "next" or "prev" buttons
   * - the user clicks or a cell with special "active content"
   *
   * Different kinds of actions are possible for each of these events:
   * - RETURN: to go back to a previous point in the sequence.
   * - EXIT: to exit the program (thus navigating to another URL)
   * - STOP: to do nothing.
   * - JUMP: to jump to a specific point in the sequence of activities, or to another JClic project.
   * @exports JumpInfo
   * @class
   * @see {@link ActivitySequenceJump}
   * @see {@link ConditionalJumpInfo}
   */
  var JumpInfo = function () {
    /**
     * JumpInfo constructor
     * @param {string} action - Must be one of the described actions.
     * @param {(number|string)=} sq - Can be the tag of the sequence element to jump to, or its
     * cardinal number in the list.
     */
    function JumpInfo(action, sq) {
      _classCallCheck(this, JumpInfo);

      this.action = action;
      switch (typeof sq === 'undefined' ? 'undefined' : _typeof(sq)) {
        case 'string':
          this.sequence = sq;
          break;
        case 'number':
          this.actNum = sq;
          break;
      }
    }

    /**
     * Loads the object settings from a specific JQuery XML element
     * @param {external:jQuery} $xml - The XML element to parse
     */


    _createClass(JumpInfo, [{
      key: 'setProperties',
      value: function setProperties($xml) {
        this.id = $xml.attr('id');
        this.action = $xml.attr('action') || 'JUMP';
        this.sequence = Utils.nSlash($xml.attr('tag'));
        this.projectPath = Utils.nSlash($xml.attr('project'));
        return this;
      }
    }]);

    return JumpInfo;
  }();

  Object.assign(JumpInfo.prototype, {
    /**
     * The JumpInfo identifier
     * - For regular jumps: 'forward', 'back'
     * - For conditional jumps: 'upper', 'lower'
     * @name JumpInfo#id
     * @type {string} */
    id: null,
    /**
     * The current action.
     * Possible values are: `JUMP`, `STOP`, `RETURN` and `EXIT`.
     * @name JumpInfo#action
     * @type {string} */
    action: undefined,
    /**
     * Activity number in the sequence list
     * @name JumpInfo#actNum
     * @type {number} */
    actNum: -1,
    /**
     * Current sequence tag
     * @name JumpInfo#sequence
     * @type {string} */
    sequence: undefined,
    /**
     * Path of another JClic project to jump to
     * @name JumpInfo#projectPath
     * @type {string} */
    projectPath: undefined
  });

  return JumpInfo;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 99 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : boxes/AbstractBox.js
 *  Created : 18/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(3), __webpack_require__(57)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, AWT, BoxBase) {

  /**
   * This abstract class is the base for most graphic components of JClic. It describes an area
   * (by default an {@link AWT.Rectangle}) with some special properties that determine how it must
   * be drawn on screen.
   *
   * Some types of boxes can act as containers for other boxes, establishing a hierarchy of dependences.
   * @exports AbstractBox
   * @abstract
   * @class
   * @extends AWT.Rectangle
   */
  var AbstractBox = function (_AWT$Rectangle) {
    _inherits(AbstractBox, _AWT$Rectangle);

    /**
     * AbstractBox constructor
     * @param {?AbstractBox} parent - The AbstractBox to which this one belongs
     * @param {?AWT.Container} container - The container where this box is placed.
     * @param {?BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
     * of this box are defined.
     */
    function AbstractBox(parent, container, boxBase) {
      _classCallCheck(this, AbstractBox);

      var _this = _possibleConstructorReturn(this, (AbstractBox.__proto__ || Object.getPrototypeOf(AbstractBox)).call(this));
      // AbstractBox extends AWT.Rectangle


      _this.container = container;
      _this.parent = parent;
      _this.boxBase = boxBase;
      _this.shape = _this;
      _this.specialShape = false;
      _this.visible = true;
      return _this;
    }

    /**
     * Setter method for `parent`
     * @param {AbstractBox} parent - The new parent of this box
     */


    _createClass(AbstractBox, [{
      key: "setParent",
      value: function setParent(parent) {
        this.parent = parent;
      }

      /**
       * Gets the current parent of this box
       * @returns {AbstractBox}
       */

    }, {
      key: "getParent",
      value: function getParent() {
        return this.parent;
      }

      /**
       * Finisher method
       */

    }, {
      key: "end",
      value: function end() {}

      /**
       * Setter method for `container`
       * @param {AWT.Container} newContainer - The new Container assigned to this box
       */

    }, {
      key: "setContainer",
      value: function setContainer(newContainer) {
        this.container = newContainer;
        if (this.$hostedComponent && this.container && this.container.$div) {
          this.$hostedComponent.detach();
          this.container.$div.append(this.$hostedComponent);
        }
      }

      /**
       * Gets the `container` attribute of this box, without checking its parent
       * @returns {?AWT.Container}
       */

    }, {
      key: "getContainerX",
      value: function getContainerX() {
        return this.container;
      }

      /**
       * Gets the container associated to this box, asking its parents when `null`.
       * @returns {?AWT.Container}
       */

    }, {
      key: "getContainerResolve",
      value: function getContainerResolve() {
        var ab = this;
        while (ab.container === null && ab.parent !== null) {
          ab = ab.parent;
        }return ab.container;
      }

      /**
       * Invalidates the zone corresponding to this box in the associated {@link AWT.Container}, if any.
       * @param {AWT.Rectangle} rect - The rectangle to be invalidated. When `null`, it's the full
       * container area.
       */

    }, {
      key: "invalidate",
      value: function invalidate(rect) {
        var cnt = this.getContainerResolve();
        if (cnt) cnt.invalidate(rect);
      }

      /**
       * Sets the {@link BoxBase} of this box
       * @param {BoxBase} boxBase - The new BoxBase
       */

    }, {
      key: "setBoxBase",
      value: function setBoxBase(boxBase) {
        this.boxBase = boxBase;
        this.invalidate();
      }

      /**
       * Gets the real {@link BoxBase} associated to this box, scanning down parent relationships.
       * @returns {BoxBase}
       */

    }, {
      key: "getBoxBaseResolve",
      value: function getBoxBaseResolve() {
        var ab = this;
        while (!ab.boxBase && ab.parent) {
          ab = ab.parent;
        }return ab.boxBase || BoxBase.prototype.defaultBoxBase;
      }

      /**
       * Sets the shape used to draw the content of this box
       * @param {AWT.Shape} sh - The shape to be set
       */

    }, {
      key: "setShape",
      value: function setShape(sh) {
        this.shape = sh;
        this.specialShape = true;
        this.invalidate();
        _get(AbstractBox.prototype.__proto__ || Object.getPrototypeOf(AbstractBox.prototype), "setBounds", this).call(this, sh.getBounds());
        this.invalidate();
      }

      /**
       * Gets the current shape used in this box
       * @returns {AWT.Shape}
       */

    }, {
      key: "getShape",
      value: function getShape() {
        return this.shape;
      }

      /**
       * Check if this box contains the specified point
       * @override
       * @param {AWT.Point} p - The point to be checked
       * @returns {boolean}
       */

    }, {
      key: "contains",
      value: function contains(p) {
        return this.shape === this ? _get(AbstractBox.prototype.__proto__ || Object.getPrototypeOf(AbstractBox.prototype), "contains", this).call(this, p) : this.shape.contains(p);
      }

      /**
       * Sets a new size and/or dimension to this box
       * @override
       * @param {(AWT.Rectangle|number)} rect - An AWT.Rectangle object, or the `x` coordinate of the
       * upper-left corner of a new rectangle.
       * @param {number=} y - `y` coordinate of the upper-left corner of the new rectangle.
       * @param {number=} w - Width of the new rectangle.
       * @param {number=} h - Height of the new rectangle.
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect, y, w, h) {
        if (typeof rect === 'number')
          // arguments are co-ordinates and size
          rect = new AWT.Rectangle(rect, y, w, h);
        // Rectangle comparision
        if (this.equals(rect)) return;

        var sizeChanged = !this.dim.equals(rect.dim);
        if (this.specialShape) {
          if (sizeChanged) {
            this.shape.scaleBy(new AWT.Dimension(rect.dim.width / this.dim.width, rect.dim.height / this.dim.height));
            this.setShape(this.shape);
          }
          if (!this.pos.equals(rect.pos)) {
            this.shape.moveTo(rect.pos);
          }
          this.setShape(this.shape);
        } else _get(AbstractBox.prototype.__proto__ || Object.getPrototypeOf(AbstractBox.prototype), "setBounds", this).call(this, rect);

        if (this.$hostedComponent) this.setHostedComponentBounds(sizeChanged);

        return this;
      }

      /**
       * Sets a new location for this box. In JClic this method was named `setLocation`
       * @param {(AWT.Point|number)} newPos - A point or the `x` coordinate of a new point.
       * @param {number=} y - The `y` coordinate of a new point.
       */

    }, {
      key: "moveTo",
      value: function moveTo(newPos, y) {
        if (typeof newPos === 'number') newPos = new AWT.Point(newPos, y);
        this.setBounds(new AWT.Rectangle(this).moveTo(newPos));
      }

      /**
       * Sets a new location to this box. In JClic this method was named `translate`.
       * @param {number} dx - The displacement on the X axis
       * @param {number} dy - The displacement on the Y axis
       */

    }, {
      key: "moveBy",
      value: function moveBy(dx, dy) {
        this.setBounds(new AWT.Rectangle(this).moveBy(dx, dy));
      }

      /**
       * Changes the size of this box
       * @param {number} width
       * @param {number} height
       */

    }, {
      key: "setSize",
      value: function setSize(width, height) {
        this.setBounds(new AWT.Rectangle(this.pos, new AWT.Dimension(width, height)));
      }

      /**
       * Checks if this box has border
       * @returns {boolean}
       */

    }, {
      key: "hasBorder",
      value: function hasBorder() {
        return this.border;
      }

      /**
       * Sets/unsets a border to this box
       * @param {boolean} newVal - `true` to set a border.
       */

    }, {
      key: "setBorder",
      value: function setBorder(newVal) {
        if (!newVal) this.invalidate();
        this.border = newVal;
        if (newVal) this.invalidate();
      }

      /**
       * Checks if this box is fully visible
       * @returns {boolean}
       */

    }, {
      key: "isVisible",
      value: function isVisible() {
        return this.visible;
      }

      /**
       * Sets this box visible or invisible
       * @param {boolean} newVal - `true` for visible
       */

    }, {
      key: "setVisible",
      value: function setVisible(newVal) {
        this.visible = newVal;
        this.setHostedComponentVisible();
        this.invalidate();
      }

      /**
       * Makes {@link AbstractBox#$hostedComponent} visible or invisible, based on the value of
       * the AbstractBox `visible` flag.
       */

    }, {
      key: "setHostedComponentVisible",
      value: function setHostedComponentVisible() {
        if (this.$hostedComponent) this.$hostedComponent.css('visibility', this.visible ? 'visible' : 'hidden');
      }

      /**
       * Checks if this box is temporary hidden
       * @returns {boolean}
       */

    }, {
      key: "isTemporaryHidden",
      value: function isTemporaryHidden() {
        return this.temporaryHidden;
      }

      /**
       * Makes this box temporary hidden (newVal `true`) or resets its original state (newVal `false`)
       * @param {boolean} newVal
       */

    }, {
      key: "setTemporaryHidden",
      value: function setTemporaryHidden(newVal) {
        this.temporaryHidden = newVal;
      }

      /**
       * Checks if this box is currently inactive.
       * @returns {boolean}
       */

    }, {
      key: "isInactive",
      value: function isInactive() {
        return this.inactive;
      }

      /**
       * Makes this box active (`false`) or inactive (`true`)
       * @param {boolean} newVal
       */

    }, {
      key: "setInactive",
      value: function setInactive(newVal) {
        this.inactive = newVal;
        if (this.$hostedComponent) {
          this.setHostedComponentColors();
          this.setHostedComponentVisible();
        } else {
          if (this.$accessibleElement) {
            var disabled = this.isInactive() && !this.accessibleAlwaysActive;
            this.$accessibleElement.prop({
              disabled: disabled,
              tabindex: disabled ? -1 : 0
            });
          }
          this.invalidate();
        }
      }

      /**
       * Checks if this box is in `inverted` state.
       * @returns {boolean}
       */

    }, {
      key: "isInverted",
      value: function isInverted() {
        return this.inverted;
      }

      /**
       * Puts this box in `inverted` mode or restores its original state.
       * @param {boolean} newVal
       */

    }, {
      key: "setInverted",
      value: function setInverted(newVal) {
        this.inverted = newVal;
        if (this.$hostedComponent) this.setHostedComponentColors();else this.invalidate();
      }

      /**
       * Checks if this box is `marked`
       * @returns {boolean}
       */

    }, {
      key: "isMarked",
      value: function isMarked() {
        return this.marked;
      }

      /**
       * Sets this box in `marked` mode, or restores its original state.
       * @param {boolean} newVal
       */

    }, {
      key: "setMarked",
      value: function setMarked(newVal) {
        if (!newVal) this.invalidate();
        this.marked = newVal;
        if (this.$hostedComponent) {
          this.setHostedComponentColors();
          this.setHostedComponentBorder();
        } else if (newVal) this.invalidate();
      }

      /**
       * Checks if this box has the input focus
       * @returns {boolean}
       */

    }, {
      key: "isFocused",
      value: function isFocused() {
        return this.focused;
      }

      /**
       *
       * Sets or unsets the input focus to this box.
       * @param {boolean} newVal
       */

    }, {
      key: "setFocused",
      value: function setFocused(newVal) {
        if (!newVal) this.invalidate();
        this.focused = newVal;
        if (newVal) this.invalidate();
        // Put hosted component on top
        if (this.$hostedComponent) this.$hostedComponent.css('z-index', this.focused ? 20 : 2);
      }

      /**
       * Checks if this box is in `alternative` state.
       * @returns {boolean}
       */

    }, {
      key: "isAlternative",
      value: function isAlternative() {
        return this.alternative;
      }

      /**
       * Sets this box in `alternative` mode, or restores its original state.
       * @param {boolean} newVal
       */

    }, {
      key: "setAlternative",
      value: function setAlternative(newVal) {
        this.alternative = newVal;
        this.invalidate();
      }

      /**
       * Draws the content of this box on an HTML `canvas` element. At this level, only background
       * and border are painted/stroked. Derived classes should implement specific drawing tasks in
       * {@link AbstractBox#updateContent}.
       * @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context used to draw the
       * box content.
       * @param {AWT.Rectangle=} dirtyRegion - The area that must be repainted. `null` refers to the whole box.
       */

    }, {
      key: "update",
      value: function update(ctx, dirtyRegion) {
        if (this.isEmpty() || !this.isVisible() || this.isTemporaryHidden()) return false;

        if (dirtyRegion && !this.shape.intersects(dirtyRegion)) return false;

        /**
         * TODO: Implement clipping
         Shape saveClip=new Area(g2.getClip())
         Area clip=new Area(saveClip)
         clip.intersect(new Area(shape))
         g2.setClip(clip)
         */

        var bb = this.getBoxBaseResolve();
        if (!bb.transparent && !bb.dontFill && !this.tmpTrans) {
          if (!bb.bgGradient || bb.bgGradient.hasTransparency()) {
            // Prepare the rendering context
            ctx.fillStyle = this.inactive ? bb.inactiveColor : this.inverted ? bb.textColor : bb.backColor;
            // Fill the shape
            this.shape.fill(ctx, dirtyRegion);
          }
          if (bb.bgGradient) {
            ctx.fillStyle = bb.bgGradient.getGradient(ctx, this.shape.getBounds());
            this.shape.fill(ctx, dirtyRegion);
          }
          // Reset the canvas context
          ctx.fillStyle = 'black';
        }

        if (!this.$hostedComponent) this.updateContent(ctx, dirtyRegion);

        this.drawBorder(ctx);
        return true;
      }

      /**
       * Here is where classes derived from {@link AbstractBox} should implement the drawing of its
       * content. Background and border are already painted in {@link AbstractBox#update}.
       * @param {external:CanvasRenderingContext2D} _ctx - The canvas rendering context used to draw the
       * box content.
       * @param {AWT.Rectangle=} _dirtyRegion - The area that must be repainted. `null` refers to the whole box.
       */
      //
      // Abstract method, to be implemented in subclasses

    }, {
      key: "updateContent",
      value: function updateContent(_ctx, _dirtyRegion) {}

      /**
       * Draws the box border
       * @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context where the border
       * will be drawn.
       */

    }, {
      key: "drawBorder",
      value: function drawBorder(ctx) {
        if (this.border || this.marked) {
          var bb = this.getBoxBaseResolve();

          // Prepare stroke settings
          ctx.strokeStyle = bb.borderColor;
          bb[this.marked ? 'markerStroke' : 'borderStroke'].setStroke(ctx);
          if (this.marked) ctx.globalCompositeOperation = 'xor';

          // Draw border
          this.shape.stroke(ctx);

          // Reset ctx default values
          if (this.marked) ctx.globalCompositeOperation = 'source-over';
          ctx.strokeStyle = 'black';
          AWT.Stroke.prototype.setStroke(ctx);
        }
      }

      /**
       * Returns the enclosing Rectangle of this box including its border (if any)
       * @returns {AWT.Rectangle}
       */

    }, {
      key: "getBorderBounds",
      value: function getBorderBounds() {
        var result = new AWT.Rectangle(this.getBounds());
        if (this.border || this.marked) {
          var bb = this.getBoxBaseResolve();
          var w = bb[this.marked ? 'markerStroke' : 'borderStroke'].lineWidth;
          result.moveBy(-w / 2, -w / 2);
          result.dim.width += w;
          result.dim.height += w;
        }
        return result;
      }

      /**
       * Sets the {@link AbstractBox#$hostedComponent $hostedComponent} member.
       * @param {external:jQuery} $hc - The jQuery DOM component hosted by this box.
       */

    }, {
      key: "setHostedComponent",
      value: function setHostedComponent($hc) {
        if (this.$hostedComponent) this.$hostedComponent.detach();

        this.$hostedComponent = $hc;

        if (this.$hostedComponent) {
          this.setContainer(this.container);
          this.setHostedComponentColors();
          this.setHostedComponentBorder();
          this.setHostedComponentBounds(true);
          this.setHostedComponentVisible();
          this.setFocused(this.focused);
        }
      }

      /**
       * Gets the current {@link AbstractBox#$hostedComponent|$hostedComponent} member
       * @returns {external:jQuery}
       */

    }, {
      key: "getHostedComponent",
      value: function getHostedComponent() {
        return this.$hostedComponent;
      }

      /**
       * Sets {@link AbstractBox#$hostedComponent|$hostedComponent} colors and other css properties
       * based on the current {@link BoxBase} of this box.
       */

    }, {
      key: "setHostedComponentColors",
      value: function setHostedComponentColors() {
        if (this.$hostedComponent) {
          var bb = this.getBoxBaseResolve();
          var css = bb.getCSS(null, this.inactive, this.inverted, this.alternative);
          // Check if cell has background gradient and animated gif
          if (this.$hostedComponent.data('background-image') && css['background-image']) css['background-image'] = this.$hostedComponent.data('background-image') + "," + css['background-image'];
          this.$hostedComponent.css(css);
        }
      }

      /**
       * Sets the {@link AbstractBox#$hostedComponent|$hostedComponent} border, based on the current
       * {@link BoxBase} of this box.
       */

    }, {
      key: "setHostedComponentBorder",
      value: function setHostedComponentBorder() {
        if (this.$hostedComponent && (this.border || this.marked)) {
          var bb = this.getBoxBaseResolve();
          this.$hostedComponent.css({
            'border-width': bb.get(this.marked ? 'markerStroke' : 'borderStroke').lineWidth + "px",
            'border-style': 'solid',
            'border-color': bb.get('borderColor')
          });
        }
      }

      /**
       * Places and resizes {@link AbstractBox#$hostedComponent|$hostedComponent}, based on the size
       * and position of this box.
       * @param {boolean} _sizeChanged - `true` when this {@link ActiveBox} has changed its size
       */

    }, {
      key: "setHostedComponentBounds",
      value: function setHostedComponentBounds(_sizeChanged) {
        if (this.$hostedComponent) {
          var r = this.getBounds(),
              b = this.border || this.marked ? this.getBoxBaseResolve().get(this.marked ? 'markerStroke' : 'borderStroke').lineWidth : 0;
          this.$hostedComponent.css({
            position: 'absolute',
            width: r.dim.width - 2 * b + 'px',
            height: r.dim.height - 2 * b + 'px',
            top: r.pos.y + 'px',
            left: r.pos.x + 'px'
          });
        }
      }
    }]);

    return AbstractBox;
  }(AWT.Rectangle);

  Object.assign(AbstractBox.prototype, {
    /**
     * The parent AbstractBox (can be `null`)
     * @name AbstractBox#parent
     * @type {AbstractBox} */
    parent: null,
    /**
     * The Container to which this AbstractBox belongs
     * @name AbstractBox#container
     * @type {AWT.Container} */
    container: null,
    /**
     * The {@link BoxBase} related to this AbstractBox. When `null`, the parent can provide an
     * alternative one.
     * @name AbstractBox#boxBase
     * @type {BoxBase} */
    boxBase: null,
    /**
     * Whether this box has a border or not
     * @name AbstractBox#border
     * @type {boolean} */
    border: false,
    /**
     * The shape of this box (the box Rectangle or a special Shape, if set)
     * @name AbstractBox#shape
     * @type {AWT.Shape} */
    shape: null,
    /**
     * Whether this box has a shape that is not a rectangle
     * @name AbstractBox#specialShape
     * @type {boolean} */
    specialShape: false,
    /**
     * Whether this box is visible or not
     * @name AbstractBox#visible
     * @type {boolean} */
    visible: true,
    /**
     * Used to temporary hide a box while other drawing operations are done
     * @name AbstractBox#temporaryHidden
     * @type {boolean} */
    temporaryHidden: false,
    /**
     * Cells with this attribute will be transparent but with painted border
     * @name AbstractBox#tmpTrans
     * @type {boolean}*/
    tmpTrans: false,
    /**
     * Whether this box is active or inactive
     * @name AbstractBox#inactive
     * @type {boolean} */
    inactive: false,
    /**
     * Whether this box must be displayed with inverted or regular colors
     * @name AbstractBox#inverted
     * @type {boolean} */
    inverted: false,
    /**
     * Whether this box must be displayed with alternative or regular color and font settings
     * @name AbstractBox#alternative
     * @type {boolean} */
    alternative: false,
    /**
     * Whether this box is marked (selected) or not
     * @name AbstractBox#marked
     * @type {boolean} */
    marked: false,
    /**
     * Whether this box holds the input focus
     * @name AbstractBox#focused
     * @type {boolean} */
    focused: false,
    /**
     * Text to be used in accessible contexts
     * @name AbstractBox#accessibleText
     * @type {string} */
    accessibleText: '',
    /**
     * Describes the main role of this box on the activity. Useful in wai-aria descriptions.
     * @name AbstractBox#role
     * @type {string} */
    role: 'cell',
    /**
     * DOM element used to display this cell content in wai-aria contexts
     * @name AbstractBox#$accessibleElement
     * @type {external:jQuery} */
    $accessibleElement: null,
    /**
     * Flag indicating that $accessibleElement should be always active
     * @name AbstractBox#accessibleAlwaysActive
     * @type {boolean} */
    accessibleAlwaysActive: false,
    /**
     * An external JQuery DOM element hosted by this box
     * @name AbstractBox#$hostedComponent
     * @type {external:jQuery} */
    $hostedComponent: null
  });

  return AbstractBox;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 100 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var isObject = __webpack_require__(7);
var document = __webpack_require__(5).document;
// typeof document.createElement is 'object' in old IE
var is = isObject(document) && isObject(document.createElement);
module.exports = function (it) {
  return is ? document.createElement(it) : {};
};

/***/ }),
/* 101 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var global = __webpack_require__(5);
var core = __webpack_require__(28);
var LIBRARY = __webpack_require__(46);
var wksExt = __webpack_require__(142);
var defineProperty = __webpack_require__(11).f;
module.exports = function (name) {
  var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
  if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
};

/***/ }),
/* 102 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var shared = __webpack_require__(77)('keys');
var uid = __webpack_require__(45);
module.exports = function (key) {
  return shared[key] || (shared[key] = uid(key));
};

/***/ }),
/* 103 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// IE 8- don't enum bug keys
module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(',');

/***/ }),
/* 104 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var document = __webpack_require__(5).document;
module.exports = document && document.documentElement;

/***/ }),
/* 105 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var isObject = __webpack_require__(7);
var anObject = __webpack_require__(4);
var check = function check(O, proto) {
  anObject(O);
  if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
};
module.exports = {
  set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
  function (test, buggy, set) {
    try {
      set = __webpack_require__(25)(Function.call, __webpack_require__(21).f(Object.prototype, '__proto__').set, 2);
      set(test, []);
      buggy = !(test instanceof Array);
    } catch (e) {
      buggy = true;
    }
    return function setPrototypeOf(O, proto) {
      check(O, proto);
      if (buggy) O.__proto__ = proto;else set(O, proto);
      return O;
    };
  }({}, false) : undefined),
  check: check
};

/***/ }),
/* 106 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = '\t\n\x0B\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003' + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';

/***/ }),
/* 107 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var isObject = __webpack_require__(7);
var setPrototypeOf = __webpack_require__(105).set;
module.exports = function (that, target, C) {
  var S = target.constructor;
  var P;
  if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {
    setPrototypeOf(that, P);
  }return that;
};

/***/ }),
/* 108 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var toInteger = __webpack_require__(31);
var defined = __webpack_require__(30);

module.exports = function repeat(count) {
  var str = String(defined(this));
  var res = '';
  var n = toInteger(count);
  if (n < 0 || n == Infinity) throw RangeError("Count can't be negative");
  for (; n > 0; (n >>>= 1) && (str += str)) {
    if (n & 1) res += str;
  }return res;
};

/***/ }),
/* 109 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.28 Math.sign(x)
module.exports = Math.sign || function sign(x) {
  // eslint-disable-next-line no-self-compare
  return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
};

/***/ }),
/* 110 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.14 Math.expm1(x)
var $expm1 = Math.expm1;
module.exports = !$expm1
// Old FF bug
|| $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168
// Tor Browser bug
|| $expm1(-2e-17) != -2e-17 ? function expm1(x) {
  return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1;
} : $expm1;

/***/ }),
/* 111 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var toInteger = __webpack_require__(31);
var defined = __webpack_require__(30);
// true  -> String#at
// false -> String#codePointAt
module.exports = function (TO_STRING) {
  return function (that, pos) {
    var s = String(defined(that));
    var i = toInteger(pos);
    var l = s.length;
    var a, b;
    if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
    a = s.charCodeAt(i);
    return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  };
};

/***/ }),
/* 112 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var LIBRARY = __webpack_require__(46);
var $export = __webpack_require__(0);
var redefine = __webpack_require__(18);
var hide = __webpack_require__(17);
var has = __webpack_require__(16);
var Iterators = __webpack_require__(61);
var $iterCreate = __webpack_require__(113);
var setToStringTag = __webpack_require__(59);
var getPrototypeOf = __webpack_require__(22);
var ITERATOR = __webpack_require__(8)('iterator');
var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
var FF_ITERATOR = '@@iterator';
var KEYS = 'keys';
var VALUES = 'values';

var returnThis = function returnThis() {
  return this;
};

module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
  $iterCreate(Constructor, NAME, next);
  var getMethod = function getMethod(kind) {
    if (!BUGGY && kind in proto) return proto[kind];
    switch (kind) {
      case KEYS:
        return function keys() {
          return new Constructor(this, kind);
        };
      case VALUES:
        return function values() {
          return new Constructor(this, kind);
        };
    }return function entries() {
      return new Constructor(this, kind);
    };
  };
  var TAG = NAME + ' Iterator';
  var DEF_VALUES = DEFAULT == VALUES;
  var VALUES_BUG = false;
  var proto = Base.prototype;
  var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
  var $default = !BUGGY && $native || getMethod(DEFAULT);
  var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
  var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
  var methods, key, IteratorPrototype;
  // Fix native
  if ($anyNative) {
    IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
    if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
      // Set @@toStringTag to native iterators
      setToStringTag(IteratorPrototype, TAG, true);
      // fix for some old engines
      if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
    }
  }
  // fix Array#{values, @@iterator}.name in V8 / FF
  if (DEF_VALUES && $native && $native.name !== VALUES) {
    VALUES_BUG = true;
    $default = function values() {
      return $native.call(this);
    };
  }
  // Define iterator
  if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
    hide(proto, ITERATOR, $default);
  }
  // Plug for library
  Iterators[NAME] = $default;
  Iterators[TAG] = returnThis;
  if (DEFAULT) {
    methods = {
      values: DEF_VALUES ? $default : getMethod(VALUES),
      keys: IS_SET ? $default : getMethod(KEYS),
      entries: $entries
    };
    if (FORCED) for (key in methods) {
      if (!(key in proto)) redefine(proto, key, methods[key]);
    } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
  }
  return methods;
};

/***/ }),
/* 113 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var create = __webpack_require__(49);
var descriptor = __webpack_require__(44);
var setToStringTag = __webpack_require__(59);
var IteratorPrototype = {};

// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
__webpack_require__(17)(IteratorPrototype, __webpack_require__(8)('iterator'), function () {
  return this;
});

module.exports = function (Constructor, NAME, next) {
  Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
  setToStringTag(Constructor, NAME + ' Iterator');
};

/***/ }),
/* 114 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// helper for String#{startsWith, endsWith, includes}
var isRegExp = __webpack_require__(81);
var defined = __webpack_require__(30);

module.exports = function (that, searchString, NAME) {
  if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!");
  return String(defined(that));
};

/***/ }),
/* 115 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var MATCH = __webpack_require__(8)('match');
module.exports = function (KEY) {
  var re = /./;
  try {
    '/./'[KEY](re);
  } catch (e) {
    try {
      re[MATCH] = false;
      return !'/./'[KEY](re);
    } catch (f) {/* empty */}
  }return true;
};

/***/ }),
/* 116 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// check on default Array iterator
var Iterators = __webpack_require__(61);
var ITERATOR = __webpack_require__(8)('iterator');
var ArrayProto = Array.prototype;

module.exports = function (it) {
  return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
};

/***/ }),
/* 117 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $defineProperty = __webpack_require__(11);
var createDesc = __webpack_require__(44);

module.exports = function (object, index, value) {
  if (index in object) $defineProperty.f(object, index, createDesc(0, value));else object[index] = value;
};

/***/ }),
/* 118 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var classof = __webpack_require__(69);
var ITERATOR = __webpack_require__(8)('iterator');
var Iterators = __webpack_require__(61);
module.exports = __webpack_require__(28).getIteratorMethod = function (it) {
  if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)];
};

/***/ }),
/* 119 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
var speciesConstructor = __webpack_require__(310);

module.exports = function (original, length) {
  return new (speciesConstructor(original))(length);
};

/***/ }),
/* 120 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)


var toObject = __webpack_require__(14);
var toAbsoluteIndex = __webpack_require__(48);
var toLength = __webpack_require__(12);
module.exports = function fill(value /* , start = 0, end = @length */) {
  var O = toObject(this);
  var length = toLength(O.length);
  var aLen = arguments.length;
  var index = toAbsoluteIndex(aLen > 1 ? arguments[1] : undefined, length);
  var end = aLen > 2 ? arguments[2] : undefined;
  var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
  while (endPos > index) {
    O[index++] = value;
  }return O;
};

/***/ }),
/* 121 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var addToUnscopables = __webpack_require__(40);
var step = __webpack_require__(158);
var Iterators = __webpack_require__(61);
var toIObject = __webpack_require__(20);

// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
module.exports = __webpack_require__(112)(Array, 'Array', function (iterated, kind) {
  this._t = toIObject(iterated); // target
  this._i = 0; // next index
  this._k = kind; // kind
  // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function () {
  var O = this._t;
  var kind = this._k;
  var index = this._i++;
  if (!O || index >= O.length) {
    this._t = undefined;
    return step(1);
  }
  if (kind == 'keys') return step(0, index);
  if (kind == 'values') return step(0, O[index]);
  return step(0, [index, O[index]]);
}, 'values');

// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array;

addToUnscopables('keys');
addToUnscopables('values');
addToUnscopables('entries');

/***/ }),
/* 122 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var ctx = __webpack_require__(25);
var invoke = __webpack_require__(148);
var html = __webpack_require__(104);
var cel = __webpack_require__(100);
var global = __webpack_require__(5);
var process = global.process;
var setTask = global.setImmediate;
var clearTask = global.clearImmediate;
var MessageChannel = global.MessageChannel;
var Dispatch = global.Dispatch;
var counter = 0;
var queue = {};
var ONREADYSTATECHANGE = 'onreadystatechange';
var defer, channel, port;
var run = function run() {
  var id = +this;
  // eslint-disable-next-line no-prototype-builtins
  if (queue.hasOwnProperty(id)) {
    var fn = queue[id];
    delete queue[id];
    fn();
  }
};
var listener = function listener(event) {
  run.call(event.data);
};
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if (!setTask || !clearTask) {
  setTask = function setImmediate(fn) {
    var args = [];
    var i = 1;
    while (arguments.length > i) {
      args.push(arguments[i++]);
    }queue[++counter] = function () {
      // eslint-disable-next-line no-new-func
      invoke(typeof fn == 'function' ? fn : Function(fn), args);
    };
    defer(counter);
    return counter;
  };
  clearTask = function clearImmediate(id) {
    delete queue[id];
  };
  // Node.js 0.8-
  if (__webpack_require__(26)(process) == 'process') {
    defer = function defer(id) {
      process.nextTick(ctx(run, id, 1));
    };
    // Sphere (JS game engine) Dispatch API
  } else if (Dispatch && Dispatch.now) {
    defer = function defer(id) {
      Dispatch.now(ctx(run, id, 1));
    };
    // Browsers with MessageChannel, includes WebWorkers
  } else if (MessageChannel) {
    channel = new MessageChannel();
    port = channel.port2;
    channel.port1.onmessage = listener;
    defer = ctx(port.postMessage, port, 1);
    // Browsers with postMessage, skip WebWorkers
    // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
    defer = function defer(id) {
      global.postMessage(id + '', '*');
    };
    global.addEventListener('message', listener, false);
    // IE8-
  } else if (ONREADYSTATECHANGE in cel('script')) {
    defer = function defer(id) {
      html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
        html.removeChild(this);
        run.call(id);
      };
    };
    // Rest old browsers
  } else {
    defer = function defer(id) {
      setTimeout(ctx(run, id, 1), 0);
    };
  }
}
module.exports = {
  set: setTask,
  clear: clearTask
};

/***/ }),
/* 123 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var global = __webpack_require__(5);
var macrotask = __webpack_require__(122).set;
var Observer = global.MutationObserver || global.WebKitMutationObserver;
var process = global.process;
var Promise = global.Promise;
var isNode = __webpack_require__(26)(process) == 'process';

module.exports = function () {
  var head, last, notify;

  var flush = function flush() {
    var parent, fn;
    if (isNode && (parent = process.domain)) parent.exit();
    while (head) {
      fn = head.fn;
      head = head.next;
      try {
        fn();
      } catch (e) {
        if (head) notify();else last = undefined;
        throw e;
      }
    }last = undefined;
    if (parent) parent.enter();
  };

  // Node.js
  if (isNode) {
    notify = function notify() {
      process.nextTick(flush);
    };
    // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
  } else if (Observer && !(global.navigator && global.navigator.standalone)) {
    var toggle = true;
    var node = document.createTextNode('');
    new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
    notify = function notify() {
      node.data = toggle = !toggle;
    };
    // environments with maybe non-completely correct, but existent Promise
  } else if (Promise && Promise.resolve) {
    var promise = Promise.resolve();
    notify = function notify() {
      promise.then(flush);
    };
    // for other environments - macrotask based on:
    // - setImmediate
    // - MessageChannel
    // - window.postMessag
    // - onreadystatechange
    // - setTimeout
  } else {
    notify = function notify() {
      // strange IE + webpack dev server bug - use .call(global)
      macrotask.call(global, flush);
    };
  }

  return function (fn) {
    var task = { fn: fn, next: undefined };
    if (last) last.next = task;
    if (!head) {
      head = task;
      notify();
    }last = task;
  };
};

/***/ }),
/* 124 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// 25.4.1.5 NewPromiseCapability(C)

var aFunction = __webpack_require__(15);

function PromiseCapability(C) {
  var resolve, reject;
  this.promise = new C(function ($$resolve, $$reject) {
    if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
    resolve = $$resolve;
    reject = $$reject;
  });
  this.resolve = aFunction(resolve);
  this.reject = aFunction(reject);
}

module.exports.f = function (C) {
  return new PromiseCapability(C);
};

/***/ }),
/* 125 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var global = __webpack_require__(5);
var DESCRIPTORS = __webpack_require__(10);
var LIBRARY = __webpack_require__(46);
var $typed = __webpack_require__(87);
var hide = __webpack_require__(17);
var redefineAll = __webpack_require__(54);
var fails = __webpack_require__(6);
var anInstance = __webpack_require__(52);
var toInteger = __webpack_require__(31);
var toLength = __webpack_require__(12);
var toIndex = __webpack_require__(167);
var gOPN = __webpack_require__(50).f;
var dP = __webpack_require__(11).f;
var arrayFill = __webpack_require__(120);
var setToStringTag = __webpack_require__(59);
var ARRAY_BUFFER = 'ArrayBuffer';
var DATA_VIEW = 'DataView';
var PROTOTYPE = 'prototype';
var WRONG_LENGTH = 'Wrong length!';
var WRONG_INDEX = 'Wrong index!';
var $ArrayBuffer = global[ARRAY_BUFFER];
var $DataView = global[DATA_VIEW];
var Math = global.Math;
var RangeError = global.RangeError;
// eslint-disable-next-line no-shadow-restricted-names
var Infinity = global.Infinity;
var BaseBuffer = $ArrayBuffer;
var abs = Math.abs;
var pow = Math.pow;
var floor = Math.floor;
var log = Math.log;
var LN2 = Math.LN2;
var BUFFER = 'buffer';
var BYTE_LENGTH = 'byteLength';
var BYTE_OFFSET = 'byteOffset';
var $BUFFER = DESCRIPTORS ? '_b' : BUFFER;
var $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH;
var $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET;

// IEEE754 conversions based on https://github.com/feross/ieee754
function packIEEE754(value, mLen, nBytes) {
  var buffer = new Array(nBytes);
  var eLen = nBytes * 8 - mLen - 1;
  var eMax = (1 << eLen) - 1;
  var eBias = eMax >> 1;
  var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0;
  var i = 0;
  var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
  var e, m, c;
  value = abs(value);
  // eslint-disable-next-line no-self-compare
  if (value != value || value === Infinity) {
    // eslint-disable-next-line no-self-compare
    m = value != value ? 1 : 0;
    e = eMax;
  } else {
    e = floor(log(value) / LN2);
    if (value * (c = pow(2, -e)) < 1) {
      e--;
      c *= 2;
    }
    if (e + eBias >= 1) {
      value += rt / c;
    } else {
      value += rt * pow(2, 1 - eBias);
    }
    if (value * c >= 2) {
      e++;
      c /= 2;
    }
    if (e + eBias >= eMax) {
      m = 0;
      e = eMax;
    } else if (e + eBias >= 1) {
      m = (value * c - 1) * pow(2, mLen);
      e = e + eBias;
    } else {
      m = value * pow(2, eBias - 1) * pow(2, mLen);
      e = 0;
    }
  }
  for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8) {}
  e = e << mLen | m;
  eLen += mLen;
  for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8) {}
  buffer[--i] |= s * 128;
  return buffer;
}
function unpackIEEE754(buffer, mLen, nBytes) {
  var eLen = nBytes * 8 - mLen - 1;
  var eMax = (1 << eLen) - 1;
  var eBias = eMax >> 1;
  var nBits = eLen - 7;
  var i = nBytes - 1;
  var s = buffer[i--];
  var e = s & 127;
  var m;
  s >>= 7;
  for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8) {}
  m = e & (1 << -nBits) - 1;
  e >>= -nBits;
  nBits += mLen;
  for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8) {}
  if (e === 0) {
    e = 1 - eBias;
  } else if (e === eMax) {
    return m ? NaN : s ? -Infinity : Infinity;
  } else {
    m = m + pow(2, mLen);
    e = e - eBias;
  }return (s ? -1 : 1) * m * pow(2, e - mLen);
}

function unpackI32(bytes) {
  return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
}
function packI8(it) {
  return [it & 0xff];
}
function packI16(it) {
  return [it & 0xff, it >> 8 & 0xff];
}
function packI32(it) {
  return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff];
}
function packF64(it) {
  return packIEEE754(it, 52, 8);
}
function packF32(it) {
  return packIEEE754(it, 23, 4);
}

function addGetter(C, key, internal) {
  dP(C[PROTOTYPE], key, { get: function get() {
      return this[internal];
    } });
}

function get(view, bytes, index, isLittleEndian) {
  var numIndex = +index;
  var intIndex = toIndex(numIndex);
  if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX);
  var store = view[$BUFFER]._b;
  var start = intIndex + view[$OFFSET];
  var pack = store.slice(start, start + bytes);
  return isLittleEndian ? pack : pack.reverse();
}
function set(view, bytes, index, conversion, value, isLittleEndian) {
  var numIndex = +index;
  var intIndex = toIndex(numIndex);
  if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX);
  var store = view[$BUFFER]._b;
  var start = intIndex + view[$OFFSET];
  var pack = conversion(+value);
  for (var i = 0; i < bytes; i++) {
    store[start + i] = pack[isLittleEndian ? i : bytes - i - 1];
  }
}

if (!$typed.ABV) {
  $ArrayBuffer = function ArrayBuffer(length) {
    anInstance(this, $ArrayBuffer, ARRAY_BUFFER);
    var byteLength = toIndex(length);
    this._b = arrayFill.call(new Array(byteLength), 0);
    this[$LENGTH] = byteLength;
  };

  $DataView = function DataView(buffer, byteOffset, byteLength) {
    anInstance(this, $DataView, DATA_VIEW);
    anInstance(buffer, $ArrayBuffer, DATA_VIEW);
    var bufferLength = buffer[$LENGTH];
    var offset = toInteger(byteOffset);
    if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset!');
    byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
    if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);
    this[$BUFFER] = buffer;
    this[$OFFSET] = offset;
    this[$LENGTH] = byteLength;
  };

  if (DESCRIPTORS) {
    addGetter($ArrayBuffer, BYTE_LENGTH, '_l');
    addGetter($DataView, BUFFER, '_b');
    addGetter($DataView, BYTE_LENGTH, '_l');
    addGetter($DataView, BYTE_OFFSET, '_o');
  }

  redefineAll($DataView[PROTOTYPE], {
    getInt8: function getInt8(byteOffset) {
      return get(this, 1, byteOffset)[0] << 24 >> 24;
    },
    getUint8: function getUint8(byteOffset) {
      return get(this, 1, byteOffset)[0];
    },
    getInt16: function getInt16(byteOffset /* , littleEndian */) {
      var bytes = get(this, 2, byteOffset, arguments[1]);
      return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
    },
    getUint16: function getUint16(byteOffset /* , littleEndian */) {
      var bytes = get(this, 2, byteOffset, arguments[1]);
      return bytes[1] << 8 | bytes[0];
    },
    getInt32: function getInt32(byteOffset /* , littleEndian */) {
      return unpackI32(get(this, 4, byteOffset, arguments[1]));
    },
    getUint32: function getUint32(byteOffset /* , littleEndian */) {
      return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0;
    },
    getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
      return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4);
    },
    getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
      return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8);
    },
    setInt8: function setInt8(byteOffset, value) {
      set(this, 1, byteOffset, packI8, value);
    },
    setUint8: function setUint8(byteOffset, value) {
      set(this, 1, byteOffset, packI8, value);
    },
    setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
      set(this, 2, byteOffset, packI16, value, arguments[2]);
    },
    setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
      set(this, 2, byteOffset, packI16, value, arguments[2]);
    },
    setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
      set(this, 4, byteOffset, packI32, value, arguments[2]);
    },
    setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
      set(this, 4, byteOffset, packI32, value, arguments[2]);
    },
    setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
      set(this, 4, byteOffset, packF32, value, arguments[2]);
    },
    setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
      set(this, 8, byteOffset, packF64, value, arguments[2]);
    }
  });
} else {
  if (!fails(function () {
    $ArrayBuffer(1);
  }) || !fails(function () {
    new $ArrayBuffer(-1); // eslint-disable-line no-new
  }) || fails(function () {
    new $ArrayBuffer(); // eslint-disable-line no-new
    new $ArrayBuffer(1.5); // eslint-disable-line no-new
    new $ArrayBuffer(NaN); // eslint-disable-line no-new
    return $ArrayBuffer.name != ARRAY_BUFFER;
  })) {
    $ArrayBuffer = function ArrayBuffer(length) {
      anInstance(this, $ArrayBuffer);
      return new BaseBuffer(toIndex(length));
    };
    var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE];
    for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j;) {
      if (!((key = keys[j++]) in $ArrayBuffer)) hide($ArrayBuffer, key, BaseBuffer[key]);
    }
    if (!LIBRARY) ArrayBufferProto.constructor = $ArrayBuffer;
  }
  // iOS Safari 7.x bug
  var view = new $DataView(new $ArrayBuffer(2));
  var $setInt8 = $DataView[PROTOTYPE].setInt8;
  view.setInt8(0, 2147483648);
  view.setInt8(1, 2147483649);
  if (view.getInt8(0) || !view.getInt8(1)) redefineAll($DataView[PROTOTYPE], {
    setInt8: function setInt8(byteOffset, value) {
      $setInt8.call(this, byteOffset, value << 24 >> 24);
    },
    setUint8: function setUint8(byteOffset, value) {
      $setInt8.call(this, byteOffset, value << 24 >> 24);
    }
  }, true);
}
setToStringTag($ArrayBuffer, ARRAY_BUFFER);
setToStringTag($DataView, DATA_VIEW);
hide($DataView[PROTOTYPE], $typed.VIEW, true);
exports[ARRAY_BUFFER] = $ArrayBuffer;
exports[DATA_VIEW] = $DataView;

/***/ }),
/* 126 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var global = __webpack_require__(5);
var navigator = global.navigator;

module.exports = navigator && navigator.userAgent || '';

/***/ }),
/* 127 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(process) {

if (!process.version || process.version.indexOf('v0.') === 0 || process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
  module.exports = nextTick;
} else {
  module.exports = process.nextTick;
}

function nextTick(fn, arg1, arg2, arg3) {
  if (typeof fn !== 'function') {
    throw new TypeError('"callback" argument must be a function');
  }
  var len = arguments.length;
  var args, i;
  switch (len) {
    case 0:
    case 1:
      return process.nextTick(fn);
    case 2:
      return process.nextTick(function afterTickOne() {
        fn.call(null, arg1);
      });
    case 3:
      return process.nextTick(function afterTickTwo() {
        fn.call(null, arg1, arg2);
      });
    case 4:
      return process.nextTick(function afterTickThree() {
        fn.call(null, arg1, arg2, arg3);
      });
    default:
      args = new Array(len - 1);
      i = 0;
      while (i < args.length) {
        args[i++] = arguments[i];
      }
      return process.nextTick(function afterTick() {
        fn.apply(null, args);
      });
  }
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(93)))

/***/ }),
/* 128 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(process, setImmediate) {// A bit simpler than readable streams.
// Implement an async ._write(chunk, encoding, cb), and it'll handle all
// the drain event emission and buffering.



module.exports = Writable;

/*<replacement>*/
var processNextTick = __webpack_require__(127);
/*</replacement>*/

/*<replacement>*/
var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
/*</replacement>*/

/*<replacement>*/
var Buffer = __webpack_require__(38).Buffer;
/*</replacement>*/

Writable.WritableState = WritableState;

/*<replacement>*/
var util = __webpack_require__(70);
util.inherits = __webpack_require__(64);
/*</replacement>*/

/*<replacement>*/
var internalUtil = {
  deprecate: __webpack_require__(428)
};
/*</replacement>*/

/*<replacement>*/
var Stream;
(function () {
  try {
    Stream = __webpack_require__(91);
  } catch (_) {} finally {
    if (!Stream) Stream = __webpack_require__(92).EventEmitter;
  }
})();
/*</replacement>*/

var Buffer = __webpack_require__(38).Buffer;

util.inherits(Writable, Stream);

function nop() {}

function WriteReq(chunk, encoding, cb) {
  this.chunk = chunk;
  this.encoding = encoding;
  this.callback = cb;
  this.next = null;
}

var Duplex;
function WritableState(options, stream) {
  Duplex = Duplex || __webpack_require__(55);

  options = options || {};

  // object stream flag to indicate whether or not this stream
  // contains buffers or objects.
  this.objectMode = !!options.objectMode;

  if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;

  // the point at which write() starts returning false
  // Note: 0 is a valid value, means that we always return false if
  // the entire buffer is not flushed immediately on write()
  var hwm = options.highWaterMark;
  var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;

  // cast to ints.
  this.highWaterMark = ~~this.highWaterMark;

  this.needDrain = false;
  // at the start of calling end()
  this.ending = false;
  // when end() has been called, and returned
  this.ended = false;
  // when 'finish' is emitted
  this.finished = false;

  // should we decode strings into buffers before passing to _write?
  // this is here so that some node-core streams can optimize string
  // handling at a lower level.
  var noDecode = options.decodeStrings === false;
  this.decodeStrings = !noDecode;

  // Crypto is kind of old and crusty.  Historically, its default string
  // encoding is 'binary' so we have to make this configurable.
  // Everything else in the universe uses 'utf8', though.
  this.defaultEncoding = options.defaultEncoding || 'utf8';

  // not an actual buffer we keep track of, but a measurement
  // of how much we're waiting to get pushed to some underlying
  // socket or file.
  this.length = 0;

  // a flag to see when we're in the middle of a write.
  this.writing = false;

  // when true all writes will be buffered until .uncork() call
  this.corked = 0;

  // a flag to be able to tell if the onwrite cb is called immediately,
  // or on a later tick.  We set this to true at first, because any
  // actions that shouldn't happen until "later" should generally also
  // not happen before the first write call.
  this.sync = true;

  // a flag to know if we're processing previously buffered items, which
  // may call the _write() callback in the same tick, so that we don't
  // end up in an overlapped onwrite situation.
  this.bufferProcessing = false;

  // the callback that's passed to _write(chunk,cb)
  this.onwrite = function (er) {
    onwrite(stream, er);
  };

  // the callback that the user supplies to write(chunk,encoding,cb)
  this.writecb = null;

  // the amount that is being written when _write is called.
  this.writelen = 0;

  this.bufferedRequest = null;
  this.lastBufferedRequest = null;

  // number of pending user-supplied write callbacks
  // this must be 0 before 'finish' can be emitted
  this.pendingcb = 0;

  // emit prefinish if the only thing we're waiting for is _write cbs
  // This is relevant for synchronous Transform streams
  this.prefinished = false;

  // True if the error was already emitted and should not be thrown again
  this.errorEmitted = false;

  // count buffered requests
  this.bufferedRequestCount = 0;

  // create the two objects needed to store the corked requests
  // they are not a linked list, as no new elements are inserted in there
  this.corkedRequestsFree = new CorkedRequest(this);
  this.corkedRequestsFree.next = new CorkedRequest(this);
}

WritableState.prototype.getBuffer = function writableStateGetBuffer() {
  var current = this.bufferedRequest;
  var out = [];
  while (current) {
    out.push(current);
    current = current.next;
  }
  return out;
};

(function () {
  try {
    Object.defineProperty(WritableState.prototype, 'buffer', {
      get: internalUtil.deprecate(function () {
        return this.getBuffer();
      }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
    });
  } catch (_) {}
})();

var Duplex;
function Writable(options) {
  Duplex = Duplex || __webpack_require__(55);

  // Writable ctor is applied to Duplexes, though they're not
  // instanceof Writable, they're instanceof Readable.
  if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options);

  this._writableState = new WritableState(options, this);

  // legacy.
  this.writable = true;

  if (options) {
    if (typeof options.write === 'function') this._write = options.write;

    if (typeof options.writev === 'function') this._writev = options.writev;
  }

  Stream.call(this);
}

// Otherwise people can pipe Writable streams, which is just wrong.
Writable.prototype.pipe = function () {
  this.emit('error', new Error('Cannot pipe. Not readable.'));
};

function writeAfterEnd(stream, cb) {
  var er = new Error('write after end');
  // TODO: defer error events consistently everywhere, not just the cb
  stream.emit('error', er);
  processNextTick(cb, er);
}

// If we get something that is not a buffer, string, null, or undefined,
// and we're not in objectMode, then that's an error.
// Otherwise stream chunks are all considered to be of length=1, and the
// watermarks determine how many objects to keep in the buffer, rather than
// how many bytes or characters.
function validChunk(stream, state, chunk, cb) {
  var valid = true;

  if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
    var er = new TypeError('Invalid non-string/buffer chunk');
    stream.emit('error', er);
    processNextTick(cb, er);
    valid = false;
  }
  return valid;
}

Writable.prototype.write = function (chunk, encoding, cb) {
  var state = this._writableState;
  var ret = false;

  if (typeof encoding === 'function') {
    cb = encoding;
    encoding = null;
  }

  if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;

  if (typeof cb !== 'function') cb = nop;

  if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {
    state.pendingcb++;
    ret = writeOrBuffer(this, state, chunk, encoding, cb);
  }

  return ret;
};

Writable.prototype.cork = function () {
  var state = this._writableState;

  state.corked++;
};

Writable.prototype.uncork = function () {
  var state = this._writableState;

  if (state.corked) {
    state.corked--;

    if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  }
};

Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  // node::ParseEncoding() requires lower case.
  if (typeof encoding === 'string') encoding = encoding.toLowerCase();
  if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
  this._writableState.defaultEncoding = encoding;
};

function decodeChunk(state, chunk, encoding) {
  if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
    chunk = new Buffer(chunk, encoding);
  }
  return chunk;
}

// if we're already writing something, then just put this
// in the queue, and wait our turn.  Otherwise, call _write
// If we return false, then we need a drain event, so set that flag.
function writeOrBuffer(stream, state, chunk, encoding, cb) {
  chunk = decodeChunk(state, chunk, encoding);

  if (Buffer.isBuffer(chunk)) encoding = 'buffer';
  var len = state.objectMode ? 1 : chunk.length;

  state.length += len;

  var ret = state.length < state.highWaterMark;
  // we must ensure that previous needDrain will not be reset to false.
  if (!ret) state.needDrain = true;

  if (state.writing || state.corked) {
    var last = state.lastBufferedRequest;
    state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
    if (last) {
      last.next = state.lastBufferedRequest;
    } else {
      state.bufferedRequest = state.lastBufferedRequest;
    }
    state.bufferedRequestCount += 1;
  } else {
    doWrite(stream, state, false, len, chunk, encoding, cb);
  }

  return ret;
}

function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  state.writelen = len;
  state.writecb = cb;
  state.writing = true;
  state.sync = true;
  if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  state.sync = false;
}

function onwriteError(stream, state, sync, er, cb) {
  --state.pendingcb;
  if (sync) processNextTick(cb, er);else cb(er);

  stream._writableState.errorEmitted = true;
  stream.emit('error', er);
}

function onwriteStateUpdate(state) {
  state.writing = false;
  state.writecb = null;
  state.length -= state.writelen;
  state.writelen = 0;
}

function onwrite(stream, er) {
  var state = stream._writableState;
  var sync = state.sync;
  var cb = state.writecb;

  onwriteStateUpdate(state);

  if (er) onwriteError(stream, state, sync, er, cb);else {
    // Check if we're actually ready to finish, but don't emit yet
    var finished = needFinish(state);

    if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
      clearBuffer(stream, state);
    }

    if (sync) {
      /*<replacement>*/
      asyncWrite(afterWrite, stream, state, finished, cb);
      /*</replacement>*/
    } else {
      afterWrite(stream, state, finished, cb);
    }
  }
}

function afterWrite(stream, state, finished, cb) {
  if (!finished) onwriteDrain(stream, state);
  state.pendingcb--;
  cb();
  finishMaybe(stream, state);
}

// Must force callback to be called on nextTick, so that we don't
// emit 'drain' before the write() consumer gets the 'false' return
// value, and has a chance to attach a 'drain' listener.
function onwriteDrain(stream, state) {
  if (state.length === 0 && state.needDrain) {
    state.needDrain = false;
    stream.emit('drain');
  }
}

// if there's something in the buffer waiting, then process it
function clearBuffer(stream, state) {
  state.bufferProcessing = true;
  var entry = state.bufferedRequest;

  if (stream._writev && entry && entry.next) {
    // Fast case, write everything using _writev()
    var l = state.bufferedRequestCount;
    var buffer = new Array(l);
    var holder = state.corkedRequestsFree;
    holder.entry = entry;

    var count = 0;
    while (entry) {
      buffer[count] = entry;
      entry = entry.next;
      count += 1;
    }

    doWrite(stream, state, true, state.length, buffer, '', holder.finish);

    // doWrite is always async, defer these to save a bit of time
    // as the hot path ends with doWrite
    state.pendingcb++;
    state.lastBufferedRequest = null;
    state.corkedRequestsFree = holder.next;
    holder.next = null;
  } else {
    // Slow case, write chunks one-by-one
    while (entry) {
      var chunk = entry.chunk;
      var encoding = entry.encoding;
      var cb = entry.callback;
      var len = state.objectMode ? 1 : chunk.length;

      doWrite(stream, state, false, len, chunk, encoding, cb);
      entry = entry.next;
      // if we didn't call the onwrite immediately, then
      // it means that we need to wait until it does.
      // also, that means that the chunk and cb are currently
      // being processed, so move the buffer counter past them.
      if (state.writing) {
        break;
      }
    }

    if (entry === null) state.lastBufferedRequest = null;
  }

  state.bufferedRequestCount = 0;
  state.bufferedRequest = entry;
  state.bufferProcessing = false;
}

Writable.prototype._write = function (chunk, encoding, cb) {
  cb(new Error('not implemented'));
};

Writable.prototype._writev = null;

Writable.prototype.end = function (chunk, encoding, cb) {
  var state = this._writableState;

  if (typeof chunk === 'function') {
    cb = chunk;
    chunk = null;
    encoding = null;
  } else if (typeof encoding === 'function') {
    cb = encoding;
    encoding = null;
  }

  if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);

  // .end() fully uncorks
  if (state.corked) {
    state.corked = 1;
    this.uncork();
  }

  // ignore unnecessary end() calls.
  if (!state.ending && !state.finished) endWritable(this, state, cb);
};

function needFinish(state) {
  return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
}

function prefinish(stream, state) {
  if (!state.prefinished) {
    state.prefinished = true;
    stream.emit('prefinish');
  }
}

function finishMaybe(stream, state) {
  var need = needFinish(state);
  if (need) {
    if (state.pendingcb === 0) {
      prefinish(stream, state);
      state.finished = true;
      stream.emit('finish');
    } else {
      prefinish(stream, state);
    }
  }
  return need;
}

function endWritable(stream, state, cb) {
  state.ending = true;
  finishMaybe(stream, state);
  if (cb) {
    if (state.finished) processNextTick(cb);else stream.once('finish', cb);
  }
  state.ended = true;
  stream.writable = false;
}

// It seems a linked list but it is not
// there will be only 2 of these for each stream
function CorkedRequest(state) {
  var _this = this;

  this.next = null;
  this.entry = null;

  this.finish = function (err) {
    var entry = _this.entry;
    _this.entry = null;
    while (entry) {
      var cb = entry.callback;
      state.pendingcb--;
      cb(err);
      entry = entry.next;
    }
    if (state.corkedRequestsFree) {
      state.corkedRequestsFree.next = _this;
    } else {
      state.corkedRequestsFree = _this;
    }
  };
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(93), __webpack_require__(180).setImmediate))

/***/ }),
/* 129 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// a transform stream is a readable/writable stream where you do
// something with the data.  Sometimes it's called a "filter",
// but that's not a great name for it, since that implies a thing where
// some bits pass through, and others are simply ignored.  (That would
// be a valid example of a transform, of course.)
//
// While the output is causally related to the input, it's not a
// necessarily symmetric or synchronous transformation.  For example,
// a zlib stream might take multiple plain-text writes(), and then
// emit a single compressed chunk some time in the future.
//
// Here's how this works:
//
// The Transform stream has all the aspects of the readable and writable
// stream classes.  When you write(chunk), that calls _write(chunk,cb)
// internally, and returns false if there's a lot of pending writes
// buffered up.  When you call read(), that calls _read(n) until
// there's enough pending readable data buffered up.
//
// In a transform stream, the written data is placed in a buffer.  When
// _read(n) is called, it transforms the queued up data, calling the
// buffered _write cb's as it consumes chunks.  If consuming a single
// written chunk would result in multiple output chunks, then the first
// outputted bit calls the readcb, and subsequent chunks just go into
// the read buffer, and will cause it to emit 'readable' if necessary.
//
// This way, back-pressure is actually determined by the reading side,
// since _read has to be called to start processing a new chunk.  However,
// a pathological inflate type of transform can cause excessive buffering
// here.  For example, imagine a stream where every byte of input is
// interpreted as an integer from 0-255, and then results in that many
// bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in
// 1kb of data being output.  In this case, you could write a very small
// amount of input, and end up with a very large amount of output.  In
// such a pathological inflating mechanism, there'd be no way to tell
// the system to stop doing the transform.  A single 4MB write could
// cause the system to run out of memory.
//
// However, even in such a pathological case, only a single written chunk
// would be consumed, and then the rest would wait (un-transformed) until
// the results of the previous transformed chunk were consumed.



module.exports = Transform;

var Duplex = __webpack_require__(55);

/*<replacement>*/
var util = __webpack_require__(70);
util.inherits = __webpack_require__(64);
/*</replacement>*/

util.inherits(Transform, Duplex);

function TransformState(stream) {
  this.afterTransform = function (er, data) {
    return afterTransform(stream, er, data);
  };

  this.needTransform = false;
  this.transforming = false;
  this.writecb = null;
  this.writechunk = null;
  this.writeencoding = null;
}

function afterTransform(stream, er, data) {
  var ts = stream._transformState;
  ts.transforming = false;

  var cb = ts.writecb;

  if (!cb) return stream.emit('error', new Error('no writecb in Transform class'));

  ts.writechunk = null;
  ts.writecb = null;

  if (data !== null && data !== undefined) stream.push(data);

  cb(er);

  var rs = stream._readableState;
  rs.reading = false;
  if (rs.needReadable || rs.length < rs.highWaterMark) {
    stream._read(rs.highWaterMark);
  }
}

function Transform(options) {
  if (!(this instanceof Transform)) return new Transform(options);

  Duplex.call(this, options);

  this._transformState = new TransformState(this);

  // when the writable side finishes, then flush out anything remaining.
  var stream = this;

  // start out asking for a readable event once data is transformed.
  this._readableState.needReadable = true;

  // we have implemented the _read method, and done the other things
  // that Readable wants before the first _read call, so unset the
  // sync guard flag.
  this._readableState.sync = false;

  if (options) {
    if (typeof options.transform === 'function') this._transform = options.transform;

    if (typeof options.flush === 'function') this._flush = options.flush;
  }

  this.once('prefinish', function () {
    if (typeof this._flush === 'function') this._flush(function (er) {
      done(stream, er);
    });else done(stream);
  });
}

Transform.prototype.push = function (chunk, encoding) {
  this._transformState.needTransform = false;
  return Duplex.prototype.push.call(this, chunk, encoding);
};

// This is the part where you do stuff!
// override this function in implementation classes.
// 'chunk' is an input chunk.
//
// Call `push(newChunk)` to pass along transformed output
// to the readable side.  You may call 'push' zero or more times.
//
// Call `cb(err)` when you are done with this chunk.  If you pass
// an error, then that'll put the hurt on the whole operation.  If you
// never call cb(), then you'll never get another chunk.
Transform.prototype._transform = function (chunk, encoding, cb) {
  throw new Error('not implemented');
};

Transform.prototype._write = function (chunk, encoding, cb) {
  var ts = this._transformState;
  ts.writecb = cb;
  ts.writechunk = chunk;
  ts.writeencoding = encoding;
  if (!ts.transforming) {
    var rs = this._readableState;
    if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  }
};

// Doesn't matter what the args are here.
// _transform does all the work.
// That we got here means that the readable side wants more data.
Transform.prototype._read = function (n) {
  var ts = this._transformState;

  if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
    ts.transforming = true;
    this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  } else {
    // mark that we need a transform, so that any data that comes in
    // will get processed, now that we've asked for it.
    ts.needTransform = true;
  }
};

function done(stream, er) {
  if (er) return stream.emit('error', er);

  // if there's nothing in the write buffer, then that means
  // that nothing more will ever be provided
  var ws = stream._writableState;
  var ts = stream._transformState;

  if (ws.length) throw new Error('calling transform done when ws.length != 0');

  if (ts.transforming) throw new Error('calling transform done when still transforming');

  return stream.push(null);
}

/***/ }),
/* 130 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

module.exports = function (it) {
  return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) === 'object' ? it !== null : typeof it === 'function';
};

/***/ }),
/* 131 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(186)(function () {
  return Object.defineProperty({}, 'a', { get: function get() {
      return 7;
    } }).a != 7;
});

/***/ }),
/* 132 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var external = __webpack_require__(71);
var DataWorker = __webpack_require__(190);
var DataLengthProbe = __webpack_require__(191);
var Crc32Probe = __webpack_require__(192);
var DataLengthProbe = __webpack_require__(191);

/**
 * Represent a compressed object, with everything needed to decompress it.
 * @constructor
 * @param {number} compressedSize the size of the data compressed.
 * @param {number} uncompressedSize the size of the data after decompression.
 * @param {number} crc32 the crc32 of the decompressed file.
 * @param {object} compression the type of compression, see lib/compressions.js.
 * @param {String|ArrayBuffer|Uint8Array|Buffer} data the compressed data.
 */
function CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) {
    this.compressedSize = compressedSize;
    this.uncompressedSize = uncompressedSize;
    this.crc32 = crc32;
    this.compression = compression;
    this.compressedContent = data;
}

CompressedObject.prototype = {
    /**
     * Create a worker to get the uncompressed content.
     * @return {GenericWorker} the worker.
     */
    getContentWorker: function getContentWorker() {
        var worker = new DataWorker(external.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new DataLengthProbe("data_length"));

        var that = this;
        worker.on("end", function () {
            if (this.streamInfo['data_length'] !== that.uncompressedSize) {
                throw new Error("Bug : uncompressed data size mismatch");
            }
        });
        return worker;
    },
    /**
     * Create a worker to get the compressed content.
     * @return {GenericWorker} the worker.
     */
    getCompressedWorker: function getCompressedWorker() {
        return new DataWorker(external.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
    }
};

/**
 * Chain the given worker with other workers to compress the content with the
 * given compresion.
 * @param {GenericWorker} uncompressedWorker the worker to pipe.
 * @param {Object} compression the compression object.
 * @param {Object} compressionOptions the options to use when compressing.
 * @return {GenericWorker} the new worker compressing the content.
 */
CompressedObject.createWorkerFrom = function (uncompressedWorker, compression, compressionOptions) {
    return uncompressedWorker.pipe(new Crc32Probe()).pipe(new DataLengthProbe("uncompressedSize")).pipe(compression.compressWorker(compressionOptions)).pipe(new DataLengthProbe("compressedSize")).withStreamInfo("compression", compression);
};

module.exports = CompressedObject;

/***/ }),
/* 133 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var utils = __webpack_require__(9);

/**
 * The following functions come from pako, from pako/lib/zlib/crc32.js
 * released under the MIT license, see pako https://github.com/nodeca/pako/
 */

// Use ordinary array, since untyped makes no boost here
function makeTable() {
    var c,
        table = [];

    for (var n = 0; n < 256; n++) {
        c = n;
        for (var k = 0; k < 8; k++) {
            c = c & 1 ? 0xEDB88320 ^ c >>> 1 : c >>> 1;
        }
        table[n] = c;
    }

    return table;
}

// Create table on load. Just 255 signed longs. Not a problem.
var crcTable = makeTable();

function crc32(crc, buf, len, pos) {
    var t = crcTable,
        end = pos + len;

    crc = crc ^ -1;

    for (var i = pos; i < end; i++) {
        crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 0xFF];
    }

    return crc ^ -1; // >>> 0;
}

// That's all for the pako functions.

/**
 * Compute the crc32 of a string.
 * This is almost the same as the function crc32, but for strings. Using the
 * same function for the two use cases leads to horrible performances.
 * @param {Number} crc the starting value of the crc.
 * @param {String} str the string to use.
 * @param {Number} len the length of the string.
 * @param {Number} pos the starting position for the crc32 computation.
 * @return {Number} the computed crc32.
 */
function crc32str(crc, str, len, pos) {
    var t = crcTable,
        end = pos + len;

    crc = crc ^ -1;

    for (var i = pos; i < end; i++) {
        crc = crc >>> 8 ^ t[(crc ^ str.charCodeAt(i)) & 0xFF];
    }

    return crc ^ -1; // >>> 0;
}

module.exports = function crc32wrapper(input, crc) {
    if (typeof input === "undefined" || !input.length) {
        return 0;
    }

    var isArray = utils.getTypeOf(input) !== "string";

    if (isArray) {
        return crc32(crc | 0, input, input.length, 0);
    } else {
        return crc32str(crc | 0, input, input.length, 0);
    }
};

/***/ }),
/* 134 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// (C) 1995-2013 Jean-loup Gailly and Mark Adler
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//   claim that you wrote the original software. If you use this software
//   in a product, an acknowledgment in the product documentation would be
//   appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
//   misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.

module.exports = {
  2: 'need dictionary', /* Z_NEED_DICT       2  */
  1: 'stream end', /* Z_STREAM_END      1  */
  0: '', /* Z_OK              0  */
  '-1': 'file error', /* Z_ERRNO         (-1) */
  '-2': 'stream error', /* Z_STREAM_ERROR  (-2) */
  '-3': 'data error', /* Z_DATA_ERROR    (-3) */
  '-4': 'insufficient memory', /* Z_MEM_ERROR     (-4) */
  '-5': 'buffer error', /* Z_BUF_ERROR     (-5) */
  '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
};

/***/ }),
/* 135 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/*!
* screenfull
* v3.3.2 - 2017-10-27
* (c) Sindre Sorhus; MIT License
*/
(function () {
	'use strict';

	var document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {};
	var isCommonjs = typeof module !== 'undefined' && module.exports;
	var keyboardAllowed = typeof Element !== 'undefined' && 'ALLOW_KEYBOARD_INPUT' in Element;

	var fn = function () {
		var val;

		var fnMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'],
		// New WebKit
		['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'],
		// Old WebKit (Safari 5.1)
		['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];

		var i = 0;
		var l = fnMap.length;
		var ret = {};

		for (; i < l; i++) {
			val = fnMap[i];
			if (val && val[1] in document) {
				for (i = 0; i < val.length; i++) {
					ret[fnMap[0][i]] = val[i];
				}
				return ret;
			}
		}

		return false;
	}();

	var eventNameMap = {
		change: fn.fullscreenchange,
		error: fn.fullscreenerror
	};

	var screenfull = {
		request: function request(elem) {
			var request = fn.requestFullscreen;

			elem = elem || document.documentElement;

			// Work around Safari 5.1 bug: reports support for
			// keyboard in fullscreen even though it doesn't.
			// Browser sniffing, since the alternative with
			// setTimeout is even worse.
			if (/ Version\/5\.1(?:\.\d+)? Safari\//.test(navigator.userAgent)) {
				elem[request]();
			} else {
				elem[request](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT);
			}
		},
		exit: function exit() {
			document[fn.exitFullscreen]();
		},
		toggle: function toggle(elem) {
			if (this.isFullscreen) {
				this.exit();
			} else {
				this.request(elem);
			}
		},
		onchange: function onchange(callback) {
			this.on('change', callback);
		},
		onerror: function onerror(callback) {
			this.on('error', callback);
		},
		on: function on(event, callback) {
			var eventName = eventNameMap[event];
			if (eventName) {
				document.addEventListener(eventName, callback, false);
			}
		},
		off: function off(event, callback) {
			var eventName = eventNameMap[event];
			if (eventName) {
				document.removeEventListener(eventName, callback, false);
			}
		},
		raw: fn
	};

	if (!fn) {
		if (isCommonjs) {
			module.exports = false;
		} else {
			window.screenfull = false;
		}

		return;
	}

	Object.defineProperties(screenfull, {
		isFullscreen: {
			get: function get() {
				return Boolean(document[fn.fullscreenElement]);
			}
		},
		element: {
			enumerable: true,
			get: function get() {
				return document[fn.fullscreenElement];
			}
		},
		enabled: {
			enumerable: true,
			get: function get() {
				// Coerce to boolean in case of old WebKit
				return Boolean(document[fn.fullscreenEnabled]);
			}
		}
	});

	if (isCommonjs) {
		module.exports = screenfull;
	} else {
		window.screenfull = screenfull;
	}
})();

/***/ }),
/* 136 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : media/EventSounds.js
 *  Created : 01/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(484), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, EventSoundsElement, Utils) {

  /**
   * The EventSounds objects contains specific sounds to be played when JClic events are fired:
   * - start
   * - click
   * - actionError
   * - actionOk
   * - finishedError
   * - finishedOk
   *
   * The sounds are stored in an array of {@link EventSoundsElement} objects.
   * @exports EventSounds
   * @class
   */
  var EventSounds = function () {
    /**
     * EventSounds constructor
     * @param {EventSounds=} parent - Another EventSounds object that will act as a parent of this one,
     * used to resolve which sound must be played for events when not defined here.
     */
    function EventSounds(parent) {
      _classCallCheck(this, EventSounds);

      if (parent) this.elements = Object.assign({}, this.elements, parent.elements);
    }

    /**
     * Reads the object properties from an XML element
     * @param {external:jQuery} $xml - The XML element to be parsed
     */


    _createClass(EventSounds, [{
      key: "setProperties",
      value: function setProperties($xml) {
        var _this = this;

        $xml.children().each(function (_n, child) {
          var id = child.getAttribute('id');
          _this.elements[id] = new EventSoundsElement(id);
          _this.elements[id].setProperties($(child));
        });
        return this;
      }

      /**
       * Instantiates the audio objects needed to play event sounds
       * @param {PlayStation} ps
       * @param {MediaBag} mediaBag
       */

    }, {
      key: "realize",
      value: function realize(ps, mediaBag) {
        // Values are {EventSoundElement} objects
        $.each(this.elements, function (key, value) {
          return value.realize(ps, mediaBag);
        });
      }

      /**
       * Plays a specific event sound
       * @param {string} eventName - The identifier of the event to be played
       */

    }, {
      key: "play",
      value: function play(eventName) {
        var sound = this.elements[eventName];
        if (sound) sound.play();
      }
    }]);

    return EventSounds;
  }();

  /**
   * Audio data for default event sounds
   * @name EventSounds.MEDIA
   * @type {object} */


  EventSounds.MEDIA = {
    start: 'data:audio/mp3;base64,' + '//NAxAARGk5RdUEQANIEZEBAPGPyIAAYAKMY/6EaQn8hP+c/yEb//kITU7oc9Cf6nPnPoT/8nQhC' + 'KEEEnDizkAwM8ThYH1Bj/EAYEhyUGghyivv7fn0vtsLdYI0CiTQE+aaqfH3BW37/80LEFhl6nvZf' + 'j1ACplLtsfx19gOQfBp7iHeEWRj8WxiLLI6khikjEI9IvsePycfERCSpPJ9s95IbO1O/tRX70XQi' + 'OGX+n+hmeb+aMirKxN/IibInf//G3K9PVym7NoL/W2usCkcMT5T/80DEDBcivuJd0lADkXMLoGxc' + 'A7ENhPlAY8LMK280iLkhQq80ojkRQCwz/rEsTjjTlMPMu3RWZ2c3dmONON0NVDzDzDzP79Y9PFg9' + 'v//oqi4hHyp+7HGl2b///I8VcYAAls9qrCT1Mv/zQsQKFsrCvlzLRNa/FN/jd/HUrGLUa8tKonzD' + 'K8+t55alG5sbKYilBExD8Id1ugmp+eKIdSplGpaoxNZiznEU/J9KJmUsqBzPVjJ/+Aif//71QCdv' + '+gE7f//6gICqPAAci1sbgH8/G//zQMQKFfF2qb9ZaAKU9PlY3uHFsAqAXfgZvyyhtTM2fC1zH/8+' + 'tFlslODFHjTHsClFqSTfprRCxdzMcppQ8yHsbbEkzpoLvZFBnWt1GBa/+8se/+SPdQe//FIIsAAA' + 'ba7YbC65AQAf//NCxA0XMh6xv5OIAEIz0mVENAJ0DbwIQjpGYFNAvTSI1ePBuh+MwYk+xib0DA/K' + '5YQadIk+o0Z0UyLmiv+h5bMD1Ro3/3/TSUggmu/+v/7KNL03CcLAh//5dpCqkltAAAqFFpldqAHI' + '//NAxAwXGl7aXYxoABm/nTyF8EwhIPY/DSOKUIQ2WXUzAlFDQXzyRCXBUNUk33XoqQNhyeltWFUL' + '6CKTImv7/vSZNZw0MP6v/v2oFQ5EUR7/1SVyb//E7FkIn9f9NXWQAg47vXRBbzv/80LEChbaYs5f' + '2IAC9rPHK1z/yygqmvwSoaAGvNLr9jCagdVUGyxOpVqpp79lJPf9ZNEttWXTUvf/9azMUgOcZrZP' + 'MThF00d7//v///9SnpUlpJJJJJFeLhp3///yKi4QAHWdrdQE07P/80DEChTJvrI+Ro6Oalhjl3DY' + 'QyyMpMHHcIbTFNlqYvp6GKBJBYZ89G+PKyt/Q4oCbx9z9b//80CTA+F3zTlSqOz6G0PoVCIItC3/' + 'CnwN/xZAvcr/99VSIAEKz7+UABhWz01LyctXJv/zQsQRE5nOvl4WFHISWA9Ybn87+VaIKzA0kk7n' + '33/KHo6qv1QKoNjMTHtX//ocaRCuGg2MP8jbueS9WIWU3NPcenOEv/CbcsVAKiIkATNv/9QAb60q' + 'FitrzbcZQ+ixX7169gCfAOpwHf/zQMQeE+Fasl4T0HJRrdobjyh8XBKr80WAqJQaiQPhY7vmJ4//' + '/ppkOhOaLMDbgVOwVdYt0SgqM/4hBQO+qglKQAFQM0aPnrrVvpRJLyCYt2amWVGBpcJrSl6ypI4h' + 'goMQk5Di+Yv3//NCxCkP+IpANGYehC+92dkrPJ/1a+z+3/r/sL/6f+6G7BotKqkVeDWsJLMDPP8p' + 'f2a4///Jf+VgHuRkfn85h7MIeAY9RE3ZM3IRTyUaGvCJpep52lDPb0nCY5xRqRkEWzDKgw+8Ftdp' + '//NAxEUS42YhgAhHHAG9ZCQjo0VONppYbQStB6qWUv5f591O8bze0/3y//62eUqnWzSn9vNsnOBz' + 'K8TN6urr6bcxGukbeqNZjuyIMO5FREnqzI6SVZVcahzgpCwMa561B4M8zjedy6v/80LEVBI7ViYo' + 'CEsdN5b7kv/+Rsub5P/X6yz0/JdhcZdZl+/hII/xFYdTSmc0ck3O0055fkc2R+ZgsyZsEagnMwRq' + 'kK1xle//6iZh/ITJmiF/yEKT4QyEKEP8hMQl/mNYxv+hn/lKZyn/80DEZxEbPiWICEc9StmmMZW0' + 'r1KXR/qYxnX0UpWMZAxQFqoapnCiQwqxihWDAQEBAQEKE6mZGZGTTMiMjTWZHa/aZkZlTRGXojIz' + 'L///////8yP85/5k1lspGrWRyNWCggYME4kGJf/zQsR9EkNiDAAARN1MNUkqTEFNRTMuOTkuNaqq' + 'qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq' + 'qqqqqqqqqqqqqqqqqqqqqqqqqv/zQMSQDcslQAoAR1mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq' + 'qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq' + 'qqqqqqqqqqqq',
    click: 'data:audio/mp3;base64,' + '//NAxAASsyJgIUEQAY///gX8///yfyHO/8hCEafoRp3nPQgAAEUAABBCEIT//QhCKQhNGyEIQhCN' + 'ITU5//OQhCN7f/yEZQAAIynOc5CEIhGnABGY/4gAIQZ4h4h4d3Z2Z9Jba5XWhWP/80LEEBhJOxcf' + 'iUAC9BEda+oiKFQsViiMpvHFC98pLjySjUNeKoYxMpwIT21HmHlEhx83A9K5vDAuZUQxzq7nJPgE' + 'VWKQZ1Iu5oJH3UpGObWV/MfAgLC4Z/yhP/ULKnqHd/syOQenhOL/80DEChZpZs7rzBgAT3bBWub0' + 'T/xNtn9nY5bvQdCA0TvnpXNC7EJ3iRPtebJ//7xK4IAqIii2AKbfkBAJxATDLN7wiUGv6VANBNjq' + 'QwGCayGoaBAJaNC79/z5wP2IuJbfZsNFgBVo7P/zQsQLF0lGxvRJhlQVDyEmYldHXJGadquTRs6a' + 'Ymq9VY1hqqt6xmqts2zGTvGNrl+u1IMBHREJREbkpaFQkFRoa2FYSDvBp6DwSf1lgFqfkQ0JcRCY' + 'lKxKg0eEw8sKqgaEogGBH3EZpv/zQMQJEyEudaoIBoAf+HV2UBjoOsP2/IwrkezQ1Y4e2wVxgxlV' + 'AqDQUSRUBRU6LrBY1lvxEdUBWBIOnZWOCrvlVnTsltWNOqPP4seUBcKgKpW44m3GkHLjaBS4ohHZ' + 'dTGi6FXXVo6+//NCxBcNYAYyWAhEAJ3U+j3uXdl1z1Du30fCySCGablvUTrhwggLTomAAmrWsmWY' + '9ym89ZcvlwX/zf+a95ZLwXOar/LNrJ60LUl25Hs58yKRWIjSbt9DCIs0UtF/TOlm2cyNTpKysuCB' + '//NAxD0Rw1YliAhHPdmd9nYYQOsGCgAfmqIAXlnhbNZeUBQvyL/y6NlP/r1LLlEiSPL/7lE9SirM' + '5zxZEwCseMDL330yrtl8/8jJs6mt5dTloYsvNSGbmTkYQhpVpRpCG1yr9YSfr1b/80LEURFLZiWQ' + 'CEc8v/rLXPzys+Z9z8v+H9qyCMpGLn3bla9qtcxYZXk9cbOUjb8t0q2ytz79ImM1R0ht3QdWK11m' + 'yihIpt8SZBRAlbWq3CDpDKWUte/VHgJDH6k+lsqSPbRj+pHWWrL/80DEZxKjYh2ICIfhxIKhMBeL' + 'PjgKlFRIKjCxIKjCukkFAKCSCxFtgTAQFIkisqIg2EngUVFg8FQCQUxBTUUzLjk5LjVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/zQsR3EnAF9kgARgBVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVQ==',
    actionOk: 'data:audio/mp3;base64,' + '//NAxAAT+gKmPUFoAI81KAANYQZECuQAASjAD820006kC+buYDgGEGEKIcsCYAUQYA6JeI2JmS5w' + 'cY5yXL6b1IJpp6kG////9X+h/oaaaadAvpvBA5/9QIDQQOQ+cbQllsQQAKTggvn/80LECxdCcupd' + 'jFACwA8cFoNFZuosRJUe3E48kEhWIRueePjSdR4T9XMQ4SwB/BZ1GQNAtHHOPzOFryImV2zlb//r' + 'ZV/6MYp56IY00sPgvi5vp1NN///3Q4ZlSUVV6wAAHLn//b/+Bv3/80DEChbo7s5fmGgA8cDgPEdP' + 'slrmVdkwdsV66+p2vZktFECYbF0sxMc6XTyGfU7omIDWqTLdIdocopcSHkqkN/1OLnGEiTI5lQIH' + 'z6F//h8+Aw////SWn6Ai////RQCALJttttthGP/zQsQJFgLXBl+PUAJpUBpuDr/a/Bn7vbuBpTSa' + 'Ju9C26HLGnV05pymMa+52rjwoQl9HX5xkseQEWn/zR+C+CGcTN1IQsr/O/6N///////zyotv//Ul' + 'b+WNu/4a/G/DAGASAsBQ86QpAv/zQMQNFyqWqFWaUACorGJ3w70JwQXdB1Iw8FBR6w8BkLlXmCwS' + 'QKbRFEDGyFEFw/LiWNeT8eOSG/++3///5oEpv5wrF/RmoYsz////+yuLZ55GT//yosfyqj5gugAN' + 'MBv///+Bt0Bw//NCxAsWul7hv49QAIAcsuZ3XnIKHgXVwYS+wjbgGuEvA8WjfAsaQmNk2QkZh551' + '7ceH7uZegsm5y///0VTDzzDz09dev/6IIMKcL8i/5CSjE3/oqRMBZpmk7R/RgAAbjwkkcZrZNKRG' + '//NAxAwW4j6pudpoAwwbDspelxARGBQ5l21KTHGz7RkyVSuLZ5l3/S9SQ1CutfuvPzIvF4HUFzRX' + 'NkiXJVH+pv//mvMTVRJGyT6S29LRao2Wqj///UbLJxLHVPBVD9SWyADnc5p6REf/80LECxb6Uoxe' + '3A7SY0MyGLYtINLEx4dXVEEvywRGZ7pcZEtrkjRpam6yOArCCRZNX/W3WOoGKq04z/0I/nt/UCYZ' + 'f6GfovMahvTn21oZ7KnY4oNhuRFQuLsBID8cKC5qSQAC9j29EzH/80DECxNZYoT+xuAyRLbuBA8W' + 'RBNAN0Eq+mboAV7G62xjgCvi7cM0Ov1kOELDyoy/75RGdB8iaMZJ//S9SaPWe8oonsV4o5NO40K5' + 'FG2xNQZo78WcFOwcZjQQYvlIW6mGkh0f0ZiOBv/zQsQYE8jiVBDfVogDF7hUFzGQhTgpeTFkKEeX' + 'lL8syjVHZ03ZCDR2nSxR7Pq7np3LRaHB9adBZ07r018kdy3tjTX1KiSqekjtoMGlaAKNEYCZkOHz' + 'pZziA0FmwmEDZhMwfvxGWFAY3P/zQMQkE5DaRAjW1ohECprRK1TRrKRtJsNpyJrNfLvndF7g+gSn' + 'Ayt351B5obyX8r/u//////rqgBmlYGs01hNdBQpEQyNoHhEMuUtgytPS01oLy0hu6NVNabzryYxw' + 'zfIqvKPaRFls//NCxDAQ+FYw8gjSKH7tHbMxfJlUtVpIB16SI0SEXBsf68/+/L//zfLll/nmj7F/' + '1pcpZ/+Z3Ur5Eq5WpbM9MfPljxeb9Lamv/nXIuOSkVXJVRmzRxLpVUlMiBhOahamKCgmCgSwVXHX' + '//NAxEgRU1YcAABGvSNI0Nzzp5SNpUj5aE3ZUqAvIkhEnnq1D3/yxFqrceAgEVIho8WKlhKVGBUJ' + 'HjzvOh0JndVbtdYykkFQmdDoaDqCIaLKTEFNRTMuOTkuNaqqqqqqqqqqqqqqqqr/80LEXRFYBf5I' + 'CEYAqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq' + 'qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo=',
    actionError: 'data:audio/mp3;base64,' + '//M4xAAUuVJUAUgYARcXFz4DgFAeKHAeChiIie7u+iaIibgYuAYGcTz3OIhf/Xd38v+J6J7u+gGB' + 'iw8P8PDw8PDHRw8/+O6GADo/h78BEQz8HAHh5+v+A4A6H/8AAEfIiZmZBXlicwVCsWj1//M4xAwY' + 'WvL/H4goAHY5EADTzSBEDUpfz/OhTMPGC+NAMWAgfAcAgHFSjhZD1PCRAUQFBjMUxMhGGuOVyndn' + 'XzvlH2dGLp+jbHsUykMTTFkX/+ror2841v+k//+MIOdv/GUVmvrpkGSqAYta//M4xAkXMsLmN89o' + 'Ag/iwxc/bCcqY374+ZYv8ms1WUWQHQlTUFCJgbIjvMcd6K1m71G+ttB9Pt32bR6OptTZxtV0l/ov' + '20P3b9/1/1f0dSCkh7FjKTdSRbQKiRLyBKFroXi7uP0CAvGOAWNk//M4xAsXwr7a/mPUwS+O1HXt' + 'gEWD0qvqiuk8xOG4QoqkAU5eFUIMYl8WHoK3Hcq2dx5p5fTjLvlFtLucF2SuaciHhslc4JhNnm5X' + 'U2pCS6c3n6+3/9GyFsk+xwWUQmSTumm7e5ggAEWsUBor//M4xAsXCrLXHntO7NUoPTkrtfAzt+Vm' + 'c1QDhdvOk4mMiMaxzG9AERpgbNKfJVp0/lfOvjfl9SWj5XpoXfIYVep7R0WTaUAGDj1IkMHy1Oyr' + 'fnfq2e37/22fJduLdKpFmVawABglJaFVG03L//M4xA0XurK+5HnLTJeQXpCP4L6DAO1L6jOnPOCx' + '/wVBu4nAIHEgOCbXJbP5R/74hGiwND1iw7BYtTsqM6viJ1aoa14o/kdXwsdo2K6nxravl7al1/t+' + 'rUDz4J+IDtW7bbVAX+3gDwiUL8lI//M4xA0Xgq7qVnoO+zaBvGmHeGt1WGsEPh7RWPKQT82FEhiW' + 'LGeUlRHjRERFE6UUhhATy9J5Lcv+PM+axpVIkaHDqqvi+yUHdjW3sp2vTv+rav9F/Kt+Lm9QJFdn' + 'wrvt7SXHLLMAFKoGoNaO//M4xA4UurLyXkDFT5XYo5iQ9ckoWFh61037WowPpb5NVRWlrUmVVqxm' + 'NV/b6q+xuJVfY1VVXfDHvnL7TGOFMb6ifdZf0etaP//lZH6FbyuK5MUAYWLKUvoamjS5tZpdNnrW' + 'z2ASUXdsckcS//M4xBoUcVJ4IisMydfHkiAUZzmoyajzSOzOf1T9qlFq+ORkFFeC//HxXOxf/PKP' + 'G/CNxYO4+WKbl+Lv4VBQU6KKhP/K/+vK3+WXVv/9SobSZ1b/lb9SshjN9S/Upahjf/LMahjv6qx/' + 'DpAR//M4xCcS40IEABDN5DMaqqrVVVjWLGPjH7GpWZ/7dqr47Eq/7HQds4duAxGfzkjUTpoLSIv/' + '//qn///YxTAwQIGhyP/u7O/3P2eqNZ2k4so4sp2NFAYhnZ2couBNTEFNRTMuOTkuNVVVVVVV//M4' + 'xDoKqz1wDACNy1VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
    finishedOk: 'data:audio/mp3;base64,' + '//NAxAAQiXIEAUIQAPnfO/OdyAYGehP/U5Gqd+c/8785zoBi3QhCMpCVP+SpwM6AYGODH/8TvB+s' + 'PiMP5cMCcPygIAg7/lAff4IAgcBCD6ofD4diQbC0WaISi0SB3EAzA8WZgeALXg3/80LEGBoDGyZf' + 'glACgsRODRuWFcnMLm+eQEhRVQz5IePy5Icm/2Yn5GLY58hG3/J0JyAkq54WhVHosmkTmr//OYkI' + 'x+aejta5yObVf////fbcgJP/8oP//L/+w6tzSgKyRVuaO6jleQb/80DEDBdLJs4/2FABfMefV3NU' + '1/Pu+MiMj5TGccdZM7mtR9poqDaj269WQ7clU5//OzTSgSRYFoL8eoeaaxhw+u9lq/9jn/NY7/3V' + 'PohqW+///////5ELQ+cqSm8F1QfSAHmkZP3Rz//zQsQJFgHCul9ZUACtuzlS2auXefrUxQUkTU+e' + 'tjYpBz++SrehymLQlDIbPScu+uppsoFMTf/5uSiO7kpKKo1ONQ6/NbKkDv8iJj3OE/xEHRQl1Hv/' + '/4UPLBeWtoFTaaAttttstQEAgP/zQMQNF1PXDl+BUAJQhUAPuz0DJsKELcVBuf+NDz79ceCoSE/m' + 'eeYSBfk6fQt91kZOYYxE3/+2YwtnyQxn////0JHMY+w/H5OSN/////zDGf5+p7///////kjSQxXT' + 'FGTyENw7gapG//NCxAoVUeLUAYKYABCegFrFga4BpxsoJJHKbdSSNc9rTRNTiRTtofSWUkUt1o19' + 'fWkoiIJAGaRYixFlM4yQ2FK7pDOlX6q0Ty0TFQNc910f521f//sEw5VqWAAa0xN/4IJysXXPUXWj' + '//NAxBAYQc7CX9RQAD7L1moNjonkAxWFww4nWd9JCeciFDR6QsKgKiayKccZU7pWdi9jnzTd7C9H' + 'zWNZFE6VNY70udouzEPUInt/WdLG0YKntR5SDn/rBWjQpBIJjCnEADG403RAjmT/80LEChYx1rpf' + 'U2gCXkzXRRXSZBTHSfAUM4JVGmSJvr92ZalqJzOtY1C+n3qXd7ojHpJVph9KfTv2QF00S62Usnjy' + 'Ukk+pbH0Uf+akuloBUN9eziVT/Kbf//1pSuJ/YIvIGDjaERizGT/80DEDRciBtzLgWgAnyaG0C1l' + 'wTMAJBpi0QiX27oskt/p2pJGx1aanoWQ9R1FMw1JVmtN1vSNE2ZKcL4kwhTIv+7hPkVpum9/54qQ' + 'NoCB5od9Wc/WVZltv//9olVqRkBpkMgFbWp6pf/zQsQLFGGq0jfYOAJYZ33eO8O4ay/WUDUrPXKa' + '0BSIWhEPEua1Jvfvd1CxL/0T7nGsppoSEjjaf6tN1ZTTR0SRqRO/+K/Ou/9CwVOnmrcSdMqBpY56' + 'yFdrrd+BUSsXF/De07+HriXkC//zQMQVEyIO7l9IOAINDw83zXmx47coMuc54Km6W6HL5VI1dHUo' + 'FS9CrJ/FZBL1apo8Bec67a3b/1JDQt4iEv/niXtWlQKNhcSXFrNXq9RoxmJPGjO8N0UWAZDR6hQZ' + 'VGYs4HkcGtuz//NCxCMcqvMKX4VQAp6GEjERDVO0nICRTDDitdHYkPnkRhZTDzS5o/yvFTPc9GLC' + 'uTkX7OXt7fseehISK578TUFArC8lNQ06n//2Gg/Jy48bb9TWcmmH//93/Fyy29rQUkjgEwC74QXH' + '//NAxAwTWb76X8xoAtGYil8Sf13FyrazOOzs66VgJUPYvJbKXWr+myS2SrPPf1KWiiiyOpLSWjRT' + 'ZFlalf//omqn///Bl/gqd4NSP1sCtUboQAq2KfAZcuompqTyWlosplpidkw4Y4D/80LEGRRiJrZd' + 'UqAAgAJMBywG+KiSmxrWtlKfMj6SV386x0gTt/1OtvvS0CizI+umWkl/XUbP1ESayKkktX93dfzz' + 'tT61SAEkgBQEjccjkciAYAa39zxcaPCYCFY9Q550fgIUwErGSDn/80DEIxwS+tZfhWgDSkw83gvv' + 'ZTK1Iko2tI9rLpf1mZ+b1tMy4Nm06mXyUQY9ZLXyQUJTs9RmYhzjd0y+bppJEj+8v/+81fqQYzTN' + '1ppIW/////+pA0UgaXaVuC5FVLzhMlMyKAyi3P/zQsQNF/I62AGBiABLhOwsg1FMBUmAa4LK0kU0' + 'GslRZGmpJb+3on0EzNJjN/Rt+6CJfdTUtj6KkvV+iRcjyBCdC2XzhNFUvstzFYtImJ1Ff9ZRIj59' + 'h0HQICe1It//pYprEApJJFaBDP/zQMQJFHJu5l/GaALvVEYd0Zlq2t/CXLznyPVFYKIeRsUnRSrZ' + 'Nn/r6CnqdQ5i8i3q1bKfpGtS0UV2JMeKP6knf2Nf0VaLGLbf//rR0WRKyF4MhrBplw9IE232uwC4' + 'QyFzCiYsW86d//NCxBIT0nLqXgpUxo9sRW7llTyJzaqvmIaPi3VgsG/mt9ykwfCQIU3OOY04ehw7' + '/ppOC+OfQ45TbwRmsdOf9V//3NEgtEX//4aVAAFRFv32vuC0ePWVlkuksMhlhMTeSZcTTa6TL1tX' + '//NAxB4T0m7aXgNUnlF5nDuaJdERvfmX6mCXNcKxO/V1USAU/9yGy3Aqp/1gZFJn/1f/82RAAwvU' + 'f/9n/4aVAAEIF91+vwCeBTp6TCmP9INghMQii720i+pAnlzzrUX1IHQtju2swb//80LEKRQCbtJe' + 'AJqGnOo/ai6SKYMAWbN+pyk9BZgJk//uSoi1brV+z//mZmmHNKZ13/4fAAEADstllgF/v972towZ' + '0QXK8AA+PC5cN0PRTdbHW9k5M9zgqso/zibfk+1ZC/skJF/61jz/80DENROyfrpeA9qODemqMKr/' + 'rUHwRS1Nq9SKD//rZIcRZmT//kUEALSZ3D//6vAmzqOlAm8FwxbwFiX8VRMT/DEsPCqRbOw8Q1mI' + 'xxtBkkSi3qAOVm6F2/FRWYSyB/bF4bP/YoK6TP/zQsRBE7JuiRpulMRYCzO1V/Bgm+3///oVNQAB' + 'URf9/bgBP/8U9MW42GQb/AyP4bURvzzGIYvAhJL0x3ooCTlFLZYWlmfqPt+PdVErEQz3RZKDyTFf' + '60vWSP/2GMeX/qsr/+oxmB0RAP/zQMROEzJqxl4CWpcBmBvv9vwBTX/L98zdfopM4GlbpJtgUn1e' + 'HHhe8yxjmqcdp+upQEuTdtU3X9x6VTAMv2qIoiG/VYg/GN7/nhJgfH2Qf0qSKab/9STkueh1IDkm' + 'klAH5fflAZLq//NCxFwT8m7CXgPall7BM4igvw7JyAbmlbrY2Zmc95UkokD/dw4U/VNjZq2TcStZ' + 'ukKgZTDVrng8v/mRTZa8Yre35WIl+v9boo3/1pprJU2wFQAyBI5tJABr9/77Z/CdRCLoRWqEYrN6' + '//NAxGgUEnKcfgPaq4nSU+eNbpg1JSTemhOK12Eir1L/WdGRPphACdmzWMj7GIgg/nV/2MkNzYiH' + '1f+MUXviFwhf5ESNESoACMgKy22UAf/oZWmPclPEoiClH5cGwN0IZce9FABAWFr/80LEchQJ8p2+' + 'BhqSJMm0Y97b+IcHG7exHP1o1ozptGFJY96zeDFv2jvm5WapBNLZ6npCx39f9//xJxaUAGauYYNH' + '0NxP49ytAzAugiwASDuCaDUpRXKKAro0F7oKjNigqK2bCimismz/80DEfRPCbrJeUYsW2bJs07zh' + 'UJE83J52vOGiuPNiokv/+//8tONhddJC82Fk8VX//+//+L/+X8vgX38/zyBLzXnwocMyMyN5mLPJ' + 'siIzhs/AZfSMyzTJX/zT7ykZlXbe+/dxn2i68f/zQsSJFBiqZBYAXknZ3GPTCDzzqqXjKRMJwaRC' + '8G6IQU2nG4n4GGmXKsyZrv9S/Pz0LNbNUKz3/+L//YfmT5sn3CfNUKp/vzCv+a/PzXF+sMhBLEGQ' + 'yJlrOq0Ao4kKJILAayo7MqEZp//zQMSUEvNmFAAIzcjp0sip/9jKz0mW6zFUj/RP6r+xkUjlR2Mj' + '/dbbIrGRyodjWKh2MrGEVYys5TKUSGhweBQ8NIQysZWMrlRxEYLh0SRVTEFNRTMuOTkuNVVVVVVV' + 'VVVVVVVVVVVV//NCxKMQi2IeUAhHXVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + '//NAxLwR22HQAAgKnVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=',
    finishedError: 'data:audio/mp3;base64,' + '/+MgxAAT5BX8AUEoAP///mNkc/////1Oc/6noc/9f///85/0O///r/kI2jf+pCf/Of/6HP/znOc7' + 'znPkIQgfFzvIRjhwOChCEIQOB8Ph853yHOc/zvEA4AAAAABF/UgSPmQKhhYBw4f/4yLECxVpXpgB' + 'mYgAKgCEXoz6Bj24G4gxlPDKhgAUoFxwtiGufjWFsGbKgF+Fh4noT/8i5uaFcZgLm1i2k0Mbam8Z' + 'AiwbYX0nExHIEEx2FBBP9J3S5vA6wAAltAA+pUwHS9e7B4EtiwD/4yDEERexdr1fz2ABlQrFTFPg' + 'XqqjQRzMFqGEeDUkEbrrMjtB+lU/tcuj+umyBDN1q/2GlFesgKLdHTqWo7RktruiRwdRlfa8J/BP' + 'RN+XHtgb0Y/AzC/2cZdiQgBuTa69W4S8bMAAXP/jIsQNF0k6wVZ5xSYzp4BvjV+T2Udd8R2+On01' + 'SiRpX5PGv6QjYpD1nBt8VZ0skMc9QHq1CpqJlnhoqVPKPHZYGqnIypEyWPAo8SPz0OhX//QJmyvH' + 'u/o8qM/6CtXSAhKu34FZMGcPy//jIMQLFcmeyX5pRy5R0BZEoNVh/FruKTVBRcR5rUTQpGyFqJx7' + 'CzcOcPjqoGcWJjOrcdzfsGXZAsFs2WdUKwcLiEIhWFB7w0GpuTa0XaMGgcqzrQsz/+kNKkIAFLvg' + 'P/OonDe+4DCL/+MixA4XgpK9XsKG9sYelKU8J/UGwRrm0l9/tjMjWMAOthrqK45iONNBfxi+hbll' + 'z+raE/If6Y91Y8jnb49Kxn0WeTT6ihhKnGOj8LGIiWQHuOogUc/66H/hHf+ZgAISpdgBncq6Fj3n' + '/+MgxAwWYfa9fnqHEiCLPLVweu/9CIz6wGZbXVpry1Kg57ZhtwxXKh82K2giB2guGug/OyF9W1Ju' + 'QftstdzJ1LPcEKLR5hTreUz/iBxskEVBY+CqAyCgQoz+yuNqlTn/4AmceACjmEH/4yLEDROBjtGf' + 'TFACEdnXxxr0lwp2+ghopgB4IjWCiAiL1Fns+pLqPWoKx2ncfG0InzW1JerftHxMpxQ801HHziUM' + 'vQeK6+SzxEliW+qFqaEByyhgQELpGQIgqtQ3JzIWch4kp17kEgX/4yDEGxrBdpwBmcgA2HbmH2R4' + 'LIKeMtsKwjCc/PT00y9l+qMGDIckAycFqvMfuJz7iPxLEzFQo5sngfD9d/3Lh+njFJYublz8Q5Rf' + '////T2+4Yc+Lz9NurVqf9g+AKTd3AE4qU1E2vP/jIsQLFHFG1N/MMAKBuH8oS/ikp9KqlSqkwegT' + 'JgTLjeYlyndKcQSsCSPJJQRk9HC1Mj+l42THqWrK1khp0NFfwKks86SKw6IipGbLX60JBY92Jgpy' + '/gAfjbqATePy62LBPlndI3QLQ//jIMQVEzHK0D5ITaKR7RryvYmOsx1fbM6V2JJnbpavk1iJiS8J' + 'PqV6qgWaY6uxhvzoBzN51ktGpofVlW2syZxMO0b3qgp3fgAeIb4DIseOluSeSAlQn7hrzAjZSZuJ' + '1hX4vsT7jPQ//+MixCMTSZ7MPlmQ9/X6VzdY3edjF975aHZclh+kp0dpLevY334aVbI8HpNcncwN' + 'u/n4iv+WjdUp78AD9ctNSZuODC31N8HTqGeWmtBbEAMsHqNC8I2hSomoRqXy9S0ceUx3G2Xy1HlX' + '/+MgxDETia7EHnnS35XKZuzIM1elCplWUbSZUyasFtQGBXZtvjOkd7fyKgXdgAP2BBZD9S9RP5NG' + '79jO2pTIwZr7J8G1gzEtzOp2ieBOgOaBuVOqMyrSjT9MjQyjbxO0deP52eZM5EX/4yLEPRPR9rge' + 'eccSHPRatU3MJQt+RHNLSiTFR+5aqgXbiAQBNtgMw1oA6FmGT6BBFIiJwdNzPHg4GwWjwaEZMdZC' + 'YHjSgwh4y0x3apZUmcmPvrb6vn+zvD/t5itoX1ejvi2HXytG9Pf/4yDESRRRirQZT1gDn6MGwmcJ' + 'JfWqPBUiBf4SQhy0VHhgDRhoxv1ZsAhtWpzFYcHZOFihgb4zFC60dOmrlmXJiSomyBZ2YpiZigYK' + 'oIYAIGkiMAiwM8MMgCyIACjNhTPqzAnwKNMoKP/jIsRSJSlqhAma0AChCECX2WopEOPhhoiCKtdU' + 'FCCgKJA0W01lY2TxupC5HD8td2jhciVYlirC37fwM/kcmq9jHKMSipK977GKSz039KNFCnN8BxNk' + 'yKQ7PaifSU06ZWbLXIRrxeNesv/jIMQZFAk6zD/MMAKWQS5DeCUx/Y3lI4WvyH8L5+c/sB9iWul3' + 'X4R9zz7SwOgUyMBtTkhABBIUn1CLs///////9YC1KgVL/IbU4pxAdm9RCY22Fl3QDjRdhcbGgh/G' + 'wR2i7lo1CmY0/+MixCMT0ZasGMPKX2VNy3/JfvZB7an/a3fEB8Ky4hh6gJUlR8Y0bs8ZsysdHzOS' + '5lQSpSjDL8SjagVdQAPkgaNhAzDy0U7Ny7ewjcdcD9uihn7LI+uRtxwzNFzBvzo+Dh1KUoG4nLxM' + '/+MgxC8TQaK0HnnHLvdpTPyNVqWq8ps87Xc4tp+84odaBg0EhAGhAEm9SAVb+0XZfMCMzNKdBLCf' + 'WT9Cl5ZjyQd6VlAraiTVvTti91RulyZBkwXuoV3YXmOkKVn5U0rzPNMp1ltR6t7/4yLEPRQ5lqwY' + 'w1ETceczuhocBflPuWRyT5NPfTibxXsKc3HAHohRMAuHFwWYsiboQoSDQaBHij2BTtI1iU2jto6y' + 'cFqsuHDPAswsJlcSaDHBypOCRwT6zM81yPX/lTY4KIGgWSGQ4+n/4yDESBLppsg+SYaW///sUgod' + 'AxFs3LEahGcMIGORNKMFqJMRseA8gjpVF3QapN5RoQOoQ0DWBwiRkkW4R+n8dpREBICTA00IFzMp' + 'EJUo25plEqklOrq6VWSDH6/u3crqCEL0P4bJIP/jIsRXE9ECWADD0lknZeEGlVUAgUCFiDzDzCj4' + 'WjRpT2WWWUGKhkz4qKC1QsK/ioqLN9ISFhURmfWKi3//////////QDIVFBIHgZFaTEFNRTMuOTku' + 'Naqqqqqqqqqqqqqqqqqqqqqqqv/jIMRjEaCVZAp5hlCqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq' + 'qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq' + 'qqqqqqqqqqqq'
  };

  Object.assign(EventSounds.prototype, {
    /**
     * Collection of {@link EventSoundsElement} objects
     * @name EventSounds#elements
     * @type {object} */
    elements: {
      start: new EventSoundsElement('start', EventSounds.MEDIA.start),
      click: new EventSoundsElement('click', EventSounds.MEDIA.click),
      actionOk: new EventSoundsElement('actionOk', EventSounds.MEDIA.actionOk),
      actionError: new EventSoundsElement('actionError', EventSounds.MEDIA.actionError),
      finishedOk: new EventSoundsElement('finishedOk', EventSounds.MEDIA.finishedOk),
      finishedError: new EventSoundsElement('finishedError', EventSounds.MEDIA.finishedError)
    },
    /**
     * Whether this event sounds are enabled or not
     * @name EventSounds#enabled
     * @type {boolean} */
    enabled: Utils.DEFAULT,
    /**
     * This attribute is intended to be used at prototype level, to indicate a globally disabled
     * or enabled state.
     * @name EventSounds#globalEnabled
     * @type {boolean} */
    globalEnabled: true
  });

  return EventSounds;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 137 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : project/JClicProject.js
 *  Created : 01/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(485), __webpack_require__(486), __webpack_require__(489), __webpack_require__(13), __webpack_require__(2), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, ProjectSettings, ActivitySequence, MediaBag, Activity, Utils, AWT) {

  /**
   *  JClicProject contains all the components of a JClic project: activities, sequences, media
   *  files, descriptors and metadata.
   *
   *  This encapsulation is achieved by three auxiliary objects:
   *  - {@link ProjectSettings}: stores metadata like full title, description, authors, languages,
   *  educational topics...
   *  - {@link ActivitySequence}: defines the order in which the activities must be shown.
   *  - {@link MediaBag}: contains the list of all media files used by the activities
   * @exports JClicProject
   * @class
   */
  var JClicProject = function () {
    /**
     * JClicProject constructor
     */
    function JClicProject() {
      _classCallCheck(this, JClicProject);

      this.settings = new ProjectSettings(this);
      this.activitySequence = new ActivitySequence(this);
      this._activities = {};
      this.mediaBag = new MediaBag(this);
    }

    /**
     * Loads the project settings from a main jQuery XML element
     * @param {external:jQuery} $xml - The XML element
     * @param {string} path - The full path of this project
     * @param {?external:JSZip} zip - An optional JSZip object where this project is encapsulated
     * @param {?object} options - An object with miscellaneous options
     * @returns {JClicProject}
     */


    _createClass(JClicProject, [{
      key: "setProperties",
      value: function setProperties($xml, path, zip, options) {
        var _this = this;

        if (path) {
          this.path = path;
          if (path.file) this.basePath = path;else this.basePath = Utils.getBasePath(path);
        }
        this.zip = zip;
        this.name = $xml.attr('name');
        this.version = $xml.attr('version');
        this.type = $xml.attr('type');
        this.code = $xml.attr('code');
        this.settings.setProperties($xml.children('settings'));
        this.activitySequence.setProperties($xml.children('sequence'));
        this.mediaBag.setProperties($xml.children('mediaBag'));
        this.reportableActs = 0;
        this._activities = {};
        var $node = $xml.children('activities');
        var $acts = $node.children('activity');
        var ownFonts = this.mediaBag.getElementsOfType('font');
        if (ownFonts.length > 0) options.ownFonts = (options.ownFonts || []).concat(ownFonts);
        AWT.Font.checkTree($acts, options);
        $acts.each(function (_n, act) {
          var $act = $(act);
          _this._activities[Utils.nSlash($act.attr('name'))] = $act;
          if ($act.children('settings').attr('report') === 'true') _this.reportableActs++;
        });
        return this;
      }

      /**
       * Finds activities by name and builds the corresponding {@link Activity} object.
       * @param {string} name - The name of the requested activity
       * @returns {Activity}
       */

    }, {
      key: "getActivity",
      value: function getActivity(name) {
        return Activity.getActivity(this._activities[Utils.nSlash(name)], this);
      }

      /**
       *
       * Builds the {@link Skin}, {@link EventSounds} and {@link MediaBag} fonts associated to this project.
       * @param {PlayStation} ps - The PlayStation (usually a {@link JClicPlayer}) linked to this project.
       */

    }, {
      key: "realize",
      value: function realize(ps) {
        // Build skin
        if (this.skin === null && this.settings.skinFileName !== null && this.settings.skinFileName.length > 0) this.skin = this.mediaBag.getSkinElement(this.settings.skinFileName, ps);

        this.settings.eventSounds.realize(ps, this.mediaBag);

        // Build all elements of type `font`
        this.mediaBag.buildAll('font', null, ps);
      }

      /**
       * Run finalizers on realized objects
       */

    }, {
      key: "end",
      value: function end() {
        // TODO: Implement JClicProject.end()
      }
    }]);

    return JClicProject;
  }();

  Object.assign(JClicProject.prototype, {
    /**
     * The project's name
     * @name JClicProject#name
     * @type {string} */
    name: 'unknown',
    /**
     * The version of the XML file format used to save the project (currently 0.1.3)
     * @name JClicProject#version
     * @type {string} */
    version: '0.1.3',
    /**
     * Optional property that can be used by reporting systems
     * @name JClicProject#type
     * @type {string} */
    type: null,
    /**
     * Optional property that can be used by reporting systems
     * @name JClicProject#code
     * @type {string} */
    code: null,
    /**
     * Object containing the project settings
     * @name JClicProject#settings
     * @type {ProjectSettings} */
    settings: null,
    /**
     * Object containing the order in which the activities should be played
     * @name JClicProject#activitySequence
     * @type {ActivitySequence} */
    activitySequence: null,
    /**
     * Array of jQuery xml elements containing the data of each activity. Don't rely on this object
     * to retrieve real activities. Use the method {@link @JClicProject#getActivity} instead.
     * @name JClicProject#_activities
     * @private
     * @type {external:jQuery[]} */
    _activities: null,
    /**
     * Number of activities suitable to be included reports
     * @name JClicProject#reportableActs
     * @type {number}
     */
    reportableActs: 0,
    /**
     * The collection of all media elements used in this project
     * @name JClicProject#mediaBag
     * @type {MediaBag} */
    mediaBag: null,
    /**
     * The object that builds and manages the visual interface presented to users
     * @name JClicProject#skin
     * @type {Skin} */
    skin: null,
    /**
     * Relative path or absolute URL to be used as a base to access files, usually in conjunction
     * with {@link JClicPlayer#basePath}
     * @name JClicProject#basePath
     * @type {string} */
    basePath: '',
    /**
     * Full path of this project
     * @name JClicProject#path
     * @type {string} */
    path: null,
    /**
     * The JSZip object where this project is stored (can be `null`)
     * @name JClicProject#zip
     * @type {external:JSZip} */
    zip: null
  });

  return JClicProject;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 138 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : boxes/ActiveBagContent.js
 *  Created : 13/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(57), __webpack_require__(73), __webpack_require__(65), __webpack_require__(3), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, BoxBase, ActiveBoxContent, Shaper, AWT, Utils) {

  /**
   * This class packs a collection of {@link ActiveBoxContent} objects and provides methods to access
   * and manage it. The two main members of `ActiveBagContent` are the {@link Shaper}, responsible for
   * determining the position and shape of each {@link ActiveBox}, and the {@link BoxBase} (field `bb`),
   * provider of a common visual style.
   * @exports ActiveBagContent
   * @class
   */
  var ActiveBagContent = function () {
    /**
     * ActiveBagContent constructor
     * @param {string=} id - An optional text tag identifying this ActiveBagContent
     * @param {number} ncw - In grid-based distributions, number of columns.
     * @param {number} nch - In grid-based distributions, number of rows.
     */
    function ActiveBagContent(id, ncw, nch) {
      _classCallCheck(this, ActiveBagContent);

      if (id) this.id = id;
      this.activeBoxContentArray = [];
      this.ncw = Math.max(1, ncw);
      this.nch = Math.max(1, nch);
    }

    /**
     * Loads the object settings from a specific JQuery XML element
     * @param {external:jQuery} $xml - The XML element to parse
     * @param {MediaBag} mediaBag - The project's MediaBag
     */


    _createClass(ActiveBagContent, [{
      key: "setProperties",
      value: function setProperties($xml, mediaBag) {
        var _this = this;

        var bug = false;
        Utils.attrForEach($xml.get(0).attributes, function (name, val) {
          switch (name) {
            case 'id':
              _this.id = val;
              break;
            case 'image':
              _this.imgName = Utils.nSlash(val);
              break;
            // Bug in JClic beta 1: "columns" is number of rows, and "rows" is number of columns.
            // Was corrected in beta 2: If "cols" is specified, "rows" are rows and "cols" are columns.
            case 'rows':
              _this.nch = Number(val);
              break;
            case 'columns':
              bug = true;
            /* falls through */
            case 'cols':
              _this.ncw = Number(val);
              break;
            case 'cellWidth':
              _this.w = Number(val);
              break;
            case 'cellHeight':
              _this.h = Number(val);
              break;
            case 'border':
              _this.border = Utils.getBoolean(val);
              break;
          }
        });

        if (bug) {
          var _n2 = this.ncw;
          this.ncw = this.nch;
          this.nch = _n2;
        }

        $xml.children().each(function (_n, child) {
          var $node = $(child);
          switch (child.nodeName) {
            case 'style':
              _this.bb = new BoxBase(null).setProperties($node);
              break;
            case 'shaper':
              var shaperClassName = $node.attr('class'),
                  nCols = Math.max(1, $node.attr('cols')),
                  nRows = Math.max(1, $node.attr('rows'));
              _this.shaper = Shaper.getShaper(shaperClassName, nCols, nRows);
              _this.shaper.setProperties($node);
              break;
            case 'ids':
              // Used in special cases where all cells have empty content with only 'ids'
              child.textContent.split(' ').forEach(function (id, i) {
                _this.activeBoxContentArray[i] = new ActiveBoxContent(Number(id));
              });
              break;
            case 'cell':
              _this.activeBoxContentArray.push(new ActiveBoxContent().setProperties($node, mediaBag));
              break;
          }
        });

        var n = this.activeBoxContentArray.length;

        // Create cells when `activeBoxContentArray` is empty
        if (n === 0 && this.shaper && this.shaper.nCells > 0) {
          n = this.shaper.nCells;
          this.getActiveBoxContent(n - 1);
        }

        // Assign ids when cells have empty content (they are just shapes)
        if (n > 0) {
          var empty = true;
          for (var i = 0; i < n; i++) {
            var bxc = this.getActiveBoxContent(i);
            if (bxc.id !== -1 || bxc.item !== -1 || !bxc.isEmpty()) {
              empty = false;
              break;
            }
          }
          if (empty) {
            for (var _i = 0; _i < n; _i++) {
              this.getActiveBoxContent(_i).id = _i;
            }
          }
        }

        // Link [BoxBase](BoxBase.html) objects of `activeBoxContentArray` elements to `bb`
        if (this.bb) this.activeBoxContentArray.forEach(function (abc) {
          if (abc.bb) abc.bb.parent = _this.bb;
        });

        return this;
      }

      /**
       * Prepares the media content of all elements
       * @param {PlayStation} playStation - The {@link JClicPlayer}
       */

    }, {
      key: "prepareMedia",
      value: function prepareMedia(playStation) {
        this.activeBoxContentArray.forEach(function (abc) {
          return abc.prepareMedia(playStation);
        });
      }

      /**
       * Gets the estimated total width of this content bag
       * @returns {number}
       */

    }, {
      key: "getTotalWidth",
      value: function getTotalWidth() {
        return this.w * this.ncw;
      }

      /**
       * Gets the estimated total height of this bag
       * @returns {number}
       */

    }, {
      key: "getTotalHeight",
      value: function getTotalHeight() {
        return this.h * this.nch;
      }

      /**
       * Gets the total number of cells of this bag
       * @returns {number}
       */

    }, {
      key: "getNumCells",
      value: function getNumCells() {
        return this.activeBoxContentArray.length;
      }

      /**
       * Checks if the bag is empty
       * @returns {boolean}
       */

    }, {
      key: "isEmpty",
      value: function isEmpty() {
        return this.activeBoxContentArray.length === 0;
      }

      /**
       * Retrieves the {@link Shaper} of this bag, creating a new one if it was _null_
       * @returns {Shaper}
       */

    }, {
      key: "getShaper",
      value: function getShaper() {
        if (this.shaper === null) this.shaper = Shaper.getShaper('@Rectangular', this.ncw, this.nch);
        return this.shaper;
      }

      /**
       * Retrieves the {@link BoxBase} of this bag, creating a new one if it was _null_
       * @returns {BoxBase}
       */

    }, {
      key: "getBoxBase",
      value: function getBoxBase() {
        if (this.bb === null) this.bb = new BoxBase();
        return this.bb;
      }

      /**
       * Adds a new {@link ActiveBoxContent} to this bag
       * @param {ActiveBoxContent} ab - The ActiveBoxContent to add
       */

    }, {
      key: "addActiveBoxContent",
      value: function addActiveBoxContent(ab) {
        this.activeBoxContentArray.push(ab);
        if (this.ncw === 0 || this.nch === 0) {
          this.ncw = this.nch = 1;
        }
      }

      /**
       * Gets the nth {@link ActiveBoxContent} in `activeBoxContentArray`
       * @param {number} i - The index of the content to be retrieved
       * @returns {ActiveBoxContent}
       */

    }, {
      key: "getActiveBoxContent",
      value: function getActiveBoxContent(i) {
        if (i >= this.activeBoxContentArray.length) {
          for (var j = this.activeBoxContentArray.length; j <= i; j++) {
            this.activeBoxContentArray.push(new ActiveBoxContent());
          }
        }
        return this.activeBoxContentArray[i];
      }

      /**
       * Finds the ActiveBoxContent with specific `id` and `item` values
       * @param {number} id
       * @param {number} item
       * @returns {ActiveBoxContent}
       */

    }, {
      key: "getActiveBoxContentWith",
      value: function getActiveBoxContentWith(id, item) {
        return this.activeBoxContentArray.find(function (bxc) {
          return bxc.id === id && bxc.item === item;
        });
      }

      /**
       * Sets the content of the cells based on a image spliced by a shaper
       * @param {MediaBag} mb - The MediaBag used to retrieve the image
       * @param {Shaper} sh - The Shaper used to splice the image
       * @param {boolean} roundSizes - When `true`, the size and coordinates of cells will be rounded
       * to the nearest integer values.
       */

    }, {
      key: "setImgContent",
      value: function setImgContent(mb, sh, roundSizes) {
        if (sh) this.setShaper(sh);

        if (this.shaper.className === '@Holes') this.shaper.hasRemainder = true;

        this.ncw = this.shaper.nCols;
        this.nch = this.shaper.nRows;
        var mbe = mb.elements[this.imgName];
        if (mb && this.imgName && mbe && mbe.ready) {
          this.img = mbe.data;
          if (mbe.animated) this.animatedGifFile = mbe.getFullPath();
          this.w = this.img.width / this.ncw;
          this.h = this.img.height / this.nch;
          if (roundSizes) {
            this.w = Math.round(this.w);
            this.h = Math.round(this.h);
          }
        } else {
          this.img = null;
          this.w = Math.max(this.w, 10);
          this.h = Math.max(this.h, 10);
        }

        var r = new AWT.Rectangle(0, 0, this.w * this.ncw, this.h * this.nch);
        for (var i = 0; i < this.shaper.nCells; i++) {
          this.getActiveBoxContent(i).setImgContent(this.img, this.shaper.getShape(i, r), this.animatedGifFile);
        }if (this.shaper.hasRemainder) {
          this.backgroundContent = new ActiveBoxContent();
          this.backgroundContent.setImgContent(this.img, this.shaper.getRemainderShape(r));
        }
      }

      /**
       * Sets the content of this bag based on an array of strings
       * @param {string[]} txt - The array of strings to be used as content.
       * @param {number} setNcw - Number of columns
       * @param {number} setNch - Number of rows
       */

    }, {
      key: "setTextContent",
      value: function setTextContent(txt, setNcw, setNch) {
        this.ncw = Math.max(1, setNcw);
        this.nch = Math.max(1, setNch);
        var n = this.ncw * this.nch;
        for (var i = 0; i < n; i++) {
          this.getActiveBoxContent(i).setTextContent(i >= txt.length || txt[i] === null ? '' : txt[i]);
        }
      }

      /**
       * Sets `id` values to a all the {@link ActiveBoxContent} elements of his bag.
       * @param {number[]} ids -Array of numeric identifiers
       */

    }, {
      key: "setIds",
      value: function setIds(ids) {
        for (var i = 0; i < ids.length && i < this.activeBoxContentArray.length; i++) {
          this.getActiveBoxContent(i).id = ids[i];
        }
      }

      /**
       * Sets `value` to the `key` attribute of all cells
       * @param {string} key - The key where the value will be stored
       * @param {*} value - The supplied value. Can be of any type.
       */

    }, {
      key: "setCellsAttribute",
      value: function setCellsAttribute(key, value) {
        this.activeBoxContentArray.forEach(function (abc) {
          return abc[key] = value;
        });
      }

      /**
       *
       * Cheks if the `id` values of all {@link ActiveBoxContent} objects are -1 and, if true,
       * sets new ids to them, with values between 0 and `maxId`
       * @param {number} maxId - The maximum value of identifiers
       */

    }, {
      key: "avoidAllIdsNull",
      value: function avoidAllIdsNull(maxId) {
        if (this.activeBoxContentArray.every(function (abc) {
          return abc.id === -1;
        })) {
          maxId = Math.max(1, maxId);
          this.activeBoxContentArray.forEach(function (abc, n) {
            abc.id = n % maxId;
          });
        }
      }
    }]);

    return ActiveBagContent;
  }();

  Object.assign(ActiveBagContent.prototype, {
    /**
     * The global identifier of this object: `primary`, `secondary`...
     * @name ActiveBagContent#id
     * @type {string} */
    id: 'primary',
    /**
     * The name of the image file used as a common image of this bag
     * @name ActiveBagContent#imgName
     * @type {string} */
    imgName: null,
    /**
     * The built image object
     * @name ActiveBagContent#img
     * @type {external:HTMLImageElement} */
    img: null,
    /**
     * Name of the img source when is an animated GIF
     * @name ActiveBagContent#animatedGifFile
     * @type {string} */
    animatedGifFile: null,
    /**
     * Number of columns when cells are distributed in a grid
     * @name ActiveBagContent#ncw
     * @type {number} */
    ncw: 1,
    /**
     * Number of rows when cells are distributed in a grid
     * @name ActiveBagContent#nch
     * @type {number} */
    nch: 1,
    /**
     * Optimal cell width
     * @name ActiveBagContent#w
     * @type {number} */
    w: Utils.settings.DEFAULT_GRID_ELEMENT_SIZE,
    /**
     * Optimal cell height
     * @name ActiveBagContent#h
     * @type {number} */
    h: Utils.settings.DEFAULT_GRID_ELEMENT_SIZE,
    /**
     * Whether the cells must have a border or not
     * @name ActiveBagContent#border
     * @type {boolean} */
    border: true,
    /**
     * The BoxBase used for this bag of cell contents
     * @name ActiveBagContent#bb
     * @type {BoxBase} */
    bb: null,
    /**
     * The Shaper used to define the specific shape of each cell
     * @name ActiveBagContent#shaper
     * @type {Shaper} */
    shaper: null,
    /**
     * An optional ActiveBoxContent object with background settings.
     * @name ActiveBagContent#backgroundContent
     * @type {ActiveBoxContent} */
    backgroundContent: null,
    /**
     * The main Array of {@link ActiveBoxContent} objects
     * @name ActiveBagContent#activeBoxContentArray
     * @type {ActiveBoxContent[]} */
    activeBoxContentArray: null,
    /**
     * The default value to be assigned at the 'id' field of children
     * @name ActiveBagContent#defaultIdValue
     * @type {number} */
    defaultIdValue: -1
  });

  return ActiveBagContent;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 139 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : report/Reporter.js
 *  Created : 17/05/2016
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(493), __webpack_require__(497), __webpack_require__(498), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, SessionReg, Encryption, Scorm, Utils) {

  /**
   * This class implements the basic operations related with the processing of times and scores
   * done by users playing JClic activities. These operations include: identification of users,
   * compilation of data coming from the activities, storage of this data for later use, and
   * presentation of summarized results.
   * @exports Reporter
   * @class
   */
  var Reporter = function () {
    /**
     * Reporter constructor
     * @param {PlayStation} ps - The {@link PlayStation} used to retrieve localized messages
     */
    function Reporter(ps) {
      _classCallCheck(this, Reporter);

      this.ps = ps;
      this.sessions = [];
      this.started = new Date();
      this.initiated = false;
      this.info = new ReporterInfo(this);
    }

    /**
     * Creates a new Reporter of the requested class
     * The resulting object must be prepared to operate with a call to its `init` method.
     * @param {string} className - Class name of the requested reporter. When `null`, a basic Reporter is created.
     * @param {PlayStation} ps - The {@link PlayStation} used to retrieve localized messages
     * @returns {Reporter}
     */


    _createClass(Reporter, [{
      key: "getInfo",


      /**
       * Returns the `info` element associated to this Reporter.
       * @returns {ReporterInfo}
       */
      value: function getInfo() {
        return this.info.recalc();
      }

      /**
       * Gets a specific property from this reporting system
       * @param {string} key - Requested property
       * @param {string}+ defaultValue - Default return value when requested property does not exist
       * @returns {string}
       */

    }, {
      key: "getProperty",
      value: function getProperty(key, defaultValue) {
        return defaultValue;
      }

      /**
       * Gets a specific boolean property from this reporting system
       * @param {string} key - Requested property
       * @param {boolean}+ defaultValue - Default return when requested property does not exist
       * @returns {boolean}
       */

    }, {
      key: "getBooleanProperty",
      value: function getBooleanProperty(key, defaultValue) {
        var s = this.getProperty(key, defaultValue === true ? 'true' : 'false');
        return key === null ? defaultValue : s === 'true' ? true : false;
      }

      /**
       * Gets the list of groups or organizations currently registered in the system. This
       * method should be implemented by classes derived of `Reporter`.
       * @returns {Promise} - When fulfilled, an array of group data is returned as a result
       */

    }, {
      key: "getGroups",
      value: function getGroups() {
        return Promise.reject('No groups defined!');
      }

      /**
       * Gets the list of users currently registered in the system, optionally filtered by
       * a specific group ID. This method should be implemented by classes derived of `Reporter`.
       * @param {string}+ groupId - Optional group ID to be used as a filter criteria
       * @returns {Promise} - When fulfilled, an object with a collection of user data records
       * is returned
       */

    }, {
      key: "getUsers",
      value: function getUsers(groupId) {
        return Promise.reject('No users defined in ' + groupId);
      }

      /**
       * Gets extended data associated with a specific user. This is a method intended to be
       * implemented in subclasses.
       * @param {string} _userId - The requested user ID
       * @returns {Promise} - When fulfilled, an object with user data is returned.
       */

    }, {
      key: "getUserData",
      value: function getUserData(_userId) {
        return Promise.reject('Unknown user!');
      }

      /**
       * Gets extended data associated with a specific group or organization. This
       * is a method intended to be implemented in subclasses.
       * @param {string} _groupId - The requested group ID
       * @returns {Promise} - When fulfilled, an object with group data is returned.
       */

    }, {
      key: "getGroupData",
      value: function getGroupData(_groupId) {
        return Promise.reject('Unknown group!');
      }

      /**
       * Checks if this reporting system manages its own database of users and groups. Defaults to `false`
       * @returns {boolean}
       */

    }, {
      key: "userBased",
      value: function userBased() {
        if (this.bUserBased === null) this.bUserBased = this.getBooleanProperty('USER_TABLES', false);
        return this.bUserBased;
      }

      /**
       * Allows the current user to create a new group, and asks his name
       * @returns {Promise} - When fulfilled, the chosen name for the new group is returned.
       */

    }, {
      key: "promptForNewGroup",
      value: function promptForNewGroup() {
        // TODO: Implement promptForNewGroup
        return Promise.reject('Remote creation of groups not yet implemented!');
      }

      /**
       * Allows the current user to create a new user ID, and asks his ID and password
       * @returns {Promise} - When fulfilled, an object with the new user ID and password
       * is returned.
       */

    }, {
      key: "promptForNewUser",
      value: function promptForNewUser() {
        // TODO: Implement promptForNewUser
        return Promise.reject('Remote creation of users not yet implemented!');
      }

      /**
       * Allows the current user to select its group or organization from the current groups list
       * @returns {Promise}
       */

    }, {
      key: "promptGroupId",
      value: function promptGroupId() {
        var _this = this;

        return new Promise(function (resolve, reject) {
          if (!_this.userBased()) reject('This system does not manage users!');else {
            _this.getGroups().then(function (groupList) {
              // Creation of new groups not yet implemented!
              if (!groupList || groupList.length < 1) reject('No groups defined!');else {
                var sel = 0;
                var $groupSelect = $('<select/>').attr({ size: Math.max(3, Math.min(15, groupList.length)) });
                groupList.forEach(function (g) {
                  return $groupSelect.append($('<option/>').attr({ value: g.id }).text(g.name));
                });
                $groupSelect.change(function (ev) {
                  sel = ev.target.selectedIndex;
                });
                _this.ps.skin.showDlg(true, {
                  main: [$('<h2/>', { class: 'subtitle' }).html(_this.ps.getMsg('Select group:')), $groupSelect],
                  bottom: [_this.ps.skin.$okDlgBtn, _this.ps.skin.$cancelDlgBtn]
                }).then(function () {
                  resolve(groupList[sel].id);
                }).catch(reject);
              }
            }).catch(reject);
          }
        });
      }

      /**
       * Asks for a valid user ID fulfilling the promise if found, rejecting it otherwise
       * @param {boolean}+ forcePrompt - Prompt also if `userId` is already defined (default is `false`)
       * @returns {Promise}
       */

    }, {
      key: "promptUserId",
      value: function promptUserId(forcePrompt) {
        var _this2 = this;

        return new Promise(function (resolve, reject) {
          if (_this2.userId !== null && !forcePrompt) resolve(_this2.userId);else if (!_this2.userBased()) reject('This system does not manage users!');else {
            var $pwdInput = $('<input/>', { type: 'password', size: 8, maxlength: 64 });
            if (_this2.getBooleanProperty('SHOW_USER_LIST', true)) {
              _this2.promptGroupId().then(function (groupId) {
                _this2.getUsers(groupId).then(function (userList) {
                  // Creation of new users not yet implemented
                  // let userCreationAllowed = this.getBooleanProperty('ALLOW_CREATE_USERS', false)
                  if (!userList || userList.length < 1) reject('Group ' + groupId + ' has no users!');else {
                    var sel = -1;
                    var $userSelect = $('<select/>').attr({ size: Math.max(3, Math.min(15, userList.length)) });
                    userList.forEach(function (u) {
                      return $userSelect.append($('<option/>').attr({ value: u.id }).text(u.name));
                    });
                    $userSelect.change(function (ev) {
                      sel = ev.target.selectedIndex;
                    });
                    _this2.ps.skin.showDlg(true, {
                      main: [$('<h2/>', { class: 'subtitle' }).html(_this2.ps.getMsg('Select user:')), $userSelect, $('<h2/>', { class: 'subtitle' }).html(_this2.ps.getMsg('Password:')).append($pwdInput)],
                      bottom: [_this2.ps.skin.$okDlgBtn, _this2.ps.skin.$cancelDlgBtn]
                    }).then(function () {
                      if (sel >= 0) {
                        if (userList[sel].pwd && Encryption.Decrypt(userList[sel].pwd) !== $pwdInput.val()) {
                          window.alert(_this2.ps.getMsg('Incorrect password'));
                          reject('Incorrect password');
                        } else {
                          _this2.userId = userList[sel].id;
                          resolve(_this2.userId);
                        }
                      } else reject('No user has been selected');
                    }).catch(reject);
                  }
                }).catch(reject);
              }).catch(reject);
            } else {
              var $userInput = $('<input/>', { type: 'text', size: 8, maxlength: 64 });
              _this2.ps.skin.showDlg(true, {
                main: [$('<div/>').css({ 'text-align': 'right' }).append($('<h2/>', { class: 'subtitle' }).html(_this2.ps.getMsg('User:')).append($userInput)).append($('<h2/>', { class: 'subtitle' }).html(_this2.ps.getMsg('Password:')).append($pwdInput))],
                bottom: [_this2.ps.skin.$okDlgBtn, _this2.ps.skin.$cancelDlgBtn]
              }).then(function () {
                _this2.getUserData($userInput.val()).then(function (user) {
                  if (user.pwd && Encryption.Decrypt(user.pwd) !== $pwdInput.val()) {
                    window.alert(_this2.ps.getMsg('Incorrect password'));
                    reject('Incorrect password');
                  } else {
                    _this2.userId = user.id;
                    resolve(_this2.userId);
                  }
                }).catch(reject);
              }).catch(reject);
            }
          }
        });
      }

      /**
       * Builds a complex object containing all the results reported while playing activities
       * @returns {Object} - The current results
       */

    }, {
      key: "getData",
      value: function getData() {

        // Force the re-calculation of all scores
        this.info.recalc();

        var result = {
          started: this.started.toISOString(),
          descriptionKey: this.descriptionKey,
          descriptionDetail: this.descriptionDetail,
          projects: this.info.numSessions,
          sequences: this.info.numSequences,
          activitiesDone: this.info.nActivities,
          playedOnce: this.info.nActPlayed,
          reportable: this.info.reportableActs,
          ratioPlayed: Math.round(this.info.ratioPlayed * 100),
          activitiesSolved: this.info.nActSolved,
          ratioSolved: Math.round(this.info.ratioSolved * 100),
          actScore: this.info.nActScore,
          partialScore: Math.round(this.info.partialScore * 100),
          globalScore: Math.round(this.info.globalScore * 100),
          time: Math.round(this.info.tTime / 10) / 100,
          actions: this.info.nActions,
          sessions: []
        };

        if (this.userId) result.userId = this.userId;else if (this.SCORM) result.user = this.SCORM.studentName + (this.SCORM.studentId === '' ? '' : " (" + this.SCORM.studentId + ")");

        this.sessions.forEach(function (sr) {
          if (sr.getInfo().numSequences > 0) result.sessions.push(sr.getData(false, false));
        });

        return result;
      }

      /**
       * Initializes this report system with an optional set of parameters.
       * Returns a Promise, fulfilled when the reporter is fully initialized.
       * @param {?Object} options - Initial settings passed to the reporting system
       * @returns {Promise}
       */

    }, {
      key: "init",
      value: function init(options) {
        if (!options) options = this.ps.options;
        this.userId = Utils.getVal(options.user);
        this.sessionKey = Utils.getVal(options.key);
        this.sessionContext = Utils.getVal(options.context);
        this.groupCodeFilter = Utils.getVal(options.groupCodeFilter);
        this.userCodeFilter = Utils.getVal(options.userCodeFilter);
        if (options.SCORM !== false) {
          this.SCORM = Scorm.getSCORM(this);
          if (this.SCORM !== null && this.descriptionKey === Reporter.prototype.descriptionKey) this.descriptionKey = this.SCORM.getScormType();
        }
        this.initiated = true;
        Utils.log('debug', 'Basic Reporter initialized');
        return Promise.resolve(true);
      }

      /**
       * Closes this reporting system
       * @returns {Promise} - A Promise object to be fullfilled when all pending tasks are finished.
       */

    }, {
      key: "end",
      value: function end() {
        Utils.log('debug', 'Basic Reporter ending');
        this.endSession();
        return Promise.resolve(true);
      }

      /**
       * Finalizes the current sequence
       */

    }, {
      key: "endSequence",
      value: function endSequence() {
        if (this.currentSession) {
          this.currentSession.endSequence();
          this.info.valid = false;
        }
      }

      /**
       * Finalizes the current session
       */

    }, {
      key: "endSession",
      value: function endSession() {
        this.endSequence();
        this.currentSession = null;
      }

      /**
       * Creates a new group (method to be implemented in subclasses)
       * @param {GroupData} _gd
       */

    }, {
      key: "newGroup",
      value: function newGroup(_gd) {
        throw "No database!";
      }

      /**
       * Creates a new user (method to be implemented in subclasses)
       * @param {UserData} _ud
       */

    }, {
      key: "newUser",
      value: function newUser(_ud) {
        throw "No database!";
      }

      /**
       * This method should be invoked when a new session starts.
       * @param {JClicProject} jcp - The {@link JClicProject} this session refers to.
       */

    }, {
      key: "newSession",
      value: function newSession(jcp) {
        this.endSession();
        this.currentSession = new SessionReg(jcp);
        this.sessions.push(this.currentSession);
        this.info.valid = false;
      }

      /**
       * This method should be invoked when a new sequence starts
       * @param {ActivitySequenceElement} ase - The {@link ActivitySequenceElement} referenced by this sequence.
       */

    }, {
      key: "newSequence",
      value: function newSequence(ase) {
        if (this.currentSession) {
          this.currentSession.newSequence(ase);
          this.info.valid = false;
          if (this.SCORM) this.SCORM.commitInfo();
        }
      }

      /**
       * This method should be invoked when the user starts a new activity
       * @param {Activity} act - The {@link Activity} reporter has just started
       */

    }, {
      key: "newActivity",
      value: function newActivity(act) {
        if (this.currentSession) {
          this.currentSession.newActivity(act);
          this.info.valid = false;
        }
      }

      /**
       * This method should be called when the current activity finishes. Data about user's final results
       * on the activity will then be saved.
       * @param {number} score - The final score, usually in a 0-100 scale.
       * @param {number} numActions - The total number of actions done by the user to solve the activity
       * @param {boolean} solved - `true` if the activity was finally solved, `false` otherwise.
       */

    }, {
      key: "endActivity",
      value: function endActivity(score, numActions, solved) {
        if (this.currentSession) {
          this.currentSession.endActivity(score, numActions, solved);
          this.info.valid = false;
        }
      }

      /**
       * Reports a new action done by the user while playing the current activity
       * @param {string} type - Type of action (`click`, `write`, `move`, `select`...)
       * @param {string}+ source - Description of the object on which the action is done.
       * @param {string}+ dest - Description of the object reporter acts as a target of the action (usually in pairings)
       * @param {boolean} ok - `true` if the action was OK, `false`, `null` or `undefined` otherwhise
       */

    }, {
      key: "newAction",
      value: function newAction(type, source, dest, ok) {
        if (this.currentSession) {
          this.currentSession.newAction(type, source, dest, ok);
          this.info.valid = false;
        }
      }

      /**
       * Gets information about the current sequence
       * @returns {SequenceReg.Info}
       */

    }, {
      key: "getCurrentSequenceInfo",
      value: function getCurrentSequenceInfo() {
        return this.currentSession === null ? null : this.currentSession.getCurrentSequenceInfo();
      }

      /**
       * Gets the name of the current sequence
       * @returns {string}
       */

    }, {
      key: "getCurrentSequenceTag",
      value: function getCurrentSequenceTag() {
        return this.currentSession === null ? null : this.currentSession.getCurrentSequenceTag();
      }
    }], [{
      key: "getReporter",
      value: function getReporter(className, ps) {
        var result = null;
        if (className === null) {
          className = 'Reporter';
          if (ps.options.hasOwnProperty('reporter')) className = ps.options.reporter;
        }
        if (Reporter.CLASSES.hasOwnProperty(className)) result = new Reporter.CLASSES[className](ps);else Utils.log('error', 'Unknown reporter class: %s', className);

        return result;
      }
    }]);

    return Reporter;
  }();

  Object.assign(Reporter.prototype, {
    /**
     * The {@link ReporterInfo} used to calculate and store global results.
     * @name Reporter#info
     * @type {ReporterInfo} */
    info: null,
    /**
     * The {@link PlayStation} used to retrieve messages
     * @name Reporter#ps
     * @type {PlayStation} */
    ps: null,
    /**
     * A valid SCORM bridge, or `null` if no SCORM API detected.
     * @name Reporter#SCORM */
    SCORM: null,
    /**
     * User ID currently associated with this reporting system
     * @name Reporter#userId
     * @type {string} */
    userId: null,
    /**
     * Optional key to be added as a field in session records
     * @name Reporter#sessionKey
     * @type {string} */
    sessionKey: null,
    /**
     * A second optional key to be reported as a field in session records
     * @name Reporter#sessionContext
     * @type {string} */
    sessionContext: null,
    /**
     * Optional filter key to be used in the group selection dialog
     * @name Reporter#groupCodeFilter
     * @type {string} */
    groupCodeFilter: null,
    /**
     * Another optional filter key to be used in the user selection dialog
     * @name Reporter#userCodeFilter
     * @type {string} */
    userCodeFilter: null,
    /**
     * Description of this reporting system
     * @name Reporter#descriptionKey
     * @type {string} */
    descriptionKey: 'Results are not currently being saved',
    /**
     * Additional info to display after the reporter's `description`
     * @name Reporter#descriptionDetail
     * @type {string} */
    descriptionDetail: '',
    /**
     * Starting date and time of this report
     * @name Reporter#started
     * @type {Date} */
    started: null,
    /**
     * Array of sessions included in this report
     * @name Reporter#sessions
     * @type {SessionReg[]} */
    sessions: [],
    /**
     * Currently active session
     * @name Reporter#currentSession
     * @type {SessionReg} */
    currentSession: null,
    /**
     * `true` if the system was successfully initiated, `false` otherwise
     * @name Reporter#initiated
     * @type {boolean} */
    initiated: false,
    /**
     * `true` if the system is connected to a database with user's data.
     * When `false`, a generic ID will be used.
     * @name Reporter#bUserBased
     * @type {boolean} */
    bUserBased: null,
    /**
     * Maximum number of incorrect UserID attempts
     * @name Reporter#MAX_USERID_PROMPT_ATTEMPTS
     * @type {number} */
    MAX_USERID_PROMPT_ATTEMPTS: 3
  });

  /**
   * This object stores the global results of a {@link Reporter}
   * @class
   */

  var ReporterInfo = function () {
    /**
     * ReporterInfo constructor
     * @param {Reporter} rep - The {@link Reporter} associated tho this `Info` object.
     */
    function ReporterInfo(rep) {
      _classCallCheck(this, ReporterInfo);

      this.rep = rep;
    }

    /**
     * Clears all data associated with this ReporterInfo
     */


    _createClass(ReporterInfo, [{
      key: "clear",
      value: function clear() {
        this.numSessions = this.numSequences = this.nActivities = this.reportableActs = this.nActSolved = this.nActPlayed = this.nActScore = this.nActions = this.ratioSolved = this.ratioPlayed = this.tScore = this.tTime = this.partialScore = this.globalScore = 0;
        this.valid = false;
      }

      /**
       * Computes the value of all global variables based on the data stored in `sessions`
       * @returns {ReporterInfo} - This "info" object
       */

    }, {
      key: "recalc",
      value: function recalc() {
        var _this3 = this;

        if (!this.valid) {
          this.clear();
          this.rep.sessions.forEach(function (ses) {
            var inf = ses.getInfo();
            _this3.reportableActs += inf.sReg.reportableActs;
            if (inf.numSequences > 0) {
              _this3.numSessions++;
              _this3.numSequences += inf.numSequences;
              if (inf.nActivities > 0) {
                _this3.nActivities += inf.nActivities;
                _this3.nActPlayed += inf.sReg.actNames.length;
                _this3.nActSolved += inf.nActSolved;
                _this3.nActions += inf.nActions;
                if (inf.nActScore > 0) {
                  _this3.tScore += inf.tScore * inf.nActScore;
                  _this3.nActScore += inf.nActScore;
                }
                _this3.tTime += inf.tTime;
              }
            }
          });
          if (this.nActivities > 0) {
            this.ratioSolved = this.nActSolved / this.nActivities;
            if (this.reportableActs > 0) this.ratioPlayed = this.nActPlayed / this.reportableActs;
            this.partialScore = this.tScore / (this.nActScore * 100);
            this.globalScore = this.partialScore * this.ratioPlayed;
          }
          this.valid = true;
        }
        return this;
      }
    }]);

    return ReporterInfo;
  }();

  Object.assign(ReporterInfo.prototype, {
    /**
     * The Reporter linked to this Info object
     * @name ReporterInfo#rep
     * @type {Reporter}
     */
    rep: null,
    /**
     * When `false`, data must be recalculated
     * @name ReporterInfo#valid
     * @type {boolean} */
    valid: false,
    /**
     * Number of sessions registered
     * @name ReporterInfo#numSessions
     * @type {number} */
    numSessions: 0,
    /**
     * Number of sequences played
     * @name ReporterInfo#numSequences
     * @type {number} */
    numSequences: 0,
    /**
     * Number of activities played
     * @name ReporterInfo#nActivities
     * @type {number} */
    nActivities: 0,
    /**
     * Number of activities in existing in the played projects suitable to be reported
     * @name ReporterInfo#reportableActs
     * @type {number} */
    reportableActs: 0,
    /**
     * Number of activities solved
     * @name ReporterInfo#nActSolved
     * @type {number} */
    nActSolved: 0,
    /**
     * Number of different activities played
     * @name ReporterInfo#nActPlayed
     * @type {number} */
    nActPlayed: 0,
    /**
     * Global score obtained in all sessions registered by this reporter
     * @name ReporterInfo#nActScore
     * @type {number} */
    nActScore: 0,
    /**
     * Number of actions done by the user while in this working session
     * @name ReporterInfo#nActions
     * @type {number} */
    nActions: 0,
    /**
     * Percentage of solved activities
     * @name ReporterInfo#ratioSolved
     * @type {number} */
    ratioSolved: 0,
    /**
     * Percentage of reportable activities played
     * @name ReporterInfo#ratioPlayed
     * @type {number} */
    ratioPlayed: 0,
    /**
     * Sum of the scores of all the activities played
     * @name ReporterInfo#tScore
     * @type {number} */
    tScore: 0,
    /**
     * Global score obtained
     * @name ReporterInfo#partialScore
     * @type {number} */
    partialScore: 0,
    /**
     * Sum of the playing time reported by each activity (not always equals to the sum of all session's time)
     * @name ReporterInfo#tTime
     * @type {number} */
    tTime: 0,
    /**
     * Final score based on the percent of reportable activities played. If the user plays all the
     * activities, this result equals to `partialScore`.
     * @name ReporterInfo#globalScore
     * @type {number} */
    globalScore: 0
  });

  Reporter.Info = ReporterInfo;

  /**
   * Static list of classes derived from Reporter. It should be filled by Reporter classes at declaration time.
   * @type {Object}
   */
  Reporter.CLASSES = { 'Reporter': Reporter };

  return Reporter;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 140 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : shapers/JigSaw.js
 *  Created : 01/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(65), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Shaper, AWT) {

  /**
   *
   * This {@link Shaper} returns a set of rectangular shapes with teeth and slots that fit between them.
   * @exports JigSaw
   * @class
   * @extends Shaper
   */
  var JigSaw = function (_Shaper) {
    _inherits(JigSaw, _Shaper);

    /**
     * JigSaw constructor
     * @param {number} nx - Number of columns
     * @param {number} ny - Number of rows
     */
    function JigSaw(nx, ny) {
      _classCallCheck(this, JigSaw);

      return _possibleConstructorReturn(this, (JigSaw.__proto__ || Object.getPrototypeOf(JigSaw)).call(this, nx, ny));
    }

    /**
     * Builds the jigsaw shapes based on the number of rows and columns
     * @override
     */


    _createClass(JigSaw, [{
      key: "buildShapes",
      value: function buildShapes() {
        // Create two two-dimension arrays for storing the type of horizontal and vertical lines
        var hLineType = [],
            vLineType = [];
        for (var i = 0; i <= this.nRows; i++) {
          hLineType[i] = [];
          vLineType[i] = [];
        }

        for (var row = 0; row < this.nRows; row++) {
          for (var col = 0; col < this.nCols; col++) {
            hLineType[row][col] = row === 0 ? 0 : 1 + (this.randomLines ? Math.round(Math.random() * 9) : row + col) % 2;
            vLineType[row][col] = col === 0 ? 0 : 1 + (this.randomLines ? Math.round(Math.random() * 9) : col + row + 1) % 2;
            if (col === this.nCols - 1) vLineType[row][col + 1] = 0;
            if (row === this.nRows - 1) hLineType[row + 1][col] = 0;
          }
        }

        var w = 1 / this.nCols,
            h = 1 / this.nRows;
        for (var r = 0; r < this.nRows; r++) {
          for (var c = 0; c < this.nCols; c++) {
            var x = w * c;
            var y = h * r;
            var sd = new AWT.Path([new AWT.PathStroke('M', [x, y])]);
            this.hLine(sd, hLineType[r][c], x + 0, y + 0, w, h, false);
            this.vLine(sd, vLineType[r][c + 1], x + w, y + 0, w, h, false);
            this.hLine(sd, hLineType[r + 1][c], x + w, y + h, w, h, true);
            this.vLine(sd, vLineType[r][c], x + 0, y + h, w, h, true);
            sd.addStroke(new AWT.PathStroke('X'));
            sd.calcEnclosingRect();
            // Save the Path in `shapeData`
            this.shapeData[r * this.nCols + c] = sd;
          }
        }
        this.initiated = true;
      }

      /**
       * Adds an horizontal line to the provided path
       * @param {AWT.Path} sd - The Path to which the line will be added
       * @param {number} type - Type  of tooth: 0 is flat (no tooth), 1 means tooth up, and 2 means tooth down
       * @param {number} x - X coordinate of the starting point
       * @param {number} y - Y coordinate of the starting point
       * @param {number} w - Width of the piece
       * @param {number} h - Height of the piece
       * @param {boolean} inv - The line must be drawn right to left
       */

    }, {
      key: "hLine",
      value: function hLine(sd, type, x, y, w, h, inv) {
        var kx = inv ? -1 : 1,
            ky = type === 1 ? 1 : -1;

        if (type === 0)
          // Flat line
          sd.addStroke(new AWT.PathStroke('L', [x + w * kx, y]));else {
          var x0 = x + (w - w * this.baseWidthFactor) / 2 * kx;
          var wb = w * this.baseWidthFactor * kx;
          // Approximation to the tooth:
          sd.addStroke(new AWT.PathStroke('L', [x0, y]));
          // The tooth:
          var hb = h * this.toothHeightFactor * ky;
          sd.addStroke(new AWT.PathStroke('L', [x0, y + hb]));
          sd.addStroke(new AWT.PathStroke('L', [x0 + wb, y + hb]));
          sd.addStroke(new AWT.PathStroke('L', [x0 + wb, y]));
          // Draw the remaining of the line
          sd.addStroke(new AWT.PathStroke('L', [x + w * kx, y]));
        }
      }

      /**
       *
       * Adds a vertical line to the provided path
       * @param {AWT.Path} sd - The Path to which the line will be added
       * @param {number} type - Type  of tooth: 0 is flat (no tooth), 1 means tooth right, and 2 means tooth left
       * @param {number} x - X coordinate of the starting point
       * @param {number} y - Y coordinate of the starting point
       * @param {number} w - Width of the piece
       * @param {number} h - Height of the piece
       * @param {boolean} inv - The line must be drawn bottom to top
       */

    }, {
      key: "vLine",
      value: function vLine(sd, type, x, y, w, h, inv) {
        var ky = inv ? -1 : 1,
            kx = type === 1 ? 1 : -1;

        if (type === 0) {
          // Flat line
          sd.addStroke(new AWT.PathStroke('L', [x, y + h * ky]));
        } else {
          var y0 = y + (h - h * this.baseWidthFactor) / 2 * ky;
          var hb = h * this.baseWidthFactor * ky;
          // Approximation to the tooth:
          sd.addStroke(new AWT.PathStroke('L', [x, y0]));
          // The tooth:
          var wb = w * this.toothHeightFactor * kx;
          sd.addStroke(new AWT.PathStroke('L', [x + wb, y0]));
          sd.addStroke(new AWT.PathStroke('L', [x + wb, y0 + hb]));
          sd.addStroke(new AWT.PathStroke('L', [x, y0 + hb]));
          // Draw the remaining line
          sd.addStroke(new AWT.PathStroke('L', [x, y + h * ky]));
        }
      }
    }]);

    return JigSaw;
  }(Shaper);

  // Register this class in the list of known shapers


  Shaper.CLASSES['@JigSaw'] = JigSaw;

  return JigSaw;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 141 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = !__webpack_require__(10) && !__webpack_require__(6)(function () {
  return Object.defineProperty(__webpack_require__(100)('div'), 'a', { get: function get() {
      return 7;
    } }).a != 7;
});

/***/ }),
/* 142 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


exports.f = __webpack_require__(8);

/***/ }),
/* 143 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var has = __webpack_require__(16);
var toIObject = __webpack_require__(20);
var arrayIndexOf = __webpack_require__(78)(false);
var IE_PROTO = __webpack_require__(102)('IE_PROTO');

module.exports = function (object, names) {
  var O = toIObject(object);
  var i = 0;
  var result = [];
  var key;
  for (key in O) {
    if (key != IE_PROTO) has(O, key) && result.push(key);
  } // Don't enum bug & hidden keys
  while (names.length > i) {
    if (has(O, key = names[i++])) {
      ~arrayIndexOf(result, key) || result.push(key);
    }
  }return result;
};

/***/ }),
/* 144 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var dP = __webpack_require__(11);
var anObject = __webpack_require__(4);
var getKeys = __webpack_require__(47);

module.exports = __webpack_require__(10) ? Object.defineProperties : function defineProperties(O, Properties) {
  anObject(O);
  var keys = getKeys(Properties);
  var length = keys.length;
  var i = 0;
  var P;
  while (length > i) {
    dP.f(O, P = keys[i++], Properties[P]);
  }return O;
};

/***/ }),
/* 145 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toIObject = __webpack_require__(20);
var gOPN = __webpack_require__(50).f;
var toString = {}.toString;

var windowNames = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];

var getWindowNames = function getWindowNames(it) {
  try {
    return gOPN(it);
  } catch (e) {
    return windowNames.slice();
  }
};

module.exports.f = function getOwnPropertyNames(it) {
  return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
};

/***/ }),
/* 146 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// 19.1.2.1 Object.assign(target, source, ...)

var getKeys = __webpack_require__(47);
var gOPS = __webpack_require__(79);
var pIE = __webpack_require__(68);
var toObject = __webpack_require__(14);
var IObject = __webpack_require__(67);
var $assign = Object.assign;

// should work with symbols and should have deterministic property order (V8 bug)
module.exports = !$assign || __webpack_require__(6)(function () {
  var A = {};
  var B = {};
  // eslint-disable-next-line no-undef
  var S = Symbol();
  var K = 'abcdefghijklmnopqrst';
  A[S] = 7;
  K.split('').forEach(function (k) {
    B[k] = k;
  });
  return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
}) ? function assign(target, source) {
  // eslint-disable-line no-unused-vars
  var T = toObject(target);
  var aLen = arguments.length;
  var index = 1;
  var getSymbols = gOPS.f;
  var isEnum = pIE.f;
  while (aLen > index) {
    var S = IObject(arguments[index++]);
    var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
    var length = keys.length;
    var j = 0;
    var key;
    while (length > j) {
      if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
    }
  }return T;
} : $assign;

/***/ }),
/* 147 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var aFunction = __webpack_require__(15);
var isObject = __webpack_require__(7);
var invoke = __webpack_require__(148);
var arraySlice = [].slice;
var factories = {};

var construct = function construct(F, len, args) {
  if (!(len in factories)) {
    for (var n = [], i = 0; i < len; i++) {
      n[i] = 'a[' + i + ']';
    } // eslint-disable-next-line no-new-func
    factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
  }return factories[len](F, args);
};

module.exports = Function.bind || function bind(that /* , ...args */) {
  var fn = aFunction(this);
  var partArgs = arraySlice.call(arguments, 1);
  var bound = function bound() /* args... */{
    var args = partArgs.concat(arraySlice.call(arguments));
    return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
  };
  if (isObject(fn.prototype)) bound.prototype = fn.prototype;
  return bound;
};

/***/ }),
/* 148 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// fast apply, http://jsperf.lnkit.com/fast-apply/5
module.exports = function (fn, args, that) {
                  var un = that === undefined;
                  switch (args.length) {
                                    case 0:
                                                      return un ? fn() : fn.call(that);
                                    case 1:
                                                      return un ? fn(args[0]) : fn.call(that, args[0]);
                                    case 2:
                                                      return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]);
                                    case 3:
                                                      return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]);
                                    case 4:
                                                      return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]);
                  }return fn.apply(that, args);
};

/***/ }),
/* 149 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $parseInt = __webpack_require__(5).parseInt;
var $trim = __webpack_require__(60).trim;
var ws = __webpack_require__(106);
var hex = /^[-+]?0[xX]/;

module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix) {
  var string = $trim(String(str), 3);
  return $parseInt(string, radix >>> 0 || (hex.test(string) ? 16 : 10));
} : $parseInt;

/***/ }),
/* 150 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $parseFloat = __webpack_require__(5).parseFloat;
var $trim = __webpack_require__(60).trim;

module.exports = 1 / $parseFloat(__webpack_require__(106) + '-0') !== -Infinity ? function parseFloat(str) {
  var string = $trim(String(str), 3);
  var result = $parseFloat(string);
  return result === 0 && string.charAt(0) == '-' ? -0 : result;
} : $parseFloat;

/***/ }),
/* 151 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var cof = __webpack_require__(26);
module.exports = function (it, msg) {
  if (typeof it != 'number' && cof(it) != 'Number') throw TypeError(msg);
  return +it;
};

/***/ }),
/* 152 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.1.2.3 Number.isInteger(number)
var isObject = __webpack_require__(7);
var floor = Math.floor;
module.exports = function isInteger(it) {
  return !isObject(it) && isFinite(it) && floor(it) === it;
};

/***/ }),
/* 153 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.20 Math.log1p(x)
module.exports = Math.log1p || function log1p(x) {
  return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x);
};

/***/ }),
/* 154 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.16 Math.fround(x)
var sign = __webpack_require__(109);
var pow = Math.pow;
var EPSILON = pow(2, -52);
var EPSILON32 = pow(2, -23);
var MAX32 = pow(2, 127) * (2 - EPSILON32);
var MIN32 = pow(2, -126);

var roundTiesToEven = function roundTiesToEven(n) {
  return n + 1 / EPSILON - 1 / EPSILON;
};

module.exports = Math.fround || function fround(x) {
  var $abs = Math.abs(x);
  var $sign = sign(x);
  var a, result;
  if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
  a = (1 + EPSILON32 / EPSILON) * $abs;
  result = a - (a - $abs);
  // eslint-disable-next-line no-self-compare
  if (result > MAX32 || result != result) return $sign * Infinity;
  return $sign * result;
};

/***/ }),
/* 155 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// call something on iterator step with safe closing on error
var anObject = __webpack_require__(4);
module.exports = function (iterator, fn, value, entries) {
  try {
    return entries ? fn(anObject(value)[0], value[1]) : fn(value);
    // 7.4.6 IteratorClose(iterator, completion)
  } catch (e) {
    var ret = iterator['return'];
    if (ret !== undefined) anObject(ret.call(iterator));
    throw e;
  }
};

/***/ }),
/* 156 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var aFunction = __webpack_require__(15);
var toObject = __webpack_require__(14);
var IObject = __webpack_require__(67);
var toLength = __webpack_require__(12);

module.exports = function (that, callbackfn, aLen, memo, isRight) {
  aFunction(callbackfn);
  var O = toObject(that);
  var self = IObject(O);
  var length = toLength(O.length);
  var index = isRight ? length - 1 : 0;
  var i = isRight ? -1 : 1;
  if (aLen < 2) for (;;) {
    if (index in self) {
      memo = self[index];
      index += i;
      break;
    }
    index += i;
    if (isRight ? index < 0 : length <= index) {
      throw TypeError('Reduce of empty array with no initial value');
    }
  }
  for (; isRight ? index >= 0 : length > index; index += i) {
    if (index in self) {
      memo = callbackfn(memo, self[index], index, O);
    }
  }return memo;
};

/***/ }),
/* 157 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)


var toObject = __webpack_require__(14);
var toAbsoluteIndex = __webpack_require__(48);
var toLength = __webpack_require__(12);

module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
  var O = toObject(this);
  var len = toLength(O.length);
  var to = toAbsoluteIndex(target, len);
  var from = toAbsoluteIndex(start, len);
  var end = arguments.length > 2 ? arguments[2] : undefined;
  var count = Math.min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to);
  var inc = 1;
  if (from < to && to < from + count) {
    inc = -1;
    from += count - 1;
    to += count - 1;
  }
  while (count-- > 0) {
    if (from in O) O[to] = O[from];else delete O[to];
    to += inc;
    from += inc;
  }return O;
};

/***/ }),
/* 158 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = function (done, value) {
  return { value: value, done: !!done };
};

/***/ }),
/* 159 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 21.2.5.3 get RegExp.prototype.flags()
if (__webpack_require__(10) && /./g.flags != 'g') __webpack_require__(11).f(RegExp.prototype, 'flags', {
  configurable: true,
  get: __webpack_require__(83)
});

/***/ }),
/* 160 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = function (exec) {
  try {
    return { e: false, v: exec() };
  } catch (e) {
    return { e: true, v: e };
  }
};

/***/ }),
/* 161 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var anObject = __webpack_require__(4);
var isObject = __webpack_require__(7);
var newPromiseCapability = __webpack_require__(124);

module.exports = function (C, x) {
  anObject(C);
  if (isObject(x) && x.constructor === C) return x;
  var promiseCapability = newPromiseCapability.f(C);
  var resolve = promiseCapability.resolve;
  resolve(x);
  return promiseCapability.promise;
};

/***/ }),
/* 162 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var strong = __webpack_require__(163);
var validate = __webpack_require__(62);
var MAP = 'Map';

// 23.1 Map Objects
module.exports = __webpack_require__(86)(MAP, function (get) {
  return function Map() {
    return get(this, arguments.length > 0 ? arguments[0] : undefined);
  };
}, {
  // 23.1.3.6 Map.prototype.get(key)
  get: function get(key) {
    var entry = strong.getEntry(validate(this, MAP), key);
    return entry && entry.v;
  },
  // 23.1.3.9 Map.prototype.set(key, value)
  set: function set(key, value) {
    return strong.def(validate(this, MAP), key === 0 ? 0 : key, value);
  }
}, strong, true);

/***/ }),
/* 163 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var dP = __webpack_require__(11).f;
var create = __webpack_require__(49);
var redefineAll = __webpack_require__(54);
var ctx = __webpack_require__(25);
var anInstance = __webpack_require__(52);
var forOf = __webpack_require__(53);
var $iterDefine = __webpack_require__(112);
var step = __webpack_require__(158);
var setSpecies = __webpack_require__(51);
var DESCRIPTORS = __webpack_require__(10);
var fastKey = __webpack_require__(39).fastKey;
var validate = __webpack_require__(62);
var SIZE = DESCRIPTORS ? '_s' : 'size';

var getEntry = function getEntry(that, key) {
  // fast case
  var index = fastKey(key);
  var entry;
  if (index !== 'F') return that._i[index];
  // frozen object case
  for (entry = that._f; entry; entry = entry.n) {
    if (entry.k == key) return entry;
  }
};

module.exports = {
  getConstructor: function getConstructor(wrapper, NAME, IS_MAP, ADDER) {
    var C = wrapper(function (that, iterable) {
      anInstance(that, C, NAME, '_i');
      that._t = NAME; // collection type
      that._i = create(null); // index
      that._f = undefined; // first entry
      that._l = undefined; // last entry
      that[SIZE] = 0; // size
      if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
    });
    redefineAll(C.prototype, {
      // 23.1.3.1 Map.prototype.clear()
      // 23.2.3.2 Set.prototype.clear()
      clear: function clear() {
        for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
          entry.r = true;
          if (entry.p) entry.p = entry.p.n = undefined;
          delete data[entry.i];
        }
        that._f = that._l = undefined;
        that[SIZE] = 0;
      },
      // 23.1.3.3 Map.prototype.delete(key)
      // 23.2.3.4 Set.prototype.delete(value)
      'delete': function _delete(key) {
        var that = validate(this, NAME);
        var entry = getEntry(that, key);
        if (entry) {
          var next = entry.n;
          var prev = entry.p;
          delete that._i[entry.i];
          entry.r = true;
          if (prev) prev.n = next;
          if (next) next.p = prev;
          if (that._f == entry) that._f = next;
          if (that._l == entry) that._l = prev;
          that[SIZE]--;
        }return !!entry;
      },
      // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
      // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
      forEach: function forEach(callbackfn /* , that = undefined */) {
        validate(this, NAME);
        var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
        var entry;
        while (entry = entry ? entry.n : this._f) {
          f(entry.v, entry.k, this);
          // revert to the last existing entry
          while (entry && entry.r) {
            entry = entry.p;
          }
        }
      },
      // 23.1.3.7 Map.prototype.has(key)
      // 23.2.3.7 Set.prototype.has(value)
      has: function has(key) {
        return !!getEntry(validate(this, NAME), key);
      }
    });
    if (DESCRIPTORS) dP(C.prototype, 'size', {
      get: function get() {
        return validate(this, NAME)[SIZE];
      }
    });
    return C;
  },
  def: function def(that, key, value) {
    var entry = getEntry(that, key);
    var prev, index;
    // change existing entry
    if (entry) {
      entry.v = value;
      // create new entry
    } else {
      that._l = entry = {
        i: index = fastKey(key, true), // <- index
        k: key, // <- key
        v: value, // <- value
        p: prev = that._l, // <- previous entry
        n: undefined, // <- next entry
        r: false // <- removed
      };
      if (!that._f) that._f = entry;
      if (prev) prev.n = entry;
      that[SIZE]++;
      // add to index
      if (index !== 'F') that._i[index] = entry;
    }return that;
  },
  getEntry: getEntry,
  setStrong: function setStrong(C, NAME, IS_MAP) {
    // add .keys, .values, .entries, [@@iterator]
    // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
    $iterDefine(C, NAME, function (iterated, kind) {
      this._t = validate(iterated, NAME); // target
      this._k = kind; // kind
      this._l = undefined; // previous
    }, function () {
      var that = this;
      var kind = that._k;
      var entry = that._l;
      // revert to the last existing entry
      while (entry && entry.r) {
        entry = entry.p;
      } // get next entry
      if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
        // or finish the iteration
        that._t = undefined;
        return step(1);
      }
      // return step by kind
      if (kind == 'keys') return step(0, entry.k);
      if (kind == 'values') return step(0, entry.v);
      return step(0, [entry.k, entry.v]);
    }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);

    // add [@@species], 23.1.2.2, 23.2.2.2
    setSpecies(NAME);
  }
};

/***/ }),
/* 164 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var strong = __webpack_require__(163);
var validate = __webpack_require__(62);
var SET = 'Set';

// 23.2 Set Objects
module.exports = __webpack_require__(86)(SET, function (get) {
  return function Set() {
    return get(this, arguments.length > 0 ? arguments[0] : undefined);
  };
}, {
  // 23.2.3.1 Set.prototype.add(value)
  add: function add(value) {
    return strong.def(validate(this, SET), value = value === 0 ? 0 : value, value);
  }
}, strong);

/***/ }),
/* 165 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var each = __webpack_require__(33)(0);
var redefine = __webpack_require__(18);
var meta = __webpack_require__(39);
var assign = __webpack_require__(146);
var weak = __webpack_require__(166);
var isObject = __webpack_require__(7);
var fails = __webpack_require__(6);
var validate = __webpack_require__(62);
var WEAK_MAP = 'WeakMap';
var getWeak = meta.getWeak;
var isExtensible = Object.isExtensible;
var uncaughtFrozenStore = weak.ufstore;
var tmp = {};
var InternalMap;

var wrapper = function wrapper(get) {
  return function WeakMap() {
    return get(this, arguments.length > 0 ? arguments[0] : undefined);
  };
};

var methods = {
  // 23.3.3.3 WeakMap.prototype.get(key)
  get: function get(key) {
    if (isObject(key)) {
      var data = getWeak(key);
      if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key);
      return data ? data[this._i] : undefined;
    }
  },
  // 23.3.3.5 WeakMap.prototype.set(key, value)
  set: function set(key, value) {
    return weak.def(validate(this, WEAK_MAP), key, value);
  }
};

// 23.3 WeakMap Objects
var $WeakMap = module.exports = __webpack_require__(86)(WEAK_MAP, wrapper, methods, weak, true, true);

// IE11 WeakMap frozen keys fix
if (fails(function () {
  return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7;
})) {
  InternalMap = weak.getConstructor(wrapper, WEAK_MAP);
  assign(InternalMap.prototype, methods);
  meta.NEED = true;
  each(['delete', 'has', 'get', 'set'], function (key) {
    var proto = $WeakMap.prototype;
    var method = proto[key];
    redefine(proto, key, function (a, b) {
      // store frozen objects on internal weakmap shim
      if (isObject(a) && !isExtensible(a)) {
        if (!this._f) this._f = new InternalMap();
        var result = this._f[key](a, b);
        return key == 'set' ? this : result;
        // store all the rest on native weakmap
      }return method.call(this, a, b);
    });
  });
}

/***/ }),
/* 166 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var redefineAll = __webpack_require__(54);
var getWeak = __webpack_require__(39).getWeak;
var anObject = __webpack_require__(4);
var isObject = __webpack_require__(7);
var anInstance = __webpack_require__(52);
var forOf = __webpack_require__(53);
var createArrayMethod = __webpack_require__(33);
var $has = __webpack_require__(16);
var validate = __webpack_require__(62);
var arrayFind = createArrayMethod(5);
var arrayFindIndex = createArrayMethod(6);
var id = 0;

// fallback for uncaught frozen keys
var uncaughtFrozenStore = function uncaughtFrozenStore(that) {
  return that._l || (that._l = new UncaughtFrozenStore());
};
var UncaughtFrozenStore = function UncaughtFrozenStore() {
  this.a = [];
};
var findUncaughtFrozen = function findUncaughtFrozen(store, key) {
  return arrayFind(store.a, function (it) {
    return it[0] === key;
  });
};
UncaughtFrozenStore.prototype = {
  get: function get(key) {
    var entry = findUncaughtFrozen(this, key);
    if (entry) return entry[1];
  },
  has: function has(key) {
    return !!findUncaughtFrozen(this, key);
  },
  set: function set(key, value) {
    var entry = findUncaughtFrozen(this, key);
    if (entry) entry[1] = value;else this.a.push([key, value]);
  },
  'delete': function _delete(key) {
    var index = arrayFindIndex(this.a, function (it) {
      return it[0] === key;
    });
    if (~index) this.a.splice(index, 1);
    return !!~index;
  }
};

module.exports = {
  getConstructor: function getConstructor(wrapper, NAME, IS_MAP, ADDER) {
    var C = wrapper(function (that, iterable) {
      anInstance(that, C, NAME, '_i');
      that._t = NAME; // collection type
      that._i = id++; // collection id
      that._l = undefined; // leak store for uncaught frozen objects
      if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
    });
    redefineAll(C.prototype, {
      // 23.3.3.2 WeakMap.prototype.delete(key)
      // 23.4.3.3 WeakSet.prototype.delete(value)
      'delete': function _delete(key) {
        if (!isObject(key)) return false;
        var data = getWeak(key);
        if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key);
        return data && $has(data, this._i) && delete data[this._i];
      },
      // 23.3.3.4 WeakMap.prototype.has(key)
      // 23.4.3.4 WeakSet.prototype.has(value)
      has: function has(key) {
        if (!isObject(key)) return false;
        var data = getWeak(key);
        if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key);
        return data && $has(data, this._i);
      }
    });
    return C;
  },
  def: function def(that, key, value) {
    var data = getWeak(anObject(key), true);
    if (data === true) uncaughtFrozenStore(that).set(key, value);else data[that._i] = value;
    return that;
  },
  ufstore: uncaughtFrozenStore
};

/***/ }),
/* 167 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://tc39.github.io/ecma262/#sec-toindex
var toInteger = __webpack_require__(31);
var toLength = __webpack_require__(12);
module.exports = function (it) {
  if (it === undefined) return 0;
  var number = toInteger(it);
  var length = toLength(number);
  if (number !== length) throw RangeError('Wrong length!');
  return length;
};

/***/ }),
/* 168 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// all object keys, includes non-enumerable and symbols
var gOPN = __webpack_require__(50);
var gOPS = __webpack_require__(79);
var anObject = __webpack_require__(4);
var Reflect = __webpack_require__(5).Reflect;
module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) {
  var keys = gOPN.f(anObject(it));
  var getSymbols = gOPS.f;
  return getSymbols ? keys.concat(getSymbols(it)) : keys;
};

/***/ }),
/* 169 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray

var isArray = __webpack_require__(80);
var isObject = __webpack_require__(7);
var toLength = __webpack_require__(12);
var ctx = __webpack_require__(25);
var IS_CONCAT_SPREADABLE = __webpack_require__(8)('isConcatSpreadable');

function flattenIntoArray(target, original, source, sourceLen, start, depth, mapper, thisArg) {
  var targetIndex = start;
  var sourceIndex = 0;
  var mapFn = mapper ? ctx(mapper, thisArg, 3) : false;
  var element, spreadable;

  while (sourceIndex < sourceLen) {
    if (sourceIndex in source) {
      element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];

      spreadable = false;
      if (isObject(element)) {
        spreadable = element[IS_CONCAT_SPREADABLE];
        spreadable = spreadable !== undefined ? !!spreadable : isArray(element);
      }

      if (spreadable && depth > 0) {
        targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1;
      } else {
        if (targetIndex >= 0x1fffffffffffff) throw TypeError();
        target[targetIndex] = element;
      }

      targetIndex++;
    }
    sourceIndex++;
  }
  return targetIndex;
}

module.exports = flattenIntoArray;

/***/ }),
/* 170 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/tc39/proposal-string-pad-start-end
var toLength = __webpack_require__(12);
var repeat = __webpack_require__(108);
var defined = __webpack_require__(30);

module.exports = function (that, maxLength, fillString, left) {
  var S = String(defined(that));
  var stringLength = S.length;
  var fillStr = fillString === undefined ? ' ' : String(fillString);
  var intMaxLength = toLength(maxLength);
  if (intMaxLength <= stringLength || fillStr == '') return S;
  var fillLen = intMaxLength - stringLength;
  var stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
  if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen);
  return left ? stringFiller + S : S + stringFiller;
};

/***/ }),
/* 171 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var getKeys = __webpack_require__(47);
var toIObject = __webpack_require__(20);
var isEnum = __webpack_require__(68).f;
module.exports = function (isEntries) {
  return function (it) {
    var O = toIObject(it);
    var keys = getKeys(O);
    var length = keys.length;
    var i = 0;
    var result = [];
    var key;
    while (length > i) {
      if (isEnum.call(O, key = keys[i++])) {
        result.push(isEntries ? [key, O[key]] : O[key]);
      }
    }return result;
  };
};

/***/ }),
/* 172 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var classof = __webpack_require__(69);
var from = __webpack_require__(173);
module.exports = function (NAME) {
  return function toJSON() {
    if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
    return from(this);
  };
};

/***/ }),
/* 173 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var forOf = __webpack_require__(53);

module.exports = function (iter, ITERATOR) {
  var result = [];
  forOf(iter, false, result.push, result, ITERATOR);
  return result;
};

/***/ }),
/* 174 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://rwaldron.github.io/proposal-math-extensions/
module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) {
  if (arguments.length === 0
  // eslint-disable-next-line no-self-compare
  || x != x
  // eslint-disable-next-line no-self-compare
  || inLow != inLow
  // eslint-disable-next-line no-self-compare
  || inHigh != inHigh
  // eslint-disable-next-line no-self-compare
  || outLow != outLow
  // eslint-disable-next-line no-self-compare
  || outHigh != outHigh) return NaN;
  if (x === Infinity || x === -Infinity) return x;
  return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow;
};

/***/ }),
/* 175 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = function (module) {
	if (!module.webpackPolyfill) {
		module.deprecate = function () {};
		module.paths = [];
		// module.parent = undefined by default
		if (!module.children) module.children = [];
		Object.defineProperty(module, "loaded", {
			enumerable: true,
			get: function get() {
				return module.l;
			}
		});
		Object.defineProperty(module, "id", {
			enumerable: true,
			get: function get() {
				return module.i;
			}
		});
		module.webpackPolyfill = 1;
	}
	return module;
};

/***/ }),
/* 176 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/**
 * Representation a of zip file in js
 * @constructor
 */

function JSZip() {
    // if this constructor is used without `new`, it adds `new` before itself:
    if (!(this instanceof JSZip)) {
        return new JSZip();
    }

    if (arguments.length) {
        throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
    }

    // object containing the files :
    // {
    //   "folder/" : {...},
    //   "folder/data.txt" : {...}
    // }
    this.files = {};

    this.comment = null;

    // Where we are in the hierarchy
    this.root = "";
    this.clone = function () {
        var newObj = new JSZip();
        for (var i in this) {
            if (typeof this[i] !== "function") {
                newObj[i] = this[i];
            }
        }
        return newObj;
    };
}
JSZip.prototype = __webpack_require__(422);
JSZip.prototype.loadAsync = __webpack_require__(466);
JSZip.support = __webpack_require__(41);
JSZip.defaults = __webpack_require__(189);

// TODO find a better way to handle this version,
// a require('package.json').version doesn't work with webpack, see #327
JSZip.version = "3.1.5";

JSZip.loadAsync = function (content, options) {
    return new JSZip().loadAsync(content, options);
};

JSZip.external = __webpack_require__(71);
module.exports = JSZip;

/***/ }),
/* 177 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var toString = {}.toString;

module.exports = Array.isArray || function (arr) {
  return toString.call(arr) == '[object Array]';
};

/***/ }),
/* 178 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/*
 * This file is used by module bundlers (browserify/webpack/etc) when
 * including a stream implementation. We use "readable-stream" to get a
 * consistent behavior between nodejs versions but bundlers often have a shim
 * for "stream". Using this shim greatly improve the compatibility and greatly
 * reduce the final size of the bundle (only one stream implementation, not
 * two).
 */
module.exports = __webpack_require__(91);

/***/ }),
/* 179 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(process) {

module.exports = Readable;

/*<replacement>*/
var processNextTick = __webpack_require__(127);
/*</replacement>*/

/*<replacement>*/
var isArray = __webpack_require__(177);
/*</replacement>*/

/*<replacement>*/
var Buffer = __webpack_require__(38).Buffer;
/*</replacement>*/

Readable.ReadableState = ReadableState;

var EE = __webpack_require__(92);

/*<replacement>*/
var EElistenerCount = function EElistenerCount(emitter, type) {
  return emitter.listeners(type).length;
};
/*</replacement>*/

/*<replacement>*/
var Stream;
(function () {
  try {
    Stream = __webpack_require__(91);
  } catch (_) {} finally {
    if (!Stream) Stream = __webpack_require__(92).EventEmitter;
  }
})();
/*</replacement>*/

var Buffer = __webpack_require__(38).Buffer;

/*<replacement>*/
var util = __webpack_require__(70);
util.inherits = __webpack_require__(64);
/*</replacement>*/

/*<replacement>*/
var debugUtil = __webpack_require__(426);
var debug = undefined;
if (debugUtil && debugUtil.debuglog) {
  debug = debugUtil.debuglog('stream');
} else {
  debug = function debug() {};
}
/*</replacement>*/

var StringDecoder;

util.inherits(Readable, Stream);

var Duplex;
function ReadableState(options, stream) {
  Duplex = Duplex || __webpack_require__(55);

  options = options || {};

  // object stream flag. Used to make read(n) ignore n and to
  // make all the buffer merging and length checks go away
  this.objectMode = !!options.objectMode;

  if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;

  // the point at which it stops calling _read() to fill the buffer
  // Note: 0 is a valid value, means "don't call _read preemptively ever"
  var hwm = options.highWaterMark;
  var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;

  // cast to ints.
  this.highWaterMark = ~~this.highWaterMark;

  this.buffer = [];
  this.length = 0;
  this.pipes = null;
  this.pipesCount = 0;
  this.flowing = null;
  this.ended = false;
  this.endEmitted = false;
  this.reading = false;

  // a flag to be able to tell if the onwrite cb is called immediately,
  // or on a later tick.  We set this to true at first, because any
  // actions that shouldn't happen until "later" should generally also
  // not happen before the first write call.
  this.sync = true;

  // whenever we return null, then we set a flag to say
  // that we're awaiting a 'readable' event emission.
  this.needReadable = false;
  this.emittedReadable = false;
  this.readableListening = false;
  this.resumeScheduled = false;

  // Crypto is kind of old and crusty.  Historically, its default string
  // encoding is 'binary' so we have to make this configurable.
  // Everything else in the universe uses 'utf8', though.
  this.defaultEncoding = options.defaultEncoding || 'utf8';

  // when piping, we only care about 'readable' events that happen
  // after read()ing all the bytes and not getting any pushback.
  this.ranOut = false;

  // the number of writers that are awaiting a drain event in .pipe()s
  this.awaitDrain = 0;

  // if true, a maybeReadMore has been scheduled
  this.readingMore = false;

  this.decoder = null;
  this.encoding = null;
  if (options.encoding) {
    if (!StringDecoder) StringDecoder = __webpack_require__(181).StringDecoder;
    this.decoder = new StringDecoder(options.encoding);
    this.encoding = options.encoding;
  }
}

var Duplex;
function Readable(options) {
  Duplex = Duplex || __webpack_require__(55);

  if (!(this instanceof Readable)) return new Readable(options);

  this._readableState = new ReadableState(options, this);

  // legacy
  this.readable = true;

  if (options && typeof options.read === 'function') this._read = options.read;

  Stream.call(this);
}

// Manually shove something into the read() buffer.
// This returns true if the highWaterMark has not been hit yet,
// similar to how Writable.write() returns true if you should
// write() some more.
Readable.prototype.push = function (chunk, encoding) {
  var state = this._readableState;

  if (!state.objectMode && typeof chunk === 'string') {
    encoding = encoding || state.defaultEncoding;
    if (encoding !== state.encoding) {
      chunk = new Buffer(chunk, encoding);
      encoding = '';
    }
  }

  return readableAddChunk(this, state, chunk, encoding, false);
};

// Unshift should *always* be something directly out of read()
Readable.prototype.unshift = function (chunk) {
  var state = this._readableState;
  return readableAddChunk(this, state, chunk, '', true);
};

Readable.prototype.isPaused = function () {
  return this._readableState.flowing === false;
};

function readableAddChunk(stream, state, chunk, encoding, addToFront) {
  var er = chunkInvalid(state, chunk);
  if (er) {
    stream.emit('error', er);
  } else if (chunk === null) {
    state.reading = false;
    onEofChunk(stream, state);
  } else if (state.objectMode || chunk && chunk.length > 0) {
    if (state.ended && !addToFront) {
      var e = new Error('stream.push() after EOF');
      stream.emit('error', e);
    } else if (state.endEmitted && addToFront) {
      var e = new Error('stream.unshift() after end event');
      stream.emit('error', e);
    } else {
      var skipAdd;
      if (state.decoder && !addToFront && !encoding) {
        chunk = state.decoder.write(chunk);
        skipAdd = !state.objectMode && chunk.length === 0;
      }

      if (!addToFront) state.reading = false;

      // Don't add to the buffer if we've decoded to an empty string chunk and
      // we're not in object mode
      if (!skipAdd) {
        // if we want the data now, just emit it.
        if (state.flowing && state.length === 0 && !state.sync) {
          stream.emit('data', chunk);
          stream.read(0);
        } else {
          // update the buffer info.
          state.length += state.objectMode ? 1 : chunk.length;
          if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);

          if (state.needReadable) emitReadable(stream);
        }
      }

      maybeReadMore(stream, state);
    }
  } else if (!addToFront) {
    state.reading = false;
  }

  return needMoreData(state);
}

// if it's past the high water mark, we can push in some more.
// Also, if we have no data yet, we can stand some
// more bytes.  This is to work around cases where hwm=0,
// such as the repl.  Also, if the push() triggered a
// readable event, and the user called read(largeNumber) such that
// needReadable was set, then we ought to push more, so that another
// 'readable' event will be triggered.
function needMoreData(state) {
  return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
}

// backwards compatibility.
Readable.prototype.setEncoding = function (enc) {
  if (!StringDecoder) StringDecoder = __webpack_require__(181).StringDecoder;
  this._readableState.decoder = new StringDecoder(enc);
  this._readableState.encoding = enc;
  return this;
};

// Don't raise the hwm > 8MB
var MAX_HWM = 0x800000;
function computeNewHighWaterMark(n) {
  if (n >= MAX_HWM) {
    n = MAX_HWM;
  } else {
    // Get the next highest power of 2
    n--;
    n |= n >>> 1;
    n |= n >>> 2;
    n |= n >>> 4;
    n |= n >>> 8;
    n |= n >>> 16;
    n++;
  }
  return n;
}

function howMuchToRead(n, state) {
  if (state.length === 0 && state.ended) return 0;

  if (state.objectMode) return n === 0 ? 0 : 1;

  if (n === null || isNaN(n)) {
    // only flow one buffer at a time
    if (state.flowing && state.buffer.length) return state.buffer[0].length;else return state.length;
  }

  if (n <= 0) return 0;

  // If we're asking for more than the target buffer level,
  // then raise the water mark.  Bump up to the next highest
  // power of 2, to prevent increasing it excessively in tiny
  // amounts.
  if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);

  // don't have that much.  return null, unless we've ended.
  if (n > state.length) {
    if (!state.ended) {
      state.needReadable = true;
      return 0;
    } else {
      return state.length;
    }
  }

  return n;
}

// you can override either this method, or the async _read(n) below.
Readable.prototype.read = function (n) {
  debug('read', n);
  var state = this._readableState;
  var nOrig = n;

  if (typeof n !== 'number' || n > 0) state.emittedReadable = false;

  // if we're doing read(0) to trigger a readable event, but we
  // already have a bunch of data in the buffer, then just trigger
  // the 'readable' event and move on.
  if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
    debug('read: emitReadable', state.length, state.ended);
    if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
    return null;
  }

  n = howMuchToRead(n, state);

  // if we've ended, and we're now clear, then finish it up.
  if (n === 0 && state.ended) {
    if (state.length === 0) endReadable(this);
    return null;
  }

  // All the actual chunk generation logic needs to be
  // *below* the call to _read.  The reason is that in certain
  // synthetic stream cases, such as passthrough streams, _read
  // may be a completely synchronous operation which may change
  // the state of the read buffer, providing enough data when
  // before there was *not* enough.
  //
  // So, the steps are:
  // 1. Figure out what the state of things will be after we do
  // a read from the buffer.
  //
  // 2. If that resulting state will trigger a _read, then call _read.
  // Note that this may be asynchronous, or synchronous.  Yes, it is
  // deeply ugly to write APIs this way, but that still doesn't mean
  // that the Readable class should behave improperly, as streams are
  // designed to be sync/async agnostic.
  // Take note if the _read call is sync or async (ie, if the read call
  // has returned yet), so that we know whether or not it's safe to emit
  // 'readable' etc.
  //
  // 3. Actually pull the requested chunks out of the buffer and return.

  // if we need a readable event, then we need to do some reading.
  var doRead = state.needReadable;
  debug('need readable', doRead);

  // if we currently have less than the highWaterMark, then also read some
  if (state.length === 0 || state.length - n < state.highWaterMark) {
    doRead = true;
    debug('length less than watermark', doRead);
  }

  // however, if we've ended, then there's no point, and if we're already
  // reading, then it's unnecessary.
  if (state.ended || state.reading) {
    doRead = false;
    debug('reading or ended', doRead);
  }

  if (doRead) {
    debug('do read');
    state.reading = true;
    state.sync = true;
    // if the length is currently zero, then we *need* a readable event.
    if (state.length === 0) state.needReadable = true;
    // call internal read method
    this._read(state.highWaterMark);
    state.sync = false;
  }

  // If _read pushed data synchronously, then `reading` will be false,
  // and we need to re-evaluate how much data we can return to the user.
  if (doRead && !state.reading) n = howMuchToRead(nOrig, state);

  var ret;
  if (n > 0) ret = fromList(n, state);else ret = null;

  if (ret === null) {
    state.needReadable = true;
    n = 0;
  }

  state.length -= n;

  // If we have nothing in the buffer, then we want to know
  // as soon as we *do* get something into the buffer.
  if (state.length === 0 && !state.ended) state.needReadable = true;

  // If we tried to read() past the EOF, then emit end on the next tick.
  if (nOrig !== n && state.ended && state.length === 0) endReadable(this);

  if (ret !== null) this.emit('data', ret);

  return ret;
};

function chunkInvalid(state, chunk) {
  var er = null;
  if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
    er = new TypeError('Invalid non-string/buffer chunk');
  }
  return er;
}

function onEofChunk(stream, state) {
  if (state.ended) return;
  if (state.decoder) {
    var chunk = state.decoder.end();
    if (chunk && chunk.length) {
      state.buffer.push(chunk);
      state.length += state.objectMode ? 1 : chunk.length;
    }
  }
  state.ended = true;

  // emit 'readable' now to make sure it gets picked up.
  emitReadable(stream);
}

// Don't emit readable right away in sync mode, because this can trigger
// another read() call => stack overflow.  This way, it might trigger
// a nextTick recursion warning, but that's not so bad.
function emitReadable(stream) {
  var state = stream._readableState;
  state.needReadable = false;
  if (!state.emittedReadable) {
    debug('emitReadable', state.flowing);
    state.emittedReadable = true;
    if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
  }
}

function emitReadable_(stream) {
  debug('emit readable');
  stream.emit('readable');
  flow(stream);
}

// at this point, the user has presumably seen the 'readable' event,
// and called read() to consume some data.  that may have triggered
// in turn another _read(n) call, in which case reading = true if
// it's in progress.
// However, if we're not ended, or reading, and the length < hwm,
// then go ahead and try to read some more preemptively.
function maybeReadMore(stream, state) {
  if (!state.readingMore) {
    state.readingMore = true;
    processNextTick(maybeReadMore_, stream, state);
  }
}

function maybeReadMore_(stream, state) {
  var len = state.length;
  while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
    debug('maybeReadMore read 0');
    stream.read(0);
    if (len === state.length)
      // didn't get any data, stop spinning.
      break;else len = state.length;
  }
  state.readingMore = false;
}

// abstract method.  to be overridden in specific implementation classes.
// call cb(er, data) where data is <= n in length.
// for virtual (non-string, non-buffer) streams, "length" is somewhat
// arbitrary, and perhaps not very meaningful.
Readable.prototype._read = function (n) {
  this.emit('error', new Error('not implemented'));
};

Readable.prototype.pipe = function (dest, pipeOpts) {
  var src = this;
  var state = this._readableState;

  switch (state.pipesCount) {
    case 0:
      state.pipes = dest;
      break;
    case 1:
      state.pipes = [state.pipes, dest];
      break;
    default:
      state.pipes.push(dest);
      break;
  }
  state.pipesCount += 1;
  debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);

  var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;

  var endFn = doEnd ? onend : cleanup;
  if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);

  dest.on('unpipe', onunpipe);
  function onunpipe(readable) {
    debug('onunpipe');
    if (readable === src) {
      cleanup();
    }
  }

  function onend() {
    debug('onend');
    dest.end();
  }

  // when the dest drains, it reduces the awaitDrain counter
  // on the source.  This would be more elegant with a .once()
  // handler in flow(), but adding and removing repeatedly is
  // too slow.
  var ondrain = pipeOnDrain(src);
  dest.on('drain', ondrain);

  var cleanedUp = false;
  function cleanup() {
    debug('cleanup');
    // cleanup event handlers once the pipe is broken
    dest.removeListener('close', onclose);
    dest.removeListener('finish', onfinish);
    dest.removeListener('drain', ondrain);
    dest.removeListener('error', onerror);
    dest.removeListener('unpipe', onunpipe);
    src.removeListener('end', onend);
    src.removeListener('end', cleanup);
    src.removeListener('data', ondata);

    cleanedUp = true;

    // if the reader is waiting for a drain event from this
    // specific writer, then it would cause it to never start
    // flowing again.
    // So, if this is awaiting a drain, then we just call it now.
    // If we don't know, then assume that we are waiting for one.
    if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  }

  src.on('data', ondata);
  function ondata(chunk) {
    debug('ondata');
    var ret = dest.write(chunk);
    if (false === ret) {
      // If the user unpiped during `dest.write()`, it is possible
      // to get stuck in a permanently paused state if that write
      // also returned false.
      if (state.pipesCount === 1 && state.pipes[0] === dest && src.listenerCount('data') === 1 && !cleanedUp) {
        debug('false write response, pause', src._readableState.awaitDrain);
        src._readableState.awaitDrain++;
      }
      src.pause();
    }
  }

  // if the dest has an error, then stop piping into it.
  // however, don't suppress the throwing behavior for this.
  function onerror(er) {
    debug('onerror', er);
    unpipe();
    dest.removeListener('error', onerror);
    if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
  }
  // This is a brutally ugly hack to make sure that our error handler
  // is attached before any userland ones.  NEVER DO THIS.
  if (!dest._events || !dest._events.error) dest.on('error', onerror);else if (isArray(dest._events.error)) dest._events.error.unshift(onerror);else dest._events.error = [onerror, dest._events.error];

  // Both close and finish should trigger unpipe, but only once.
  function onclose() {
    dest.removeListener('finish', onfinish);
    unpipe();
  }
  dest.once('close', onclose);
  function onfinish() {
    debug('onfinish');
    dest.removeListener('close', onclose);
    unpipe();
  }
  dest.once('finish', onfinish);

  function unpipe() {
    debug('unpipe');
    src.unpipe(dest);
  }

  // tell the dest that it's being piped to
  dest.emit('pipe', src);

  // start the flow if it hasn't been started already.
  if (!state.flowing) {
    debug('pipe resume');
    src.resume();
  }

  return dest;
};

function pipeOnDrain(src) {
  return function () {
    var state = src._readableState;
    debug('pipeOnDrain', state.awaitDrain);
    if (state.awaitDrain) state.awaitDrain--;
    if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
      state.flowing = true;
      flow(src);
    }
  };
}

Readable.prototype.unpipe = function (dest) {
  var state = this._readableState;

  // if we're not piping anywhere, then do nothing.
  if (state.pipesCount === 0) return this;

  // just one destination.  most common case.
  if (state.pipesCount === 1) {
    // passed in one, but it's not the right one.
    if (dest && dest !== state.pipes) return this;

    if (!dest) dest = state.pipes;

    // got a match.
    state.pipes = null;
    state.pipesCount = 0;
    state.flowing = false;
    if (dest) dest.emit('unpipe', this);
    return this;
  }

  // slow case. multiple pipe destinations.

  if (!dest) {
    // remove all.
    var dests = state.pipes;
    var len = state.pipesCount;
    state.pipes = null;
    state.pipesCount = 0;
    state.flowing = false;

    for (var _i = 0; _i < len; _i++) {
      dests[_i].emit('unpipe', this);
    }return this;
  }

  // try to find the right one.
  var i = indexOf(state.pipes, dest);
  if (i === -1) return this;

  state.pipes.splice(i, 1);
  state.pipesCount -= 1;
  if (state.pipesCount === 1) state.pipes = state.pipes[0];

  dest.emit('unpipe', this);

  return this;
};

// set up data events if they are asked for
// Ensure readable listeners eventually get something
Readable.prototype.on = function (ev, fn) {
  var res = Stream.prototype.on.call(this, ev, fn);

  // If listening to data, and it has not explicitly been paused,
  // then call resume to start the flow of data on the next tick.
  if (ev === 'data' && false !== this._readableState.flowing) {
    this.resume();
  }

  if (ev === 'readable' && !this._readableState.endEmitted) {
    var state = this._readableState;
    if (!state.readableListening) {
      state.readableListening = true;
      state.emittedReadable = false;
      state.needReadable = true;
      if (!state.reading) {
        processNextTick(nReadingNextTick, this);
      } else if (state.length) {
        emitReadable(this, state);
      }
    }
  }

  return res;
};
Readable.prototype.addListener = Readable.prototype.on;

function nReadingNextTick(self) {
  debug('readable nexttick read 0');
  self.read(0);
}

// pause() and resume() are remnants of the legacy readable stream API
// If the user uses them, then switch into old mode.
Readable.prototype.resume = function () {
  var state = this._readableState;
  if (!state.flowing) {
    debug('resume');
    state.flowing = true;
    resume(this, state);
  }
  return this;
};

function resume(stream, state) {
  if (!state.resumeScheduled) {
    state.resumeScheduled = true;
    processNextTick(resume_, stream, state);
  }
}

function resume_(stream, state) {
  if (!state.reading) {
    debug('resume read 0');
    stream.read(0);
  }

  state.resumeScheduled = false;
  stream.emit('resume');
  flow(stream);
  if (state.flowing && !state.reading) stream.read(0);
}

Readable.prototype.pause = function () {
  debug('call pause flowing=%j', this._readableState.flowing);
  if (false !== this._readableState.flowing) {
    debug('pause');
    this._readableState.flowing = false;
    this.emit('pause');
  }
  return this;
};

function flow(stream) {
  var state = stream._readableState;
  debug('flow', state.flowing);
  if (state.flowing) {
    do {
      var chunk = stream.read();
    } while (null !== chunk && state.flowing);
  }
}

// wrap an old-style stream as the async data source.
// This is *not* part of the readable stream interface.
// It is an ugly unfortunate mess of history.
Readable.prototype.wrap = function (stream) {
  var state = this._readableState;
  var paused = false;

  var self = this;
  stream.on('end', function () {
    debug('wrapped end');
    if (state.decoder && !state.ended) {
      var chunk = state.decoder.end();
      if (chunk && chunk.length) self.push(chunk);
    }

    self.push(null);
  });

  stream.on('data', function (chunk) {
    debug('wrapped data');
    if (state.decoder) chunk = state.decoder.write(chunk);

    // don't skip over falsy values in objectMode
    if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;

    var ret = self.push(chunk);
    if (!ret) {
      paused = true;
      stream.pause();
    }
  });

  // proxy all the other methods.
  // important when wrapping filters and duplexes.
  for (var i in stream) {
    if (this[i] === undefined && typeof stream[i] === 'function') {
      this[i] = function (method) {
        return function () {
          return stream[method].apply(stream, arguments);
        };
      }(i);
    }
  }

  // proxy certain important events.
  var events = ['error', 'close', 'destroy', 'pause', 'resume'];
  forEach(events, function (ev) {
    stream.on(ev, self.emit.bind(self, ev));
  });

  // when we try to consume some more bytes, simply unpause the
  // underlying stream.
  self._read = function (n) {
    debug('wrapped _read', n);
    if (paused) {
      paused = false;
      stream.resume();
    }
  };

  return self;
};

// exposed for testing purposes only.
Readable._fromList = fromList;

// Pluck off n bytes from an array of buffers.
// Length is the combined lengths of all the buffers in the list.
function fromList(n, state) {
  var list = state.buffer;
  var length = state.length;
  var stringMode = !!state.decoder;
  var objectMode = !!state.objectMode;
  var ret;

  // nothing in the list, definitely empty.
  if (list.length === 0) return null;

  if (length === 0) ret = null;else if (objectMode) ret = list.shift();else if (!n || n >= length) {
    // read it all, truncate the array.
    if (stringMode) ret = list.join('');else if (list.length === 1) ret = list[0];else ret = Buffer.concat(list, length);
    list.length = 0;
  } else {
    // read just some of it.
    if (n < list[0].length) {
      // just take a part of the first list item.
      // slice is the same for buffers and strings.
      var buf = list[0];
      ret = buf.slice(0, n);
      list[0] = buf.slice(n);
    } else if (n === list[0].length) {
      // first list is a perfect match
      ret = list.shift();
    } else {
      // complex case.
      // we have enough to cover it, but it spans past the first buffer.
      if (stringMode) ret = '';else ret = new Buffer(n);

      var c = 0;
      for (var i = 0, l = list.length; i < l && c < n; i++) {
        var buf = list[0];
        var cpy = Math.min(n - c, buf.length);

        if (stringMode) ret += buf.slice(0, cpy);else buf.copy(ret, c, 0, cpy);

        if (cpy < buf.length) list[0] = buf.slice(cpy);else list.shift();

        c += cpy;
      }
    }
  }

  return ret;
}

function endReadable(stream) {
  var state = stream._readableState;

  // If we get here before consuming all the bytes, then that is a
  // bug in node.  Should never happen.
  if (state.length > 0) throw new Error('endReadable called on non-empty stream');

  if (!state.endEmitted) {
    state.ended = true;
    processNextTick(endReadableNT, state, stream);
  }
}

function endReadableNT(state, stream) {
  // Check that we didn't get one last unshift.
  if (!state.endEmitted && state.length === 0) {
    state.endEmitted = true;
    stream.readable = false;
    stream.emit('end');
  }
}

function forEach(xs, f) {
  for (var i = 0, l = xs.length; i < l; i++) {
    f(xs[i], i);
  }
}

function indexOf(xs, x) {
  for (var i = 0, l = xs.length; i < l; i++) {
    if (xs[i] === x) return i;
  }
  return -1;
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(93)))

/***/ }),
/* 180 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {

var apply = Function.prototype.apply;

// DOM APIs, for completeness

exports.setTimeout = function () {
  return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
};
exports.setInterval = function () {
  return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
};
exports.clearTimeout = exports.clearInterval = function (timeout) {
  if (timeout) {
    timeout.close();
  }
};

function Timeout(id, clearFn) {
  this._id = id;
  this._clearFn = clearFn;
}
Timeout.prototype.unref = Timeout.prototype.ref = function () {};
Timeout.prototype.close = function () {
  this._clearFn.call(window, this._id);
};

// Does not start the time, just sets up the members needed.
exports.enroll = function (item, msecs) {
  clearTimeout(item._idleTimeoutId);
  item._idleTimeout = msecs;
};

exports.unenroll = function (item) {
  clearTimeout(item._idleTimeoutId);
  item._idleTimeout = -1;
};

exports._unrefActive = exports.active = function (item) {
  clearTimeout(item._idleTimeoutId);

  var msecs = item._idleTimeout;
  if (msecs >= 0) {
    item._idleTimeoutId = setTimeout(function onTimeout() {
      if (item._onTimeout) item._onTimeout();
    }, msecs);
  }
};

// setimmediate attaches itself to the global object
__webpack_require__(427);
// On some exotic environments, it's not clear which object `setimmeidate` was
// able to install onto.  Search each possibility in the same order as the
// `setimmediate` library.
exports.setImmediate = typeof self !== "undefined" && self.setImmediate || typeof global !== "undefined" && global.setImmediate || undefined && undefined.setImmediate;
exports.clearImmediate = typeof self !== "undefined" && self.clearImmediate || typeof global !== "undefined" && global.clearImmediate || undefined && undefined.clearImmediate;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(43)))

/***/ }),
/* 181 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var Buffer = __webpack_require__(429).Buffer;

var isEncoding = Buffer.isEncoding || function (encoding) {
  encoding = '' + encoding;
  switch (encoding && encoding.toLowerCase()) {
    case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
      return true;
    default:
      return false;
  }
};

function _normalizeEncoding(enc) {
  if (!enc) return 'utf8';
  var retried;
  while (true) {
    switch (enc) {
      case 'utf8':
      case 'utf-8':
        return 'utf8';
      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        return 'utf16le';
      case 'latin1':
      case 'binary':
        return 'latin1';
      case 'base64':
      case 'ascii':
      case 'hex':
        return enc;
      default:
        if (retried) return; // undefined
        enc = ('' + enc).toLowerCase();
        retried = true;
    }
  }
};

// Do not cache `Buffer.isEncoding` when checking encoding names as some
// modules monkey-patch it to support additional encodings
function normalizeEncoding(enc) {
  var nenc = _normalizeEncoding(enc);
  if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
  return nenc || enc;
}

// StringDecoder provides an interface for efficiently splitting a series of
// buffers into a series of JS strings without breaking apart multi-byte
// characters.
exports.StringDecoder = StringDecoder;
function StringDecoder(encoding) {
  this.encoding = normalizeEncoding(encoding);
  var nb;
  switch (this.encoding) {
    case 'utf16le':
      this.text = utf16Text;
      this.end = utf16End;
      nb = 4;
      break;
    case 'utf8':
      this.fillLast = utf8FillLast;
      nb = 4;
      break;
    case 'base64':
      this.text = base64Text;
      this.end = base64End;
      nb = 3;
      break;
    default:
      this.write = simpleWrite;
      this.end = simpleEnd;
      return;
  }
  this.lastNeed = 0;
  this.lastTotal = 0;
  this.lastChar = Buffer.allocUnsafe(nb);
}

StringDecoder.prototype.write = function (buf) {
  if (buf.length === 0) return '';
  var r;
  var i;
  if (this.lastNeed) {
    r = this.fillLast(buf);
    if (r === undefined) return '';
    i = this.lastNeed;
    this.lastNeed = 0;
  } else {
    i = 0;
  }
  if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
  return r || '';
};

StringDecoder.prototype.end = utf8End;

// Returns only complete characters in a Buffer
StringDecoder.prototype.text = utf8Text;

// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
StringDecoder.prototype.fillLast = function (buf) {
  if (this.lastNeed <= buf.length) {
    buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
    return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  }
  buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
  this.lastNeed -= buf.length;
};

// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
// continuation byte.
function utf8CheckByte(byte) {
  if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
  return -1;
}

// Checks at most 3 bytes at the end of a Buffer in order to detect an
// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
// needed to complete the UTF-8 character (if applicable) are returned.
function utf8CheckIncomplete(self, buf, i) {
  var j = buf.length - 1;
  if (j < i) return 0;
  var nb = utf8CheckByte(buf[j]);
  if (nb >= 0) {
    if (nb > 0) self.lastNeed = nb - 1;
    return nb;
  }
  if (--j < i) return 0;
  nb = utf8CheckByte(buf[j]);
  if (nb >= 0) {
    if (nb > 0) self.lastNeed = nb - 2;
    return nb;
  }
  if (--j < i) return 0;
  nb = utf8CheckByte(buf[j]);
  if (nb >= 0) {
    if (nb > 0) {
      if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
    }
    return nb;
  }
  return 0;
}

// Validates as many continuation bytes for a multi-byte UTF-8 character as
// needed or are available. If we see a non-continuation byte where we expect
// one, we "replace" the validated continuation bytes we've seen so far with
// UTF-8 replacement characters ('\ufffd'), to match v8's UTF-8 decoding
// behavior. The continuation byte check is included three times in the case
// where all of the continuation bytes for a character exist in the same buffer.
// It is also done this way as a slight performance increase instead of using a
// loop.
function utf8CheckExtraBytes(self, buf, p) {
  if ((buf[0] & 0xC0) !== 0x80) {
    self.lastNeed = 0;
    return '\uFFFD'.repeat(p);
  }
  if (self.lastNeed > 1 && buf.length > 1) {
    if ((buf[1] & 0xC0) !== 0x80) {
      self.lastNeed = 1;
      return '\uFFFD'.repeat(p + 1);
    }
    if (self.lastNeed > 2 && buf.length > 2) {
      if ((buf[2] & 0xC0) !== 0x80) {
        self.lastNeed = 2;
        return '\uFFFD'.repeat(p + 2);
      }
    }
  }
}

// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
function utf8FillLast(buf) {
  var p = this.lastTotal - this.lastNeed;
  var r = utf8CheckExtraBytes(this, buf, p);
  if (r !== undefined) return r;
  if (this.lastNeed <= buf.length) {
    buf.copy(this.lastChar, p, 0, this.lastNeed);
    return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  }
  buf.copy(this.lastChar, p, 0, buf.length);
  this.lastNeed -= buf.length;
}

// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
// partial character, the character's bytes are buffered until the required
// number of bytes are available.
function utf8Text(buf, i) {
  var total = utf8CheckIncomplete(this, buf, i);
  if (!this.lastNeed) return buf.toString('utf8', i);
  this.lastTotal = total;
  var end = buf.length - (total - this.lastNeed);
  buf.copy(this.lastChar, 0, end);
  return buf.toString('utf8', i, end);
}

// For UTF-8, a replacement character for each buffered byte of a (partial)
// character needs to be added to the output.
function utf8End(buf) {
  var r = buf && buf.length ? this.write(buf) : '';
  if (this.lastNeed) return r + '\uFFFD'.repeat(this.lastTotal - this.lastNeed);
  return r;
}

// UTF-16LE typically needs two bytes per character, but even if we have an even
// number of bytes available, we need to check if we end on a leading/high
// surrogate. In that case, we need to wait for the next two bytes in order to
// decode the last character properly.
function utf16Text(buf, i) {
  if ((buf.length - i) % 2 === 0) {
    var r = buf.toString('utf16le', i);
    if (r) {
      var c = r.charCodeAt(r.length - 1);
      if (c >= 0xD800 && c <= 0xDBFF) {
        this.lastNeed = 2;
        this.lastTotal = 4;
        this.lastChar[0] = buf[buf.length - 2];
        this.lastChar[1] = buf[buf.length - 1];
        return r.slice(0, -1);
      }
    }
    return r;
  }
  this.lastNeed = 1;
  this.lastTotal = 2;
  this.lastChar[0] = buf[buf.length - 1];
  return buf.toString('utf16le', i, buf.length - 1);
}

// For UTF-16LE we do not explicitly append special replacement characters if we
// end on a partial character, we simply let v8 handle that.
function utf16End(buf) {
  var r = buf && buf.length ? this.write(buf) : '';
  if (this.lastNeed) {
    var end = this.lastTotal - this.lastNeed;
    return r + this.lastChar.toString('utf16le', 0, end);
  }
  return r;
}

function base64Text(buf, i) {
  var n = (buf.length - i) % 3;
  if (n === 0) return buf.toString('base64', i);
  this.lastNeed = 3 - n;
  this.lastTotal = 3;
  if (n === 1) {
    this.lastChar[0] = buf[buf.length - 1];
  } else {
    this.lastChar[0] = buf[buf.length - 2];
    this.lastChar[1] = buf[buf.length - 1];
  }
  return buf.toString('base64', i, buf.length - n);
}

function base64End(buf) {
  var r = buf && buf.length ? this.write(buf) : '';
  if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
  return r;
}

// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
function simpleWrite(buf) {
  return buf.toString(this.encoding);
}

function simpleEnd(buf) {
  return buf && buf.length ? this.write(buf) : '';
}

/***/ }),
/* 182 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// a passthrough stream.
// basically just the most minimal sort of Transform stream.
// Every written chunk gets output as-is.



module.exports = PassThrough;

var Transform = __webpack_require__(129);

/*<replacement>*/
var util = __webpack_require__(70);
util.inherits = __webpack_require__(64);
/*</replacement>*/

util.inherits(PassThrough, Transform);

function PassThrough(options) {
  if (!(this instanceof PassThrough)) return new PassThrough(options);

  Transform.call(this, options);
}

PassThrough.prototype._transform = function (chunk, encoding, cb) {
  cb(null, chunk);
};

/***/ }),
/* 183 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var utils = __webpack_require__(9);
var support = __webpack_require__(41);
// private property
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

// public method for encoding
exports.encode = function (input) {
    var output = [];
    var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
    var i = 0,
        len = input.length,
        remainingBytes = len;

    var isArray = utils.getTypeOf(input) !== "string";
    while (i < input.length) {
        remainingBytes = len - i;

        if (!isArray) {
            chr1 = input.charCodeAt(i++);
            chr2 = i < len ? input.charCodeAt(i++) : 0;
            chr3 = i < len ? input.charCodeAt(i++) : 0;
        } else {
            chr1 = input[i++];
            chr2 = i < len ? input[i++] : 0;
            chr3 = i < len ? input[i++] : 0;
        }

        enc1 = chr1 >> 2;
        enc2 = (chr1 & 3) << 4 | chr2 >> 4;
        enc3 = remainingBytes > 1 ? (chr2 & 15) << 2 | chr3 >> 6 : 64;
        enc4 = remainingBytes > 2 ? chr3 & 63 : 64;

        output.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4));
    }

    return output.join("");
};

// public method for decoding
exports.decode = function (input) {
    var chr1, chr2, chr3;
    var enc1, enc2, enc3, enc4;
    var i = 0,
        resultIndex = 0;

    var dataUrlPrefix = "data:";

    if (input.substr(0, dataUrlPrefix.length) === dataUrlPrefix) {
        // This is a common error: people give a data url
        // (data:image/png;base64,iVBOR...) with a {base64: true} and
        // wonders why things don't work.
        // We can detect that the string input looks like a data url but we
        // *can't* be sure it is one: removing everything up to the comma would
        // be too dangerous.
        throw new Error("Invalid base64 input, it looks like a data url.");
    }

    input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

    var totalLength = input.length * 3 / 4;
    if (input.charAt(input.length - 1) === _keyStr.charAt(64)) {
        totalLength--;
    }
    if (input.charAt(input.length - 2) === _keyStr.charAt(64)) {
        totalLength--;
    }
    if (totalLength % 1 !== 0) {
        // totalLength is not an integer, the length does not match a valid
        // base64 content. That can happen if:
        // - the input is not a base64 content
        // - the input is *almost* a base64 content, with a extra chars at the
        //   beginning or at the end
        // - the input uses a base64 variant (base64url for example)
        throw new Error("Invalid base64 input, bad content length.");
    }
    var output;
    if (support.uint8array) {
        output = new Uint8Array(totalLength | 0);
    } else {
        output = new Array(totalLength | 0);
    }

    while (i < input.length) {

        enc1 = _keyStr.indexOf(input.charAt(i++));
        enc2 = _keyStr.indexOf(input.charAt(i++));
        enc3 = _keyStr.indexOf(input.charAt(i++));
        enc4 = _keyStr.indexOf(input.charAt(i++));

        chr1 = enc1 << 2 | enc2 >> 4;
        chr2 = (enc2 & 15) << 4 | enc3 >> 2;
        chr3 = (enc3 & 3) << 6 | enc4;

        output[resultIndex++] = chr1;

        if (enc3 !== 64) {
            output[resultIndex++] = chr2;
        }
        if (enc4 !== 64) {
            output[resultIndex++] = chr3;
        }
    }

    return output;
};

/***/ }),
/* 184 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var core = module.exports = { version: '2.3.0' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef

/***/ }),
/* 185 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// optional / simple context binding
var aFunction = __webpack_require__(437);
module.exports = function (fn, that, length) {
  aFunction(fn);
  if (that === undefined) return fn;
  switch (length) {
    case 1:
      return function (a) {
        return fn.call(that, a);
      };
    case 2:
      return function (a, b) {
        return fn.call(that, a, b);
      };
    case 3:
      return function (a, b, c) {
        return fn.call(that, a, b, c);
      };
  }
  return function () /* ...args */{
    return fn.apply(that, arguments);
  };
};

/***/ }),
/* 186 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = function (exec) {
  try {
    return !!exec();
  } catch (e) {
    return true;
  }
};

/***/ }),
/* 187 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var isObject = __webpack_require__(130),
    document = __webpack_require__(95).document
// in old IE typeof document.createElement is 'object'
,
    is = isObject(document) && isObject(document.createElement);
module.exports = function (it) {
  return is ? document.createElement(it) : {};
};

/***/ }),
/* 188 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {

var utils = __webpack_require__(9);
var ConvertWorker = __webpack_require__(450);
var GenericWorker = __webpack_require__(23);
var base64 = __webpack_require__(183);
var support = __webpack_require__(41);
var external = __webpack_require__(71);

var NodejsStreamOutputAdapter = null;
if (support.nodestream) {
    try {
        NodejsStreamOutputAdapter = __webpack_require__(451);
    } catch (e) {}
}

/**
 * Apply the final transformation of the data. If the user wants a Blob for
 * example, it's easier to work with an U8intArray and finally do the
 * ArrayBuffer/Blob conversion.
 * @param {String} type the name of the final type
 * @param {String|Uint8Array|Buffer} content the content to transform
 * @param {String} mimeType the mime type of the content, if applicable.
 * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the content in the right format.
 */
function transformZipOutput(type, content, mimeType) {
    switch (type) {
        case "blob":
            return utils.newBlob(utils.transformTo("arraybuffer", content), mimeType);
        case "base64":
            return base64.encode(content);
        default:
            return utils.transformTo(type, content);
    }
}

/**
 * Concatenate an array of data of the given type.
 * @param {String} type the type of the data in the given array.
 * @param {Array} dataArray the array containing the data chunks to concatenate
 * @return {String|Uint8Array|Buffer} the concatenated data
 * @throws Error if the asked type is unsupported
 */
function concat(type, dataArray) {
    var i,
        index = 0,
        res = null,
        totalLength = 0;
    for (i = 0; i < dataArray.length; i++) {
        totalLength += dataArray[i].length;
    }
    switch (type) {
        case "string":
            return dataArray.join("");
        case "array":
            return Array.prototype.concat.apply([], dataArray);
        case "uint8array":
            res = new Uint8Array(totalLength);
            for (i = 0; i < dataArray.length; i++) {
                res.set(dataArray[i], index);
                index += dataArray[i].length;
            }
            return res;
        case "nodebuffer":
            return Buffer.concat(dataArray);
        default:
            throw new Error("concat : unsupported type '" + type + "'");
    }
}

/**
 * Listen a StreamHelper, accumulate its content and concatenate it into a
 * complete block.
 * @param {StreamHelper} helper the helper to use.
 * @param {Function} updateCallback a callback called on each update. Called
 * with one arg :
 * - the metadata linked to the update received.
 * @return Promise the promise for the accumulation.
 */
function _accumulate(helper, updateCallback) {
    return new external.Promise(function (resolve, reject) {
        var dataArray = [];
        var chunkType = helper._internalType,
            resultType = helper._outputType,
            mimeType = helper._mimeType;
        helper.on('data', function (data, meta) {
            dataArray.push(data);
            if (updateCallback) {
                updateCallback(meta);
            }
        }).on('error', function (err) {
            dataArray = [];
            reject(err);
        }).on('end', function () {
            try {
                var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType);
                resolve(result);
            } catch (e) {
                reject(e);
            }
            dataArray = [];
        }).resume();
    });
}

/**
 * An helper to easily use workers outside of JSZip.
 * @constructor
 * @param {Worker} worker the worker to wrap
 * @param {String} outputType the type of data expected by the use
 * @param {String} mimeType the mime type of the content, if applicable.
 */
function StreamHelper(worker, outputType, mimeType) {
    var internalType = outputType;
    switch (outputType) {
        case "blob":
        case "arraybuffer":
            internalType = "uint8array";
            break;
        case "base64":
            internalType = "string";
            break;
    }

    try {
        // the type used internally
        this._internalType = internalType;
        // the type used to output results
        this._outputType = outputType;
        // the mime type
        this._mimeType = mimeType;
        utils.checkSupport(internalType);
        this._worker = worker.pipe(new ConvertWorker(internalType));
        // the last workers can be rewired without issues but we need to
        // prevent any updates on previous workers.
        worker.lock();
    } catch (e) {
        this._worker = new GenericWorker("error");
        this._worker.error(e);
    }
}

StreamHelper.prototype = {
    /**
     * Listen a StreamHelper, accumulate its content and concatenate it into a
     * complete block.
     * @param {Function} updateCb the update callback.
     * @return Promise the promise for the accumulation.
     */
    accumulate: function accumulate(updateCb) {
        return _accumulate(this, updateCb);
    },
    /**
     * Add a listener on an event triggered on a stream.
     * @param {String} evt the name of the event
     * @param {Function} fn the listener
     * @return {StreamHelper} the current helper.
     */
    on: function on(evt, fn) {
        var self = this;

        if (evt === "data") {
            this._worker.on(evt, function (chunk) {
                fn.call(self, chunk.data, chunk.meta);
            });
        } else {
            this._worker.on(evt, function () {
                utils.delay(fn, arguments, self);
            });
        }
        return this;
    },
    /**
     * Resume the flow of chunks.
     * @return {StreamHelper} the current helper.
     */
    resume: function resume() {
        utils.delay(this._worker.resume, [], this._worker);
        return this;
    },
    /**
     * Pause the flow of chunks.
     * @return {StreamHelper} the current helper.
     */
    pause: function pause() {
        this._worker.pause();
        return this;
    },
    /**
     * Return a nodejs stream for this helper.
     * @param {Function} updateCb the update callback.
     * @return {NodejsStreamOutputAdapter} the nodejs stream.
     */
    toNodejsStream: function toNodejsStream(updateCb) {
        utils.checkSupport("nodestream");
        if (this._outputType !== "nodebuffer") {
            // an object stream containing blob/arraybuffer/uint8array/string
            // is strange and I don't know if it would be useful.
            // I you find this comment and have a good usecase, please open a
            // bug report !
            throw new Error(this._outputType + " is not supported by this method");
        }

        return new NodejsStreamOutputAdapter(this, {
            objectMode: this._outputType !== "nodebuffer"
        }, updateCb);
    }
};

module.exports = StreamHelper;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(38).Buffer))

/***/ }),
/* 189 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


exports.base64 = false;
exports.binary = false;
exports.dir = false;
exports.createFolders = true;
exports.date = null;
exports.compression = null;
exports.compressionOptions = null;
exports.comment = null;
exports.unixPermissions = null;
exports.dosPermissions = null;

/***/ }),
/* 190 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var utils = __webpack_require__(9);
var GenericWorker = __webpack_require__(23);

// the size of the generated chunks
// TODO expose this as a public variable
var DEFAULT_BLOCK_SIZE = 16 * 1024;

/**
 * A worker that reads a content and emits chunks.
 * @constructor
 * @param {Promise} dataP the promise of the data to split
 */
function DataWorker(dataP) {
    GenericWorker.call(this, "DataWorker");
    var self = this;
    this.dataIsReady = false;
    this.index = 0;
    this.max = 0;
    this.data = null;
    this.type = "";

    this._tickScheduled = false;

    dataP.then(function (data) {
        self.dataIsReady = true;
        self.data = data;
        self.max = data && data.length || 0;
        self.type = utils.getTypeOf(data);
        if (!self.isPaused) {
            self._tickAndRepeat();
        }
    }, function (e) {
        self.error(e);
    });
}

utils.inherits(DataWorker, GenericWorker);

/**
 * @see GenericWorker.cleanUp
 */
DataWorker.prototype.cleanUp = function () {
    GenericWorker.prototype.cleanUp.call(this);
    this.data = null;
};

/**
 * @see GenericWorker.resume
 */
DataWorker.prototype.resume = function () {
    if (!GenericWorker.prototype.resume.call(this)) {
        return false;
    }

    if (!this._tickScheduled && this.dataIsReady) {
        this._tickScheduled = true;
        utils.delay(this._tickAndRepeat, [], this);
    }
    return true;
};

/**
 * Trigger a tick a schedule an other call to this function.
 */
DataWorker.prototype._tickAndRepeat = function () {
    this._tickScheduled = false;
    if (this.isPaused || this.isFinished) {
        return;
    }
    this._tick();
    if (!this.isFinished) {
        utils.delay(this._tickAndRepeat, [], this);
        this._tickScheduled = true;
    }
};

/**
 * Read and push a chunk.
 */
DataWorker.prototype._tick = function () {

    if (this.isPaused || this.isFinished) {
        return false;
    }

    var size = DEFAULT_BLOCK_SIZE;
    var data = null,
        nextIndex = Math.min(this.max, this.index + size);
    if (this.index >= this.max) {
        // EOF
        return this.end();
    } else {
        switch (this.type) {
            case "string":
                data = this.data.substring(this.index, nextIndex);
                break;
            case "uint8array":
                data = this.data.subarray(this.index, nextIndex);
                break;
            case "array":
            case "nodebuffer":
                data = this.data.slice(this.index, nextIndex);
                break;
        }
        this.index = nextIndex;
        return this.push({
            data: data,
            meta: {
                percent: this.max ? this.index / this.max * 100 : 0
            }
        });
    }
};

module.exports = DataWorker;

/***/ }),
/* 191 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var utils = __webpack_require__(9);
var GenericWorker = __webpack_require__(23);

/**
 * A worker which calculate the total length of the data flowing through.
 * @constructor
 * @param {String} propName the name used to expose the length
 */
function DataLengthProbe(propName) {
    GenericWorker.call(this, "DataLengthProbe for " + propName);
    this.propName = propName;
    this.withStreamInfo(propName, 0);
}
utils.inherits(DataLengthProbe, GenericWorker);

/**
 * @see GenericWorker.processChunk
 */
DataLengthProbe.prototype.processChunk = function (chunk) {
    if (chunk) {
        var length = this.streamInfo[this.propName] || 0;
        this.streamInfo[this.propName] = length + chunk.data.length;
    }
    GenericWorker.prototype.processChunk.call(this, chunk);
};
module.exports = DataLengthProbe;

/***/ }),
/* 192 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var GenericWorker = __webpack_require__(23);
var crc32 = __webpack_require__(133);
var utils = __webpack_require__(9);

/**
 * A worker which calculate the crc32 of the data flowing through.
 * @constructor
 */
function Crc32Probe() {
  GenericWorker.call(this, "Crc32Probe");
  this.withStreamInfo("crc32", 0);
}
utils.inherits(Crc32Probe, GenericWorker);

/**
 * @see GenericWorker.processChunk
 */
Crc32Probe.prototype.processChunk = function (chunk) {
  this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0);
  this.push(chunk);
};
module.exports = Crc32Probe;

/***/ }),
/* 193 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var GenericWorker = __webpack_require__(23);

exports.STORE = {
    magic: "\x00\x00",
    compressWorker: function compressWorker(compressionOptions) {
        return new GenericWorker("STORE compression");
    },
    uncompressWorker: function uncompressWorker() {
        return new GenericWorker("STORE decompression");
    }
};
exports.DEFLATE = __webpack_require__(454);

/***/ }),
/* 194 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// Note: adler32 takes 12% for level 0 and 2% for level 6.
// It isn't worth it to make additional optimizations as in original.
// Small size is preferable.

// (C) 1995-2013 Jean-loup Gailly and Mark Adler
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//   claim that you wrote the original software. If you use this software
//   in a product, an acknowledgment in the product documentation would be
//   appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
//   misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.

function adler32(adler, buf, len, pos) {
  var s1 = adler & 0xffff | 0,
      s2 = adler >>> 16 & 0xffff | 0,
      n = 0;

  while (len !== 0) {
    // Set limit ~ twice less than 5552, to keep
    // s2 in 31-bits, because we force signed ints.
    // in other case %= will fail.
    n = len > 2000 ? 2000 : len;
    len -= n;

    do {
      s1 = s1 + buf[pos++] | 0;
      s2 = s2 + s1 | 0;
    } while (--n);

    s1 %= 65521;
    s2 %= 65521;
  }

  return s1 | s2 << 16 | 0;
}

module.exports = adler32;

/***/ }),
/* 195 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// Note: we can't get significant speed boost here.
// So write code to minimize size - no pregenerated tables
// and array tools dependencies.

// (C) 1995-2013 Jean-loup Gailly and Mark Adler
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//   claim that you wrote the original software. If you use this software
//   in a product, an acknowledgment in the product documentation would be
//   appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
//   misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.

// Use ordinary array, since untyped makes no boost here

function makeTable() {
  var c,
      table = [];

  for (var n = 0; n < 256; n++) {
    c = n;
    for (var k = 0; k < 8; k++) {
      c = c & 1 ? 0xEDB88320 ^ c >>> 1 : c >>> 1;
    }
    table[n] = c;
  }

  return table;
}

// Create table on load. Just 255 signed longs. Not a problem.
var crcTable = makeTable();

function crc32(crc, buf, len, pos) {
  var t = crcTable,
      end = pos + len;

  crc ^= -1;

  for (var i = pos; i < end; i++) {
    crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 0xFF];
  }

  return crc ^ -1; // >>> 0;
}

module.exports = crc32;

/***/ }),
/* 196 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// String encode/decode helpers


var utils = __webpack_require__(42);

// Quick check if we can use fast array to bin string conversion
//
// - apply(Array) can fail on Android 2.2
// - apply(Uint8Array) can fail on iOS 5.1 Safari
//
var STR_APPLY_OK = true;
var STR_APPLY_UIA_OK = true;

try {
  String.fromCharCode.apply(null, [0]);
} catch (__) {
  STR_APPLY_OK = false;
}
try {
  String.fromCharCode.apply(null, new Uint8Array(1));
} catch (__) {
  STR_APPLY_UIA_OK = false;
}

// Table with utf8 lengths (calculated by first byte of sequence)
// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
// because max possible codepoint is 0x10ffff
var _utf8len = new utils.Buf8(256);
for (var q = 0; q < 256; q++) {
  _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1;
}
_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start


// convert string to array (typed, when possible)
exports.string2buf = function (str) {
  var buf,
      c,
      c2,
      m_pos,
      i,
      str_len = str.length,
      buf_len = 0;

  // count binary size
  for (m_pos = 0; m_pos < str_len; m_pos++) {
    c = str.charCodeAt(m_pos);
    if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {
      c2 = str.charCodeAt(m_pos + 1);
      if ((c2 & 0xfc00) === 0xdc00) {
        c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);
        m_pos++;
      }
    }
    buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
  }

  // allocate buffer
  buf = new utils.Buf8(buf_len);

  // convert
  for (i = 0, m_pos = 0; i < buf_len; m_pos++) {
    c = str.charCodeAt(m_pos);
    if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {
      c2 = str.charCodeAt(m_pos + 1);
      if ((c2 & 0xfc00) === 0xdc00) {
        c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);
        m_pos++;
      }
    }
    if (c < 0x80) {
      /* one byte */
      buf[i++] = c;
    } else if (c < 0x800) {
      /* two bytes */
      buf[i++] = 0xC0 | c >>> 6;
      buf[i++] = 0x80 | c & 0x3f;
    } else if (c < 0x10000) {
      /* three bytes */
      buf[i++] = 0xE0 | c >>> 12;
      buf[i++] = 0x80 | c >>> 6 & 0x3f;
      buf[i++] = 0x80 | c & 0x3f;
    } else {
      /* four bytes */
      buf[i++] = 0xf0 | c >>> 18;
      buf[i++] = 0x80 | c >>> 12 & 0x3f;
      buf[i++] = 0x80 | c >>> 6 & 0x3f;
      buf[i++] = 0x80 | c & 0x3f;
    }
  }

  return buf;
};

// Helper (used in 2 places)
function buf2binstring(buf, len) {
  // use fallback for big arrays to avoid stack overflow
  if (len < 65537) {
    if (buf.subarray && STR_APPLY_UIA_OK || !buf.subarray && STR_APPLY_OK) {
      return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
    }
  }

  var result = '';
  for (var i = 0; i < len; i++) {
    result += String.fromCharCode(buf[i]);
  }
  return result;
}

// Convert byte array to binary string
exports.buf2binstring = function (buf) {
  return buf2binstring(buf, buf.length);
};

// Convert binary string (typed, when possible)
exports.binstring2buf = function (str) {
  var buf = new utils.Buf8(str.length);
  for (var i = 0, len = buf.length; i < len; i++) {
    buf[i] = str.charCodeAt(i);
  }
  return buf;
};

// convert array to string
exports.buf2string = function (buf, max) {
  var i, out, c, c_len;
  var len = max || buf.length;

  // Reserve max possible length (2 words per char)
  // NB: by unknown reasons, Array is significantly faster for
  //     String.fromCharCode.apply than Uint16Array.
  var utf16buf = new Array(len * 2);

  for (out = 0, i = 0; i < len;) {
    c = buf[i++];
    // quick process ascii
    if (c < 0x80) {
      utf16buf[out++] = c;continue;
    }

    c_len = _utf8len[c];
    // skip 5 & 6 byte codes
    if (c_len > 4) {
      utf16buf[out++] = 0xfffd;i += c_len - 1;continue;
    }

    // apply mask on first byte
    c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;
    // join the rest
    while (c_len > 1 && i < len) {
      c = c << 6 | buf[i++] & 0x3f;
      c_len--;
    }

    // terminated by end of string?
    if (c_len > 1) {
      utf16buf[out++] = 0xfffd;continue;
    }

    if (c < 0x10000) {
      utf16buf[out++] = c;
    } else {
      c -= 0x10000;
      utf16buf[out++] = 0xd800 | c >> 10 & 0x3ff;
      utf16buf[out++] = 0xdc00 | c & 0x3ff;
    }
  }

  return buf2binstring(utf16buf, out);
};

// Calculate max possible position in utf8 buffer,
// that will not break sequence. If that's not possible
// - (very small limits) return max size as is.
//
// buf[] - utf8 bytes array
// max   - length limit (mandatory);
exports.utf8border = function (buf, max) {
  var pos;

  max = max || buf.length;
  if (max > buf.length) {
    max = buf.length;
  }

  // go back from last position, until start of sequence found
  pos = max - 1;
  while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) {
    pos--;
  }

  // Very small and broken sequence,
  // return max, because we should return something anyway.
  if (pos < 0) {
    return max;
  }

  // If we came to start of buffer - that means buffer is too small,
  // return max too.
  if (pos === 0) {
    return max;
  }

  return pos + _utf8len[buf[pos]] > max ? pos : max;
};

/***/ }),
/* 197 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// (C) 1995-2013 Jean-loup Gailly and Mark Adler
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//   claim that you wrote the original software. If you use this software
//   in a product, an acknowledgment in the product documentation would be
//   appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
//   misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.

function ZStream() {
  /* next input byte */
  this.input = null; // JS specific, because we have no pointers
  this.next_in = 0;
  /* number of bytes available at input */
  this.avail_in = 0;
  /* total number of input bytes read so far */
  this.total_in = 0;
  /* next output byte should be put there */
  this.output = null; // JS specific, because we have no pointers
  this.next_out = 0;
  /* remaining free space at output */
  this.avail_out = 0;
  /* total number of bytes output so far */
  this.total_out = 0;
  /* last error message, NULL if no error */
  this.msg = '' /*Z_NULL*/;
  /* not visible by applications */
  this.state = null;
  /* best guess about the data type: binary or text */
  this.data_type = 2 /*Z_UNKNOWN*/;
  /* adler32 value of the uncompressed data */
  this.adler = 0;
}

module.exports = ZStream;

/***/ }),
/* 198 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// (C) 1995-2013 Jean-loup Gailly and Mark Adler
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//   claim that you wrote the original software. If you use this software
//   in a product, an acknowledgment in the product documentation would be
//   appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
//   misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.

module.exports = {

  /* Allowed flush values; see deflate() and inflate() below for details */
  Z_NO_FLUSH: 0,
  Z_PARTIAL_FLUSH: 1,
  Z_SYNC_FLUSH: 2,
  Z_FULL_FLUSH: 3,
  Z_FINISH: 4,
  Z_BLOCK: 5,
  Z_TREES: 6,

  /* Return codes for the compression/decompression functions. Negative values
  * are errors, positive values are used for special but normal events.
  */
  Z_OK: 0,
  Z_STREAM_END: 1,
  Z_NEED_DICT: 2,
  Z_ERRNO: -1,
  Z_STREAM_ERROR: -2,
  Z_DATA_ERROR: -3,
  //Z_MEM_ERROR:     -4,
  Z_BUF_ERROR: -5,
  //Z_VERSION_ERROR: -6,

  /* compression levels */
  Z_NO_COMPRESSION: 0,
  Z_BEST_SPEED: 1,
  Z_BEST_COMPRESSION: 9,
  Z_DEFAULT_COMPRESSION: -1,

  Z_FILTERED: 1,
  Z_HUFFMAN_ONLY: 2,
  Z_RLE: 3,
  Z_FIXED: 4,
  Z_DEFAULT_STRATEGY: 0,

  /* Possible values of the data_type field (though see inflate()) */
  Z_BINARY: 0,
  Z_TEXT: 1,
  //Z_ASCII:                1, // = Z_TEXT (deprecated)
  Z_UNKNOWN: 2,

  /* The deflate compression method */
  Z_DEFLATED: 8
  //Z_NULL:                 null // Use -1 or null inline, depending on var type
};

/***/ }),
/* 199 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


exports.LOCAL_FILE_HEADER = "PK\x03\x04";
exports.CENTRAL_FILE_HEADER = "PK\x01\x02";
exports.CENTRAL_DIRECTORY_END = "PK\x05\x06";
exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07";
exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06";
exports.DATA_DESCRIPTOR = "PK\x07\x08";

/***/ }),
/* 200 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var utils = __webpack_require__(9);
var support = __webpack_require__(41);
var ArrayReader = __webpack_require__(201);
var StringReader = __webpack_require__(468);
var NodeBufferReader = __webpack_require__(469);
var Uint8ArrayReader = __webpack_require__(203);

/**
 * Create a reader adapted to the data.
 * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read.
 * @return {DataReader} the data reader.
 */
module.exports = function (data) {
    var type = utils.getTypeOf(data);
    utils.checkSupport(type);
    if (type === "string" && !support.uint8array) {
        return new StringReader(data);
    }
    if (type === "nodebuffer") {
        return new NodeBufferReader(data);
    }
    if (support.uint8array) {
        return new Uint8ArrayReader(utils.transformTo("uint8array", data));
    }
    return new ArrayReader(utils.transformTo("array", data));
};

/***/ }),
/* 201 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var DataReader = __webpack_require__(202);
var utils = __webpack_require__(9);

function ArrayReader(data) {
    DataReader.call(this, data);
    for (var i = 0; i < this.data.length; i++) {
        data[i] = data[i] & 0xFF;
    }
}
utils.inherits(ArrayReader, DataReader);
/**
 * @see DataReader.byteAt
 */
ArrayReader.prototype.byteAt = function (i) {
    return this.data[this.zero + i];
};
/**
 * @see DataReader.lastIndexOfSignature
 */
ArrayReader.prototype.lastIndexOfSignature = function (sig) {
    var sig0 = sig.charCodeAt(0),
        sig1 = sig.charCodeAt(1),
        sig2 = sig.charCodeAt(2),
        sig3 = sig.charCodeAt(3);
    for (var i = this.length - 4; i >= 0; --i) {
        if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) {
            return i - this.zero;
        }
    }

    return -1;
};
/**
 * @see DataReader.readAndCheckSignature
 */
ArrayReader.prototype.readAndCheckSignature = function (sig) {
    var sig0 = sig.charCodeAt(0),
        sig1 = sig.charCodeAt(1),
        sig2 = sig.charCodeAt(2),
        sig3 = sig.charCodeAt(3),
        data = this.readData(4);
    return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3];
};
/**
 * @see DataReader.readData
 */
ArrayReader.prototype.readData = function (size) {
    this.checkOffset(size);
    if (size === 0) {
        return [];
    }
    var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
    this.index += size;
    return result;
};
module.exports = ArrayReader;

/***/ }),
/* 202 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var utils = __webpack_require__(9);

function DataReader(data) {
    this.data = data; // type : see implementation
    this.length = data.length;
    this.index = 0;
    this.zero = 0;
}
DataReader.prototype = {
    /**
     * Check that the offset will not go too far.
     * @param {string} offset the additional offset to check.
     * @throws {Error} an Error if the offset is out of bounds.
     */
    checkOffset: function checkOffset(offset) {
        this.checkIndex(this.index + offset);
    },
    /**
     * Check that the specified index will not be too far.
     * @param {string} newIndex the index to check.
     * @throws {Error} an Error if the index is out of bounds.
     */
    checkIndex: function checkIndex(newIndex) {
        if (this.length < this.zero + newIndex || newIndex < 0) {
            throw new Error("End of data reached (data length = " + this.length + ", asked index = " + newIndex + "). Corrupted zip ?");
        }
    },
    /**
     * Change the index.
     * @param {number} newIndex The new index.
     * @throws {Error} if the new index is out of the data.
     */
    setIndex: function setIndex(newIndex) {
        this.checkIndex(newIndex);
        this.index = newIndex;
    },
    /**
     * Skip the next n bytes.
     * @param {number} n the number of bytes to skip.
     * @throws {Error} if the new index is out of the data.
     */
    skip: function skip(n) {
        this.setIndex(this.index + n);
    },
    /**
     * Get the byte at the specified index.
     * @param {number} i the index to use.
     * @return {number} a byte.
     */
    byteAt: function byteAt(i) {
        // see implementations
    },
    /**
     * Get the next number with a given byte size.
     * @param {number} size the number of bytes to read.
     * @return {number} the corresponding number.
     */
    readInt: function readInt(size) {
        var result = 0,
            i;
        this.checkOffset(size);
        for (i = this.index + size - 1; i >= this.index; i--) {
            result = (result << 8) + this.byteAt(i);
        }
        this.index += size;
        return result;
    },
    /**
     * Get the next string with a given byte size.
     * @param {number} size the number of bytes to read.
     * @return {string} the corresponding string.
     */
    readString: function readString(size) {
        return utils.transformTo("string", this.readData(size));
    },
    /**
     * Get raw data without conversion, <size> bytes.
     * @param {number} size the number of bytes to read.
     * @return {Object} the raw data, implementation specific.
     */
    readData: function readData(size) {
        // see implementations
    },
    /**
     * Find the last occurence of a zip signature (4 bytes).
     * @param {string} sig the signature to find.
     * @return {number} the index of the last occurence, -1 if not found.
     */
    lastIndexOfSignature: function lastIndexOfSignature(sig) {
        // see implementations
    },
    /**
     * Read the signature (4 bytes) at the current position and compare it with sig.
     * @param {string} sig the expected signature
     * @return {boolean} true if the signature matches, false otherwise.
     */
    readAndCheckSignature: function readAndCheckSignature(sig) {
        // see implementations
    },
    /**
     * Get the next date.
     * @return {Date} the date.
     */
    readDate: function readDate() {
        var dostime = this.readInt(4);
        return new Date(Date.UTC((dostime >> 25 & 0x7f) + 1980, // year
        (dostime >> 21 & 0x0f) - 1, // month
        dostime >> 16 & 0x1f, // day
        dostime >> 11 & 0x1f, // hour
        dostime >> 5 & 0x3f, // minute
        (dostime & 0x1f) << 1)); // second
    }
};
module.exports = DataReader;

/***/ }),
/* 203 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var ArrayReader = __webpack_require__(201);
var utils = __webpack_require__(9);

function Uint8ArrayReader(data) {
    ArrayReader.call(this, data);
}
utils.inherits(Uint8ArrayReader, ArrayReader);
/**
 * @see DataReader.readData
 */
Uint8ArrayReader.prototype.readData = function (size) {
    this.checkOffset(size);
    if (size === 0) {
        // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of [].
        return new Uint8Array(0);
    }
    var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size);
    this.index += size;
    return result;
};
module.exports = Uint8ArrayReader;

/***/ }),
/* 204 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var JSZipUtils = {};
// just use the responseText with xhr1, response with xhr2.
// The transformation doesn't throw away high-order byte (with responseText)
// because JSZip handles that case. If not used with JSZip, you may need to
// do it, see https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data
JSZipUtils._getBinaryFromXHR = function (xhr) {
    // for xhr.responseText, the 0xFF mask is applied by JSZip
    return xhr.response || xhr.responseText;
};

// taken from jQuery
function createStandardXHR() {
    try {
        return new window.XMLHttpRequest();
    } catch (e) {}
}

function createActiveXHR() {
    try {
        return new window.ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {}
}

// Create the request object
var createXHR = window.ActiveXObject ?
/* Microsoft failed to properly
 * implement the XMLHttpRequest in IE7 (can't request local files),
 * so we use the ActiveXObject when it is available
 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
 * we need a fallback.
 */
function () {
    return createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;

JSZipUtils.getBinaryContent = function (path, callback) {
    /*
     * Here is the tricky part : getting the data.
     * In firefox/chrome/opera/... setting the mimeType to 'text/plain; charset=x-user-defined'
     * is enough, the result is in the standard xhr.responseText.
     * cf https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Receiving_binary_data_in_older_browsers
     * In IE <= 9, we must use (the IE only) attribute responseBody
     * (for binary data, its content is different from responseText).
     * In IE 10, the 'charset=x-user-defined' trick doesn't work, only the
     * responseType will work :
     * http://msdn.microsoft.com/en-us/library/ie/hh673569%28v=vs.85%29.aspx#Binary_Object_upload_and_download
     *
     * I'd like to use jQuery to avoid this XHR madness, but it doesn't support
     * the responseType attribute : http://bugs.jquery.com/ticket/11461
     */
    try {

        var xhr = createXHR();

        xhr.open('GET', path, true);

        // recent browsers
        if ("responseType" in xhr) {
            xhr.responseType = "arraybuffer";
        }

        // older browser
        if (xhr.overrideMimeType) {
            xhr.overrideMimeType("text/plain; charset=x-user-defined");
        }

        xhr.onreadystatechange = function (evt) {
            var file, err;
            // use `xhr` and not `this`... thanks IE
            if (xhr.readyState === 4) {
                if (xhr.status === 200 || xhr.status === 0) {
                    file = null;
                    err = null;
                    try {
                        file = JSZipUtils._getBinaryFromXHR(xhr);
                    } catch (e) {
                        err = new Error(e);
                    }
                    callback(err, file);
                } else {
                    callback(new Error("Ajax error for " + path + " : " + this.status + " " + this.statusText), null);
                }
            }
        };

        xhr.send();
    } catch (e) {
        callback(new Error(e), null);
    }
};

// export
module.exports = JSZipUtils;

// enforcing Stuk's coding style
// vim: set shiftwidth=4 softtabstop=4:

/***/ }),
/* 205 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;

/*!
  * $script.js JS loader & dependency manager
  * https://github.com/ded/script.js
  * (c) Dustin Diaz 2014 | License MIT
  */

(function (name, definition) {
  if (typeof module != 'undefined' && module.exports) module.exports = definition();else if (true) !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition),
				__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
				(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
				__WEBPACK_AMD_DEFINE_FACTORY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else this[name] = definition();
})('$script', function () {
  var doc = document,
      head = doc.getElementsByTagName('head')[0],
      s = 'string',
      f = false,
      push = 'push',
      readyState = 'readyState',
      onreadystatechange = 'onreadystatechange',
      list = {},
      ids = {},
      delay = {},
      scripts = {},
      scriptpath,
      urlArgs;

  function every(ar, fn) {
    for (var i = 0, j = ar.length; i < j; ++i) {
      if (!fn(ar[i])) return f;
    }return 1;
  }
  function each(ar, fn) {
    every(ar, function (el) {
      return !fn(el);
    });
  }

  function $script(paths, idOrDone, optDone) {
    paths = paths[push] ? paths : [paths];
    var idOrDoneIsDone = idOrDone && idOrDone.call,
        done = idOrDoneIsDone ? idOrDone : optDone,
        id = idOrDoneIsDone ? paths.join('') : idOrDone,
        queue = paths.length;
    function loopFn(item) {
      return item.call ? item() : list[item];
    }
    function callback() {
      if (! --queue) {
        list[id] = 1;
        done && done();
        for (var dset in delay) {
          every(dset.split('|'), loopFn) && !each(delay[dset], loopFn) && (delay[dset] = []);
        }
      }
    }
    setTimeout(function () {
      each(paths, function loading(path, force) {
        if (path === null) return callback();

        if (!force && !/^https?:\/\//.test(path) && scriptpath) {
          path = path.indexOf('.js') === -1 ? scriptpath + path + '.js' : scriptpath + path;
        }

        if (scripts[path]) {
          if (id) ids[id] = 1;
          return scripts[path] == 2 ? callback() : setTimeout(function () {
            loading(path, true);
          }, 0);
        }

        scripts[path] = 1;
        if (id) ids[id] = 1;
        create(path, callback);
      });
    }, 0);
    return $script;
  }

  function create(path, fn) {
    var el = doc.createElement('script'),
        loaded;
    el.onload = el.onerror = el[onreadystatechange] = function () {
      if (el[readyState] && !/^c|loade/.test(el[readyState]) || loaded) return;
      el.onload = el[onreadystatechange] = null;
      loaded = 1;
      scripts[path] = 2;
      fn();
    };
    el.async = 1;
    el.src = urlArgs ? path + (path.indexOf('?') === -1 ? '?' : '&') + urlArgs : path;
    head.insertBefore(el, head.lastChild);
  }

  $script.get = create;

  $script.order = function (scripts, id, done) {
    (function callback(s) {
      s = scripts.shift();
      !scripts.length ? $script(s, id, done) : $script(s, callback);
    })();
  };

  $script.path = function (p) {
    scriptpath = p;
  };
  $script.urlArgs = function (str) {
    urlArgs = str;
  };
  $script.ready = function (deps, ready, req) {
    deps = deps[push] ? deps : [deps];
    var missing = [];
    !each(deps, function (dep) {
      list[dep] || missing[push](dep);
    }) && every(deps, function (dep) {
      return list[dep];
    }) ? ready() : !function (key) {
      delay[key] = delay[key] || [];
      delay[key][push](ready);
      req && req(missing);
    }(deps.join('|'));
    return $script;
  };

  $script.done = function (idOrDone) {
    $script([null], idOrDone);
  };

  return $script;
});

/***/ }),
/* 206 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.use = exports.t = exports.setDefaultNamespace = exports.on = exports.off = exports.loadResources = exports.loadNamespaces = exports.loadLanguages = exports.init = exports.getFixedT = exports.exists = exports.dir = exports.createInstance = exports.cloneInstance = exports.changeLanguage = undefined;

var _i18next = __webpack_require__(472);

var _i18next2 = _interopRequireDefault(_i18next);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.default = _i18next2.default;
var changeLanguage = exports.changeLanguage = _i18next2.default.changeLanguage.bind(_i18next2.default);
var cloneInstance = exports.cloneInstance = _i18next2.default.cloneInstance.bind(_i18next2.default);
var createInstance = exports.createInstance = _i18next2.default.createInstance.bind(_i18next2.default);
var dir = exports.dir = _i18next2.default.dir.bind(_i18next2.default);
var exists = exports.exists = _i18next2.default.exists.bind(_i18next2.default);
var getFixedT = exports.getFixedT = _i18next2.default.getFixedT.bind(_i18next2.default);
var init = exports.init = _i18next2.default.init.bind(_i18next2.default);
var loadLanguages = exports.loadLanguages = _i18next2.default.loadLanguages.bind(_i18next2.default);
var loadNamespaces = exports.loadNamespaces = _i18next2.default.loadNamespaces.bind(_i18next2.default);
var loadResources = exports.loadResources = _i18next2.default.loadResources.bind(_i18next2.default);
var off = exports.off = _i18next2.default.off.bind(_i18next2.default);
var on = exports.on = _i18next2.default.on.bind(_i18next2.default);
var setDefaultNamespace = exports.setDefaultNamespace = _i18next2.default.setDefaultNamespace.bind(_i18next2.default);
var t = exports.t = _i18next2.default.t.bind(_i18next2.default);
var use = exports.use = _i18next2.default.use.bind(_i18next2.default);

/***/ }),
/* 207 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = {

  processors: {},

  addPostProcessor: function addPostProcessor(module) {
    this.processors[module.name] = module;
  },
  handle: function handle(processors, value, key, options, translator) {
    var _this = this;

    processors.forEach(function (processor) {
      if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator);
    });

    return value;
  }
};

/***/ }),
/* 208 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(setImmediate) {

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

//  Import support https://stackoverflow.com/questions/13673346/supporting-both-commonjs-and-amd
(function (name, definition) {
  if (true) {
    module.exports = definition();
  } else if (typeof define === "function" && _typeof(define.amd) === "object") {
    define(definition);
  } else {
    this[name] = definition();
  }
})("clipboard", function () {
  if (typeof document === 'undefined' || !document.addEventListener) {
    return null;
  }

  var clipboard = {};

  clipboard.copy = function () {
    var _intercept = false;
    var _data = null; // Map from data type (e.g. "text/html") to value.
    var _bogusSelection = false;

    function cleanup() {
      _intercept = false;
      _data = null;
      if (_bogusSelection) {
        window.getSelection().removeAllRanges();
      }
      _bogusSelection = false;
    }

    document.addEventListener("copy", function (e) {
      if (_intercept) {
        for (var key in _data) {
          e.clipboardData.setData(key, _data[key]);
        }
        e.preventDefault();
      }
    });

    // Workaround for Safari: https://bugs.webkit.org/show_bug.cgi?id=156529
    function bogusSelect() {
      var sel = document.getSelection();
      // If "nothing" is selected...
      if (!document.queryCommandEnabled("copy") && sel.isCollapsed) {
        // ... temporarily select the entire body.
        //
        // We select the entire body because:
        // - it's guaranteed to exist,
        // - it works (unlike, say, document.head, or phantom element that is
        //   not inserted into the DOM),
        // - it doesn't seem to flicker (due to the synchronous copy event), and
        // - it avoids modifying the DOM (can trigger mutation observers).
        //
        // Because we can't do proper feature detection (we already checked
        // document.queryCommandEnabled("copy") , which actually gives a false
        // negative for Blink when nothing is selected) and UA sniffing is not
        // reliable (a lot of UA strings contain "Safari"), this will also
        // happen for some browsers other than Safari. :-()
        var range = document.createRange();
        range.selectNodeContents(document.body);
        sel.removeAllRanges();
        sel.addRange(range);
        _bogusSelection = true;
      }
    };

    return function (data) {
      return new Promise(function (resolve, reject) {
        _intercept = true;
        if (typeof data === "string") {
          _data = { "text/plain": data };
        } else if (data instanceof Node) {
          _data = { "text/html": new XMLSerializer().serializeToString(data) };
        } else if (data instanceof Object) {
          _data = data;
        } else {
          reject("Invalid data type. Must be string, DOM node, or an object mapping MIME types to strings.");
        }

        function triggerCopy(tryBogusSelect) {
          try {
            if (document.execCommand("copy")) {
              // document.execCommand is synchronous: http://www.w3.org/TR/2015/WD-clipboard-apis-20150421/#integration-with-rich-text-editing-apis
              // So we can call resolve() back here.
              cleanup();
              resolve();
            } else {
              if (!tryBogusSelect) {
                bogusSelect();
                triggerCopy(true);
              } else {
                cleanup();
                throw new Error("Unable to copy. Perhaps it's not available in your browser?");
              }
            }
          } catch (e) {
            cleanup();
            reject(e);
          }
        }
        triggerCopy(false);
      });
    };
  }();

  clipboard.paste = function () {
    var _intercept = false;
    var _resolve;
    var _dataType;

    document.addEventListener("paste", function (e) {
      if (_intercept) {
        _intercept = false;
        e.preventDefault();
        var resolve = _resolve;
        _resolve = null;
        resolve(e.clipboardData.getData(_dataType));
      }
    });

    return function (dataType) {
      return new Promise(function (resolve, reject) {
        _intercept = true;
        _resolve = resolve;
        _dataType = dataType || "text/plain";
        try {
          if (!document.execCommand("paste")) {
            _intercept = false;
            reject(new Error("Unable to paste. Pasting only works in Internet Explorer at the moment."));
          }
        } catch (e) {
          _intercept = false;
          reject(new Error(e));
        }
      });
    };
  }();

  // Handle IE behaviour.
  if (typeof ClipboardEvent === "undefined" && typeof window.clipboardData !== "undefined" && typeof window.clipboardData.setData !== "undefined") {

    /*! promise-polyfill 2.0.1 */
    (function (a) {
      function b(a, b) {
        return function () {
          a.apply(b, arguments);
        };
      }function c(a) {
        if ("object" != _typeof(this)) throw new TypeError("Promises must be constructed via new");if ("function" != typeof a) throw new TypeError("not a function");this._state = null, this._value = null, this._deferreds = [], i(a, b(e, this), b(f, this));
      }function d(a) {
        var b = this;return null === this._state ? void this._deferreds.push(a) : void j(function () {
          var c = b._state ? a.onFulfilled : a.onRejected;if (null === c) return void (b._state ? a.resolve : a.reject)(b._value);var d;try {
            d = c(b._value);
          } catch (e) {
            return void a.reject(e);
          }a.resolve(d);
        });
      }function e(a) {
        try {
          if (a === this) throw new TypeError("A promise cannot be resolved with itself.");if (a && ("object" == (typeof a === "undefined" ? "undefined" : _typeof(a)) || "function" == typeof a)) {
            var c = a.then;if ("function" == typeof c) return void i(b(c, a), b(e, this), b(f, this));
          }this._state = !0, this._value = a, g.call(this);
        } catch (d) {
          f.call(this, d);
        }
      }function f(a) {
        this._state = !1, this._value = a, g.call(this);
      }function g() {
        for (var a = 0, b = this._deferreds.length; b > a; a++) {
          d.call(this, this._deferreds[a]);
        }this._deferreds = null;
      }function h(a, b, c, d) {
        this.onFulfilled = "function" == typeof a ? a : null, this.onRejected = "function" == typeof b ? b : null, this.resolve = c, this.reject = d;
      }function i(a, b, c) {
        var d = !1;try {
          a(function (a) {
            d || (d = !0, b(a));
          }, function (a) {
            d || (d = !0, c(a));
          });
        } catch (e) {
          if (d) return;d = !0, c(e);
        }
      }var j = c.immediateFn || "function" == typeof setImmediate && setImmediate || function (a) {
        setTimeout(a, 1);
      },
          k = Array.isArray || function (a) {
        return "[object Array]" === Object.prototype.toString.call(a);
      };c.prototype["catch"] = function (a) {
        return this.then(null, a);
      }, c.prototype.then = function (a, b) {
        var e = this;return new c(function (c, f) {
          d.call(e, new h(a, b, c, f));
        });
      }, c.all = function () {
        var a = Array.prototype.slice.call(1 === arguments.length && k(arguments[0]) ? arguments[0] : arguments);return new c(function (b, c) {
          function d(f, g) {
            try {
              if (g && ("object" == (typeof g === "undefined" ? "undefined" : _typeof(g)) || "function" == typeof g)) {
                var h = g.then;if ("function" == typeof h) return void h.call(g, function (a) {
                  d(f, a);
                }, c);
              }a[f] = g, 0 === --e && b(a);
            } catch (i) {
              c(i);
            }
          }if (0 === a.length) return b([]);for (var e = a.length, f = 0; f < a.length; f++) {
            d(f, a[f]);
          }
        });
      }, c.resolve = function (a) {
        return a && "object" == (typeof a === "undefined" ? "undefined" : _typeof(a)) && a.constructor === c ? a : new c(function (b) {
          b(a);
        });
      }, c.reject = function (a) {
        return new c(function (b, c) {
          c(a);
        });
      }, c.race = function (a) {
        return new c(function (b, c) {
          for (var d = 0, e = a.length; e > d; d++) {
            a[d].then(b, c);
          }
        });
      }, "undefined" != typeof module && module.exports ? module.exports = c : a.Promise || (a.Promise = c);
    })(this);

    clipboard.copy = function (data) {
      return new Promise(function (resolve, reject) {
        // IE supports string and URL types: https://msdn.microsoft.com/en-us/library/ms536744(v=vs.85).aspx
        // We only support the string type for now.
        if (typeof data !== "string" && !("text/plain" in data)) {
          throw new Error("You must provide a text/plain type.");
        }

        var strData = typeof data === "string" ? data : data["text/plain"];
        var copySucceeded = window.clipboardData.setData("Text", strData);
        if (copySucceeded) {
          resolve();
        } else {
          reject(new Error("Copying was rejected."));
        }
      });
    };

    clipboard.paste = function () {
      return new Promise(function (resolve, reject) {
        var strData = window.clipboardData.getData("Text");
        if (strData) {
          resolve(strData);
        } else {
          // The user rejected the paste request.
          reject(new Error("Pasting was rejected."));
        }
      });
    };
  }

  return clipboard;
});
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(180).setImmediate))

/***/ }),
/* 209 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_RESULT__;

/* Web Font Loader v1.6.28 - (c) Adobe Systems, Google. License: Apache 2.0 */(function () {
  function aa(a, b, c) {
    return a.call.apply(a.bind, arguments);
  }function ba(a, b, c) {
    if (!a) throw Error();if (2 < arguments.length) {
      var d = Array.prototype.slice.call(arguments, 2);return function () {
        var c = Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c, d);return a.apply(b, c);
      };
    }return function () {
      return a.apply(b, arguments);
    };
  }function p(a, b, c) {
    p = Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? aa : ba;return p.apply(null, arguments);
  }var q = Date.now || function () {
    return +new Date();
  };function ca(a, b) {
    this.a = a;this.o = b || a;this.c = this.o.document;
  }var da = !!window.FontFace;function t(a, b, c, d) {
    b = a.c.createElement(b);if (c) for (var e in c) {
      c.hasOwnProperty(e) && ("style" == e ? b.style.cssText = c[e] : b.setAttribute(e, c[e]));
    }d && b.appendChild(a.c.createTextNode(d));return b;
  }function u(a, b, c) {
    a = a.c.getElementsByTagName(b)[0];a || (a = document.documentElement);a.insertBefore(c, a.lastChild);
  }function v(a) {
    a.parentNode && a.parentNode.removeChild(a);
  }
  function w(a, b, c) {
    b = b || [];c = c || [];for (var d = a.className.split(/\s+/), e = 0; e < b.length; e += 1) {
      for (var f = !1, g = 0; g < d.length; g += 1) {
        if (b[e] === d[g]) {
          f = !0;break;
        }
      }f || d.push(b[e]);
    }b = [];for (e = 0; e < d.length; e += 1) {
      f = !1;for (g = 0; g < c.length; g += 1) {
        if (d[e] === c[g]) {
          f = !0;break;
        }
      }f || b.push(d[e]);
    }a.className = b.join(" ").replace(/\s+/g, " ").replace(/^\s+|\s+$/, "");
  }function y(a, b) {
    for (var c = a.className.split(/\s+/), d = 0, e = c.length; d < e; d++) {
      if (c[d] == b) return !0;
    }return !1;
  }
  function ea(a) {
    return a.o.location.hostname || a.a.location.hostname;
  }function z(a, b, c) {
    function d() {
      m && e && f && (m(g), m = null);
    }b = t(a, "link", { rel: "stylesheet", href: b, media: "all" });var e = !1,
        f = !0,
        g = null,
        m = c || null;da ? (b.onload = function () {
      e = !0;d();
    }, b.onerror = function () {
      e = !0;g = Error("Stylesheet failed to load");d();
    }) : setTimeout(function () {
      e = !0;d();
    }, 0);u(a, "head", b);
  }
  function A(a, b, c, d) {
    var e = a.c.getElementsByTagName("head")[0];if (e) {
      var f = t(a, "script", { src: b }),
          g = !1;f.onload = f.onreadystatechange = function () {
        g || this.readyState && "loaded" != this.readyState && "complete" != this.readyState || (g = !0, c && c(null), f.onload = f.onreadystatechange = null, "HEAD" == f.parentNode.tagName && e.removeChild(f));
      };e.appendChild(f);setTimeout(function () {
        g || (g = !0, c && c(Error("Script load timeout")));
      }, d || 5E3);return f;
    }return null;
  };function B() {
    this.a = 0;this.c = null;
  }function C(a) {
    a.a++;return function () {
      a.a--;D(a);
    };
  }function E(a, b) {
    a.c = b;D(a);
  }function D(a) {
    0 == a.a && a.c && (a.c(), a.c = null);
  };function F(a) {
    this.a = a || "-";
  }F.prototype.c = function (a) {
    for (var b = [], c = 0; c < arguments.length; c++) {
      b.push(arguments[c].replace(/[\W_]+/g, "").toLowerCase());
    }return b.join(this.a);
  };function G(a, b) {
    this.c = a;this.f = 4;this.a = "n";var c = (b || "n4").match(/^([nio])([1-9])$/i);c && (this.a = c[1], this.f = parseInt(c[2], 10));
  }function fa(a) {
    return H(a) + " " + (a.f + "00") + " 300px " + I(a.c);
  }function I(a) {
    var b = [];a = a.split(/,\s*/);for (var c = 0; c < a.length; c++) {
      var d = a[c].replace(/['"]/g, "");-1 != d.indexOf(" ") || /^\d/.test(d) ? b.push("'" + d + "'") : b.push(d);
    }return b.join(",");
  }function J(a) {
    return a.a + a.f;
  }function H(a) {
    var b = "normal";"o" === a.a ? b = "oblique" : "i" === a.a && (b = "italic");return b;
  }
  function ga(a) {
    var b = 4,
        c = "n",
        d = null;a && ((d = a.match(/(normal|oblique|italic)/i)) && d[1] && (c = d[1].substr(0, 1).toLowerCase()), (d = a.match(/([1-9]00|normal|bold)/i)) && d[1] && (/bold/i.test(d[1]) ? b = 7 : /[1-9]00/.test(d[1]) && (b = parseInt(d[1].substr(0, 1), 10))));return c + b;
  };function ha(a, b) {
    this.c = a;this.f = a.o.document.documentElement;this.h = b;this.a = new F("-");this.j = !1 !== b.events;this.g = !1 !== b.classes;
  }function ia(a) {
    a.g && w(a.f, [a.a.c("wf", "loading")]);K(a, "loading");
  }function L(a) {
    if (a.g) {
      var b = y(a.f, a.a.c("wf", "active")),
          c = [],
          d = [a.a.c("wf", "loading")];b || c.push(a.a.c("wf", "inactive"));w(a.f, c, d);
    }K(a, "inactive");
  }function K(a, b, c) {
    if (a.j && a.h[b]) if (c) a.h[b](c.c, J(c));else a.h[b]();
  };function ja() {
    this.c = {};
  }function ka(a, b, c) {
    var d = [],
        e;for (e in b) {
      if (b.hasOwnProperty(e)) {
        var f = a.c[e];f && d.push(f(b[e], c));
      }
    }return d;
  };function M(a, b) {
    this.c = a;this.f = b;this.a = t(this.c, "span", { "aria-hidden": "true" }, this.f);
  }function N(a) {
    u(a.c, "body", a.a);
  }function O(a) {
    return "display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:" + I(a.c) + ";" + ("font-style:" + H(a) + ";font-weight:" + (a.f + "00") + ";");
  };function P(a, b, c, d, e, f) {
    this.g = a;this.j = b;this.a = d;this.c = c;this.f = e || 3E3;this.h = f || void 0;
  }P.prototype.start = function () {
    var a = this.c.o.document,
        b = this,
        c = q(),
        d = new Promise(function (d, e) {
      function f() {
        q() - c >= b.f ? e() : a.fonts.load(fa(b.a), b.h).then(function (a) {
          1 <= a.length ? d() : setTimeout(f, 25);
        }, function () {
          e();
        });
      }f();
    }),
        e = null,
        f = new Promise(function (a, d) {
      e = setTimeout(d, b.f);
    });Promise.race([f, d]).then(function () {
      e && (clearTimeout(e), e = null);b.g(b.a);
    }, function () {
      b.j(b.a);
    });
  };function Q(a, b, c, d, e, f, g) {
    this.v = a;this.B = b;this.c = c;this.a = d;this.s = g || "BESbswy";this.f = {};this.w = e || 3E3;this.u = f || null;this.m = this.j = this.h = this.g = null;this.g = new M(this.c, this.s);this.h = new M(this.c, this.s);this.j = new M(this.c, this.s);this.m = new M(this.c, this.s);a = new G(this.a.c + ",serif", J(this.a));a = O(a);this.g.a.style.cssText = a;a = new G(this.a.c + ",sans-serif", J(this.a));a = O(a);this.h.a.style.cssText = a;a = new G("serif", J(this.a));a = O(a);this.j.a.style.cssText = a;a = new G("sans-serif", J(this.a));a = O(a);this.m.a.style.cssText = a;N(this.g);N(this.h);N(this.j);N(this.m);
  }var R = { D: "serif", C: "sans-serif" },
      S = null;function T() {
    if (null === S) {
      var a = /AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);S = !!a && (536 > parseInt(a[1], 10) || 536 === parseInt(a[1], 10) && 11 >= parseInt(a[2], 10));
    }return S;
  }Q.prototype.start = function () {
    this.f.serif = this.j.a.offsetWidth;this.f["sans-serif"] = this.m.a.offsetWidth;this.A = q();U(this);
  };
  function la(a, b, c) {
    for (var d in R) {
      if (R.hasOwnProperty(d) && b === a.f[R[d]] && c === a.f[R[d]]) return !0;
    }return !1;
  }function U(a) {
    var b = a.g.a.offsetWidth,
        c = a.h.a.offsetWidth,
        d;(d = b === a.f.serif && c === a.f["sans-serif"]) || (d = T() && la(a, b, c));d ? q() - a.A >= a.w ? T() && la(a, b, c) && (null === a.u || a.u.hasOwnProperty(a.a.c)) ? V(a, a.v) : V(a, a.B) : ma(a) : V(a, a.v);
  }function ma(a) {
    setTimeout(p(function () {
      U(this);
    }, a), 50);
  }function V(a, b) {
    setTimeout(p(function () {
      v(this.g.a);v(this.h.a);v(this.j.a);v(this.m.a);b(this.a);
    }, a), 0);
  };function W(a, b, c) {
    this.c = a;this.a = b;this.f = 0;this.m = this.j = !1;this.s = c;
  }var X = null;W.prototype.g = function (a) {
    var b = this.a;b.g && w(b.f, [b.a.c("wf", a.c, J(a).toString(), "active")], [b.a.c("wf", a.c, J(a).toString(), "loading"), b.a.c("wf", a.c, J(a).toString(), "inactive")]);K(b, "fontactive", a);this.m = !0;na(this);
  };
  W.prototype.h = function (a) {
    var b = this.a;if (b.g) {
      var c = y(b.f, b.a.c("wf", a.c, J(a).toString(), "active")),
          d = [],
          e = [b.a.c("wf", a.c, J(a).toString(), "loading")];c || d.push(b.a.c("wf", a.c, J(a).toString(), "inactive"));w(b.f, d, e);
    }K(b, "fontinactive", a);na(this);
  };function na(a) {
    0 == --a.f && a.j && (a.m ? (a = a.a, a.g && w(a.f, [a.a.c("wf", "active")], [a.a.c("wf", "loading"), a.a.c("wf", "inactive")]), K(a, "active")) : L(a.a));
  };function oa(a) {
    this.j = a;this.a = new ja();this.h = 0;this.f = this.g = !0;
  }oa.prototype.load = function (a) {
    this.c = new ca(this.j, a.context || this.j);this.g = !1 !== a.events;this.f = !1 !== a.classes;pa(this, new ha(this.c, a), a);
  };
  function qa(a, b, c, d, e) {
    var f = 0 == --a.h;(a.f || a.g) && setTimeout(function () {
      var a = e || null,
          m = d || null || {};if (0 === c.length && f) L(b.a);else {
        b.f += c.length;f && (b.j = f);var h,
            l = [];for (h = 0; h < c.length; h++) {
          var k = c[h],
              n = m[k.c],
              r = b.a,
              x = k;r.g && w(r.f, [r.a.c("wf", x.c, J(x).toString(), "loading")]);K(r, "fontloading", x);r = null;if (null === X) if (window.FontFace) {
            var x = /Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent),
                xa = /OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent) && /Apple/.exec(window.navigator.vendor);
            X = x ? 42 < parseInt(x[1], 10) : xa ? !1 : !0;
          } else X = !1;X ? r = new P(p(b.g, b), p(b.h, b), b.c, k, b.s, n) : r = new Q(p(b.g, b), p(b.h, b), b.c, k, b.s, a, n);l.push(r);
        }for (h = 0; h < l.length; h++) {
          l[h].start();
        }
      }
    }, 0);
  }function pa(a, b, c) {
    var d = [],
        e = c.timeout;ia(b);var d = ka(a.a, c, a.c),
        f = new W(a.c, b, e);a.h = d.length;b = 0;for (c = d.length; b < c; b++) {
      d[b].load(function (b, d, c) {
        qa(a, f, b, d, c);
      });
    }
  };function ra(a, b) {
    this.c = a;this.a = b;
  }
  ra.prototype.load = function (a) {
    function b() {
      if (f["__mti_fntLst" + d]) {
        var c = f["__mti_fntLst" + d](),
            e = [],
            h;if (c) for (var l = 0; l < c.length; l++) {
          var k = c[l].fontfamily;void 0 != c[l].fontStyle && void 0 != c[l].fontWeight ? (h = c[l].fontStyle + c[l].fontWeight, e.push(new G(k, h))) : e.push(new G(k));
        }a(e);
      } else setTimeout(function () {
        b();
      }, 50);
    }var c = this,
        d = c.a.projectId,
        e = c.a.version;if (d) {
      var f = c.c.o;A(this.c, (c.a.api || "https://fast.fonts.net/jsapi") + "/" + d + ".js" + (e ? "?v=" + e : ""), function (e) {
        e ? a([]) : (f["__MonotypeConfiguration__" + d] = function () {
          return c.a;
        }, b());
      }).id = "__MonotypeAPIScript__" + d;
    } else a([]);
  };function sa(a, b) {
    this.c = a;this.a = b;
  }sa.prototype.load = function (a) {
    var b,
        c,
        d = this.a.urls || [],
        e = this.a.families || [],
        f = this.a.testStrings || {},
        g = new B();b = 0;for (c = d.length; b < c; b++) {
      z(this.c, d[b], C(g));
    }var m = [];b = 0;for (c = e.length; b < c; b++) {
      if (d = e[b].split(":"), d[1]) for (var h = d[1].split(","), l = 0; l < h.length; l += 1) {
        m.push(new G(d[0], h[l]));
      } else m.push(new G(d[0]));
    }E(g, function () {
      a(m, f);
    });
  };function ta(a, b) {
    a ? this.c = a : this.c = ua;this.a = [];this.f = [];this.g = b || "";
  }var ua = "https://fonts.googleapis.com/css";function va(a, b) {
    for (var c = b.length, d = 0; d < c; d++) {
      var e = b[d].split(":");3 == e.length && a.f.push(e.pop());var f = "";2 == e.length && "" != e[1] && (f = ":");a.a.push(e.join(f));
    }
  }
  function wa(a) {
    if (0 == a.a.length) throw Error("No fonts to load!");if (-1 != a.c.indexOf("kit=")) return a.c;for (var b = a.a.length, c = [], d = 0; d < b; d++) {
      c.push(a.a[d].replace(/ /g, "+"));
    }b = a.c + "?family=" + c.join("%7C");0 < a.f.length && (b += "&subset=" + a.f.join(","));0 < a.g.length && (b += "&text=" + encodeURIComponent(a.g));return b;
  };function ya(a) {
    this.f = a;this.a = [];this.c = {};
  }
  var za = { latin: "BESbswy", "latin-ext": "\xE7\xF6\xFC\u011F\u015F", cyrillic: "\u0439\u044F\u0416", greek: "\u03B1\u03B2\u03A3", khmer: "\u1780\u1781\u1782", Hanuman: "\u1780\u1781\u1782" },
      Aa = { thin: "1", extralight: "2", "extra-light": "2", ultralight: "2", "ultra-light": "2", light: "3", regular: "4", book: "4", medium: "5", "semi-bold": "6", semibold: "6", "demi-bold": "6", demibold: "6", bold: "7", "extra-bold": "8", extrabold: "8", "ultra-bold": "8", ultrabold: "8", black: "9", heavy: "9", l: "3", r: "4", b: "7" },
      Ba = { i: "i", italic: "i", n: "n", normal: "n" },
      Ca = /^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;
  function Da(a) {
    for (var b = a.f.length, c = 0; c < b; c++) {
      var d = a.f[c].split(":"),
          e = d[0].replace(/\+/g, " "),
          f = ["n4"];if (2 <= d.length) {
        var g;var m = d[1];g = [];if (m) for (var m = m.split(","), h = m.length, l = 0; l < h; l++) {
          var k;k = m[l];if (k.match(/^[\w-]+$/)) {
            var n = Ca.exec(k.toLowerCase());if (null == n) k = "";else {
              k = n[2];k = null == k || "" == k ? "n" : Ba[k];n = n[1];if (null == n || "" == n) n = "4";else var r = Aa[n],
                  n = r ? r : isNaN(n) ? "4" : n.substr(0, 1);k = [k, n].join("");
            }
          } else k = "";k && g.push(k);
        }0 < g.length && (f = g);3 == d.length && (d = d[2], g = [], d = d ? d.split(",") : g, 0 < d.length && (d = za[d[0]]) && (a.c[e] = d));
      }a.c[e] || (d = za[e]) && (a.c[e] = d);for (d = 0; d < f.length; d += 1) {
        a.a.push(new G(e, f[d]));
      }
    }
  };function Ea(a, b) {
    this.c = a;this.a = b;
  }var Fa = { Arimo: !0, Cousine: !0, Tinos: !0 };Ea.prototype.load = function (a) {
    var b = new B(),
        c = this.c,
        d = new ta(this.a.api, this.a.text),
        e = this.a.families;va(d, e);var f = new ya(e);Da(f);z(c, wa(d), C(b));E(b, function () {
      a(f.a, f.c, Fa);
    });
  };function Ga(a, b) {
    this.c = a;this.a = b;
  }Ga.prototype.load = function (a) {
    var b = this.a.id,
        c = this.c.o;b ? A(this.c, (this.a.api || "https://use.typekit.net") + "/" + b + ".js", function (b) {
      if (b) a([]);else if (c.Typekit && c.Typekit.config && c.Typekit.config.fn) {
        b = c.Typekit.config.fn;for (var e = [], f = 0; f < b.length; f += 2) {
          for (var g = b[f], m = b[f + 1], h = 0; h < m.length; h++) {
            e.push(new G(g, m[h]));
          }
        }try {
          c.Typekit.load({ events: !1, classes: !1, async: !0 });
        } catch (l) {}a(e);
      }
    }, 2E3) : a([]);
  };function Ha(a, b) {
    this.c = a;this.f = b;this.a = [];
  }Ha.prototype.load = function (a) {
    var b = this.f.id,
        c = this.c.o,
        d = this;b ? (c.__webfontfontdeckmodule__ || (c.__webfontfontdeckmodule__ = {}), c.__webfontfontdeckmodule__[b] = function (b, c) {
      for (var g = 0, m = c.fonts.length; g < m; ++g) {
        var h = c.fonts[g];d.a.push(new G(h.name, ga("font-weight:" + h.weight + ";font-style:" + h.style)));
      }a(d.a);
    }, A(this.c, (this.f.api || "https://f.fontdeck.com/s/css/js/") + ea(this.c) + "/" + b + ".js", function (b) {
      b && a([]);
    })) : a([]);
  };var Y = new oa(window);Y.a.c.custom = function (a, b) {
    return new sa(b, a);
  };Y.a.c.fontdeck = function (a, b) {
    return new Ha(b, a);
  };Y.a.c.monotype = function (a, b) {
    return new ra(b, a);
  };Y.a.c.typekit = function (a, b) {
    return new Ga(b, a);
  };Y.a.c.google = function (a, b) {
    return new Ea(b, a);
  };var Z = { load: p(Y.load, Y) }; true ? !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
    return Z;
  }).call(exports, __webpack_require__, exports, module),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : "undefined" !== typeof module && module.exports ? module.exports = Z : (window.WebFont = Z, window.WebFontConfig && Y.load(window.WebFontConfig));
})();

/***/ }),
/* 210 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : media/ActiveMediaPlayer.js
 *  Created : 28/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(483)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, AudioBuffer) {

  /**
   * This kind of object encapsulates a realized {@link MediaContent} and provides methods to start,
   * stop, pause and record different types of media (audio, video, MIDI, voice recording...)
   * @exports ActiveMediaPlayer
   * @class
   */
  var ActiveMediaPlayer = function () {
    /**
     * ActiveMediaPlayer constructor
     * @param {MediaContent} mc - - The content used by this player
     * @param {MediaBag} mb - The project's MediaBag
     * @param {PlayStation} ps - An object implementing the
     * {@link http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html PlayStation} interface,
     * usually a {@link JClicPlayer}.
     */
    function ActiveMediaPlayer(mc, mb, ps) {
      _classCallCheck(this, ActiveMediaPlayer);

      this.mc = mc;
      this.ps = ps;
      switch (mc.mediaType) {
        case 'RECORD_AUDIO':
          if (ActiveMediaPlayer.AUDIO_BUFFERS) {
            this.clearAudioBuffer(mc.recBuffer);
            ActiveMediaPlayer.AUDIO_BUFFERS[mc.recBuffer] = new AudioBuffer(mc.length);
          }
        /* falls through */
        case 'PLAY_RECORDED_AUDIO':
          this.useAudioBuffer = true;
          break;
        case 'PLAY_AUDIO':
        case 'PLAY_VIDEO':
          this.mbe = mb.getElement(mc.mediaFileName, true);
          break;
        case 'PLAY_MIDI':
          // TODO: Implement MIDI playing
          break;
        default:
          break;
      }
    }

    /**
     * Generates the objects that will play media
     */


    _createClass(ActiveMediaPlayer, [{
      key: "realize",
      value: function realize() {
        var _this = this;

        if (this.mbe) {
          this.mbe.build(function (mbe) {
            if (mbe.data && mbe.data.pause && !mbe.data.paused && !mbe.data.ended && mbe.data.currentTime) mbe.data.pause();
            if ((mbe.type === 'video' || mbe.type === 'anim') && mbe.data) {
              _this.$visualComponent = $(mbe.data);
              _this.$visualComponent.css('z-index', 20);
            }
          });
        }
      }

      /**
       * Plays the media, realizing it if needed.
       * @param {ActiveBox=} _setBx - The active box where this media will be placed (when video)
       */

    }, {
      key: "playNow",
      value: function playNow(_setBx) {
        var _this2 = this;

        // TODO: Remove unused param "_setBx"
        if (this.useAudioBuffer) {
          if (ActiveMediaPlayer.AUDIO_BUFFERS) {
            var buffer = ActiveMediaPlayer.AUDIO_BUFFERS[this.mc.recBuffer];
            if (buffer) {
              if (this.mc.mediaType === 'RECORD_AUDIO') {
                buffer.record();
              } else {
                buffer.play();
              }
            }
          }
        } else if (this.mbe) {
          this.mbe.build(function () {
            if (_this2.mbe.data) {
              var armed = false;
              var $player = $(_this2.mbe.data);
              // Clear previous event handlers
              $player.off();
              // If there is a time fragment specified, prepare to stop when the `to` position is reached
              if (_this2.mc.to > 0) {
                $player.on('timeupdate', function () {
                  if (armed && _this2.mbe.data.currentTime >= _this2.mc.to / 1000) {
                    $player.off('timeupdate');
                    _this2.mbe.data.pause();
                  }
                });
              }
              // Launch the media despite of its readyState
              armed = true;
              if (!_this2.mbe.data.paused && !_this2.mbe.data.ended && _this2.mbe.data.currentTime) _this2.mbe.data.pause();
              // Seek the media position
              _this2.mbe.data.currentTime = _this2.mc.from > 0 ? _this2.mc.from / 1000 : 0;
              _this2.mbe.data.play();
            }
          });
        }
      }

      /**
       * Plays the media when available, without blocking the current thread.
       * @param {ActiveBox=} setBx - The active box where this media will be placed (when video)
       */

    }, {
      key: "play",
      value: function play(setBx) {
        this.stopAllAudioBuffers();
        this.playNow(setBx);
      }

      /**
       * Stops the media playing
       */

    }, {
      key: "stop",
      value: function stop() {
        if (this.useAudioBuffer) this.stopAudioBuffer(this.mc.recBuffer);else if (this.mbe && this.mbe.data && this.mbe.data.pause && !this.mbe.data.paused && !this.mbe.data.ended && this.mbe.data.currentTime) this.mbe.data.pause();
      }

      /**
       * Frees all resources used by this player
       */

    }, {
      key: "clear",
      value: function clear() {
        this.stop();
        if (this.useAudioBuffer) this.clearAudioBuffer(this.mc.recBuffer);
      }

      /**
       * Clears the specified audio buffer
       * @param {number} buffer - Index of the buffer in {@link ActiveMediaPlayer.AUDIO_BUFFERS}
       */

    }, {
      key: "clearAudioBuffer",
      value: function clearAudioBuffer(buffer) {
        if (ActiveMediaPlayer.AUDIO_BUFFERS && buffer >= 0 && buffer < ActiveMediaPlayer.AUDIO_BUFFERS.length && ActiveMediaPlayer.AUDIO_BUFFERS[buffer]) {
          ActiveMediaPlayer.AUDIO_BUFFERS[buffer].clear();
          ActiveMediaPlayer.AUDIO_BUFFERS[buffer] = null;
        }
      }

      /**
       * Clears all audio buffers
       */

    }, {
      key: "clearAllAudioBuffers",
      value: function clearAllAudioBuffers() {
        var _this3 = this;

        if (ActiveMediaPlayer.AUDIO_BUFFERS) ActiveMediaPlayer.AUDIO_BUFFERS.forEach(function (_buffer, n) {
          return _this3.clearAudioBuffer(n);
        });
      }

      /**
       * Counts the number of active audio buffers
       * @returns {number}
       */

    }, {
      key: "countActiveBuffers",
      value: function countActiveBuffers() {
        return ActiveMediaPlayer.AUDIO_BUFFERS ? ActiveMediaPlayer.AUDIO_BUFFERS.reduce(function (c, ab) {
          return c + ab ? 1 : 0;
        }, 0) : 0;
      }

      /**
       * Stops the playing or recording actions of all audio buffers
       */

    }, {
      key: "stopAllAudioBuffers",
      value: function stopAllAudioBuffers() {
        if (ActiveMediaPlayer.AUDIO_BUFFERS) ActiveMediaPlayer.AUDIO_BUFFERS.forEach(function (ab) {
          return ab ? ab.stop() : null;
        });
      }

      /**
       * Stops a specific audio buffer
       * @param {number} buffer - Index of the buffer in {@link ActiveMediaPlayer.AUDIO_BUFFERS}
       */

    }, {
      key: "stopAudioBuffer",
      value: function stopAudioBuffer(buffer) {
        if (ActiveMediaPlayer.AUDIO_BUFFERS && buffer >= 0 && buffer < ActiveMediaPlayer.AUDIO_BUFFERS.length && ActiveMediaPlayer.AUDIO_BUFFERS[buffer]) ActiveMediaPlayer.AUDIO_BUFFERS[buffer].stop();
      }

      /**
       * Checks the position of visual components after a displacement or resizing of its container
       * @param {ActiveBox} _bxi - The container where this player is hosted
       */

    }, {
      key: "checkVisualComponentBounds",
      value: function checkVisualComponentBounds(_bxi) {}
      // does nothing


      /**
       * Sets the visual component of this player visible or invisible
       * @param {boolean} _state - `true` for visible
       */

    }, {
      key: "setVisualComponentVisible",
      value: function setVisualComponentVisible(_state) {}
      // TODO: Implement setVisualComponentVisible


      /**
       * Sets the ActiveBox associated to this media player
       * @param {?ActiveBox} setBx - The new container of this media. Can be `null`.
       */

    }, {
      key: "linkTo",
      value: function linkTo(setBx) {
        this.bx = setBx;
        if (this.bx && this.$visualComponent) this.bx.setHostedComponent(this.$visualComponent);
      }
    }]);

    return ActiveMediaPlayer;
  }();

  /**
   * Recording of audio is enabled only when `navigator.getUserMedia` and `MediaRecorder` are defined
   * In 02-Mar-2016 this is implemented only in Firefox 41 and Chrome 49 or later.
   * See: {@link https://addpipe.com/blog/mediarecorder-api}
   * @type Boolean
   */


  ActiveMediaPlayer.REC_ENABLED = typeof MediaRecorder !== 'undefined' && typeof navigator !== 'undefined';

  if (ActiveMediaPlayer.REC_ENABLED) {
    navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
  }

  /**
   * Audio buffers used for recording and playing voice are stored in a static array because
   * they are common to all instances of {@link ActiveMediaPlayer}
   * Only initialized when {@link REC_ENABLED} is `true`.
   * @type {AudioBuffer[]} */
  ActiveMediaPlayer.AUDIO_BUFFERS = ActiveMediaPlayer.REC_ENABLED ? [] : null;

  Object.assign(ActiveMediaPlayer.prototype, {
    /**
     * The MediaContent associated to this player.
     * @name ActiveMediaPlayer#mc
     * @type {MediaContent} */
    mc: null,
    /**
     * The player to which this player belongs.
     * @name ActiveMediaPlayer#ps
     * @type {JClicPlayer} */
    ps: null,
    /**
     * MediaPlayers should be linked to {@link ActiveBox} objects.
     * @name ActiveMediaPlayer#bx
     * @type {ActiveBox} */
    bx: null,
    /**
     * The visual component for videos, usually a `video` HTML element
     * @name ActiveMediaPlayer#$visualComponent
     * @type {external:jQuery} */
    $visualComponent: null,
    /**
     * When `true`, this player makes use of a recording audio buffer
     * @name ActiveMediaPlayer#useAudioBuffer
     * @type {boolean} */
    useAudioBuffer: false,
    /**
     * The {@link MediaBagElement} containing the reference to the media to be played
     * @name ActiveMediaPlayer#mbe
     * @type {MediaBagElement} */
    mbe: null
  });

  return ActiveMediaPlayer;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 211 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : bags/ActivitySequenceJump.js
 *  Created : 05/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2016 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(98), __webpack_require__(488)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, JumpInfo, ConditionalJumpInfo) {

  /**
   * This is a special case of {@link JumpInfo}, used only in {@link ActivitySequenceElement} objects.
   * Sequence elements can contain up to two ActivitySequenceJump objects: one to be processed
   * when the user clicks on the "next" button (or when the activity finishes, if in automatic mode),
   * and the other used with the "prev" button. ActivitySequenceJump objects define a default jump
   * or action to be performed, but can also have up to two {@link ConditionalJumpInfo} objects. These
   * define alternative jumps that are performed only when score or time are below or over a specific
   * threshold.
   * @exports ActivitySequenceJump
   * @class
   * @extends JumpInfo
   */
  var ActivitySequenceJump = function (_JumpInfo) {
    _inherits(ActivitySequenceJump, _JumpInfo);

    /**
     * ActivitySequenceJump constructor
     * @param {string} action - Must be one of the described actions.
     * @param {(number|string)=} sq - Can be the tag of the sequence element to jump to, or its
     * cardinal number in the list.
     */
    function ActivitySequenceJump(action, sq) {
      _classCallCheck(this, ActivitySequenceJump);

      return _possibleConstructorReturn(this, (ActivitySequenceJump.__proto__ || Object.getPrototypeOf(ActivitySequenceJump)).call(this, action, sq));
    }

    /**
     * Loads the object settings from a specific JQuery XML element.
     * @param {external:jQuery} $xml - The XML element to parse
     */


    _createClass(ActivitySequenceJump, [{
      key: "setProperties",
      value: function setProperties($xml) {
        var _this2 = this;

        _get(ActivitySequenceJump.prototype.__proto__ || Object.getPrototypeOf(ActivitySequenceJump.prototype), "setProperties", this).call(this, $xml);

        // Read conditional jumps
        $xml.children('jump').each(function (_n, child) {
          var condJmp = new ConditionalJumpInfo().setProperties($(child));
          if (condJmp.id === 'upper') _this2.upperJump = condJmp;else if (condJmp.id === 'lower') _this2.lowerJump = condJmp;
        });
        return this;
      }

      /**
       * Resolves what {@link JumpInfo} must be taken, based on a done time and average rating obtained
       * in activities.
       * @param {number} rating - Average rating obtained by the user in the activities done during the
       * last sequence stretch.
       * @param {number} time - Total time spend doing the activities.
       * @returns {JumpInfo}
       */

    }, {
      key: "resolveJump",
      value: function resolveJump(rating, time) {
        var result = this;
        if (rating >= 0 && time >= 0) {
          if (this.upperJump !== null && rating > this.upperJump.threshold && (this.upperJump.time <= 0 || time < this.upperJump.time)) {
            result = this.upperJump;
          } else if (this.lowerJump !== null && (rating < this.lowerJump.threshold || this.lowerJump.time > 0 && time > this.lowerJump.time)) {
            result = this.lowerJump;
          }
        }
        return result;
      }
    }]);

    return ActivitySequenceJump;
  }(JumpInfo);

  Object.assign(ActivitySequenceJump.prototype, {
    /**
     * Optional jump to be performed when the results (score and time) are above a specific threshold.
     * @name ActivitySequenceJump#upperJump
     * @type {ConditionalJumpInfo} */
    upperJump: null,
    /**
     * Optional jump to be performed when the results (score or time) are below a specific threshold.
     * @name ActivitySequenceJump#lowerJump
     * @type {ConditionalJumpInfo} */
    lowerJump: null
  });

  return ActivitySequenceJump;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 212 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : automation/AutoContentProvider.js
 *  Created : 13/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Utils) {

  /**
   * This abstract class is the base for classes that create on-time automatic content for JClic
   * activities, usually using random parameters to assure different content in each session.
   *
   * Activities with `AutoContentProvider` objects rely on them to build new content on every start.
   * @exports AutoContentProvider
   * @class
   */
  var AutoContentProvider = function () {
    /**
     * AutoContentProvider constructor
     * @param {JClicProject} project - The JClic project to which this content provider belongs.
     */
    function AutoContentProvider(project) {
      _classCallCheck(this, AutoContentProvider);

      this.project = project;
    }

    /**
     * Dynamic constructor that returns a specific type of AutoContentProvider based on the `class`
     * attribute declared on an $xml element.
     * It should be called only from {@link Activity#setproperties}
     * @param {external.jQuery} $xml - The XML element to parse
     * @param {JClicProject} project - The JClic project to which this object will be related
     * @returns {AutoContentProvider}
     */


    _createClass(AutoContentProvider, [{
      key: 'setProperties',


      /**
       * Loads the object settings from a specific jQuery XML element
       * @param {external:jQuery} $xml - The XML element to parse
       */
      value: function setProperties($xml) {
        this.className = ($xml.attr('class') || '').replace(/^edu\.xtec\.jclic\.automation\./, '@');
        return this;
      }

      /**
       * Initializes the content provider
       */

    }, {
      key: 'init',
      value: function init() {}
      // To be implemented in real content providers


      /**
       * Builds an {@link AutoContentProvider.ActiveBagContentKit} and generates the automatized content.
       * @param {number} nRows - Number of rows to be processed
       * @param {number} nCols - Number of columns to be processed
       * @param {ActiveBagContent[]} content - Array with one or more containers of {@link ActiveBoxContent}
       * objects to be filled with new content.
       * @param {bolean} useIds - When `true`, the `id` field of {@link ActiveBoxContent} objects is significant
       * @returns {boolean} - `true` if the process was OK. `false` otherwise.
       */

    }, {
      key: 'generateContent',
      value: function generateContent(nRows, nCols, content, useIds) {
        return this.process(new AutoContentProvider.ActiveBagContentKit(nRows, nCols, content, useIds));
      }

      /**
       * Generates the automatized content
       * @param {AutoContentProvider.ActiveBagContentKit} _kit - The objects to be filled with content
       * @returns {boolean} - `true` if the process was OK. `false` otherwise.
       */

    }, {
      key: 'process',
      value: function process(_kit) {
        // To be implemented in subclasses
        return false;
      }
    }], [{
      key: 'getProvider',
      value: function getProvider($xml, project) {
        var automation = null;
        if ($xml && project) {
          var className = ($xml.attr('class') || '').replace(/^edu\.xtec\.jclic\.automation\./, '@'),
              cl = AutoContentProvider.CLASSES[className];
          if (cl) {
            automation = new cl(project);
            automation.setProperties($xml);
          } else Utils.log('error', 'Unknown AutoContentProvider class: ' + className);
        }
        return automation;
      }
    }]);

    return AutoContentProvider;
  }();

  Object.assign(AutoContentProvider.prototype, {
    /**
     * The JClic project to which AutoContentProvider belongs
     * @name AutoContentProvider#project
     * @type {JClicProject} */
    project: null
  });

  /**
   * Utility class used to encapsulate multiple sets of box contents
   * @class
   * @param {number} nRows - Number of rows to be processed
   * @param {number} nCols - Number of columns to be processed
   * @param {ActiveBagContent[]} content - Array with one or more containers of {@link ActiveBoxContent}
   * objects to be filled with new content.
   * @param {bolean} useIds - `true` when the `id` field of {@link ActiveBoxContent} objects is significant.
   */
  AutoContentProvider.ActiveBagContentKit = function () {
    function _class(nRows, nCols, content, useIds) {
      _classCallCheck(this, _class);

      this.nRows = nRows;
      this.nCols = nCols;
      this.content = content;
      this.useIds = useIds;
    }

    return _class;
  }();

  /**
   * Contains the current list of classes derived from AutoContentProvider.
   * This object should be updated by real automation classes at declaration time.
   * Currently, only two types of "AutoContentProvider" are defined: {@link Arith} and TagReplace.
   * @type {object} */
  AutoContentProvider.CLASSES = {
    // TODO: Implement TagReplace
    '@tagreplace.TagReplace': AutoContentProvider
  };

  return AutoContentProvider;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 213 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : boxes/TextGridContent.js
 *  Created : 14/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2), __webpack_require__(57)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Utils, BoxBase) {

  /**
   * This class encapsulates the content of {@link TextGrid} objects.
   *
   * It implements methods to set and retrieve individual characters on the grid, and parsing of
   * XML objects. It also contains information about the optimal size and other graphic properties
   * (fonts, colors, etc.) of the grid.
   * @exports TextGridContent
   * @class
   */
  var TextGridContent = function () {
    /**
     * TextGridContent constructor
     */
    function TextGridContent() {
      _classCallCheck(this, TextGridContent);

      this.bb = new BoxBase(null);
      this.text = [];
    }

    /**
     * Loads the object settings from a specific JQuery XML element
     * @param {external:jQuery} $xml
     */


    _createClass(TextGridContent, [{
      key: "setProperties",
      value: function setProperties($xml) {
        var _this = this;

        // Read attributes
        Utils.attrForEach($xml.get(0).attributes, function (name, val) {
          switch (name) {
            case 'rows':
              // WARNING: Due to a bug in JClic, the meaning of "rows" and "columns" must be
              // interchanged:
              _this.ncw = Number(val);
              break;
            case 'columns':
              _this.nch = Number(val);
              break;
            case 'cellWidth':
              _this.w = Number(val);
              break;
            case 'cellHeight':
              _this.h = Number(val);
              break;
            case 'border':
              _this.border = Utils.getBoolean(val);
              break;
            case 'wild':
            case 'randomChars':
              _this[name] = val;
              break;
          }
        });

        // Read inner elements
        $xml.children('style:first').each(function (_n, child) {
          _this.bb = new BoxBase().setProperties($(child));
        });

        $xml.find('text:first > row').each(function (_n, el) {
          return _this.text.push(el.textContent);
        });

        for (var i = this.text.length; i < this.nch; i++) {
          this.text[i] = '';
        }return this;
      }

      /**
       * Counts the number of wildcard characters present in this TextGrid
       * @returns {number}
       */

    }, {
      key: "countWildChars",
      value: function countWildChars() {
        var result = 0;
        if (this.text) for (var y = 0; y < this.nch; y++) {
          for (var x = 0; x < this.ncw; x++) {
            if (this.text[y].charAt(x) === this.wild) result++;
          }
        }return result;
      }

      /**
       * Counts the total number of characters, including wildcard characters.
       * @returns {Number}
       */

    }, {
      key: "getNumChars",
      value: function getNumChars() {
        return this.ncw * this.nch;
      }

      /**
       * Sets the specified character as a content of the cell located at specific coordinates
       * @param {number} x - The X coordinate of the cell
       * @param {number} y - The X coordinate of the cell
       * @param {string} ch - The character to be placed on the specified cell
       */

    }, {
      key: "setCharAt",
      value: function setCharAt(x, y, ch) {
        if (x >= 0 && x < this.ncw && y >= 0 && y < this.nch) this.text[y] = this.text[y].substring(0, x) + ch + this.text[y].substring(x + 1);
      }
    }]);

    return TextGridContent;
  }();

  Object.assign(TextGridContent.prototype, {
    /**
     * Grid columns
     * @name TextGridContent#ncw
     * @type {number} */
    ncw: 1,
    /**
     * Grid rows
     * @name TextGridContent#nch
     * @type {number} */
    nch: 1,
    /**
     * Width of cells
     * @name TextGridContent#w
     * @type {number} */
    w: 20,
    /**
     * Height of cells
     * @name TextGridContent#h
     * @type {number} */
    h: 20,
    /**
     * Whether the cells must be surrounded by a border or not
     * @name TextGridContent#border
     * @type {boolean} */
    border: false,
    /**
     * The {@link BoxBase} object with visual settings of the text grid
     * @name TextGridContent#bb
     * @type {BoxBase} */
    bb: null,
    /**
     * An array of String objects containing the chars of cells. One string per row, one character of
     * this string per cell.
     * @name TextGridContent#text
     * @type {string[]} */
    text: null,
    /**
     * The letter used as wildcard
     * @name TextGridContent#wild
     * @type {string} */
    wild: '*',
    /**
     * A String with the chars to take as source when randomly filling empty cells
     * @name TextGridContent#randomChars
     * @type {string} */
    randomChars: Utils.settings.RANDOM_CHARS
  });

  return TextGridContent;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 214 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : skins/Counter.js
 *  Created : 07/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {

  /**
   * This class encapsulates the operation of a numeric counter, used to display the current
   * values of score, actions and time.
   */
  var Counter = function () {
    /**
     * Counter constructor
     * @param {string} id - The type of information stored on this counter
     * @param {external:jQuery=} $div - The HTML element where this counter will show values (can be _null_)
     */
    function Counter(id, $div) {
      _classCallCheck(this, Counter);

      if (id) this.id = id;
      if ($div) this.$div = $div;
    }

    /**
     * Gets the current display value of this counter
     * @returns {number}
     */


    _createClass(Counter, [{
      key: 'getDisplayValue',
      value: function getDisplayValue() {
        var result = this.countDown > 0 ? this.countDown - this.value : this.value;
        if (this.displayDiffFrom) result = result - this.displayDiffFrom.value;
        return Math.max(0, Math.min(this.MAX_DISPLAY_VALUE, result));
      }

      /**
       * Paints the value of this counter on screen
       * (method to be overridden by subclasses)
       */

    }, {
      key: 'refreshDisplay',
      value: function refreshDisplay() {
        if (this.$div) this.$div.html(this.enabled ? (this.getDisplayValue() + 1000).toString().substr(1) : '000');
      }

      /**
       * Enables or disables this counter
       * @param {boolean} enabled - State been assigned to this counter
       */

    }, {
      key: 'setEnabled',
      value: function setEnabled(enabled) {
        if (this.enabled !== enabled) {
          this.enabled = enabled;
          if (this.$div) {
            this.refreshDisplay();
            this.$div.css('opacity', this.enabled ? 1.0 : 0.3);
          }
        }
      }

      /**
       * Sets the initial value of the counter
       * @param {number} maxValue - Value from which the countdown will start
       */

    }, {
      key: 'setCountDown',
      value: function setCountDown(maxValue) {
        if (this.countDown !== (this.countDown = maxValue)) this.refreshDisplay();
      }

      /**
       * Increments by one the value of this counter
       */

    }, {
      key: 'incValue',
      value: function incValue() {
        this.value++;
        if (this.enabled) this.refreshDisplay();
      }

      /**
       * Sets a specific value to this counter
       * @param {number} value - The value to set
       */

    }, {
      key: 'setValue',
      value: function setValue(value) {
        if (this.enabled && this.value !== (this.value = value)) this.refreshDisplay();
      }
    }]);

    return Counter;
  }();

  Object.assign(Counter.prototype, {
    /**
     * Type of counter (usually: `score`, `actions` or `time`)
     * @name Counter#id
     * @type {string} */
    id: '',
    /**
     * The HTML element where this counter shows its value
     * @name Counter#$div
     * @type {external:jQuery}
     */
    $div: null,
    /**
     * Current value of this counter
     * @name Counter#value
     * @type {number} */
    value: 0,
    /**
     * When set, the counter displays a countdown from this value to zero
     * @name Counter#countDown
     * @type {number} */
    countDown: 0,
    /**
     * Flag indicating if this counter is currently enabled
     * @name Counter#enabled
     * @type {boolean} */
    enabled: true,
    /**
     * Maximum value to be displayed by this counter
     * @name Counter#MAX_DISPLAY_VALUE
     * @type {Number} */
    MAX_DISPLAY_VALUE: 999,
    /**
     * An optional Counter used as a subtractor to display the current value.
     * Useful to display `errors` subtracting `score` from `actions`.
     * @name Counter#displayDiffFrom
     * @type {Counter}
     */
    displayDiffFrom: null
  });

  return Counter;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 215 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/associations/SimpleAssociation.js
 *  Created : 02/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2016 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(35), __webpack_require__(24), __webpack_require__(58), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, ActiveBoxGrid, BoxBag, BoxConnector, AWT) {

  /**
   * This class of {@link Activity} uses two panels (`primary` and `secondary`) formed by
   * {@link ActiveBox} objects filled with data stored in {@link ActiveBagContent} repositories.
   *
   * Both panels have the same number of elements, associated one-to-one. A third {@link ActiveBagContent}
   * can be used as alternative content, that will be revealed in the `primary` panel as the pairings
   * of its cells are solved.
   * @exports SimpleAssociation
   * @class
   * @extends Activity
   */
  var SimpleAssociation = function (_Activity) {
    _inherits(SimpleAssociation, _Activity);

    /**
     * SimpleAssociation constructor
     * @param {JClicProject} project - The JClic project to which this activity belongs
     */
    function SimpleAssociation(project) {
      _classCallCheck(this, SimpleAssociation);

      return _possibleConstructorReturn(this, (SimpleAssociation.__proto__ || Object.getPrototypeOf(SimpleAssociation)).call(this, project));
    }

    /**
     * Retrieves the minimum number of actions needed to solve this activity.
     * @override
     * @returns {number}
     */


    _createClass(SimpleAssociation, [{
      key: "getMinNumActions",
      value: function getMinNumActions() {
        return this.abc.primary.getNumCells();
      }

      /**
       * Whether or not the activity uses random to scramble internal components
       * @override
       * @returns {boolean}
       */

    }, {
      key: "hasRandom",
      value: function hasRandom() {
        return true;
      }

      /**
       * When `true`, the activity must always be scrambled
       * @override
       * @returns {boolean}
       */

    }, {
      key: "shuffleAlways",
      value: function shuffleAlways() {
        return true;
      }

      /**
       * Whether the activity allows the user to request help.
       * @override
       * @returns {boolean}
       */

    }, {
      key: "helpSolutionAllowed",
      value: function helpSolutionAllowed() {
        return true;
      }
    }]);

    return SimpleAssociation;
  }(Activity);

  Object.assign(SimpleAssociation.prototype, {
    /**
     * When `true`, the cell's `idAss` field will be used to check pairing matches.
     * @name SimpleAssociation#useIdAss
     * @type {boolean} */
    useIdAss: false
  });

  /**
   * The {@link ActivityPanel} where {@link SimpleAssociation} activities are played.
   * @class
   * @extends ActivityPanel
   */

  var SimpleAssociationPanel = function (_Activity$Panel) {
    _inherits(SimpleAssociationPanel, _Activity$Panel);

    /**
     * SimpleAssociationPanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function SimpleAssociationPanel(act, ps, $div) {
      _classCallCheck(this, SimpleAssociationPanel);

      return _possibleConstructorReturn(this, (SimpleAssociationPanel.__proto__ || Object.getPrototypeOf(SimpleAssociationPanel)).call(this, act, ps, $div));
    }

    /**
     * Performs miscellaneous cleaning operations
     * @override
     */


    _createClass(SimpleAssociationPanel, [{
      key: "clear",
      value: function clear() {
        if (this.bgA) {
          this.bgA.end();
          this.bgA = null;
        }
        if (this.bgB) {
          this.bgB.end();
          this.bgB = null;
        }
      }

      /**
       * Prepares the visual components of the activity
       * @override
       */

    }, {
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        if (this.firstRun) _get(SimpleAssociationPanel.prototype.__proto__ || Object.getPrototypeOf(SimpleAssociationPanel.prototype), "buildVisualComponents", this).call(this);

        this.clear();

        var abcA = this.act.abc['primary'],
            abcB = this.act.abc['secondary'],
            solved = this.act.abc['solvedPrimary'];

        if (abcA && abcB) {
          if (abcA.imgName) {
            abcA.setImgContent(this.act.project.mediaBag, null, false);
            if (abcA.animatedGifFile && !abcA.shaper.rectangularShapes && !this.act.scramble['primary']) this.$animatedBg = $('<span/>').css({
              'background-image': "url(" + abcA.animatedGifFile + ")",
              'background-position': 'center',
              'background-repeat': 'no-repeat',
              position: 'absolute'
            }).appendTo(this.$div);
          }

          if (abcB.imgName) {
            abcB.setImgContent(this.act.project.mediaBag, null, false);
            if (abcB.animatedGifFile && !abcB.shaper.rectangularShapes && !this.act.scramble['secondary']) this.$animatedBgB = $('<span/>').css({
              'background-image': "url(" + abcB.animatedGifFile + ")",
              'background-position': 'center',
              'background-repeat': 'no-repeat',
              position: 'absolute'
            }).appendTo(this.$div);
          }

          if (solved && solved.imgName) solved.setImgContent(this.act.project.mediaBag, null, false);

          if (this.act.acp !== null) {
            var contentKit = [abcA, abcB];
            if (solved) contentKit.push(solved);
            this.act.acp.generateContent(abcA.nch, abcA.ncw, contentKit, false);
          }

          this.bgA = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abcA);
          this.bgB = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abcB);

          this.bgA.setContent(abcA, solved ? solved : null);
          if (this.$animatedBg) this.bgA.setCellAttr('tmpTrans', true);

          this.bgB.setContent(abcB);
          if (this.$animatedBgB) this.bgB.setCellAttr('tmpTrans', true);

          this.bgA.accessibleText = this.ps.getMsg('source');
          this.bgB.accessibleText = this.ps.getMsg('target');

          this.bgA.setVisible(true);
          this.bgB.setVisible(true);
        }
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(SimpleAssociationPanel.prototype.__proto__ || Object.getPrototypeOf(SimpleAssociationPanel.prototype), "initActivity", this).call(this);
        if (!this.firstRun) this.buildVisualComponents();else this.firstRun = false;

        if (this.bgA && this.bgB) {
          // Scramble cells
          var scrambleArray = [];
          if (this.act.scramble.primary) scrambleArray.push(this.bgA);
          if (this.act.scramble.secondary) scrambleArray.push(this.bgB);
          if (scrambleArray.length > 0) {
            this.shuffle(scrambleArray, true, true);
          }

          if (this.useOrder) this.currentItem = this.bgA.getNextItem(-1);

          this.invalidate().update();
          this.setAndPlayMsg('initial', 'start');
          this.playing = true;
        }
      }

      /**
       * Updates the graphic content of this panel.
       * This method will be called from {@link AWT.Container#update} when needed.
       * @override
       * @param {AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
       * it's the whole panel.
       */

    }, {
      key: "updateContent",
      value: function updateContent(dirtyRegion) {
        _get(SimpleAssociationPanel.prototype.__proto__ || Object.getPrototypeOf(SimpleAssociationPanel.prototype), "updateContent", this).call(this, dirtyRegion);
        if (this.bgA && this.bgB && this.$canvas) {
          var canvas = this.$canvas.get(-1),
              ctx = canvas.getContext('2d');
          if (!dirtyRegion) dirtyRegion = new AWT.Rectangle(0, 0, canvas.width, canvas.height);
          ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
          this.bgA.update(ctx, dirtyRegion);
          this.bgB.update(ctx, dirtyRegion);
        }
        return this;
      }

      /**
       * Sets the real dimension of this panel.
       * @override
       * @param {AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
       * @returns {AWT.Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(preferredMaxSize) {
        return !this.bgA || !this.bgB || this.getBounds().equals(preferredMaxSize) ? preferredMaxSize : BoxBag.layoutDouble(preferredMaxSize, this.bgA, this.bgB, this.act.boxGridPos, this.act.margin);
      }

      /**
       * Sets the size and position of this activity panel
       * @override
       * @param {AWT.Rectangle} rect
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect) {
        if (this.$canvas) this.$canvas.remove();

        _get(SimpleAssociationPanel.prototype.__proto__ || Object.getPrototypeOf(SimpleAssociationPanel.prototype), "setBounds", this).call(this, rect);
        if (this.bgA || this.bgB) {
          // Create the main canvas
          this.$canvas = $("<canvas width=\"" + rect.dim.width + "\" height=\"" + rect.dim.height + "\"/>").css({
            position: 'absolute',
            top: 0,
            left: 0
          });
          // Resize animated gif background A
          if (this.$animatedBg && this.bgA) {
            var bgRect = this.bgA.getBounds();
            this.$animatedBg.css({
              left: bgRect.pos.x,
              top: bgRect.pos.y,
              width: bgRect.dim.width + 'px',
              height: bgRect.dim.height + 'px',
              'background-size': bgRect.dim.width + "px " + bgRect.dim.height + "px"
            });
          }
          // Resize animated gif background B
          if (this.$animatedBgB && this.bgB) {
            var bgRectB = this.bgB.getBounds();
            this.$animatedBgB.css({
              left: bgRectB.pos.x,
              top: bgRectB.pos.y,
              width: bgRectB.dim.width + 'px',
              height: bgRectB.dim.height + 'px',
              'background-size': bgRectB.dim.width + "px " + bgRectB.dim.height + "px"
            });
          }
          this.$div.append(this.$canvas);

          // Create a [BoxConnector](BoxConnector.html) and attach it to the canvas context
          this.bc = new BoxConnector(this, this.$canvas.get(-1).getContext('2d'));

          // Repaint all
          this.invalidate().update();
        }
      }

      /**
       * Builds the accessible components needed for this ActivityPanel
       * This method is called when all main elements are placed and visible, when the activity is ready
       * to start or when resized.
       * @override
       */

    }, {
      key: "buildAccessibleComponents",
      value: function buildAccessibleComponents() {
        if (this.$canvas && this.accessibleCanvas) {
          _get(SimpleAssociationPanel.prototype.__proto__ || Object.getPrototypeOf(SimpleAssociationPanel.prototype), "buildAccessibleComponents", this).call(this);
          if (this.bgA) this.bgA.buildAccessibleElements(this.$canvas, this.$div, 'mousedown');
          if (this.bgB) this.bgB.buildAccessibleElements(this.$canvas, this.$div, 'mousedown');
        }
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (this.bc && this.playing) {
          //
          // The [AWT.Point](AWT.html#Point) where the mouse or touch event has been originated
          // and two [ActiveBox](ActiveBox.html) pointers used for the [BoxConnector](BoxConnector.html)
          // `origin` and `dest` points.
          var p = null,
              bx1 = void 0,
              bx2 = void 0;
          //
          // _touchend_ event don't provide pageX nor pageY information
          if (event.type === 'touchend') p = this.bc.active ? this.bc.dest.clone() : new AWT.Point();else {
            // Touch events can have more than one touch, so `pageX` must be obtained from `touches[0]`
            var x = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX,
                y = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY;
            p = new AWT.Point(x - this.$div.offset().left, y - this.$div.offset().top);
          }

          // Flag for tracking `mouseup` events
          var up = false,

          // Flag for assuring that only one media plays per event (avoid event sounds overlapping
          // cell's media sounds)
          m = false,

          // Flag for tracking clicks on the background of grid A
          clickOnBg0 = false,

          // Array to be filled with actions to be executed at the end of event processing
          delayedActions = [];

          switch (event.type) {
            case 'touchcancel':
              // Canvel movement
              if (this.bc.active) this.bc.end();
              break;

            case 'mouseup':
              // Don't consider drag moves below 3 pixels. Can be a "trembling click"
              if (this.bc.active && p.distanceTo(this.bc.origin) <= 3) {
                break;
              }
              up = true;
            /* falls through */
            case 'touchend':
            case 'touchstart':
            case 'mousedown':
              if (!this.bc.active) {
                // A new pairing starts
                //
                // Pairings can never start with a `mouseup` event
                if (up) break;

                this.ps.stopMedia(1);
                //
                // Determine if click was done on panel A or panel B
                bx1 = this.bgA ? this.bgA.findActiveBox(p) : null;
                bx2 = this.bgB ? this.bgB.findActiveBox(p) : null;
                if (bx1 && (!this.act.useOrder || bx1.idOrder === this.currentItem) || !this.act.useOrder && bx2 && bx2.idAss !== -1) {
                  // Start the [BoxConnector](BoxConnector.html)
                  if (this.act.dragCells) this.bc.begin(p, bx1 || bx2);else this.bc.begin(p);
                  // Play cell media or event sound
                  m = m || (bx1 || bx2).playMedia(this.ps, delayedActions);
                  if (!m) this.playEvent('click');

                  // Move the focus to the opposite accessible group
                  var bg = bx1 ? this.bgA : this.bgB;
                  if (bg && bg.$accessibleDiv) {
                    bg = bx1 ? this.bgB : this.bgA;
                    if (bg && bg.$accessibleDiv) bg.$accessibleDiv.focus();
                  }
                }
              } else {
                this.ps.stopMedia(1);
                // Pairing completed
                //
                // Find the active boxes behind `bc.origin` and `p`
                var origin = this.bc.origin;
                this.bc.end();
                bx1 = this.bgA ? this.bgA.findActiveBox(origin) : null;
                if (bx1) {
                  bx2 = this.bgB ? this.bgB.findActiveBox(p) : null;
                } else {
                  bx2 = this.bgB ? this.bgB.findActiveBox(origin) : null;
                  if (bx2) {
                    bx1 = this.bgA ? this.bgA.findActiveBox(p) : null;
                    clickOnBg0 = true;
                  }
                }
                // Check if the pairing was correct
                if (bx1 && bx2 && bx1.idAss !== -1 && bx2.idAss !== -1 && this.act.abc['secondary']) {
                  var ok = false;
                  var src = bx1.getDescription(),
                      dest = bx2.getDescription(),
                      matchingDest = this.act.abc['secondary'].getActiveBoxContent(bx1.idOrder);
                  if (bx1.idOrder === bx2.idOrder || bx2.getContent().isEquivalent(matchingDest, true)) {
                    // Pairing is OK. Play media and disable involved cells
                    ok = true;
                    bx1.idAss = -1;
                    bx2.idAss = -1;
                    if (this.act.abc['solvedPrimary']) {
                      bx1.switchToAlt(this.ps);
                      m = m || bx1.playMedia(this.ps, delayedActions);
                    } else {
                      if (clickOnBg0) m = m || bx1.playMedia(this.ps, delayedActions);else m = m || bx2.playMedia(this.ps, delayedActions);
                      bx1.clear();
                    }
                    bx2.clear();

                    if (this.act.useOrder && this.bgA)
                      // Load next item
                      this.currentItem = this.bgA.getNextItem(this.currentItem);
                  }
                  // Check results and notify action
                  var cellsPlaced = this.bgB ? this.bgB.countCellsWithIdAss(-1) : 0;
                  this.ps.reportNewAction(this.act, 'MATCH', src, dest, ok, cellsPlaced);
                  // End activity or play event sound
                  if (ok && cellsPlaced === this.bgB.getNumCells()) this.finishActivity(true);else if (!m) this.playEvent(ok ? 'actionOk' : 'actionError');
                }
                this.update();

                // Move the focus to the `source` accessible group
                if (this.bgA && this.bgA.$accessibleDiv) this.bgA.$accessibleDiv.focus();
              }
              break;

            case 'mousemove':
            case 'touchmove':
              this.bc.moveTo(p);
              break;
          }
          delayedActions.forEach(function (action) {
            return action();
          });
          event.preventDefault();
        }
      }
    }]);

    return SimpleAssociationPanel;
  }(Activity.Panel);

  Object.assign(SimpleAssociationPanel.prototype, {
    /**
     * The {@link ActiveBoxBag} object containing the information to be displayed in the `primary` panel
     * @name SimpleAssociationPanel#bgA
     * @type {ActiveBoxBag} */
    bgA: null,
    /**
     * The {@link ActiveBoxBag} object containing the information to be displayed in the `secondary` panel
     * @name SimpleAssociationPanel#bgB
     * @type {ActiveBoxBag} */
    bgB: null,
    /**
     * The box connector
     * @name SimpleAssociationPanel#bc
     * @type {BoxConnector} */
    bc: null,
    /**
     * List of mouse, touch and keyboard events intercepted by this panel
     * @override
     * @name SimpleAssociationPanel#events
     * @type {string[]} */
    events: ['mousedown', 'mouseup', 'mousemove', 'touchstart', 'touchend', 'touchmove', 'touchcancel']
  });

  /**
   * Panel class associated to this type of activity: {@link SimpleAssociationPanel}
   * @type {class} */
  SimpleAssociation.Panel = SimpleAssociationPanel;

  //
  // Register class in Activity.prototype
  Activity.CLASSES['@associations.SimpleAssociation'] = SimpleAssociation;

  return SimpleAssociation;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 216 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : boxes/TextGrid.js
 *  Created : 12/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(3), __webpack_require__(2), __webpack_require__(99), __webpack_require__(213)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, AWT, Utils, AbstractBox, TextGridContent) {

  /**
   * Default values
   * @type {object} */
  var defaults = {
    MIN_CELL_SIZE: 12,
    DEFAULT_CELL_SIZE: 20,
    MIN_INTERNAL_MARGIN: 2

    /**
     * Binary flags used to mark status
     * @type {object} */
  };var flags = {
    NORMAL: 0,
    INVERTED: 1,
    HIDDEN: 2,
    LOCKED: 4,
    MARKED: 8,
    TRANSPARENT: 16

    /**
     * This class is a special type of {@link AbstractBox} that displays a grid of single
     * characters.
     *
     * It's used {@link CrossWord} and {@link WordSearch} activities.
     * @exports TextGrid
     * @class
     * @extends AbstractBox
     */
  };
  var TextGrid = function (_AbstractBox) {
    _inherits(TextGrid, _AbstractBox);

    /**
     * TextGrid constructor
     * @param {?AbstractBox} parent - The AbstractBox to which this text grid belongs
     * @param {?AWT.Container} container - The container where this text grid is placed.
     * @param {?BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
     * @param {number} x - `X` coordinate of the upper left corner of this grid
     * @param {number} y - `Y` coordinate of the upper left corner of this grid
     * @param {number} ncw - Number of columns of the grid
     * @param {number} nch - Nomber of rows of the grid
     * @param {number} cellW - Width of the cells
     * @param {number} cellH - Height of the cells
     * @param {boolean} border - When `true`, a border must be drawn between the cells
     */
    function TextGrid(parent, container, boxBase, x, y, ncw, nch, cellW, cellH, border) {
      _classCallCheck(this, TextGrid);

      var _this = _possibleConstructorReturn(this, (TextGrid.__proto__ || Object.getPrototypeOf(TextGrid)).call(this, parent, container, boxBase));
      // *TextGrid* extends [AbstractBox](AbstractBox.html)


      _this.pos.x = x;
      _this.pos.y = y;
      _this.nCols = Math.max(1, ncw);
      _this.nRows = Math.max(1, nch);
      _this.cellWidth = Math.max(cellW, defaults.MIN_CELL_SIZE);
      _this.cellHeight = Math.max(cellH, defaults.MIN_CELL_SIZE);
      _this.dim.width = cellW * _this.nCols;
      _this.dim.height = cellH * _this.nRows;
      _this.setChars(' ');
      _this.preferredBounds = new AWT.Rectangle(_this.pos, _this.dim);
      _this.setBorder(border);
      _this.cursorTimer = new AWT.Timer(function () {
        return _this.blink(0);
      }, 500, false);
      _this.cursorEnabled = false;
      _this.useCursor = false;
      _this.wildTransparent = false;
      _this.cursor = new AWT.Point();
      return _this;
    }

    /**
     * Factory constructor that creates an empty grid based on a {@link TextGridContent}
     * @param {?AbstractBox} parent - The AbstractBox to which the text grid belongs
     * @param {?AWT.Container} container - The container where the text grid will be placed.
     * @param {number} x - `X` coordinate of the upper left corner of the grid
     * @param {number} y - `Y` coordinate of the upper left corner of the grid
     * @param {TextGridContent} tgc - Object with the content and other settings of the grid
     * @param {boolean} wildTransparent - When `true`, the wildcard character will be transparent
     * @returns {TextGrid}
     */


    _createClass(TextGrid, [{
      key: "setChars",


      /**
       * Sets the characters to be placed in the cells of this TextGrid
       * @param {string} text
       */
      value: function setChars(text) {
        this.chars = [];
        this.answers = [];
        this.attributes = [];
        for (var py = 0; py < this.nRows; py++) {
          var line = py < text.length ? text[py] : '';
          this.chars[py] = line.split('');
          this.answers[py] = [];
          this.attributes[py] = [];
          for (var px = 0; px < this.nCols; px++) {
            if (px >= line.length) this.chars[py][px] = ' ';
            this.answers[py][px] = this.chars[py][px];
            this.attributes[py][px] = flags.NORMAL;
          }
        }
      }

      /**
       * Substitutes the current content of all cells with wildcards with a randomly generated char.
       * @see TextGridContent#randomChars
       */

    }, {
      key: "randomize",
      value: function randomize() {
        for (var py = 0; py < this.nRows; py++) {
          for (var px = 0; px < this.nCols; px++) {
            if (this.chars[py][px] === this.wild) this.chars[py][px] = this.randomChars.charAt(Math.floor(Math.random() * this.randomChars.length));
          }
        }
      }

      /**
       * Clears or sets global attributes to all cells
       * @param {boolean} lockWild - When `true`, the wildcard cells will be marked with special
       * attributes (used in CrossWords to mark black cells)
       * @param {boolean} clearChars - When `true`, the current content of cells will be erased.
       */

    }, {
      key: "setCellAttributes",
      value: function setCellAttributes(lockWild, clearChars) {
        var atr = flags.LOCKED;
        if (this.wildTransparent) atr |= flags.TRANSPARENT;else atr |= flags.INVERTED | flags.HIDDEN;
        for (var py = 0; py < this.nRows; py++) {
          for (var px = 0; px < this.nCols; px++) {
            if (lockWild && this.chars[py][px] === this.wild) this.attributes[py][px] = atr;else {
              this.attributes[py][px] = flags.NORMAL;
              if (clearChars) this.chars[py][px] = ' ';
            }
          }
        }
      }

      /**
       * Sets or unsets the `locked` properties (black cell) to a specific cell.
       * @param {number} px - The logical 'X' coordinate of the cell
       * @param {number} py - The logical 'Y' coordinate of the cell
       * @param {boolean} locked - When true, the `locked` attribute will be on.
       * @returns {undefined}
       */

    }, {
      key: "setCellLocked",
      value: function setCellLocked(px, py, locked) {
        if (px >= 0 && px < this.nCols && py >= 0 && py < this.nRows) {
          this.attributes[py][px] = locked ? flags.LOCKED | (this.wildTransparent ? flags.TRANSPARENT : flags.INVERTED | flags.HIDDEN) : flags.NORMAL;
        }
      }

      /**
       * For a specific cell located at column `rx` and row `ry`, finds the number of words delimited
       * by wildchars located behind its current position and in the same row and column. Used in
       * {@link CrossWord} activities to find the definition for a specific cell.
       *
       * The result is returned as 'x' and 'y' properties of a logical point.
       * @param {type} rx - The 'X' position of the cell
       * @param {type} ry - The 'Y' position of the cell
       * @returns {AWT.Point} - The logical positions of the definition for this cell inside the list
       * of current definitions of its row and column. '0' means first definition of its row/column,
       * '1' the second one, etc.
       */

    }, {
      key: "getItemFor",
      value: function getItemFor(rx, ry) {
        if (!this.isValidCell(rx, ry)) return null;

        var point = new AWT.Point();
        var inBlack = false,
            startCount = false;

        for (var px = 0; px < rx; px++) {
          if ((this.attributes[ry][px] & flags.LOCKED) !== 0) {
            if (!inBlack) {
              if (startCount) point.x++;
              inBlack = true;
            }
          } else {
            startCount = true;
            inBlack = false;
          }
        }
        inBlack = false;
        startCount = false;
        for (var py = 0; py < ry; py++) {
          if ((this.attributes[py][rx] & flags.LOCKED) !== 0) {
            if (!inBlack) {
              if (startCount) point.y++;
              inBlack = true;
            }
          } else {
            startCount = true;
            inBlack = false;
          }
        }
        return point;
      }

      /**
       * Whether the blinking cursor must be enabled or disabled.
       * @param {boolean} status
       */

    }, {
      key: "setCursorEnabled",
      value: function setCursorEnabled(status) {
        this.cursorEnabled = status;
        if (status === true) this.startCursorBlink();else this.stopCursorBlink();
      }

      /**
       * Starts the {@link AWT.Timer} that makes the cursor blink.
       */

    }, {
      key: "startCursorBlink",
      value: function startCursorBlink() {
        if (this.useCursor && this.cursorEnabled && this.cursorTimer && !this.cursorTimer.isRunning()) {
          this.blink(1);
          this.cursorTimer.start();
        }
      }

      /**
       * Stops the {@link AWT.Timer} that makes the cursor blink.
       */

    }, {
      key: "stopCursorBlink",
      value: function stopCursorBlink() {
        if (this.cursorTimer && this.cursorTimer.isRunning()) {
          this.cursorTimer.stop();
          this.blink(-1);
        }
      }

      /**
       * Moves the cursor in the specified x and y directions.
       * @param {number} dx - Amount to move in the 'X' axis
       * @param {number} dy - Amount to move in the 'Y' axis
       * @param {boolean} skipLocked - Skip locked cells (wildcards in {@link CrossWord})
       */

    }, {
      key: "moveCursor",
      value: function moveCursor(dx, dy, skipLocked) {
        if (this.useCursor) {
          var point = this.findNextCellWithAttr(this.cursor.x, this.cursor.y, skipLocked ? flags.LOCKED : flags.NORMAL, dx, dy, false);

          if (!this.cursor.equals(point)) this.setCursorAt(point.x, point.y, skipLocked);
        }
      }

      /**
       * Finds the coordinates of the nearest non-locked cell (non-wildcard) moving on the indicated
       * 'X' and 'Y' directions.
       * @param {AWT.Point} - Logical coordinates of the starting point
       * @param {number} dx - 0 means no movement, 1 go right, -1 go left.
       * @param {number} dy - 0 means no movement, 1 go down, -1 go up.
       * @returns {AWT.Point}
       */

    }, {
      key: "findFreeCell",
      value: function findFreeCell(from, dx, dy) {
        var result = null;
        if (from && (dx !== 0 || dy !== 0)) {
          var scan = new AWT.Point(from);
          while (result === null) {
            scan.x += dx;
            scan.y += dy;
            if (scan.x < 0 || scan.x >= this.nCols || scan.y < 0 || scan.y >= this.nRows) break;
            if (!this.getCellAttribute(scan.x, scan.y, flags.LOCKED)) result = scan;
          }
        }
        return result;
      }

      /**
       * Finds the first cell with the specified attributes at the specified state, starting
       * at specified point.
       * @param {number} startX - Starting X coordinate
       * @param {number} startY - Starting Y coordinate
       * @param {number} attr - Attribute to check. See {@link TextGrid.flags}.
       * @param {number} dx - 0 means no movement, 1 go right, -1 go left.
       * @param {number} dy - 0 means no movement, 1 go down, -1 go up.
       * @param {boolean} attrState - Desired state (enabled or disabled) of `attr`
       * @returns {AWT.Point}
       */

    }, {
      key: "findNextCellWithAttr",
      value: function findNextCellWithAttr(startX, startY, attr, dx, dy, attrState) {
        var point = new AWT.Point(startX + dx, startY + dy);
        while (true) {
          if (point.x < 0) {
            point.x = this.nCols - 1;
            if (point.y > 0) point.y--;else point.y = this.nRows - 1;
          } else if (point.x >= this.nCols) {
            point.x = 0;
            if (point.y < this.nRows - 1) point.y++;else point.y = 0;
          }
          if (point.y < 0) {
            point.y = this.nRows - 1;
            if (point.x > 0) point.x--;else point.x = this.nCols - 1;
          } else if (point.y >= this.nRows) {
            point.y = 0;
            if (point.x < this.nCols - 1) point.x++;else point.x = 0;
          }
          if (point.x === startX && point.y === startY || this.getCellAttribute(point.x, point.y, attr) === attrState) break;
          point.x += dx;
          point.y += dy;
        }
        return point;
      }

      /**
       * Sets the blinking cursor at a specific point
       * @param {number} px - X coordinate
       * @param {number} py - Y coordinate
       * @param {boolean} skipLocked - Skip locked (wildcard) cells
       */

    }, {
      key: "setCursorAt",
      value: function setCursorAt(px, py, skipLocked) {
        this.stopCursorBlink();
        if (this.isValidCell(px, py)) {
          this.cursor.x = px;
          this.cursor.y = py;
          this.useCursor = true;
          if (skipLocked && this.getCellAttribute(px, py, flags.LOCKED)) {
            this.moveCursor(1, 0, skipLocked);
          } else {
            if (this.cursorEnabled) this.startCursorBlink();
          }
        }
      }

      /**
       * Sets the `useCursor` property of this text grid
       * @param {boolean} value
       */

    }, {
      key: "setUseCursor",
      value: function setUseCursor(value) {
        this.useCursor = value;
      }

      /**
       * Gets the current position of the blinking cursor
       * @returns {AWT.Point}
       */

    }, {
      key: "getCursor",
      value: function getCursor() {
        return this.cursor;
      }

      /**
       * Counts the number of cells of this grid with the specified character
       * @param {string} ch
       * @returns {number}
       */

    }, {
      key: "countCharsLike",
      value: function countCharsLike(ch) {
        var result = 0;
        for (var py = 0; py < this.nRows; py++) {
          for (var px = 0; px < this.nCols; px++) {
            if (this.chars[py][px] === ch) result++;
          }
        }return result;
      }

      /**
       * Gets the number of cells of this grid
       * @returns {number}
       */

    }, {
      key: "getNumCells",
      value: function getNumCells() {
        return this.nRows * this.nCols;
      }

      /**
       * Counts the number of coincidences between the `answers` array and the current content of this grid
       * @param {boolean} checkCase - Make comparisions case-sensitive
       * @returns {number}
       */

    }, {
      key: "countCoincidences",
      value: function countCoincidences(checkCase) {
        var result = 0;
        if (this.answers) for (var py = 0; py < this.nRows; py++) {
          for (var px = 0; px < this.nCols; px++) {
            if (this.isCellOk(px, py, checkCase)) result++;
          }
        }return result;
      }

      /**
       * Checks if a specific cell is equivalent to the content of `answers` at its position
       * @param {number} px - X coordinate
       * @param {number} py - Y coordinate
       * @param {boolean} checkCase - Make comparisions case-sensitive
       * @returns {boolean}
       */

    }, {
      key: "isCellOk",
      value: function isCellOk(px, py, checkCase) {
        var result = false;
        if (this.isValidCell(px, py)) {
          var ch = this.chars[py][px];
          if (ch !== this.wild) {
            var ch2 = this.answers[py][px];
            if (ch === ch2 || !checkCase && ch.toUpperCase() === ch2.toUpperCase()) result = true;
          }
        }
        return result;
      }

      /**
       * Gets the logical coordinates (in 'cell' units) of a device point into the grid
       * @param {AWT.Point} devicePoint
       * @returns {AWT.Point}
       */

    }, {
      key: "getLogicalCoords",
      value: function getLogicalCoords(devicePoint) {
        if (!this.contains(devicePoint)) return null;
        var px = Math.floor((devicePoint.x - this.pos.x) / this.cellWidth),
            py = Math.floor((devicePoint.y - this.pos.y) / this.cellHeight);

        return this.isValidCell(px, py) ? new AWT.Point(px, py) : null;
      }

      /**
       * Checks if the specified logical coordinates are inside the valid bounds of the grid.
       * @param {number} px - 'X' coordinate
       * @param {number} py - 'Y' coordinate
       * @returns {boolean}
       */

    }, {
      key: "isValidCell",
      value: function isValidCell(px, py) {
        return px < this.nCols && py < this.nRows && px >= 0 && py >= 0;
      }

      /**
       * Sets the specified character as a content of the cell at specified coordinates
       * @param {number} px - 'X' coordinate
       * @param {number} py - 'Y' coordinate
       * @param {string} ch - The character to set.
       */

    }, {
      key: "setCharAt",
      value: function setCharAt(px, py, ch) {
        if (this.isValidCell(px, py)) {
          this.chars[py][px] = ch;
          this.repaintCell(px, py);
        }
      }

      /**
       * Gets the character of the cell at the specified coordinates
       * @param {number} px - 'X' coordinate
       * @param {number} py - 'Y' coordinate
       * @returns {string}
       */

    }, {
      key: "getCharAt",
      value: function getCharAt(px, py) {
        return this.isValidCell(px, py) ? this.chars[py][px] : ' ';
      }

      /**
       * Gets the text formed by the letters between two cells that share a straight line on the grid.
       * The text can be formed horizontally, vertically and diagonal, both in left-to-right or
       * right-to-left direction.
       * @param {number} x0 - 'X' coordinate of the first cell
       * @param {number} y0 - 'Y' coordinate of the first cell
       * @param {number} x1 - 'X' coordinate of the second cell
       * @param {number} y1 - 'Y' coordinate of the second cell
       * @returns {string}
       */

    }, {
      key: "getStringBetween",
      value: function getStringBetween(x0, y0, x1, y1) {
        var sb = '';
        if (this.isValidCell(x0, y0) && this.isValidCell(x1, y1)) {
          var dx = x1 - x0,
              dy = y1 - y0;
          if (dx === 0 || dy === 0 || Math.abs(dx) === Math.abs(dy)) {
            var steps = Math.max(Math.abs(dx), Math.abs(dy));
            if (steps > 0) {
              dx /= steps;
              dy /= steps;
            }
            for (var i = 0; i <= steps; i++) {
              sb += this.getCharAt(x0 + dx * i, y0 + dy * i);
            }
          }
        }
        return sb;
      }

      /**
       * Sets a specific attribute to all cells forming a straight line between two cells on the grid.
       * @param {number} x0 - 'X' coordinate of the first cell
       * @param {number} y0 - 'Y' coordinate of the first cell
       * @param {number} x1 - 'X' coordinate of the second cell
       * @param {number} y1 - 'Y' coordinate of the second cell
       * @param {number} attribute - The binary flag representing this attribute. See {@link TextGrid.flags}.
       * @param {boolean} value - Whether to set or unset the attribute.
       */

    }, {
      key: "setAttributeBetween",
      value: function setAttributeBetween(x0, y0, x1, y1, attribute, value) {
        if (this.isValidCell(x0, y0) && this.isValidCell(x1, y1)) {
          var dx = x1 - x0,
              dy = y1 - y0;

          if (dx === 0 || dy === 0 || Math.abs(dx) === Math.abs(dy)) {
            var steps = Math.max(Math.abs(dx), Math.abs(dy));
            if (steps > 0) {
              dx /= steps;
              dy /= steps;
            }
            for (var i = 0; i <= steps; i++) {
              this.setAttribute(x0 + dx * i, y0 + dy * i, attribute, value);
            }
          }
        }
      }

      /**
       * Sets or unsets a specifi attrobut to a cell.
       * @param {number} px - The 'X' coordinate of the cell
       * @param {number} py - The 'Y' coordinate of the cell
       * @param {number} attribute - The binary flag representing this attribute. See {@link TextGrid.flags}.
       * @param {boolean} state - Whether to set or unset the attribute.
       */

    }, {
      key: "setAttribute",
      value: function setAttribute(px, py, attribute, state) {
        if (this.isValidCell(px, py)) {
          if (this.attribute === flags.MARKED && !state) this.repaintCell(px, py);
          this.attributes[py][px] &= ~attribute;
          this.attributes[py][px] |= state ? attribute : 0;
          if (attribute !== flags.MARKED || state) this.repaintCell(px, py);
        }
      }

      /**
       * Sets the specified attribute to all cells.
       * @param {number} attribute - The binary flag representing this attribute. See {@link TextGrid.flags}.
       * @param {boolean} state - Whether to set or unset the attribute.
       */

    }, {
      key: "setAllCellsAttribute",
      value: function setAllCellsAttribute(attribute, state) {
        for (var py = 0; py < this.nRows; py++) {
          for (var px = 0; px < this.nCols; px++) {
            this.setAttribute(px, py, attribute, state);
          }
        }
      }

      /**
       * Gets the specified attribute of a cell
       * @param {number} px - The 'X' coordinate of the cell
       * @param {number} py - The 'Y' coordinate of the cell
       * @param {number} attribute - The binary flag representing this attribute. See {@link TextGrid.flags}.
       * @returns {boolean} - `true` if the cell has this attribute, `false` otherwise.
       */

    }, {
      key: "getCellAttribute",
      value: function getCellAttribute(px, py, attribute) {
        return this.isValidCell(px, py) ? (this.attributes[py][px] & attribute) !== 0 : false;
      }

      /**
       * Gets the rectangle enclosing a specific cell
       * @param {number} px - The 'X' coordinate of the cell
       * @param {number} py - The 'Y' coordinate of the cell
       * @returns {AWT.Rectangle}
       */

    }, {
      key: "getCellRect",
      value: function getCellRect(px, py) {
        return new AWT.Rectangle(this.pos.x + px * this.cellWidth, this.pos.y + py * this.cellHeight, this.cellWidth, this.cellHeight);
      }

      /**
       * Gets the rectangle enclosing a specific cell, including the border thick.
       * @param {number} px - The 'X' coordinate of the cell
       * @param {number} py - The 'Y' coordinate of the cell
       * @returns {AWT.Rectangle}
       */

    }, {
      key: "getCellBorderBounds",
      value: function getCellBorderBounds(px, py) {
        var isMarked = this.getCellAttribute(px, py, flags.MARKED);
        if (!this.border && !isMarked) return this.getCellRect(px, py);

        var bb = this.getBoxBaseResolve(),
            strk = isMarked ? bb.markerStroke : bb.borderStroke;

        return this.getCellRect(px, py).grow(strk.lineWidth, strk.lineWidth);
      }

      /**
       * Repaints a cell
       * @param {number} px - The 'X' coordinate of the cell
       * @param {number} py - The 'Y' coordinate of the cell
       */

    }, {
      key: "repaintCell",
      value: function repaintCell(px, py) {
        if (this.container) this.container.invalidate(this.getCellBorderBounds(px, py)).update();
      }

      /**
       * Gets the preferred size of this grid
       * @returns {AWT.Dimension}
       */

    }, {
      key: "getPreferredSize",
      value: function getPreferredSize() {
        return this.preferredBounds.dim;
      }

      /**
       * Gets the minimum size of this grid
       * @returns {AWT.Dimension}
       */

    }, {
      key: "getMinimumSize",
      value: function getMinimumSize() {
        return new AWT.Dimension(defaults.MIN_CELL_SIZE * this.nCols, defaults.MIN_CELL_SIZE * this.nRows);
      }

      /**
       * Scales the grid to a new size
       * @param {number} scale - The factor used to multiply all coordinates and sizes
       * @returns {AWT.Dimension}
       */

    }, {
      key: "getScaledSize",
      value: function getScaledSize(scale) {
        return new AWT.Dimension(Utils.roundTo(scale * this.preferredBounds.dim.width, this.nCols), Utils.roundTo(scale * this.preferredBounds.dim.height, this.nRows));
      }

      /**
       * Overrides {@link AbstractBox#setBounds}
       * @override
       * @param {(AWT.Rectangle|number)} rect - An AWT.Rectangle object, or the `x` coordinate of the
       * upper-left corner of a new rectangle.
       * @param {number=} y - `y` coordinate of the upper-left corner of the new rectangle.
       * @param {number=} w - Width of the new rectangle.
       * @param {number=} h - Height of the new rectangle.
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect, y, w, h) {
        _get(TextGrid.prototype.__proto__ || Object.getPrototypeOf(TextGrid.prototype), "setBounds", this).call(this, rect, y, w, h);
        this.cellWidth = this.dim.width / this.nCols;
        this.cellHeight = this.dim.height / this.nRows;
      }

      /**
       * Overrides {@link AbstractBox#updateContent}
       * @override
       * @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context used to draw the
       * grid.
       * @param {AWT.Rectangle=} dirtyRegion - The area that must be repainted. `null` refers to the whole box.
       */

    }, {
      key: "updateContent",
      value: function updateContent(ctx, dirtyRegion) {
        var bb = this.getBoxBaseResolve();

        // test font size
        ctx.font = bb.font.cssFont();
        ctx.textBaseline = 'hanging';
        bb.prepareText(ctx, 'W', this.cellWidth - 2 * defaults.MIN_INTERNAL_MARGIN, this.cellHeight - 2 * defaults.MIN_INTERNAL_MARGIN);

        var ch = [];
        //
        // TODO: Check in different browsers and devices what is the real font height.
        // In Chrome on Linux (Gnome), subtracting `bb.font._metrics.descent / 4` produces
        // good results, but in iPad this correction places the character at the bottom of the cell.
        var ry = (this.cellHeight - bb.font.getHeight()) / 2;

        for (var py = 0; py < this.nRows; py++) {
          for (var px = 0; px < this.nCols; px++) {
            var bxr = this.getCellBorderBounds(px, py);
            if (bxr.intersects(dirtyRegion)) {
              var attr = this.attributes[py][px];
              if ((attr & flags.TRANSPARENT) === 0) {
                var isInverted = (attr & flags.INVERTED) !== 0;
                var isMarked = (attr & flags.MARKED) !== 0;
                var isCursor = this.useCursor && this.cursor.x === px && this.cursor.y === py;
                var boxBounds = this.getCellRect(px, py);
                ctx.fillStyle = isCursor && this.cursorBlink ? bb.inactiveColor : isInverted ? bb.textColor : bb.backColor;
                boxBounds.fill(ctx);
                ctx.strokeStyle = 'black';
                if ((attr & flags.HIDDEN) === 0) {
                  ch[0] = this.chars[py][px];
                  if (ch[0]) {
                    var dx = boxBounds.pos.x + (this.cellWidth - ctx.measureText(ch[0]).width) / 2;
                    var dy = boxBounds.pos.y + ry;

                    if (bb.shadow) {
                      // Render text shadow
                      var d = Math.max(1, bb.font.size / 10);
                      ctx.fillStyle = bb.shadowColor;
                      ctx.fillText(ch[0], dx + d, dy + d);
                    }
                    // Render text
                    ctx.fillStyle = isInverted ? bb.backColor : this.isAlternative() ? bb.alternativeColor : bb.textColor;
                    ctx.fillText(ch[0], dx, dy);
                  }
                }
                if (this.border || isMarked) {
                  ctx.strokeStyle = bb.borderColor;
                  bb[isMarked ? 'markerStroke' : 'borderStroke'].setStroke(ctx);
                  if (isMarked) ctx.globalCompositeOperation = 'xor';

                  // Draw border
                  boxBounds.stroke(ctx);

                  // Reset ctx default values
                  if (isMarked) ctx.globalCompositeOperation = 'source-over';
                }
                ctx.strokeStyle = 'black';
                AWT.Stroke.prototype.setStroke(ctx);
              }
            }
          }
        }
        return true;
      }

      /**
       * Makes the cursor blink, alternating between two states. This method should be called only by
       * {@link TextGrid#cursorTimer}
       * @param {boolean} status
       */

    }, {
      key: "blink",
      value: function blink(status) {
        // TODO: Move blink and timer to ActivityPanel
        if (this.useCursor) {
          this.cursorBlink = status === 1 ? true : status === -1 ? false : !this.cursorBlink;
          this.repaintCell(this.cursor.x, this.cursor.y);
        }
      }

      /**
       * Stops the cursor timer if not `null` and active
       */

    }, {
      key: "end",
      value: function end() {
        if (this.cursorTimer) {
          this.cursorTimer.stop();
          this.cursorTimer = null;
        }
      }
    }], [{
      key: "createEmptyGrid",
      value: function createEmptyGrid(parent, container, x, y, tgc, wildTransparent) {
        var result = new TextGrid(parent, container, tgc.bb, x, y, tgc.ncw, tgc.nch, tgc.w, tgc.h, tgc.border);
        result.wild = tgc.wild;
        result.randomChars = tgc.randomChars;
        result.wildTransparent = wildTransparent;
        return result;
      }
    }]);

    return TextGrid;
  }(AbstractBox);

  Object.assign(TextGrid.prototype, {
    /**
     * Number of rows
     * @name TextGrid#nRows
     * @type {number} */
    nRows: 1,
    /**
     * Number of columns
     * @name TextGrid#nCols
     * @type {number} */
    nCols: 1,
    /**
     * Two-dimension array of characters
     * @name TextGrid#chars
     * @type {string[][]} */
    chars: null,
    /**
     * Two-dimension array with the expected characters, used to check user's answers.
     * @name TextGrid#answers
     * @type {string[][]} */
    answers: null,
    /**
     * Two-dimension array of bytes used as containers of boolean attributes
     * @name TextGrid#attributes
     * @see TextGrid.flags
     * @type {number[][]} */
    attributes: null,
    /**
     * The cell width, in pixels
     * @name TextGrid#cellWidth
     * @type {number} */
    cellWidth: 20,
    /**
     * The cell height, in pixels
     * @name TextGrid#cellHeight
     * @type {number} */
    cellHeight: 20,
    /**
     * The preferred bounds of this grid
     * @name TextGrid#preferredBounds
     * @type {AWT.Rectangle} */
    preferredBounds: null,
    /**
     * The character to be used as wildcard
     * @name TextGrid#wild
     * @type {string} */
    wild: TextGridContent.prototype.wild,
    /**
     * Characters that can be used when randomizing the content of this grid
     * @name TextGrid#randomChars
     * @see TextGridContent#randomChars
     * @type {string} */
    randomChars: TextGridContent.prototype.randomChars,
    /**
     * Whether the blinking cursor is enabled or disabled
     * @name TextGrid#cursorEnabled
     * @type {boolean} */
    cursorEnabled: false,
    /**
     * Whether this grid uses a blinking cursor or not
     * @name TextGrid#useCursor
     * @type {boolean} */
    useCursor: false,
    /**
     * The current position of the cursor
     * @name TextGrid#cursor
     * @type {AWT.Point} */
    cursor: null,
    /**
     * `true` when the cursor is "blinking" (cell drawn with {@link BoxBase} `inverse` attributes)
     * @name TextGrid#cursorBlink
     * @type {boolean} */
    cursorBlink: false,
    /**
     * Controls the blinking of the cursor
     * @name TextGrid#cursorTimer
     * @type {AWT.Timer} */
    cursorTimer: null,
    /**
     * Whether the wildcard character is transparent or opaque
     * @name TextGrid#wildTransparent
     * @type {boolean} */
    wildTransparent: false
  });

  /**
   * TextGrid default values
   * @name TextGrid.defaults
   * @constant
   * @type {object} */
  TextGrid.defaults = defaults;

  /**
   * Binary flags used to mark status
   * @name TextGrid.flags
   * @constant
   * @type {object} */
  TextGrid.flags = flags;

  return TextGrid;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 217 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(218);
module.exports = __webpack_require__(420);


/***/ }),
/* 218 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {

__webpack_require__(219);

__webpack_require__(416);

__webpack_require__(417);

if (global._babelPolyfill) {
  throw new Error("only one instance of babel-polyfill is allowed");
}
global._babelPolyfill = true;

var DEFINE_PROPERTY = "defineProperty";
function define(O, key, value) {
  O[key] || Object[DEFINE_PROPERTY](O, key, {
    writable: true,
    configurable: true,
    value: value
  });
}

define(String.prototype, "padLeft", "".padStart);
define(String.prototype, "padRight", "".padEnd);

"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function (key) {
  [][key] && define(Array, key, Function.call.bind([][key]));
});
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(43)))

/***/ }),
/* 219 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(220);
__webpack_require__(222);
__webpack_require__(223);
__webpack_require__(224);
__webpack_require__(225);
__webpack_require__(226);
__webpack_require__(227);
__webpack_require__(228);
__webpack_require__(229);
__webpack_require__(230);
__webpack_require__(231);
__webpack_require__(232);
__webpack_require__(233);
__webpack_require__(234);
__webpack_require__(235);
__webpack_require__(236);
__webpack_require__(238);
__webpack_require__(239);
__webpack_require__(240);
__webpack_require__(241);
__webpack_require__(242);
__webpack_require__(243);
__webpack_require__(244);
__webpack_require__(245);
__webpack_require__(246);
__webpack_require__(247);
__webpack_require__(248);
__webpack_require__(249);
__webpack_require__(250);
__webpack_require__(251);
__webpack_require__(252);
__webpack_require__(253);
__webpack_require__(254);
__webpack_require__(255);
__webpack_require__(256);
__webpack_require__(257);
__webpack_require__(258);
__webpack_require__(259);
__webpack_require__(260);
__webpack_require__(261);
__webpack_require__(262);
__webpack_require__(263);
__webpack_require__(264);
__webpack_require__(265);
__webpack_require__(266);
__webpack_require__(267);
__webpack_require__(268);
__webpack_require__(269);
__webpack_require__(270);
__webpack_require__(271);
__webpack_require__(272);
__webpack_require__(273);
__webpack_require__(274);
__webpack_require__(275);
__webpack_require__(276);
__webpack_require__(277);
__webpack_require__(278);
__webpack_require__(279);
__webpack_require__(280);
__webpack_require__(281);
__webpack_require__(282);
__webpack_require__(283);
__webpack_require__(284);
__webpack_require__(285);
__webpack_require__(286);
__webpack_require__(287);
__webpack_require__(288);
__webpack_require__(289);
__webpack_require__(290);
__webpack_require__(291);
__webpack_require__(292);
__webpack_require__(293);
__webpack_require__(294);
__webpack_require__(295);
__webpack_require__(296);
__webpack_require__(297);
__webpack_require__(298);
__webpack_require__(300);
__webpack_require__(301);
__webpack_require__(303);
__webpack_require__(304);
__webpack_require__(305);
__webpack_require__(306);
__webpack_require__(307);
__webpack_require__(308);
__webpack_require__(309);
__webpack_require__(311);
__webpack_require__(312);
__webpack_require__(313);
__webpack_require__(314);
__webpack_require__(315);
__webpack_require__(316);
__webpack_require__(317);
__webpack_require__(318);
__webpack_require__(319);
__webpack_require__(320);
__webpack_require__(321);
__webpack_require__(322);
__webpack_require__(323);
__webpack_require__(121);
__webpack_require__(324);
__webpack_require__(325);
__webpack_require__(159);
__webpack_require__(326);
__webpack_require__(327);
__webpack_require__(328);
__webpack_require__(329);
__webpack_require__(330);
__webpack_require__(162);
__webpack_require__(164);
__webpack_require__(165);
__webpack_require__(331);
__webpack_require__(332);
__webpack_require__(333);
__webpack_require__(334);
__webpack_require__(335);
__webpack_require__(336);
__webpack_require__(337);
__webpack_require__(338);
__webpack_require__(339);
__webpack_require__(340);
__webpack_require__(341);
__webpack_require__(342);
__webpack_require__(343);
__webpack_require__(344);
__webpack_require__(345);
__webpack_require__(346);
__webpack_require__(347);
__webpack_require__(348);
__webpack_require__(349);
__webpack_require__(350);
__webpack_require__(351);
__webpack_require__(352);
__webpack_require__(353);
__webpack_require__(354);
__webpack_require__(355);
__webpack_require__(356);
__webpack_require__(357);
__webpack_require__(358);
__webpack_require__(359);
__webpack_require__(360);
__webpack_require__(361);
__webpack_require__(362);
__webpack_require__(363);
__webpack_require__(364);
__webpack_require__(365);
__webpack_require__(366);
__webpack_require__(367);
__webpack_require__(368);
__webpack_require__(369);
__webpack_require__(370);
__webpack_require__(371);
__webpack_require__(372);
__webpack_require__(373);
__webpack_require__(374);
__webpack_require__(375);
__webpack_require__(376);
__webpack_require__(377);
__webpack_require__(378);
__webpack_require__(379);
__webpack_require__(380);
__webpack_require__(381);
__webpack_require__(382);
__webpack_require__(383);
__webpack_require__(384);
__webpack_require__(385);
__webpack_require__(386);
__webpack_require__(387);
__webpack_require__(388);
__webpack_require__(389);
__webpack_require__(390);
__webpack_require__(391);
__webpack_require__(392);
__webpack_require__(393);
__webpack_require__(394);
__webpack_require__(395);
__webpack_require__(396);
__webpack_require__(397);
__webpack_require__(398);
__webpack_require__(399);
__webpack_require__(400);
__webpack_require__(401);
__webpack_require__(402);
__webpack_require__(403);
__webpack_require__(404);
__webpack_require__(405);
__webpack_require__(406);
__webpack_require__(407);
__webpack_require__(408);
__webpack_require__(409);
__webpack_require__(410);
__webpack_require__(411);
__webpack_require__(412);
__webpack_require__(413);
__webpack_require__(414);
__webpack_require__(415);
module.exports = __webpack_require__(28);

/***/ }),
/* 220 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// ECMAScript 6 symbols shim

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var global = __webpack_require__(5);
var has = __webpack_require__(16);
var DESCRIPTORS = __webpack_require__(10);
var $export = __webpack_require__(0);
var redefine = __webpack_require__(18);
var META = __webpack_require__(39).KEY;
var $fails = __webpack_require__(6);
var shared = __webpack_require__(77);
var setToStringTag = __webpack_require__(59);
var uid = __webpack_require__(45);
var wks = __webpack_require__(8);
var wksExt = __webpack_require__(142);
var wksDefine = __webpack_require__(101);
var enumKeys = __webpack_require__(221);
var isArray = __webpack_require__(80);
var anObject = __webpack_require__(4);
var isObject = __webpack_require__(7);
var toIObject = __webpack_require__(20);
var toPrimitive = __webpack_require__(29);
var createDesc = __webpack_require__(44);
var _create = __webpack_require__(49);
var gOPNExt = __webpack_require__(145);
var $GOPD = __webpack_require__(21);
var $DP = __webpack_require__(11);
var $keys = __webpack_require__(47);
var gOPD = $GOPD.f;
var dP = $DP.f;
var gOPN = gOPNExt.f;
var $Symbol = global.Symbol;
var $JSON = global.JSON;
var _stringify = $JSON && $JSON.stringify;
var PROTOTYPE = 'prototype';
var HIDDEN = wks('_hidden');
var TO_PRIMITIVE = wks('toPrimitive');
var isEnum = {}.propertyIsEnumerable;
var SymbolRegistry = shared('symbol-registry');
var AllSymbols = shared('symbols');
var OPSymbols = shared('op-symbols');
var ObjectProto = Object[PROTOTYPE];
var USE_NATIVE = typeof $Symbol == 'function';
var QObject = global.QObject;
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;

// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
var setSymbolDesc = DESCRIPTORS && $fails(function () {
  return _create(dP({}, 'a', {
    get: function get() {
      return dP(this, 'a', { value: 7 }).a;
    }
  })).a != 7;
}) ? function (it, key, D) {
  var protoDesc = gOPD(ObjectProto, key);
  if (protoDesc) delete ObjectProto[key];
  dP(it, key, D);
  if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
} : dP;

var wrap = function wrap(tag) {
  var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
  sym._k = tag;
  return sym;
};

var isSymbol = USE_NATIVE && _typeof($Symbol.iterator) == 'symbol' ? function (it) {
  return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) == 'symbol';
} : function (it) {
  return it instanceof $Symbol;
};

var $defineProperty = function defineProperty(it, key, D) {
  if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
  anObject(it);
  key = toPrimitive(key, true);
  anObject(D);
  if (has(AllSymbols, key)) {
    if (!D.enumerable) {
      if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
      it[HIDDEN][key] = true;
    } else {
      if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
      D = _create(D, { enumerable: createDesc(0, false) });
    }return setSymbolDesc(it, key, D);
  }return dP(it, key, D);
};
var $defineProperties = function defineProperties(it, P) {
  anObject(it);
  var keys = enumKeys(P = toIObject(P));
  var i = 0;
  var l = keys.length;
  var key;
  while (l > i) {
    $defineProperty(it, key = keys[i++], P[key]);
  }return it;
};
var $create = function create(it, P) {
  return P === undefined ? _create(it) : $defineProperties(_create(it), P);
};
var $propertyIsEnumerable = function propertyIsEnumerable(key) {
  var E = isEnum.call(this, key = toPrimitive(key, true));
  if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
  return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
};
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
  it = toIObject(it);
  key = toPrimitive(key, true);
  if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
  var D = gOPD(it, key);
  if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
  return D;
};
var $getOwnPropertyNames = function getOwnPropertyNames(it) {
  var names = gOPN(toIObject(it));
  var result = [];
  var i = 0;
  var key;
  while (names.length > i) {
    if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
  }return result;
};
var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
  var IS_OP = it === ObjectProto;
  var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
  var result = [];
  var i = 0;
  var key;
  while (names.length > i) {
    if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
  }return result;
};

// 19.4.1.1 Symbol([description])
if (!USE_NATIVE) {
  $Symbol = function _Symbol() {
    if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
    var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
    var $set = function $set(value) {
      if (this === ObjectProto) $set.call(OPSymbols, value);
      if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
      setSymbolDesc(this, tag, createDesc(1, value));
    };
    if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
    return wrap(tag);
  };
  redefine($Symbol[PROTOTYPE], 'toString', function toString() {
    return this._k;
  });

  $GOPD.f = $getOwnPropertyDescriptor;
  $DP.f = $defineProperty;
  __webpack_require__(50).f = gOPNExt.f = $getOwnPropertyNames;
  __webpack_require__(68).f = $propertyIsEnumerable;
  __webpack_require__(79).f = $getOwnPropertySymbols;

  if (DESCRIPTORS && !__webpack_require__(46)) {
    redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
  }

  wksExt.f = function (name) {
    return wrap(wks(name));
  };
}

$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });

for (var es6Symbols =
// 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'.split(','), j = 0; es6Symbols.length > j;) {
  wks(es6Symbols[j++]);
}for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) {
  wksDefine(wellKnownSymbols[k++]);
}$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
  // 19.4.2.1 Symbol.for(key)
  'for': function _for(key) {
    return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key);
  },
  // 19.4.2.5 Symbol.keyFor(sym)
  keyFor: function keyFor(sym) {
    if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
    for (var key in SymbolRegistry) {
      if (SymbolRegistry[key] === sym) return key;
    }
  },
  useSetter: function useSetter() {
    setter = true;
  },
  useSimple: function useSimple() {
    setter = false;
  }
});

$export($export.S + $export.F * !USE_NATIVE, 'Object', {
  // 19.1.2.2 Object.create(O [, Properties])
  create: $create,
  // 19.1.2.4 Object.defineProperty(O, P, Attributes)
  defineProperty: $defineProperty,
  // 19.1.2.3 Object.defineProperties(O, Properties)
  defineProperties: $defineProperties,
  // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
  // 19.1.2.7 Object.getOwnPropertyNames(O)
  getOwnPropertyNames: $getOwnPropertyNames,
  // 19.1.2.8 Object.getOwnPropertySymbols(O)
  getOwnPropertySymbols: $getOwnPropertySymbols
});

// 24.3.2 JSON.stringify(value [, replacer [, space]])
$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
  var S = $Symbol();
  // MS Edge converts symbol values to JSON as {}
  // WebKit converts symbol values to JSON as null
  // V8 throws on boxed symbols
  return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
})), 'JSON', {
  stringify: function stringify(it) {
    var args = [it];
    var i = 1;
    var replacer, $replacer;
    while (arguments.length > i) {
      args.push(arguments[i++]);
    }$replacer = replacer = args[1];
    if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
    if (!isArray(replacer)) replacer = function replacer(key, value) {
      if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
      if (!isSymbol(value)) return value;
    };
    args[1] = replacer;
    return _stringify.apply($JSON, args);
  }
});

// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(17)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setToStringTag($Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, 'JSON', true);

/***/ }),
/* 221 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// all enumerable object keys, includes symbols
var getKeys = __webpack_require__(47);
var gOPS = __webpack_require__(79);
var pIE = __webpack_require__(68);
module.exports = function (it) {
  var result = getKeys(it);
  var getSymbols = gOPS.f;
  if (getSymbols) {
    var symbols = getSymbols(it);
    var isEnum = pIE.f;
    var i = 0;
    var key;
    while (symbols.length > i) {
      if (isEnum.call(it, key = symbols[i++])) result.push(key);
    }
  }return result;
};

/***/ }),
/* 222 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
$export($export.S, 'Object', { create: __webpack_require__(49) });

/***/ }),
/* 223 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
$export($export.S + $export.F * !__webpack_require__(10), 'Object', { defineProperty: __webpack_require__(11).f });

/***/ }),
/* 224 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
$export($export.S + $export.F * !__webpack_require__(10), 'Object', { defineProperties: __webpack_require__(144) });

/***/ }),
/* 225 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
var toIObject = __webpack_require__(20);
var $getOwnPropertyDescriptor = __webpack_require__(21).f;

__webpack_require__(32)('getOwnPropertyDescriptor', function () {
  return function getOwnPropertyDescriptor(it, key) {
    return $getOwnPropertyDescriptor(toIObject(it), key);
  };
});

/***/ }),
/* 226 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.9 Object.getPrototypeOf(O)
var toObject = __webpack_require__(14);
var $getPrototypeOf = __webpack_require__(22);

__webpack_require__(32)('getPrototypeOf', function () {
  return function getPrototypeOf(it) {
    return $getPrototypeOf(toObject(it));
  };
});

/***/ }),
/* 227 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.14 Object.keys(O)
var toObject = __webpack_require__(14);
var $keys = __webpack_require__(47);

__webpack_require__(32)('keys', function () {
  return function keys(it) {
    return $keys(toObject(it));
  };
});

/***/ }),
/* 228 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.7 Object.getOwnPropertyNames(O)
__webpack_require__(32)('getOwnPropertyNames', function () {
  return __webpack_require__(145).f;
});

/***/ }),
/* 229 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.5 Object.freeze(O)
var isObject = __webpack_require__(7);
var meta = __webpack_require__(39).onFreeze;

__webpack_require__(32)('freeze', function ($freeze) {
  return function freeze(it) {
    return $freeze && isObject(it) ? $freeze(meta(it)) : it;
  };
});

/***/ }),
/* 230 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.17 Object.seal(O)
var isObject = __webpack_require__(7);
var meta = __webpack_require__(39).onFreeze;

__webpack_require__(32)('seal', function ($seal) {
  return function seal(it) {
    return $seal && isObject(it) ? $seal(meta(it)) : it;
  };
});

/***/ }),
/* 231 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.15 Object.preventExtensions(O)
var isObject = __webpack_require__(7);
var meta = __webpack_require__(39).onFreeze;

__webpack_require__(32)('preventExtensions', function ($preventExtensions) {
  return function preventExtensions(it) {
    return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it;
  };
});

/***/ }),
/* 232 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.12 Object.isFrozen(O)
var isObject = __webpack_require__(7);

__webpack_require__(32)('isFrozen', function ($isFrozen) {
  return function isFrozen(it) {
    return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;
  };
});

/***/ }),
/* 233 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.13 Object.isSealed(O)
var isObject = __webpack_require__(7);

__webpack_require__(32)('isSealed', function ($isSealed) {
  return function isSealed(it) {
    return isObject(it) ? $isSealed ? $isSealed(it) : false : true;
  };
});

/***/ }),
/* 234 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.2.11 Object.isExtensible(O)
var isObject = __webpack_require__(7);

__webpack_require__(32)('isExtensible', function ($isExtensible) {
  return function isExtensible(it) {
    return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;
  };
});

/***/ }),
/* 235 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.3.1 Object.assign(target, source)
var $export = __webpack_require__(0);

$export($export.S + $export.F, 'Object', { assign: __webpack_require__(146) });

/***/ }),
/* 236 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.3.10 Object.is(value1, value2)
var $export = __webpack_require__(0);
$export($export.S, 'Object', { is: __webpack_require__(237) });

/***/ }),
/* 237 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 7.2.9 SameValue(x, y)
module.exports = Object.is || function is(x, y) {
  // eslint-disable-next-line no-self-compare
  return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
};

/***/ }),
/* 238 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $export = __webpack_require__(0);
$export($export.S, 'Object', { setPrototypeOf: __webpack_require__(105).set });

/***/ }),
/* 239 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// 19.1.3.6 Object.prototype.toString()

var classof = __webpack_require__(69);
var test = {};
test[__webpack_require__(8)('toStringTag')] = 'z';
if (test + '' != '[object z]') {
  __webpack_require__(18)(Object.prototype, 'toString', function toString() {
    return '[object ' + classof(this) + ']';
  }, true);
}

/***/ }),
/* 240 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
var $export = __webpack_require__(0);

$export($export.P, 'Function', { bind: __webpack_require__(147) });

/***/ }),
/* 241 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var dP = __webpack_require__(11).f;
var FProto = Function.prototype;
var nameRE = /^\s*function ([^ (]*)/;
var NAME = 'name';

// 19.2.4.2 name
NAME in FProto || __webpack_require__(10) && dP(FProto, NAME, {
  configurable: true,
  get: function get() {
    try {
      return ('' + this).match(nameRE)[1];
    } catch (e) {
      return '';
    }
  }
});

/***/ }),
/* 242 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var isObject = __webpack_require__(7);
var getPrototypeOf = __webpack_require__(22);
var HAS_INSTANCE = __webpack_require__(8)('hasInstance');
var FunctionProto = Function.prototype;
// 19.2.3.6 Function.prototype[@@hasInstance](V)
if (!(HAS_INSTANCE in FunctionProto)) __webpack_require__(11).f(FunctionProto, HAS_INSTANCE, { value: function value(O) {
    if (typeof this != 'function' || !isObject(O)) return false;
    if (!isObject(this.prototype)) return O instanceof this;
    // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
    while (O = getPrototypeOf(O)) {
      if (this.prototype === O) return true;
    }return false;
  } });

/***/ }),
/* 243 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $parseInt = __webpack_require__(149);
// 18.2.5 parseInt(string, radix)
$export($export.G + $export.F * (parseInt != $parseInt), { parseInt: $parseInt });

/***/ }),
/* 244 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $parseFloat = __webpack_require__(150);
// 18.2.4 parseFloat(string)
$export($export.G + $export.F * (parseFloat != $parseFloat), { parseFloat: $parseFloat });

/***/ }),
/* 245 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var global = __webpack_require__(5);
var has = __webpack_require__(16);
var cof = __webpack_require__(26);
var inheritIfRequired = __webpack_require__(107);
var toPrimitive = __webpack_require__(29);
var fails = __webpack_require__(6);
var gOPN = __webpack_require__(50).f;
var gOPD = __webpack_require__(21).f;
var dP = __webpack_require__(11).f;
var $trim = __webpack_require__(60).trim;
var NUMBER = 'Number';
var $Number = global[NUMBER];
var Base = $Number;
var proto = $Number.prototype;
// Opera ~12 has broken Object#toString
var BROKEN_COF = cof(__webpack_require__(49)(proto)) == NUMBER;
var TRIM = 'trim' in String.prototype;

// 7.1.3 ToNumber(argument)
var toNumber = function toNumber(argument) {
  var it = toPrimitive(argument, false);
  if (typeof it == 'string' && it.length > 2) {
    it = TRIM ? it.trim() : $trim(it, 3);
    var first = it.charCodeAt(0);
    var third, radix, maxCode;
    if (first === 43 || first === 45) {
      third = it.charCodeAt(2);
      if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
    } else if (first === 48) {
      switch (it.charCodeAt(1)) {
        case 66:case 98:
          radix = 2;maxCode = 49;break; // fast equal /^0b[01]+$/i
        case 79:case 111:
          radix = 8;maxCode = 55;break; // fast equal /^0o[0-7]+$/i
        default:
          return +it;
      }
      for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) {
        code = digits.charCodeAt(i);
        // parseInt parses a string to a first unavailable symbol
        // but ToNumber should return NaN if a string contains unavailable symbols
        if (code < 48 || code > maxCode) return NaN;
      }return parseInt(digits, radix);
    }
  }return +it;
};

if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) {
  $Number = function Number(value) {
    var it = arguments.length < 1 ? 0 : value;
    var that = this;
    return that instanceof $Number
    // check on 1..constructor(foo) case
    && (BROKEN_COF ? fails(function () {
      proto.valueOf.call(that);
    }) : cof(that) != NUMBER) ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it);
  };
  for (var keys = __webpack_require__(10) ? gOPN(Base) : (
  // ES3:
  'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
  // ES6 (in case, if modules with ES6 Number statics required before):
  'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger').split(','), j = 0, key; keys.length > j; j++) {
    if (has(Base, key = keys[j]) && !has($Number, key)) {
      dP($Number, key, gOPD(Base, key));
    }
  }
  $Number.prototype = proto;
  proto.constructor = $Number;
  __webpack_require__(18)(global, NUMBER, $Number);
}

/***/ }),
/* 246 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var toInteger = __webpack_require__(31);
var aNumberValue = __webpack_require__(151);
var repeat = __webpack_require__(108);
var $toFixed = 1.0.toFixed;
var floor = Math.floor;
var data = [0, 0, 0, 0, 0, 0];
var ERROR = 'Number.toFixed: incorrect invocation!';
var ZERO = '0';

var multiply = function multiply(n, c) {
  var i = -1;
  var c2 = c;
  while (++i < 6) {
    c2 += n * data[i];
    data[i] = c2 % 1e7;
    c2 = floor(c2 / 1e7);
  }
};
var divide = function divide(n) {
  var i = 6;
  var c = 0;
  while (--i >= 0) {
    c += data[i];
    data[i] = floor(c / n);
    c = c % n * 1e7;
  }
};
var numToString = function numToString() {
  var i = 6;
  var s = '';
  while (--i >= 0) {
    if (s !== '' || i === 0 || data[i] !== 0) {
      var t = String(data[i]);
      s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t;
    }
  }return s;
};
var pow = function pow(x, n, acc) {
  return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
};
var log = function log(x) {
  var n = 0;
  var x2 = x;
  while (x2 >= 4096) {
    n += 12;
    x2 /= 4096;
  }
  while (x2 >= 2) {
    n += 1;
    x2 /= 2;
  }return n;
};

$export($export.P + $export.F * (!!$toFixed && (0.00008.toFixed(3) !== '0.000' || 0.9.toFixed(0) !== '1' || 1.255.toFixed(2) !== '1.25' || 1000000000000000128.0.toFixed(0) !== '1000000000000000128') || !__webpack_require__(6)(function () {
  // V8 ~ Android 4.3-
  $toFixed.call({});
})), 'Number', {
  toFixed: function toFixed(fractionDigits) {
    var x = aNumberValue(this, ERROR);
    var f = toInteger(fractionDigits);
    var s = '';
    var m = ZERO;
    var e, z, j, k;
    if (f < 0 || f > 20) throw RangeError(ERROR);
    // eslint-disable-next-line no-self-compare
    if (x != x) return 'NaN';
    if (x <= -1e21 || x >= 1e21) return String(x);
    if (x < 0) {
      s = '-';
      x = -x;
    }
    if (x > 1e-21) {
      e = log(x * pow(2, 69, 1)) - 69;
      z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1);
      z *= 0x10000000000000;
      e = 52 - e;
      if (e > 0) {
        multiply(0, z);
        j = f;
        while (j >= 7) {
          multiply(1e7, 0);
          j -= 7;
        }
        multiply(pow(10, j, 1), 0);
        j = e - 1;
        while (j >= 23) {
          divide(1 << 23);
          j -= 23;
        }
        divide(1 << j);
        multiply(1, 1);
        divide(2);
        m = numToString();
      } else {
        multiply(0, z);
        multiply(1 << -e, 0);
        m = numToString() + repeat.call(ZERO, f);
      }
    }
    if (f > 0) {
      k = m.length;
      m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f));
    } else {
      m = s + m;
    }return m;
  }
});

/***/ }),
/* 247 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $fails = __webpack_require__(6);
var aNumberValue = __webpack_require__(151);
var $toPrecision = 1.0.toPrecision;

$export($export.P + $export.F * ($fails(function () {
  // IE7-
  return $toPrecision.call(1, undefined) !== '1';
}) || !$fails(function () {
  // V8 ~ Android 4.3-
  $toPrecision.call({});
})), 'Number', {
  toPrecision: function toPrecision(precision) {
    var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!');
    return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision);
  }
});

/***/ }),
/* 248 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.1.2.1 Number.EPSILON
var $export = __webpack_require__(0);

$export($export.S, 'Number', { EPSILON: Math.pow(2, -52) });

/***/ }),
/* 249 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.1.2.2 Number.isFinite(number)
var $export = __webpack_require__(0);
var _isFinite = __webpack_require__(5).isFinite;

$export($export.S, 'Number', {
  isFinite: function isFinite(it) {
    return typeof it == 'number' && _isFinite(it);
  }
});

/***/ }),
/* 250 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.1.2.3 Number.isInteger(number)
var $export = __webpack_require__(0);

$export($export.S, 'Number', { isInteger: __webpack_require__(152) });

/***/ }),
/* 251 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.1.2.4 Number.isNaN(number)
var $export = __webpack_require__(0);

$export($export.S, 'Number', {
  isNaN: function isNaN(number) {
    // eslint-disable-next-line no-self-compare
    return number != number;
  }
});

/***/ }),
/* 252 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.1.2.5 Number.isSafeInteger(number)
var $export = __webpack_require__(0);
var isInteger = __webpack_require__(152);
var abs = Math.abs;

$export($export.S, 'Number', {
  isSafeInteger: function isSafeInteger(number) {
    return isInteger(number) && abs(number) <= 0x1fffffffffffff;
  }
});

/***/ }),
/* 253 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.1.2.6 Number.MAX_SAFE_INTEGER
var $export = __webpack_require__(0);

$export($export.S, 'Number', { MAX_SAFE_INTEGER: 0x1fffffffffffff });

/***/ }),
/* 254 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.1.2.10 Number.MIN_SAFE_INTEGER
var $export = __webpack_require__(0);

$export($export.S, 'Number', { MIN_SAFE_INTEGER: -0x1fffffffffffff });

/***/ }),
/* 255 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $parseFloat = __webpack_require__(150);
// 20.1.2.12 Number.parseFloat(string)
$export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', { parseFloat: $parseFloat });

/***/ }),
/* 256 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $parseInt = __webpack_require__(149);
// 20.1.2.13 Number.parseInt(string, radix)
$export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', { parseInt: $parseInt });

/***/ }),
/* 257 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.3 Math.acosh(x)
var $export = __webpack_require__(0);
var log1p = __webpack_require__(153);
var sqrt = Math.sqrt;
var $acosh = Math.acosh;

$export($export.S + $export.F * !($acosh
// V8 bug: https://code.google.com/p/v8/issues/detail?id=3509
&& Math.floor($acosh(Number.MAX_VALUE)) == 710
// Tor Browser bug: Math.acosh(Infinity) -> NaN
&& $acosh(Infinity) == Infinity), 'Math', {
  acosh: function acosh(x) {
    return (x = +x) < 1 ? NaN : x > 94906265.62425156 ? Math.log(x) + Math.LN2 : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
  }
});

/***/ }),
/* 258 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.5 Math.asinh(x)
var $export = __webpack_require__(0);
var $asinh = Math.asinh;

function asinh(x) {
  return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1));
}

// Tor Browser bug: Math.asinh(0) -> -0
$export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', { asinh: asinh });

/***/ }),
/* 259 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.7 Math.atanh(x)
var $export = __webpack_require__(0);
var $atanh = Math.atanh;

// Tor Browser bug: Math.atanh(-0) -> 0
$export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', {
  atanh: function atanh(x) {
    return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2;
  }
});

/***/ }),
/* 260 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.9 Math.cbrt(x)
var $export = __webpack_require__(0);
var sign = __webpack_require__(109);

$export($export.S, 'Math', {
  cbrt: function cbrt(x) {
    return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3);
  }
});

/***/ }),
/* 261 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.11 Math.clz32(x)
var $export = __webpack_require__(0);

$export($export.S, 'Math', {
  clz32: function clz32(x) {
    return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32;
  }
});

/***/ }),
/* 262 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.12 Math.cosh(x)
var $export = __webpack_require__(0);
var exp = Math.exp;

$export($export.S, 'Math', {
  cosh: function cosh(x) {
    return (exp(x = +x) + exp(-x)) / 2;
  }
});

/***/ }),
/* 263 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.14 Math.expm1(x)
var $export = __webpack_require__(0);
var $expm1 = __webpack_require__(110);

$export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', { expm1: $expm1 });

/***/ }),
/* 264 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.16 Math.fround(x)
var $export = __webpack_require__(0);

$export($export.S, 'Math', { fround: __webpack_require__(154) });

/***/ }),
/* 265 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
var $export = __webpack_require__(0);
var abs = Math.abs;

$export($export.S, 'Math', {
  hypot: function hypot(value1, value2) {
    // eslint-disable-line no-unused-vars
    var sum = 0;
    var i = 0;
    var aLen = arguments.length;
    var larg = 0;
    var arg, div;
    while (i < aLen) {
      arg = abs(arguments[i++]);
      if (larg < arg) {
        div = larg / arg;
        sum = sum * div * div + 1;
        larg = arg;
      } else if (arg > 0) {
        div = arg / larg;
        sum += div * div;
      } else sum += arg;
    }
    return larg === Infinity ? Infinity : larg * Math.sqrt(sum);
  }
});

/***/ }),
/* 266 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.18 Math.imul(x, y)
var $export = __webpack_require__(0);
var $imul = Math.imul;

// some WebKit versions fails with big numbers, some has wrong arity
$export($export.S + $export.F * __webpack_require__(6)(function () {
  return $imul(0xffffffff, 5) != -5 || $imul.length != 2;
}), 'Math', {
  imul: function imul(x, y) {
    var UINT16 = 0xffff;
    var xn = +x;
    var yn = +y;
    var xl = UINT16 & xn;
    var yl = UINT16 & yn;
    return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0);
  }
});

/***/ }),
/* 267 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.21 Math.log10(x)
var $export = __webpack_require__(0);

$export($export.S, 'Math', {
  log10: function log10(x) {
    return Math.log(x) * Math.LOG10E;
  }
});

/***/ }),
/* 268 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.20 Math.log1p(x)
var $export = __webpack_require__(0);

$export($export.S, 'Math', { log1p: __webpack_require__(153) });

/***/ }),
/* 269 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.22 Math.log2(x)
var $export = __webpack_require__(0);

$export($export.S, 'Math', {
  log2: function log2(x) {
    return Math.log(x) / Math.LN2;
  }
});

/***/ }),
/* 270 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.28 Math.sign(x)
var $export = __webpack_require__(0);

$export($export.S, 'Math', { sign: __webpack_require__(109) });

/***/ }),
/* 271 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.30 Math.sinh(x)
var $export = __webpack_require__(0);
var expm1 = __webpack_require__(110);
var exp = Math.exp;

// V8 near Chromium 38 has a problem with very small numbers
$export($export.S + $export.F * __webpack_require__(6)(function () {
  return !Math.sinh(-2e-17) != -2e-17;
}), 'Math', {
  sinh: function sinh(x) {
    return Math.abs(x = +x) < 1 ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2);
  }
});

/***/ }),
/* 272 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.33 Math.tanh(x)
var $export = __webpack_require__(0);
var expm1 = __webpack_require__(110);
var exp = Math.exp;

$export($export.S, 'Math', {
  tanh: function tanh(x) {
    var a = expm1(x = +x);
    var b = expm1(-x);
    return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
  }
});

/***/ }),
/* 273 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.2.2.34 Math.trunc(x)
var $export = __webpack_require__(0);

$export($export.S, 'Math', {
  trunc: function trunc(it) {
    return (it > 0 ? Math.floor : Math.ceil)(it);
  }
});

/***/ }),
/* 274 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var toAbsoluteIndex = __webpack_require__(48);
var fromCharCode = String.fromCharCode;
var $fromCodePoint = String.fromCodePoint;

// length should be 1, old FF problem
$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
  // 21.1.2.2 String.fromCodePoint(...codePoints)
  fromCodePoint: function fromCodePoint(x) {
    // eslint-disable-line no-unused-vars
    var res = [];
    var aLen = arguments.length;
    var i = 0;
    var code;
    while (aLen > i) {
      code = +arguments[i++];
      if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point');
      res.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00));
    }return res.join('');
  }
});

/***/ }),
/* 275 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var toIObject = __webpack_require__(20);
var toLength = __webpack_require__(12);

$export($export.S, 'String', {
  // 21.1.2.4 String.raw(callSite, ...substitutions)
  raw: function raw(callSite) {
    var tpl = toIObject(callSite.raw);
    var len = toLength(tpl.length);
    var aLen = arguments.length;
    var res = [];
    var i = 0;
    while (len > i) {
      res.push(String(tpl[i++]));
      if (i < aLen) res.push(String(arguments[i]));
    }return res.join('');
  }
});

/***/ }),
/* 276 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// 21.1.3.25 String.prototype.trim()

__webpack_require__(60)('trim', function ($trim) {
  return function trim() {
    return $trim(this, 3);
  };
});

/***/ }),
/* 277 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $at = __webpack_require__(111)(true);

// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(112)(String, 'String', function (iterated) {
  this._t = String(iterated); // target
  this._i = 0; // next index
  // 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function () {
  var O = this._t;
  var index = this._i;
  var point;
  if (index >= O.length) return { value: undefined, done: true };
  point = $at(O, index);
  this._i += point.length;
  return { value: point, done: false };
});

/***/ }),
/* 278 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $at = __webpack_require__(111)(false);
$export($export.P, 'String', {
  // 21.1.3.3 String.prototype.codePointAt(pos)
  codePointAt: function codePointAt(pos) {
    return $at(this, pos);
  }
});

/***/ }),
/* 279 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])


var $export = __webpack_require__(0);
var toLength = __webpack_require__(12);
var context = __webpack_require__(114);
var ENDS_WITH = 'endsWith';
var $endsWith = ''[ENDS_WITH];

$export($export.P + $export.F * __webpack_require__(115)(ENDS_WITH), 'String', {
  endsWith: function endsWith(searchString /* , endPosition = @length */) {
    var that = context(this, searchString, ENDS_WITH);
    var endPosition = arguments.length > 1 ? arguments[1] : undefined;
    var len = toLength(that.length);
    var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len);
    var search = String(searchString);
    return $endsWith ? $endsWith.call(that, search, end) : that.slice(end - search.length, end) === search;
  }
});

/***/ }),
/* 280 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// 21.1.3.7 String.prototype.includes(searchString, position = 0)


var $export = __webpack_require__(0);
var context = __webpack_require__(114);
var INCLUDES = 'includes';

$export($export.P + $export.F * __webpack_require__(115)(INCLUDES), 'String', {
  includes: function includes(searchString /* , position = 0 */) {
    return !!~context(this, searchString, INCLUDES).indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
  }
});

/***/ }),
/* 281 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);

$export($export.P, 'String', {
  // 21.1.3.13 String.prototype.repeat(count)
  repeat: __webpack_require__(108)
});

/***/ }),
/* 282 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// 21.1.3.18 String.prototype.startsWith(searchString [, position ])


var $export = __webpack_require__(0);
var toLength = __webpack_require__(12);
var context = __webpack_require__(114);
var STARTS_WITH = 'startsWith';
var $startsWith = ''[STARTS_WITH];

$export($export.P + $export.F * __webpack_require__(115)(STARTS_WITH), 'String', {
  startsWith: function startsWith(searchString /* , position = 0 */) {
    var that = context(this, searchString, STARTS_WITH);
    var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length));
    var search = String(searchString);
    return $startsWith ? $startsWith.call(that, search, index) : that.slice(index, index + search.length) === search;
  }
});

/***/ }),
/* 283 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// B.2.3.2 String.prototype.anchor(name)

__webpack_require__(19)('anchor', function (createHTML) {
  return function anchor(name) {
    return createHTML(this, 'a', 'name', name);
  };
});

/***/ }),
/* 284 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// B.2.3.3 String.prototype.big()

__webpack_require__(19)('big', function (createHTML) {
  return function big() {
    return createHTML(this, 'big', '', '');
  };
});

/***/ }),
/* 285 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// B.2.3.4 String.prototype.blink()

__webpack_require__(19)('blink', function (createHTML) {
  return function blink() {
    return createHTML(this, 'blink', '', '');
  };
});

/***/ }),
/* 286 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// B.2.3.5 String.prototype.bold()

__webpack_require__(19)('bold', function (createHTML) {
  return function bold() {
    return createHTML(this, 'b', '', '');
  };
});

/***/ }),
/* 287 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// B.2.3.6 String.prototype.fixed()

__webpack_require__(19)('fixed', function (createHTML) {
  return function fixed() {
    return createHTML(this, 'tt', '', '');
  };
});

/***/ }),
/* 288 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// B.2.3.7 String.prototype.fontcolor(color)

__webpack_require__(19)('fontcolor', function (createHTML) {
  return function fontcolor(color) {
    return createHTML(this, 'font', 'color', color);
  };
});

/***/ }),
/* 289 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// B.2.3.8 String.prototype.fontsize(size)

__webpack_require__(19)('fontsize', function (createHTML) {
  return function fontsize(size) {
    return createHTML(this, 'font', 'size', size);
  };
});

/***/ }),
/* 290 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// B.2.3.9 String.prototype.italics()

__webpack_require__(19)('italics', function (createHTML) {
  return function italics() {
    return createHTML(this, 'i', '', '');
  };
});

/***/ }),
/* 291 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// B.2.3.10 String.prototype.link(url)

__webpack_require__(19)('link', function (createHTML) {
  return function link(url) {
    return createHTML(this, 'a', 'href', url);
  };
});

/***/ }),
/* 292 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// B.2.3.11 String.prototype.small()

__webpack_require__(19)('small', function (createHTML) {
  return function small() {
    return createHTML(this, 'small', '', '');
  };
});

/***/ }),
/* 293 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// B.2.3.12 String.prototype.strike()

__webpack_require__(19)('strike', function (createHTML) {
  return function strike() {
    return createHTML(this, 'strike', '', '');
  };
});

/***/ }),
/* 294 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// B.2.3.13 String.prototype.sub()

__webpack_require__(19)('sub', function (createHTML) {
  return function sub() {
    return createHTML(this, 'sub', '', '');
  };
});

/***/ }),
/* 295 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// B.2.3.14 String.prototype.sup()

__webpack_require__(19)('sup', function (createHTML) {
  return function sup() {
    return createHTML(this, 'sup', '', '');
  };
});

/***/ }),
/* 296 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.3.3.1 / 15.9.4.4 Date.now()
var $export = __webpack_require__(0);

$export($export.S, 'Date', { now: function now() {
    return new Date().getTime();
  } });

/***/ }),
/* 297 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var toObject = __webpack_require__(14);
var toPrimitive = __webpack_require__(29);

$export($export.P + $export.F * __webpack_require__(6)(function () {
  return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({ toISOString: function toISOString() {
      return 1;
    } }) !== 1;
}), 'Date', {
  // eslint-disable-next-line no-unused-vars
  toJSON: function toJSON(key) {
    var O = toObject(this);
    var pv = toPrimitive(O);
    return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString();
  }
});

/***/ }),
/* 298 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
var $export = __webpack_require__(0);
var toISOString = __webpack_require__(299);

// PhantomJS / old WebKit has a broken implementations
$export($export.P + $export.F * (Date.prototype.toISOString !== toISOString), 'Date', {
  toISOString: toISOString
});

/***/ }),
/* 299 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()

var fails = __webpack_require__(6);
var getTime = Date.prototype.getTime;
var $toISOString = Date.prototype.toISOString;

var lz = function lz(num) {
  return num > 9 ? num : '0' + num;
};

// PhantomJS / old WebKit has a broken implementations
module.exports = fails(function () {
  return $toISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z';
}) || !fails(function () {
  $toISOString.call(new Date(NaN));
}) ? function toISOString() {
  if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value');
  var d = this;
  var y = d.getUTCFullYear();
  var m = d.getUTCMilliseconds();
  var s = y < 0 ? '-' : y > 9999 ? '+' : '';
  return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
} : $toISOString;

/***/ }),
/* 300 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var DateProto = Date.prototype;
var INVALID_DATE = 'Invalid Date';
var TO_STRING = 'toString';
var $toString = DateProto[TO_STRING];
var getTime = DateProto.getTime;
if (new Date(NaN) + '' != INVALID_DATE) {
  __webpack_require__(18)(DateProto, TO_STRING, function toString() {
    var value = getTime.call(this);
    // eslint-disable-next-line no-self-compare
    return value === value ? $toString.call(this) : INVALID_DATE;
  });
}

/***/ }),
/* 301 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var TO_PRIMITIVE = __webpack_require__(8)('toPrimitive');
var proto = Date.prototype;

if (!(TO_PRIMITIVE in proto)) __webpack_require__(17)(proto, TO_PRIMITIVE, __webpack_require__(302));

/***/ }),
/* 302 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var anObject = __webpack_require__(4);
var toPrimitive = __webpack_require__(29);
var NUMBER = 'number';

module.exports = function (hint) {
  if (hint !== 'string' && hint !== NUMBER && hint !== 'default') throw TypeError('Incorrect hint');
  return toPrimitive(anObject(this), hint != NUMBER);
};

/***/ }),
/* 303 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
var $export = __webpack_require__(0);

$export($export.S, 'Array', { isArray: __webpack_require__(80) });

/***/ }),
/* 304 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var ctx = __webpack_require__(25);
var $export = __webpack_require__(0);
var toObject = __webpack_require__(14);
var call = __webpack_require__(155);
var isArrayIter = __webpack_require__(116);
var toLength = __webpack_require__(12);
var createProperty = __webpack_require__(117);
var getIterFn = __webpack_require__(118);

$export($export.S + $export.F * !__webpack_require__(82)(function (iter) {
  Array.from(iter);
}), 'Array', {
  // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
  from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
    var O = toObject(arrayLike);
    var C = typeof this == 'function' ? this : Array;
    var aLen = arguments.length;
    var mapfn = aLen > 1 ? arguments[1] : undefined;
    var mapping = mapfn !== undefined;
    var index = 0;
    var iterFn = getIterFn(O);
    var length, result, step, iterator;
    if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
    // if object isn't iterable or it's array with default iterator - use simple case
    if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {
      for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
        createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
      }
    } else {
      length = toLength(O.length);
      for (result = new C(length); length > index; index++) {
        createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
      }
    }
    result.length = index;
    return result;
  }
});

/***/ }),
/* 305 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var createProperty = __webpack_require__(117);

// WebKit Array.of isn't generic
$export($export.S + $export.F * __webpack_require__(6)(function () {
  function F() {/* empty */}
  return !(Array.of.call(F) instanceof F);
}), 'Array', {
  // 22.1.2.3 Array.of( ...items)
  of: function of() /* ...args */{
    var index = 0;
    var aLen = arguments.length;
    var result = new (typeof this == 'function' ? this : Array)(aLen);
    while (aLen > index) {
      createProperty(result, index, arguments[index++]);
    }result.length = aLen;
    return result;
  }
});

/***/ }),
/* 306 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// 22.1.3.13 Array.prototype.join(separator)

var $export = __webpack_require__(0);
var toIObject = __webpack_require__(20);
var arrayJoin = [].join;

// fallback for not array-like strings
$export($export.P + $export.F * (__webpack_require__(67) != Object || !__webpack_require__(27)(arrayJoin)), 'Array', {
  join: function join(separator) {
    return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator);
  }
});

/***/ }),
/* 307 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var html = __webpack_require__(104);
var cof = __webpack_require__(26);
var toAbsoluteIndex = __webpack_require__(48);
var toLength = __webpack_require__(12);
var arraySlice = [].slice;

// fallback for not array-like ES3 strings and DOM objects
$export($export.P + $export.F * __webpack_require__(6)(function () {
  if (html) arraySlice.call(html);
}), 'Array', {
  slice: function slice(begin, end) {
    var len = toLength(this.length);
    var klass = cof(this);
    end = end === undefined ? len : end;
    if (klass == 'Array') return arraySlice.call(this, begin, end);
    var start = toAbsoluteIndex(begin, len);
    var upTo = toAbsoluteIndex(end, len);
    var size = toLength(upTo - start);
    var cloned = new Array(size);
    var i = 0;
    for (; i < size; i++) {
      cloned[i] = klass == 'String' ? this.charAt(start + i) : this[start + i];
    }return cloned;
  }
});

/***/ }),
/* 308 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var aFunction = __webpack_require__(15);
var toObject = __webpack_require__(14);
var fails = __webpack_require__(6);
var $sort = [].sort;
var test = [1, 2, 3];

$export($export.P + $export.F * (fails(function () {
  // IE8-
  test.sort(undefined);
}) || !fails(function () {
  // V8 bug
  test.sort(null);
  // Old WebKit
}) || !__webpack_require__(27)($sort)), 'Array', {
  // 22.1.3.25 Array.prototype.sort(comparefn)
  sort: function sort(comparefn) {
    return comparefn === undefined ? $sort.call(toObject(this)) : $sort.call(toObject(this), aFunction(comparefn));
  }
});

/***/ }),
/* 309 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $forEach = __webpack_require__(33)(0);
var STRICT = __webpack_require__(27)([].forEach, true);

$export($export.P + $export.F * !STRICT, 'Array', {
  // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
  forEach: function forEach(callbackfn /* , thisArg */) {
    return $forEach(this, callbackfn, arguments[1]);
  }
});

/***/ }),
/* 310 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var isObject = __webpack_require__(7);
var isArray = __webpack_require__(80);
var SPECIES = __webpack_require__(8)('species');

module.exports = function (original) {
  var C;
  if (isArray(original)) {
    C = original.constructor;
    // cross-realm fallback
    if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
    if (isObject(C)) {
      C = C[SPECIES];
      if (C === null) C = undefined;
    }
  }return C === undefined ? Array : C;
};

/***/ }),
/* 311 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $map = __webpack_require__(33)(1);

$export($export.P + $export.F * !__webpack_require__(27)([].map, true), 'Array', {
  // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
  map: function map(callbackfn /* , thisArg */) {
    return $map(this, callbackfn, arguments[1]);
  }
});

/***/ }),
/* 312 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $filter = __webpack_require__(33)(2);

$export($export.P + $export.F * !__webpack_require__(27)([].filter, true), 'Array', {
  // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
  filter: function filter(callbackfn /* , thisArg */) {
    return $filter(this, callbackfn, arguments[1]);
  }
});

/***/ }),
/* 313 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $some = __webpack_require__(33)(3);

$export($export.P + $export.F * !__webpack_require__(27)([].some, true), 'Array', {
  // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
  some: function some(callbackfn /* , thisArg */) {
    return $some(this, callbackfn, arguments[1]);
  }
});

/***/ }),
/* 314 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $every = __webpack_require__(33)(4);

$export($export.P + $export.F * !__webpack_require__(27)([].every, true), 'Array', {
  // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
  every: function every(callbackfn /* , thisArg */) {
    return $every(this, callbackfn, arguments[1]);
  }
});

/***/ }),
/* 315 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $reduce = __webpack_require__(156);

$export($export.P + $export.F * !__webpack_require__(27)([].reduce, true), 'Array', {
  // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
  reduce: function reduce(callbackfn /* , initialValue */) {
    return $reduce(this, callbackfn, arguments.length, arguments[1], false);
  }
});

/***/ }),
/* 316 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $reduce = __webpack_require__(156);

$export($export.P + $export.F * !__webpack_require__(27)([].reduceRight, true), 'Array', {
  // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
  reduceRight: function reduceRight(callbackfn /* , initialValue */) {
    return $reduce(this, callbackfn, arguments.length, arguments[1], true);
  }
});

/***/ }),
/* 317 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $indexOf = __webpack_require__(78)(false);
var $native = [].indexOf;
var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;

$export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(27)($native)), 'Array', {
  // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
  indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
    return NEGATIVE_ZERO
    // convert -0 to +0
    ? $native.apply(this, arguments) || 0 : $indexOf(this, searchElement, arguments[1]);
  }
});

/***/ }),
/* 318 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var toIObject = __webpack_require__(20);
var toInteger = __webpack_require__(31);
var toLength = __webpack_require__(12);
var $native = [].lastIndexOf;
var NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0;

$export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(27)($native)), 'Array', {
  // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
  lastIndexOf: function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
    // convert -0 to +0
    if (NEGATIVE_ZERO) return $native.apply(this, arguments) || 0;
    var O = toIObject(this);
    var length = toLength(O.length);
    var index = length - 1;
    if (arguments.length > 1) index = Math.min(index, toInteger(arguments[1]));
    if (index < 0) index = length + index;
    for (; index >= 0; index--) {
      if (index in O) if (O[index] === searchElement) return index || 0;
    }return -1;
  }
});

/***/ }),
/* 319 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
var $export = __webpack_require__(0);

$export($export.P, 'Array', { copyWithin: __webpack_require__(157) });

__webpack_require__(40)('copyWithin');

/***/ }),
/* 320 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
var $export = __webpack_require__(0);

$export($export.P, 'Array', { fill: __webpack_require__(120) });

__webpack_require__(40)('fill');

/***/ }),
/* 321 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)

var $export = __webpack_require__(0);
var $find = __webpack_require__(33)(5);
var KEY = 'find';
var forced = true;
// Shouldn't skip holes
if (KEY in []) Array(1)[KEY](function () {
  forced = false;
});
$export($export.P + $export.F * forced, 'Array', {
  find: function find(callbackfn /* , that = undefined */) {
    return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  }
});
__webpack_require__(40)(KEY);

/***/ }),
/* 322 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)

var $export = __webpack_require__(0);
var $find = __webpack_require__(33)(6);
var KEY = 'findIndex';
var forced = true;
// Shouldn't skip holes
if (KEY in []) Array(1)[KEY](function () {
  forced = false;
});
$export($export.P + $export.F * forced, 'Array', {
  findIndex: function findIndex(callbackfn /* , that = undefined */) {
    return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  }
});
__webpack_require__(40)(KEY);

/***/ }),
/* 323 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(51)('Array');

/***/ }),
/* 324 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var global = __webpack_require__(5);
var inheritIfRequired = __webpack_require__(107);
var dP = __webpack_require__(11).f;
var gOPN = __webpack_require__(50).f;
var isRegExp = __webpack_require__(81);
var $flags = __webpack_require__(83);
var $RegExp = global.RegExp;
var Base = $RegExp;
var proto = $RegExp.prototype;
var re1 = /a/g;
var re2 = /a/g;
// "new" creates a new object, old webkit buggy here
var CORRECT_NEW = new $RegExp(re1) !== re1;

if (__webpack_require__(10) && (!CORRECT_NEW || __webpack_require__(6)(function () {
  re2[__webpack_require__(8)('match')] = false;
  // RegExp constructor can alter flags and IsRegExp works correct with @@match
  return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
}))) {
  $RegExp = function RegExp(p, f) {
    var tiRE = this instanceof $RegExp;
    var piRE = isRegExp(p);
    var fiU = f === undefined;
    return !tiRE && piRE && p.constructor === $RegExp && fiU ? p : inheritIfRequired(CORRECT_NEW ? new Base(piRE && !fiU ? p.source : p, f) : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f), tiRE ? this : proto, $RegExp);
  };
  var proxy = function proxy(key) {
    key in $RegExp || dP($RegExp, key, {
      configurable: true,
      get: function get() {
        return Base[key];
      },
      set: function set(it) {
        Base[key] = it;
      }
    });
  };
  for (var keys = gOPN(Base), i = 0; keys.length > i;) {
    proxy(keys[i++]);
  }proto.constructor = $RegExp;
  $RegExp.prototype = proto;
  __webpack_require__(18)(global, 'RegExp', $RegExp);
}

__webpack_require__(51)('RegExp');

/***/ }),
/* 325 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(159);
var anObject = __webpack_require__(4);
var $flags = __webpack_require__(83);
var DESCRIPTORS = __webpack_require__(10);
var TO_STRING = 'toString';
var $toString = /./[TO_STRING];

var define = function define(fn) {
  __webpack_require__(18)(RegExp.prototype, TO_STRING, fn, true);
};

// 21.2.5.14 RegExp.prototype.toString()
if (__webpack_require__(6)(function () {
  return $toString.call({ source: 'a', flags: 'b' }) != '/a/b';
})) {
  define(function toString() {
    var R = anObject(this);
    return '/'.concat(R.source, '/', 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);
  });
  // FF44- RegExp#toString has a wrong name
} else if ($toString.name != TO_STRING) {
  define(function toString() {
    return $toString.call(this);
  });
}

/***/ }),
/* 326 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// @@match logic
__webpack_require__(84)('match', 1, function (defined, MATCH, $match) {
  // 21.1.3.11 String.prototype.match(regexp)
  return [function match(regexp) {
    'use strict';

    var O = defined(this);
    var fn = regexp == undefined ? undefined : regexp[MATCH];
    return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
  }, $match];
});

/***/ }),
/* 327 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// @@replace logic
__webpack_require__(84)('replace', 2, function (defined, REPLACE, $replace) {
  // 21.1.3.14 String.prototype.replace(searchValue, replaceValue)
  return [function replace(searchValue, replaceValue) {
    'use strict';

    var O = defined(this);
    var fn = searchValue == undefined ? undefined : searchValue[REPLACE];
    return fn !== undefined ? fn.call(searchValue, O, replaceValue) : $replace.call(String(O), searchValue, replaceValue);
  }, $replace];
});

/***/ }),
/* 328 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// @@search logic
__webpack_require__(84)('search', 1, function (defined, SEARCH, $search) {
  // 21.1.3.15 String.prototype.search(regexp)
  return [function search(regexp) {
    'use strict';

    var O = defined(this);
    var fn = regexp == undefined ? undefined : regexp[SEARCH];
    return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
  }, $search];
});

/***/ }),
/* 329 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// @@split logic
__webpack_require__(84)('split', 2, function (defined, SPLIT, $split) {
  'use strict';

  var isRegExp = __webpack_require__(81);
  var _split = $split;
  var $push = [].push;
  var $SPLIT = 'split';
  var LENGTH = 'length';
  var LAST_INDEX = 'lastIndex';
  if ('abbc'[$SPLIT](/(b)*/)[1] == 'c' || 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || '.'[$SPLIT](/()()/)[LENGTH] > 1 || ''[$SPLIT](/.?/)[LENGTH]) {
    var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group
    // based on es5-shim implementation, need to rework it
    $split = function $split(separator, limit) {
      var string = String(this);
      if (separator === undefined && limit === 0) return [];
      // If `separator` is not a regex, use native split
      if (!isRegExp(separator)) return _split.call(string, separator, limit);
      var output = [];
      var flags = (separator.ignoreCase ? 'i' : '') + (separator.multiline ? 'm' : '') + (separator.unicode ? 'u' : '') + (separator.sticky ? 'y' : '');
      var lastLastIndex = 0;
      var splitLimit = limit === undefined ? 4294967295 : limit >>> 0;
      // Make `global` and avoid `lastIndex` issues by working with a copy
      var separatorCopy = new RegExp(separator.source, flags + 'g');
      var separator2, match, lastIndex, lastLength, i;
      // Doesn't need flags gy, but they don't hurt
      if (!NPCG) separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags);
      while (match = separatorCopy.exec(string)) {
        // `separatorCopy.lastIndex` is not reliable cross-browser
        lastIndex = match.index + match[0][LENGTH];
        if (lastIndex > lastLastIndex) {
          output.push(string.slice(lastLastIndex, match.index));
          // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG
          // eslint-disable-next-line no-loop-func
          if (!NPCG && match[LENGTH] > 1) match[0].replace(separator2, function () {
            for (i = 1; i < arguments[LENGTH] - 2; i++) {
              if (arguments[i] === undefined) match[i] = undefined;
            }
          });
          if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1));
          lastLength = match[0][LENGTH];
          lastLastIndex = lastIndex;
          if (output[LENGTH] >= splitLimit) break;
        }
        if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop
      }
      if (lastLastIndex === string[LENGTH]) {
        if (lastLength || !separatorCopy.test('')) output.push('');
      } else output.push(string.slice(lastLastIndex));
      return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;
    };
    // Chakra, V8
  } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) {
    $split = function $split(separator, limit) {
      return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit);
    };
  }
  // 21.1.3.17 String.prototype.split(separator, limit)
  return [function split(separator, limit) {
    var O = defined(this);
    var fn = separator == undefined ? undefined : separator[SPLIT];
    return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit);
  }, $split];
});

/***/ }),
/* 330 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var LIBRARY = __webpack_require__(46);
var global = __webpack_require__(5);
var ctx = __webpack_require__(25);
var classof = __webpack_require__(69);
var $export = __webpack_require__(0);
var isObject = __webpack_require__(7);
var aFunction = __webpack_require__(15);
var anInstance = __webpack_require__(52);
var forOf = __webpack_require__(53);
var speciesConstructor = __webpack_require__(85);
var task = __webpack_require__(122).set;
var microtask = __webpack_require__(123)();
var newPromiseCapabilityModule = __webpack_require__(124);
var perform = __webpack_require__(160);
var promiseResolve = __webpack_require__(161);
var PROMISE = 'Promise';
var TypeError = global.TypeError;
var process = global.process;
var $Promise = global[PROMISE];
var isNode = classof(process) == 'process';
var empty = function empty() {/* empty */};
var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;

var USE_NATIVE = !!function () {
  try {
    // correct subclassing with @@species support
    var promise = $Promise.resolve(1);
    var FakePromise = (promise.constructor = {})[__webpack_require__(8)('species')] = function (exec) {
      exec(empty, empty);
    };
    // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
    return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise;
  } catch (e) {/* empty */}
}();

// helpers
var isThenable = function isThenable(it) {
  var then;
  return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
};
var notify = function notify(promise, isReject) {
  if (promise._n) return;
  promise._n = true;
  var chain = promise._c;
  microtask(function () {
    var value = promise._v;
    var ok = promise._s == 1;
    var i = 0;
    var run = function run(reaction) {
      var handler = ok ? reaction.ok : reaction.fail;
      var resolve = reaction.resolve;
      var reject = reaction.reject;
      var domain = reaction.domain;
      var result, then;
      try {
        if (handler) {
          if (!ok) {
            if (promise._h == 2) onHandleUnhandled(promise);
            promise._h = 1;
          }
          if (handler === true) result = value;else {
            if (domain) domain.enter();
            result = handler(value);
            if (domain) domain.exit();
          }
          if (result === reaction.promise) {
            reject(TypeError('Promise-chain cycle'));
          } else if (then = isThenable(result)) {
            then.call(result, resolve, reject);
          } else resolve(result);
        } else reject(value);
      } catch (e) {
        reject(e);
      }
    };
    while (chain.length > i) {
      run(chain[i++]);
    } // variable length - can't use forEach
    promise._c = [];
    promise._n = false;
    if (isReject && !promise._h) onUnhandled(promise);
  });
};
var onUnhandled = function onUnhandled(promise) {
  task.call(global, function () {
    var value = promise._v;
    var unhandled = isUnhandled(promise);
    var result, handler, console;
    if (unhandled) {
      result = perform(function () {
        if (isNode) {
          process.emit('unhandledRejection', value, promise);
        } else if (handler = global.onunhandledrejection) {
          handler({ promise: promise, reason: value });
        } else if ((console = global.console) && console.error) {
          console.error('Unhandled promise rejection', value);
        }
      });
      // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
      promise._h = isNode || isUnhandled(promise) ? 2 : 1;
    }promise._a = undefined;
    if (unhandled && result.e) throw result.v;
  });
};
var isUnhandled = function isUnhandled(promise) {
  return promise._h !== 1 && (promise._a || promise._c).length === 0;
};
var onHandleUnhandled = function onHandleUnhandled(promise) {
  task.call(global, function () {
    var handler;
    if (isNode) {
      process.emit('rejectionHandled', promise);
    } else if (handler = global.onrejectionhandled) {
      handler({ promise: promise, reason: promise._v });
    }
  });
};
var $reject = function $reject(value) {
  var promise = this;
  if (promise._d) return;
  promise._d = true;
  promise = promise._w || promise; // unwrap
  promise._v = value;
  promise._s = 2;
  if (!promise._a) promise._a = promise._c.slice();
  notify(promise, true);
};
var $resolve = function $resolve(value) {
  var promise = this;
  var then;
  if (promise._d) return;
  promise._d = true;
  promise = promise._w || promise; // unwrap
  try {
    if (promise === value) throw TypeError("Promise can't be resolved itself");
    if (then = isThenable(value)) {
      microtask(function () {
        var wrapper = { _w: promise, _d: false }; // wrap
        try {
          then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
        } catch (e) {
          $reject.call(wrapper, e);
        }
      });
    } else {
      promise._v = value;
      promise._s = 1;
      notify(promise, false);
    }
  } catch (e) {
    $reject.call({ _w: promise, _d: false }, e); // wrap
  }
};

// constructor polyfill
if (!USE_NATIVE) {
  // 25.4.3.1 Promise(executor)
  $Promise = function Promise(executor) {
    anInstance(this, $Promise, PROMISE, '_h');
    aFunction(executor);
    Internal.call(this);
    try {
      executor(ctx($resolve, this, 1), ctx($reject, this, 1));
    } catch (err) {
      $reject.call(this, err);
    }
  };
  // eslint-disable-next-line no-unused-vars
  Internal = function Promise(executor) {
    this._c = []; // <- awaiting reactions
    this._a = undefined; // <- checked in isUnhandled reactions
    this._s = 0; // <- state
    this._d = false; // <- done
    this._v = undefined; // <- value
    this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
    this._n = false; // <- notify
  };
  Internal.prototype = __webpack_require__(54)($Promise.prototype, {
    // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
    then: function then(onFulfilled, onRejected) {
      var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
      reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
      reaction.fail = typeof onRejected == 'function' && onRejected;
      reaction.domain = isNode ? process.domain : undefined;
      this._c.push(reaction);
      if (this._a) this._a.push(reaction);
      if (this._s) notify(this, false);
      return reaction.promise;
    },
    // 25.4.5.1 Promise.prototype.catch(onRejected)
    'catch': function _catch(onRejected) {
      return this.then(undefined, onRejected);
    }
  });
  OwnPromiseCapability = function OwnPromiseCapability() {
    var promise = new Internal();
    this.promise = promise;
    this.resolve = ctx($resolve, promise, 1);
    this.reject = ctx($reject, promise, 1);
  };
  newPromiseCapabilityModule.f = newPromiseCapability = function newPromiseCapability(C) {
    return C === $Promise || C === Wrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C);
  };
}

$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });
__webpack_require__(59)($Promise, PROMISE);
__webpack_require__(51)(PROMISE);
Wrapper = __webpack_require__(28)[PROMISE];

// statics
$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
  // 25.4.4.5 Promise.reject(r)
  reject: function reject(r) {
    var capability = newPromiseCapability(this);
    var $$reject = capability.reject;
    $$reject(r);
    return capability.promise;
  }
});
$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
  // 25.4.4.6 Promise.resolve(x)
  resolve: function resolve(x) {
    return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
  }
});
$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(82)(function (iter) {
  $Promise.all(iter)['catch'](empty);
})), PROMISE, {
  // 25.4.4.1 Promise.all(iterable)
  all: function all(iterable) {
    var C = this;
    var capability = newPromiseCapability(C);
    var resolve = capability.resolve;
    var reject = capability.reject;
    var result = perform(function () {
      var values = [];
      var index = 0;
      var remaining = 1;
      forOf(iterable, false, function (promise) {
        var $index = index++;
        var alreadyCalled = false;
        values.push(undefined);
        remaining++;
        C.resolve(promise).then(function (value) {
          if (alreadyCalled) return;
          alreadyCalled = true;
          values[$index] = value;
          --remaining || resolve(values);
        }, reject);
      });
      --remaining || resolve(values);
    });
    if (result.e) reject(result.v);
    return capability.promise;
  },
  // 25.4.4.4 Promise.race(iterable)
  race: function race(iterable) {
    var C = this;
    var capability = newPromiseCapability(C);
    var reject = capability.reject;
    var result = perform(function () {
      forOf(iterable, false, function (promise) {
        C.resolve(promise).then(capability.resolve, reject);
      });
    });
    if (result.e) reject(result.v);
    return capability.promise;
  }
});

/***/ }),
/* 331 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var weak = __webpack_require__(166);
var validate = __webpack_require__(62);
var WEAK_SET = 'WeakSet';

// 23.4 WeakSet Objects
__webpack_require__(86)(WEAK_SET, function (get) {
  return function WeakSet() {
    return get(this, arguments.length > 0 ? arguments[0] : undefined);
  };
}, {
  // 23.4.3.1 WeakSet.prototype.add(value)
  add: function add(value) {
    return weak.def(validate(this, WEAK_SET), value, true);
  }
}, weak, false, true);

/***/ }),
/* 332 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $typed = __webpack_require__(87);
var buffer = __webpack_require__(125);
var anObject = __webpack_require__(4);
var toAbsoluteIndex = __webpack_require__(48);
var toLength = __webpack_require__(12);
var isObject = __webpack_require__(7);
var ArrayBuffer = __webpack_require__(5).ArrayBuffer;
var speciesConstructor = __webpack_require__(85);
var $ArrayBuffer = buffer.ArrayBuffer;
var $DataView = buffer.DataView;
var $isView = $typed.ABV && ArrayBuffer.isView;
var $slice = $ArrayBuffer.prototype.slice;
var VIEW = $typed.VIEW;
var ARRAY_BUFFER = 'ArrayBuffer';

$export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), { ArrayBuffer: $ArrayBuffer });

$export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, {
  // 24.1.3.1 ArrayBuffer.isView(arg)
  isView: function isView(it) {
    return $isView && $isView(it) || isObject(it) && VIEW in it;
  }
});

$export($export.P + $export.U + $export.F * __webpack_require__(6)(function () {
  return !new $ArrayBuffer(2).slice(1, undefined).byteLength;
}), ARRAY_BUFFER, {
  // 24.1.4.3 ArrayBuffer.prototype.slice(start, end)
  slice: function slice(start, end) {
    if ($slice !== undefined && end === undefined) return $slice.call(anObject(this), start); // FF fix
    var len = anObject(this).byteLength;
    var first = toAbsoluteIndex(start, len);
    var final = toAbsoluteIndex(end === undefined ? len : end, len);
    var result = new (speciesConstructor(this, $ArrayBuffer))(toLength(final - first));
    var viewS = new $DataView(this);
    var viewT = new $DataView(result);
    var index = 0;
    while (first < final) {
      viewT.setUint8(index++, viewS.getUint8(first++));
    }return result;
  }
});

__webpack_require__(51)(ARRAY_BUFFER);

/***/ }),
/* 333 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
$export($export.G + $export.W + $export.F * !__webpack_require__(87).ABV, {
  DataView: __webpack_require__(125).DataView
});

/***/ }),
/* 334 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(36)('Int8', 1, function (init) {
  return function Int8Array(data, byteOffset, length) {
    return init(this, data, byteOffset, length);
  };
});

/***/ }),
/* 335 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(36)('Uint8', 1, function (init) {
  return function Uint8Array(data, byteOffset, length) {
    return init(this, data, byteOffset, length);
  };
});

/***/ }),
/* 336 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(36)('Uint8', 1, function (init) {
  return function Uint8ClampedArray(data, byteOffset, length) {
    return init(this, data, byteOffset, length);
  };
}, true);

/***/ }),
/* 337 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(36)('Int16', 2, function (init) {
  return function Int16Array(data, byteOffset, length) {
    return init(this, data, byteOffset, length);
  };
});

/***/ }),
/* 338 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(36)('Uint16', 2, function (init) {
  return function Uint16Array(data, byteOffset, length) {
    return init(this, data, byteOffset, length);
  };
});

/***/ }),
/* 339 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(36)('Int32', 4, function (init) {
  return function Int32Array(data, byteOffset, length) {
    return init(this, data, byteOffset, length);
  };
});

/***/ }),
/* 340 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(36)('Uint32', 4, function (init) {
  return function Uint32Array(data, byteOffset, length) {
    return init(this, data, byteOffset, length);
  };
});

/***/ }),
/* 341 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(36)('Float32', 4, function (init) {
  return function Float32Array(data, byteOffset, length) {
    return init(this, data, byteOffset, length);
  };
});

/***/ }),
/* 342 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(36)('Float64', 8, function (init) {
  return function Float64Array(data, byteOffset, length) {
    return init(this, data, byteOffset, length);
  };
});

/***/ }),
/* 343 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
var $export = __webpack_require__(0);
var aFunction = __webpack_require__(15);
var anObject = __webpack_require__(4);
var rApply = (__webpack_require__(5).Reflect || {}).apply;
var fApply = Function.apply;
// MS Edge argumentsList argument is optional
$export($export.S + $export.F * !__webpack_require__(6)(function () {
  rApply(function () {/* empty */});
}), 'Reflect', {
  apply: function apply(target, thisArgument, argumentsList) {
    var T = aFunction(target);
    var L = anObject(argumentsList);
    return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L);
  }
});

/***/ }),
/* 344 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
var $export = __webpack_require__(0);
var create = __webpack_require__(49);
var aFunction = __webpack_require__(15);
var anObject = __webpack_require__(4);
var isObject = __webpack_require__(7);
var fails = __webpack_require__(6);
var bind = __webpack_require__(147);
var rConstruct = (__webpack_require__(5).Reflect || {}).construct;

// MS Edge supports only 2 arguments and argumentsList argument is optional
// FF Nightly sets third argument as `new.target`, but does not create `this` from it
var NEW_TARGET_BUG = fails(function () {
  function F() {/* empty */}
  return !(rConstruct(function () {/* empty */}, [], F) instanceof F);
});
var ARGS_BUG = !fails(function () {
  rConstruct(function () {/* empty */});
});

$export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', {
  construct: function construct(Target, args /* , newTarget */) {
    aFunction(Target);
    anObject(args);
    var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
    if (ARGS_BUG && !NEW_TARGET_BUG) return rConstruct(Target, args, newTarget);
    if (Target == newTarget) {
      // w/o altered newTarget, optimization for 0-4 arguments
      switch (args.length) {
        case 0:
          return new Target();
        case 1:
          return new Target(args[0]);
        case 2:
          return new Target(args[0], args[1]);
        case 3:
          return new Target(args[0], args[1], args[2]);
        case 4:
          return new Target(args[0], args[1], args[2], args[3]);
      }
      // w/o altered newTarget, lot of arguments case
      var $args = [null];
      $args.push.apply($args, args);
      return new (bind.apply(Target, $args))();
    }
    // with altered newTarget, not support built-in constructors
    var proto = newTarget.prototype;
    var instance = create(isObject(proto) ? proto : Object.prototype);
    var result = Function.apply.call(Target, instance, args);
    return isObject(result) ? result : instance;
  }
});

/***/ }),
/* 345 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
var dP = __webpack_require__(11);
var $export = __webpack_require__(0);
var anObject = __webpack_require__(4);
var toPrimitive = __webpack_require__(29);

// MS Edge has broken Reflect.defineProperty - throwing instead of returning false
$export($export.S + $export.F * __webpack_require__(6)(function () {
  // eslint-disable-next-line no-undef
  Reflect.defineProperty(dP.f({}, 1, { value: 1 }), 1, { value: 2 });
}), 'Reflect', {
  defineProperty: function defineProperty(target, propertyKey, attributes) {
    anObject(target);
    propertyKey = toPrimitive(propertyKey, true);
    anObject(attributes);
    try {
      dP.f(target, propertyKey, attributes);
      return true;
    } catch (e) {
      return false;
    }
  }
});

/***/ }),
/* 346 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 26.1.4 Reflect.deleteProperty(target, propertyKey)
var $export = __webpack_require__(0);
var gOPD = __webpack_require__(21).f;
var anObject = __webpack_require__(4);

$export($export.S, 'Reflect', {
  deleteProperty: function deleteProperty(target, propertyKey) {
    var desc = gOPD(anObject(target), propertyKey);
    return desc && !desc.configurable ? false : delete target[propertyKey];
  }
});

/***/ }),
/* 347 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// 26.1.5 Reflect.enumerate(target)

var $export = __webpack_require__(0);
var anObject = __webpack_require__(4);
var Enumerate = function Enumerate(iterated) {
  this._t = anObject(iterated); // target
  this._i = 0; // next index
  var keys = this._k = []; // keys
  var key;
  for (key in iterated) {
    keys.push(key);
  }
};
__webpack_require__(113)(Enumerate, 'Object', function () {
  var that = this;
  var keys = that._k;
  var key;
  do {
    if (that._i >= keys.length) return { value: undefined, done: true };
  } while (!((key = keys[that._i++]) in that._t));
  return { value: key, done: false };
});

$export($export.S, 'Reflect', {
  enumerate: function enumerate(target) {
    return new Enumerate(target);
  }
});

/***/ }),
/* 348 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 26.1.6 Reflect.get(target, propertyKey [, receiver])
var gOPD = __webpack_require__(21);
var getPrototypeOf = __webpack_require__(22);
var has = __webpack_require__(16);
var $export = __webpack_require__(0);
var isObject = __webpack_require__(7);
var anObject = __webpack_require__(4);

function get(target, propertyKey /* , receiver */) {
  var receiver = arguments.length < 3 ? target : arguments[2];
  var desc, proto;
  if (anObject(target) === receiver) return target[propertyKey];
  if (desc = gOPD.f(target, propertyKey)) return has(desc, 'value') ? desc.value : desc.get !== undefined ? desc.get.call(receiver) : undefined;
  if (isObject(proto = getPrototypeOf(target))) return get(proto, propertyKey, receiver);
}

$export($export.S, 'Reflect', { get: get });

/***/ }),
/* 349 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
var gOPD = __webpack_require__(21);
var $export = __webpack_require__(0);
var anObject = __webpack_require__(4);

$export($export.S, 'Reflect', {
  getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) {
    return gOPD.f(anObject(target), propertyKey);
  }
});

/***/ }),
/* 350 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 26.1.8 Reflect.getPrototypeOf(target)
var $export = __webpack_require__(0);
var getProto = __webpack_require__(22);
var anObject = __webpack_require__(4);

$export($export.S, 'Reflect', {
  getPrototypeOf: function getPrototypeOf(target) {
    return getProto(anObject(target));
  }
});

/***/ }),
/* 351 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 26.1.9 Reflect.has(target, propertyKey)
var $export = __webpack_require__(0);

$export($export.S, 'Reflect', {
  has: function has(target, propertyKey) {
    return propertyKey in target;
  }
});

/***/ }),
/* 352 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 26.1.10 Reflect.isExtensible(target)
var $export = __webpack_require__(0);
var anObject = __webpack_require__(4);
var $isExtensible = Object.isExtensible;

$export($export.S, 'Reflect', {
  isExtensible: function isExtensible(target) {
    anObject(target);
    return $isExtensible ? $isExtensible(target) : true;
  }
});

/***/ }),
/* 353 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 26.1.11 Reflect.ownKeys(target)
var $export = __webpack_require__(0);

$export($export.S, 'Reflect', { ownKeys: __webpack_require__(168) });

/***/ }),
/* 354 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 26.1.12 Reflect.preventExtensions(target)
var $export = __webpack_require__(0);
var anObject = __webpack_require__(4);
var $preventExtensions = Object.preventExtensions;

$export($export.S, 'Reflect', {
  preventExtensions: function preventExtensions(target) {
    anObject(target);
    try {
      if ($preventExtensions) $preventExtensions(target);
      return true;
    } catch (e) {
      return false;
    }
  }
});

/***/ }),
/* 355 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
var dP = __webpack_require__(11);
var gOPD = __webpack_require__(21);
var getPrototypeOf = __webpack_require__(22);
var has = __webpack_require__(16);
var $export = __webpack_require__(0);
var createDesc = __webpack_require__(44);
var anObject = __webpack_require__(4);
var isObject = __webpack_require__(7);

function set(target, propertyKey, V /* , receiver */) {
  var receiver = arguments.length < 4 ? target : arguments[3];
  var ownDesc = gOPD.f(anObject(target), propertyKey);
  var existingDescriptor, proto;
  if (!ownDesc) {
    if (isObject(proto = getPrototypeOf(target))) {
      return set(proto, propertyKey, V, receiver);
    }
    ownDesc = createDesc(0);
  }
  if (has(ownDesc, 'value')) {
    if (ownDesc.writable === false || !isObject(receiver)) return false;
    existingDescriptor = gOPD.f(receiver, propertyKey) || createDesc(0);
    existingDescriptor.value = V;
    dP.f(receiver, propertyKey, existingDescriptor);
    return true;
  }
  return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
}

$export($export.S, 'Reflect', { set: set });

/***/ }),
/* 356 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 26.1.14 Reflect.setPrototypeOf(target, proto)
var $export = __webpack_require__(0);
var setProto = __webpack_require__(105);

if (setProto) $export($export.S, 'Reflect', {
  setPrototypeOf: function setPrototypeOf(target, proto) {
    setProto.check(target, proto);
    try {
      setProto.set(target, proto);
      return true;
    } catch (e) {
      return false;
    }
  }
});

/***/ }),
/* 357 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://github.com/tc39/Array.prototype.includes

var $export = __webpack_require__(0);
var $includes = __webpack_require__(78)(true);

$export($export.P, 'Array', {
  includes: function includes(el /* , fromIndex = 0 */) {
    return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  }
});

__webpack_require__(40)('includes');

/***/ }),
/* 358 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatMap

var $export = __webpack_require__(0);
var flattenIntoArray = __webpack_require__(169);
var toObject = __webpack_require__(14);
var toLength = __webpack_require__(12);
var aFunction = __webpack_require__(15);
var arraySpeciesCreate = __webpack_require__(119);

$export($export.P, 'Array', {
  flatMap: function flatMap(callbackfn /* , thisArg */) {
    var O = toObject(this);
    var sourceLen, A;
    aFunction(callbackfn);
    sourceLen = toLength(O.length);
    A = arraySpeciesCreate(O, 0);
    flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments[1]);
    return A;
  }
});

__webpack_require__(40)('flatMap');

/***/ }),
/* 359 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatten

var $export = __webpack_require__(0);
var flattenIntoArray = __webpack_require__(169);
var toObject = __webpack_require__(14);
var toLength = __webpack_require__(12);
var toInteger = __webpack_require__(31);
var arraySpeciesCreate = __webpack_require__(119);

$export($export.P, 'Array', {
  flatten: function flatten() /* depthArg = 1 */{
    var depthArg = arguments[0];
    var O = toObject(this);
    var sourceLen = toLength(O.length);
    var A = arraySpeciesCreate(O, 0);
    flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg));
    return A;
  }
});

__webpack_require__(40)('flatten');

/***/ }),
/* 360 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://github.com/mathiasbynens/String.prototype.at

var $export = __webpack_require__(0);
var $at = __webpack_require__(111)(true);

$export($export.P, 'String', {
  at: function at(pos) {
    return $at(this, pos);
  }
});

/***/ }),
/* 361 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://github.com/tc39/proposal-string-pad-start-end

var $export = __webpack_require__(0);
var $pad = __webpack_require__(170);
var userAgent = __webpack_require__(126);

// https://github.com/zloirock/core-js/issues/280
$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', {
  padStart: function padStart(maxLength /* , fillString = ' ' */) {
    return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
  }
});

/***/ }),
/* 362 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://github.com/tc39/proposal-string-pad-start-end

var $export = __webpack_require__(0);
var $pad = __webpack_require__(170);
var userAgent = __webpack_require__(126);

// https://github.com/zloirock/core-js/issues/280
$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', {
  padEnd: function padEnd(maxLength /* , fillString = ' ' */) {
    return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
  }
});

/***/ }),
/* 363 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://github.com/sebmarkbage/ecmascript-string-left-right-trim

__webpack_require__(60)('trimLeft', function ($trim) {
  return function trimLeft() {
    return $trim(this, 1);
  };
}, 'trimStart');

/***/ }),
/* 364 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://github.com/sebmarkbage/ecmascript-string-left-right-trim

__webpack_require__(60)('trimRight', function ($trim) {
  return function trimRight() {
    return $trim(this, 2);
  };
}, 'trimEnd');

/***/ }),
/* 365 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://tc39.github.io/String.prototype.matchAll/

var $export = __webpack_require__(0);
var defined = __webpack_require__(30);
var toLength = __webpack_require__(12);
var isRegExp = __webpack_require__(81);
var getFlags = __webpack_require__(83);
var RegExpProto = RegExp.prototype;

var $RegExpStringIterator = function $RegExpStringIterator(regexp, string) {
  this._r = regexp;
  this._s = string;
};

__webpack_require__(113)($RegExpStringIterator, 'RegExp String', function next() {
  var match = this._r.exec(this._s);
  return { value: match, done: match === null };
});

$export($export.P, 'String', {
  matchAll: function matchAll(regexp) {
    defined(this);
    if (!isRegExp(regexp)) throw TypeError(regexp + ' is not a regexp!');
    var S = String(this);
    var flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp);
    var rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags);
    rx.lastIndex = toLength(regexp.lastIndex);
    return new $RegExpStringIterator(rx, S);
  }
});

/***/ }),
/* 366 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(101)('asyncIterator');

/***/ }),
/* 367 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(101)('observable');

/***/ }),
/* 368 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/tc39/proposal-object-getownpropertydescriptors
var $export = __webpack_require__(0);
var ownKeys = __webpack_require__(168);
var toIObject = __webpack_require__(20);
var gOPD = __webpack_require__(21);
var createProperty = __webpack_require__(117);

$export($export.S, 'Object', {
  getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
    var O = toIObject(object);
    var getDesc = gOPD.f;
    var keys = ownKeys(O);
    var result = {};
    var i = 0;
    var key, desc;
    while (keys.length > i) {
      desc = getDesc(O, key = keys[i++]);
      if (desc !== undefined) createProperty(result, key, desc);
    }
    return result;
  }
});

/***/ }),
/* 369 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/tc39/proposal-object-values-entries
var $export = __webpack_require__(0);
var $values = __webpack_require__(171)(false);

$export($export.S, 'Object', {
  values: function values(it) {
    return $values(it);
  }
});

/***/ }),
/* 370 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/tc39/proposal-object-values-entries
var $export = __webpack_require__(0);
var $entries = __webpack_require__(171)(true);

$export($export.S, 'Object', {
  entries: function entries(it) {
    return $entries(it);
  }
});

/***/ }),
/* 371 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var toObject = __webpack_require__(14);
var aFunction = __webpack_require__(15);
var $defineProperty = __webpack_require__(11);

// B.2.2.2 Object.prototype.__defineGetter__(P, getter)
__webpack_require__(10) && $export($export.P + __webpack_require__(88), 'Object', {
  __defineGetter__: function __defineGetter__(P, getter) {
    $defineProperty.f(toObject(this), P, { get: aFunction(getter), enumerable: true, configurable: true });
  }
});

/***/ }),
/* 372 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var toObject = __webpack_require__(14);
var aFunction = __webpack_require__(15);
var $defineProperty = __webpack_require__(11);

// B.2.2.3 Object.prototype.__defineSetter__(P, setter)
__webpack_require__(10) && $export($export.P + __webpack_require__(88), 'Object', {
  __defineSetter__: function __defineSetter__(P, setter) {
    $defineProperty.f(toObject(this), P, { set: aFunction(setter), enumerable: true, configurable: true });
  }
});

/***/ }),
/* 373 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var toObject = __webpack_require__(14);
var toPrimitive = __webpack_require__(29);
var getPrototypeOf = __webpack_require__(22);
var getOwnPropertyDescriptor = __webpack_require__(21).f;

// B.2.2.4 Object.prototype.__lookupGetter__(P)
__webpack_require__(10) && $export($export.P + __webpack_require__(88), 'Object', {
  __lookupGetter__: function __lookupGetter__(P) {
    var O = toObject(this);
    var K = toPrimitive(P, true);
    var D;
    do {
      if (D = getOwnPropertyDescriptor(O, K)) return D.get;
    } while (O = getPrototypeOf(O));
  }
});

/***/ }),
/* 374 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var toObject = __webpack_require__(14);
var toPrimitive = __webpack_require__(29);
var getPrototypeOf = __webpack_require__(22);
var getOwnPropertyDescriptor = __webpack_require__(21).f;

// B.2.2.5 Object.prototype.__lookupSetter__(P)
__webpack_require__(10) && $export($export.P + __webpack_require__(88), 'Object', {
  __lookupSetter__: function __lookupSetter__(P) {
    var O = toObject(this);
    var K = toPrimitive(P, true);
    var D;
    do {
      if (D = getOwnPropertyDescriptor(O, K)) return D.set;
    } while (O = getPrototypeOf(O));
  }
});

/***/ }),
/* 375 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var $export = __webpack_require__(0);

$export($export.P + $export.R, 'Map', { toJSON: __webpack_require__(172)('Map') });

/***/ }),
/* 376 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var $export = __webpack_require__(0);

$export($export.P + $export.R, 'Set', { toJSON: __webpack_require__(172)('Set') });

/***/ }),
/* 377 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
__webpack_require__(89)('Map');

/***/ }),
/* 378 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://tc39.github.io/proposal-setmap-offrom/#sec-set.of
__webpack_require__(89)('Set');

/***/ }),
/* 379 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of
__webpack_require__(89)('WeakMap');

/***/ }),
/* 380 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of
__webpack_require__(89)('WeakSet');

/***/ }),
/* 381 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
__webpack_require__(90)('Map');

/***/ }),
/* 382 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://tc39.github.io/proposal-setmap-offrom/#sec-set.from
__webpack_require__(90)('Set');

/***/ }),
/* 383 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from
__webpack_require__(90)('WeakMap');

/***/ }),
/* 384 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from
__webpack_require__(90)('WeakSet');

/***/ }),
/* 385 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/tc39/proposal-global
var $export = __webpack_require__(0);

$export($export.G, { global: __webpack_require__(5) });

/***/ }),
/* 386 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/tc39/proposal-global
var $export = __webpack_require__(0);

$export($export.S, 'System', { global: __webpack_require__(5) });

/***/ }),
/* 387 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/ljharb/proposal-is-error
var $export = __webpack_require__(0);
var cof = __webpack_require__(26);

$export($export.S, 'Error', {
  isError: function isError(it) {
    return cof(it) === 'Error';
  }
});

/***/ }),
/* 388 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://rwaldron.github.io/proposal-math-extensions/
var $export = __webpack_require__(0);

$export($export.S, 'Math', {
  clamp: function clamp(x, lower, upper) {
    return Math.min(upper, Math.max(lower, x));
  }
});

/***/ }),
/* 389 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://rwaldron.github.io/proposal-math-extensions/
var $export = __webpack_require__(0);

$export($export.S, 'Math', { DEG_PER_RAD: Math.PI / 180 });

/***/ }),
/* 390 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://rwaldron.github.io/proposal-math-extensions/
var $export = __webpack_require__(0);
var RAD_PER_DEG = 180 / Math.PI;

$export($export.S, 'Math', {
  degrees: function degrees(radians) {
    return radians * RAD_PER_DEG;
  }
});

/***/ }),
/* 391 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://rwaldron.github.io/proposal-math-extensions/
var $export = __webpack_require__(0);
var scale = __webpack_require__(174);
var fround = __webpack_require__(154);

$export($export.S, 'Math', {
  fscale: function fscale(x, inLow, inHigh, outLow, outHigh) {
    return fround(scale(x, inLow, inHigh, outLow, outHigh));
  }
});

/***/ }),
/* 392 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
var $export = __webpack_require__(0);

$export($export.S, 'Math', {
  iaddh: function iaddh(x0, x1, y0, y1) {
    var $x0 = x0 >>> 0;
    var $x1 = x1 >>> 0;
    var $y0 = y0 >>> 0;
    return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0;
  }
});

/***/ }),
/* 393 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
var $export = __webpack_require__(0);

$export($export.S, 'Math', {
  isubh: function isubh(x0, x1, y0, y1) {
    var $x0 = x0 >>> 0;
    var $x1 = x1 >>> 0;
    var $y0 = y0 >>> 0;
    return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0;
  }
});

/***/ }),
/* 394 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
var $export = __webpack_require__(0);

$export($export.S, 'Math', {
  imulh: function imulh(u, v) {
    var UINT16 = 0xffff;
    var $u = +u;
    var $v = +v;
    var u0 = $u & UINT16;
    var v0 = $v & UINT16;
    var u1 = $u >> 16;
    var v1 = $v >> 16;
    var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
    return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16);
  }
});

/***/ }),
/* 395 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://rwaldron.github.io/proposal-math-extensions/
var $export = __webpack_require__(0);

$export($export.S, 'Math', { RAD_PER_DEG: 180 / Math.PI });

/***/ }),
/* 396 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://rwaldron.github.io/proposal-math-extensions/
var $export = __webpack_require__(0);
var DEG_PER_RAD = Math.PI / 180;

$export($export.S, 'Math', {
  radians: function radians(degrees) {
    return degrees * DEG_PER_RAD;
  }
});

/***/ }),
/* 397 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://rwaldron.github.io/proposal-math-extensions/
var $export = __webpack_require__(0);

$export($export.S, 'Math', { scale: __webpack_require__(174) });

/***/ }),
/* 398 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
var $export = __webpack_require__(0);

$export($export.S, 'Math', {
  umulh: function umulh(u, v) {
    var UINT16 = 0xffff;
    var $u = +u;
    var $v = +v;
    var u0 = $u & UINT16;
    var v0 = $v & UINT16;
    var u1 = $u >>> 16;
    var v1 = $v >>> 16;
    var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
    return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16);
  }
});

/***/ }),
/* 399 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// http://jfbastien.github.io/papers/Math.signbit.html
var $export = __webpack_require__(0);

$export($export.S, 'Math', { signbit: function signbit(x) {
    // eslint-disable-next-line no-self-compare
    return (x = +x) != x ? x : x == 0 ? 1 / x == Infinity : x > 0;
  } });

/***/ }),
/* 400 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// https://github.com/tc39/proposal-promise-finally


var $export = __webpack_require__(0);
var core = __webpack_require__(28);
var global = __webpack_require__(5);
var speciesConstructor = __webpack_require__(85);
var promiseResolve = __webpack_require__(161);

$export($export.P + $export.R, 'Promise', { 'finally': function _finally(onFinally) {
    var C = speciesConstructor(this, core.Promise || global.Promise);
    var isFunction = typeof onFinally == 'function';
    return this.then(isFunction ? function (x) {
      return promiseResolve(C, onFinally()).then(function () {
        return x;
      });
    } : onFinally, isFunction ? function (e) {
      return promiseResolve(C, onFinally()).then(function () {
        throw e;
      });
    } : onFinally);
  } });

/***/ }),
/* 401 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://github.com/tc39/proposal-promise-try

var $export = __webpack_require__(0);
var newPromiseCapability = __webpack_require__(124);
var perform = __webpack_require__(160);

$export($export.S, 'Promise', { 'try': function _try(callbackfn) {
    var promiseCapability = newPromiseCapability.f(this);
    var result = perform(callbackfn);
    (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
    return promiseCapability.promise;
  } });

/***/ }),
/* 402 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var metadata = __webpack_require__(37);
var anObject = __webpack_require__(4);
var toMetaKey = metadata.key;
var ordinaryDefineOwnMetadata = metadata.set;

metadata.exp({ defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey) {
    ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey));
  } });

/***/ }),
/* 403 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var metadata = __webpack_require__(37);
var anObject = __webpack_require__(4);
var toMetaKey = metadata.key;
var getOrCreateMetadataMap = metadata.map;
var store = metadata.store;

metadata.exp({ deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) {
    var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]);
    var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false);
    if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false;
    if (metadataMap.size) return true;
    var targetMetadata = store.get(target);
    targetMetadata['delete'](targetKey);
    return !!targetMetadata.size || store['delete'](target);
  } });

/***/ }),
/* 404 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var metadata = __webpack_require__(37);
var anObject = __webpack_require__(4);
var getPrototypeOf = __webpack_require__(22);
var ordinaryHasOwnMetadata = metadata.has;
var ordinaryGetOwnMetadata = metadata.get;
var toMetaKey = metadata.key;

var ordinaryGetMetadata = function ordinaryGetMetadata(MetadataKey, O, P) {
  var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
  if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P);
  var parent = getPrototypeOf(O);
  return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined;
};

metadata.exp({ getMetadata: function getMetadata(metadataKey, target /* , targetKey */) {
    return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
  } });

/***/ }),
/* 405 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var Set = __webpack_require__(164);
var from = __webpack_require__(173);
var metadata = __webpack_require__(37);
var anObject = __webpack_require__(4);
var getPrototypeOf = __webpack_require__(22);
var ordinaryOwnMetadataKeys = metadata.keys;
var toMetaKey = metadata.key;

var ordinaryMetadataKeys = function ordinaryMetadataKeys(O, P) {
  var oKeys = ordinaryOwnMetadataKeys(O, P);
  var parent = getPrototypeOf(O);
  if (parent === null) return oKeys;
  var pKeys = ordinaryMetadataKeys(parent, P);
  return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys;
};

metadata.exp({ getMetadataKeys: function getMetadataKeys(target /* , targetKey */) {
    return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
  } });

/***/ }),
/* 406 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var metadata = __webpack_require__(37);
var anObject = __webpack_require__(4);
var ordinaryGetOwnMetadata = metadata.get;
var toMetaKey = metadata.key;

metadata.exp({ getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) {
    return ordinaryGetOwnMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
  } });

/***/ }),
/* 407 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var metadata = __webpack_require__(37);
var anObject = __webpack_require__(4);
var ordinaryOwnMetadataKeys = metadata.keys;
var toMetaKey = metadata.key;

metadata.exp({ getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) {
    return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
  } });

/***/ }),
/* 408 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var metadata = __webpack_require__(37);
var anObject = __webpack_require__(4);
var getPrototypeOf = __webpack_require__(22);
var ordinaryHasOwnMetadata = metadata.has;
var toMetaKey = metadata.key;

var ordinaryHasMetadata = function ordinaryHasMetadata(MetadataKey, O, P) {
  var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
  if (hasOwn) return true;
  var parent = getPrototypeOf(O);
  return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false;
};

metadata.exp({ hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) {
    return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
  } });

/***/ }),
/* 409 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var metadata = __webpack_require__(37);
var anObject = __webpack_require__(4);
var ordinaryHasOwnMetadata = metadata.has;
var toMetaKey = metadata.key;

metadata.exp({ hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) {
    return ordinaryHasOwnMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
  } });

/***/ }),
/* 410 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $metadata = __webpack_require__(37);
var anObject = __webpack_require__(4);
var aFunction = __webpack_require__(15);
var toMetaKey = $metadata.key;
var ordinaryDefineOwnMetadata = $metadata.set;

$metadata.exp({ metadata: function metadata(metadataKey, metadataValue) {
    return function decorator(target, targetKey) {
      ordinaryDefineOwnMetadata(metadataKey, metadataValue, (targetKey !== undefined ? anObject : aFunction)(target), toMetaKey(targetKey));
    };
  } });

/***/ }),
/* 411 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask
var $export = __webpack_require__(0);
var microtask = __webpack_require__(123)();
var process = __webpack_require__(5).process;
var isNode = __webpack_require__(26)(process) == 'process';

$export($export.G, {
  asap: function asap(fn) {
    var domain = isNode && process.domain;
    microtask(domain ? domain.bind(fn) : fn);
  }
});

/***/ }),
/* 412 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://github.com/zenparsing/es-observable

var $export = __webpack_require__(0);
var global = __webpack_require__(5);
var core = __webpack_require__(28);
var microtask = __webpack_require__(123)();
var OBSERVABLE = __webpack_require__(8)('observable');
var aFunction = __webpack_require__(15);
var anObject = __webpack_require__(4);
var anInstance = __webpack_require__(52);
var redefineAll = __webpack_require__(54);
var hide = __webpack_require__(17);
var forOf = __webpack_require__(53);
var RETURN = forOf.RETURN;

var getMethod = function getMethod(fn) {
  return fn == null ? undefined : aFunction(fn);
};

var cleanupSubscription = function cleanupSubscription(subscription) {
  var cleanup = subscription._c;
  if (cleanup) {
    subscription._c = undefined;
    cleanup();
  }
};

var subscriptionClosed = function subscriptionClosed(subscription) {
  return subscription._o === undefined;
};

var closeSubscription = function closeSubscription(subscription) {
  if (!subscriptionClosed(subscription)) {
    subscription._o = undefined;
    cleanupSubscription(subscription);
  }
};

var Subscription = function Subscription(observer, subscriber) {
  anObject(observer);
  this._c = undefined;
  this._o = observer;
  observer = new SubscriptionObserver(this);
  try {
    var cleanup = subscriber(observer);
    var subscription = cleanup;
    if (cleanup != null) {
      if (typeof cleanup.unsubscribe === 'function') cleanup = function cleanup() {
        subscription.unsubscribe();
      };else aFunction(cleanup);
      this._c = cleanup;
    }
  } catch (e) {
    observer.error(e);
    return;
  }if (subscriptionClosed(this)) cleanupSubscription(this);
};

Subscription.prototype = redefineAll({}, {
  unsubscribe: function unsubscribe() {
    closeSubscription(this);
  }
});

var SubscriptionObserver = function SubscriptionObserver(subscription) {
  this._s = subscription;
};

SubscriptionObserver.prototype = redefineAll({}, {
  next: function next(value) {
    var subscription = this._s;
    if (!subscriptionClosed(subscription)) {
      var observer = subscription._o;
      try {
        var m = getMethod(observer.next);
        if (m) return m.call(observer, value);
      } catch (e) {
        try {
          closeSubscription(subscription);
        } finally {
          throw e;
        }
      }
    }
  },
  error: function error(value) {
    var subscription = this._s;
    if (subscriptionClosed(subscription)) throw value;
    var observer = subscription._o;
    subscription._o = undefined;
    try {
      var m = getMethod(observer.error);
      if (!m) throw value;
      value = m.call(observer, value);
    } catch (e) {
      try {
        cleanupSubscription(subscription);
      } finally {
        throw e;
      }
    }cleanupSubscription(subscription);
    return value;
  },
  complete: function complete(value) {
    var subscription = this._s;
    if (!subscriptionClosed(subscription)) {
      var observer = subscription._o;
      subscription._o = undefined;
      try {
        var m = getMethod(observer.complete);
        value = m ? m.call(observer, value) : undefined;
      } catch (e) {
        try {
          cleanupSubscription(subscription);
        } finally {
          throw e;
        }
      }cleanupSubscription(subscription);
      return value;
    }
  }
});

var $Observable = function Observable(subscriber) {
  anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber);
};

redefineAll($Observable.prototype, {
  subscribe: function subscribe(observer) {
    return new Subscription(observer, this._f);
  },
  forEach: function forEach(fn) {
    var that = this;
    return new (core.Promise || global.Promise)(function (resolve, reject) {
      aFunction(fn);
      var subscription = that.subscribe({
        next: function next(value) {
          try {
            return fn(value);
          } catch (e) {
            reject(e);
            subscription.unsubscribe();
          }
        },
        error: reject,
        complete: resolve
      });
    });
  }
});

redefineAll($Observable, {
  from: function from(x) {
    var C = typeof this === 'function' ? this : $Observable;
    var method = getMethod(anObject(x)[OBSERVABLE]);
    if (method) {
      var observable = anObject(method.call(x));
      return observable.constructor === C ? observable : new C(function (observer) {
        return observable.subscribe(observer);
      });
    }
    return new C(function (observer) {
      var done = false;
      microtask(function () {
        if (!done) {
          try {
            if (forOf(x, false, function (it) {
              observer.next(it);
              if (done) return RETURN;
            }) === RETURN) return;
          } catch (e) {
            if (done) throw e;
            observer.error(e);
            return;
          }observer.complete();
        }
      });
      return function () {
        done = true;
      };
    });
  },
  of: function of() {
    for (var i = 0, l = arguments.length, items = new Array(l); i < l;) {
      items[i] = arguments[i++];
    }return new (typeof this === 'function' ? this : $Observable)(function (observer) {
      var done = false;
      microtask(function () {
        if (!done) {
          for (var j = 0; j < items.length; ++j) {
            observer.next(items[j]);
            if (done) return;
          }observer.complete();
        }
      });
      return function () {
        done = true;
      };
    });
  }
});

hide($Observable.prototype, OBSERVABLE, function () {
  return this;
});

$export($export.G, { Observable: $Observable });

__webpack_require__(51)('Observable');

/***/ }),
/* 413 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// ie9- setTimeout & setInterval additional parameters fix
var global = __webpack_require__(5);
var $export = __webpack_require__(0);
var userAgent = __webpack_require__(126);
var slice = [].slice;
var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check
var wrap = function wrap(set) {
  return function (fn, time /* , ...args */) {
    var boundArgs = arguments.length > 2;
    var args = boundArgs ? slice.call(arguments, 2) : false;
    return set(boundArgs ? function () {
      // eslint-disable-next-line no-new-func
      (typeof fn == 'function' ? fn : Function(fn)).apply(this, args);
    } : fn, time);
  };
};
$export($export.G + $export.B + $export.F * MSIE, {
  setTimeout: wrap(global.setTimeout),
  setInterval: wrap(global.setInterval)
});

/***/ }),
/* 414 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(0);
var $task = __webpack_require__(122);
$export($export.G + $export.B, {
  setImmediate: $task.set,
  clearImmediate: $task.clear
});

/***/ }),
/* 415 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $iterators = __webpack_require__(121);
var getKeys = __webpack_require__(47);
var redefine = __webpack_require__(18);
var global = __webpack_require__(5);
var hide = __webpack_require__(17);
var Iterators = __webpack_require__(61);
var wks = __webpack_require__(8);
var ITERATOR = wks('iterator');
var TO_STRING_TAG = wks('toStringTag');
var ArrayValues = Iterators.Array;

var DOMIterables = {
  CSSRuleList: true, // TODO: Not spec compliant, should be false.
  CSSStyleDeclaration: false,
  CSSValueList: false,
  ClientRectList: false,
  DOMRectList: false,
  DOMStringList: false,
  DOMTokenList: true,
  DataTransferItemList: false,
  FileList: false,
  HTMLAllCollection: false,
  HTMLCollection: false,
  HTMLFormElement: false,
  HTMLSelectElement: false,
  MediaList: true, // TODO: Not spec compliant, should be false.
  MimeTypeArray: false,
  NamedNodeMap: false,
  NodeList: true,
  PaintRequestList: false,
  Plugin: false,
  PluginArray: false,
  SVGLengthList: false,
  SVGNumberList: false,
  SVGPathSegList: false,
  SVGPointList: false,
  SVGStringList: false,
  SVGTransformList: false,
  SourceBufferList: false,
  StyleSheetList: true, // TODO: Not spec compliant, should be false.
  TextTrackCueList: false,
  TextTrackList: false,
  TouchList: false
};

for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {
  var NAME = collections[i];
  var explicit = DOMIterables[NAME];
  var Collection = global[NAME];
  var proto = Collection && Collection.prototype;
  var key;
  if (proto) {
    if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);
    if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
    Iterators[NAME] = ArrayValues;
    if (explicit) for (key in $iterators) {
      if (!proto[key]) redefine(proto, key, $iterators[key], true);
    }
  }
}

/***/ }),
/* 416 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global, module) {

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

/**
 * Copyright (c) 2014, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
 * additional grant of patent rights can be found in the PATENTS file in
 * the same directory.
 */

!function (global) {
  "use strict";

  var Op = Object.prototype;
  var hasOwn = Op.hasOwnProperty;
  var undefined; // More compressible than void 0.
  var $Symbol = typeof Symbol === "function" ? Symbol : {};
  var iteratorSymbol = $Symbol.iterator || "@@iterator";
  var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";

  var inModule = ( false ? "undefined" : _typeof(module)) === "object";
  var runtime = global.regeneratorRuntime;
  if (runtime) {
    if (inModule) {
      // If regeneratorRuntime is defined globally and we're in a module,
      // make the exports object identical to regeneratorRuntime.
      module.exports = runtime;
    }
    // Don't bother evaluating the rest of this file if the runtime was
    // already defined globally.
    return;
  }

  // Define the runtime globally (as expected by generated code) as either
  // module.exports (if we're in a module) or a new, empty object.
  runtime = global.regeneratorRuntime = inModule ? module.exports : {};

  function wrap(innerFn, outerFn, self, tryLocsList) {
    // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
    var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
    var generator = Object.create(protoGenerator.prototype);
    var context = new Context(tryLocsList || []);

    // The ._invoke method unifies the implementations of the .next,
    // .throw, and .return methods.
    generator._invoke = makeInvokeMethod(innerFn, self, context);

    return generator;
  }
  runtime.wrap = wrap;

  // Try/catch helper to minimize deoptimizations. Returns a completion
  // record like context.tryEntries[i].completion. This interface could
  // have been (and was previously) designed to take a closure to be
  // invoked without arguments, but in all the cases we care about we
  // already have an existing method we want to call, so there's no need
  // to create a new function object. We can even get away with assuming
  // the method takes exactly one argument, since that happens to be true
  // in every case, so we don't have to touch the arguments object. The
  // only additional allocation required is the completion record, which
  // has a stable shape and so hopefully should be cheap to allocate.
  function tryCatch(fn, obj, arg) {
    try {
      return { type: "normal", arg: fn.call(obj, arg) };
    } catch (err) {
      return { type: "throw", arg: err };
    }
  }

  var GenStateSuspendedStart = "suspendedStart";
  var GenStateSuspendedYield = "suspendedYield";
  var GenStateExecuting = "executing";
  var GenStateCompleted = "completed";

  // Returning this object from the innerFn has the same effect as
  // breaking out of the dispatch switch statement.
  var ContinueSentinel = {};

  // Dummy constructor functions that we use as the .constructor and
  // .constructor.prototype properties for functions that return Generator
  // objects. For full spec compliance, you may wish to configure your
  // minifier not to mangle the names of these two functions.
  function Generator() {}
  function GeneratorFunction() {}
  function GeneratorFunctionPrototype() {}

  // This is a polyfill for %IteratorPrototype% for environments that
  // don't natively support it.
  var IteratorPrototype = {};
  IteratorPrototype[iteratorSymbol] = function () {
    return this;
  };

  var getProto = Object.getPrototypeOf;
  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
    // This environment has a native %IteratorPrototype%; use it instead
    // of the polyfill.
    IteratorPrototype = NativeIteratorPrototype;
  }

  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
  GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  GeneratorFunctionPrototype.constructor = GeneratorFunction;
  GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction";

  // Helper for defining the .next, .throw, and .return methods of the
  // Iterator interface in terms of a single ._invoke method.
  function defineIteratorMethods(prototype) {
    ["next", "throw", "return"].forEach(function (method) {
      prototype[method] = function (arg) {
        return this._invoke(method, arg);
      };
    });
  }

  runtime.isGeneratorFunction = function (genFun) {
    var ctor = typeof genFun === "function" && genFun.constructor;
    return ctor ? ctor === GeneratorFunction ||
    // For the native GeneratorFunction constructor, the best we can
    // do is to check its .name property.
    (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
  };

  runtime.mark = function (genFun) {
    if (Object.setPrototypeOf) {
      Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
    } else {
      genFun.__proto__ = GeneratorFunctionPrototype;
      if (!(toStringTagSymbol in genFun)) {
        genFun[toStringTagSymbol] = "GeneratorFunction";
      }
    }
    genFun.prototype = Object.create(Gp);
    return genFun;
  };

  // Within the body of any async function, `await x` is transformed to
  // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  // `hasOwn.call(value, "__await")` to determine if the yielded value is
  // meant to be awaited.
  runtime.awrap = function (arg) {
    return { __await: arg };
  };

  function AsyncIterator(generator) {
    function invoke(method, arg, resolve, reject) {
      var record = tryCatch(generator[method], generator, arg);
      if (record.type === "throw") {
        reject(record.arg);
      } else {
        var result = record.arg;
        var value = result.value;
        if (value && (typeof value === "undefined" ? "undefined" : _typeof(value)) === "object" && hasOwn.call(value, "__await")) {
          return Promise.resolve(value.__await).then(function (value) {
            invoke("next", value, resolve, reject);
          }, function (err) {
            invoke("throw", err, resolve, reject);
          });
        }

        return Promise.resolve(value).then(function (unwrapped) {
          // When a yielded Promise is resolved, its final value becomes
          // the .value of the Promise<{value,done}> result for the
          // current iteration. If the Promise is rejected, however, the
          // result for this iteration will be rejected with the same
          // reason. Note that rejections of yielded Promises are not
          // thrown back into the generator function, as is the case
          // when an awaited Promise is rejected. This difference in
          // behavior between yield and await is important, because it
          // allows the consumer to decide what to do with the yielded
          // rejection (swallow it and continue, manually .throw it back
          // into the generator, abandon iteration, whatever). With
          // await, by contrast, there is no opportunity to examine the
          // rejection reason outside the generator function, so the
          // only option is to throw it from the await expression, and
          // let the generator function handle the exception.
          result.value = unwrapped;
          resolve(result);
        }, reject);
      }
    }

    if (_typeof(global.process) === "object" && global.process.domain) {
      invoke = global.process.domain.bind(invoke);
    }

    var previousPromise;

    function enqueue(method, arg) {
      function callInvokeWithMethodAndArg() {
        return new Promise(function (resolve, reject) {
          invoke(method, arg, resolve, reject);
        });
      }

      return previousPromise =
      // If enqueue has been called before, then we want to wait until
      // all previous Promises have been resolved before calling invoke,
      // so that results are always delivered in the correct order. If
      // enqueue has not been called before, then it is important to
      // call invoke immediately, without waiting on a callback to fire,
      // so that the async generator function has the opportunity to do
      // any necessary setup in a predictable way. This predictability
      // is why the Promise constructor synchronously invokes its
      // executor callback, and why async functions synchronously
      // execute code before the first await. Since we implement simple
      // async functions in terms of async generators, it is especially
      // important to get this right, even though it requires care.
      previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
      // Avoid propagating failures to Promises returned by later
      // invocations of the iterator.
      callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
    }

    // Define the unified helper method that is used to implement .next,
    // .throw, and .return (see defineIteratorMethods).
    this._invoke = enqueue;
  }

  defineIteratorMethods(AsyncIterator.prototype);
  AsyncIterator.prototype[asyncIteratorSymbol] = function () {
    return this;
  };
  runtime.AsyncIterator = AsyncIterator;

  // Note that simple async functions are implemented on top of
  // AsyncIterator objects; they just return a Promise for the value of
  // the final result produced by the iterator.
  runtime.async = function (innerFn, outerFn, self, tryLocsList) {
    var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList));

    return runtime.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
    : iter.next().then(function (result) {
      return result.done ? result.value : iter.next();
    });
  };

  function makeInvokeMethod(innerFn, self, context) {
    var state = GenStateSuspendedStart;

    return function invoke(method, arg) {
      if (state === GenStateExecuting) {
        throw new Error("Generator is already running");
      }

      if (state === GenStateCompleted) {
        if (method === "throw") {
          throw arg;
        }

        // Be forgiving, per 25.3.3.3.3 of the spec:
        // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
        return doneResult();
      }

      context.method = method;
      context.arg = arg;

      while (true) {
        var delegate = context.delegate;
        if (delegate) {
          var delegateResult = maybeInvokeDelegate(delegate, context);
          if (delegateResult) {
            if (delegateResult === ContinueSentinel) continue;
            return delegateResult;
          }
        }

        if (context.method === "next") {
          // Setting context._sent for legacy support of Babel's
          // function.sent implementation.
          context.sent = context._sent = context.arg;
        } else if (context.method === "throw") {
          if (state === GenStateSuspendedStart) {
            state = GenStateCompleted;
            throw context.arg;
          }

          context.dispatchException(context.arg);
        } else if (context.method === "return") {
          context.abrupt("return", context.arg);
        }

        state = GenStateExecuting;

        var record = tryCatch(innerFn, self, context);
        if (record.type === "normal") {
          // If an exception is thrown from innerFn, we leave state ===
          // GenStateExecuting and loop back for another invocation.
          state = context.done ? GenStateCompleted : GenStateSuspendedYield;

          if (record.arg === ContinueSentinel) {
            continue;
          }

          return {
            value: record.arg,
            done: context.done
          };
        } else if (record.type === "throw") {
          state = GenStateCompleted;
          // Dispatch the exception by looping back around to the
          // context.dispatchException(context.arg) call above.
          context.method = "throw";
          context.arg = record.arg;
        }
      }
    };
  }

  // Call delegate.iterator[context.method](context.arg) and handle the
  // result, either by returning a { value, done } result from the
  // delegate iterator, or by modifying context.method and context.arg,
  // setting context.delegate to null, and returning the ContinueSentinel.
  function maybeInvokeDelegate(delegate, context) {
    var method = delegate.iterator[context.method];
    if (method === undefined) {
      // A .throw or .return when the delegate iterator has no .throw
      // method always terminates the yield* loop.
      context.delegate = null;

      if (context.method === "throw") {
        if (delegate.iterator.return) {
          // If the delegate iterator has a return method, give it a
          // chance to clean up.
          context.method = "return";
          context.arg = undefined;
          maybeInvokeDelegate(delegate, context);

          if (context.method === "throw") {
            // If maybeInvokeDelegate(context) changed context.method from
            // "return" to "throw", let that override the TypeError below.
            return ContinueSentinel;
          }
        }

        context.method = "throw";
        context.arg = new TypeError("The iterator does not provide a 'throw' method");
      }

      return ContinueSentinel;
    }

    var record = tryCatch(method, delegate.iterator, context.arg);

    if (record.type === "throw") {
      context.method = "throw";
      context.arg = record.arg;
      context.delegate = null;
      return ContinueSentinel;
    }

    var info = record.arg;

    if (!info) {
      context.method = "throw";
      context.arg = new TypeError("iterator result is not an object");
      context.delegate = null;
      return ContinueSentinel;
    }

    if (info.done) {
      // Assign the result of the finished delegate to the temporary
      // variable specified by delegate.resultName (see delegateYield).
      context[delegate.resultName] = info.value;

      // Resume execution at the desired location (see delegateYield).
      context.next = delegate.nextLoc;

      // If context.method was "throw" but the delegate handled the
      // exception, let the outer generator proceed normally. If
      // context.method was "next", forget context.arg since it has been
      // "consumed" by the delegate iterator. If context.method was
      // "return", allow the original .return call to continue in the
      // outer generator.
      if (context.method !== "return") {
        context.method = "next";
        context.arg = undefined;
      }
    } else {
      // Re-yield the result returned by the delegate method.
      return info;
    }

    // The delegate iterator is finished, so forget it and continue with
    // the outer generator.
    context.delegate = null;
    return ContinueSentinel;
  }

  // Define Generator.prototype.{next,throw,return} in terms of the
  // unified ._invoke helper method.
  defineIteratorMethods(Gp);

  Gp[toStringTagSymbol] = "Generator";

  // A Generator should always return itself as the iterator object when the
  // @@iterator function is called on it. Some browsers' implementations of the
  // iterator prototype chain incorrectly implement this, causing the Generator
  // object to not be returned from this call. This ensures that doesn't happen.
  // See https://github.com/facebook/regenerator/issues/274 for more details.
  Gp[iteratorSymbol] = function () {
    return this;
  };

  Gp.toString = function () {
    return "[object Generator]";
  };

  function pushTryEntry(locs) {
    var entry = { tryLoc: locs[0] };

    if (1 in locs) {
      entry.catchLoc = locs[1];
    }

    if (2 in locs) {
      entry.finallyLoc = locs[2];
      entry.afterLoc = locs[3];
    }

    this.tryEntries.push(entry);
  }

  function resetTryEntry(entry) {
    var record = entry.completion || {};
    record.type = "normal";
    delete record.arg;
    entry.completion = record;
  }

  function Context(tryLocsList) {
    // The root entry object (effectively a try statement without a catch
    // or a finally block) gives us a place to store values thrown from
    // locations where there is no enclosing try statement.
    this.tryEntries = [{ tryLoc: "root" }];
    tryLocsList.forEach(pushTryEntry, this);
    this.reset(true);
  }

  runtime.keys = function (object) {
    var keys = [];
    for (var key in object) {
      keys.push(key);
    }
    keys.reverse();

    // Rather than returning an object with a next method, we keep
    // things simple and return the next function itself.
    return function next() {
      while (keys.length) {
        var key = keys.pop();
        if (key in object) {
          next.value = key;
          next.done = false;
          return next;
        }
      }

      // To avoid creating an additional object, we just hang the .value
      // and .done properties off the next function object itself. This
      // also ensures that the minifier will not anonymize the function.
      next.done = true;
      return next;
    };
  };

  function values(iterable) {
    if (iterable) {
      var iteratorMethod = iterable[iteratorSymbol];
      if (iteratorMethod) {
        return iteratorMethod.call(iterable);
      }

      if (typeof iterable.next === "function") {
        return iterable;
      }

      if (!isNaN(iterable.length)) {
        var i = -1,
            next = function next() {
          while (++i < iterable.length) {
            if (hasOwn.call(iterable, i)) {
              next.value = iterable[i];
              next.done = false;
              return next;
            }
          }

          next.value = undefined;
          next.done = true;

          return next;
        };

        return next.next = next;
      }
    }

    // Return an iterator with no values.
    return { next: doneResult };
  }
  runtime.values = values;

  function doneResult() {
    return { value: undefined, done: true };
  }

  Context.prototype = {
    constructor: Context,

    reset: function reset(skipTempReset) {
      this.prev = 0;
      this.next = 0;
      // Resetting context._sent for legacy support of Babel's
      // function.sent implementation.
      this.sent = this._sent = undefined;
      this.done = false;
      this.delegate = null;

      this.method = "next";
      this.arg = undefined;

      this.tryEntries.forEach(resetTryEntry);

      if (!skipTempReset) {
        for (var name in this) {
          // Not sure about the optimal order of these conditions:
          if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
            this[name] = undefined;
          }
        }
      }
    },

    stop: function stop() {
      this.done = true;

      var rootEntry = this.tryEntries[0];
      var rootRecord = rootEntry.completion;
      if (rootRecord.type === "throw") {
        throw rootRecord.arg;
      }

      return this.rval;
    },

    dispatchException: function dispatchException(exception) {
      if (this.done) {
        throw exception;
      }

      var context = this;
      function handle(loc, caught) {
        record.type = "throw";
        record.arg = exception;
        context.next = loc;

        if (caught) {
          // If the dispatched exception was caught by a catch block,
          // then let that catch block handle the exception normally.
          context.method = "next";
          context.arg = undefined;
        }

        return !!caught;
      }

      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        var record = entry.completion;

        if (entry.tryLoc === "root") {
          // Exception thrown outside of any try block that could handle
          // it, so set the completion value of the entire function to
          // throw the exception.
          return handle("end");
        }

        if (entry.tryLoc <= this.prev) {
          var hasCatch = hasOwn.call(entry, "catchLoc");
          var hasFinally = hasOwn.call(entry, "finallyLoc");

          if (hasCatch && hasFinally) {
            if (this.prev < entry.catchLoc) {
              return handle(entry.catchLoc, true);
            } else if (this.prev < entry.finallyLoc) {
              return handle(entry.finallyLoc);
            }
          } else if (hasCatch) {
            if (this.prev < entry.catchLoc) {
              return handle(entry.catchLoc, true);
            }
          } else if (hasFinally) {
            if (this.prev < entry.finallyLoc) {
              return handle(entry.finallyLoc);
            }
          } else {
            throw new Error("try statement without catch or finally");
          }
        }
      }
    },

    abrupt: function abrupt(type, arg) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
          var finallyEntry = entry;
          break;
        }
      }

      if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
        // Ignore the finally entry if control is not jumping to a
        // location outside the try/catch block.
        finallyEntry = null;
      }

      var record = finallyEntry ? finallyEntry.completion : {};
      record.type = type;
      record.arg = arg;

      if (finallyEntry) {
        this.method = "next";
        this.next = finallyEntry.finallyLoc;
        return ContinueSentinel;
      }

      return this.complete(record);
    },

    complete: function complete(record, afterLoc) {
      if (record.type === "throw") {
        throw record.arg;
      }

      if (record.type === "break" || record.type === "continue") {
        this.next = record.arg;
      } else if (record.type === "return") {
        this.rval = this.arg = record.arg;
        this.method = "return";
        this.next = "end";
      } else if (record.type === "normal" && afterLoc) {
        this.next = afterLoc;
      }

      return ContinueSentinel;
    },

    finish: function finish(finallyLoc) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.finallyLoc === finallyLoc) {
          this.complete(entry.completion, entry.afterLoc);
          resetTryEntry(entry);
          return ContinueSentinel;
        }
      }
    },

    "catch": function _catch(tryLoc) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.tryLoc === tryLoc) {
          var record = entry.completion;
          if (record.type === "throw") {
            var thrown = record.arg;
            resetTryEntry(entry);
          }
          return thrown;
        }
      }

      // The context.catch method must only be called with a location
      // argument that corresponds to a known catch block.
      throw new Error("illegal catch attempt");
    },

    delegateYield: function delegateYield(iterable, resultName, nextLoc) {
      this.delegate = {
        iterator: values(iterable),
        resultName: resultName,
        nextLoc: nextLoc
      };

      if (this.method === "next") {
        // Deliberately forget the last sent value so that we don't
        // accidentally pass it on to the delegate.
        this.arg = undefined;
      }

      return ContinueSentinel;
    }
  };
}(
// Among the various tricks for obtaining a reference to the global
// object, this seems to be the most reliable technique that does not
// use indirect eval (which violates Content Security Policy).
(typeof global === "undefined" ? "undefined" : _typeof(global)) === "object" ? global : (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" ? window : (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" ? self : undefined);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(43), __webpack_require__(175)(module)))

/***/ }),
/* 417 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(418);
module.exports = __webpack_require__(28).RegExp.escape;

/***/ }),
/* 418 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// https://github.com/benjamingr/RexExp.escape
var $export = __webpack_require__(0);
var $re = __webpack_require__(419)(/[\\^$*+?.()|[\]{}]/g, '\\$&');

$export($export.S, 'RegExp', { escape: function escape(it) {
    return $re(it);
  } });

/***/ }),
/* 419 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = function (regExp, replace) {
  var replacer = replace === Object(replace) ? function (part) {
    return replace[part];
  } : replace;
  return function (it) {
    return String(it).replace(regExp, replacer);
  };
};

/***/ }),
/* 420 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

/**
 *  File    : JClic.js
 *  Created : 01/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

// Declaration of JSDoc external objects:

/**
 * The HTMLElement interface represents any HTML element. Some elements directly implement this
 * interface, others implement it via an interface that inherits it.
 * @external HTMLElement
 * @see {@link https://developer.mozilla.org/ca/docs/Web/API/HTMLElement}
 */

/**
 * A jQuery object
 * @external jQuery
 * @see {@link http://api.jquery.com/jQuery/}
 */

/**
 * The jQuery XMLHttpRequest (jqXHR) object returned by `$.ajax()` as of jQuery 1.5 is a superset
 * of the browser's native [XMLHttpRequest](https://developer.mozilla.org/docs/XMLHttpRequest) object.
 * As of jQuery 1.5, jqXHR objects implement the Promise interface, giving them
 * all the properties, methods, and behavior of a Promise.
 * @external jqXHR
 * @see {@link https://api.jquery.com/jQuery.ajax/#jqXHR}
 */

/**
 * The CanvasRenderingContext2D interface provides the 2D rendering context for the drawing surface
 * of a &lt;canvas&gt; element.
 * @external CanvasRenderingContext2D
 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D}
 */

/**
 * The HTMLImageElement interface provides special properties and methods (beyond the regular
 * {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement HTMLElement} interface it
 * also has available to it by inheritance) for manipulating the layout and presentation of
 * &lt;img&gt; elements.
 * @external HTMLImageElement
 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement}
 */

/**
 * The HTMLAudioElement interface provides access to the properties of &lt;audio&gt; elements, as
 * well as methods to manipulate them. It derives from the
 * {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement HTMLMediaElement} interface.
 * @external HTMLAudioElement
 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement}
 */

/**
 * The Intl.Collator object is a constructor for collators, objects that enable language sensitive
 * string comparison.
 * @external Collator
 * @see {@link https://developer.mozilla.org/ca/docs/Web/JavaScript/Reference/Global_Objects/Collator}
 */

/**
 * A JSZip object
 * @external JSZip
 * @see {@link https://stuk.github.io/jszip}
 */

/**
 * The MediaRecorder interface of the {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder_API MediaRecorder API}
 * provides functionality to easily capture media.
 * @external MediaRecorder
 * @see {@link https://developer.mozilla.org/ca/docs/Web/API/MediaRecorder}
 */

/**
 * An i18next object, used to translate literals
 * @external i18next
 * @see {@link http://i18next.com}
 */

/**
 * The Promise object is used for asynchronous computations. A Promise represents an operation
 * that hasn't completed yet, but is expected in the future.
 * @external Promise
 * @see {@link https://developer.mozilla.org/ca/docs/Web/JavaScript/Reference/Global_Objects/Promise}
 */

/**
* The Storage interface of the Web Storage API provides access to the session storage or local storage for a particular domain,
* allowing you to for example add, modify or delete stored data items.
* @external Storage
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Storage}
*/

/**
 * The NamedNodeMap interface represents a collection of Attr objects. Objects inside a NamedNodeMap are not in any particular
 * order, unlike NodeList, although they may be accessed by an index as in an array.
 * @external NamedNodeMap
 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap}
 */

/* global define:true, JClicDataProject, JClicDataOptions */

// Mock `define` when called from a JavaScript environment without native AMD support (like Node.js)
// For an example of how to call JClic.js in node.js, see:
// `/test/nodejs/listProjectContents.js`
if (false) define = function define(deps, callback) {
  return callback.apply(null, deps.map(function (dep) {
    return require(dep);
  }));
};

// Initial empty definition of `JClicObject`, to be filled with real data in `define`
var JClicObject = {};

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(421), __webpack_require__(137), __webpack_require__(3), __webpack_require__(2), __webpack_require__(500)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, JClicPlayer, JClicProject, AWT, Utils /*, deps*/) {

  /**
   * This is the main method of JClic
   *
   * Executes on `document.ready()`.
   *
   * The method iterates over all `div` objects with `JClic` class and creates a {@link JClicPlayer}
   * within them. Each player loads the JClic project file specified in the `data-project` attribute of
   * the `div` tag.
   *
   * The `div` elements must preferabily be empty. Inner content may become overlapped by objects
   * created by the JClic player.
   *
   * This method exports the global variable `window.JClicObject`, useful when other scripts
   * need to make direct calls to the main components of JClic.
   *
   * The main members of the global variable `JClicObject` are:
   * - `JClicObject.JClicPlayer` (the {@link JClicPlayer} object)
   * - `JClicObject.JClicProject` (the {@link JClicProject} object)
   * - `JClicObject.AWT` (the {@link AWT} object)
   * - `JClicObject.Utils` (the {@link Utils} object)
   * - `JClicObject.$` (the JQuery object)
   * - `JClicObject.options` (the main options loaded at startup, usually the content of the global variable `JClicDataOptions`)
   * - `JClicObject.projectFiles` (used by JSONP to store the content of some files when inaccessible to the browser because CORS or other restrictions)
   * - `JClicObject.currentPlayers` (array with references to the players currently running)
   * - `JClicObject.loadProject` (a function that starts a JClicPlayer on a specific `div`)
   *
   * @module JClic
   * @exports JClicObject
   * @example
   * Creates a JClic div and loads "myproject.jclic" on it:
   * `<div class ="JClic" data-project="myproject.jclic"></div>`
   * @example
   * Creates a JClic div that loads "myproject.jclic" with additional parameters, passed as a
   * JSON string. Note that `data-options` should be delimited by apostrophes `'` because quotation
   * marks `"` are used for JSON keys and values:
   * `<div class ="JClic" data-project="myproject.jclic" data-options='{"fade":"400","lang":"es","reporter":"TCPReporter","user":"test01","path":"localhost:9090"}'></div>`
   *
   */
  Object.assign(JClicObject, {
    JClicPlayer: JClicPlayer,
    JClicProject: JClicProject,
    AWT: AWT,
    Utils: Utils,
    $: $,
    options: typeof JClicDataOptions === 'undefined' ? {} : JClicDataOptions,
    projectFiles: {},
    currentPlayers: [],
    /**
     *
     * Creates a new JClicPlayer hosted on the specified `div`, and loads an specific project on it.
     * @param {HTMLElement} div - The HTML element (usually a `<div/>`) that will be used as a main container of the player.
     * @param {string} projectName - The file name or URL of the JClic project to be loaded
     * @param {object=} options - An optional set of preferences
     * @returns {JClicPlayer}
     */
    loadProject: function loadProject(div, projectName, options) {

      //options = Utils.init(Object.assign({}, JClicObject.options, options))
      options = Utils.init($.extend(Object.create(JClicObject.options), options || {}));
      var player = null;

      // Find if there is another player already running on 'div'
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = JClicObject.currentPlayers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var pl = _step.value;

          if (pl && pl.$topDiv && pl.$topDiv.get(-1) === div) {
            // Player found! Check if it has the same options
            Utils.log('debug', 'Existing JClicPlayer found in div. I will try to reuse it.');
            player = pl;
            var _iteratorNormalCompletion2 = true;
            var _didIteratorError2 = false;
            var _iteratorError2 = undefined;

            try {
              for (var _iterator2 = Object.getOwnPropertyNames(options)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
                var prop = _step2.value;

                if (!player.options.hasOwnProperty(prop) || player.options[prop] !== options[prop]) {
                  Utils.log('debug', 'Existing JClicPlayer has diferent options! Creating a new one from scratch.');
                  player = null;
                  break;
                }
              }
            } catch (err) {
              _didIteratorError2 = true;
              _iteratorError2 = err;
            } finally {
              try {
                if (!_iteratorNormalCompletion2 && _iterator2.return) {
                  _iterator2.return();
                }
              } finally {
                if (_didIteratorError2) {
                  throw _iteratorError2;
                }
              }
            }

            break;
          }
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

      if (player) player.reset();else {
        Utils.log('debug', 'Creating a new instance of JClicPlayer');
        player = new JClicPlayer($(div).empty(), options);
      }

      if (projectName) player.initReporter().then(function () {
        return player.load(projectName);
      }).catch(function (err) {
        Utils.log('error', "Unable to start reporting: " + err.toString() + ".\n JClicPlayer will be removed.'");
        $(div).empty().removeAttr('style').append($('<h2/>').html(player.getMsg('ERROR'))).append($('<p/>').html(err));
        var i = JClicObject.currentPlayers.indexOf(player);
        if (i >= 0) JClicObject.currentPlayers.splice(i, 1);
        player = null;
      });

      if (player && options.savePlayersRef !== false && JClicObject.currentPlayers.indexOf(player) === -1) JClicObject.currentPlayers.push(player);

      return player;
    }
  });

  // Make JClicObject global and attach resize handler
  if (typeof window !== 'undefined') {
    window.JClicObject = JClicObject;
    var fnFit = function fnFit() {
      return JClicObject.currentPlayers.forEach(function (player) {
        if (player && player.skin) player.skin.fit();
      });
    };
    $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', fnFit);
    $(window).resize(fnFit);
  }

  // Execute on document ready
  $(function () {
    // If defined, load the global variable `JClicDataOptions`
    var options = typeof JClicDataOptions === 'undefined' ? {} : JClicDataOptions;
    JClicObject.options = options;

    if (!options.noInit) {
      // If defined, load the global variable `JClicDataProject` or `JClicObject.projectFile`
      var projectName = typeof JClicDataProject === 'string' ? JClicDataProject : typeof JClicObject.projectFile === 'string' ? JClicObject.projectFile : null;

      // Search DOM elements with class "JClic" (usually of type 'div') and iterate over them
      // initializing players
      $('.JClic').each(function (_n, element) {
        var $div = $(element);
        var prj = $div.data('project');
        if (prj) projectName = prj;

        var opt = $div.data('options');
        if (opt) options = $.extend(Object.create(options), opt);

        JClicObject.loadProject(element, projectName, options);
      });
    }
  });

  return JClicObject;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

// Export JClicObject as a result
if (true) {
  exports = module.exports = JClicObject;
}

/***/ }),
/* 421 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : JClicPlayer.js
 *  Created : 28/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define, JSON, location, window */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(176), __webpack_require__(204), __webpack_require__(205), __webpack_require__(471), __webpack_require__(2), __webpack_require__(3), __webpack_require__(499), __webpack_require__(482), __webpack_require__(34), __webpack_require__(136), __webpack_require__(137), __webpack_require__(98), __webpack_require__(73), __webpack_require__(139)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, JSZip, JSZipUtils, ScriptJS, i18n, Utils, AWT, PlayerHistory, ActiveMediaBag, Skin, EventSounds, JClicProject, JumpInfo, ActiveBoxContent, Reporter) {

  /**
   * JClicPlayer is one of the the main classes of the JClic system. It implements the
   * {@link http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html PlayStation}
   * interface, needed to host JClic activities.
   * JClicPlayer offers to {@link Activity#Panel} objects all the necessary resources and functions:
   * media bags (to load and realize images and other media contents), sequence control, management
   * of the reporting system, user interface, display of system messages, etc.
   * @exports JClicPlayer
   * @class
   * @extends AWT.Container
   */
  var JClicPlayer = function (_AWT$Container) {
    _inherits(JClicPlayer, _AWT$Container);

    /**
     * JClicPlayer constructor
     * @param {external:jQuery} $topDiv - The HTML `div` element where this JClicPlayer will deploy.
     * @param {object=} options - A set of optional customized options.
     */
    function JClicPlayer($topDiv, options) {
      _classCallCheck(this, JClicPlayer);

      // Build cascading options
      //this.options = Object.assign({}, this.options, Utils.init(options))
      var _this = _possibleConstructorReturn(this, (JClicPlayer.__proto__ || Object.getPrototypeOf(JClicPlayer)).call(this));

      // JClicPlayer extends AWT.Container


      options = Utils.init(options);
      _this.options = $.extend(Object.create(_this.options), options);
      // Generate unique ID
      _this.id = "JC" + (0x10000 + Math.round(Math.random() * 0xFFFF)).toString(16).toUpperCase().substr(1);
      // Identify the HTML element where this player will deploy
      _this.$topDiv = $topDiv || $('<div/>');
      // Avoid side effects of 'align=center' in old HTML pages
      _this.$topDiv.css({ 'text-align': 'initial' });

      // Special case: $topDiv inside a TD (like in http://clic.xtec.cat/gali)
      if (_this.$topDiv.parent().is('td')) {
        // Set explicit width and height to fill-in the TD
        _this.$topDiv.css({
          width: _this.options.width || '100%',
          height: _this.options.height || '100%'
        });
      }

      // Build the main container
      _this.$mainContainer = $('<div/>', { class: 'JClicContainer', id: _this.id }).css({ width: '100%', height: '100%' }).appendTo(_this.$topDiv);

      // Attach the localization
      i18n(_this);

      // Intitialize other elements
      _this.localFS = location && location.protocol === 'file:';
      _this.$div = $('<div/>', { class: 'JClicPlayer' });
      _this.project = new JClicProject();
      _this.activeMediaBag = new ActiveMediaBag();
      _this.counterVal = { score: 0, actions: 0, time: 0 };
      _this.bgImageOrigin = new AWT.Point();
      _this.buildActions();
      _this.history = new PlayerHistory(_this);
      _this.audioEnabled = _this.options.audioEnabled;
      _this.navButtonsAlways = _this.options.navButtonsAlways;
      _this.defaultSkin = Skin.getSkin(_this.options.skin, _this);
      _this.setSkin(Skin.getSkin('@empty.xml', _this));
      _this.initTimers();
      Utils.log('info', 'JClicPlayer ready');
      return _this;
    }

    /**
     * Generates an unique ID for elements being used with this player
     * @param {string} lb - The element's label
     * @returns {string}
     */


    _createClass(JClicPlayer, [{
      key: "getUniqueId",
      value: function getUniqueId(lb) {
        return this.id + "-" + lb;
      }

      /**
       * Builds the {@link AWT.Action} objects for this player
       */

    }, {
      key: "buildActions",
      value: function buildActions() {
        var _this2 = this;

        this.actions = {
          'next': new AWT.Action('next', function () {
            return _this2.history.processJump(_this2.project.activitySequence.getJump(false, _this2.reporter), false);
          }),
          'prev': new AWT.Action('prev', function () {
            return _this2.history.processJump(_this2.project.activitySequence.getJump(true, _this2.reporter), false);
          }),
          'return': new AWT.Action('return', function () {
            return _this2.history.pop();
          }),
          'reset': new AWT.Action('reset', function () {
            if (_this2.actPanel && _this2.actPanel.act.canReinit()) _this2.initActivity();
          }),
          'help': new AWT.Action('help', function () {
            if (_this2.actPanel) _this2.actPanel.showHelp();
          }),
          'info': new AWT.Action('info', function () {
            if (_this2.actPanel && _this2.actPanel.act.hasInfo()) {
              if (_this2.actPanel.act.infoUrl) _this2.displayURL(_this2.act.infoUrl, true);else if (_this2.actPanel.act.infoCmd) _this2.runCmd(_this2.actPanel.act.infoCmd);
            }
          }),
          'reports': new AWT.Action('reports', function () {
            return _this2.showReports();
          }),
          'audio': new AWT.Action('audio', function () {
            _this2.audioEnabled = !_this2.audioEnabled;
            if (!_this2.audioEnabled) _this2.stopMedia();
            EventSounds.prototype.globalEnabled = _this2.audioEnabled;
          })
        };

        $.each(this.actions, function (key, value) {
          value.addStatusListener(function (action) {
            if (_this2.skin) _this2.skin.actionStatusChanged(action);
          });
        });
      }

      /**
       * Resets the main components of this player
       */

    }, {
      key: "reset",
      value: function reset() {
        Utils.log('info', 'Restoring player');
        this.removeActivity();
        this.end();
        this.activeMediaBag = new ActiveMediaBag();
        this.history.clearHistory();
        this.setSkin(null);
        this.setMsg(null);
        this.setCounterValue('score', 0);
        this.setCounterValue('actions', 0);
        this.setCounterValue('time', 0);
        if (this.skin) this.skin.setWaitCursor('reset');
      }

      /**
       * Instructs the player to stop working
       */

    }, {
      key: "stop",
      value: function stop() {
        this.stopMedia(-1);
      }

      /**
       * Executes miscellaneous finalization routines.
       * @returns {Promise} - A promise to be fullfilled when all pending tasks are finished.
       */

    }, {
      key: "end",
      value: function end() {
        var result = null;
        this.stopMedia();
        this.closeHelpWindow();
        if (this.reporter) {
          result = this.reporter.end();
          this.reporter = null;
        }
        if (this.actPanel) {
          this.actPanel.end();
          this.actPanel.$div.remove();
          this.actPanel = null;
        }
        if (this.project) {
          this.project.end();
          this.project = null;
        }
        if (this.activeMediaBag) this.activeMediaBag.removeAll();
        return result || Promise.resolve(true);
      }

      /**
       * Creates and initializes the {@link Reporter} member
       * @return {Promise}
       */

    }, {
      key: "initReporter",
      value: function initReporter() {
        if (this.reporter) {
          this.reporter.end();
          this.reporter = null;
        }
        this.reporter = Reporter.getReporter(null, this);
        return this.reporter.init();
      }

      /**
       *
       * Creates and initializes objects of type {@link AWT.Timer}
       */

    }, {
      key: "initTimers",
      value: function initTimers() {
        var _this3 = this;

        // Main timer
        if (this.timer) this.timer.stop();
        this.timer = new AWT.Timer(function () {
          _this3.incCounterValue('time');
          if (_this3.actPanel && _this3.actPanel.act.maxTime > 0 && _this3.actPanel.playing && _this3.counterVal['time'] >= _this3.actPanel.act.maxTime) _this3.actPanel.finishActivity(false);
        }, 1000, false);

        // One-time timer, for delayed actions
        if (this.delayedTimer) this.delayedTimer.stop();
        this.delayedTimer = new AWT.Timer(function () {
          if (_this3.delayedAction) _this3.delayedAction.processEvent(_this3.delayedAction, null);
        }, 1000, false);
        this.delayedTimer.repeats = false;
      }

      /**
       * Opens the reports dialog
       */

    }, {
      key: "showReports",
      value: function showReports() {
        if (this.skin) this.skin.showReports(this.reporter);
      }

      /**
       * Closes the help dialog window
       */

    }, {
      key: "closeHelpWindow",
      value: function closeHelpWindow() {
        if (this.skin) this.skin._closeDlg(false);
      }

      /**
       * Sets the current skin
       * @param {?Skin} newSkin - The skin to use. When `null`, `defaultSkin` will be used.
       */

    }, {
      key: "setSkin",
      value: function setSkin(newSkin) {
        newSkin = newSkin || (this.project && this.project.skin ? this.project.skin : this.defaultSkin);
        if (newSkin && (this.skin === null || newSkin.name !== this.skin.name)) {
          newSkin.attach(this);
          this.skin = newSkin;
          this.skin.doLayout();
        }
      }

      /**
       * Sets the current project of this player, without starting any activity
       * @param {JClicProject} project - The project to be set
       */

    }, {
      key: "setProject",
      value: function setProject(project) {
        if (this.project) {
          if (this.project !== project) this.project.end();
          this.removeActivity();
        }
        this.project = project || new JClicProject();
        this.project.realize(this);
      }

      /**
       * Loads the specified project and starts playing at the specified activity or sequence tag.
       * @param {?(string|JClicProject)} project - The project to load (if it's a string) or to use (if it's an object of type {@link JClicProject}).
       * When it's a `string`, it can be the absolute or relative path to:
       * - A '.jclic' project file
       * - A '.jclic.zip' compressed project file (containing one '.jclic' file)
       * - A '.scorm.zip' file, as exported by JClic Author.
       * - A 'project.json' file, as exported by JClic Author
       * When `null` or `undefined`, refers to the current project.
       * @param {(string|number)=} sequence - Sequence tag or numeric order in the {@link ActivitySequence}
       * to be loaded. If _sequence_ and _activity_ are both `null`, the first {@link ActivitySequenceElement}
       * will be loaded.
       * @param {string=} activity - Name of the activity to be loaded (usually `null`)
       */

    }, {
      key: "load",
      value: function load(project, sequence, activity) {
        var _this4 = this;

        this.forceFinishActivity();
        this.setWaitCursor(true);

        // The ActivityPanel object to be obtained as a result of the loading process
        var actp = null;

        // step one: load the project
        if (project) {
          if (typeof project === 'string') {

            // Param `project` is a file name or URL (otherwise, is a realized `JClicProject` object)
            var fullPath = Utils.getPath(this.basePath, project);

            // Previous step: Check if `project` points to a "project.json" file
            if (fullPath.endsWith('project.json')) {
              Utils.log('info', "Loading JSON info from: " + fullPath);
              $.getJSON(fullPath).done(function (json) {
                // Read the `mainFile` field of `project.json`
                if (Utils.endsWith(json['mainFile'], '.jclic')) {
                  // Load project's main file
                  _this4.load(Utils.getPath(Utils.getBasePath(fullPath), json['mainFile']), sequence, activity);
                } else {
                  Utils.log('error', "Invalid or null \"mainFile\" specified in " + fullPath + " - \"project.json\".");
                }
              }).fail(function (jqhxr, textStatus, error) {
                var errMsg = textStatus + " (" + error + ") while loading " + project;
                Utils.log(errMsg);
                alert("Error!\n" + errMsg);
              }).always(function () {
                return _this4.setWaitCursor(false);
              });
              return;
            }

            // Step 0: Check if `project` points to a ZIP file
            if (fullPath.endsWith('.zip')) {
              // TODO: Implement register of zip files in PlayerHistory
              this.zip = null;
              Utils.log('info', "Loading ZIP file: " + fullPath);

              // Launch loading of ZIP file in a separated thread
              JSZipUtils.getBinaryContent(fullPath, function (err, data) {
                if (err) {
                  _this4.setWaitCursor(false);
                  Utils.log('error', "Error loading ZIP file: " + err.toString());
                  return;
                }
                new JSZip().loadAsync(data).then(function (zip) {
                  _this4.zip = zip;
                  _this4.zip.fullZipPath = fullPath;
                  _this4.zip.zipBasePath = Utils.getBasePath(fullPath);
                  var fileName = null;
                  // Check if ZIP contains a "project.json" file (as in the ".scorm.zip" files generated by JClic Author)
                  if (_this4.zip.files['project.json']) {
                    _this4.zip.files['project.json'].async('string').then(function (content) {
                      try {
                        var json = JSON.parse(content);
                        // Read the `mainFile` field of `project.json`
                        if (Utils.endsWith(json['mainFile'], '.jclic')) {
                          // Load project's main file
                          _this4.load(Utils.getPath(_this4.zip.zipBasePath, json['mainFile']), sequence, activity);
                        } else {
                          Utils.log('error', "Invalid or null \"mainFile\" specified in " + fullPath + " - \"project.json\".");
                        }
                      } catch (err) {
                        Utils.log('error', "Error reading \"project.json\" in " + fullPath + ": " + (err ? err.toString() : 'unknown error'));
                      }
                    }).catch(function (reason) {
                      Utils.log('error', "Error reading ZIP file: " + (reason ? reason.toString() : 'unknown reason'));
                    });
                  } else {
                    // Find first file with extension '.jclic' inside the zip file
                    fileName = Object.keys(_this4.zip.files).find(function (fn) {
                      return fn.endsWith('.jclic');
                    }) || null;
                    if (fileName) _this4.load(Utils.getPath(_this4.zip.zipBasePath, fileName), sequence, activity);else Utils.log('error', 'This ZIP file does not contain any JClic project!');
                  }
                  _this4.setWaitCursor(false);
                }).catch(function (reason) {
                  Utils.log('error', "Error reading ZIP file: " + (reason ? reason.toString() : 'unknown reason'));
                  _this4.setWaitCursor(false);
                });
              });
              return;
            } else if (this.localFS && window.JClicObject && !window.JClicObject.projectFiles[fullPath]) {
              ScriptJS(fullPath + ".js", function () {
                return _this4.load(project, sequence, activity);
              });
              this.setWaitCursor(false);
              return;
            }

            // Step one: load the project file
            var processProjectFile = function processProjectFile(fp) {
              $.get(fp, null, null, 'xml').done(function (data) {
                if (data === null || (typeof data === "undefined" ? "undefined" : _typeof(data)) !== 'object') {
                  Utils.log('error', "Bad data. Project not loaded: " + project);
                  return;
                }
                var prj = new JClicProject();
                prj.setProperties($(data).find('JClicProject'), fullPath, _this4.zip, _this4.options);
                Utils.log('info', "Project file loaded and parsed: " + project);
                var elements = prj.mediaBag.buildAll(null, function (element) {
                  Utils.log('trace', "\"" + element.name + "\" ready.");
                  _this4.incProgress(1);
                }, _this4);
                Utils.log('info', "Media elements to be loaded: " + elements);
                _this4.setProgress(0, elements);
                var loops = 0;
                var interval = 500;
                _this4.setWaitCursor(true);
                var checkMedia = window.setInterval(function () {
                  // Wait for a maximum time of two minutes
                  if (++loops > _this4.options.maxWaitTime / interval) {
                    window.clearInterval(checkMedia);
                    _this4.setProgress(-1);
                    _this4.setWaitCursor(false);
                    Utils.log('error', 'Error loading media');
                  }
                  var waitingObjects = prj.mediaBag.countWaitingElements();
                  // player.setProgress(waiting)
                  if (waitingObjects === -1) {
                    window.clearInterval(checkMedia);
                    _this4.setProgress(-1);
                    _this4.setWaitCursor(false);
                    // Call `load` again, passing the loaded [JClicProject](JClicProject.html) as a parameter
                    _this4.load(prj, sequence, activity);
                  }
                }, interval);
              }).fail(function (jqXHR, textStatus, errorThrown) {
                var errMsg = textStatus + " (" + errorThrown + ") while loading " + project;
                Utils.log(errMsg);
                alert("Error!\n" + errMsg);
              }).always(function () {
                return _this4.setWaitCursor(false);
              });
            };

            Utils.log('info', "Loading project: " + project);
            var fp = fullPath;

            // Special case for ZIP files
            if (this.zip) {
              var fName = Utils.getRelativePath(fp, this.zip.zipBasePath);
              if (this.zip.files[fName]) {
                this.zip.file(fName).async('string').then(function (text) {
                  processProjectFile("data:text/xml;charset=UTF-8," + text);
                }).catch(function (reason) {
                  Utils.log('error', "Unable to extract \"" + fName + "\" from ZIP file because of: " + (reason ? reason.toString() : 'unknown reason'));
                  _this4.setWaitCursor(false);
                });
                return;
              }
            }
            // Special case for local file systems (using `file` protocol)
            else if (this.localFS) {
                // Check if file is already loaded in the global variable `JClicObject`
                if (window.JClicObject && window.JClicObject.projectFiles[fullPath]) {
                  fp = "data:text/xml;charset=UTF-8," + window.JClicObject.projectFiles[fullPath];
                } else {
                  Utils.log('error', "Unable to load: " + fullPath + ".js");
                  this.setWaitCursor(false);
                  return;
                }
              }
            processProjectFile(fp);
            return;
          }

          // From here, assume that `project` is a [JClicProject](JClicProject.html)
          this.setProject(project);

          // If none specified, start with the first element of the sequence
          if (!sequence && !activity) sequence = '0';

          // start reporter session
          if (this.reporter) this.reporter.newSession(project);
        }

        // Step two: load the ActivitySequenceElement
        if (!Utils.isNullOrUndef(sequence)) {
          Utils.log('info', "Loading sequence: " + sequence);
          this.navButtonsDisabled = false;
          // Try to load sequence by tag
          var ase = null;
          if (typeof sequence === 'string') ase = this.project.activitySequence.getElementByTag(sequence, true);
          if (ase === null) {
            // Try to treat 'sequence' as a number
            var n = parseInt(sequence, 10);
            if (typeof n === 'number') ase = this.project.activitySequence.getElement(n, true);
          }

          if (ase !== null) {
            // Success! We have a real [ActivitySequenceElement](ActivitySequenceElement.html)
            if (this.reporter) this.reporter.newSequence(ase);
            activity = ase.activityName;
          }
        }

        // Step three: load the activity
        if (activity) {
          var act = this.project.getActivity(activity);
          if (act) {
            // Success! We have a real [Activity](Activity.html)
            Utils.log('info', "Loading activity: " + activity);
            act.prepareMedia(this);
            this.project.activitySequence.checkCurrentActivity(act.name);
            actp = act.getActivityPanel(this);
            actp.buildVisualComponents();
          } else {
            Utils.log('error', "Missing activity: " + activity);
          }
        }

        // Step four: put the activity panel on place

        // Remove the current ActivityPanel
        if (this.actPanel !== null) {
          this.actPanel.end();
          this.actPanel.$div.remove();
          this.actPanel = null;
          this.setCounterValue('time', 0);
        }

        // Attach the new ActivityPanel
        if (actp) {
          // Sets the actPanel member to this ActivityPanel
          this.actPanel = actp;

          if (this.options.fade > 0) this.actPanel.$div.css('display', 'none');

          // Places the JQuery DOM element of actPanel within the player main panel
          this.$div.prepend(this.actPanel.$div);
          if (this.skin) this.skin.resetAllCounters(false);

          // Sets the current skin
          if (this.actPanel.skin) this.setSkin(this.actPanel.skin);else if (this.project.skin) {
            this.setSkin(this.project.skin);
            this.lastProjectSkin = this.project.skin;
          } else if (this.lastProjectSkin) this.setSkin(this.lastProjectSkin);else this.setSkin(null);

          if (this.skin) {
            // Enable or disable actions
            var hasReturn = this.history.storedElementsCount() > 0 || this.options.returnAsExit;
            var navBtnFlag = this.navButtonsAlways ? 'both' : this.navButtonsDisabled ? 'none' : this.project.activitySequence.getNavButtonsFlag();
            this.actions['next'].setEnabled((navBtnFlag === 'fwd' || navBtnFlag === 'both') && this.project.activitySequence.hasNextAct(hasReturn));
            this.actions['prev'].setEnabled((navBtnFlag === 'back' || navBtnFlag === 'both') && this.project.activitySequence.hasPrevAct(hasReturn));
            this.actions['return'].setEnabled(hasReturn);
            this.actions['help'].setEnabled(this.actPanel.act.helpWindowAllowed());
            this.actions['reset'].setEnabled(this.actPanel.act.canReinit());
            this.actions['info'].setEnabled(this.actPanel.act.hasInfo());
          }
          this.doLayout();
          this.initActivity();

          this.actPanel.$div.fadeIn(this.options.fade, function () {
            return _this4.activityReady();
          });
        }
        this.setWaitCursor(false);
      }

      /**
       * Forces the current activity to stop playing.
       */

    }, {
      key: "forceFinishActivity",
      value: function forceFinishActivity() {
        this.timer.stop();
        this.delayedTimer.stop();
        if (this.actPanel) {
          this.closeHelpWindow();
          this.actPanel.forceFinishActivity();
          this.stopMedia();
          this.activeMediaBag.removeAll();
        }
      }

      /**
       *
       * Removes the current {@link Activity#Panel} from this player
       */

    }, {
      key: "removeActivity",
      value: function removeActivity() {
        this.forceFinishActivity();
        if (this.actPanel) {
          this.actPanel.end();
          this.actPanel.$div.remove();
          this.actPanel = null;
          this.setMsg(null);
          this.doLayout();
        }
      }

      /**
       *
       * Initializes the activity
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        this.setWaitCursor(true);
        this.timer.stop();
        this.delayedTimer.stop();
        this.setCounterValue('time', 0);
        this.stopMedia();
        if (this.actPanel) {
          this.actPanel.initActivity();
          this.timer.start();
          if (!this.actPanel.act.mustPauseSequence()) this.startAutoPassTimer();
          Utils.log('info', "Activity \"" + this.actPanel.act.name + "\" running");
        }
        this.setWaitCursor(false);
      }

      /**
       * Called by {@link JClicPlayer#load} when the {@link Activity#Panel} is fully visible, just
       * after the JQuery animation effect.
       */

    }, {
      key: "activityReady",
      value: function activityReady() {
        if (this.actPanel) {
          this.actPanel.activityReady();
          Utils.log('info', 'Activity ready');
        }
      }

      /**
       * Starts the activity. This method is usually called from text activities with previous text.
       */

    }, {
      key: "startActivity",
      value: function startActivity() {
        this.setWaitCursor(true);
        if (this.actPanel) this.actPanel.startActivity();
        this.setWaitCursor(false);
      }

      /**
       * Configures the layout and visual aspect of the player area.
       */

    }, {
      key: "doLayout",
      value: function doLayout() {
        var _this5 = this;

        // Main player area settings
        var width = this.dim.width = this.$div.width(),
            height = this.dim.height = this.$div.height(),
            mainCss = {
          'background-color': this.actPanel ? this.actPanel.act.bgColor : 'azure',
          'background-image': ''
        };

        if (this.actPanel) {
          var act = this.actPanel.act;
          if (act.bgGradient)
            // Canvas version also available
            mainCss['background-image'] = act.bgGradient.getCss();

          if (act.bgImageFile && act.bgImageFile.length > 0) {
            this.project.mediaBag.getElement(act.bgImageFile, true).getFullPathPromise().then(function (bgImageUrl) {
              _this5.$div.css({
                'background-image': 'url(\'' + bgImageUrl + '\')',
                'background-repeat': act.tiledBgImg ? 'repeat' : 'no-repeat',
                'background-position': act.tiledBgImg ? '' : 'center center'
              });
            });
          }

          // Activity panel settings
          // Calc the maximum rectangle available for the activity panel
          var m = Utils.settings.BoxBase.AC_MARGIN,
              proposedRect = new AWT.Rectangle(m, m, width - 2 * m, height - 2 * m);

          if (this.actPanel.bgImage && !act.tiledBgImg && act.absolutePositioned) {
            // Special case: when the activity has a background image not tiled, and an absolute
            // position has been specified, the ActivityPanel must be placed at this absolute
            // position, relative to the background image
            this.bgImageOrigin.x = (width - this.actPanel.bgImage.width) / 2;
            this.bgImageOrigin.y = (height - this.actPanel.bgImage.height) / 2;
            proposedRect.pos.moveTo(this.bgImageOrigin);
            proposedRect.dim.width -= this.bgImageOrigin.x - m;
            proposedRect.dim.height -= this.bgImageOrigin.y - m;
            proposedRect.dim.width = Math.min(proposedRect.dim.width, width);
            proposedRect.dim.height = Math.min(proposedRect.dim.height, height);
          }

          // ActivityPanel will calculate and set its position and size based on the maximum and optimal
          // available space
          /* TODO: Try with a computed rectangle instead of "this", to avoid the loss of the right margin
           * in narrow displays */
          this.actPanel.fitTo(proposedRect, this);
        }
        this.$div.css(mainCss);
      }

      /**
       * Plays the specified media.
       * @param {MediaContent} mediaContent - The media to be played
       * @param {ActiveBox=} mediaPlacement - The cell where the graphic component of this media
       * @param {function[]=} delayedActions - If set, store the the action in this array for future execution
       * should be placed (used with video objects)
       */

    }, {
      key: "playMedia",
      value: function playMedia(mediaContent) {
        var _this6 = this;

        var mediaPlacement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
        var delayedActions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;


        var ji = null;
        var fn = mediaContent.mediaFileName;
        var action = null;

        switch (mediaContent.mediaType) {
          case 'PLAY_AUDIO':
          case 'PLAY_VIDEO':
          case 'PLAY_MIDI':
          case 'RECORD_AUDIO':
          case 'PLAY_RECORDED_AUDIO':
            if (this.audioEnabled) {
              var amp = this.activeMediaBag.getActiveMediaPlayer(mediaContent, this.project.mediaBag, this);
              if (amp) action = function action() {
                return amp.play(mediaPlacement);
              };
            }
            break;

          case 'RUN_CLIC_PACKAGE':
            ji = new JumpInfo('JUMP', fn);
            if (mediaContent.externalParam) {
              // Relative path computed in History.processJump
              ji.projectPath = mediaContent.externalParam;
            }
            action = function action() {
              return _this6.history.processJump(ji, true);
            };
            break;

          case 'RUN_CLIC_ACTIVITY':
            this.history.push();
            action = function action() {
              return _this6.load(null, null, fn);
            };
            break;

          case 'RETURN':
            if (this.history.storedElementsCount() > 0 || !this.options.returnAsExit) {
              action = function action() {
                return _this6.history.pop();
              };
              break;
            }
          case 'EXIT':
            ji = new JumpInfo('EXIT', fn);
            action = function action() {
              return _this6.history.processJump(ji, false);
            };
            break;

          case 'RUN_EXTERNAL':
            action = function action() {
              return _this6.runCmd(fn);
            };
            break;

          case 'URL':
            if (fn)
              // When mediaContent.level is 2 or more, the URL will be opened in a separate window.
              action = function action() {
                return _this6.displayURL(fn, mediaContent.level > 1);
              };
            break;

          default:
            Utils.log('error', "Unknown media type: " + mediaContent.mediaType);
            break;
        }

        // Execute the action or pass callback
        if (delayedActions && action) delayedActions.push(action);else if (action) action();
      }

      /**
       * Stops currently playing media
       * @param {number=} [level=-1] - Sets the threshold above which all media objects with equal
       * or greater `level` will also also be muted.
       */

    }, {
      key: "stopMedia",
      value: function stopMedia(level) {
        if (typeof level !== 'number') level = -1;
        this.activeMediaBag.stopAll(level);
      }

      /**
       * Launches the specified system command.
       * Currently not implemented.
       * @param {string} cmd
       */

    }, {
      key: "runCmd",
      value: function runCmd(cmd) {
        Utils.log('warn', "Unsupported call to external command: \"" + cmd + "\"");
      }

      /**
       * Called from {@link Activity} when finished.
       * @param {boolean} _completedOK - `true` when the activity was successfully completed, `false`
       * otherwise.
       */

    }, {
      key: "activityFinished",
      value: function activityFinished(_completedOK) {
        this.closeHelpWindow();
        Utils.log('info', 'Activity finished');
        this.timer.stop();
        this.startAutoPassTimer();
      }

      /**
       * Starts the automatic jump to next activity, when applicable.
       */

    }, {
      key: "startAutoPassTimer",
      value: function startAutoPassTimer() {
        var ase = this.project.activitySequence.getCurrentAct();
        if (ase !== null && ase.delay > 0 && !this.delayedTimer.isRunning() && !this.navButtonsDisabled) {
          this.delayedAction = this.actions['next'];
          this.delayedTimer.interval = ase.delay * 1000;
          this.delayedTimer.start();
        }
      }

      /**
       * Function obtained from `i18next` that will return the translation of the provided key
       * into the current language.
       * The real function will be initiated by constructor. Meanwhile, it returns always `key`.
       * @param {string} key - ID of the expression to be translated
       * @returns {string} - Translated text
       */

    }, {
      key: "getMsg",
      value: function getMsg(key) {
        return key;
      }

      /**
       *
       * Sets the current main message.
       * @param {ActiveBoxContent} abc - The content of the message
       */

    }, {
      key: "setMsg",
      value: function setMsg(abc) {
        var ab = this.skin ? this.skin.getMsgBox() : null;
        if (ab) {
          ab.clear();
          this.skin.invalidate(ab).update();
          ab.setContent(abc ? abc : ActiveBoxContent.EMPTY_CONTENT);
          // TODO: Move this method to Skin
          this.skin.invalidate(ab).update();
          ab.playMedia(this);
        }
      }

      /**
       * Launches the active media content associated to the main message, if any.
       */

    }, {
      key: "playMsg",
      value: function playMsg() {
        if (this.skin && this.skin.getMsgBox()) this.skin.getMsgBox().playMedia(this);
      }

      /**
       * Sets a value to the specified counter
       * @param {string} counter - The id of the counter ('score', 'actions' or 'time')
       * @param {number} newValue - The value to be set
       */

    }, {
      key: "setCounterValue",
      value: function setCounterValue(counter, newValue) {
        this.counterVal[counter] = newValue;
        if (this.skin && this.skin.counters[counter]) this.skin.counters[counter].setValue(newValue);
      }

      /**
       * Gets the current value for the specified counter
       * @param {string} counter - The id of the counter ('score', 'actions' or 'time')
       * @returns {number}
       */

    }, {
      key: "getCounterValue",
      value: function getCounterValue(counter) {
        return this.counterVal[counter];
      }

      /**
       * Enables or disables a specific counter
       * @param {string} counter - The id of the counter ('score', 'actions' or 'time')
       * @param {boolean} bEnabled - When `true`, the counter will be enabled.
       */

    }, {
      key: "setCounterEnabled",
      value: function setCounterEnabled(counter, bEnabled) {
        if (this.skin) {
          this.skin.enableCounter(counter, bEnabled);
          this.setCountDown(counter, 0);
        }
      }

      /**
       * Increments by 1 the value of the specified counter
       * @param {string} counter - The id of the counter ('score', 'actions' or 'time')
       */

    }, {
      key: "incCounterValue",
      value: function incCounterValue(counter) {
        this.counterVal[counter]++;

        var actp = this.actPanel,
            cnt = this.skin ? this.skin.counters[counter] : null;

        if (cnt) cnt.setValue(this.counterVal[counter]);
        if (counter === 'actions' && actp !== null && actp.act.maxActions > 0 && actp.playing && this.counterVal['actions'] >= actp.act.maxActions) window.setTimeout(function () {
          actp.finishActivity(actp.solved);
        }, 0);
      }

      /**
       * Sets the specified counter in count-down status, starting at `maxValue`.
       * @param {string} counter - The id of the counter ('score', 'actions' or 'time')
       * @param {number} maxValue - The value from which to start counting down
       */

    }, {
      key: "setCountDown",
      value: function setCountDown(counter, maxValue) {
        //this.counterVal[counter] = maxValue
        if (this.skin && this.skin.counters[counter]) this.skin.counters[counter].setCountDown(maxValue);
      }

      /**
       * Set/unset the panel in 'wait' state
       * @param {boolean} status
       */

    }, {
      key: "setWaitCursor",
      value: function setWaitCursor(status) {
        if (this.skin) this.skin.setWaitCursor(status);
      }

      /**
       * Sets the current value of the progress bar
       * @param {number} val - The current value. Should be less or equal than `max`. When -1, the progress bar will be hidden.
       * @param {number=} max - Optional parameter representing the maximum value. When passed, the progress bar will be displayed.
       */

    }, {
      key: "setProgress",
      value: function setProgress(val, max) {
        if (this.skin) this.skin.setProgress(val, max);
      }

      /**
       * Increments the progress bar value by the specified amount, only when the progress bar is running.
       * @param {number=} val - The amount to increment. When not defined, it's 1.
       */

    }, {
      key: "incProgress",
      value: function incProgress(val) {
        if (this.skin) this.skin.incProgress(val);
      }

      /**
       * Builds an {@link ActiveMediaPlayer} for the specified {@link MediaContent}
       * @param {MediaContent} mediaContent - The media content to be played
       * @returns {ActiveMediaPlayer}
       */

    }, {
      key: "getActiveMediaPlayer",
      value: function getActiveMediaPlayer(mediaContent) {
        return this.activeMediaBag && mediaContent ? this.activeMediaBag.getActiveMediaPlayer(mediaContent, this.project.mediaBag, this) : null;
      }

      /**
       * Notifies the reporting system that a new activity has started
       * @param {Activity} act - The activity that is sending the notification
       */

    }, {
      key: "reportNewActivity",
      value: function reportNewActivity(act) {
        var ase = this.project.activitySequence.getCurrentAct();
        if (this.reporter) {
          if (ase.tag === this.reporter.getCurrentSequenceTag())
            // Notify that the sequence has changed
            this.reporter.newSequence(ase);
          if (act.includeInReports) this.reporter.newActivity(act);
        }
        this.setCounterValue('actions', 0);
        this.setCounterValue('score', 0);
      }

      /**
       * Notifies the reporting system that a new action has been performed on the current activity
       * @param {Activity} act - The activity that is sending the notification
       * @param {string} type - Type of action (match, move, switch...)
       * @param {?string} source - Object acting as a source of the action (cell, grid, clue...)
       * @param {?string} dest - When applicable, object acting as a receiver of the action (cell, grid...)
       * @param {boolean} ok - Whether the action was OK or not
       * @param {number} currentScore - The current score of the activity
       */

    }, {
      key: "reportNewAction",
      value: function reportNewAction(act, type, source, dest, ok, currentScore) {
        if (this.reporter && act.includeInReports && act.reportActions) this.reporter.newAction(type, source, dest, ok);
        if (currentScore >= 0) {
          this.incCounterValue('actions');
          this.setCounterValue('score', currentScore);
        }
      }

      /**
       * Notifies the reporting system that the current activity has finished
       * @param {Activity} act - The activity that is sending the notification
       * @param {boolean} solved - Whether the activity was successfully completed or not.
       */

    }, {
      key: "reportEndActivity",
      value: function reportEndActivity(act, solved) {
        if (this.reporter && act.includeInReports) this.reporter.endActivity(this.counterVal['score'], this.counterVal['actions'], solved);
      }

      /**
       * Shows the help info provided by the activity
       * @param {external:jQuery} $hlpComponent - The jQuery DOM component to be shown.
       * @returns {boolean} - True when the component was successfully displayed
       */

    }, {
      key: "showHelp",
      value: function showHelp($hlpComponent) {
        return this.skin ? this.skin.showHelp($hlpComponent) : false;
      }

      /**
       * Navigates to the requested URL
       * @param {string} url - The URL to navigate to
       * @param {boolean} inFrame - When `true` opens in a new frame
       */

    }, {
      key: "displayURL",
      value: function displayURL(url, inFrame) {
        if (url) {
          if (inFrame) window.open(url, this.options.infoUrlFrame);else {
            this.end().then(function () {
              window.location.href = url;
            });
          }
        }
      }

      /**
       * Only when `exitUrl` has been specified in `options`, navigates to the specified URL
       * @param {string} url - The URL to navigate to.
       */

    }, {
      key: "exit",
      value: function exit(url) {
        this.displayURL(url || this.options.exitUrl, false);
      }

      /**
       * Sets a title in a specific HTML element, if provided.
       * @param {string} docTitle
       */

    }, {
      key: "setWindowTitle",
      value: function setWindowTitle(docTitle) {
        Utils.log('info', "running " + docTitle);
      }
    }]);

    return JClicPlayer;
  }(AWT.Container);

  Object.assign(JClicPlayer.prototype, {
    /**
     * Current version will be updated by i18n.js
     * @name JClicPlayer#JClicVersion
     * @type {string} */
    JClicVersion: '0',
    /**
     * Object with miscellaneous options.
     * @name JClicPlayer#options
     * @type {object} */
    options: {
      //
      // Max waiting time to have all media loaded (milliseconds)
      maxWaitTime: 120000,
      //
      // Name of the frame where to open links
      infoUrlFrame: '_blank',
      //
      // URL where to navigate to on exit
      exitUrl: null,
      //
      // When `true` and no elements on sequence stack, RETURN acts as EXIT
      returnAsExit: false,
      //
      // At the beginning, the audio should be enabled or disabled
      audioEnabled: true,
      //
      // Navigation buttons are always visible (for debugging purposes)
      navButtonsAlways: false,
      //
      // Time (milliseconds) of the fade-in animation of the activity panel. When 0, no animation
      // is performed
      fade: 300
    },
    /**
     * Unique ID of this player, randomly generated by the constructor
     * @name JClicPlayer#id
     * @type {string} */
    id: 'JC0000',
    /**
     * The JQuery "div" element used by this player as stage for activities
     * @name JClicPlayer#$div
     * @type {external:jQuery} */
    $div: null,
    /**
     * The JQuery top container where this player will deploy
     * @name JClicPlayer#$topDiv
     * @type {external:jQuery} */
    $topDiv: null,
    /**
     * The main container of all JClic components
     * @name JClicPlayer#$mainContainer
     * @type {external:jQuery} */
    $mainContainer: null,
    /**
     * Flag indicatig that this player has switched to full screen at least once
     * @name JClicPlayer#fullScreenChecked
     * @type {boolean} */
    fullScreenChecked: false,
    /**
     * The {@link JClicProject} currently hosted in this player
     * @name JClicPlayer#project
     * @type {JClicProject} */
    project: null,
    /**
     * Relative path or absolute URL to be used as a base to access files
     * @name JClicPlayer#basePath
     * @type {string} */
    basePath: '',
    /**
     * A {@link external:JSZip} object pointing to a `jclic.zip` or `jclic.scorm.zip` file containing
     * the current project.
     * Two extra properties will be added to this object when loaded:
     * - __zip.fullZipPath__ {string} - The full path of the ZIP file
     * - __zip.zipBasePath__ {string} - The path to the folder containing the ZIP file
     * @name JClicPlayer#zip
     * @type {external:JSZip} */
    zip: null,
    /**
     * This flag indicates if the player is running inside a document loaded by `file:` protocol
     * @name JClicPlayer#localFS
     * @type {boolean}
     */
    localFS: false,
    /**
     * The {@link Activity#Panel} currently running on this player.
     * @name JClicPlayer#actPanel
     * @type {Activity#Panel} */
    actPanel: null,
    /**
     * This object records the list of the activities played during the current session.
     * @name JClicPlayer#history
     * @type {PlayerHistory} */
    history: null,
    /**
     * The Skin currently used by this player.
     * @name JClicPlayer#skin
     * @type {Skin} */
    skin: null,
    /**
     * The default Skin to be used if none specified
     * @name JClicPlayer#defaultSkin
     * @type {Skin} */
    defaultSkin: null,
    /**
     * The last skin directly specified by a {@link JClicProject}
     * @name JClicPlayer#defaultSkin
     * @type {Skin} */
    lastProjectSkin: null,
    /**
     * Object containing references to realized media objects, ready to play.
     * @name JClicPlayer#activeMediaBag
     * @type {ActiveMediaBag} */
    activeMediaBag: null,
    /**
     * Object responsible for passing the scores obtained by users to a external reporting systems
     * when playing activities.
     * @name JClicPlayer#reporter
     * @type {Reporter} */
    reporter: null,
    /**
     * Collection of {@link AWT.Action} objects used by this player.
     * @name JClicPlayer#actions
     * @type {AWT.Action[]} */
    actions: {},
    /**
     * Main timer object used to feed the time counter. Ticks every second.
     * @name JClicPlayer#timer
     * @type {AWT.Timer} */
    timer: null,
    /**
     * Timer for delayed actions
     * @name JClicPlayer#delayedTimer
     * @type {AWT.Timer} */
    delayedTimer: null,
    /**
     * This variable holds the action to be executed by `delayedTimer`
     * @name JClicPlayer#delayedAction
     * @type {AWT.Action} */
    delayedAction: null,
    /**
     * @typedef JClicPlayer~counterValType
     * @type {object}
     * @property {number} score
     * @property {number} actions
     * @property {number} time */
    /**
     * Current values of the counters
     * @name JClicPlayer#counterVal
     * @type {JClicPlayer~counterValType} */
    counterVal: { score: 0, actions: 0, time: 0 },
    /**
     * Point indicating the upper-left corner of the current background image
     * @name JClicPlayer#bgImageOrigin
     * @type {AWT.Point} */
    bgImageOrigin: null,
    /**
     * Whether the player must play all sounds (including system sounds) and other media content
     * of the activities.
     * @name JClicPlayer#audioEnabled
     * @type {boolean} */
    audioEnabled: true,
    /**
     * Whether the navigation buttons `next` and `back` are enabled o disabled.
     * @name JClicPlayer#navButtonsDisabled
     * @type {boolean} */
    navButtonsDisabled: false,
    /**
     * When this flag is `true`, the navigation buttons are always enabled despite
     * of the indications made by the activities or the sequence control system.
     * This is used only to debug projects with complicated sequence chaining.
     * @name JClicPlayer#navButtonsAlways
     * @type {boolean} */
    navButtonsAlways: false
  });

  return JClicPlayer;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 422 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var utf8 = __webpack_require__(63);
var utils = __webpack_require__(9);
var GenericWorker = __webpack_require__(23);
var StreamHelper = __webpack_require__(188);
var defaults = __webpack_require__(189);
var CompressedObject = __webpack_require__(132);
var ZipObject = __webpack_require__(452);
var generate = __webpack_require__(453);
var nodejsUtils = __webpack_require__(94);
var NodejsStreamInputAdapter = __webpack_require__(465);

/**
 * Add a file in the current folder.
 * @private
 * @param {string} name the name of the file
 * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file
 * @param {Object} originalOptions the options of the file
 * @return {Object} the new file.
 */
var fileAdd = function fileAdd(name, data, originalOptions) {
    // be sure sub folders exist
    var dataType = utils.getTypeOf(data),
        parent;

    /*
     * Correct options.
     */

    var o = utils.extend(originalOptions || {}, defaults);
    o.date = o.date || new Date();
    if (o.compression !== null) {
        o.compression = o.compression.toUpperCase();
    }

    if (typeof o.unixPermissions === "string") {
        o.unixPermissions = parseInt(o.unixPermissions, 8);
    }

    // UNX_IFDIR  0040000 see zipinfo.c
    if (o.unixPermissions && o.unixPermissions & 0x4000) {
        o.dir = true;
    }
    // Bit 4    Directory
    if (o.dosPermissions && o.dosPermissions & 0x0010) {
        o.dir = true;
    }

    if (o.dir) {
        name = forceTrailingSlash(name);
    }
    if (o.createFolders && (parent = parentFolder(name))) {
        folderAdd.call(this, parent, true);
    }

    var isUnicodeString = dataType === "string" && o.binary === false && o.base64 === false;
    if (!originalOptions || typeof originalOptions.binary === "undefined") {
        o.binary = !isUnicodeString;
    }

    var isCompressedEmpty = data instanceof CompressedObject && data.uncompressedSize === 0;

    if (isCompressedEmpty || o.dir || !data || data.length === 0) {
        o.base64 = false;
        o.binary = true;
        data = "";
        o.compression = "STORE";
        dataType = "string";
    }

    /*
     * Convert content to fit.
     */

    var zipObjectContent = null;
    if (data instanceof CompressedObject || data instanceof GenericWorker) {
        zipObjectContent = data;
    } else if (nodejsUtils.isNode && nodejsUtils.isStream(data)) {
        zipObjectContent = new NodejsStreamInputAdapter(name, data);
    } else {
        zipObjectContent = utils.prepareContent(name, data, o.binary, o.optimizedBinaryString, o.base64);
    }

    var object = new ZipObject(name, zipObjectContent, o);
    this.files[name] = object;
    /*
    TODO: we can't throw an exception because we have async promises
    (we can have a promise of a Date() for example) but returning a
    promise is useless because file(name, data) returns the JSZip
    object for chaining. Should we break that to allow the user
    to catch the error ?
     return external.Promise.resolve(zipObjectContent)
    .then(function () {
        return object;
    });
    */
};

/**
 * Find the parent folder of the path.
 * @private
 * @param {string} path the path to use
 * @return {string} the parent folder, or ""
 */
var parentFolder = function parentFolder(path) {
    if (path.slice(-1) === '/') {
        path = path.substring(0, path.length - 1);
    }
    var lastSlash = path.lastIndexOf('/');
    return lastSlash > 0 ? path.substring(0, lastSlash) : "";
};

/**
 * Returns the path with a slash at the end.
 * @private
 * @param {String} path the path to check.
 * @return {String} the path with a trailing slash.
 */
var forceTrailingSlash = function forceTrailingSlash(path) {
    // Check the name ends with a /
    if (path.slice(-1) !== "/") {
        path += "/"; // IE doesn't like substr(-1)
    }
    return path;
};

/**
 * Add a (sub) folder in the current folder.
 * @private
 * @param {string} name the folder's name
 * @param {boolean=} [createFolders] If true, automatically create sub
 *  folders. Defaults to false.
 * @return {Object} the new folder.
 */
var folderAdd = function folderAdd(name, createFolders) {
    createFolders = typeof createFolders !== 'undefined' ? createFolders : defaults.createFolders;

    name = forceTrailingSlash(name);

    // Does this folder already exist?
    if (!this.files[name]) {
        fileAdd.call(this, name, null, {
            dir: true,
            createFolders: createFolders
        });
    }
    return this.files[name];
};

/**
* Cross-window, cross-Node-context regular expression detection
* @param  {Object}  object Anything
* @return {Boolean}        true if the object is a regular expression,
* false otherwise
*/
function isRegExp(object) {
    return Object.prototype.toString.call(object) === "[object RegExp]";
}

// return the actual prototype of JSZip
var out = {
    /**
     * @see loadAsync
     */
    load: function load() {
        throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
    },

    /**
     * Call a callback function for each entry at this folder level.
     * @param {Function} cb the callback function:
     * function (relativePath, file) {...}
     * It takes 2 arguments : the relative path and the file.
     */
    forEach: function forEach(cb) {
        var filename, relativePath, file;
        for (filename in this.files) {
            if (!this.files.hasOwnProperty(filename)) {
                continue;
            }
            file = this.files[filename];
            relativePath = filename.slice(this.root.length, filename.length);
            if (relativePath && filename.slice(0, this.root.length) === this.root) {
                // the file is in the current root
                cb(relativePath, file); // TODO reverse the parameters ? need to be clean AND consistent with the filter search fn...
            }
        }
    },

    /**
     * Filter nested files/folders with the specified function.
     * @param {Function} search the predicate to use :
     * function (relativePath, file) {...}
     * It takes 2 arguments : the relative path and the file.
     * @return {Array} An array of matching elements.
     */
    filter: function filter(search) {
        var result = [];
        this.forEach(function (relativePath, entry) {
            if (search(relativePath, entry)) {
                // the file matches the function
                result.push(entry);
            }
        });
        return result;
    },

    /**
     * Add a file to the zip file, or search a file.
     * @param   {string|RegExp} name The name of the file to add (if data is defined),
     * the name of the file to find (if no data) or a regex to match files.
     * @param   {String|ArrayBuffer|Uint8Array|Buffer} data  The file data, either raw or base64 encoded
     * @param   {Object} o     File options
     * @return  {JSZip|Object|Array} this JSZip object (when adding a file),
     * a file (when searching by string) or an array of files (when searching by regex).
     */
    file: function file(name, data, o) {
        if (arguments.length === 1) {
            if (isRegExp(name)) {
                var regexp = name;
                return this.filter(function (relativePath, file) {
                    return !file.dir && regexp.test(relativePath);
                });
            } else {
                // text
                var obj = this.files[this.root + name];
                if (obj && !obj.dir) {
                    return obj;
                } else {
                    return null;
                }
            }
        } else {
            // more than one argument : we have data !
            name = this.root + name;
            fileAdd.call(this, name, data, o);
        }
        return this;
    },

    /**
     * Add a directory to the zip file, or search.
     * @param   {String|RegExp} arg The name of the directory to add, or a regex to search folders.
     * @return  {JSZip} an object with the new directory as the root, or an array containing matching folders.
     */
    folder: function folder(arg) {
        if (!arg) {
            return this;
        }

        if (isRegExp(arg)) {
            return this.filter(function (relativePath, file) {
                return file.dir && arg.test(relativePath);
            });
        }

        // else, name is a new folder
        var name = this.root + arg;
        var newFolder = folderAdd.call(this, name);

        // Allow chaining by returning a new object with this folder as the root
        var ret = this.clone();
        ret.root = newFolder.name;
        return ret;
    },

    /**
     * Delete a file, or a directory and all sub-files, from the zip
     * @param {string} name the name of the file to delete
     * @return {JSZip} this JSZip object
     */
    remove: function remove(name) {
        name = this.root + name;
        var file = this.files[name];
        if (!file) {
            // Look for any folders
            if (name.slice(-1) !== "/") {
                name += "/";
            }
            file = this.files[name];
        }

        if (file && !file.dir) {
            // file
            delete this.files[name];
        } else {
            // maybe a folder, delete recursively
            var kids = this.filter(function (relativePath, file) {
                return file.name.slice(0, name.length) === name;
            });
            for (var i = 0; i < kids.length; i++) {
                delete this.files[kids[i].name];
            }
        }

        return this;
    },

    /**
     * Generate the complete zip file
     * @param {Object} options the options to generate the zip file :
     * - compression, "STORE" by default.
     * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob.
     * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file
     */
    generate: function generate(options) {
        throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
    },

    /**
     * Generate the complete zip file as an internal stream.
     * @param {Object} options the options to generate the zip file :
     * - compression, "STORE" by default.
     * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob.
     * @return {StreamHelper} the streamed zip file.
     */
    generateInternalStream: function generateInternalStream(options) {
        var worker,
            opts = {};
        try {
            opts = utils.extend(options || {}, {
                streamFiles: false,
                compression: "STORE",
                compressionOptions: null,
                type: "",
                platform: "DOS",
                comment: null,
                mimeType: 'application/zip',
                encodeFileName: utf8.utf8encode
            });

            opts.type = opts.type.toLowerCase();
            opts.compression = opts.compression.toUpperCase();

            // "binarystring" is prefered but the internals use "string".
            if (opts.type === "binarystring") {
                opts.type = "string";
            }

            if (!opts.type) {
                throw new Error("No output type specified.");
            }

            utils.checkSupport(opts.type);

            // accept nodejs `process.platform`
            if (opts.platform === 'darwin' || opts.platform === 'freebsd' || opts.platform === 'linux' || opts.platform === 'sunos') {
                opts.platform = "UNIX";
            }
            if (opts.platform === 'win32') {
                opts.platform = "DOS";
            }

            var comment = opts.comment || this.comment || "";
            worker = generate.generateWorker(this, opts, comment);
        } catch (e) {
            worker = new GenericWorker("error");
            worker.error(e);
        }
        return new StreamHelper(worker, opts.type || "string", opts.mimeType);
    },
    /**
     * Generate the complete zip file asynchronously.
     * @see generateInternalStream
     */
    generateAsync: function generateAsync(options, onUpdate) {
        return this.generateInternalStream(options).accumulate(onUpdate);
    },
    /**
     * Generate the complete zip file asynchronously.
     * @see generateInternalStream
     */
    generateNodeStream: function generateNodeStream(options, onUpdate) {
        options = options || {};
        if (!options.type) {
            options.type = "nodebuffer";
        }
        return this.generateInternalStream(options).toNodejsStream(onUpdate);
    }
};
module.exports = out;

/***/ }),
/* 423 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


exports.byteLength = byteLength;
exports.toByteArray = toByteArray;
exports.fromByteArray = fromByteArray;

var lookup = [];
var revLookup = [];
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;

var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
for (var i = 0, len = code.length; i < len; ++i) {
  lookup[i] = code[i];
  revLookup[code.charCodeAt(i)] = i;
}

// Support decoding URL-safe base64 strings, as Node.js does.
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
revLookup['-'.charCodeAt(0)] = 62;
revLookup['_'.charCodeAt(0)] = 63;

function placeHoldersCount(b64) {
  var len = b64.length;
  if (len % 4 > 0) {
    throw new Error('Invalid string. Length must be a multiple of 4');
  }

  // the number of equal signs (place holders)
  // if there are two placeholders, than the two characters before it
  // represent one byte
  // if there is only one, then the three characters before it represent 2 bytes
  // this is just a cheap hack to not do indexOf twice
  return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
}

function byteLength(b64) {
  // base64 is 4/3 + up to two characters of the original data
  return b64.length * 3 / 4 - placeHoldersCount(b64);
}

function toByteArray(b64) {
  var i, l, tmp, placeHolders, arr;
  var len = b64.length;
  placeHolders = placeHoldersCount(b64);

  arr = new Arr(len * 3 / 4 - placeHolders);

  // if there are placeholders, only get up to the last complete 4 chars
  l = placeHolders > 0 ? len - 4 : len;

  var L = 0;

  for (i = 0; i < l; i += 4) {
    tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
    arr[L++] = tmp >> 16 & 0xFF;
    arr[L++] = tmp >> 8 & 0xFF;
    arr[L++] = tmp & 0xFF;
  }

  if (placeHolders === 2) {
    tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
    arr[L++] = tmp & 0xFF;
  } else if (placeHolders === 1) {
    tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
    arr[L++] = tmp >> 8 & 0xFF;
    arr[L++] = tmp & 0xFF;
  }

  return arr;
}

function tripletToBase64(num) {
  return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];
}

function encodeChunk(uint8, start, end) {
  var tmp;
  var output = [];
  for (var i = start; i < end; i += 3) {
    tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF);
    output.push(tripletToBase64(tmp));
  }
  return output.join('');
}

function fromByteArray(uint8) {
  var tmp;
  var len = uint8.length;
  var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
  var output = '';
  var parts = [];
  var maxChunkLength = 16383; // must be multiple of 3

  // go through the array every three bytes, we'll deal with trailing stuff later
  for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
    parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
  }

  // pad the end with zeros, but make sure to not forget the extra bytes
  if (extraBytes === 1) {
    tmp = uint8[len - 1];
    output += lookup[tmp >> 2];
    output += lookup[tmp << 4 & 0x3F];
    output += '==';
  } else if (extraBytes === 2) {
    tmp = (uint8[len - 2] << 8) + uint8[len - 1];
    output += lookup[tmp >> 10];
    output += lookup[tmp >> 4 & 0x3F];
    output += lookup[tmp << 2 & 0x3F];
    output += '=';
  }

  parts.push(output);

  return parts.join('');
}

/***/ }),
/* 424 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  var e, m;
  var eLen = nBytes * 8 - mLen - 1;
  var eMax = (1 << eLen) - 1;
  var eBias = eMax >> 1;
  var nBits = -7;
  var i = isLE ? nBytes - 1 : 0;
  var d = isLE ? -1 : 1;
  var s = buffer[offset + i];

  i += d;

  e = s & (1 << -nBits) - 1;
  s >>= -nBits;
  nBits += eLen;
  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}

  m = e & (1 << -nBits) - 1;
  e >>= -nBits;
  nBits += mLen;
  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}

  if (e === 0) {
    e = 1 - eBias;
  } else if (e === eMax) {
    return m ? NaN : (s ? -1 : 1) * Infinity;
  } else {
    m = m + Math.pow(2, mLen);
    e = e - eBias;
  }
  return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
};

exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  var e, m, c;
  var eLen = nBytes * 8 - mLen - 1;
  var eMax = (1 << eLen) - 1;
  var eBias = eMax >> 1;
  var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
  var i = isLE ? 0 : nBytes - 1;
  var d = isLE ? 1 : -1;
  var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;

  value = Math.abs(value);

  if (isNaN(value) || value === Infinity) {
    m = isNaN(value) ? 1 : 0;
    e = eMax;
  } else {
    e = Math.floor(Math.log(value) / Math.LN2);
    if (value * (c = Math.pow(2, -e)) < 1) {
      e--;
      c *= 2;
    }
    if (e + eBias >= 1) {
      value += rt / c;
    } else {
      value += rt * Math.pow(2, 1 - eBias);
    }
    if (value * c >= 2) {
      e++;
      c /= 2;
    }

    if (e + eBias >= eMax) {
      m = 0;
      e = eMax;
    } else if (e + eBias >= 1) {
      m = (value * c - 1) * Math.pow(2, mLen);
      e = e + eBias;
    } else {
      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
      e = 0;
    }
  }

  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}

  e = e << mLen | m;
  eLen += mLen;
  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}

  buffer[offset + i - d] |= s * 128;
};

/***/ }),
/* 425 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var Stream = function () {
  try {
    return __webpack_require__(91); // hack to fix a circular dependency issue when used with browserify
  } catch (_) {}
}();
exports = module.exports = __webpack_require__(179);
exports.Stream = Stream || exports;
exports.Readable = exports;
exports.Writable = __webpack_require__(128);
exports.Duplex = __webpack_require__(55);
exports.Transform = __webpack_require__(129);
exports.PassThrough = __webpack_require__(182);

/***/ }),
/* 426 */
/***/ (function(module, exports) {

/* (ignored) */

/***/ }),
/* 427 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global, process) {

(function (global, undefined) {
    "use strict";

    if (global.setImmediate) {
        return;
    }

    var nextHandle = 1; // Spec says greater than zero
    var tasksByHandle = {};
    var currentlyRunningATask = false;
    var doc = global.document;
    var registerImmediate;

    function setImmediate(callback) {
        // Callback can either be a function or a string
        if (typeof callback !== "function") {
            callback = new Function("" + callback);
        }
        // Copy function arguments
        var args = new Array(arguments.length - 1);
        for (var i = 0; i < args.length; i++) {
            args[i] = arguments[i + 1];
        }
        // Store and register the task
        var task = { callback: callback, args: args };
        tasksByHandle[nextHandle] = task;
        registerImmediate(nextHandle);
        return nextHandle++;
    }

    function clearImmediate(handle) {
        delete tasksByHandle[handle];
    }

    function run(task) {
        var callback = task.callback;
        var args = task.args;
        switch (args.length) {
            case 0:
                callback();
                break;
            case 1:
                callback(args[0]);
                break;
            case 2:
                callback(args[0], args[1]);
                break;
            case 3:
                callback(args[0], args[1], args[2]);
                break;
            default:
                callback.apply(undefined, args);
                break;
        }
    }

    function runIfPresent(handle) {
        // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
        // So if we're currently running a task, we'll need to delay this invocation.
        if (currentlyRunningATask) {
            // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
            // "too much recursion" error.
            setTimeout(runIfPresent, 0, handle);
        } else {
            var task = tasksByHandle[handle];
            if (task) {
                currentlyRunningATask = true;
                try {
                    run(task);
                } finally {
                    clearImmediate(handle);
                    currentlyRunningATask = false;
                }
            }
        }
    }

    function installNextTickImplementation() {
        registerImmediate = function registerImmediate(handle) {
            process.nextTick(function () {
                runIfPresent(handle);
            });
        };
    }

    function canUsePostMessage() {
        // The test against `importScripts` prevents this implementation from being installed inside a web worker,
        // where `global.postMessage` means something completely different and can't be used for this purpose.
        if (global.postMessage && !global.importScripts) {
            var postMessageIsAsynchronous = true;
            var oldOnMessage = global.onmessage;
            global.onmessage = function () {
                postMessageIsAsynchronous = false;
            };
            global.postMessage("", "*");
            global.onmessage = oldOnMessage;
            return postMessageIsAsynchronous;
        }
    }

    function installPostMessageImplementation() {
        // Installs an event handler on `global` for the `message` event: see
        // * https://developer.mozilla.org/en/DOM/window.postMessage
        // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages

        var messagePrefix = "setImmediate$" + Math.random() + "$";
        var onGlobalMessage = function onGlobalMessage(event) {
            if (event.source === global && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) {
                runIfPresent(+event.data.slice(messagePrefix.length));
            }
        };

        if (global.addEventListener) {
            global.addEventListener("message", onGlobalMessage, false);
        } else {
            global.attachEvent("onmessage", onGlobalMessage);
        }

        registerImmediate = function registerImmediate(handle) {
            global.postMessage(messagePrefix + handle, "*");
        };
    }

    function installMessageChannelImplementation() {
        var channel = new MessageChannel();
        channel.port1.onmessage = function (event) {
            var handle = event.data;
            runIfPresent(handle);
        };

        registerImmediate = function registerImmediate(handle) {
            channel.port2.postMessage(handle);
        };
    }

    function installReadyStateChangeImplementation() {
        var html = doc.documentElement;
        registerImmediate = function registerImmediate(handle) {
            // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
            // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
            var script = doc.createElement("script");
            script.onreadystatechange = function () {
                runIfPresent(handle);
                script.onreadystatechange = null;
                html.removeChild(script);
                script = null;
            };
            html.appendChild(script);
        };
    }

    function installSetTimeoutImplementation() {
        registerImmediate = function registerImmediate(handle) {
            setTimeout(runIfPresent, 0, handle);
        };
    }

    // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
    var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
    attachTo = attachTo && attachTo.setTimeout ? attachTo : global;

    // Don't get fooled by e.g. browserify environments.
    if ({}.toString.call(global.process) === "[object process]") {
        // For Node.js before 0.9
        installNextTickImplementation();
    } else if (canUsePostMessage()) {
        // For non-IE10 modern browsers
        installPostMessageImplementation();
    } else if (global.MessageChannel) {
        // For web workers, where supported
        installMessageChannelImplementation();
    } else if (doc && "onreadystatechange" in doc.createElement("script")) {
        // For IE 6–8
        installReadyStateChangeImplementation();
    } else {
        // For older browsers
        installSetTimeoutImplementation();
    }

    attachTo.setImmediate = setImmediate;
    attachTo.clearImmediate = clearImmediate;
})(typeof self === "undefined" ? typeof global === "undefined" ? undefined : global : self);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(43), __webpack_require__(93)))

/***/ }),
/* 428 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {

/**
 * Module exports.
 */

module.exports = deprecate;

/**
 * Mark that a method should not be used.
 * Returns a modified function which warns once by default.
 *
 * If `localStorage.noDeprecation = true` is set, then it is a no-op.
 *
 * If `localStorage.throwDeprecation = true` is set, then deprecated functions
 * will throw an Error when invoked.
 *
 * If `localStorage.traceDeprecation = true` is set, then deprecated functions
 * will invoke `console.trace()` instead of `console.error()`.
 *
 * @param {Function} fn - the function to deprecate
 * @param {String} msg - the string to print to the console when `fn` is invoked
 * @returns {Function} a new "deprecated" version of `fn`
 * @api public
 */

function deprecate(fn, msg) {
  if (config('noDeprecation')) {
    return fn;
  }

  var warned = false;
  function deprecated() {
    if (!warned) {
      if (config('throwDeprecation')) {
        throw new Error(msg);
      } else if (config('traceDeprecation')) {
        console.trace(msg);
      } else {
        console.warn(msg);
      }
      warned = true;
    }
    return fn.apply(this, arguments);
  }

  return deprecated;
}

/**
 * Checks `localStorage` for boolean values for the given `name`.
 *
 * @param {String} name
 * @returns {Boolean}
 * @api private
 */

function config(name) {
  // accessing global.localStorage can trigger a DOMException in sandboxed iframes
  try {
    if (!global.localStorage) return false;
  } catch (_) {
    return false;
  }
  var val = global.localStorage[name];
  if (null == val) return false;
  return String(val).toLowerCase() === 'true';
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(43)))

/***/ }),
/* 429 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/* eslint-disable node/no-deprecated-api */
var buffer = __webpack_require__(38);
var Buffer = buffer.Buffer;

// alternative to using Object.keys for old browsers
function copyProps(src, dst) {
  for (var key in src) {
    dst[key] = src[key];
  }
}
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
  module.exports = buffer;
} else {
  // Copy properties from require('buffer')
  copyProps(buffer, exports);
  exports.Buffer = SafeBuffer;
}

function SafeBuffer(arg, encodingOrOffset, length) {
  return Buffer(arg, encodingOrOffset, length);
}

// Copy static methods from Buffer
copyProps(Buffer, SafeBuffer);

SafeBuffer.from = function (arg, encodingOrOffset, length) {
  if (typeof arg === 'number') {
    throw new TypeError('Argument must not be a number');
  }
  return Buffer(arg, encodingOrOffset, length);
};

SafeBuffer.alloc = function (size, fill, encoding) {
  if (typeof size !== 'number') {
    throw new TypeError('Argument must be a number');
  }
  var buf = Buffer(size);
  if (fill !== undefined) {
    if (typeof encoding === 'string') {
      buf.fill(fill, encoding);
    } else {
      buf.fill(fill);
    }
  } else {
    buf.fill(0);
  }
  return buf;
};

SafeBuffer.allocUnsafe = function (size) {
  if (typeof size !== 'number') {
    throw new TypeError('Argument must be a number');
  }
  return Buffer(size);
};

SafeBuffer.allocUnsafeSlow = function (size) {
  if (typeof size !== 'number') {
    throw new TypeError('Argument must be a number');
  }
  return buffer.SlowBuffer(size);
};

/***/ }),
/* 430 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = __webpack_require__(128);

/***/ }),
/* 431 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = __webpack_require__(55);

/***/ }),
/* 432 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = __webpack_require__(129);

/***/ }),
/* 433 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = __webpack_require__(182);

/***/ }),
/* 434 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


__webpack_require__(435);
module.exports = __webpack_require__(184).setImmediate;

/***/ }),
/* 435 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var $export = __webpack_require__(436),
    $task = __webpack_require__(444);
$export($export.G + $export.B, {
  setImmediate: $task.set,
  clearImmediate: $task.clear
});

/***/ }),
/* 436 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var global = __webpack_require__(95),
    core = __webpack_require__(184),
    ctx = __webpack_require__(185),
    hide = __webpack_require__(438),
    PROTOTYPE = 'prototype';

var $export = function $export(type, name, source) {
  var IS_FORCED = type & $export.F,
      IS_GLOBAL = type & $export.G,
      IS_STATIC = type & $export.S,
      IS_PROTO = type & $export.P,
      IS_BIND = type & $export.B,
      IS_WRAP = type & $export.W,
      exports = IS_GLOBAL ? core : core[name] || (core[name] = {}),
      expProto = exports[PROTOTYPE],
      target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE],
      key,
      own,
      out;
  if (IS_GLOBAL) source = name;
  for (key in source) {
    // contains in native
    own = !IS_FORCED && target && target[key] !== undefined;
    if (own && key in exports) continue;
    // export native or passed
    out = own ? target[key] : source[key];
    // prevent global pollution for namespaces
    exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
    // bind timers to global for call from export context
    : IS_BIND && own ? ctx(out, global)
    // wrap global constructors for prevent change them in library
    : IS_WRAP && target[key] == out ? function (C) {
      var F = function F(a, b, c) {
        if (this instanceof C) {
          switch (arguments.length) {
            case 0:
              return new C();
            case 1:
              return new C(a);
            case 2:
              return new C(a, b);
          }return new C(a, b, c);
        }return C.apply(this, arguments);
      };
      F[PROTOTYPE] = C[PROTOTYPE];
      return F;
      // make static versions for prototype methods
    }(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
    // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
    if (IS_PROTO) {
      (exports.virtual || (exports.virtual = {}))[key] = out;
      // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
      if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
    }
  }
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library` 
module.exports = $export;

/***/ }),
/* 437 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = function (it) {
  if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  return it;
};

/***/ }),
/* 438 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var dP = __webpack_require__(439),
    createDesc = __webpack_require__(443);
module.exports = __webpack_require__(131) ? function (object, key, value) {
  return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
  object[key] = value;
  return object;
};

/***/ }),
/* 439 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var anObject = __webpack_require__(440),
    IE8_DOM_DEFINE = __webpack_require__(441),
    toPrimitive = __webpack_require__(442),
    dP = Object.defineProperty;

exports.f = __webpack_require__(131) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  anObject(O);
  P = toPrimitive(P, true);
  anObject(Attributes);
  if (IE8_DOM_DEFINE) try {
    return dP(O, P, Attributes);
  } catch (e) {/* empty */}
  if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  if ('value' in Attributes) O[P] = Attributes.value;
  return O;
};

/***/ }),
/* 440 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var isObject = __webpack_require__(130);
module.exports = function (it) {
  if (!isObject(it)) throw TypeError(it + ' is not an object!');
  return it;
};

/***/ }),
/* 441 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = !__webpack_require__(131) && !__webpack_require__(186)(function () {
  return Object.defineProperty(__webpack_require__(187)('div'), 'a', { get: function get() {
      return 7;
    } }).a != 7;
});

/***/ }),
/* 442 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(130);
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function (it, S) {
  if (!isObject(it)) return it;
  var fn, val;
  if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
  if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  throw TypeError("Can't convert object to primitive value");
};

/***/ }),
/* 443 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = function (bitmap, value) {
  return {
    enumerable: !(bitmap & 1),
    configurable: !(bitmap & 2),
    writable: !(bitmap & 4),
    value: value
  };
};

/***/ }),
/* 444 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var ctx = __webpack_require__(185),
    invoke = __webpack_require__(445),
    html = __webpack_require__(446),
    cel = __webpack_require__(187),
    global = __webpack_require__(95),
    process = global.process,
    setTask = global.setImmediate,
    clearTask = global.clearImmediate,
    MessageChannel = global.MessageChannel,
    counter = 0,
    queue = {},
    ONREADYSTATECHANGE = 'onreadystatechange',
    defer,
    channel,
    port;
var run = function run() {
  var id = +this;
  if (queue.hasOwnProperty(id)) {
    var fn = queue[id];
    delete queue[id];
    fn();
  }
};
var listener = function listener(event) {
  run.call(event.data);
};
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if (!setTask || !clearTask) {
  setTask = function setImmediate(fn) {
    var args = [],
        i = 1;
    while (arguments.length > i) {
      args.push(arguments[i++]);
    }queue[++counter] = function () {
      invoke(typeof fn == 'function' ? fn : Function(fn), args);
    };
    defer(counter);
    return counter;
  };
  clearTask = function clearImmediate(id) {
    delete queue[id];
  };
  // Node.js 0.8-
  if (__webpack_require__(447)(process) == 'process') {
    defer = function defer(id) {
      process.nextTick(ctx(run, id, 1));
    };
    // Browsers with MessageChannel, includes WebWorkers
  } else if (MessageChannel) {
    channel = new MessageChannel();
    port = channel.port2;
    channel.port1.onmessage = listener;
    defer = ctx(port.postMessage, port, 1);
    // Browsers with postMessage, skip WebWorkers
    // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
    defer = function defer(id) {
      global.postMessage(id + '', '*');
    };
    global.addEventListener('message', listener, false);
    // IE8-
  } else if (ONREADYSTATECHANGE in cel('script')) {
    defer = function defer(id) {
      html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
        html.removeChild(this);
        run.call(id);
      };
    };
    // Rest old browsers
  } else {
    defer = function defer(id) {
      setTimeout(ctx(run, id, 1), 0);
    };
  }
}
module.exports = {
  set: setTask,
  clear: clearTask
};

/***/ }),
/* 445 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// fast apply, http://jsperf.lnkit.com/fast-apply/5
module.exports = function (fn, args, that) {
                  var un = that === undefined;
                  switch (args.length) {
                                    case 0:
                                                      return un ? fn() : fn.call(that);
                                    case 1:
                                                      return un ? fn(args[0]) : fn.call(that, args[0]);
                                    case 2:
                                                      return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]);
                                    case 3:
                                                      return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]);
                                    case 4:
                                                      return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]);
                  }return fn.apply(that, args);
};

/***/ }),
/* 446 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = __webpack_require__(95).document && document.documentElement;

/***/ }),
/* 447 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var toString = {}.toString;

module.exports = function (it) {
  return toString.call(it).slice(8, -1);
};

/***/ }),
/* 448 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var immediate = __webpack_require__(449);

/* istanbul ignore next */
function INTERNAL() {}

var handlers = {};

var REJECTED = ['REJECTED'];
var FULFILLED = ['FULFILLED'];
var PENDING = ['PENDING'];

module.exports = Promise;

function Promise(resolver) {
  if (typeof resolver !== 'function') {
    throw new TypeError('resolver must be a function');
  }
  this.state = PENDING;
  this.queue = [];
  this.outcome = void 0;
  if (resolver !== INTERNAL) {
    safelyResolveThenable(this, resolver);
  }
}

Promise.prototype["catch"] = function (onRejected) {
  return this.then(null, onRejected);
};
Promise.prototype.then = function (onFulfilled, onRejected) {
  if (typeof onFulfilled !== 'function' && this.state === FULFILLED || typeof onRejected !== 'function' && this.state === REJECTED) {
    return this;
  }
  var promise = new this.constructor(INTERNAL);
  if (this.state !== PENDING) {
    var resolver = this.state === FULFILLED ? onFulfilled : onRejected;
    unwrap(promise, resolver, this.outcome);
  } else {
    this.queue.push(new QueueItem(promise, onFulfilled, onRejected));
  }

  return promise;
};
function QueueItem(promise, onFulfilled, onRejected) {
  this.promise = promise;
  if (typeof onFulfilled === 'function') {
    this.onFulfilled = onFulfilled;
    this.callFulfilled = this.otherCallFulfilled;
  }
  if (typeof onRejected === 'function') {
    this.onRejected = onRejected;
    this.callRejected = this.otherCallRejected;
  }
}
QueueItem.prototype.callFulfilled = function (value) {
  handlers.resolve(this.promise, value);
};
QueueItem.prototype.otherCallFulfilled = function (value) {
  unwrap(this.promise, this.onFulfilled, value);
};
QueueItem.prototype.callRejected = function (value) {
  handlers.reject(this.promise, value);
};
QueueItem.prototype.otherCallRejected = function (value) {
  unwrap(this.promise, this.onRejected, value);
};

function unwrap(promise, func, value) {
  immediate(function () {
    var returnValue;
    try {
      returnValue = func(value);
    } catch (e) {
      return handlers.reject(promise, e);
    }
    if (returnValue === promise) {
      handlers.reject(promise, new TypeError('Cannot resolve promise with itself'));
    } else {
      handlers.resolve(promise, returnValue);
    }
  });
}

handlers.resolve = function (self, value) {
  var result = tryCatch(getThen, value);
  if (result.status === 'error') {
    return handlers.reject(self, result.value);
  }
  var thenable = result.value;

  if (thenable) {
    safelyResolveThenable(self, thenable);
  } else {
    self.state = FULFILLED;
    self.outcome = value;
    var i = -1;
    var len = self.queue.length;
    while (++i < len) {
      self.queue[i].callFulfilled(value);
    }
  }
  return self;
};
handlers.reject = function (self, error) {
  self.state = REJECTED;
  self.outcome = error;
  var i = -1;
  var len = self.queue.length;
  while (++i < len) {
    self.queue[i].callRejected(error);
  }
  return self;
};

function getThen(obj) {
  // Make sure we only access the accessor once as required by the spec
  var then = obj && obj.then;
  if (obj && ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' || typeof obj === 'function') && typeof then === 'function') {
    return function appyThen() {
      then.apply(obj, arguments);
    };
  }
}

function safelyResolveThenable(self, thenable) {
  // Either fulfill, reject or reject with error
  var called = false;
  function onError(value) {
    if (called) {
      return;
    }
    called = true;
    handlers.reject(self, value);
  }

  function onSuccess(value) {
    if (called) {
      return;
    }
    called = true;
    handlers.resolve(self, value);
  }

  function tryToUnwrap() {
    thenable(onSuccess, onError);
  }

  var result = tryCatch(tryToUnwrap);
  if (result.status === 'error') {
    onError(result.value);
  }
}

function tryCatch(func, value) {
  var out = {};
  try {
    out.value = func(value);
    out.status = 'success';
  } catch (e) {
    out.status = 'error';
    out.value = e;
  }
  return out;
}

Promise.resolve = resolve;
function resolve(value) {
  if (value instanceof this) {
    return value;
  }
  return handlers.resolve(new this(INTERNAL), value);
}

Promise.reject = reject;
function reject(reason) {
  var promise = new this(INTERNAL);
  return handlers.reject(promise, reason);
}

Promise.all = all;
function all(iterable) {
  var self = this;
  if (Object.prototype.toString.call(iterable) !== '[object Array]') {
    return this.reject(new TypeError('must be an array'));
  }

  var len = iterable.length;
  var called = false;
  if (!len) {
    return this.resolve([]);
  }

  var values = new Array(len);
  var resolved = 0;
  var i = -1;
  var promise = new this(INTERNAL);

  while (++i < len) {
    allResolver(iterable[i], i);
  }
  return promise;
  function allResolver(value, i) {
    self.resolve(value).then(resolveFromAll, function (error) {
      if (!called) {
        called = true;
        handlers.reject(promise, error);
      }
    });
    function resolveFromAll(outValue) {
      values[i] = outValue;
      if (++resolved === len && !called) {
        called = true;
        handlers.resolve(promise, values);
      }
    }
  }
}

Promise.race = race;
function race(iterable) {
  var self = this;
  if (Object.prototype.toString.call(iterable) !== '[object Array]') {
    return this.reject(new TypeError('must be an array'));
  }

  var len = iterable.length;
  var called = false;
  if (!len) {
    return this.resolve([]);
  }

  var i = -1;
  var promise = new this(INTERNAL);

  while (++i < len) {
    resolver(iterable[i]);
  }
  return promise;
  function resolver(value) {
    self.resolve(value).then(function (response) {
      if (!called) {
        called = true;
        handlers.resolve(promise, response);
      }
    }, function (error) {
      if (!called) {
        called = true;
        handlers.reject(promise, error);
      }
    });
  }
}

/***/ }),
/* 449 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {

var Mutation = global.MutationObserver || global.WebKitMutationObserver;

var scheduleDrain;

{
  if (Mutation) {
    var called = 0;
    var observer = new Mutation(nextTick);
    var element = global.document.createTextNode('');
    observer.observe(element, {
      characterData: true
    });
    scheduleDrain = function scheduleDrain() {
      element.data = called = ++called % 2;
    };
  } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {
    var channel = new global.MessageChannel();
    channel.port1.onmessage = nextTick;
    scheduleDrain = function scheduleDrain() {
      channel.port2.postMessage(0);
    };
  } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {
    scheduleDrain = function scheduleDrain() {

      // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
      // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
      var scriptEl = global.document.createElement('script');
      scriptEl.onreadystatechange = function () {
        nextTick();

        scriptEl.onreadystatechange = null;
        scriptEl.parentNode.removeChild(scriptEl);
        scriptEl = null;
      };
      global.document.documentElement.appendChild(scriptEl);
    };
  } else {
    scheduleDrain = function scheduleDrain() {
      setTimeout(nextTick, 0);
    };
  }
}

var draining;
var queue = [];
//named nextTick for less confusing stack traces
function nextTick() {
  draining = true;
  var i, oldQueue;
  var len = queue.length;
  while (len) {
    oldQueue = queue;
    queue = [];
    i = -1;
    while (++i < len) {
      oldQueue[i]();
    }
    len = queue.length;
  }
  draining = false;
}

module.exports = immediate;
function immediate(task) {
  if (queue.push(task) === 1 && !draining) {
    scheduleDrain();
  }
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(43)))

/***/ }),
/* 450 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var GenericWorker = __webpack_require__(23);
var utils = __webpack_require__(9);

/**
 * A worker which convert chunks to a specified type.
 * @constructor
 * @param {String} destType the destination type.
 */
function ConvertWorker(destType) {
    GenericWorker.call(this, "ConvertWorker to " + destType);
    this.destType = destType;
}
utils.inherits(ConvertWorker, GenericWorker);

/**
 * @see GenericWorker.processChunk
 */
ConvertWorker.prototype.processChunk = function (chunk) {
    this.push({
        data: utils.transformTo(this.destType, chunk.data),
        meta: chunk.meta
    });
};
module.exports = ConvertWorker;

/***/ }),
/* 451 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var Readable = __webpack_require__(178).Readable;

var utils = __webpack_require__(9);
utils.inherits(NodejsStreamOutputAdapter, Readable);

/**
* A nodejs stream using a worker as source.
* @see the SourceWrapper in http://nodejs.org/api/stream.html
* @constructor
* @param {StreamHelper} helper the helper wrapping the worker
* @param {Object} options the nodejs stream options
* @param {Function} updateCb the update callback.
*/
function NodejsStreamOutputAdapter(helper, options, updateCb) {
    Readable.call(this, options);
    this._helper = helper;

    var self = this;
    helper.on("data", function (data, meta) {
        if (!self.push(data)) {
            self._helper.pause();
        }
        if (updateCb) {
            updateCb(meta);
        }
    }).on("error", function (e) {
        self.emit('error', e);
    }).on("end", function () {
        self.push(null);
    });
}

NodejsStreamOutputAdapter.prototype._read = function () {
    this._helper.resume();
};

module.exports = NodejsStreamOutputAdapter;

/***/ }),
/* 452 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var StreamHelper = __webpack_require__(188);
var DataWorker = __webpack_require__(190);
var utf8 = __webpack_require__(63);
var CompressedObject = __webpack_require__(132);
var GenericWorker = __webpack_require__(23);

/**
 * A simple object representing a file in the zip file.
 * @constructor
 * @param {string} name the name of the file
 * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data
 * @param {Object} options the options of the file
 */
var ZipObject = function ZipObject(name, data, options) {
    this.name = name;
    this.dir = options.dir;
    this.date = options.date;
    this.comment = options.comment;
    this.unixPermissions = options.unixPermissions;
    this.dosPermissions = options.dosPermissions;

    this._data = data;
    this._dataBinary = options.binary;
    // keep only the compression
    this.options = {
        compression: options.compression,
        compressionOptions: options.compressionOptions
    };
};

ZipObject.prototype = {
    /**
     * Create an internal stream for the content of this object.
     * @param {String} type the type of each chunk.
     * @return StreamHelper the stream.
     */
    internalStream: function internalStream(type) {
        var result = null,
            outputType = "string";
        try {
            if (!type) {
                throw new Error("No output type specified.");
            }
            outputType = type.toLowerCase();
            var askUnicodeString = outputType === "string" || outputType === "text";
            if (outputType === "binarystring" || outputType === "text") {
                outputType = "string";
            }
            result = this._decompressWorker();

            var isUnicodeString = !this._dataBinary;

            if (isUnicodeString && !askUnicodeString) {
                result = result.pipe(new utf8.Utf8EncodeWorker());
            }
            if (!isUnicodeString && askUnicodeString) {
                result = result.pipe(new utf8.Utf8DecodeWorker());
            }
        } catch (e) {
            result = new GenericWorker("error");
            result.error(e);
        }

        return new StreamHelper(result, outputType, "");
    },

    /**
     * Prepare the content in the asked type.
     * @param {String} type the type of the result.
     * @param {Function} onUpdate a function to call on each internal update.
     * @return Promise the promise of the result.
     */
    async: function async(type, onUpdate) {
        return this.internalStream(type).accumulate(onUpdate);
    },

    /**
     * Prepare the content as a nodejs stream.
     * @param {String} type the type of each chunk.
     * @param {Function} onUpdate a function to call on each internal update.
     * @return Stream the stream.
     */
    nodeStream: function nodeStream(type, onUpdate) {
        return this.internalStream(type || "nodebuffer").toNodejsStream(onUpdate);
    },

    /**
     * Return a worker for the compressed content.
     * @private
     * @param {Object} compression the compression object to use.
     * @param {Object} compressionOptions the options to use when compressing.
     * @return Worker the worker.
     */
    _compressWorker: function _compressWorker(compression, compressionOptions) {
        if (this._data instanceof CompressedObject && this._data.compression.magic === compression.magic) {
            return this._data.getCompressedWorker();
        } else {
            var result = this._decompressWorker();
            if (!this._dataBinary) {
                result = result.pipe(new utf8.Utf8EncodeWorker());
            }
            return CompressedObject.createWorkerFrom(result, compression, compressionOptions);
        }
    },
    /**
     * Return a worker for the decompressed content.
     * @private
     * @return Worker the worker.
     */
    _decompressWorker: function _decompressWorker() {
        if (this._data instanceof CompressedObject) {
            return this._data.getContentWorker();
        } else if (this._data instanceof GenericWorker) {
            return this._data;
        } else {
            return new DataWorker(this._data);
        }
    }
};

var removedMethods = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"];
var removedFn = function removedFn() {
    throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
};

for (var i = 0; i < removedMethods.length; i++) {
    ZipObject.prototype[removedMethods[i]] = removedFn;
}
module.exports = ZipObject;

/***/ }),
/* 453 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var compressions = __webpack_require__(193);
var ZipFileWorker = __webpack_require__(464);

/**
 * Find the compression to use.
 * @param {String} fileCompression the compression defined at the file level, if any.
 * @param {String} zipCompression the compression defined at the load() level.
 * @return {Object} the compression object to use.
 */
var getCompression = function getCompression(fileCompression, zipCompression) {

    var compressionName = fileCompression || zipCompression;
    var compression = compressions[compressionName];
    if (!compression) {
        throw new Error(compressionName + " is not a valid compression method !");
    }
    return compression;
};

/**
 * Create a worker to generate a zip file.
 * @param {JSZip} zip the JSZip instance at the right root level.
 * @param {Object} options to generate the zip file.
 * @param {String} comment the comment to use.
 */
exports.generateWorker = function (zip, options, comment) {

    var zipFileWorker = new ZipFileWorker(options.streamFiles, comment, options.platform, options.encodeFileName);
    var entriesCount = 0;
    try {

        zip.forEach(function (relativePath, file) {
            entriesCount++;
            var compression = getCompression(file.options.compression, options.compression);
            var compressionOptions = file.options.compressionOptions || options.compressionOptions || {};
            var dir = file.dir,
                date = file.date;

            file._compressWorker(compression, compressionOptions).withStreamInfo("file", {
                name: relativePath,
                dir: dir,
                date: date,
                comment: file.comment || "",
                unixPermissions: file.unixPermissions,
                dosPermissions: file.dosPermissions
            }).pipe(zipFileWorker);
        });
        zipFileWorker.entriesCount = entriesCount;
    } catch (e) {
        zipFileWorker.error(e);
    }

    return zipFileWorker;
};

/***/ }),
/* 454 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var USE_TYPEDARRAY = typeof Uint8Array !== 'undefined' && typeof Uint16Array !== 'undefined' && typeof Uint32Array !== 'undefined';

var pako = __webpack_require__(455);
var utils = __webpack_require__(9);
var GenericWorker = __webpack_require__(23);

var ARRAY_TYPE = USE_TYPEDARRAY ? "uint8array" : "array";

exports.magic = "\x08\x00";

/**
 * Create a worker that uses pako to inflate/deflate.
 * @constructor
 * @param {String} action the name of the pako function to call : either "Deflate" or "Inflate".
 * @param {Object} options the options to use when (de)compressing.
 */
function FlateWorker(action, options) {
    GenericWorker.call(this, "FlateWorker/" + action);

    this._pako = null;
    this._pakoAction = action;
    this._pakoOptions = options;
    // the `meta` object from the last chunk received
    // this allow this worker to pass around metadata
    this.meta = {};
}

utils.inherits(FlateWorker, GenericWorker);

/**
 * @see GenericWorker.processChunk
 */
FlateWorker.prototype.processChunk = function (chunk) {
    this.meta = chunk.meta;
    if (this._pako === null) {
        this._createPako();
    }
    this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false);
};

/**
 * @see GenericWorker.flush
 */
FlateWorker.prototype.flush = function () {
    GenericWorker.prototype.flush.call(this);
    if (this._pako === null) {
        this._createPako();
    }
    this._pako.push([], true);
};
/**
 * @see GenericWorker.cleanUp
 */
FlateWorker.prototype.cleanUp = function () {
    GenericWorker.prototype.cleanUp.call(this);
    this._pako = null;
};

/**
 * Create the _pako object.
 * TODO: lazy-loading this object isn't the best solution but it's the
 * quickest. The best solution is to lazy-load the worker list. See also the
 * issue #446.
 */
FlateWorker.prototype._createPako = function () {
    this._pako = new pako[this._pakoAction]({
        raw: true,
        level: this._pakoOptions.level || -1 // default compression
    });
    var self = this;
    this._pako.onData = function (data) {
        self.push({
            data: data,
            meta: self.meta
        });
    };
};

exports.compressWorker = function (compressionOptions) {
    return new FlateWorker("Deflate", compressionOptions);
};
exports.uncompressWorker = function () {
    return new FlateWorker("Inflate", {});
};

/***/ }),
/* 455 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// Top level file is just a mixin of submodules & constants


var assign = __webpack_require__(42).assign;

var deflate = __webpack_require__(456);
var inflate = __webpack_require__(459);
var constants = __webpack_require__(198);

var pako = {};

assign(pako, deflate, inflate, constants);

module.exports = pako;

/***/ }),
/* 456 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var zlib_deflate = __webpack_require__(457);
var utils = __webpack_require__(42);
var strings = __webpack_require__(196);
var msg = __webpack_require__(134);
var ZStream = __webpack_require__(197);

var toString = Object.prototype.toString;

/* Public constants ==========================================================*/
/* ===========================================================================*/

var Z_NO_FLUSH = 0;
var Z_FINISH = 4;

var Z_OK = 0;
var Z_STREAM_END = 1;
var Z_SYNC_FLUSH = 2;

var Z_DEFAULT_COMPRESSION = -1;

var Z_DEFAULT_STRATEGY = 0;

var Z_DEFLATED = 8;

/* ===========================================================================*/

/**
 * class Deflate
 *
 * Generic JS-style wrapper for zlib calls. If you don't need
 * streaming behaviour - use more simple functions: [[deflate]],
 * [[deflateRaw]] and [[gzip]].
 **/

/* internal
 * Deflate.chunks -> Array
 *
 * Chunks of output data, if [[Deflate#onData]] not overridden.
 **/

/**
 * Deflate.result -> Uint8Array|Array
 *
 * Compressed result, generated by default [[Deflate#onData]]
 * and [[Deflate#onEnd]] handlers. Filled after you push last chunk
 * (call [[Deflate#push]] with `Z_FINISH` / `true` param)  or if you
 * push a chunk with explicit flush (call [[Deflate#push]] with
 * `Z_SYNC_FLUSH` param).
 **/

/**
 * Deflate.err -> Number
 *
 * Error code after deflate finished. 0 (Z_OK) on success.
 * You will not need it in real life, because deflate errors
 * are possible only on wrong options or bad `onData` / `onEnd`
 * custom handlers.
 **/

/**
 * Deflate.msg -> String
 *
 * Error message, if [[Deflate.err]] != 0
 **/

/**
 * new Deflate(options)
 * - options (Object): zlib deflate options.
 *
 * Creates new deflator instance with specified params. Throws exception
 * on bad params. Supported options:
 *
 * - `level`
 * - `windowBits`
 * - `memLevel`
 * - `strategy`
 * - `dictionary`
 *
 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
 * for more information on these.
 *
 * Additional options, for internal needs:
 *
 * - `chunkSize` - size of generated data chunks (16K by default)
 * - `raw` (Boolean) - do raw deflate
 * - `gzip` (Boolean) - create gzip wrapper
 * - `to` (String) - if equal to 'string', then result will be "binary string"
 *    (each char code [0..255])
 * - `header` (Object) - custom header for gzip
 *   - `text` (Boolean) - true if compressed data believed to be text
 *   - `time` (Number) - modification time, unix timestamp
 *   - `os` (Number) - operation system code
 *   - `extra` (Array) - array of bytes with extra data (max 65536)
 *   - `name` (String) - file name (binary string)
 *   - `comment` (String) - comment (binary string)
 *   - `hcrc` (Boolean) - true if header crc should be added
 *
 * ##### Example:
 *
 * ```javascript
 * var pako = require('pako')
 *   , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])
 *   , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);
 *
 * var deflate = new pako.Deflate({ level: 3});
 *
 * deflate.push(chunk1, false);
 * deflate.push(chunk2, true);  // true -> last chunk
 *
 * if (deflate.err) { throw new Error(deflate.err); }
 *
 * console.log(deflate.result);
 * ```
 **/
function Deflate(options) {
  if (!(this instanceof Deflate)) return new Deflate(options);

  this.options = utils.assign({
    level: Z_DEFAULT_COMPRESSION,
    method: Z_DEFLATED,
    chunkSize: 16384,
    windowBits: 15,
    memLevel: 8,
    strategy: Z_DEFAULT_STRATEGY,
    to: ''
  }, options || {});

  var opt = this.options;

  if (opt.raw && opt.windowBits > 0) {
    opt.windowBits = -opt.windowBits;
  } else if (opt.gzip && opt.windowBits > 0 && opt.windowBits < 16) {
    opt.windowBits += 16;
  }

  this.err = 0; // error code, if happens (0 = Z_OK)
  this.msg = ''; // error message
  this.ended = false; // used to avoid multiple onEnd() calls
  this.chunks = []; // chunks of compressed data

  this.strm = new ZStream();
  this.strm.avail_out = 0;

  var status = zlib_deflate.deflateInit2(this.strm, opt.level, opt.method, opt.windowBits, opt.memLevel, opt.strategy);

  if (status !== Z_OK) {
    throw new Error(msg[status]);
  }

  if (opt.header) {
    zlib_deflate.deflateSetHeader(this.strm, opt.header);
  }

  if (opt.dictionary) {
    var dict;
    // Convert data if needed
    if (typeof opt.dictionary === 'string') {
      // If we need to compress text, change encoding to utf8.
      dict = strings.string2buf(opt.dictionary);
    } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {
      dict = new Uint8Array(opt.dictionary);
    } else {
      dict = opt.dictionary;
    }

    status = zlib_deflate.deflateSetDictionary(this.strm, dict);

    if (status !== Z_OK) {
      throw new Error(msg[status]);
    }

    this._dict_set = true;
  }
}

/**
 * Deflate#push(data[, mode]) -> Boolean
 * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be
 *   converted to utf8 byte sequence.
 * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.
 *   See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.
 *
 * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with
 * new compressed chunks. Returns `true` on success. The last data block must have
 * mode Z_FINISH (or `true`). That will flush internal pending buffers and call
 * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you
 * can use mode Z_SYNC_FLUSH, keeping the compression context.
 *
 * On fail call [[Deflate#onEnd]] with error code and return false.
 *
 * We strongly recommend to use `Uint8Array` on input for best speed (output
 * array format is detected automatically). Also, don't skip last param and always
 * use the same type in your code (boolean or number). That will improve JS speed.
 *
 * For regular `Array`-s make sure all elements are [0..255].
 *
 * ##### Example
 *
 * ```javascript
 * push(chunk, false); // push one of data chunks
 * ...
 * push(chunk, true);  // push last chunk
 * ```
 **/
Deflate.prototype.push = function (data, mode) {
  var strm = this.strm;
  var chunkSize = this.options.chunkSize;
  var status, _mode;

  if (this.ended) {
    return false;
  }

  _mode = mode === ~~mode ? mode : mode === true ? Z_FINISH : Z_NO_FLUSH;

  // Convert data if needed
  if (typeof data === 'string') {
    // If we need to compress text, change encoding to utf8.
    strm.input = strings.string2buf(data);
  } else if (toString.call(data) === '[object ArrayBuffer]') {
    strm.input = new Uint8Array(data);
  } else {
    strm.input = data;
  }

  strm.next_in = 0;
  strm.avail_in = strm.input.length;

  do {
    if (strm.avail_out === 0) {
      strm.output = new utils.Buf8(chunkSize);
      strm.next_out = 0;
      strm.avail_out = chunkSize;
    }
    status = zlib_deflate.deflate(strm, _mode); /* no bad return value */

    if (status !== Z_STREAM_END && status !== Z_OK) {
      this.onEnd(status);
      this.ended = true;
      return false;
    }
    if (strm.avail_out === 0 || strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH)) {
      if (this.options.to === 'string') {
        this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));
      } else {
        this.onData(utils.shrinkBuf(strm.output, strm.next_out));
      }
    }
  } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);

  // Finalize on the last chunk.
  if (_mode === Z_FINISH) {
    status = zlib_deflate.deflateEnd(this.strm);
    this.onEnd(status);
    this.ended = true;
    return status === Z_OK;
  }

  // callback interim results if Z_SYNC_FLUSH.
  if (_mode === Z_SYNC_FLUSH) {
    this.onEnd(Z_OK);
    strm.avail_out = 0;
    return true;
  }

  return true;
};

/**
 * Deflate#onData(chunk) -> Void
 * - chunk (Uint8Array|Array|String): output data. Type of array depends
 *   on js engine support. When string output requested, each chunk
 *   will be string.
 *
 * By default, stores data blocks in `chunks[]` property and glue
 * those in `onEnd`. Override this handler, if you need another behaviour.
 **/
Deflate.prototype.onData = function (chunk) {
  this.chunks.push(chunk);
};

/**
 * Deflate#onEnd(status) -> Void
 * - status (Number): deflate status. 0 (Z_OK) on success,
 *   other if not.
 *
 * Called once after you tell deflate that the input stream is
 * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
 * or if an error happened. By default - join collected chunks,
 * free memory and fill `results` / `err` properties.
 **/
Deflate.prototype.onEnd = function (status) {
  // On success - join
  if (status === Z_OK) {
    if (this.options.to === 'string') {
      this.result = this.chunks.join('');
    } else {
      this.result = utils.flattenChunks(this.chunks);
    }
  }
  this.chunks = [];
  this.err = status;
  this.msg = this.strm.msg;
};

/**
 * deflate(data[, options]) -> Uint8Array|Array|String
 * - data (Uint8Array|Array|String): input data to compress.
 * - options (Object): zlib deflate options.
 *
 * Compress `data` with deflate algorithm and `options`.
 *
 * Supported options are:
 *
 * - level
 * - windowBits
 * - memLevel
 * - strategy
 * - dictionary
 *
 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
 * for more information on these.
 *
 * Sugar (options):
 *
 * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
 *   negative windowBits implicitly.
 * - `to` (String) - if equal to 'string', then result will be "binary string"
 *    (each char code [0..255])
 *
 * ##### Example:
 *
 * ```javascript
 * var pako = require('pako')
 *   , data = Uint8Array([1,2,3,4,5,6,7,8,9]);
 *
 * console.log(pako.deflate(data));
 * ```
 **/
function deflate(input, options) {
  var deflator = new Deflate(options);

  deflator.push(input, true);

  // That will never happens, if you don't cheat with options :)
  if (deflator.err) {
    throw deflator.msg || msg[deflator.err];
  }

  return deflator.result;
}

/**
 * deflateRaw(data[, options]) -> Uint8Array|Array|String
 * - data (Uint8Array|Array|String): input data to compress.
 * - options (Object): zlib deflate options.
 *
 * The same as [[deflate]], but creates raw data, without wrapper
 * (header and adler32 crc).
 **/
function deflateRaw(input, options) {
  options = options || {};
  options.raw = true;
  return deflate(input, options);
}

/**
 * gzip(data[, options]) -> Uint8Array|Array|String
 * - data (Uint8Array|Array|String): input data to compress.
 * - options (Object): zlib deflate options.
 *
 * The same as [[deflate]], but create gzip wrapper instead of
 * deflate one.
 **/
function gzip(input, options) {
  options = options || {};
  options.gzip = true;
  return deflate(input, options);
}

exports.Deflate = Deflate;
exports.deflate = deflate;
exports.deflateRaw = deflateRaw;
exports.gzip = gzip;

/***/ }),
/* 457 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// (C) 1995-2013 Jean-loup Gailly and Mark Adler
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//   claim that you wrote the original software. If you use this software
//   in a product, an acknowledgment in the product documentation would be
//   appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
//   misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.

var utils = __webpack_require__(42);
var trees = __webpack_require__(458);
var adler32 = __webpack_require__(194);
var crc32 = __webpack_require__(195);
var msg = __webpack_require__(134);

/* Public constants ==========================================================*/
/* ===========================================================================*/

/* Allowed flush values; see deflate() and inflate() below for details */
var Z_NO_FLUSH = 0;
var Z_PARTIAL_FLUSH = 1;
//var Z_SYNC_FLUSH    = 2;
var Z_FULL_FLUSH = 3;
var Z_FINISH = 4;
var Z_BLOCK = 5;
//var Z_TREES         = 6;


/* Return codes for the compression/decompression functions. Negative values
 * are errors, positive values are used for special but normal events.
 */
var Z_OK = 0;
var Z_STREAM_END = 1;
//var Z_NEED_DICT     = 2;
//var Z_ERRNO         = -1;
var Z_STREAM_ERROR = -2;
var Z_DATA_ERROR = -3;
//var Z_MEM_ERROR     = -4;
var Z_BUF_ERROR = -5;
//var Z_VERSION_ERROR = -6;


/* compression levels */
//var Z_NO_COMPRESSION      = 0;
//var Z_BEST_SPEED          = 1;
//var Z_BEST_COMPRESSION    = 9;
var Z_DEFAULT_COMPRESSION = -1;

var Z_FILTERED = 1;
var Z_HUFFMAN_ONLY = 2;
var Z_RLE = 3;
var Z_FIXED = 4;
var Z_DEFAULT_STRATEGY = 0;

/* Possible values of the data_type field (though see inflate()) */
//var Z_BINARY              = 0;
//var Z_TEXT                = 1;
//var Z_ASCII               = 1; // = Z_TEXT
var Z_UNKNOWN = 2;

/* The deflate compression method */
var Z_DEFLATED = 8;

/*============================================================================*/

var MAX_MEM_LEVEL = 9;
/* Maximum value for memLevel in deflateInit2 */
var MAX_WBITS = 15;
/* 32K LZ77 window */
var DEF_MEM_LEVEL = 8;

var LENGTH_CODES = 29;
/* number of length codes, not counting the special END_BLOCK code */
var LITERALS = 256;
/* number of literal bytes 0..255 */
var L_CODES = LITERALS + 1 + LENGTH_CODES;
/* number of Literal or Length codes, including the END_BLOCK code */
var D_CODES = 30;
/* number of distance codes */
var BL_CODES = 19;
/* number of codes used to transfer the bit lengths */
var HEAP_SIZE = 2 * L_CODES + 1;
/* maximum heap size */
var MAX_BITS = 15;
/* All codes must not exceed MAX_BITS bits */

var MIN_MATCH = 3;
var MAX_MATCH = 258;
var MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1;

var PRESET_DICT = 0x20;

var INIT_STATE = 42;
var EXTRA_STATE = 69;
var NAME_STATE = 73;
var COMMENT_STATE = 91;
var HCRC_STATE = 103;
var BUSY_STATE = 113;
var FINISH_STATE = 666;

var BS_NEED_MORE = 1; /* block not completed, need more input or more output */
var BS_BLOCK_DONE = 2; /* block flush performed */
var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */
var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */

var OS_CODE = 0x03; // Unix :) . Don't detect, use this default.

function err(strm, errorCode) {
  strm.msg = msg[errorCode];
  return errorCode;
}

function rank(f) {
  return (f << 1) - (f > 4 ? 9 : 0);
}

function zero(buf) {
  var len = buf.length;while (--len >= 0) {
    buf[len] = 0;
  }
}

/* =========================================================================
 * Flush as much pending output as possible. All deflate() output goes
 * through this function so some applications may wish to modify it
 * to avoid allocating a large strm->output buffer and copying into it.
 * (See also read_buf()).
 */
function flush_pending(strm) {
  var s = strm.state;

  //_tr_flush_bits(s);
  var len = s.pending;
  if (len > strm.avail_out) {
    len = strm.avail_out;
  }
  if (len === 0) {
    return;
  }

  utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);
  strm.next_out += len;
  s.pending_out += len;
  strm.total_out += len;
  strm.avail_out -= len;
  s.pending -= len;
  if (s.pending === 0) {
    s.pending_out = 0;
  }
}

function flush_block_only(s, last) {
  trees._tr_flush_block(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last);
  s.block_start = s.strstart;
  flush_pending(s.strm);
}

function put_byte(s, b) {
  s.pending_buf[s.pending++] = b;
}

/* =========================================================================
 * Put a short in the pending buffer. The 16-bit value is put in MSB order.
 * IN assertion: the stream state is correct and there is enough room in
 * pending_buf.
 */
function putShortMSB(s, b) {
  //  put_byte(s, (Byte)(b >> 8));
  //  put_byte(s, (Byte)(b & 0xff));
  s.pending_buf[s.pending++] = b >>> 8 & 0xff;
  s.pending_buf[s.pending++] = b & 0xff;
}

/* ===========================================================================
 * Read a new buffer from the current input stream, update the adler32
 * and total number of bytes read.  All deflate() input goes through
 * this function so some applications may wish to modify it to avoid
 * allocating a large strm->input buffer and copying from it.
 * (See also flush_pending()).
 */
function read_buf(strm, buf, start, size) {
  var len = strm.avail_in;

  if (len > size) {
    len = size;
  }
  if (len === 0) {
    return 0;
  }

  strm.avail_in -= len;

  // zmemcpy(buf, strm->next_in, len);
  utils.arraySet(buf, strm.input, strm.next_in, len, start);
  if (strm.state.wrap === 1) {
    strm.adler = adler32(strm.adler, buf, len, start);
  } else if (strm.state.wrap === 2) {
    strm.adler = crc32(strm.adler, buf, len, start);
  }

  strm.next_in += len;
  strm.total_in += len;

  return len;
}

/* ===========================================================================
 * Set match_start to the longest match starting at the given string and
 * return its length. Matches shorter or equal to prev_length are discarded,
 * in which case the result is equal to prev_length and match_start is
 * garbage.
 * IN assertions: cur_match is the head of the hash chain for the current
 *   string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
 * OUT assertion: the match length is not greater than s->lookahead.
 */
function longest_match(s, cur_match) {
  var chain_length = s.max_chain_length; /* max hash chain length */
  var scan = s.strstart; /* current string */
  var match; /* matched string */
  var len; /* length of current match */
  var best_len = s.prev_length; /* best match length so far */
  var nice_match = s.nice_match; /* stop if match long enough */
  var limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0 /*NIL*/;

  var _win = s.window; // shortcut

  var wmask = s.w_mask;
  var prev = s.prev;

  /* Stop when cur_match becomes <= limit. To simplify the code,
   * we prevent matches with the string of window index 0.
   */

  var strend = s.strstart + MAX_MATCH;
  var scan_end1 = _win[scan + best_len - 1];
  var scan_end = _win[scan + best_len];

  /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
   * It is easy to get rid of this optimization if necessary.
   */
  // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");

  /* Do not waste too much time if we already have a good match: */
  if (s.prev_length >= s.good_match) {
    chain_length >>= 2;
  }
  /* Do not look for matches beyond the end of the input. This is necessary
   * to make deflate deterministic.
   */
  if (nice_match > s.lookahead) {
    nice_match = s.lookahead;
  }

  // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");

  do {
    // Assert(cur_match < s->strstart, "no future");
    match = cur_match;

    /* Skip to next match if the match length cannot increase
     * or if the match length is less than 2.  Note that the checks below
     * for insufficient lookahead only occur occasionally for performance
     * reasons.  Therefore uninitialized memory will be accessed, and
     * conditional jumps will be made that depend on those values.
     * However the length of the match is limited to the lookahead, so
     * the output of deflate is not affected by the uninitialized values.
     */

    if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) {
      continue;
    }

    /* The check at best_len-1 can be removed because it will be made
     * again later. (This heuristic is not always a win.)
     * It is not necessary to compare scan[2] and match[2] since they
     * are always equal when the other bytes match, given that
     * the hash keys are equal and that HASH_BITS >= 8.
     */
    scan += 2;
    match++;
    // Assert(*scan == *match, "match[2]?");

    /* We check for insufficient lookahead only every 8th comparison;
     * the 256th check will be made at strstart+258.
     */
    do {
      /*jshint noempty:false*/
    } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend);

    // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");

    len = MAX_MATCH - (strend - scan);
    scan = strend - MAX_MATCH;

    if (len > best_len) {
      s.match_start = cur_match;
      best_len = len;
      if (len >= nice_match) {
        break;
      }
      scan_end1 = _win[scan + best_len - 1];
      scan_end = _win[scan + best_len];
    }
  } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);

  if (best_len <= s.lookahead) {
    return best_len;
  }
  return s.lookahead;
}

/* ===========================================================================
 * Fill the window when the lookahead becomes insufficient.
 * Updates strstart and lookahead.
 *
 * IN assertion: lookahead < MIN_LOOKAHEAD
 * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
 *    At least one byte has been read, or avail_in == 0; reads are
 *    performed for at least two bytes (required for the zip translate_eol
 *    option -- not supported here).
 */
function fill_window(s) {
  var _w_size = s.w_size;
  var p, n, m, more, str;

  //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");

  do {
    more = s.window_size - s.lookahead - s.strstart;

    // JS ints have 32 bit, block below not needed
    /* Deal with !@#$% 64K limit: */
    //if (sizeof(int) <= 2) {
    //    if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
    //        more = wsize;
    //
    //  } else if (more == (unsigned)(-1)) {
    //        /* Very unlikely, but possible on 16 bit machine if
    //         * strstart == 0 && lookahead == 1 (input done a byte at time)
    //         */
    //        more--;
    //    }
    //}


    /* If the window is almost full and there is insufficient lookahead,
     * move the upper half to the lower one to make room in the upper half.
     */
    if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {

      utils.arraySet(s.window, s.window, _w_size, _w_size, 0);
      s.match_start -= _w_size;
      s.strstart -= _w_size;
      /* we now have strstart >= MAX_DIST */
      s.block_start -= _w_size;

      /* Slide the hash table (could be avoided with 32 bit values
       at the expense of memory usage). We slide even when level == 0
       to keep the hash table consistent if we switch back to level > 0
       later. (Using level 0 permanently is not an optimal usage of
       zlib, so we don't care about this pathological case.)
       */

      n = s.hash_size;
      p = n;
      do {
        m = s.head[--p];
        s.head[p] = m >= _w_size ? m - _w_size : 0;
      } while (--n);

      n = _w_size;
      p = n;
      do {
        m = s.prev[--p];
        s.prev[p] = m >= _w_size ? m - _w_size : 0;
        /* If n is not on any hash chain, prev[n] is garbage but
         * its value will never be used.
         */
      } while (--n);

      more += _w_size;
    }
    if (s.strm.avail_in === 0) {
      break;
    }

    /* If there was no sliding:
     *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
     *    more == window_size - lookahead - strstart
     * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
     * => more >= window_size - 2*WSIZE + 2
     * In the BIG_MEM or MMAP case (not yet supported),
     *   window_size == input_size + MIN_LOOKAHEAD  &&
     *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
     * Otherwise, window_size == 2*WSIZE so more >= 2.
     * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
     */
    //Assert(more >= 2, "more < 2");
    n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);
    s.lookahead += n;

    /* Initialize the hash value now that we have some input: */
    if (s.lookahead + s.insert >= MIN_MATCH) {
      str = s.strstart - s.insert;
      s.ins_h = s.window[str];

      /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */
      s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + 1]) & s.hash_mask;
      //#if MIN_MATCH != 3
      //        Call update_hash() MIN_MATCH-3 more times
      //#endif
      while (s.insert) {
        /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
        s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;

        s.prev[str & s.w_mask] = s.head[s.ins_h];
        s.head[s.ins_h] = str;
        str++;
        s.insert--;
        if (s.lookahead + s.insert < MIN_MATCH) {
          break;
        }
      }
    }
    /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
     * but this is not important since only literal bytes will be emitted.
     */
  } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);

  /* If the WIN_INIT bytes after the end of the current data have never been
   * written, then zero those bytes in order to avoid memory check reports of
   * the use of uninitialized (or uninitialised as Julian writes) bytes by
   * the longest match routines.  Update the high water mark for the next
   * time through here.  WIN_INIT is set to MAX_MATCH since the longest match
   * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
   */
  //  if (s.high_water < s.window_size) {
  //    var curr = s.strstart + s.lookahead;
  //    var init = 0;
  //
  //    if (s.high_water < curr) {
  //      /* Previous high water mark below current data -- zero WIN_INIT
  //       * bytes or up to end of window, whichever is less.
  //       */
  //      init = s.window_size - curr;
  //      if (init > WIN_INIT)
  //        init = WIN_INIT;
  //      zmemzero(s->window + curr, (unsigned)init);
  //      s->high_water = curr + init;
  //    }
  //    else if (s->high_water < (ulg)curr + WIN_INIT) {
  //      /* High water mark at or above current data, but below current data
  //       * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
  //       * to end of window, whichever is less.
  //       */
  //      init = (ulg)curr + WIN_INIT - s->high_water;
  //      if (init > s->window_size - s->high_water)
  //        init = s->window_size - s->high_water;
  //      zmemzero(s->window + s->high_water, (unsigned)init);
  //      s->high_water += init;
  //    }
  //  }
  //
  //  Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
  //    "not enough room for search");
}

/* ===========================================================================
 * Copy without compression as much as possible from the input stream, return
 * the current block state.
 * This function does not insert new strings in the dictionary since
 * uncompressible data is probably not useful. This function is used
 * only for the level=0 compression option.
 * NOTE: this function should be optimized to avoid extra copying from
 * window to pending_buf.
 */
function deflate_stored(s, flush) {
  /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
   * to pending_buf_size, and each stored block has a 5 byte header:
   */
  var max_block_size = 0xffff;

  if (max_block_size > s.pending_buf_size - 5) {
    max_block_size = s.pending_buf_size - 5;
  }

  /* Copy as much as possible from input to output: */
  for (;;) {
    /* Fill the window as much as possible: */
    if (s.lookahead <= 1) {

      //Assert(s->strstart < s->w_size+MAX_DIST(s) ||
      //  s->block_start >= (long)s->w_size, "slide too late");
      //      if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||
      //        s.block_start >= s.w_size)) {
      //        throw  new Error("slide too late");
      //      }

      fill_window(s);
      if (s.lookahead === 0 && flush === Z_NO_FLUSH) {
        return BS_NEED_MORE;
      }

      if (s.lookahead === 0) {
        break;
      }
      /* flush the current block */
    }
    //Assert(s->block_start >= 0L, "block gone");
    //    if (s.block_start < 0) throw new Error("block gone");

    s.strstart += s.lookahead;
    s.lookahead = 0;

    /* Emit a stored block if pending_buf will be full: */
    var max_start = s.block_start + max_block_size;

    if (s.strstart === 0 || s.strstart >= max_start) {
      /* strstart == 0 is possible when wraparound on 16-bit machine */
      s.lookahead = s.strstart - max_start;
      s.strstart = max_start;
      /*** FLUSH_BLOCK(s, 0); ***/
      flush_block_only(s, false);
      if (s.strm.avail_out === 0) {
        return BS_NEED_MORE;
      }
      /***/
    }
    /* Flush if we may have to slide, otherwise block_start may become
     * negative and the data will be gone:
     */
    if (s.strstart - s.block_start >= s.w_size - MIN_LOOKAHEAD) {
      /*** FLUSH_BLOCK(s, 0); ***/
      flush_block_only(s, false);
      if (s.strm.avail_out === 0) {
        return BS_NEED_MORE;
      }
      /***/
    }
  }

  s.insert = 0;

  if (flush === Z_FINISH) {
    /*** FLUSH_BLOCK(s, 1); ***/
    flush_block_only(s, true);
    if (s.strm.avail_out === 0) {
      return BS_FINISH_STARTED;
    }
    /***/
    return BS_FINISH_DONE;
  }

  if (s.strstart > s.block_start) {
    /*** FLUSH_BLOCK(s, 0); ***/
    flush_block_only(s, false);
    if (s.strm.avail_out === 0) {
      return BS_NEED_MORE;
    }
    /***/
  }

  return BS_NEED_MORE;
}

/* ===========================================================================
 * Compress as much as possible from the input stream, return the current
 * block state.
 * This function does not perform lazy evaluation of matches and inserts
 * new strings in the dictionary only for unmatched strings or for short
 * matches. It is used only for the fast compression options.
 */
function deflate_fast(s, flush) {
  var hash_head; /* head of the hash chain */
  var bflush; /* set if current block must be flushed */

  for (;;) {
    /* Make sure that we always have enough lookahead, except
     * at the end of the input file. We need MAX_MATCH bytes
     * for the next match, plus MIN_MATCH bytes to insert the
     * string following the next match.
     */
    if (s.lookahead < MIN_LOOKAHEAD) {
      fill_window(s);
      if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
        return BS_NEED_MORE;
      }
      if (s.lookahead === 0) {
        break; /* flush the current block */
      }
    }

    /* Insert the string window[strstart .. strstart+2] in the
     * dictionary, and set hash_head to the head of the hash chain:
     */
    hash_head = 0 /*NIL*/;
    if (s.lookahead >= MIN_MATCH) {
      /*** INSERT_STRING(s, s.strstart, hash_head); ***/
      s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
      hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
      s.head[s.ins_h] = s.strstart;
      /***/
    }

    /* Find the longest match, discarding those <= prev_length.
     * At this point we have always match_length < MIN_MATCH
     */
    if (hash_head !== 0 /*NIL*/ && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) {
      /* To simplify the code, we prevent matches with the string
       * of window index 0 (in particular we have to avoid a match
       * of the string with itself at the start of the input file).
       */
      s.match_length = longest_match(s, hash_head);
      /* longest_match() sets match_start */
    }
    if (s.match_length >= MIN_MATCH) {
      // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only

      /*** _tr_tally_dist(s, s.strstart - s.match_start,
                     s.match_length - MIN_MATCH, bflush); ***/
      bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);

      s.lookahead -= s.match_length;

      /* Insert new strings in the hash table only if the match length
       * is not too large. This saves time but degrades compression.
       */
      if (s.match_length <= s.max_lazy_match /*max_insert_length*/ && s.lookahead >= MIN_MATCH) {
        s.match_length--; /* string at strstart already in table */
        do {
          s.strstart++;
          /*** INSERT_STRING(s, s.strstart, hash_head); ***/
          s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
          hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
          s.head[s.ins_h] = s.strstart;
          /***/
          /* strstart never exceeds WSIZE-MAX_MATCH, so there are
           * always MIN_MATCH bytes ahead.
           */
        } while (--s.match_length !== 0);
        s.strstart++;
      } else {
        s.strstart += s.match_length;
        s.match_length = 0;
        s.ins_h = s.window[s.strstart];
        /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */
        s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + 1]) & s.hash_mask;

        //#if MIN_MATCH != 3
        //                Call UPDATE_HASH() MIN_MATCH-3 more times
        //#endif
        /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
         * matter since it will be recomputed at next deflate call.
         */
      }
    } else {
      /* No match, output a literal byte */
      //Tracevv((stderr,"%c", s.window[s.strstart]));
      /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
      bflush = trees._tr_tally(s, 0, s.window[s.strstart]);

      s.lookahead--;
      s.strstart++;
    }
    if (bflush) {
      /*** FLUSH_BLOCK(s, 0); ***/
      flush_block_only(s, false);
      if (s.strm.avail_out === 0) {
        return BS_NEED_MORE;
      }
      /***/
    }
  }
  s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;
  if (flush === Z_FINISH) {
    /*** FLUSH_BLOCK(s, 1); ***/
    flush_block_only(s, true);
    if (s.strm.avail_out === 0) {
      return BS_FINISH_STARTED;
    }
    /***/
    return BS_FINISH_DONE;
  }
  if (s.last_lit) {
    /*** FLUSH_BLOCK(s, 0); ***/
    flush_block_only(s, false);
    if (s.strm.avail_out === 0) {
      return BS_NEED_MORE;
    }
    /***/
  }
  return BS_BLOCK_DONE;
}

/* ===========================================================================
 * Same as above, but achieves better compression. We use a lazy
 * evaluation for matches: a match is finally adopted only if there is
 * no better match at the next window position.
 */
function deflate_slow(s, flush) {
  var hash_head; /* head of hash chain */
  var bflush; /* set if current block must be flushed */

  var max_insert;

  /* Process the input block. */
  for (;;) {
    /* Make sure that we always have enough lookahead, except
     * at the end of the input file. We need MAX_MATCH bytes
     * for the next match, plus MIN_MATCH bytes to insert the
     * string following the next match.
     */
    if (s.lookahead < MIN_LOOKAHEAD) {
      fill_window(s);
      if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
        return BS_NEED_MORE;
      }
      if (s.lookahead === 0) {
        break;
      } /* flush the current block */
    }

    /* Insert the string window[strstart .. strstart+2] in the
     * dictionary, and set hash_head to the head of the hash chain:
     */
    hash_head = 0 /*NIL*/;
    if (s.lookahead >= MIN_MATCH) {
      /*** INSERT_STRING(s, s.strstart, hash_head); ***/
      s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
      hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
      s.head[s.ins_h] = s.strstart;
      /***/
    }

    /* Find the longest match, discarding those <= prev_length.
     */
    s.prev_length = s.match_length;
    s.prev_match = s.match_start;
    s.match_length = MIN_MATCH - 1;

    if (hash_head !== 0 /*NIL*/ && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD /*MAX_DIST(s)*/) {
        /* To simplify the code, we prevent matches with the string
         * of window index 0 (in particular we have to avoid a match
         * of the string with itself at the start of the input file).
         */
        s.match_length = longest_match(s, hash_head);
        /* longest_match() sets match_start */

        if (s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096 /*TOO_FAR*/)) {

          /* If prev_match is also MIN_MATCH, match_start is garbage
           * but we will ignore the current match anyway.
           */
          s.match_length = MIN_MATCH - 1;
        }
      }
    /* If there was a match at the previous step and the current
     * match is not better, output the previous match:
     */
    if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {
      max_insert = s.strstart + s.lookahead - MIN_MATCH;
      /* Do not insert strings in hash table beyond this. */

      //check_match(s, s.strstart-1, s.prev_match, s.prev_length);

      /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,
                     s.prev_length - MIN_MATCH, bflush);***/
      bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);
      /* Insert in hash table all strings up to the end of the match.
       * strstart-1 and strstart are already inserted. If there is not
       * enough lookahead, the last two strings are not inserted in
       * the hash table.
       */
      s.lookahead -= s.prev_length - 1;
      s.prev_length -= 2;
      do {
        if (++s.strstart <= max_insert) {
          /*** INSERT_STRING(s, s.strstart, hash_head); ***/
          s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
          hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
          s.head[s.ins_h] = s.strstart;
          /***/
        }
      } while (--s.prev_length !== 0);
      s.match_available = 0;
      s.match_length = MIN_MATCH - 1;
      s.strstart++;

      if (bflush) {
        /*** FLUSH_BLOCK(s, 0); ***/
        flush_block_only(s, false);
        if (s.strm.avail_out === 0) {
          return BS_NEED_MORE;
        }
        /***/
      }
    } else if (s.match_available) {
      /* If there was no match at the previous position, output a
       * single literal. If there was a match but the current match
       * is longer, truncate the previous match to a single literal.
       */
      //Tracevv((stderr,"%c", s->window[s->strstart-1]));
      /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
      bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);

      if (bflush) {
        /*** FLUSH_BLOCK_ONLY(s, 0) ***/
        flush_block_only(s, false);
        /***/
      }
      s.strstart++;
      s.lookahead--;
      if (s.strm.avail_out === 0) {
        return BS_NEED_MORE;
      }
    } else {
      /* There is no previous match to compare with, wait for
       * the next step to decide.
       */
      s.match_available = 1;
      s.strstart++;
      s.lookahead--;
    }
  }
  //Assert (flush != Z_NO_FLUSH, "no flush?");
  if (s.match_available) {
    //Tracevv((stderr,"%c", s->window[s->strstart-1]));
    /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
    bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);

    s.match_available = 0;
  }
  s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;
  if (flush === Z_FINISH) {
    /*** FLUSH_BLOCK(s, 1); ***/
    flush_block_only(s, true);
    if (s.strm.avail_out === 0) {
      return BS_FINISH_STARTED;
    }
    /***/
    return BS_FINISH_DONE;
  }
  if (s.last_lit) {
    /*** FLUSH_BLOCK(s, 0); ***/
    flush_block_only(s, false);
    if (s.strm.avail_out === 0) {
      return BS_NEED_MORE;
    }
    /***/
  }

  return BS_BLOCK_DONE;
}

/* ===========================================================================
 * For Z_RLE, simply look for runs of bytes, generate matches only of distance
 * one.  Do not maintain a hash table.  (It will be regenerated if this run of
 * deflate switches away from Z_RLE.)
 */
function deflate_rle(s, flush) {
  var bflush; /* set if current block must be flushed */
  var prev; /* byte at distance one to match */
  var scan, strend; /* scan goes up to strend for length of run */

  var _win = s.window;

  for (;;) {
    /* Make sure that we always have enough lookahead, except
     * at the end of the input file. We need MAX_MATCH bytes
     * for the longest run, plus one for the unrolled loop.
     */
    if (s.lookahead <= MAX_MATCH) {
      fill_window(s);
      if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {
        return BS_NEED_MORE;
      }
      if (s.lookahead === 0) {
        break;
      } /* flush the current block */
    }

    /* See how many times the previous byte repeats */
    s.match_length = 0;
    if (s.lookahead >= MIN_MATCH && s.strstart > 0) {
      scan = s.strstart - 1;
      prev = _win[scan];
      if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
        strend = s.strstart + MAX_MATCH;
        do {
          /*jshint noempty:false*/
        } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend);
        s.match_length = MAX_MATCH - (strend - scan);
        if (s.match_length > s.lookahead) {
          s.match_length = s.lookahead;
        }
      }
      //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
    }

    /* Emit match if have run of MIN_MATCH or longer, else emit literal */
    if (s.match_length >= MIN_MATCH) {
      //check_match(s, s.strstart, s.strstart - 1, s.match_length);

      /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/
      bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);

      s.lookahead -= s.match_length;
      s.strstart += s.match_length;
      s.match_length = 0;
    } else {
      /* No match, output a literal byte */
      //Tracevv((stderr,"%c", s->window[s->strstart]));
      /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
      bflush = trees._tr_tally(s, 0, s.window[s.strstart]);

      s.lookahead--;
      s.strstart++;
    }
    if (bflush) {
      /*** FLUSH_BLOCK(s, 0); ***/
      flush_block_only(s, false);
      if (s.strm.avail_out === 0) {
        return BS_NEED_MORE;
      }
      /***/
    }
  }
  s.insert = 0;
  if (flush === Z_FINISH) {
    /*** FLUSH_BLOCK(s, 1); ***/
    flush_block_only(s, true);
    if (s.strm.avail_out === 0) {
      return BS_FINISH_STARTED;
    }
    /***/
    return BS_FINISH_DONE;
  }
  if (s.last_lit) {
    /*** FLUSH_BLOCK(s, 0); ***/
    flush_block_only(s, false);
    if (s.strm.avail_out === 0) {
      return BS_NEED_MORE;
    }
    /***/
  }
  return BS_BLOCK_DONE;
}

/* ===========================================================================
 * For Z_HUFFMAN_ONLY, do not look for matches.  Do not maintain a hash table.
 * (It will be regenerated if this run of deflate switches away from Huffman.)
 */
function deflate_huff(s, flush) {
  var bflush; /* set if current block must be flushed */

  for (;;) {
    /* Make sure that we have a literal to write. */
    if (s.lookahead === 0) {
      fill_window(s);
      if (s.lookahead === 0) {
        if (flush === Z_NO_FLUSH) {
          return BS_NEED_MORE;
        }
        break; /* flush the current block */
      }
    }

    /* Output a literal byte */
    s.match_length = 0;
    //Tracevv((stderr,"%c", s->window[s->strstart]));
    /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
    bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
    s.lookahead--;
    s.strstart++;
    if (bflush) {
      /*** FLUSH_BLOCK(s, 0); ***/
      flush_block_only(s, false);
      if (s.strm.avail_out === 0) {
        return BS_NEED_MORE;
      }
      /***/
    }
  }
  s.insert = 0;
  if (flush === Z_FINISH) {
    /*** FLUSH_BLOCK(s, 1); ***/
    flush_block_only(s, true);
    if (s.strm.avail_out === 0) {
      return BS_FINISH_STARTED;
    }
    /***/
    return BS_FINISH_DONE;
  }
  if (s.last_lit) {
    /*** FLUSH_BLOCK(s, 0); ***/
    flush_block_only(s, false);
    if (s.strm.avail_out === 0) {
      return BS_NEED_MORE;
    }
    /***/
  }
  return BS_BLOCK_DONE;
}

/* Values for max_lazy_match, good_match and max_chain_length, depending on
 * the desired pack level (0..9). The values given below have been tuned to
 * exclude worst case performance for pathological files. Better values may be
 * found for specific files.
 */
function Config(good_length, max_lazy, nice_length, max_chain, func) {
  this.good_length = good_length;
  this.max_lazy = max_lazy;
  this.nice_length = nice_length;
  this.max_chain = max_chain;
  this.func = func;
}

var configuration_table;

configuration_table = [
/*      good lazy nice chain */
new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */
new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */
new Config(4, 5, 16, 8, deflate_fast), /* 2 */
new Config(4, 6, 32, 32, deflate_fast), /* 3 */

new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */
new Config(8, 16, 32, 32, deflate_slow), /* 5 */
new Config(8, 16, 128, 128, deflate_slow), /* 6 */
new Config(8, 32, 128, 256, deflate_slow), /* 7 */
new Config(32, 128, 258, 1024, deflate_slow), /* 8 */
new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */
];

/* ===========================================================================
 * Initialize the "longest match" routines for a new zlib stream
 */
function lm_init(s) {
  s.window_size = 2 * s.w_size;

  /*** CLEAR_HASH(s); ***/
  zero(s.head); // Fill with NIL (= 0);

  /* Set the default configuration parameters:
   */
  s.max_lazy_match = configuration_table[s.level].max_lazy;
  s.good_match = configuration_table[s.level].good_length;
  s.nice_match = configuration_table[s.level].nice_length;
  s.max_chain_length = configuration_table[s.level].max_chain;

  s.strstart = 0;
  s.block_start = 0;
  s.lookahead = 0;
  s.insert = 0;
  s.match_length = s.prev_length = MIN_MATCH - 1;
  s.match_available = 0;
  s.ins_h = 0;
}

function DeflateState() {
  this.strm = null; /* pointer back to this zlib stream */
  this.status = 0; /* as the name implies */
  this.pending_buf = null; /* output still pending */
  this.pending_buf_size = 0; /* size of pending_buf */
  this.pending_out = 0; /* next pending byte to output to the stream */
  this.pending = 0; /* nb of bytes in the pending buffer */
  this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
  this.gzhead = null; /* gzip header information to write */
  this.gzindex = 0; /* where in extra, name, or comment */
  this.method = Z_DEFLATED; /* can only be DEFLATED */
  this.last_flush = -1; /* value of flush param for previous deflate call */

  this.w_size = 0; /* LZ77 window size (32K by default) */
  this.w_bits = 0; /* log2(w_size)  (8..16) */
  this.w_mask = 0; /* w_size - 1 */

  this.window = null;
  /* Sliding window. Input bytes are read into the second half of the window,
   * and move to the first half later to keep a dictionary of at least wSize
   * bytes. With this organization, matches are limited to a distance of
   * wSize-MAX_MATCH bytes, but this ensures that IO is always
   * performed with a length multiple of the block size.
   */

  this.window_size = 0;
  /* Actual size of window: 2*wSize, except when the user input buffer
   * is directly used as sliding window.
   */

  this.prev = null;
  /* Link to older string with same hash index. To limit the size of this
   * array to 64K, this link is maintained only for the last 32K strings.
   * An index in this array is thus a window index modulo 32K.
   */

  this.head = null; /* Heads of the hash chains or NIL. */

  this.ins_h = 0; /* hash index of string to be inserted */
  this.hash_size = 0; /* number of elements in hash table */
  this.hash_bits = 0; /* log2(hash_size) */
  this.hash_mask = 0; /* hash_size-1 */

  this.hash_shift = 0;
  /* Number of bits by which ins_h must be shifted at each input
   * step. It must be such that after MIN_MATCH steps, the oldest
   * byte no longer takes part in the hash key, that is:
   *   hash_shift * MIN_MATCH >= hash_bits
   */

  this.block_start = 0;
  /* Window position at the beginning of the current output block. Gets
   * negative when the window is moved backwards.
   */

  this.match_length = 0; /* length of best match */
  this.prev_match = 0; /* previous match */
  this.match_available = 0; /* set if previous match exists */
  this.strstart = 0; /* start of string to insert */
  this.match_start = 0; /* start of matching string */
  this.lookahead = 0; /* number of valid bytes ahead in window */

  this.prev_length = 0;
  /* Length of the best match at previous step. Matches not greater than this
   * are discarded. This is used in the lazy match evaluation.
   */

  this.max_chain_length = 0;
  /* To speed up deflation, hash chains are never searched beyond this
   * length.  A higher limit improves compression ratio but degrades the
   * speed.
   */

  this.max_lazy_match = 0;
  /* Attempt to find a better match only when the current match is strictly
   * smaller than this value. This mechanism is used only for compression
   * levels >= 4.
   */
  // That's alias to max_lazy_match, don't use directly
  //this.max_insert_length = 0;
  /* Insert new strings in the hash table only if the match length is not
   * greater than this length. This saves time but degrades compression.
   * max_insert_length is used only for compression levels <= 3.
   */

  this.level = 0; /* compression level (1..9) */
  this.strategy = 0; /* favor or force Huffman coding*/

  this.good_match = 0;
  /* Use a faster search when the previous match is longer than this */

  this.nice_match = 0; /* Stop searching when current match exceeds this */

  /* used by trees.c: */

  /* Didn't use ct_data typedef below to suppress compiler warning */

  // struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
  // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
  // struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */

  // Use flat array of DOUBLE size, with interleaved fata,
  // because JS does not support effective
  this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);
  this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);
  this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);
  zero(this.dyn_ltree);
  zero(this.dyn_dtree);
  zero(this.bl_tree);

  this.l_desc = null; /* desc. for literal tree */
  this.d_desc = null; /* desc. for distance tree */
  this.bl_desc = null; /* desc. for bit length tree */

  //ush bl_count[MAX_BITS+1];
  this.bl_count = new utils.Buf16(MAX_BITS + 1);
  /* number of codes at each bit length for an optimal tree */

  //int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */
  this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */
  zero(this.heap);

  this.heap_len = 0; /* number of elements in the heap */
  this.heap_max = 0; /* element of largest frequency */
  /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
   * The same heap array is used to build all trees.
   */

  this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];
  zero(this.depth);
  /* Depth of each subtree used as tie breaker for trees of equal frequency
   */

  this.l_buf = 0; /* buffer index for literals or lengths */

  this.lit_bufsize = 0;
  /* Size of match buffer for literals/lengths.  There are 4 reasons for
   * limiting lit_bufsize to 64K:
   *   - frequencies can be kept in 16 bit counters
   *   - if compression is not successful for the first block, all input
   *     data is still in the window so we can still emit a stored block even
   *     when input comes from standard input.  (This can also be done for
   *     all blocks if lit_bufsize is not greater than 32K.)
   *   - if compression is not successful for a file smaller than 64K, we can
   *     even emit a stored file instead of a stored block (saving 5 bytes).
   *     This is applicable only for zip (not gzip or zlib).
   *   - creating new Huffman trees less frequently may not provide fast
   *     adaptation to changes in the input data statistics. (Take for
   *     example a binary file with poorly compressible code followed by
   *     a highly compressible string table.) Smaller buffer sizes give
   *     fast adaptation but have of course the overhead of transmitting
   *     trees more frequently.
   *   - I can't count above 4
   */

  this.last_lit = 0; /* running index in l_buf */

  this.d_buf = 0;
  /* Buffer index for distances. To simplify the code, d_buf and l_buf have
   * the same number of elements. To use different lengths, an extra flag
   * array would be necessary.
   */

  this.opt_len = 0; /* bit length of current block with optimal trees */
  this.static_len = 0; /* bit length of current block with static trees */
  this.matches = 0; /* number of string matches in current block */
  this.insert = 0; /* bytes at end of window left to insert */

  this.bi_buf = 0;
  /* Output buffer. bits are inserted starting at the bottom (least
   * significant bits).
   */
  this.bi_valid = 0;
  /* Number of valid bits in bi_buf.  All bits above the last valid bit
   * are always zero.
   */

  // Used for window memory init. We safely ignore it for JS. That makes
  // sense only for pointers and memory check tools.
  //this.high_water = 0;
  /* High water mark offset in window for initialized bytes -- bytes above
   * this are set to zero in order to avoid memory check warnings when
   * longest match routines access bytes past the input.  This is then
   * updated to the new high water mark.
   */
}

function deflateResetKeep(strm) {
  var s;

  if (!strm || !strm.state) {
    return err(strm, Z_STREAM_ERROR);
  }

  strm.total_in = strm.total_out = 0;
  strm.data_type = Z_UNKNOWN;

  s = strm.state;
  s.pending = 0;
  s.pending_out = 0;

  if (s.wrap < 0) {
    s.wrap = -s.wrap;
    /* was made negative by deflate(..., Z_FINISH); */
  }
  s.status = s.wrap ? INIT_STATE : BUSY_STATE;
  strm.adler = s.wrap === 2 ? 0 // crc32(0, Z_NULL, 0)
  : 1; // adler32(0, Z_NULL, 0)
  s.last_flush = Z_NO_FLUSH;
  trees._tr_init(s);
  return Z_OK;
}

function deflateReset(strm) {
  var ret = deflateResetKeep(strm);
  if (ret === Z_OK) {
    lm_init(strm.state);
  }
  return ret;
}

function deflateSetHeader(strm, head) {
  if (!strm || !strm.state) {
    return Z_STREAM_ERROR;
  }
  if (strm.state.wrap !== 2) {
    return Z_STREAM_ERROR;
  }
  strm.state.gzhead = head;
  return Z_OK;
}

function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
  if (!strm) {
    // === Z_NULL
    return Z_STREAM_ERROR;
  }
  var wrap = 1;

  if (level === Z_DEFAULT_COMPRESSION) {
    level = 6;
  }

  if (windowBits < 0) {
    /* suppress zlib wrapper */
    wrap = 0;
    windowBits = -windowBits;
  } else if (windowBits > 15) {
    wrap = 2; /* write gzip wrapper instead */
    windowBits -= 16;
  }

  if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
    return err(strm, Z_STREAM_ERROR);
  }

  if (windowBits === 8) {
    windowBits = 9;
  }
  /* until 256-byte window bug fixed */

  var s = new DeflateState();

  strm.state = s;
  s.strm = strm;

  s.wrap = wrap;
  s.gzhead = null;
  s.w_bits = windowBits;
  s.w_size = 1 << s.w_bits;
  s.w_mask = s.w_size - 1;

  s.hash_bits = memLevel + 7;
  s.hash_size = 1 << s.hash_bits;
  s.hash_mask = s.hash_size - 1;
  s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);

  s.window = new utils.Buf8(s.w_size * 2);
  s.head = new utils.Buf16(s.hash_size);
  s.prev = new utils.Buf16(s.w_size);

  // Don't need mem init magic for JS.
  //s.high_water = 0;  /* nothing written to s->window yet */

  s.lit_bufsize = 1 << memLevel + 6; /* 16K elements by default */

  s.pending_buf_size = s.lit_bufsize * 4;

  //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
  //s->pending_buf = (uchf *) overlay;
  s.pending_buf = new utils.Buf8(s.pending_buf_size);

  // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)
  //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
  s.d_buf = 1 * s.lit_bufsize;

  //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
  s.l_buf = (1 + 2) * s.lit_bufsize;

  s.level = level;
  s.strategy = strategy;
  s.method = method;

  return deflateReset(strm);
}

function deflateInit(strm, level) {
  return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
}

function deflate(strm, flush) {
  var old_flush, s;
  var beg, val; // for gzip header write only

  if (!strm || !strm.state || flush > Z_BLOCK || flush < 0) {
    return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
  }

  s = strm.state;

  if (!strm.output || !strm.input && strm.avail_in !== 0 || s.status === FINISH_STATE && flush !== Z_FINISH) {
    return err(strm, strm.avail_out === 0 ? Z_BUF_ERROR : Z_STREAM_ERROR);
  }

  s.strm = strm; /* just in case */
  old_flush = s.last_flush;
  s.last_flush = flush;

  /* Write the header */
  if (s.status === INIT_STATE) {

    if (s.wrap === 2) {
      // GZIP header
      strm.adler = 0; //crc32(0L, Z_NULL, 0);
      put_byte(s, 31);
      put_byte(s, 139);
      put_byte(s, 8);
      if (!s.gzhead) {
        // s->gzhead == Z_NULL
        put_byte(s, 0);
        put_byte(s, 0);
        put_byte(s, 0);
        put_byte(s, 0);
        put_byte(s, 0);
        put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0);
        put_byte(s, OS_CODE);
        s.status = BUSY_STATE;
      } else {
        put_byte(s, (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16));
        put_byte(s, s.gzhead.time & 0xff);
        put_byte(s, s.gzhead.time >> 8 & 0xff);
        put_byte(s, s.gzhead.time >> 16 & 0xff);
        put_byte(s, s.gzhead.time >> 24 & 0xff);
        put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0);
        put_byte(s, s.gzhead.os & 0xff);
        if (s.gzhead.extra && s.gzhead.extra.length) {
          put_byte(s, s.gzhead.extra.length & 0xff);
          put_byte(s, s.gzhead.extra.length >> 8 & 0xff);
        }
        if (s.gzhead.hcrc) {
          strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);
        }
        s.gzindex = 0;
        s.status = EXTRA_STATE;
      }
    } else // DEFLATE header
      {
        var header = Z_DEFLATED + (s.w_bits - 8 << 4) << 8;
        var level_flags = -1;

        if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
          level_flags = 0;
        } else if (s.level < 6) {
          level_flags = 1;
        } else if (s.level === 6) {
          level_flags = 2;
        } else {
          level_flags = 3;
        }
        header |= level_flags << 6;
        if (s.strstart !== 0) {
          header |= PRESET_DICT;
        }
        header += 31 - header % 31;

        s.status = BUSY_STATE;
        putShortMSB(s, header);

        /* Save the adler32 of the preset dictionary: */
        if (s.strstart !== 0) {
          putShortMSB(s, strm.adler >>> 16);
          putShortMSB(s, strm.adler & 0xffff);
        }
        strm.adler = 1; // adler32(0L, Z_NULL, 0);
      }
  }

  //#ifdef GZIP
  if (s.status === EXTRA_STATE) {
    if (s.gzhead.extra /* != Z_NULL*/) {
        beg = s.pending; /* start of bytes to update crc */

        while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {
          if (s.pending === s.pending_buf_size) {
            if (s.gzhead.hcrc && s.pending > beg) {
              strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
            }
            flush_pending(strm);
            beg = s.pending;
            if (s.pending === s.pending_buf_size) {
              break;
            }
          }
          put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);
          s.gzindex++;
        }
        if (s.gzhead.hcrc && s.pending > beg) {
          strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
        }
        if (s.gzindex === s.gzhead.extra.length) {
          s.gzindex = 0;
          s.status = NAME_STATE;
        }
      } else {
      s.status = NAME_STATE;
    }
  }
  if (s.status === NAME_STATE) {
    if (s.gzhead.name /* != Z_NULL*/) {
        beg = s.pending; /* start of bytes to update crc */
        //int val;

        do {
          if (s.pending === s.pending_buf_size) {
            if (s.gzhead.hcrc && s.pending > beg) {
              strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
            }
            flush_pending(strm);
            beg = s.pending;
            if (s.pending === s.pending_buf_size) {
              val = 1;
              break;
            }
          }
          // JS specific: little magic to add zero terminator to end of string
          if (s.gzindex < s.gzhead.name.length) {
            val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;
          } else {
            val = 0;
          }
          put_byte(s, val);
        } while (val !== 0);

        if (s.gzhead.hcrc && s.pending > beg) {
          strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
        }
        if (val === 0) {
          s.gzindex = 0;
          s.status = COMMENT_STATE;
        }
      } else {
      s.status = COMMENT_STATE;
    }
  }
  if (s.status === COMMENT_STATE) {
    if (s.gzhead.comment /* != Z_NULL*/) {
        beg = s.pending; /* start of bytes to update crc */
        //int val;

        do {
          if (s.pending === s.pending_buf_size) {
            if (s.gzhead.hcrc && s.pending > beg) {
              strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
            }
            flush_pending(strm);
            beg = s.pending;
            if (s.pending === s.pending_buf_size) {
              val = 1;
              break;
            }
          }
          // JS specific: little magic to add zero terminator to end of string
          if (s.gzindex < s.gzhead.comment.length) {
            val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;
          } else {
            val = 0;
          }
          put_byte(s, val);
        } while (val !== 0);

        if (s.gzhead.hcrc && s.pending > beg) {
          strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
        }
        if (val === 0) {
          s.status = HCRC_STATE;
        }
      } else {
      s.status = HCRC_STATE;
    }
  }
  if (s.status === HCRC_STATE) {
    if (s.gzhead.hcrc) {
      if (s.pending + 2 > s.pending_buf_size) {
        flush_pending(strm);
      }
      if (s.pending + 2 <= s.pending_buf_size) {
        put_byte(s, strm.adler & 0xff);
        put_byte(s, strm.adler >> 8 & 0xff);
        strm.adler = 0; //crc32(0L, Z_NULL, 0);
        s.status = BUSY_STATE;
      }
    } else {
      s.status = BUSY_STATE;
    }
  }
  //#endif

  /* Flush as much pending output as possible */
  if (s.pending !== 0) {
    flush_pending(strm);
    if (strm.avail_out === 0) {
      /* Since avail_out is 0, deflate will be called again with
       * more output space, but possibly with both pending and
       * avail_in equal to zero. There won't be anything to do,
       * but this is not an error situation so make sure we
       * return OK instead of BUF_ERROR at next call of deflate:
       */
      s.last_flush = -1;
      return Z_OK;
    }

    /* Make sure there is something to do and avoid duplicate consecutive
     * flushes. For repeated and useless calls with Z_FINISH, we keep
     * returning Z_STREAM_END instead of Z_BUF_ERROR.
     */
  } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH) {
    return err(strm, Z_BUF_ERROR);
  }

  /* User must not provide more input after the first FINISH: */
  if (s.status === FINISH_STATE && strm.avail_in !== 0) {
    return err(strm, Z_BUF_ERROR);
  }

  /* Start a new block or continue the current one.
   */
  if (strm.avail_in !== 0 || s.lookahead !== 0 || flush !== Z_NO_FLUSH && s.status !== FINISH_STATE) {
    var bstate = s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : s.strategy === Z_RLE ? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush);

    if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {
      s.status = FINISH_STATE;
    }
    if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {
      if (strm.avail_out === 0) {
        s.last_flush = -1;
        /* avoid BUF_ERROR next call, see above */
      }
      return Z_OK;
      /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
       * of deflate should use the same flush parameter to make sure
       * that the flush is complete. So we don't have to output an
       * empty block here, this will be done at next call. This also
       * ensures that for a very small output buffer, we emit at most
       * one empty block.
       */
    }
    if (bstate === BS_BLOCK_DONE) {
      if (flush === Z_PARTIAL_FLUSH) {
        trees._tr_align(s);
      } else if (flush !== Z_BLOCK) {
        /* FULL_FLUSH or SYNC_FLUSH */

        trees._tr_stored_block(s, 0, 0, false);
        /* For a full flush, this empty block will be recognized
         * as a special marker by inflate_sync().
         */
        if (flush === Z_FULL_FLUSH) {
          /*** CLEAR_HASH(s); ***/ /* forget history */
          zero(s.head); // Fill with NIL (= 0);

          if (s.lookahead === 0) {
            s.strstart = 0;
            s.block_start = 0;
            s.insert = 0;
          }
        }
      }
      flush_pending(strm);
      if (strm.avail_out === 0) {
        s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */
        return Z_OK;
      }
    }
  }
  //Assert(strm->avail_out > 0, "bug2");
  //if (strm.avail_out <= 0) { throw new Error("bug2");}

  if (flush !== Z_FINISH) {
    return Z_OK;
  }
  if (s.wrap <= 0) {
    return Z_STREAM_END;
  }

  /* Write the trailer */
  if (s.wrap === 2) {
    put_byte(s, strm.adler & 0xff);
    put_byte(s, strm.adler >> 8 & 0xff);
    put_byte(s, strm.adler >> 16 & 0xff);
    put_byte(s, strm.adler >> 24 & 0xff);
    put_byte(s, strm.total_in & 0xff);
    put_byte(s, strm.total_in >> 8 & 0xff);
    put_byte(s, strm.total_in >> 16 & 0xff);
    put_byte(s, strm.total_in >> 24 & 0xff);
  } else {
    putShortMSB(s, strm.adler >>> 16);
    putShortMSB(s, strm.adler & 0xffff);
  }

  flush_pending(strm);
  /* If avail_out is zero, the application will call deflate again
   * to flush the rest.
   */
  if (s.wrap > 0) {
    s.wrap = -s.wrap;
  }
  /* write the trailer only once! */
  return s.pending !== 0 ? Z_OK : Z_STREAM_END;
}

function deflateEnd(strm) {
  var status;

  if (!strm /*== Z_NULL*/ || !strm.state /*== Z_NULL*/) {
      return Z_STREAM_ERROR;
    }

  status = strm.state.status;
  if (status !== INIT_STATE && status !== EXTRA_STATE && status !== NAME_STATE && status !== COMMENT_STATE && status !== HCRC_STATE && status !== BUSY_STATE && status !== FINISH_STATE) {
    return err(strm, Z_STREAM_ERROR);
  }

  strm.state = null;

  return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;
}

/* =========================================================================
 * Initializes the compression dictionary from the given byte
 * sequence without producing any compressed output.
 */
function deflateSetDictionary(strm, dictionary) {
  var dictLength = dictionary.length;

  var s;
  var str, n;
  var wrap;
  var avail;
  var next;
  var input;
  var tmpDict;

  if (!strm /*== Z_NULL*/ || !strm.state /*== Z_NULL*/) {
      return Z_STREAM_ERROR;
    }

  s = strm.state;
  wrap = s.wrap;

  if (wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead) {
    return Z_STREAM_ERROR;
  }

  /* when using zlib wrappers, compute Adler-32 for provided dictionary */
  if (wrap === 1) {
    /* adler32(strm->adler, dictionary, dictLength); */
    strm.adler = adler32(strm.adler, dictionary, dictLength, 0);
  }

  s.wrap = 0; /* avoid computing Adler-32 in read_buf */

  /* if dictionary would fill window, just replace the history */
  if (dictLength >= s.w_size) {
    if (wrap === 0) {
      /* already empty otherwise */
      /*** CLEAR_HASH(s); ***/
      zero(s.head); // Fill with NIL (= 0);
      s.strstart = 0;
      s.block_start = 0;
      s.insert = 0;
    }
    /* use the tail */
    // dictionary = dictionary.slice(dictLength - s.w_size);
    tmpDict = new utils.Buf8(s.w_size);
    utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);
    dictionary = tmpDict;
    dictLength = s.w_size;
  }
  /* insert dictionary into window and hash */
  avail = strm.avail_in;
  next = strm.next_in;
  input = strm.input;
  strm.avail_in = dictLength;
  strm.next_in = 0;
  strm.input = dictionary;
  fill_window(s);
  while (s.lookahead >= MIN_MATCH) {
    str = s.strstart;
    n = s.lookahead - (MIN_MATCH - 1);
    do {
      /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
      s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;

      s.prev[str & s.w_mask] = s.head[s.ins_h];

      s.head[s.ins_h] = str;
      str++;
    } while (--n);
    s.strstart = str;
    s.lookahead = MIN_MATCH - 1;
    fill_window(s);
  }
  s.strstart += s.lookahead;
  s.block_start = s.strstart;
  s.insert = s.lookahead;
  s.lookahead = 0;
  s.match_length = s.prev_length = MIN_MATCH - 1;
  s.match_available = 0;
  strm.next_in = next;
  strm.input = input;
  strm.avail_in = avail;
  s.wrap = wrap;
  return Z_OK;
}

exports.deflateInit = deflateInit;
exports.deflateInit2 = deflateInit2;
exports.deflateReset = deflateReset;
exports.deflateResetKeep = deflateResetKeep;
exports.deflateSetHeader = deflateSetHeader;
exports.deflate = deflate;
exports.deflateEnd = deflateEnd;
exports.deflateSetDictionary = deflateSetDictionary;
exports.deflateInfo = 'pako deflate (from Nodeca project)';

/* Not implemented
exports.deflateBound = deflateBound;
exports.deflateCopy = deflateCopy;
exports.deflateParams = deflateParams;
exports.deflatePending = deflatePending;
exports.deflatePrime = deflatePrime;
exports.deflateTune = deflateTune;
*/

/***/ }),
/* 458 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// (C) 1995-2013 Jean-loup Gailly and Mark Adler
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//   claim that you wrote the original software. If you use this software
//   in a product, an acknowledgment in the product documentation would be
//   appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
//   misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.

var utils = __webpack_require__(42);

/* Public constants ==========================================================*/
/* ===========================================================================*/

//var Z_FILTERED          = 1;
//var Z_HUFFMAN_ONLY      = 2;
//var Z_RLE               = 3;
var Z_FIXED = 4;
//var Z_DEFAULT_STRATEGY  = 0;

/* Possible values of the data_type field (though see inflate()) */
var Z_BINARY = 0;
var Z_TEXT = 1;
//var Z_ASCII             = 1; // = Z_TEXT
var Z_UNKNOWN = 2;

/*============================================================================*/

function zero(buf) {
  var len = buf.length;while (--len >= 0) {
    buf[len] = 0;
  }
}

// From zutil.h

var STORED_BLOCK = 0;
var STATIC_TREES = 1;
var DYN_TREES = 2;
/* The three kinds of block type */

var MIN_MATCH = 3;
var MAX_MATCH = 258;
/* The minimum and maximum match lengths */

// From deflate.h
/* ===========================================================================
 * Internal compression state.
 */

var LENGTH_CODES = 29;
/* number of length codes, not counting the special END_BLOCK code */

var LITERALS = 256;
/* number of literal bytes 0..255 */

var L_CODES = LITERALS + 1 + LENGTH_CODES;
/* number of Literal or Length codes, including the END_BLOCK code */

var D_CODES = 30;
/* number of distance codes */

var BL_CODES = 19;
/* number of codes used to transfer the bit lengths */

var HEAP_SIZE = 2 * L_CODES + 1;
/* maximum heap size */

var MAX_BITS = 15;
/* All codes must not exceed MAX_BITS bits */

var Buf_size = 16;
/* size of bit buffer in bi_buf */

/* ===========================================================================
 * Constants
 */

var MAX_BL_BITS = 7;
/* Bit length codes must not exceed MAX_BL_BITS bits */

var END_BLOCK = 256;
/* end of block literal code */

var REP_3_6 = 16;
/* repeat previous bit length 3-6 times (2 bits of repeat count) */

var REPZ_3_10 = 17;
/* repeat a zero length 3-10 times  (3 bits of repeat count) */

var REPZ_11_138 = 18;
/* repeat a zero length 11-138 times  (7 bits of repeat count) */

/* eslint-disable comma-spacing,array-bracket-spacing */
var extra_lbits = /* extra bits for each length code */
[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0];

var extra_dbits = /* extra bits for each distance code */
[0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];

var extra_blbits = /* extra bits for each bit length code */
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7];

var bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
/* eslint-enable comma-spacing,array-bracket-spacing */

/* The lengths of the bit length codes are sent in order of decreasing
 * probability, to avoid transmitting the lengths for unused bit length codes.
 */

/* ===========================================================================
 * Local data. These are initialized only once.
 */

// We pre-fill arrays with 0 to avoid uninitialized gaps

var DIST_CODE_LEN = 512; /* see definition of array dist_code below */

// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1
var static_ltree = new Array((L_CODES + 2) * 2);
zero(static_ltree);
/* The static literal tree. Since the bit lengths are imposed, there is no
 * need for the L_CODES extra codes used during heap construction. However
 * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
 * below).
 */

var static_dtree = new Array(D_CODES * 2);
zero(static_dtree);
/* The static distance tree. (Actually a trivial tree since all codes use
 * 5 bits.)
 */

var _dist_code = new Array(DIST_CODE_LEN);
zero(_dist_code);
/* Distance codes. The first 256 values correspond to the distances
 * 3 .. 258, the last 256 values correspond to the top 8 bits of
 * the 15 bit distances.
 */

var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);
zero(_length_code);
/* length code for each normalized match length (0 == MIN_MATCH) */

var base_length = new Array(LENGTH_CODES);
zero(base_length);
/* First normalized length for each code (0 = MIN_MATCH) */

var base_dist = new Array(D_CODES);
zero(base_dist);
/* First normalized distance for each code (0 = distance of 1) */

function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {

  this.static_tree = static_tree; /* static tree or NULL */
  this.extra_bits = extra_bits; /* extra bits for each code or NULL */
  this.extra_base = extra_base; /* base index for extra_bits */
  this.elems = elems; /* max number of elements in the tree */
  this.max_length = max_length; /* max bit length for the codes */

  // show if `static_tree` has data or dummy - needed for monomorphic objects
  this.has_stree = static_tree && static_tree.length;
}

var static_l_desc;
var static_d_desc;
var static_bl_desc;

function TreeDesc(dyn_tree, stat_desc) {
  this.dyn_tree = dyn_tree; /* the dynamic tree */
  this.max_code = 0; /* largest code with non zero frequency */
  this.stat_desc = stat_desc; /* the corresponding static tree */
}

function d_code(dist) {
  return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];
}

/* ===========================================================================
 * Output a short LSB first on the stream.
 * IN assertion: there is enough room in pendingBuf.
 */
function put_short(s, w) {
  //    put_byte(s, (uch)((w) & 0xff));
  //    put_byte(s, (uch)((ush)(w) >> 8));
  s.pending_buf[s.pending++] = w & 0xff;
  s.pending_buf[s.pending++] = w >>> 8 & 0xff;
}

/* ===========================================================================
 * Send a value on a given number of bits.
 * IN assertion: length <= 16 and value fits in length bits.
 */
function send_bits(s, value, length) {
  if (s.bi_valid > Buf_size - length) {
    s.bi_buf |= value << s.bi_valid & 0xffff;
    put_short(s, s.bi_buf);
    s.bi_buf = value >> Buf_size - s.bi_valid;
    s.bi_valid += length - Buf_size;
  } else {
    s.bi_buf |= value << s.bi_valid & 0xffff;
    s.bi_valid += length;
  }
}

function send_code(s, c, tree) {
  send_bits(s, tree[c * 2] /*.Code*/, tree[c * 2 + 1] /*.Len*/);
}

/* ===========================================================================
 * Reverse the first len bits of a code, using straightforward code (a faster
 * method would use a table)
 * IN assertion: 1 <= len <= 15
 */
function bi_reverse(code, len) {
  var res = 0;
  do {
    res |= code & 1;
    code >>>= 1;
    res <<= 1;
  } while (--len > 0);
  return res >>> 1;
}

/* ===========================================================================
 * Flush the bit buffer, keeping at most 7 bits in it.
 */
function bi_flush(s) {
  if (s.bi_valid === 16) {
    put_short(s, s.bi_buf);
    s.bi_buf = 0;
    s.bi_valid = 0;
  } else if (s.bi_valid >= 8) {
    s.pending_buf[s.pending++] = s.bi_buf & 0xff;
    s.bi_buf >>= 8;
    s.bi_valid -= 8;
  }
}

/* ===========================================================================
 * Compute the optimal bit lengths for a tree and update the total bit length
 * for the current block.
 * IN assertion: the fields freq and dad are set, heap[heap_max] and
 *    above are the tree nodes sorted by increasing frequency.
 * OUT assertions: the field len is set to the optimal bit length, the
 *     array bl_count contains the frequencies for each bit length.
 *     The length opt_len is updated; static_len is also updated if stree is
 *     not null.
 */
function gen_bitlen(s, desc)
//    deflate_state *s;
//    tree_desc *desc;    /* the tree descriptor */
{
  var tree = desc.dyn_tree;
  var max_code = desc.max_code;
  var stree = desc.stat_desc.static_tree;
  var has_stree = desc.stat_desc.has_stree;
  var extra = desc.stat_desc.extra_bits;
  var base = desc.stat_desc.extra_base;
  var max_length = desc.stat_desc.max_length;
  var h; /* heap index */
  var n, m; /* iterate over the tree elements */
  var bits; /* bit length */
  var xbits; /* extra bits */
  var f; /* frequency */
  var overflow = 0; /* number of elements with bit length too large */

  for (bits = 0; bits <= MAX_BITS; bits++) {
    s.bl_count[bits] = 0;
  }

  /* In a first pass, compute the optimal bit lengths (which may
   * overflow in the case of the bit length tree).
   */
  tree[s.heap[s.heap_max] * 2 + 1] /*.Len*/ = 0; /* root of the heap */

  for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {
    n = s.heap[h];
    bits = tree[tree[n * 2 + 1] /*.Dad*/ * 2 + 1] /*.Len*/ + 1;
    if (bits > max_length) {
      bits = max_length;
      overflow++;
    }
    tree[n * 2 + 1] /*.Len*/ = bits;
    /* We overwrite tree[n].Dad which is no longer needed */

    if (n > max_code) {
      continue;
    } /* not a leaf node */

    s.bl_count[bits]++;
    xbits = 0;
    if (n >= base) {
      xbits = extra[n - base];
    }
    f = tree[n * 2] /*.Freq*/;
    s.opt_len += f * (bits + xbits);
    if (has_stree) {
      s.static_len += f * (stree[n * 2 + 1] /*.Len*/ + xbits);
    }
  }
  if (overflow === 0) {
    return;
  }

  // Trace((stderr,"\nbit length overflow\n"));
  /* This happens for example on obj2 and pic of the Calgary corpus */

  /* Find the first bit length which could increase: */
  do {
    bits = max_length - 1;
    while (s.bl_count[bits] === 0) {
      bits--;
    }
    s.bl_count[bits]--; /* move one leaf down the tree */
    s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */
    s.bl_count[max_length]--;
    /* The brother of the overflow item also moves one step up,
     * but this does not affect bl_count[max_length]
     */
    overflow -= 2;
  } while (overflow > 0);

  /* Now recompute all bit lengths, scanning in increasing frequency.
   * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
   * lengths instead of fixing only the wrong ones. This idea is taken
   * from 'ar' written by Haruhiko Okumura.)
   */
  for (bits = max_length; bits !== 0; bits--) {
    n = s.bl_count[bits];
    while (n !== 0) {
      m = s.heap[--h];
      if (m > max_code) {
        continue;
      }
      if (tree[m * 2 + 1] /*.Len*/ !== bits) {
        // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
        s.opt_len += (bits - tree[m * 2 + 1] /*.Len*/) * tree[m * 2] /*.Freq*/;
        tree[m * 2 + 1] /*.Len*/ = bits;
      }
      n--;
    }
  }
}

/* ===========================================================================
 * Generate the codes for a given tree and bit counts (which need not be
 * optimal).
 * IN assertion: the array bl_count contains the bit length statistics for
 * the given tree and the field len is set for all tree elements.
 * OUT assertion: the field code is set for all tree elements of non
 *     zero code length.
 */
function gen_codes(tree, max_code, bl_count)
//    ct_data *tree;             /* the tree to decorate */
//    int max_code;              /* largest code with non zero frequency */
//    ushf *bl_count;            /* number of codes at each bit length */
{
  var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */
  var code = 0; /* running code value */
  var bits; /* bit index */
  var n; /* code index */

  /* The distribution counts are first used to generate the code values
   * without bit reversal.
   */
  for (bits = 1; bits <= MAX_BITS; bits++) {
    next_code[bits] = code = code + bl_count[bits - 1] << 1;
  }
  /* Check that the bit counts in bl_count are consistent. The last code
   * must be all ones.
   */
  //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
  //        "inconsistent bit counts");
  //Tracev((stderr,"\ngen_codes: max_code %d ", max_code));

  for (n = 0; n <= max_code; n++) {
    var len = tree[n * 2 + 1] /*.Len*/;
    if (len === 0) {
      continue;
    }
    /* Now reverse the bits */
    tree[n * 2] /*.Code*/ = bi_reverse(next_code[len]++, len);

    //Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
    //     n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
  }
}

/* ===========================================================================
 * Initialize the various 'constant' tables.
 */
function tr_static_init() {
  var n; /* iterates over tree elements */
  var bits; /* bit counter */
  var length; /* length value */
  var code; /* code value */
  var dist; /* distance index */
  var bl_count = new Array(MAX_BITS + 1);
  /* number of codes at each bit length for an optimal tree */

  // do check in _tr_init()
  //if (static_init_done) return;

  /* For some embedded targets, global variables are not initialized: */
  /*#ifdef NO_INIT_GLOBAL_POINTERS
    static_l_desc.static_tree = static_ltree;
    static_l_desc.extra_bits = extra_lbits;
    static_d_desc.static_tree = static_dtree;
    static_d_desc.extra_bits = extra_dbits;
    static_bl_desc.extra_bits = extra_blbits;
  #endif*/

  /* Initialize the mapping length (0..255) -> length code (0..28) */
  length = 0;
  for (code = 0; code < LENGTH_CODES - 1; code++) {
    base_length[code] = length;
    for (n = 0; n < 1 << extra_lbits[code]; n++) {
      _length_code[length++] = code;
    }
  }
  //Assert (length == 256, "tr_static_init: length != 256");
  /* Note that the length 255 (match length 258) can be represented
   * in two different ways: code 284 + 5 bits or code 285, so we
   * overwrite length_code[255] to use the best encoding:
   */
  _length_code[length - 1] = code;

  /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
  dist = 0;
  for (code = 0; code < 16; code++) {
    base_dist[code] = dist;
    for (n = 0; n < 1 << extra_dbits[code]; n++) {
      _dist_code[dist++] = code;
    }
  }
  //Assert (dist == 256, "tr_static_init: dist != 256");
  dist >>= 7; /* from now on, all distances are divided by 128 */
  for (; code < D_CODES; code++) {
    base_dist[code] = dist << 7;
    for (n = 0; n < 1 << extra_dbits[code] - 7; n++) {
      _dist_code[256 + dist++] = code;
    }
  }
  //Assert (dist == 256, "tr_static_init: 256+dist != 512");

  /* Construct the codes of the static literal tree */
  for (bits = 0; bits <= MAX_BITS; bits++) {
    bl_count[bits] = 0;
  }

  n = 0;
  while (n <= 143) {
    static_ltree[n * 2 + 1] /*.Len*/ = 8;
    n++;
    bl_count[8]++;
  }
  while (n <= 255) {
    static_ltree[n * 2 + 1] /*.Len*/ = 9;
    n++;
    bl_count[9]++;
  }
  while (n <= 279) {
    static_ltree[n * 2 + 1] /*.Len*/ = 7;
    n++;
    bl_count[7]++;
  }
  while (n <= 287) {
    static_ltree[n * 2 + 1] /*.Len*/ = 8;
    n++;
    bl_count[8]++;
  }
  /* Codes 286 and 287 do not exist, but we must include them in the
   * tree construction to get a canonical Huffman tree (longest code
   * all ones)
   */
  gen_codes(static_ltree, L_CODES + 1, bl_count);

  /* The static distance tree is trivial: */
  for (n = 0; n < D_CODES; n++) {
    static_dtree[n * 2 + 1] /*.Len*/ = 5;
    static_dtree[n * 2] /*.Code*/ = bi_reverse(n, 5);
  }

  // Now data ready and we can init static trees
  static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);
  static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);
  static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);

  //static_init_done = true;
}

/* ===========================================================================
 * Initialize a new block.
 */
function init_block(s) {
  var n; /* iterates over tree elements */

  /* Initialize the trees. */
  for (n = 0; n < L_CODES; n++) {
    s.dyn_ltree[n * 2] /*.Freq*/ = 0;
  }
  for (n = 0; n < D_CODES; n++) {
    s.dyn_dtree[n * 2] /*.Freq*/ = 0;
  }
  for (n = 0; n < BL_CODES; n++) {
    s.bl_tree[n * 2] /*.Freq*/ = 0;
  }

  s.dyn_ltree[END_BLOCK * 2] /*.Freq*/ = 1;
  s.opt_len = s.static_len = 0;
  s.last_lit = s.matches = 0;
}

/* ===========================================================================
 * Flush the bit buffer and align the output on a byte boundary
 */
function bi_windup(s) {
  if (s.bi_valid > 8) {
    put_short(s, s.bi_buf);
  } else if (s.bi_valid > 0) {
    //put_byte(s, (Byte)s->bi_buf);
    s.pending_buf[s.pending++] = s.bi_buf;
  }
  s.bi_buf = 0;
  s.bi_valid = 0;
}

/* ===========================================================================
 * Copy a stored block, storing first the length and its
 * one's complement if requested.
 */
function copy_block(s, buf, len, header)
//DeflateState *s;
//charf    *buf;    /* the input data */
//unsigned len;     /* its length */
//int      header;  /* true if block header must be written */
{
  bi_windup(s); /* align on byte boundary */

  if (header) {
    put_short(s, len);
    put_short(s, ~len);
  }
  //  while (len--) {
  //    put_byte(s, *buf++);
  //  }
  utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);
  s.pending += len;
}

/* ===========================================================================
 * Compares to subtrees, using the tree depth as tie breaker when
 * the subtrees have equal frequency. This minimizes the worst case length.
 */
function smaller(tree, n, m, depth) {
  var _n2 = n * 2;
  var _m2 = m * 2;
  return tree[_n2] /*.Freq*/ < tree[_m2] /*.Freq*/ || tree[_n2] /*.Freq*/ === tree[_m2] /*.Freq*/ && depth[n] <= depth[m];
}

/* ===========================================================================
 * Restore the heap property by moving down the tree starting at node k,
 * exchanging a node with the smallest of its two sons if necessary, stopping
 * when the heap property is re-established (each father smaller than its
 * two sons).
 */
function pqdownheap(s, tree, k)
//    deflate_state *s;
//    ct_data *tree;  /* the tree to restore */
//    int k;               /* node to move down */
{
  var v = s.heap[k];
  var j = k << 1; /* left son of k */
  while (j <= s.heap_len) {
    /* Set j to the smallest of the two sons: */
    if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {
      j++;
    }
    /* Exit if v is smaller than both sons */
    if (smaller(tree, v, s.heap[j], s.depth)) {
      break;
    }

    /* Exchange v with the smallest son */
    s.heap[k] = s.heap[j];
    k = j;

    /* And continue down the tree, setting j to the left son of k */
    j <<= 1;
  }
  s.heap[k] = v;
}

// inlined manually
// var SMALLEST = 1;

/* ===========================================================================
 * Send the block data compressed using the given Huffman trees
 */
function compress_block(s, ltree, dtree)
//    deflate_state *s;
//    const ct_data *ltree; /* literal tree */
//    const ct_data *dtree; /* distance tree */
{
  var dist; /* distance of matched string */
  var lc; /* match length or unmatched char (if dist == 0) */
  var lx = 0; /* running index in l_buf */
  var code; /* the code to send */
  var extra; /* number of extra bits to send */

  if (s.last_lit !== 0) {
    do {
      dist = s.pending_buf[s.d_buf + lx * 2] << 8 | s.pending_buf[s.d_buf + lx * 2 + 1];
      lc = s.pending_buf[s.l_buf + lx];
      lx++;

      if (dist === 0) {
        send_code(s, lc, ltree); /* send a literal byte */
        //Tracecv(isgraph(lc), (stderr," '%c' ", lc));
      } else {
        /* Here, lc is the match length - MIN_MATCH */
        code = _length_code[lc];
        send_code(s, code + LITERALS + 1, ltree); /* send the length code */
        extra = extra_lbits[code];
        if (extra !== 0) {
          lc -= base_length[code];
          send_bits(s, lc, extra); /* send the extra length bits */
        }
        dist--; /* dist is now the match distance - 1 */
        code = d_code(dist);
        //Assert (code < D_CODES, "bad d_code");

        send_code(s, code, dtree); /* send the distance code */
        extra = extra_dbits[code];
        if (extra !== 0) {
          dist -= base_dist[code];
          send_bits(s, dist, extra); /* send the extra distance bits */
        }
      } /* literal or match pair ? */

      /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
      //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
      //       "pendingBuf overflow");
    } while (lx < s.last_lit);
  }

  send_code(s, END_BLOCK, ltree);
}

/* ===========================================================================
 * Construct one Huffman tree and assigns the code bit strings and lengths.
 * Update the total bit length for the current block.
 * IN assertion: the field freq is set for all tree elements.
 * OUT assertions: the fields len and code are set to the optimal bit length
 *     and corresponding code. The length opt_len is updated; static_len is
 *     also updated if stree is not null. The field max_code is set.
 */
function build_tree(s, desc)
//    deflate_state *s;
//    tree_desc *desc; /* the tree descriptor */
{
  var tree = desc.dyn_tree;
  var stree = desc.stat_desc.static_tree;
  var has_stree = desc.stat_desc.has_stree;
  var elems = desc.stat_desc.elems;
  var n, m; /* iterate over heap elements */
  var max_code = -1; /* largest code with non zero frequency */
  var node; /* new node being created */

  /* Construct the initial heap, with least frequent element in
   * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
   * heap[0] is not used.
   */
  s.heap_len = 0;
  s.heap_max = HEAP_SIZE;

  for (n = 0; n < elems; n++) {
    if (tree[n * 2] /*.Freq*/ !== 0) {
      s.heap[++s.heap_len] = max_code = n;
      s.depth[n] = 0;
    } else {
      tree[n * 2 + 1] /*.Len*/ = 0;
    }
  }

  /* The pkzip format requires that at least one distance code exists,
   * and that at least one bit should be sent even if there is only one
   * possible code. So to avoid special checks later on we force at least
   * two codes of non zero frequency.
   */
  while (s.heap_len < 2) {
    node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0;
    tree[node * 2] /*.Freq*/ = 1;
    s.depth[node] = 0;
    s.opt_len--;

    if (has_stree) {
      s.static_len -= stree[node * 2 + 1] /*.Len*/;
    }
    /* node is 0 or 1 so it does not have extra bits */
  }
  desc.max_code = max_code;

  /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
   * establish sub-heaps of increasing lengths:
   */
  for (n = s.heap_len >> 1 /*int /2*/; n >= 1; n--) {
    pqdownheap(s, tree, n);
  }

  /* Construct the Huffman tree by repeatedly combining the least two
   * frequent nodes.
   */
  node = elems; /* next internal node of the tree */
  do {
    //pqremove(s, tree, n);  /* n = node of least frequency */
    /*** pqremove ***/
    n = s.heap[1 /*SMALLEST*/];
    s.heap[1 /*SMALLEST*/] = s.heap[s.heap_len--];
    pqdownheap(s, tree, 1 /*SMALLEST*/);
    /***/

    m = s.heap[1 /*SMALLEST*/]; /* m = node of next least frequency */

    s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */
    s.heap[--s.heap_max] = m;

    /* Create a new node father of n and m */
    tree[node * 2] /*.Freq*/ = tree[n * 2] /*.Freq*/ + tree[m * 2] /*.Freq*/;
    s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;
    tree[n * 2 + 1] /*.Dad*/ = tree[m * 2 + 1] /*.Dad*/ = node;

    /* and insert the new node in the heap */
    s.heap[1 /*SMALLEST*/] = node++;
    pqdownheap(s, tree, 1 /*SMALLEST*/);
  } while (s.heap_len >= 2);

  s.heap[--s.heap_max] = s.heap[1 /*SMALLEST*/];

  /* At this point, the fields freq and dad are set. We can now
   * generate the bit lengths.
   */
  gen_bitlen(s, desc);

  /* The field len is now set, we can generate the bit codes */
  gen_codes(tree, max_code, s.bl_count);
}

/* ===========================================================================
 * Scan a literal or distance tree to determine the frequencies of the codes
 * in the bit length tree.
 */
function scan_tree(s, tree, max_code)
//    deflate_state *s;
//    ct_data *tree;   /* the tree to be scanned */
//    int max_code;    /* and its largest code of non zero frequency */
{
  var n; /* iterates over all tree elements */
  var prevlen = -1; /* last emitted length */
  var curlen; /* length of current code */

  var nextlen = tree[0 * 2 + 1] /*.Len*/; /* length of next code */

  var count = 0; /* repeat count of the current code */
  var max_count = 7; /* max repeat count */
  var min_count = 4; /* min repeat count */

  if (nextlen === 0) {
    max_count = 138;
    min_count = 3;
  }
  tree[(max_code + 1) * 2 + 1] /*.Len*/ = 0xffff; /* guard */

  for (n = 0; n <= max_code; n++) {
    curlen = nextlen;
    nextlen = tree[(n + 1) * 2 + 1] /*.Len*/;

    if (++count < max_count && curlen === nextlen) {
      continue;
    } else if (count < min_count) {
      s.bl_tree[curlen * 2] /*.Freq*/ += count;
    } else if (curlen !== 0) {

      if (curlen !== prevlen) {
        s.bl_tree[curlen * 2] /*.Freq*/++;
      }
      s.bl_tree[REP_3_6 * 2] /*.Freq*/++;
    } else if (count <= 10) {
      s.bl_tree[REPZ_3_10 * 2] /*.Freq*/++;
    } else {
      s.bl_tree[REPZ_11_138 * 2] /*.Freq*/++;
    }

    count = 0;
    prevlen = curlen;

    if (nextlen === 0) {
      max_count = 138;
      min_count = 3;
    } else if (curlen === nextlen) {
      max_count = 6;
      min_count = 3;
    } else {
      max_count = 7;
      min_count = 4;
    }
  }
}

/* ===========================================================================
 * Send a literal or distance tree in compressed form, using the codes in
 * bl_tree.
 */
function send_tree(s, tree, max_code)
//    deflate_state *s;
//    ct_data *tree; /* the tree to be scanned */
//    int max_code;       /* and its largest code of non zero frequency */
{
  var n; /* iterates over all tree elements */
  var prevlen = -1; /* last emitted length */
  var curlen; /* length of current code */

  var nextlen = tree[0 * 2 + 1] /*.Len*/; /* length of next code */

  var count = 0; /* repeat count of the current code */
  var max_count = 7; /* max repeat count */
  var min_count = 4; /* min repeat count */

  /* tree[max_code+1].Len = -1; */ /* guard already set */
  if (nextlen === 0) {
    max_count = 138;
    min_count = 3;
  }

  for (n = 0; n <= max_code; n++) {
    curlen = nextlen;
    nextlen = tree[(n + 1) * 2 + 1] /*.Len*/;

    if (++count < max_count && curlen === nextlen) {
      continue;
    } else if (count < min_count) {
      do {
        send_code(s, curlen, s.bl_tree);
      } while (--count !== 0);
    } else if (curlen !== 0) {
      if (curlen !== prevlen) {
        send_code(s, curlen, s.bl_tree);
        count--;
      }
      //Assert(count >= 3 && count <= 6, " 3_6?");
      send_code(s, REP_3_6, s.bl_tree);
      send_bits(s, count - 3, 2);
    } else if (count <= 10) {
      send_code(s, REPZ_3_10, s.bl_tree);
      send_bits(s, count - 3, 3);
    } else {
      send_code(s, REPZ_11_138, s.bl_tree);
      send_bits(s, count - 11, 7);
    }

    count = 0;
    prevlen = curlen;
    if (nextlen === 0) {
      max_count = 138;
      min_count = 3;
    } else if (curlen === nextlen) {
      max_count = 6;
      min_count = 3;
    } else {
      max_count = 7;
      min_count = 4;
    }
  }
}

/* ===========================================================================
 * Construct the Huffman tree for the bit lengths and return the index in
 * bl_order of the last bit length code to send.
 */
function build_bl_tree(s) {
  var max_blindex; /* index of last bit length code of non zero freq */

  /* Determine the bit length frequencies for literal and distance trees */
  scan_tree(s, s.dyn_ltree, s.l_desc.max_code);
  scan_tree(s, s.dyn_dtree, s.d_desc.max_code);

  /* Build the bit length tree: */
  build_tree(s, s.bl_desc);
  /* opt_len now includes the length of the tree representations, except
   * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
   */

  /* Determine the number of bit length codes to send. The pkzip format
   * requires that at least 4 bit length codes be sent. (appnote.txt says
   * 3 but the actual value used is 4.)
   */
  for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {
    if (s.bl_tree[bl_order[max_blindex] * 2 + 1] /*.Len*/ !== 0) {
      break;
    }
  }
  /* Update opt_len to include the bit length tree and counts */
  s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;
  //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
  //        s->opt_len, s->static_len));

  return max_blindex;
}

/* ===========================================================================
 * Send the header for a block using dynamic Huffman trees: the counts, the
 * lengths of the bit length codes, the literal tree and the distance tree.
 * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
 */
function send_all_trees(s, lcodes, dcodes, blcodes)
//    deflate_state *s;
//    int lcodes, dcodes, blcodes; /* number of codes for each tree */
{
  var rank; /* index in bl_order */

  //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
  //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
  //        "too many codes");
  //Tracev((stderr, "\nbl counts: "));
  send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */
  send_bits(s, dcodes - 1, 5);
  send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */
  for (rank = 0; rank < blcodes; rank++) {
    //Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
    send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1] /*.Len*/, 3);
  }
  //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));

  send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */
  //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));

  send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */
  //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
}

/* ===========================================================================
 * Check if the data type is TEXT or BINARY, using the following algorithm:
 * - TEXT if the two conditions below are satisfied:
 *    a) There are no non-portable control characters belonging to the
 *       "black list" (0..6, 14..25, 28..31).
 *    b) There is at least one printable character belonging to the
 *       "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
 * - BINARY otherwise.
 * - The following partially-portable control characters form a
 *   "gray list" that is ignored in this detection algorithm:
 *   (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
 * IN assertion: the fields Freq of dyn_ltree are set.
 */
function detect_data_type(s) {
  /* black_mask is the bit mask of black-listed bytes
   * set bits 0..6, 14..25, and 28..31
   * 0xf3ffc07f = binary 11110011111111111100000001111111
   */
  var black_mask = 0xf3ffc07f;
  var n;

  /* Check for non-textual ("black-listed") bytes. */
  for (n = 0; n <= 31; n++, black_mask >>>= 1) {
    if (black_mask & 1 && s.dyn_ltree[n * 2] /*.Freq*/ !== 0) {
      return Z_BINARY;
    }
  }

  /* Check for textual ("white-listed") bytes. */
  if (s.dyn_ltree[9 * 2] /*.Freq*/ !== 0 || s.dyn_ltree[10 * 2] /*.Freq*/ !== 0 || s.dyn_ltree[13 * 2] /*.Freq*/ !== 0) {
    return Z_TEXT;
  }
  for (n = 32; n < LITERALS; n++) {
    if (s.dyn_ltree[n * 2] /*.Freq*/ !== 0) {
      return Z_TEXT;
    }
  }

  /* There are no "black-listed" or "white-listed" bytes:
   * this stream either is empty or has tolerated ("gray-listed") bytes only.
   */
  return Z_BINARY;
}

var static_init_done = false;

/* ===========================================================================
 * Initialize the tree data structures for a new zlib stream.
 */
function _tr_init(s) {

  if (!static_init_done) {
    tr_static_init();
    static_init_done = true;
  }

  s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);
  s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);
  s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);

  s.bi_buf = 0;
  s.bi_valid = 0;

  /* Initialize the first block of the first file: */
  init_block(s);
}

/* ===========================================================================
 * Send a stored block
 */
function _tr_stored_block(s, buf, stored_len, last)
//DeflateState *s;
//charf *buf;       /* input block */
//ulg stored_len;   /* length of input block */
//int last;         /* one if this is the last block for a file */
{
  send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */
  copy_block(s, buf, stored_len, true); /* with header */
}

/* ===========================================================================
 * Send one empty static block to give enough lookahead for inflate.
 * This takes 10 bits, of which 7 may remain in the bit buffer.
 */
function _tr_align(s) {
  send_bits(s, STATIC_TREES << 1, 3);
  send_code(s, END_BLOCK, static_ltree);
  bi_flush(s);
}

/* ===========================================================================
 * Determine the best encoding for the current block: dynamic trees, static
 * trees or store, and output the encoded block to the zip file.
 */
function _tr_flush_block(s, buf, stored_len, last)
//DeflateState *s;
//charf *buf;       /* input block, or NULL if too old */
//ulg stored_len;   /* length of input block */
//int last;         /* one if this is the last block for a file */
{
  var opt_lenb, static_lenb; /* opt_len and static_len in bytes */
  var max_blindex = 0; /* index of last bit length code of non zero freq */

  /* Build the Huffman trees unless a stored block is forced */
  if (s.level > 0) {

    /* Check if the file is binary or text */
    if (s.strm.data_type === Z_UNKNOWN) {
      s.strm.data_type = detect_data_type(s);
    }

    /* Construct the literal and distance trees */
    build_tree(s, s.l_desc);
    // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
    //        s->static_len));

    build_tree(s, s.d_desc);
    // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
    //        s->static_len));
    /* At this point, opt_len and static_len are the total bit lengths of
     * the compressed block data, excluding the tree representations.
     */

    /* Build the bit length tree for the above two trees, and get the index
     * in bl_order of the last bit length code to send.
     */
    max_blindex = build_bl_tree(s);

    /* Determine the best encoding. Compute the block lengths in bytes. */
    opt_lenb = s.opt_len + 3 + 7 >>> 3;
    static_lenb = s.static_len + 3 + 7 >>> 3;

    // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
    //        opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
    //        s->last_lit));

    if (static_lenb <= opt_lenb) {
      opt_lenb = static_lenb;
    }
  } else {
    // Assert(buf != (char*)0, "lost buf");
    opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
  }

  if (stored_len + 4 <= opt_lenb && buf !== -1) {
    /* 4: two words for the lengths */

    /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
     * Otherwise we can't have processed more than WSIZE input bytes since
     * the last block flush, because compression would have been
     * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
     * transform a block into a stored block.
     */
    _tr_stored_block(s, buf, stored_len, last);
  } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {

    send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);
    compress_block(s, static_ltree, static_dtree);
  } else {
    send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);
    send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);
    compress_block(s, s.dyn_ltree, s.dyn_dtree);
  }
  // Assert (s->compressed_len == s->bits_sent, "bad compressed size");
  /* The above check is made mod 2^32, for files larger than 512 MB
   * and uLong implemented on 32 bits.
   */
  init_block(s);

  if (last) {
    bi_windup(s);
  }
  // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
  //       s->compressed_len-7*last));
}

/* ===========================================================================
 * Save the match info and tally the frequency counts. Return true if
 * the current block must be flushed.
 */
function _tr_tally(s, dist, lc)
//    deflate_state *s;
//    unsigned dist;  /* distance of matched string */
//    unsigned lc;    /* match length-MIN_MATCH or unmatched char (if dist==0) */
{
  //var out_length, in_length, dcode;

  s.pending_buf[s.d_buf + s.last_lit * 2] = dist >>> 8 & 0xff;
  s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;

  s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;
  s.last_lit++;

  if (dist === 0) {
    /* lc is the unmatched char */
    s.dyn_ltree[lc * 2] /*.Freq*/++;
  } else {
    s.matches++;
    /* Here, lc is the match length - MIN_MATCH */
    dist--; /* dist = match distance - 1 */
    //Assert((ush)dist < (ush)MAX_DIST(s) &&
    //       (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
    //       (ush)d_code(dist) < (ush)D_CODES,  "_tr_tally: bad match");

    s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2] /*.Freq*/++;
    s.dyn_dtree[d_code(dist) * 2] /*.Freq*/++;
  }

  // (!) This block is disabled in zlib defaults,
  // don't enable it for binary compatibility

  //#ifdef TRUNCATE_BLOCK
  //  /* Try to guess if it is profitable to stop the current block here */
  //  if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {
  //    /* Compute an upper bound for the compressed length */
  //    out_length = s.last_lit*8;
  //    in_length = s.strstart - s.block_start;
  //
  //    for (dcode = 0; dcode < D_CODES; dcode++) {
  //      out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);
  //    }
  //    out_length >>>= 3;
  //    //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
  //    //       s->last_lit, in_length, out_length,
  //    //       100L - out_length*100L/in_length));
  //    if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {
  //      return true;
  //    }
  //  }
  //#endif

  return s.last_lit === s.lit_bufsize - 1;
  /* We avoid equality with lit_bufsize because of wraparound at 64K
   * on 16 bit machines and because stored blocks are restricted to
   * 64K-1 bytes.
   */
}

exports._tr_init = _tr_init;
exports._tr_stored_block = _tr_stored_block;
exports._tr_flush_block = _tr_flush_block;
exports._tr_tally = _tr_tally;
exports._tr_align = _tr_align;

/***/ }),
/* 459 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var zlib_inflate = __webpack_require__(460);
var utils = __webpack_require__(42);
var strings = __webpack_require__(196);
var c = __webpack_require__(198);
var msg = __webpack_require__(134);
var ZStream = __webpack_require__(197);
var GZheader = __webpack_require__(463);

var toString = Object.prototype.toString;

/**
 * class Inflate
 *
 * Generic JS-style wrapper for zlib calls. If you don't need
 * streaming behaviour - use more simple functions: [[inflate]]
 * and [[inflateRaw]].
 **/

/* internal
 * inflate.chunks -> Array
 *
 * Chunks of output data, if [[Inflate#onData]] not overridden.
 **/

/**
 * Inflate.result -> Uint8Array|Array|String
 *
 * Uncompressed result, generated by default [[Inflate#onData]]
 * and [[Inflate#onEnd]] handlers. Filled after you push last chunk
 * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you
 * push a chunk with explicit flush (call [[Inflate#push]] with
 * `Z_SYNC_FLUSH` param).
 **/

/**
 * Inflate.err -> Number
 *
 * Error code after inflate finished. 0 (Z_OK) on success.
 * Should be checked if broken data possible.
 **/

/**
 * Inflate.msg -> String
 *
 * Error message, if [[Inflate.err]] != 0
 **/

/**
 * new Inflate(options)
 * - options (Object): zlib inflate options.
 *
 * Creates new inflator instance with specified params. Throws exception
 * on bad params. Supported options:
 *
 * - `windowBits`
 * - `dictionary`
 *
 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
 * for more information on these.
 *
 * Additional options, for internal needs:
 *
 * - `chunkSize` - size of generated data chunks (16K by default)
 * - `raw` (Boolean) - do raw inflate
 * - `to` (String) - if equal to 'string', then result will be converted
 *   from utf8 to utf16 (javascript) string. When string output requested,
 *   chunk length can differ from `chunkSize`, depending on content.
 *
 * By default, when no options set, autodetect deflate/gzip data format via
 * wrapper header.
 *
 * ##### Example:
 *
 * ```javascript
 * var pako = require('pako')
 *   , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])
 *   , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);
 *
 * var inflate = new pako.Inflate({ level: 3});
 *
 * inflate.push(chunk1, false);
 * inflate.push(chunk2, true);  // true -> last chunk
 *
 * if (inflate.err) { throw new Error(inflate.err); }
 *
 * console.log(inflate.result);
 * ```
 **/
function Inflate(options) {
  if (!(this instanceof Inflate)) return new Inflate(options);

  this.options = utils.assign({
    chunkSize: 16384,
    windowBits: 0,
    to: ''
  }, options || {});

  var opt = this.options;

  // Force window size for `raw` data, if not set directly,
  // because we have no header for autodetect.
  if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) {
    opt.windowBits = -opt.windowBits;
    if (opt.windowBits === 0) {
      opt.windowBits = -15;
    }
  }

  // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate
  if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) {
    opt.windowBits += 32;
  }

  // Gzip header has no info about windows size, we can do autodetect only
  // for deflate. So, if window size not set, force it to max when gzip possible
  if (opt.windowBits > 15 && opt.windowBits < 48) {
    // bit 3 (16) -> gzipped data
    // bit 4 (32) -> autodetect gzip/deflate
    if ((opt.windowBits & 15) === 0) {
      opt.windowBits |= 15;
    }
  }

  this.err = 0; // error code, if happens (0 = Z_OK)
  this.msg = ''; // error message
  this.ended = false; // used to avoid multiple onEnd() calls
  this.chunks = []; // chunks of compressed data

  this.strm = new ZStream();
  this.strm.avail_out = 0;

  var status = zlib_inflate.inflateInit2(this.strm, opt.windowBits);

  if (status !== c.Z_OK) {
    throw new Error(msg[status]);
  }

  this.header = new GZheader();

  zlib_inflate.inflateGetHeader(this.strm, this.header);
}

/**
 * Inflate#push(data[, mode]) -> Boolean
 * - data (Uint8Array|Array|ArrayBuffer|String): input data
 * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.
 *   See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.
 *
 * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
 * new output chunks. Returns `true` on success. The last data block must have
 * mode Z_FINISH (or `true`). That will flush internal pending buffers and call
 * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you
 * can use mode Z_SYNC_FLUSH, keeping the decompression context.
 *
 * On fail call [[Inflate#onEnd]] with error code and return false.
 *
 * We strongly recommend to use `Uint8Array` on input for best speed (output
 * format is detected automatically). Also, don't skip last param and always
 * use the same type in your code (boolean or number). That will improve JS speed.
 *
 * For regular `Array`-s make sure all elements are [0..255].
 *
 * ##### Example
 *
 * ```javascript
 * push(chunk, false); // push one of data chunks
 * ...
 * push(chunk, true);  // push last chunk
 * ```
 **/
Inflate.prototype.push = function (data, mode) {
  var strm = this.strm;
  var chunkSize = this.options.chunkSize;
  var dictionary = this.options.dictionary;
  var status, _mode;
  var next_out_utf8, tail, utf8str;
  var dict;

  // Flag to properly process Z_BUF_ERROR on testing inflate call
  // when we check that all output data was flushed.
  var allowBufError = false;

  if (this.ended) {
    return false;
  }
  _mode = mode === ~~mode ? mode : mode === true ? c.Z_FINISH : c.Z_NO_FLUSH;

  // Convert data if needed
  if (typeof data === 'string') {
    // Only binary strings can be decompressed on practice
    strm.input = strings.binstring2buf(data);
  } else if (toString.call(data) === '[object ArrayBuffer]') {
    strm.input = new Uint8Array(data);
  } else {
    strm.input = data;
  }

  strm.next_in = 0;
  strm.avail_in = strm.input.length;

  do {
    if (strm.avail_out === 0) {
      strm.output = new utils.Buf8(chunkSize);
      strm.next_out = 0;
      strm.avail_out = chunkSize;
    }

    status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */

    if (status === c.Z_NEED_DICT && dictionary) {
      // Convert data if needed
      if (typeof dictionary === 'string') {
        dict = strings.string2buf(dictionary);
      } else if (toString.call(dictionary) === '[object ArrayBuffer]') {
        dict = new Uint8Array(dictionary);
      } else {
        dict = dictionary;
      }

      status = zlib_inflate.inflateSetDictionary(this.strm, dict);
    }

    if (status === c.Z_BUF_ERROR && allowBufError === true) {
      status = c.Z_OK;
      allowBufError = false;
    }

    if (status !== c.Z_STREAM_END && status !== c.Z_OK) {
      this.onEnd(status);
      this.ended = true;
      return false;
    }

    if (strm.next_out) {
      if (strm.avail_out === 0 || status === c.Z_STREAM_END || strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH)) {

        if (this.options.to === 'string') {

          next_out_utf8 = strings.utf8border(strm.output, strm.next_out);

          tail = strm.next_out - next_out_utf8;
          utf8str = strings.buf2string(strm.output, next_out_utf8);

          // move tail
          strm.next_out = tail;
          strm.avail_out = chunkSize - tail;
          if (tail) {
            utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0);
          }

          this.onData(utf8str);
        } else {
          this.onData(utils.shrinkBuf(strm.output, strm.next_out));
        }
      }
    }

    // When no more input data, we should check that internal inflate buffers
    // are flushed. The only way to do it when avail_out = 0 - run one more
    // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.
    // Here we set flag to process this error properly.
    //
    // NOTE. Deflate does not return error in this case and does not needs such
    // logic.
    if (strm.avail_in === 0 && strm.avail_out === 0) {
      allowBufError = true;
    }
  } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);

  if (status === c.Z_STREAM_END) {
    _mode = c.Z_FINISH;
  }

  // Finalize on the last chunk.
  if (_mode === c.Z_FINISH) {
    status = zlib_inflate.inflateEnd(this.strm);
    this.onEnd(status);
    this.ended = true;
    return status === c.Z_OK;
  }

  // callback interim results if Z_SYNC_FLUSH.
  if (_mode === c.Z_SYNC_FLUSH) {
    this.onEnd(c.Z_OK);
    strm.avail_out = 0;
    return true;
  }

  return true;
};

/**
 * Inflate#onData(chunk) -> Void
 * - chunk (Uint8Array|Array|String): output data. Type of array depends
 *   on js engine support. When string output requested, each chunk
 *   will be string.
 *
 * By default, stores data blocks in `chunks[]` property and glue
 * those in `onEnd`. Override this handler, if you need another behaviour.
 **/
Inflate.prototype.onData = function (chunk) {
  this.chunks.push(chunk);
};

/**
 * Inflate#onEnd(status) -> Void
 * - status (Number): inflate status. 0 (Z_OK) on success,
 *   other if not.
 *
 * Called either after you tell inflate that the input stream is
 * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
 * or if an error happened. By default - join collected chunks,
 * free memory and fill `results` / `err` properties.
 **/
Inflate.prototype.onEnd = function (status) {
  // On success - join
  if (status === c.Z_OK) {
    if (this.options.to === 'string') {
      // Glue & convert here, until we teach pako to send
      // utf8 aligned strings to onData
      this.result = this.chunks.join('');
    } else {
      this.result = utils.flattenChunks(this.chunks);
    }
  }
  this.chunks = [];
  this.err = status;
  this.msg = this.strm.msg;
};

/**
 * inflate(data[, options]) -> Uint8Array|Array|String
 * - data (Uint8Array|Array|String): input data to decompress.
 * - options (Object): zlib inflate options.
 *
 * Decompress `data` with inflate/ungzip and `options`. Autodetect
 * format via wrapper header by default. That's why we don't provide
 * separate `ungzip` method.
 *
 * Supported options are:
 *
 * - windowBits
 *
 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
 * for more information.
 *
 * Sugar (options):
 *
 * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
 *   negative windowBits implicitly.
 * - `to` (String) - if equal to 'string', then result will be converted
 *   from utf8 to utf16 (javascript) string. When string output requested,
 *   chunk length can differ from `chunkSize`, depending on content.
 *
 *
 * ##### Example:
 *
 * ```javascript
 * var pako = require('pako')
 *   , input = pako.deflate([1,2,3,4,5,6,7,8,9])
 *   , output;
 *
 * try {
 *   output = pako.inflate(input);
 * } catch (err)
 *   console.log(err);
 * }
 * ```
 **/
function inflate(input, options) {
  var inflator = new Inflate(options);

  inflator.push(input, true);

  // That will never happens, if you don't cheat with options :)
  if (inflator.err) {
    throw inflator.msg || msg[inflator.err];
  }

  return inflator.result;
}

/**
 * inflateRaw(data[, options]) -> Uint8Array|Array|String
 * - data (Uint8Array|Array|String): input data to decompress.
 * - options (Object): zlib inflate options.
 *
 * The same as [[inflate]], but creates raw data, without wrapper
 * (header and adler32 crc).
 **/
function inflateRaw(input, options) {
  options = options || {};
  options.raw = true;
  return inflate(input, options);
}

/**
 * ungzip(data[, options]) -> Uint8Array|Array|String
 * - data (Uint8Array|Array|String): input data to decompress.
 * - options (Object): zlib inflate options.
 *
 * Just shortcut to [[inflate]], because it autodetects format
 * by header.content. Done for convenience.
 **/

exports.Inflate = Inflate;
exports.inflate = inflate;
exports.inflateRaw = inflateRaw;
exports.ungzip = inflate;

/***/ }),
/* 460 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// (C) 1995-2013 Jean-loup Gailly and Mark Adler
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//   claim that you wrote the original software. If you use this software
//   in a product, an acknowledgment in the product documentation would be
//   appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
//   misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.

var utils = __webpack_require__(42);
var adler32 = __webpack_require__(194);
var crc32 = __webpack_require__(195);
var inflate_fast = __webpack_require__(461);
var inflate_table = __webpack_require__(462);

var CODES = 0;
var LENS = 1;
var DISTS = 2;

/* Public constants ==========================================================*/
/* ===========================================================================*/

/* Allowed flush values; see deflate() and inflate() below for details */
//var Z_NO_FLUSH      = 0;
//var Z_PARTIAL_FLUSH = 1;
//var Z_SYNC_FLUSH    = 2;
//var Z_FULL_FLUSH    = 3;
var Z_FINISH = 4;
var Z_BLOCK = 5;
var Z_TREES = 6;

/* Return codes for the compression/decompression functions. Negative values
 * are errors, positive values are used for special but normal events.
 */
var Z_OK = 0;
var Z_STREAM_END = 1;
var Z_NEED_DICT = 2;
//var Z_ERRNO         = -1;
var Z_STREAM_ERROR = -2;
var Z_DATA_ERROR = -3;
var Z_MEM_ERROR = -4;
var Z_BUF_ERROR = -5;
//var Z_VERSION_ERROR = -6;

/* The deflate compression method */
var Z_DEFLATED = 8;

/* STATES ====================================================================*/
/* ===========================================================================*/

var HEAD = 1; /* i: waiting for magic header */
var FLAGS = 2; /* i: waiting for method and flags (gzip) */
var TIME = 3; /* i: waiting for modification time (gzip) */
var OS = 4; /* i: waiting for extra flags and operating system (gzip) */
var EXLEN = 5; /* i: waiting for extra length (gzip) */
var EXTRA = 6; /* i: waiting for extra bytes (gzip) */
var NAME = 7; /* i: waiting for end of file name (gzip) */
var COMMENT = 8; /* i: waiting for end of comment (gzip) */
var HCRC = 9; /* i: waiting for header crc (gzip) */
var DICTID = 10; /* i: waiting for dictionary check value */
var DICT = 11; /* waiting for inflateSetDictionary() call */
var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */
var STORED = 14; /* i: waiting for stored size (length and complement) */
var COPY_ = 15; /* i/o: same as COPY below, but only first time in */
var COPY = 16; /* i/o: waiting for input or output to copy stored block */
var TABLE = 17; /* i: waiting for dynamic block table lengths */
var LENLENS = 18; /* i: waiting for code length code lengths */
var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */
var LEN_ = 20; /* i: same as LEN below, but only first time in */
var LEN = 21; /* i: waiting for length/lit/eob code */
var LENEXT = 22; /* i: waiting for length extra bits */
var DIST = 23; /* i: waiting for distance code */
var DISTEXT = 24; /* i: waiting for distance extra bits */
var MATCH = 25; /* o: waiting for output space to copy string */
var LIT = 26; /* o: waiting for output space to write literal */
var CHECK = 27; /* i: waiting for 32-bit check value */
var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */
var DONE = 29; /* finished check, done -- remain here until reset */
var BAD = 30; /* got a data error -- remain here until reset */
var MEM = 31; /* got an inflate() memory error -- remain here until reset */
var SYNC = 32; /* looking for synchronization bytes to restart inflate() */

/* ===========================================================================*/

var ENOUGH_LENS = 852;
var ENOUGH_DISTS = 592;
//var ENOUGH =  (ENOUGH_LENS+ENOUGH_DISTS);

var MAX_WBITS = 15;
/* 32K LZ77 window */
var DEF_WBITS = MAX_WBITS;

function zswap32(q) {
  return (q >>> 24 & 0xff) + (q >>> 8 & 0xff00) + ((q & 0xff00) << 8) + ((q & 0xff) << 24);
}

function InflateState() {
  this.mode = 0; /* current inflate mode */
  this.last = false; /* true if processing last block */
  this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
  this.havedict = false; /* true if dictionary provided */
  this.flags = 0; /* gzip header method and flags (0 if zlib) */
  this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */
  this.check = 0; /* protected copy of check value */
  this.total = 0; /* protected copy of output count */
  // TODO: may be {}
  this.head = null; /* where to save gzip header information */

  /* sliding window */
  this.wbits = 0; /* log base 2 of requested window size */
  this.wsize = 0; /* window size or zero if not using window */
  this.whave = 0; /* valid bytes in the window */
  this.wnext = 0; /* window write index */
  this.window = null; /* allocated sliding window, if needed */

  /* bit accumulator */
  this.hold = 0; /* input bit accumulator */
  this.bits = 0; /* number of bits in "in" */

  /* for string and stored block copying */
  this.length = 0; /* literal or length of data to copy */
  this.offset = 0; /* distance back to copy string from */

  /* for table and code decoding */
  this.extra = 0; /* extra bits needed */

  /* fixed and dynamic code tables */
  this.lencode = null; /* starting table for length/literal codes */
  this.distcode = null; /* starting table for distance codes */
  this.lenbits = 0; /* index bits for lencode */
  this.distbits = 0; /* index bits for distcode */

  /* dynamic table building */
  this.ncode = 0; /* number of code length code lengths */
  this.nlen = 0; /* number of length code lengths */
  this.ndist = 0; /* number of distance code lengths */
  this.have = 0; /* number of code lengths in lens[] */
  this.next = null; /* next available space in codes[] */

  this.lens = new utils.Buf16(320); /* temporary storage for code lengths */
  this.work = new utils.Buf16(288); /* work area for code table building */

  /*
   because we don't have pointers in js, we use lencode and distcode directly
   as buffers so we don't need codes
  */
  //this.codes = new utils.Buf32(ENOUGH);       /* space for code tables */
  this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */
  this.distdyn = null; /* dynamic table for distance codes (JS specific) */
  this.sane = 0; /* if false, allow invalid distance too far */
  this.back = 0; /* bits back of last unprocessed length/lit */
  this.was = 0; /* initial length of match */
}

function inflateResetKeep(strm) {
  var state;

  if (!strm || !strm.state) {
    return Z_STREAM_ERROR;
  }
  state = strm.state;
  strm.total_in = strm.total_out = state.total = 0;
  strm.msg = ''; /*Z_NULL*/
  if (state.wrap) {
    /* to support ill-conceived Java test suite */
    strm.adler = state.wrap & 1;
  }
  state.mode = HEAD;
  state.last = 0;
  state.havedict = 0;
  state.dmax = 32768;
  state.head = null /*Z_NULL*/;
  state.hold = 0;
  state.bits = 0;
  //state.lencode = state.distcode = state.next = state.codes;
  state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);
  state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);

  state.sane = 1;
  state.back = -1;
  //Tracev((stderr, "inflate: reset\n"));
  return Z_OK;
}

function inflateReset(strm) {
  var state;

  if (!strm || !strm.state) {
    return Z_STREAM_ERROR;
  }
  state = strm.state;
  state.wsize = 0;
  state.whave = 0;
  state.wnext = 0;
  return inflateResetKeep(strm);
}

function inflateReset2(strm, windowBits) {
  var wrap;
  var state;

  /* get the state */
  if (!strm || !strm.state) {
    return Z_STREAM_ERROR;
  }
  state = strm.state;

  /* extract wrap request from windowBits parameter */
  if (windowBits < 0) {
    wrap = 0;
    windowBits = -windowBits;
  } else {
    wrap = (windowBits >> 4) + 1;
    if (windowBits < 48) {
      windowBits &= 15;
    }
  }

  /* set number of window bits, free window if different */
  if (windowBits && (windowBits < 8 || windowBits > 15)) {
    return Z_STREAM_ERROR;
  }
  if (state.window !== null && state.wbits !== windowBits) {
    state.window = null;
  }

  /* update state and reset the rest of it */
  state.wrap = wrap;
  state.wbits = windowBits;
  return inflateReset(strm);
}

function inflateInit2(strm, windowBits) {
  var ret;
  var state;

  if (!strm) {
    return Z_STREAM_ERROR;
  }
  //strm.msg = Z_NULL;                 /* in case we return an error */

  state = new InflateState();

  //if (state === Z_NULL) return Z_MEM_ERROR;
  //Tracev((stderr, "inflate: allocated\n"));
  strm.state = state;
  state.window = null /*Z_NULL*/;
  ret = inflateReset2(strm, windowBits);
  if (ret !== Z_OK) {
    strm.state = null /*Z_NULL*/;
  }
  return ret;
}

function inflateInit(strm) {
  return inflateInit2(strm, DEF_WBITS);
}

/*
 Return state with length and distance decoding tables and index sizes set to
 fixed code decoding.  Normally this returns fixed tables from inffixed.h.
 If BUILDFIXED is defined, then instead this routine builds the tables the
 first time it's called, and returns those tables the first time and
 thereafter.  This reduces the size of the code by about 2K bytes, in
 exchange for a little execution time.  However, BUILDFIXED should not be
 used for threaded applications, since the rewriting of the tables and virgin
 may not be thread-safe.
 */
var virgin = true;

var lenfix, distfix; // We have no pointers in JS, so keep tables separate

function fixedtables(state) {
  /* build fixed huffman tables if first call (may not be thread safe) */
  if (virgin) {
    var sym;

    lenfix = new utils.Buf32(512);
    distfix = new utils.Buf32(32);

    /* literal/length table */
    sym = 0;
    while (sym < 144) {
      state.lens[sym++] = 8;
    }
    while (sym < 256) {
      state.lens[sym++] = 9;
    }
    while (sym < 280) {
      state.lens[sym++] = 7;
    }
    while (sym < 288) {
      state.lens[sym++] = 8;
    }

    inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });

    /* distance table */
    sym = 0;
    while (sym < 32) {
      state.lens[sym++] = 5;
    }

    inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });

    /* do this just once */
    virgin = false;
  }

  state.lencode = lenfix;
  state.lenbits = 9;
  state.distcode = distfix;
  state.distbits = 5;
}

/*
 Update the window with the last wsize (normally 32K) bytes written before
 returning.  If window does not exist yet, create it.  This is only called
 when a window is already in use, or when output has been written during this
 inflate call, but the end of the deflate stream has not been reached yet.
 It is also called to create a window for dictionary data when a dictionary
 is loaded.

 Providing output buffers larger than 32K to inflate() should provide a speed
 advantage, since only the last 32K of output is copied to the sliding window
 upon return from inflate(), and since all distances after the first 32K of
 output will fall in the output data, making match copies simpler and faster.
 The advantage may be dependent on the size of the processor's data caches.
 */
function updatewindow(strm, src, end, copy) {
  var dist;
  var state = strm.state;

  /* if it hasn't been done already, allocate space for the window */
  if (state.window === null) {
    state.wsize = 1 << state.wbits;
    state.wnext = 0;
    state.whave = 0;

    state.window = new utils.Buf8(state.wsize);
  }

  /* copy state->wsize or less output bytes into the circular window */
  if (copy >= state.wsize) {
    utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);
    state.wnext = 0;
    state.whave = state.wsize;
  } else {
    dist = state.wsize - state.wnext;
    if (dist > copy) {
      dist = copy;
    }
    //zmemcpy(state->window + state->wnext, end - copy, dist);
    utils.arraySet(state.window, src, end - copy, dist, state.wnext);
    copy -= dist;
    if (copy) {
      //zmemcpy(state->window, end - copy, copy);
      utils.arraySet(state.window, src, end - copy, copy, 0);
      state.wnext = copy;
      state.whave = state.wsize;
    } else {
      state.wnext += dist;
      if (state.wnext === state.wsize) {
        state.wnext = 0;
      }
      if (state.whave < state.wsize) {
        state.whave += dist;
      }
    }
  }
  return 0;
}

function inflate(strm, flush) {
  var state;
  var input, output; // input/output buffers
  var next; /* next input INDEX */
  var put; /* next output INDEX */
  var have, left; /* available input and output */
  var hold; /* bit buffer */
  var bits; /* bits in bit buffer */
  var _in, _out; /* save starting available input and output */
  var copy; /* number of stored or match bytes to copy */
  var from; /* where to copy match bytes from */
  var from_source;
  var here = 0; /* current decoding table entry */
  var here_bits, here_op, here_val; // paked "here" denormalized (JS specific)
  //var last;                   /* parent table entry */
  var last_bits, last_op, last_val; // paked "last" denormalized (JS specific)
  var len; /* length to copy for repeats, bits to drop */
  var ret; /* return code */
  var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */
  var opts;

  var n; // temporary var for NEED_BITS

  var order = /* permutation of code lengths */
  [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];

  if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0) {
    return Z_STREAM_ERROR;
  }

  state = strm.state;
  if (state.mode === TYPE) {
    state.mode = TYPEDO;
  } /* skip check */

  //--- LOAD() ---
  put = strm.next_out;
  output = strm.output;
  left = strm.avail_out;
  next = strm.next_in;
  input = strm.input;
  have = strm.avail_in;
  hold = state.hold;
  bits = state.bits;
  //---

  _in = have;
  _out = left;
  ret = Z_OK;

  inf_leave: // goto emulation
  for (;;) {
    switch (state.mode) {
      case HEAD:
        if (state.wrap === 0) {
          state.mode = TYPEDO;
          break;
        }
        //=== NEEDBITS(16);
        while (bits < 16) {
          if (have === 0) {
            break inf_leave;
          }
          have--;
          hold += input[next++] << bits;
          bits += 8;
        }
        //===//
        if (state.wrap & 2 && hold === 0x8b1f) {
          /* gzip header */
          state.check = 0 /*crc32(0L, Z_NULL, 0)*/;
          //=== CRC2(state.check, hold);
          hbuf[0] = hold & 0xff;
          hbuf[1] = hold >>> 8 & 0xff;
          state.check = crc32(state.check, hbuf, 2, 0);
          //===//

          //=== INITBITS();
          hold = 0;
          bits = 0;
          //===//
          state.mode = FLAGS;
          break;
        }
        state.flags = 0; /* expect zlib header */
        if (state.head) {
          state.head.done = false;
        }
        if (!(state.wrap & 1) || /* check if zlib header allowed */
        (((hold & 0xff) << /*BITS(8)*/8) + (hold >> 8)) % 31) {
          strm.msg = 'incorrect header check';
          state.mode = BAD;
          break;
        }
        if ((hold & 0x0f) !== /*BITS(4)*/Z_DEFLATED) {
          strm.msg = 'unknown compression method';
          state.mode = BAD;
          break;
        }
        //--- DROPBITS(4) ---//
        hold >>>= 4;
        bits -= 4;
        //---//
        len = (hold & 0x0f) + /*BITS(4)*/8;
        if (state.wbits === 0) {
          state.wbits = len;
        } else if (len > state.wbits) {
          strm.msg = 'invalid window size';
          state.mode = BAD;
          break;
        }
        state.dmax = 1 << len;
        //Tracev((stderr, "inflate:   zlib header ok\n"));
        strm.adler = state.check = 1 /*adler32(0L, Z_NULL, 0)*/;
        state.mode = hold & 0x200 ? DICTID : TYPE;
        //=== INITBITS();
        hold = 0;
        bits = 0;
        //===//
        break;
      case FLAGS:
        //=== NEEDBITS(16); */
        while (bits < 16) {
          if (have === 0) {
            break inf_leave;
          }
          have--;
          hold += input[next++] << bits;
          bits += 8;
        }
        //===//
        state.flags = hold;
        if ((state.flags & 0xff) !== Z_DEFLATED) {
          strm.msg = 'unknown compression method';
          state.mode = BAD;
          break;
        }
        if (state.flags & 0xe000) {
          strm.msg = 'unknown header flags set';
          state.mode = BAD;
          break;
        }
        if (state.head) {
          state.head.text = hold >> 8 & 1;
        }
        if (state.flags & 0x0200) {
          //=== CRC2(state.check, hold);
          hbuf[0] = hold & 0xff;
          hbuf[1] = hold >>> 8 & 0xff;
          state.check = crc32(state.check, hbuf, 2, 0);
          //===//
        }
        //=== INITBITS();
        hold = 0;
        bits = 0;
        //===//
        state.mode = TIME;
      /* falls through */
      case TIME:
        //=== NEEDBITS(32); */
        while (bits < 32) {
          if (have === 0) {
            break inf_leave;
          }
          have--;
          hold += input[next++] << bits;
          bits += 8;
        }
        //===//
        if (state.head) {
          state.head.time = hold;
        }
        if (state.flags & 0x0200) {
          //=== CRC4(state.check, hold)
          hbuf[0] = hold & 0xff;
          hbuf[1] = hold >>> 8 & 0xff;
          hbuf[2] = hold >>> 16 & 0xff;
          hbuf[3] = hold >>> 24 & 0xff;
          state.check = crc32(state.check, hbuf, 4, 0);
          //===
        }
        //=== INITBITS();
        hold = 0;
        bits = 0;
        //===//
        state.mode = OS;
      /* falls through */
      case OS:
        //=== NEEDBITS(16); */
        while (bits < 16) {
          if (have === 0) {
            break inf_leave;
          }
          have--;
          hold += input[next++] << bits;
          bits += 8;
        }
        //===//
        if (state.head) {
          state.head.xflags = hold & 0xff;
          state.head.os = hold >> 8;
        }
        if (state.flags & 0x0200) {
          //=== CRC2(state.check, hold);
          hbuf[0] = hold & 0xff;
          hbuf[1] = hold >>> 8 & 0xff;
          state.check = crc32(state.check, hbuf, 2, 0);
          //===//
        }
        //=== INITBITS();
        hold = 0;
        bits = 0;
        //===//
        state.mode = EXLEN;
      /* falls through */
      case EXLEN:
        if (state.flags & 0x0400) {
          //=== NEEDBITS(16); */
          while (bits < 16) {
            if (have === 0) {
              break inf_leave;
            }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          state.length = hold;
          if (state.head) {
            state.head.extra_len = hold;
          }
          if (state.flags & 0x0200) {
            //=== CRC2(state.check, hold);
            hbuf[0] = hold & 0xff;
            hbuf[1] = hold >>> 8 & 0xff;
            state.check = crc32(state.check, hbuf, 2, 0);
            //===//
          }
          //=== INITBITS();
          hold = 0;
          bits = 0;
          //===//
        } else if (state.head) {
          state.head.extra = null /*Z_NULL*/;
        }
        state.mode = EXTRA;
      /* falls through */
      case EXTRA:
        if (state.flags & 0x0400) {
          copy = state.length;
          if (copy > have) {
            copy = have;
          }
          if (copy) {
            if (state.head) {
              len = state.head.extra_len - state.length;
              if (!state.head.extra) {
                // Use untyped array for more convenient processing later
                state.head.extra = new Array(state.head.extra_len);
              }
              utils.arraySet(state.head.extra, input, next,
              // extra field is limited to 65536 bytes
              // - no need for additional size check
              copy,
              /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
              len);
              //zmemcpy(state.head.extra + len, next,
              //        len + copy > state.head.extra_max ?
              //        state.head.extra_max - len : copy);
            }
            if (state.flags & 0x0200) {
              state.check = crc32(state.check, input, copy, next);
            }
            have -= copy;
            next += copy;
            state.length -= copy;
          }
          if (state.length) {
            break inf_leave;
          }
        }
        state.length = 0;
        state.mode = NAME;
      /* falls through */
      case NAME:
        if (state.flags & 0x0800) {
          if (have === 0) {
            break inf_leave;
          }
          copy = 0;
          do {
            // TODO: 2 or 1 bytes?
            len = input[next + copy++];
            /* use constant limit because in js we should not preallocate memory */
            if (state.head && len && state.length < 65536 /*state.head.name_max*/) {
              state.head.name += String.fromCharCode(len);
            }
          } while (len && copy < have);

          if (state.flags & 0x0200) {
            state.check = crc32(state.check, input, copy, next);
          }
          have -= copy;
          next += copy;
          if (len) {
            break inf_leave;
          }
        } else if (state.head) {
          state.head.name = null;
        }
        state.length = 0;
        state.mode = COMMENT;
      /* falls through */
      case COMMENT:
        if (state.flags & 0x1000) {
          if (have === 0) {
            break inf_leave;
          }
          copy = 0;
          do {
            len = input[next + copy++];
            /* use constant limit because in js we should not preallocate memory */
            if (state.head && len && state.length < 65536 /*state.head.comm_max*/) {
              state.head.comment += String.fromCharCode(len);
            }
          } while (len && copy < have);
          if (state.flags & 0x0200) {
            state.check = crc32(state.check, input, copy, next);
          }
          have -= copy;
          next += copy;
          if (len) {
            break inf_leave;
          }
        } else if (state.head) {
          state.head.comment = null;
        }
        state.mode = HCRC;
      /* falls through */
      case HCRC:
        if (state.flags & 0x0200) {
          //=== NEEDBITS(16); */
          while (bits < 16) {
            if (have === 0) {
              break inf_leave;
            }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          if (hold !== (state.check & 0xffff)) {
            strm.msg = 'header crc mismatch';
            state.mode = BAD;
            break;
          }
          //=== INITBITS();
          hold = 0;
          bits = 0;
          //===//
        }
        if (state.head) {
          state.head.hcrc = state.flags >> 9 & 1;
          state.head.done = true;
        }
        strm.adler = state.check = 0;
        state.mode = TYPE;
        break;
      case DICTID:
        //=== NEEDBITS(32); */
        while (bits < 32) {
          if (have === 0) {
            break inf_leave;
          }
          have--;
          hold += input[next++] << bits;
          bits += 8;
        }
        //===//
        strm.adler = state.check = zswap32(hold);
        //=== INITBITS();
        hold = 0;
        bits = 0;
        //===//
        state.mode = DICT;
      /* falls through */
      case DICT:
        if (state.havedict === 0) {
          //--- RESTORE() ---
          strm.next_out = put;
          strm.avail_out = left;
          strm.next_in = next;
          strm.avail_in = have;
          state.hold = hold;
          state.bits = bits;
          //---
          return Z_NEED_DICT;
        }
        strm.adler = state.check = 1 /*adler32(0L, Z_NULL, 0)*/;
        state.mode = TYPE;
      /* falls through */
      case TYPE:
        if (flush === Z_BLOCK || flush === Z_TREES) {
          break inf_leave;
        }
      /* falls through */
      case TYPEDO:
        if (state.last) {
          //--- BYTEBITS() ---//
          hold >>>= bits & 7;
          bits -= bits & 7;
          //---//
          state.mode = CHECK;
          break;
        }
        //=== NEEDBITS(3); */
        while (bits < 3) {
          if (have === 0) {
            break inf_leave;
          }
          have--;
          hold += input[next++] << bits;
          bits += 8;
        }
        //===//
        state.last = hold & 0x01 /*BITS(1)*/;
        //--- DROPBITS(1) ---//
        hold >>>= 1;
        bits -= 1;
        //---//

        switch (hold & 0x03) {/*BITS(2)*/case 0:
            /* stored block */
            //Tracev((stderr, "inflate:     stored block%s\n",
            //        state.last ? " (last)" : ""));
            state.mode = STORED;
            break;
          case 1:
            /* fixed block */
            fixedtables(state);
            //Tracev((stderr, "inflate:     fixed codes block%s\n",
            //        state.last ? " (last)" : ""));
            state.mode = LEN_; /* decode codes */
            if (flush === Z_TREES) {
              //--- DROPBITS(2) ---//
              hold >>>= 2;
              bits -= 2;
              //---//
              break inf_leave;
            }
            break;
          case 2:
            /* dynamic block */
            //Tracev((stderr, "inflate:     dynamic codes block%s\n",
            //        state.last ? " (last)" : ""));
            state.mode = TABLE;
            break;
          case 3:
            strm.msg = 'invalid block type';
            state.mode = BAD;
        }
        //--- DROPBITS(2) ---//
        hold >>>= 2;
        bits -= 2;
        //---//
        break;
      case STORED:
        //--- BYTEBITS() ---// /* go to byte boundary */
        hold >>>= bits & 7;
        bits -= bits & 7;
        //---//
        //=== NEEDBITS(32); */
        while (bits < 32) {
          if (have === 0) {
            break inf_leave;
          }
          have--;
          hold += input[next++] << bits;
          bits += 8;
        }
        //===//
        if ((hold & 0xffff) !== (hold >>> 16 ^ 0xffff)) {
          strm.msg = 'invalid stored block lengths';
          state.mode = BAD;
          break;
        }
        state.length = hold & 0xffff;
        //Tracev((stderr, "inflate:       stored length %u\n",
        //        state.length));
        //=== INITBITS();
        hold = 0;
        bits = 0;
        //===//
        state.mode = COPY_;
        if (flush === Z_TREES) {
          break inf_leave;
        }
      /* falls through */
      case COPY_:
        state.mode = COPY;
      /* falls through */
      case COPY:
        copy = state.length;
        if (copy) {
          if (copy > have) {
            copy = have;
          }
          if (copy > left) {
            copy = left;
          }
          if (copy === 0) {
            break inf_leave;
          }
          //--- zmemcpy(put, next, copy); ---
          utils.arraySet(output, input, next, copy, put);
          //---//
          have -= copy;
          next += copy;
          left -= copy;
          put += copy;
          state.length -= copy;
          break;
        }
        //Tracev((stderr, "inflate:       stored end\n"));
        state.mode = TYPE;
        break;
      case TABLE:
        //=== NEEDBITS(14); */
        while (bits < 14) {
          if (have === 0) {
            break inf_leave;
          }
          have--;
          hold += input[next++] << bits;
          bits += 8;
        }
        //===//
        state.nlen = (hold & 0x1f) + /*BITS(5)*/257;
        //--- DROPBITS(5) ---//
        hold >>>= 5;
        bits -= 5;
        //---//
        state.ndist = (hold & 0x1f) + /*BITS(5)*/1;
        //--- DROPBITS(5) ---//
        hold >>>= 5;
        bits -= 5;
        //---//
        state.ncode = (hold & 0x0f) + /*BITS(4)*/4;
        //--- DROPBITS(4) ---//
        hold >>>= 4;
        bits -= 4;
        //---//
        //#ifndef PKZIP_BUG_WORKAROUND
        if (state.nlen > 286 || state.ndist > 30) {
          strm.msg = 'too many length or distance symbols';
          state.mode = BAD;
          break;
        }
        //#endif
        //Tracev((stderr, "inflate:       table sizes ok\n"));
        state.have = 0;
        state.mode = LENLENS;
      /* falls through */
      case LENLENS:
        while (state.have < state.ncode) {
          //=== NEEDBITS(3);
          while (bits < 3) {
            if (have === 0) {
              break inf_leave;
            }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          state.lens[order[state.have++]] = hold & 0x07; //BITS(3);
          //--- DROPBITS(3) ---//
          hold >>>= 3;
          bits -= 3;
          //---//
        }
        while (state.have < 19) {
          state.lens[order[state.have++]] = 0;
        }
        // We have separate tables & no pointers. 2 commented lines below not needed.
        //state.next = state.codes;
        //state.lencode = state.next;
        // Switch to use dynamic table
        state.lencode = state.lendyn;
        state.lenbits = 7;

        opts = { bits: state.lenbits };
        ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
        state.lenbits = opts.bits;

        if (ret) {
          strm.msg = 'invalid code lengths set';
          state.mode = BAD;
          break;
        }
        //Tracev((stderr, "inflate:       code lengths ok\n"));
        state.have = 0;
        state.mode = CODELENS;
      /* falls through */
      case CODELENS:
        while (state.have < state.nlen + state.ndist) {
          for (;;) {
            here = state.lencode[hold & (1 << state.lenbits) - 1]; /*BITS(state.lenbits)*/
            here_bits = here >>> 24;
            here_op = here >>> 16 & 0xff;
            here_val = here & 0xffff;

            if (here_bits <= bits) {
              break;
            }
            //--- PULLBYTE() ---//
            if (have === 0) {
              break inf_leave;
            }
            have--;
            hold += input[next++] << bits;
            bits += 8;
            //---//
          }
          if (here_val < 16) {
            //--- DROPBITS(here.bits) ---//
            hold >>>= here_bits;
            bits -= here_bits;
            //---//
            state.lens[state.have++] = here_val;
          } else {
            if (here_val === 16) {
              //=== NEEDBITS(here.bits + 2);
              n = here_bits + 2;
              while (bits < n) {
                if (have === 0) {
                  break inf_leave;
                }
                have--;
                hold += input[next++] << bits;
                bits += 8;
              }
              //===//
              //--- DROPBITS(here.bits) ---//
              hold >>>= here_bits;
              bits -= here_bits;
              //---//
              if (state.have === 0) {
                strm.msg = 'invalid bit length repeat';
                state.mode = BAD;
                break;
              }
              len = state.lens[state.have - 1];
              copy = 3 + (hold & 0x03); //BITS(2);
              //--- DROPBITS(2) ---//
              hold >>>= 2;
              bits -= 2;
              //---//
            } else if (here_val === 17) {
              //=== NEEDBITS(here.bits + 3);
              n = here_bits + 3;
              while (bits < n) {
                if (have === 0) {
                  break inf_leave;
                }
                have--;
                hold += input[next++] << bits;
                bits += 8;
              }
              //===//
              //--- DROPBITS(here.bits) ---//
              hold >>>= here_bits;
              bits -= here_bits;
              //---//
              len = 0;
              copy = 3 + (hold & 0x07); //BITS(3);
              //--- DROPBITS(3) ---//
              hold >>>= 3;
              bits -= 3;
              //---//
            } else {
              //=== NEEDBITS(here.bits + 7);
              n = here_bits + 7;
              while (bits < n) {
                if (have === 0) {
                  break inf_leave;
                }
                have--;
                hold += input[next++] << bits;
                bits += 8;
              }
              //===//
              //--- DROPBITS(here.bits) ---//
              hold >>>= here_bits;
              bits -= here_bits;
              //---//
              len = 0;
              copy = 11 + (hold & 0x7f); //BITS(7);
              //--- DROPBITS(7) ---//
              hold >>>= 7;
              bits -= 7;
              //---//
            }
            if (state.have + copy > state.nlen + state.ndist) {
              strm.msg = 'invalid bit length repeat';
              state.mode = BAD;
              break;
            }
            while (copy--) {
              state.lens[state.have++] = len;
            }
          }
        }

        /* handle error breaks in while */
        if (state.mode === BAD) {
          break;
        }

        /* check for end-of-block code (better have one) */
        if (state.lens[256] === 0) {
          strm.msg = 'invalid code -- missing end-of-block';
          state.mode = BAD;
          break;
        }

        /* build code tables -- note: do not change the lenbits or distbits
           values here (9 and 6) without reading the comments in inftrees.h
           concerning the ENOUGH constants, which depend on those values */
        state.lenbits = 9;

        opts = { bits: state.lenbits };
        ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);
        // We have separate tables & no pointers. 2 commented lines below not needed.
        // state.next_index = opts.table_index;
        state.lenbits = opts.bits;
        // state.lencode = state.next;

        if (ret) {
          strm.msg = 'invalid literal/lengths set';
          state.mode = BAD;
          break;
        }

        state.distbits = 6;
        //state.distcode.copy(state.codes);
        // Switch to use dynamic table
        state.distcode = state.distdyn;
        opts = { bits: state.distbits };
        ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
        // We have separate tables & no pointers. 2 commented lines below not needed.
        // state.next_index = opts.table_index;
        state.distbits = opts.bits;
        // state.distcode = state.next;

        if (ret) {
          strm.msg = 'invalid distances set';
          state.mode = BAD;
          break;
        }
        //Tracev((stderr, 'inflate:       codes ok\n'));
        state.mode = LEN_;
        if (flush === Z_TREES) {
          break inf_leave;
        }
      /* falls through */
      case LEN_:
        state.mode = LEN;
      /* falls through */
      case LEN:
        if (have >= 6 && left >= 258) {
          //--- RESTORE() ---
          strm.next_out = put;
          strm.avail_out = left;
          strm.next_in = next;
          strm.avail_in = have;
          state.hold = hold;
          state.bits = bits;
          //---
          inflate_fast(strm, _out);
          //--- LOAD() ---
          put = strm.next_out;
          output = strm.output;
          left = strm.avail_out;
          next = strm.next_in;
          input = strm.input;
          have = strm.avail_in;
          hold = state.hold;
          bits = state.bits;
          //---

          if (state.mode === TYPE) {
            state.back = -1;
          }
          break;
        }
        state.back = 0;
        for (;;) {
          here = state.lencode[hold & (1 << state.lenbits) - 1]; /*BITS(state.lenbits)*/
          here_bits = here >>> 24;
          here_op = here >>> 16 & 0xff;
          here_val = here & 0xffff;

          if (here_bits <= bits) {
            break;
          }
          //--- PULLBYTE() ---//
          if (have === 0) {
            break inf_leave;
          }
          have--;
          hold += input[next++] << bits;
          bits += 8;
          //---//
        }
        if (here_op && (here_op & 0xf0) === 0) {
          last_bits = here_bits;
          last_op = here_op;
          last_val = here_val;
          for (;;) {
            here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> /*BITS(last.bits + last.op)*/last_bits)];
            here_bits = here >>> 24;
            here_op = here >>> 16 & 0xff;
            here_val = here & 0xffff;

            if (last_bits + here_bits <= bits) {
              break;
            }
            //--- PULLBYTE() ---//
            if (have === 0) {
              break inf_leave;
            }
            have--;
            hold += input[next++] << bits;
            bits += 8;
            //---//
          }
          //--- DROPBITS(last.bits) ---//
          hold >>>= last_bits;
          bits -= last_bits;
          //---//
          state.back += last_bits;
        }
        //--- DROPBITS(here.bits) ---//
        hold >>>= here_bits;
        bits -= here_bits;
        //---//
        state.back += here_bits;
        state.length = here_val;
        if (here_op === 0) {
          //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
          //        "inflate:         literal '%c'\n" :
          //        "inflate:         literal 0x%02x\n", here.val));
          state.mode = LIT;
          break;
        }
        if (here_op & 32) {
          //Tracevv((stderr, "inflate:         end of block\n"));
          state.back = -1;
          state.mode = TYPE;
          break;
        }
        if (here_op & 64) {
          strm.msg = 'invalid literal/length code';
          state.mode = BAD;
          break;
        }
        state.extra = here_op & 15;
        state.mode = LENEXT;
      /* falls through */
      case LENEXT:
        if (state.extra) {
          //=== NEEDBITS(state.extra);
          n = state.extra;
          while (bits < n) {
            if (have === 0) {
              break inf_leave;
            }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          state.length += hold & (1 << state.extra) - 1 /*BITS(state.extra)*/;
          //--- DROPBITS(state.extra) ---//
          hold >>>= state.extra;
          bits -= state.extra;
          //---//
          state.back += state.extra;
        }
        //Tracevv((stderr, "inflate:         length %u\n", state.length));
        state.was = state.length;
        state.mode = DIST;
      /* falls through */
      case DIST:
        for (;;) {
          here = state.distcode[hold & (1 << state.distbits) - 1]; /*BITS(state.distbits)*/
          here_bits = here >>> 24;
          here_op = here >>> 16 & 0xff;
          here_val = here & 0xffff;

          if (here_bits <= bits) {
            break;
          }
          //--- PULLBYTE() ---//
          if (have === 0) {
            break inf_leave;
          }
          have--;
          hold += input[next++] << bits;
          bits += 8;
          //---//
        }
        if ((here_op & 0xf0) === 0) {
          last_bits = here_bits;
          last_op = here_op;
          last_val = here_val;
          for (;;) {
            here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> /*BITS(last.bits + last.op)*/last_bits)];
            here_bits = here >>> 24;
            here_op = here >>> 16 & 0xff;
            here_val = here & 0xffff;

            if (last_bits + here_bits <= bits) {
              break;
            }
            //--- PULLBYTE() ---//
            if (have === 0) {
              break inf_leave;
            }
            have--;
            hold += input[next++] << bits;
            bits += 8;
            //---//
          }
          //--- DROPBITS(last.bits) ---//
          hold >>>= last_bits;
          bits -= last_bits;
          //---//
          state.back += last_bits;
        }
        //--- DROPBITS(here.bits) ---//
        hold >>>= here_bits;
        bits -= here_bits;
        //---//
        state.back += here_bits;
        if (here_op & 64) {
          strm.msg = 'invalid distance code';
          state.mode = BAD;
          break;
        }
        state.offset = here_val;
        state.extra = here_op & 15;
        state.mode = DISTEXT;
      /* falls through */
      case DISTEXT:
        if (state.extra) {
          //=== NEEDBITS(state.extra);
          n = state.extra;
          while (bits < n) {
            if (have === 0) {
              break inf_leave;
            }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          state.offset += hold & (1 << state.extra) - 1 /*BITS(state.extra)*/;
          //--- DROPBITS(state.extra) ---//
          hold >>>= state.extra;
          bits -= state.extra;
          //---//
          state.back += state.extra;
        }
        //#ifdef INFLATE_STRICT
        if (state.offset > state.dmax) {
          strm.msg = 'invalid distance too far back';
          state.mode = BAD;
          break;
        }
        //#endif
        //Tracevv((stderr, "inflate:         distance %u\n", state.offset));
        state.mode = MATCH;
      /* falls through */
      case MATCH:
        if (left === 0) {
          break inf_leave;
        }
        copy = _out - left;
        if (state.offset > copy) {
          /* copy from window */
          copy = state.offset - copy;
          if (copy > state.whave) {
            if (state.sane) {
              strm.msg = 'invalid distance too far back';
              state.mode = BAD;
              break;
            }
            // (!) This block is disabled in zlib defaults,
            // don't enable it for binary compatibility
            //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
            //          Trace((stderr, "inflate.c too far\n"));
            //          copy -= state.whave;
            //          if (copy > state.length) { copy = state.length; }
            //          if (copy > left) { copy = left; }
            //          left -= copy;
            //          state.length -= copy;
            //          do {
            //            output[put++] = 0;
            //          } while (--copy);
            //          if (state.length === 0) { state.mode = LEN; }
            //          break;
            //#endif
          }
          if (copy > state.wnext) {
            copy -= state.wnext;
            from = state.wsize - copy;
          } else {
            from = state.wnext - copy;
          }
          if (copy > state.length) {
            copy = state.length;
          }
          from_source = state.window;
        } else {
          /* copy from output */
          from_source = output;
          from = put - state.offset;
          copy = state.length;
        }
        if (copy > left) {
          copy = left;
        }
        left -= copy;
        state.length -= copy;
        do {
          output[put++] = from_source[from++];
        } while (--copy);
        if (state.length === 0) {
          state.mode = LEN;
        }
        break;
      case LIT:
        if (left === 0) {
          break inf_leave;
        }
        output[put++] = state.length;
        left--;
        state.mode = LEN;
        break;
      case CHECK:
        if (state.wrap) {
          //=== NEEDBITS(32);
          while (bits < 32) {
            if (have === 0) {
              break inf_leave;
            }
            have--;
            // Use '|' instead of '+' to make sure that result is signed
            hold |= input[next++] << bits;
            bits += 8;
          }
          //===//
          _out -= left;
          strm.total_out += _out;
          state.total += _out;
          if (_out) {
            strm.adler = state.check =
            /*UPDATE(state.check, put - _out, _out);*/
            state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out);
          }
          _out = left;
          // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too
          if ((state.flags ? hold : zswap32(hold)) !== state.check) {
            strm.msg = 'incorrect data check';
            state.mode = BAD;
            break;
          }
          //=== INITBITS();
          hold = 0;
          bits = 0;
          //===//
          //Tracev((stderr, "inflate:   check matches trailer\n"));
        }
        state.mode = LENGTH;
      /* falls through */
      case LENGTH:
        if (state.wrap && state.flags) {
          //=== NEEDBITS(32);
          while (bits < 32) {
            if (have === 0) {
              break inf_leave;
            }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          if (hold !== (state.total & 0xffffffff)) {
            strm.msg = 'incorrect length check';
            state.mode = BAD;
            break;
          }
          //=== INITBITS();
          hold = 0;
          bits = 0;
          //===//
          //Tracev((stderr, "inflate:   length matches trailer\n"));
        }
        state.mode = DONE;
      /* falls through */
      case DONE:
        ret = Z_STREAM_END;
        break inf_leave;
      case BAD:
        ret = Z_DATA_ERROR;
        break inf_leave;
      case MEM:
        return Z_MEM_ERROR;
      case SYNC:
      /* falls through */
      default:
        return Z_STREAM_ERROR;
    }
  }

  // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave"

  /*
     Return from inflate(), updating the total counts and the check value.
     If there was no progress during the inflate() call, return a buffer
     error.  Call updatewindow() to create and/or update the window state.
     Note: a memory error from inflate() is non-recoverable.
   */

  //--- RESTORE() ---
  strm.next_out = put;
  strm.avail_out = left;
  strm.next_in = next;
  strm.avail_in = have;
  state.hold = hold;
  state.bits = bits;
  //---

  if (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH)) {
    if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {
      state.mode = MEM;
      return Z_MEM_ERROR;
    }
  }
  _in -= strm.avail_in;
  _out -= strm.avail_out;
  strm.total_in += _in;
  strm.total_out += _out;
  state.total += _out;
  if (state.wrap && _out) {
    strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
    state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out);
  }
  strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
  if ((_in === 0 && _out === 0 || flush === Z_FINISH) && ret === Z_OK) {
    ret = Z_BUF_ERROR;
  }
  return ret;
}

function inflateEnd(strm) {

  if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {
      return Z_STREAM_ERROR;
    }

  var state = strm.state;
  if (state.window) {
    state.window = null;
  }
  strm.state = null;
  return Z_OK;
}

function inflateGetHeader(strm, head) {
  var state;

  /* check state */
  if (!strm || !strm.state) {
    return Z_STREAM_ERROR;
  }
  state = strm.state;
  if ((state.wrap & 2) === 0) {
    return Z_STREAM_ERROR;
  }

  /* save header structure */
  state.head = head;
  head.done = false;
  return Z_OK;
}

function inflateSetDictionary(strm, dictionary) {
  var dictLength = dictionary.length;

  var state;
  var dictid;
  var ret;

  /* check state */
  if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) {
      return Z_STREAM_ERROR;
    }
  state = strm.state;

  if (state.wrap !== 0 && state.mode !== DICT) {
    return Z_STREAM_ERROR;
  }

  /* check for correct dictionary identifier */
  if (state.mode === DICT) {
    dictid = 1; /* adler32(0, null, 0)*/
    /* dictid = adler32(dictid, dictionary, dictLength); */
    dictid = adler32(dictid, dictionary, dictLength, 0);
    if (dictid !== state.check) {
      return Z_DATA_ERROR;
    }
  }
  /* copy dictionary to window using updatewindow(), which will amend the
   existing dictionary if appropriate */
  ret = updatewindow(strm, dictionary, dictLength, dictLength);
  if (ret) {
    state.mode = MEM;
    return Z_MEM_ERROR;
  }
  state.havedict = 1;
  // Tracev((stderr, "inflate:   dictionary set\n"));
  return Z_OK;
}

exports.inflateReset = inflateReset;
exports.inflateReset2 = inflateReset2;
exports.inflateResetKeep = inflateResetKeep;
exports.inflateInit = inflateInit;
exports.inflateInit2 = inflateInit2;
exports.inflate = inflate;
exports.inflateEnd = inflateEnd;
exports.inflateGetHeader = inflateGetHeader;
exports.inflateSetDictionary = inflateSetDictionary;
exports.inflateInfo = 'pako inflate (from Nodeca project)';

/* Not implemented
exports.inflateCopy = inflateCopy;
exports.inflateGetDictionary = inflateGetDictionary;
exports.inflateMark = inflateMark;
exports.inflatePrime = inflatePrime;
exports.inflateSync = inflateSync;
exports.inflateSyncPoint = inflateSyncPoint;
exports.inflateUndermine = inflateUndermine;
*/

/***/ }),
/* 461 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// (C) 1995-2013 Jean-loup Gailly and Mark Adler
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//   claim that you wrote the original software. If you use this software
//   in a product, an acknowledgment in the product documentation would be
//   appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
//   misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.

// See state defs from inflate.js

var BAD = 30; /* got a data error -- remain here until reset */
var TYPE = 12; /* i: waiting for type bits, including last-flag bit */

/*
   Decode literal, length, and distance codes and write out the resulting
   literal and match bytes until either not enough input or output is
   available, an end-of-block is encountered, or a data error is encountered.
   When large enough input and output buffers are supplied to inflate(), for
   example, a 16K input buffer and a 64K output buffer, more than 95% of the
   inflate execution time is spent in this routine.

   Entry assumptions:

        state.mode === LEN
        strm.avail_in >= 6
        strm.avail_out >= 258
        start >= strm.avail_out
        state.bits < 8

   On return, state.mode is one of:

        LEN -- ran out of enough output space or enough available input
        TYPE -- reached end of block code, inflate() to interpret next block
        BAD -- error in block data

   Notes:

    - The maximum input bits used by a length/distance pair is 15 bits for the
      length code, 5 bits for the length extra, 15 bits for the distance code,
      and 13 bits for the distance extra.  This totals 48 bits, or six bytes.
      Therefore if strm.avail_in >= 6, then there is enough input to avoid
      checking for available input while decoding.

    - The maximum bytes that a single length/distance pair can output is 258
      bytes, which is the maximum length that can be coded.  inflate_fast()
      requires strm.avail_out >= 258 for each loop to avoid checking for
      output space.
 */
module.exports = function inflate_fast(strm, start) {
  var state;
  var _in; /* local strm.input */
  var last; /* have enough input while in < last */
  var _out; /* local strm.output */
  var beg; /* inflate()'s initial strm.output */
  var end; /* while out < end, enough space available */
  //#ifdef INFLATE_STRICT
  var dmax; /* maximum distance from zlib header */
  //#endif
  var wsize; /* window size or zero if not using window */
  var whave; /* valid bytes in the window */
  var wnext; /* window write index */
  // Use `s_window` instead `window`, avoid conflict with instrumentation tools
  var s_window; /* allocated sliding window, if wsize != 0 */
  var hold; /* local strm.hold */
  var bits; /* local strm.bits */
  var lcode; /* local strm.lencode */
  var dcode; /* local strm.distcode */
  var lmask; /* mask for first level of length codes */
  var dmask; /* mask for first level of distance codes */
  var here; /* retrieved table entry */
  var op; /* code bits, operation, extra bits, or */
  /*  window position, window bytes to copy */
  var len; /* match length, unused bytes */
  var dist; /* match distance */
  var from; /* where to copy match from */
  var from_source;

  var input, output; // JS specific, because we have no pointers

  /* copy state to local variables */
  state = strm.state;
  //here = state.here;
  _in = strm.next_in;
  input = strm.input;
  last = _in + (strm.avail_in - 5);
  _out = strm.next_out;
  output = strm.output;
  beg = _out - (start - strm.avail_out);
  end = _out + (strm.avail_out - 257);
  //#ifdef INFLATE_STRICT
  dmax = state.dmax;
  //#endif
  wsize = state.wsize;
  whave = state.whave;
  wnext = state.wnext;
  s_window = state.window;
  hold = state.hold;
  bits = state.bits;
  lcode = state.lencode;
  dcode = state.distcode;
  lmask = (1 << state.lenbits) - 1;
  dmask = (1 << state.distbits) - 1;

  /* decode literals and length/distances until end-of-block or not enough
     input data or output space */

  top: do {
    if (bits < 15) {
      hold += input[_in++] << bits;
      bits += 8;
      hold += input[_in++] << bits;
      bits += 8;
    }

    here = lcode[hold & lmask];

    dolen: for (;;) {
      // Goto emulation
      op = here >>> 24 /*here.bits*/;
      hold >>>= op;
      bits -= op;
      op = here >>> 16 & 0xff /*here.op*/;
      if (op === 0) {
        /* literal */
        //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
        //        "inflate:         literal '%c'\n" :
        //        "inflate:         literal 0x%02x\n", here.val));
        output[_out++] = here & 0xffff /*here.val*/;
      } else if (op & 16) {
        /* length base */
        len = here & 0xffff /*here.val*/;
        op &= 15; /* number of extra bits */
        if (op) {
          if (bits < op) {
            hold += input[_in++] << bits;
            bits += 8;
          }
          len += hold & (1 << op) - 1;
          hold >>>= op;
          bits -= op;
        }
        //Tracevv((stderr, "inflate:         length %u\n", len));
        if (bits < 15) {
          hold += input[_in++] << bits;
          bits += 8;
          hold += input[_in++] << bits;
          bits += 8;
        }
        here = dcode[hold & dmask];

        dodist: for (;;) {
          // goto emulation
          op = here >>> 24 /*here.bits*/;
          hold >>>= op;
          bits -= op;
          op = here >>> 16 & 0xff /*here.op*/;

          if (op & 16) {
            /* distance base */
            dist = here & 0xffff /*here.val*/;
            op &= 15; /* number of extra bits */
            if (bits < op) {
              hold += input[_in++] << bits;
              bits += 8;
              if (bits < op) {
                hold += input[_in++] << bits;
                bits += 8;
              }
            }
            dist += hold & (1 << op) - 1;
            //#ifdef INFLATE_STRICT
            if (dist > dmax) {
              strm.msg = 'invalid distance too far back';
              state.mode = BAD;
              break top;
            }
            //#endif
            hold >>>= op;
            bits -= op;
            //Tracevv((stderr, "inflate:         distance %u\n", dist));
            op = _out - beg; /* max distance in output */
            if (dist > op) {
              /* see if copy from window */
              op = dist - op; /* distance back in window */
              if (op > whave) {
                if (state.sane) {
                  strm.msg = 'invalid distance too far back';
                  state.mode = BAD;
                  break top;
                }

                // (!) This block is disabled in zlib defaults,
                // don't enable it for binary compatibility
                //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
                //                if (len <= op - whave) {
                //                  do {
                //                    output[_out++] = 0;
                //                  } while (--len);
                //                  continue top;
                //                }
                //                len -= op - whave;
                //                do {
                //                  output[_out++] = 0;
                //                } while (--op > whave);
                //                if (op === 0) {
                //                  from = _out - dist;
                //                  do {
                //                    output[_out++] = output[from++];
                //                  } while (--len);
                //                  continue top;
                //                }
                //#endif
              }
              from = 0; // window index
              from_source = s_window;
              if (wnext === 0) {
                /* very common case */
                from += wsize - op;
                if (op < len) {
                  /* some from window */
                  len -= op;
                  do {
                    output[_out++] = s_window[from++];
                  } while (--op);
                  from = _out - dist; /* rest from output */
                  from_source = output;
                }
              } else if (wnext < op) {
                /* wrap around window */
                from += wsize + wnext - op;
                op -= wnext;
                if (op < len) {
                  /* some from end of window */
                  len -= op;
                  do {
                    output[_out++] = s_window[from++];
                  } while (--op);
                  from = 0;
                  if (wnext < len) {
                    /* some from start of window */
                    op = wnext;
                    len -= op;
                    do {
                      output[_out++] = s_window[from++];
                    } while (--op);
                    from = _out - dist; /* rest from output */
                    from_source = output;
                  }
                }
              } else {
                /* contiguous in window */
                from += wnext - op;
                if (op < len) {
                  /* some from window */
                  len -= op;
                  do {
                    output[_out++] = s_window[from++];
                  } while (--op);
                  from = _out - dist; /* rest from output */
                  from_source = output;
                }
              }
              while (len > 2) {
                output[_out++] = from_source[from++];
                output[_out++] = from_source[from++];
                output[_out++] = from_source[from++];
                len -= 3;
              }
              if (len) {
                output[_out++] = from_source[from++];
                if (len > 1) {
                  output[_out++] = from_source[from++];
                }
              }
            } else {
              from = _out - dist; /* copy direct from output */
              do {
                /* minimum length is three */
                output[_out++] = output[from++];
                output[_out++] = output[from++];
                output[_out++] = output[from++];
                len -= 3;
              } while (len > 2);
              if (len) {
                output[_out++] = output[from++];
                if (len > 1) {
                  output[_out++] = output[from++];
                }
              }
            }
          } else if ((op & 64) === 0) {
            /* 2nd level distance code */
            here = dcode[(here & 0xffff) + ( /*here.val*/hold & (1 << op) - 1)];
            continue dodist;
          } else {
            strm.msg = 'invalid distance code';
            state.mode = BAD;
            break top;
          }

          break; // need to emulate goto via "continue"
        }
      } else if ((op & 64) === 0) {
        /* 2nd level length code */
        here = lcode[(here & 0xffff) + ( /*here.val*/hold & (1 << op) - 1)];
        continue dolen;
      } else if (op & 32) {
        /* end-of-block */
        //Tracevv((stderr, "inflate:         end of block\n"));
        state.mode = TYPE;
        break top;
      } else {
        strm.msg = 'invalid literal/length code';
        state.mode = BAD;
        break top;
      }

      break; // need to emulate goto via "continue"
    }
  } while (_in < last && _out < end);

  /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  len = bits >> 3;
  _in -= len;
  bits -= len << 3;
  hold &= (1 << bits) - 1;

  /* update state and return */
  strm.next_in = _in;
  strm.next_out = _out;
  strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last);
  strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end);
  state.hold = hold;
  state.bits = bits;
  return;
};

/***/ }),
/* 462 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// (C) 1995-2013 Jean-loup Gailly and Mark Adler
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//   claim that you wrote the original software. If you use this software
//   in a product, an acknowledgment in the product documentation would be
//   appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
//   misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.

var utils = __webpack_require__(42);

var MAXBITS = 15;
var ENOUGH_LENS = 852;
var ENOUGH_DISTS = 592;
//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);

var CODES = 0;
var LENS = 1;
var DISTS = 2;

var lbase = [/* Length codes 257..285 base */
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0];

var lext = [/* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78];

var dbase = [/* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0];

var dext = [/* Distance codes 0..29 extra */
16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64];

module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) {
  var bits = opts.bits;
  //here = opts.here; /* table entry for duplication */

  var len = 0; /* a code's length in bits */
  var sym = 0; /* index of code symbols */
  var min = 0,
      max = 0; /* minimum and maximum code lengths */
  var root = 0; /* number of index bits for root table */
  var curr = 0; /* number of index bits for current table */
  var drop = 0; /* code bits to drop for sub-table */
  var left = 0; /* number of prefix codes available */
  var used = 0; /* code entries in table used */
  var huff = 0; /* Huffman code */
  var incr; /* for incrementing code, index */
  var fill; /* index for replicating entries */
  var low; /* low bits for current root entry */
  var mask; /* mask for low root bits */
  var next; /* next available space in table */
  var base = null; /* base value table to use */
  var base_index = 0;
  //  var shoextra;    /* extra bits table to use */
  var end; /* use base and extra for symbol > end */
  var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1];    /* number of codes of each length */
  var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1];     /* offsets in table for each length */
  var extra = null;
  var extra_index = 0;

  var here_bits, here_op, here_val;

  /*
   Process a set of code lengths to create a canonical Huffman code.  The
   code lengths are lens[0..codes-1].  Each length corresponds to the
   symbols 0..codes-1.  The Huffman code is generated by first sorting the
   symbols by length from short to long, and retaining the symbol order
   for codes with equal lengths.  Then the code starts with all zero bits
   for the first code of the shortest length, and the codes are integer
   increments for the same length, and zeros are appended as the length
   increases.  For the deflate format, these bits are stored backwards
   from their more natural integer increment ordering, and so when the
   decoding tables are built in the large loop below, the integer codes
   are incremented backwards.
    This routine assumes, but does not check, that all of the entries in
   lens[] are in the range 0..MAXBITS.  The caller must assure this.
   1..MAXBITS is interpreted as that code length.  zero means that that
   symbol does not occur in this code.
    The codes are sorted by computing a count of codes for each length,
   creating from that a table of starting indices for each length in the
   sorted table, and then entering the symbols in order in the sorted
   table.  The sorted table is work[], with that space being provided by
   the caller.
    The length counts are used for other purposes as well, i.e. finding
   the minimum and maximum length codes, determining if there are any
   codes at all, checking for a valid set of lengths, and looking ahead
   at length counts to determine sub-table sizes when building the
   decoding tables.
   */

  /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
  for (len = 0; len <= MAXBITS; len++) {
    count[len] = 0;
  }
  for (sym = 0; sym < codes; sym++) {
    count[lens[lens_index + sym]]++;
  }

  /* bound code lengths, force root to be within code lengths */
  root = bits;
  for (max = MAXBITS; max >= 1; max--) {
    if (count[max] !== 0) {
      break;
    }
  }
  if (root > max) {
    root = max;
  }
  if (max === 0) {
    /* no symbols to code at all */
    //table.op[opts.table_index] = 64;  //here.op = (var char)64;    /* invalid code marker */
    //table.bits[opts.table_index] = 1;   //here.bits = (var char)1;
    //table.val[opts.table_index++] = 0;   //here.val = (var short)0;
    table[table_index++] = 1 << 24 | 64 << 16 | 0;

    //table.op[opts.table_index] = 64;
    //table.bits[opts.table_index] = 1;
    //table.val[opts.table_index++] = 0;
    table[table_index++] = 1 << 24 | 64 << 16 | 0;

    opts.bits = 1;
    return 0; /* no symbols, but wait for decoding to report error */
  }
  for (min = 1; min < max; min++) {
    if (count[min] !== 0) {
      break;
    }
  }
  if (root < min) {
    root = min;
  }

  /* check for an over-subscribed or incomplete set of lengths */
  left = 1;
  for (len = 1; len <= MAXBITS; len++) {
    left <<= 1;
    left -= count[len];
    if (left < 0) {
      return -1;
    } /* over-subscribed */
  }
  if (left > 0 && (type === CODES || max !== 1)) {
    return -1; /* incomplete set */
  }

  /* generate offsets into symbol table for each length for sorting */
  offs[1] = 0;
  for (len = 1; len < MAXBITS; len++) {
    offs[len + 1] = offs[len] + count[len];
  }

  /* sort symbols by length, by symbol order within each length */
  for (sym = 0; sym < codes; sym++) {
    if (lens[lens_index + sym] !== 0) {
      work[offs[lens[lens_index + sym]]++] = sym;
    }
  }

  /*
   Create and fill in decoding tables.  In this loop, the table being
   filled is at next and has curr index bits.  The code being used is huff
   with length len.  That code is converted to an index by dropping drop
   bits off of the bottom.  For codes where len is less than drop + curr,
   those top drop + curr - len bits are incremented through all values to
   fill the table with replicated entries.
    root is the number of index bits for the root table.  When len exceeds
   root, sub-tables are created pointed to by the root entry with an index
   of the low root bits of huff.  This is saved in low to check for when a
   new sub-table should be started.  drop is zero when the root table is
   being filled, and drop is root when sub-tables are being filled.
    When a new sub-table is needed, it is necessary to look ahead in the
   code lengths to determine what size sub-table is needed.  The length
   counts are used for this, and so count[] is decremented as codes are
   entered in the tables.
    used keeps track of how many table entries have been allocated from the
   provided *table space.  It is checked for LENS and DIST tables against
   the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
   the initial root table size constants.  See the comments in inftrees.h
   for more information.
    sym increments through all symbols, and the loop terminates when
   all codes of length max, i.e. all codes, have been processed.  This
   routine permits incomplete codes, so another loop after this one fills
   in the rest of the decoding tables with invalid code markers.
   */

  /* set up for code type */
  // poor man optimization - use if-else instead of switch,
  // to avoid deopts in old v8
  if (type === CODES) {
    base = extra = work; /* dummy value--not used */
    end = 19;
  } else if (type === LENS) {
    base = lbase;
    base_index -= 257;
    extra = lext;
    extra_index -= 257;
    end = 256;
  } else {
    /* DISTS */
    base = dbase;
    extra = dext;
    end = -1;
  }

  /* initialize opts for loop */
  huff = 0; /* starting code */
  sym = 0; /* starting code symbol */
  len = min; /* starting code length */
  next = table_index; /* current table to fill in */
  curr = root; /* current table index bits */
  drop = 0; /* current bits to drop from code for index */
  low = -1; /* trigger new sub-table when len > root */
  used = 1 << root; /* use root table entries */
  mask = used - 1; /* mask for comparing low */

  /* check available table space */
  if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {
    return 1;
  }

  /* process all codes and make table entries */
  for (;;) {
    /* create table entry */
    here_bits = len - drop;
    if (work[sym] < end) {
      here_op = 0;
      here_val = work[sym];
    } else if (work[sym] > end) {
      here_op = extra[extra_index + work[sym]];
      here_val = base[base_index + work[sym]];
    } else {
      here_op = 32 + 64; /* end of block */
      here_val = 0;
    }

    /* replicate for those indices with low len bits equal to huff */
    incr = 1 << len - drop;
    fill = 1 << curr;
    min = fill; /* save offset to next table */
    do {
      fill -= incr;
      table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;
    } while (fill !== 0);

    /* backwards increment the len-bit code huff */
    incr = 1 << len - 1;
    while (huff & incr) {
      incr >>= 1;
    }
    if (incr !== 0) {
      huff &= incr - 1;
      huff += incr;
    } else {
      huff = 0;
    }

    /* go to next symbol, update count, len */
    sym++;
    if (--count[len] === 0) {
      if (len === max) {
        break;
      }
      len = lens[lens_index + work[sym]];
    }

    /* create new sub-table if needed */
    if (len > root && (huff & mask) !== low) {
      /* if first time, transition to sub-tables */
      if (drop === 0) {
        drop = root;
      }

      /* increment past last table */
      next += min; /* here min is 1 << curr */

      /* determine length of next table */
      curr = len - drop;
      left = 1 << curr;
      while (curr + drop < max) {
        left -= count[curr + drop];
        if (left <= 0) {
          break;
        }
        curr++;
        left <<= 1;
      }

      /* check for enough space */
      used += 1 << curr;
      if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {
        return 1;
      }

      /* point entry in root table to sub-table */
      low = huff & mask;
      /*table.op[low] = curr;
      table.bits[low] = root;
      table.val[low] = next - opts.table_index;*/
      table[low] = root << 24 | curr << 16 | next - table_index | 0;
    }
  }

  /* fill in remaining table entry if code is incomplete (guaranteed to have
   at most one remaining entry, since if the code is incomplete, the
   maximum code length that was allowed to get this far is one bit) */
  if (huff !== 0) {
    //table.op[next + huff] = 64;            /* invalid code marker */
    //table.bits[next + huff] = len - drop;
    //table.val[next + huff] = 0;
    table[next + huff] = len - drop << 24 | 64 << 16 | 0;
  }

  /* set return parameters */
  //opts.table_index += used;
  opts.bits = root;
  return 0;
};

/***/ }),
/* 463 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// (C) 1995-2013 Jean-loup Gailly and Mark Adler
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//   claim that you wrote the original software. If you use this software
//   in a product, an acknowledgment in the product documentation would be
//   appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
//   misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.

function GZheader() {
  /* true if compressed data believed to be text */
  this.text = 0;
  /* modification time */
  this.time = 0;
  /* extra flags (not used when writing a gzip file) */
  this.xflags = 0;
  /* operating system */
  this.os = 0;
  /* pointer to extra field or Z_NULL if none */
  this.extra = null;
  /* extra field length (valid if extra != Z_NULL) */
  this.extra_len = 0; // Actually, we don't need it in JS,
  // but leave for few code modifications

  //
  // Setup limits is not necessary because in js we should not preallocate memory
  // for inflate use constant limit in 65536 bytes
  //

  /* space at extra (only when reading header) */
  // this.extra_max  = 0;
  /* pointer to zero-terminated file name or Z_NULL */
  this.name = '';
  /* space at name (only when reading header) */
  // this.name_max   = 0;
  /* pointer to zero-terminated comment or Z_NULL */
  this.comment = '';
  /* space at comment (only when reading header) */
  // this.comm_max   = 0;
  /* true if there was or will be a header crc */
  this.hcrc = 0;
  /* true when done reading gzip header (not used when writing a gzip file) */
  this.done = false;
}

module.exports = GZheader;

/***/ }),
/* 464 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var utils = __webpack_require__(9);
var GenericWorker = __webpack_require__(23);
var utf8 = __webpack_require__(63);
var crc32 = __webpack_require__(133);
var signature = __webpack_require__(199);

/**
 * Transform an integer into a string in hexadecimal.
 * @private
 * @param {number} dec the number to convert.
 * @param {number} bytes the number of bytes to generate.
 * @returns {string} the result.
 */
var decToHex = function decToHex(dec, bytes) {
    var hex = "",
        i;
    for (i = 0; i < bytes; i++) {
        hex += String.fromCharCode(dec & 0xff);
        dec = dec >>> 8;
    }
    return hex;
};

/**
 * Generate the UNIX part of the external file attributes.
 * @param {Object} unixPermissions the unix permissions or null.
 * @param {Boolean} isDir true if the entry is a directory, false otherwise.
 * @return {Number} a 32 bit integer.
 *
 * adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute :
 *
 * TTTTsstrwxrwxrwx0000000000ADVSHR
 * ^^^^____________________________ file type, see zipinfo.c (UNX_*)
 *     ^^^_________________________ setuid, setgid, sticky
 *        ^^^^^^^^^________________ permissions
 *                 ^^^^^^^^^^______ not used ?
 *                           ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only
 */
var generateUnixExternalFileAttr = function generateUnixExternalFileAttr(unixPermissions, isDir) {

    var result = unixPermissions;
    if (!unixPermissions) {
        // I can't use octal values in strict mode, hence the hexa.
        //  040775 => 0x41fd
        // 0100664 => 0x81b4
        result = isDir ? 0x41fd : 0x81b4;
    }
    return (result & 0xFFFF) << 16;
};

/**
 * Generate the DOS part of the external file attributes.
 * @param {Object} dosPermissions the dos permissions or null.
 * @param {Boolean} isDir true if the entry is a directory, false otherwise.
 * @return {Number} a 32 bit integer.
 *
 * Bit 0     Read-Only
 * Bit 1     Hidden
 * Bit 2     System
 * Bit 3     Volume Label
 * Bit 4     Directory
 * Bit 5     Archive
 */
var generateDosExternalFileAttr = function generateDosExternalFileAttr(dosPermissions, isDir) {

    // the dir flag is already set for compatibility
    return (dosPermissions || 0) & 0x3F;
};

/**
 * Generate the various parts used in the construction of the final zip file.
 * @param {Object} streamInfo the hash with informations about the compressed file.
 * @param {Boolean} streamedContent is the content streamed ?
 * @param {Boolean} streamingEnded is the stream finished ?
 * @param {number} offset the current offset from the start of the zip file.
 * @param {String} platform let's pretend we are this platform (change platform dependents fields)
 * @param {Function} encodeFileName the function to encode the file name / comment.
 * @return {Object} the zip parts.
 */
var generateZipParts = function generateZipParts(streamInfo, streamedContent, streamingEnded, offset, platform, encodeFileName) {
    var file = streamInfo['file'],
        compression = streamInfo['compression'],
        useCustomEncoding = encodeFileName !== utf8.utf8encode,
        encodedFileName = utils.transformTo("string", encodeFileName(file.name)),
        utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)),
        comment = file.comment,
        encodedComment = utils.transformTo("string", encodeFileName(comment)),
        utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)),
        useUTF8ForFileName = utfEncodedFileName.length !== file.name.length,
        useUTF8ForComment = utfEncodedComment.length !== comment.length,
        dosTime,
        dosDate,
        extraFields = "",
        unicodePathExtraField = "",
        unicodeCommentExtraField = "",
        dir = file.dir,
        date = file.date;

    var dataInfo = {
        crc32: 0,
        compressedSize: 0,
        uncompressedSize: 0
    };

    // if the content is streamed, the sizes/crc32 are only available AFTER
    // the end of the stream.
    if (!streamedContent || streamingEnded) {
        dataInfo.crc32 = streamInfo['crc32'];
        dataInfo.compressedSize = streamInfo['compressedSize'];
        dataInfo.uncompressedSize = streamInfo['uncompressedSize'];
    }

    var bitflag = 0;
    if (streamedContent) {
        // Bit 3: the sizes/crc32 are set to zero in the local header.
        // The correct values are put in the data descriptor immediately
        // following the compressed data.
        bitflag |= 0x0008;
    }
    if (!useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment)) {
        // Bit 11: Language encoding flag (EFS).
        bitflag |= 0x0800;
    }

    var extFileAttr = 0;
    var versionMadeBy = 0;
    if (dir) {
        // dos or unix, we set the dos dir flag
        extFileAttr |= 0x00010;
    }
    if (platform === "UNIX") {
        versionMadeBy = 0x031E; // UNIX, version 3.0
        extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir);
    } else {
        // DOS or other, fallback to DOS
        versionMadeBy = 0x0014; // DOS, version 2.0
        extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir);
    }

    // date
    // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html
    // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html
    // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html

    dosTime = date.getUTCHours();
    dosTime = dosTime << 6;
    dosTime = dosTime | date.getUTCMinutes();
    dosTime = dosTime << 5;
    dosTime = dosTime | date.getUTCSeconds() / 2;

    dosDate = date.getUTCFullYear() - 1980;
    dosDate = dosDate << 4;
    dosDate = dosDate | date.getUTCMonth() + 1;
    dosDate = dosDate << 5;
    dosDate = dosDate | date.getUTCDate();

    if (useUTF8ForFileName) {
        // set the unicode path extra field. unzip needs at least one extra
        // field to correctly handle unicode path, so using the path is as good
        // as any other information. This could improve the situation with
        // other archive managers too.
        // This field is usually used without the utf8 flag, with a non
        // unicode path in the header (winrar, winzip). This helps (a bit)
        // with the messy Windows' default compressed folders feature but
        // breaks on p7zip which doesn't seek the unicode path extra field.
        // So for now, UTF-8 everywhere !
        unicodePathExtraField =
        // Version
        decToHex(1, 1) +
        // NameCRC32
        decToHex(crc32(encodedFileName), 4) +
        // UnicodeName
        utfEncodedFileName;

        extraFields +=
        // Info-ZIP Unicode Path Extra Field
        "\x75\x70" +
        // size
        decToHex(unicodePathExtraField.length, 2) +
        // content
        unicodePathExtraField;
    }

    if (useUTF8ForComment) {

        unicodeCommentExtraField =
        // Version
        decToHex(1, 1) +
        // CommentCRC32
        decToHex(crc32(encodedComment), 4) +
        // UnicodeName
        utfEncodedComment;

        extraFields +=
        // Info-ZIP Unicode Path Extra Field
        "\x75\x63" +
        // size
        decToHex(unicodeCommentExtraField.length, 2) +
        // content
        unicodeCommentExtraField;
    }

    var header = "";

    // version needed to extract
    header += "\x0A\x00";
    // general purpose bit flag
    header += decToHex(bitflag, 2);
    // compression method
    header += compression.magic;
    // last mod file time
    header += decToHex(dosTime, 2);
    // last mod file date
    header += decToHex(dosDate, 2);
    // crc-32
    header += decToHex(dataInfo.crc32, 4);
    // compressed size
    header += decToHex(dataInfo.compressedSize, 4);
    // uncompressed size
    header += decToHex(dataInfo.uncompressedSize, 4);
    // file name length
    header += decToHex(encodedFileName.length, 2);
    // extra field length
    header += decToHex(extraFields.length, 2);

    var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields;

    var dirRecord = signature.CENTRAL_FILE_HEADER +
    // version made by (00: DOS)
    decToHex(versionMadeBy, 2) +
    // file header (common to file and central directory)
    header +
    // file comment length
    decToHex(encodedComment.length, 2) +
    // disk number start
    "\x00\x00" +
    // internal file attributes TODO
    "\x00\x00" +
    // external file attributes
    decToHex(extFileAttr, 4) +
    // relative offset of local header
    decToHex(offset, 4) +
    // file name
    encodedFileName +
    // extra field
    extraFields +
    // file comment
    encodedComment;

    return {
        fileRecord: fileRecord,
        dirRecord: dirRecord
    };
};

/**
 * Generate the EOCD record.
 * @param {Number} entriesCount the number of entries in the zip file.
 * @param {Number} centralDirLength the length (in bytes) of the central dir.
 * @param {Number} localDirLength the length (in bytes) of the local dir.
 * @param {String} comment the zip file comment as a binary string.
 * @param {Function} encodeFileName the function to encode the comment.
 * @return {String} the EOCD record.
 */
var generateCentralDirectoryEnd = function generateCentralDirectoryEnd(entriesCount, centralDirLength, localDirLength, comment, encodeFileName) {
    var dirEnd = "";
    var encodedComment = utils.transformTo("string", encodeFileName(comment));

    // end of central dir signature
    dirEnd = signature.CENTRAL_DIRECTORY_END +
    // number of this disk
    "\x00\x00" +
    // number of the disk with the start of the central directory
    "\x00\x00" +
    // total number of entries in the central directory on this disk
    decToHex(entriesCount, 2) +
    // total number of entries in the central directory
    decToHex(entriesCount, 2) +
    // size of the central directory   4 bytes
    decToHex(centralDirLength, 4) +
    // offset of start of central directory with respect to the starting disk number
    decToHex(localDirLength, 4) +
    // .ZIP file comment length
    decToHex(encodedComment.length, 2) +
    // .ZIP file comment
    encodedComment;

    return dirEnd;
};

/**
 * Generate data descriptors for a file entry.
 * @param {Object} streamInfo the hash generated by a worker, containing informations
 * on the file entry.
 * @return {String} the data descriptors.
 */
var generateDataDescriptors = function generateDataDescriptors(streamInfo) {
    var descriptor = "";
    descriptor = signature.DATA_DESCRIPTOR +
    // crc-32                          4 bytes
    decToHex(streamInfo['crc32'], 4) +
    // compressed size                 4 bytes
    decToHex(streamInfo['compressedSize'], 4) +
    // uncompressed size               4 bytes
    decToHex(streamInfo['uncompressedSize'], 4);

    return descriptor;
};

/**
 * A worker to concatenate other workers to create a zip file.
 * @param {Boolean} streamFiles `true` to stream the content of the files,
 * `false` to accumulate it.
 * @param {String} comment the comment to use.
 * @param {String} platform the platform to use, "UNIX" or "DOS".
 * @param {Function} encodeFileName the function to encode file names and comments.
 */
function ZipFileWorker(streamFiles, comment, platform, encodeFileName) {
    GenericWorker.call(this, "ZipFileWorker");
    // The number of bytes written so far. This doesn't count accumulated chunks.
    this.bytesWritten = 0;
    // The comment of the zip file
    this.zipComment = comment;
    // The platform "generating" the zip file.
    this.zipPlatform = platform;
    // the function to encode file names and comments.
    this.encodeFileName = encodeFileName;
    // Should we stream the content of the files ?
    this.streamFiles = streamFiles;
    // If `streamFiles` is false, we will need to accumulate the content of the
    // files to calculate sizes / crc32 (and write them *before* the content).
    // This boolean indicates if we are accumulating chunks (it will change a lot
    // during the lifetime of this worker).
    this.accumulate = false;
    // The buffer receiving chunks when accumulating content.
    this.contentBuffer = [];
    // The list of generated directory records.
    this.dirRecords = [];
    // The offset (in bytes) from the beginning of the zip file for the current source.
    this.currentSourceOffset = 0;
    // The total number of entries in this zip file.
    this.entriesCount = 0;
    // the name of the file currently being added, null when handling the end of the zip file.
    // Used for the emited metadata.
    this.currentFile = null;

    this._sources = [];
}
utils.inherits(ZipFileWorker, GenericWorker);

/**
 * @see GenericWorker.push
 */
ZipFileWorker.prototype.push = function (chunk) {

    var currentFilePercent = chunk.meta.percent || 0;
    var entriesCount = this.entriesCount;
    var remainingFiles = this._sources.length;

    if (this.accumulate) {
        this.contentBuffer.push(chunk);
    } else {
        this.bytesWritten += chunk.data.length;

        GenericWorker.prototype.push.call(this, {
            data: chunk.data,
            meta: {
                currentFile: this.currentFile,
                percent: entriesCount ? (currentFilePercent + 100 * (entriesCount - remainingFiles - 1)) / entriesCount : 100
            }
        });
    }
};

/**
 * The worker started a new source (an other worker).
 * @param {Object} streamInfo the streamInfo object from the new source.
 */
ZipFileWorker.prototype.openedSource = function (streamInfo) {
    this.currentSourceOffset = this.bytesWritten;
    this.currentFile = streamInfo['file'].name;

    var streamedContent = this.streamFiles && !streamInfo['file'].dir;

    // don't stream folders (because they don't have any content)
    if (streamedContent) {
        var record = generateZipParts(streamInfo, streamedContent, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
        this.push({
            data: record.fileRecord,
            meta: { percent: 0 }
        });
    } else {
        // we need to wait for the whole file before pushing anything
        this.accumulate = true;
    }
};

/**
 * The worker finished a source (an other worker).
 * @param {Object} streamInfo the streamInfo object from the finished source.
 */
ZipFileWorker.prototype.closedSource = function (streamInfo) {
    this.accumulate = false;
    var streamedContent = this.streamFiles && !streamInfo['file'].dir;
    var record = generateZipParts(streamInfo, streamedContent, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);

    this.dirRecords.push(record.dirRecord);
    if (streamedContent) {
        // after the streamed file, we put data descriptors
        this.push({
            data: generateDataDescriptors(streamInfo),
            meta: { percent: 100 }
        });
    } else {
        // the content wasn't streamed, we need to push everything now
        // first the file record, then the content
        this.push({
            data: record.fileRecord,
            meta: { percent: 0 }
        });
        while (this.contentBuffer.length) {
            this.push(this.contentBuffer.shift());
        }
    }
    this.currentFile = null;
};

/**
 * @see GenericWorker.flush
 */
ZipFileWorker.prototype.flush = function () {

    var localDirLength = this.bytesWritten;
    for (var i = 0; i < this.dirRecords.length; i++) {
        this.push({
            data: this.dirRecords[i],
            meta: { percent: 100 }
        });
    }
    var centralDirLength = this.bytesWritten - localDirLength;

    var dirEnd = generateCentralDirectoryEnd(this.dirRecords.length, centralDirLength, localDirLength, this.zipComment, this.encodeFileName);

    this.push({
        data: dirEnd,
        meta: { percent: 100 }
    });
};

/**
 * Prepare the next source to be read.
 */
ZipFileWorker.prototype.prepareNextSource = function () {
    this.previous = this._sources.shift();
    this.openedSource(this.previous.streamInfo);
    if (this.isPaused) {
        this.previous.pause();
    } else {
        this.previous.resume();
    }
};

/**
 * @see GenericWorker.registerPrevious
 */
ZipFileWorker.prototype.registerPrevious = function (previous) {
    this._sources.push(previous);
    var self = this;

    previous.on('data', function (chunk) {
        self.processChunk(chunk);
    });
    previous.on('end', function () {
        self.closedSource(self.previous.streamInfo);
        if (self._sources.length) {
            self.prepareNextSource();
        } else {
            self.end();
        }
    });
    previous.on('error', function (e) {
        self.error(e);
    });
    return this;
};

/**
 * @see GenericWorker.resume
 */
ZipFileWorker.prototype.resume = function () {
    if (!GenericWorker.prototype.resume.call(this)) {
        return false;
    }

    if (!this.previous && this._sources.length) {
        this.prepareNextSource();
        return true;
    }
    if (!this.previous && !this._sources.length && !this.generatedError) {
        this.end();
        return true;
    }
};

/**
 * @see GenericWorker.error
 */
ZipFileWorker.prototype.error = function (e) {
    var sources = this._sources;
    if (!GenericWorker.prototype.error.call(this, e)) {
        return false;
    }
    for (var i = 0; i < sources.length; i++) {
        try {
            sources[i].error(e);
        } catch (e) {
            // the `error` exploded, nothing to do
        }
    }
    return true;
};

/**
 * @see GenericWorker.lock
 */
ZipFileWorker.prototype.lock = function () {
    GenericWorker.prototype.lock.call(this);
    var sources = this._sources;
    for (var i = 0; i < sources.length; i++) {
        sources[i].lock();
    }
};

module.exports = ZipFileWorker;

/***/ }),
/* 465 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var utils = __webpack_require__(9);
var GenericWorker = __webpack_require__(23);

/**
 * A worker that use a nodejs stream as source.
 * @constructor
 * @param {String} filename the name of the file entry for this stream.
 * @param {Readable} stream the nodejs stream.
 */
function NodejsStreamInputAdapter(filename, stream) {
    GenericWorker.call(this, "Nodejs stream input adapter for " + filename);
    this._upstreamEnded = false;
    this._bindStream(stream);
}

utils.inherits(NodejsStreamInputAdapter, GenericWorker);

/**
 * Prepare the stream and bind the callbacks on it.
 * Do this ASAP on node 0.10 ! A lazy binding doesn't always work.
 * @param {Stream} stream the nodejs stream to use.
 */
NodejsStreamInputAdapter.prototype._bindStream = function (stream) {
    var self = this;
    this._stream = stream;
    stream.pause();
    stream.on("data", function (chunk) {
        self.push({
            data: chunk,
            meta: {
                percent: 0
            }
        });
    }).on("error", function (e) {
        if (self.isPaused) {
            this.generatedError = e;
        } else {
            self.error(e);
        }
    }).on("end", function () {
        if (self.isPaused) {
            self._upstreamEnded = true;
        } else {
            self.end();
        }
    });
};
NodejsStreamInputAdapter.prototype.pause = function () {
    if (!GenericWorker.prototype.pause.call(this)) {
        return false;
    }
    this._stream.pause();
    return true;
};
NodejsStreamInputAdapter.prototype.resume = function () {
    if (!GenericWorker.prototype.resume.call(this)) {
        return false;
    }

    if (this._upstreamEnded) {
        this.end();
    } else {
        this._stream.resume();
    }

    return true;
};

module.exports = NodejsStreamInputAdapter;

/***/ }),
/* 466 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var utils = __webpack_require__(9);
var external = __webpack_require__(71);
var utf8 = __webpack_require__(63);
var utils = __webpack_require__(9);
var ZipEntries = __webpack_require__(467);
var Crc32Probe = __webpack_require__(192);
var nodejsUtils = __webpack_require__(94);

/**
 * Check the CRC32 of an entry.
 * @param {ZipEntry} zipEntry the zip entry to check.
 * @return {Promise} the result.
 */
function checkEntryCRC32(zipEntry) {
    return new external.Promise(function (resolve, reject) {
        var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe());
        worker.on("error", function (e) {
            reject(e);
        }).on("end", function () {
            if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) {
                reject(new Error("Corrupted zip : CRC32 mismatch"));
            } else {
                resolve();
            }
        }).resume();
    });
}

module.exports = function (data, options) {
    var zip = this;
    options = utils.extend(options || {}, {
        base64: false,
        checkCRC32: false,
        optimizedBinaryString: false,
        createFolders: false,
        decodeFileName: utf8.utf8decode
    });

    if (nodejsUtils.isNode && nodejsUtils.isStream(data)) {
        return external.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file."));
    }

    return utils.prepareContent("the loaded zip file", data, true, options.optimizedBinaryString, options.base64).then(function (data) {
        var zipEntries = new ZipEntries(options);
        zipEntries.load(data);
        return zipEntries;
    }).then(function checkCRC32(zipEntries) {
        var promises = [external.Promise.resolve(zipEntries)];
        var files = zipEntries.files;
        if (options.checkCRC32) {
            for (var i = 0; i < files.length; i++) {
                promises.push(checkEntryCRC32(files[i]));
            }
        }
        return external.Promise.all(promises);
    }).then(function addFiles(results) {
        var zipEntries = results.shift();
        var files = zipEntries.files;
        for (var i = 0; i < files.length; i++) {
            var input = files[i];
            zip.file(input.fileNameStr, input.decompressed, {
                binary: true,
                optimizedBinaryString: true,
                date: input.date,
                dir: input.dir,
                comment: input.fileCommentStr.length ? input.fileCommentStr : null,
                unixPermissions: input.unixPermissions,
                dosPermissions: input.dosPermissions,
                createFolders: options.createFolders
            });
        }
        if (zipEntries.zipComment.length) {
            zip.comment = zipEntries.zipComment;
        }

        return zip;
    });
};

/***/ }),
/* 467 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var readerFor = __webpack_require__(200);
var utils = __webpack_require__(9);
var sig = __webpack_require__(199);
var ZipEntry = __webpack_require__(470);
var utf8 = __webpack_require__(63);
var support = __webpack_require__(41);
//  class ZipEntries {{{
/**
 * All the entries in the zip file.
 * @constructor
 * @param {Object} loadOptions Options for loading the stream.
 */
function ZipEntries(loadOptions) {
    this.files = [];
    this.loadOptions = loadOptions;
}
ZipEntries.prototype = {
    /**
     * Check that the reader is on the specified signature.
     * @param {string} expectedSignature the expected signature.
     * @throws {Error} if it is an other signature.
     */
    checkSignature: function checkSignature(expectedSignature) {
        if (!this.reader.readAndCheckSignature(expectedSignature)) {
            this.reader.index -= 4;
            var signature = this.reader.readString(4);
            throw new Error("Corrupted zip or bug: unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")");
        }
    },
    /**
     * Check if the given signature is at the given index.
     * @param {number} askedIndex the index to check.
     * @param {string} expectedSignature the signature to expect.
     * @return {boolean} true if the signature is here, false otherwise.
     */
    isSignature: function isSignature(askedIndex, expectedSignature) {
        var currentIndex = this.reader.index;
        this.reader.setIndex(askedIndex);
        var signature = this.reader.readString(4);
        var result = signature === expectedSignature;
        this.reader.setIndex(currentIndex);
        return result;
    },
    /**
     * Read the end of the central directory.
     */
    readBlockEndOfCentral: function readBlockEndOfCentral() {
        this.diskNumber = this.reader.readInt(2);
        this.diskWithCentralDirStart = this.reader.readInt(2);
        this.centralDirRecordsOnThisDisk = this.reader.readInt(2);
        this.centralDirRecords = this.reader.readInt(2);
        this.centralDirSize = this.reader.readInt(4);
        this.centralDirOffset = this.reader.readInt(4);

        this.zipCommentLength = this.reader.readInt(2);
        // warning : the encoding depends of the system locale
        // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded.
        // On a windows machine, this field is encoded with the localized windows code page.
        var zipComment = this.reader.readData(this.zipCommentLength);
        var decodeParamType = support.uint8array ? "uint8array" : "array";
        // To get consistent behavior with the generation part, we will assume that
        // this is utf8 encoded unless specified otherwise.
        var decodeContent = utils.transformTo(decodeParamType, zipComment);
        this.zipComment = this.loadOptions.decodeFileName(decodeContent);
    },
    /**
     * Read the end of the Zip 64 central directory.
     * Not merged with the method readEndOfCentral :
     * The end of central can coexist with its Zip64 brother,
     * I don't want to read the wrong number of bytes !
     */
    readBlockZip64EndOfCentral: function readBlockZip64EndOfCentral() {
        this.zip64EndOfCentralSize = this.reader.readInt(8);
        this.reader.skip(4);
        // this.versionMadeBy = this.reader.readString(2);
        // this.versionNeeded = this.reader.readInt(2);
        this.diskNumber = this.reader.readInt(4);
        this.diskWithCentralDirStart = this.reader.readInt(4);
        this.centralDirRecordsOnThisDisk = this.reader.readInt(8);
        this.centralDirRecords = this.reader.readInt(8);
        this.centralDirSize = this.reader.readInt(8);
        this.centralDirOffset = this.reader.readInt(8);

        this.zip64ExtensibleData = {};
        var extraDataSize = this.zip64EndOfCentralSize - 44,
            index = 0,
            extraFieldId,
            extraFieldLength,
            extraFieldValue;
        while (index < extraDataSize) {
            extraFieldId = this.reader.readInt(2);
            extraFieldLength = this.reader.readInt(4);
            extraFieldValue = this.reader.readData(extraFieldLength);
            this.zip64ExtensibleData[extraFieldId] = {
                id: extraFieldId,
                length: extraFieldLength,
                value: extraFieldValue
            };
        }
    },
    /**
     * Read the end of the Zip 64 central directory locator.
     */
    readBlockZip64EndOfCentralLocator: function readBlockZip64EndOfCentralLocator() {
        this.diskWithZip64CentralDirStart = this.reader.readInt(4);
        this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8);
        this.disksCount = this.reader.readInt(4);
        if (this.disksCount > 1) {
            throw new Error("Multi-volumes zip are not supported");
        }
    },
    /**
     * Read the local files, based on the offset read in the central part.
     */
    readLocalFiles: function readLocalFiles() {
        var i, file;
        for (i = 0; i < this.files.length; i++) {
            file = this.files[i];
            this.reader.setIndex(file.localHeaderOffset);
            this.checkSignature(sig.LOCAL_FILE_HEADER);
            file.readLocalPart(this.reader);
            file.handleUTF8();
            file.processAttributes();
        }
    },
    /**
     * Read the central directory.
     */
    readCentralDir: function readCentralDir() {
        var file;

        this.reader.setIndex(this.centralDirOffset);
        while (this.reader.readAndCheckSignature(sig.CENTRAL_FILE_HEADER)) {
            file = new ZipEntry({
                zip64: this.zip64
            }, this.loadOptions);
            file.readCentralPart(this.reader);
            this.files.push(file);
        }

        if (this.centralDirRecords !== this.files.length) {
            if (this.centralDirRecords !== 0 && this.files.length === 0) {
                // We expected some records but couldn't find ANY.
                // This is really suspicious, as if something went wrong.
                throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
            } else {
                // We found some records but not all.
                // Something is wrong but we got something for the user: no error here.
                // console.warn("expected", this.centralDirRecords, "records in central dir, got", this.files.length);
            }
        }
    },
    /**
     * Read the end of central directory.
     */
    readEndOfCentral: function readEndOfCentral() {
        var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);
        if (offset < 0) {
            // Check if the content is a truncated zip or complete garbage.
            // A "LOCAL_FILE_HEADER" is not required at the beginning (auto
            // extractible zip for example) but it can give a good hint.
            // If an ajax request was used without responseType, we will also
            // get unreadable data.
            var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER);

            if (isGarbage) {
                throw new Error("Can't find end of central directory : is this a zip file ? " + "If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");
            } else {
                throw new Error("Corrupted zip: can't find end of central directory");
            }
        }
        this.reader.setIndex(offset);
        var endOfCentralDirOffset = offset;
        this.checkSignature(sig.CENTRAL_DIRECTORY_END);
        this.readBlockEndOfCentral();

        /* extract from the zip spec :
            4)  If one of the fields in the end of central directory
                record is too small to hold required data, the field
                should be set to -1 (0xFFFF or 0xFFFFFFFF) and the
                ZIP64 format record should be created.
            5)  The end of central directory record and the
                Zip64 end of central directory locator record must
                reside on the same disk when splitting or spanning
                an archive.
         */
        if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) {
            this.zip64 = true;

            /*
            Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from
            the zip file can fit into a 32bits integer. This cannot be solved : JavaScript represents
            all numbers as 64-bit double precision IEEE 754 floating point numbers.
            So, we have 53bits for integers and bitwise operations treat everything as 32bits.
            see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators
            and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5
            */

            // should look for a zip64 EOCD locator
            offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);
            if (offset < 0) {
                throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");
            }
            this.reader.setIndex(offset);
            this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);
            this.readBlockZip64EndOfCentralLocator();

            // now the zip64 EOCD record
            if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) {
                // console.warn("ZIP64 end of central directory not where expected.");
                this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);
                if (this.relativeOffsetEndOfZip64CentralDir < 0) {
                    throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");
                }
            }
            this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir);
            this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);
            this.readBlockZip64EndOfCentral();
        }

        var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize;
        if (this.zip64) {
            expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator
            expectedEndOfCentralDirOffset += 12 /* should not include the leading 12 bytes */ + this.zip64EndOfCentralSize;
        }

        var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset;

        if (extraBytes > 0) {
            // console.warn(extraBytes, "extra bytes at beginning or within zipfile");
            if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) {
                // The offsets seem wrong, but we have something at the specified offset.
                // So… we keep it.
            } else {
                // the offset is wrong, update the "zero" of the reader
                // this happens if data has been prepended (crx files for example)
                this.reader.zero = extraBytes;
            }
        } else if (extraBytes < 0) {
            throw new Error("Corrupted zip: missing " + Math.abs(extraBytes) + " bytes.");
        }
    },
    prepareReader: function prepareReader(data) {
        this.reader = readerFor(data);
    },
    /**
     * Read a zip file and create ZipEntries.
     * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file.
     */
    load: function load(data) {
        this.prepareReader(data);
        this.readEndOfCentral();
        this.readCentralDir();
        this.readLocalFiles();
    }
};
// }}} end of ZipEntries
module.exports = ZipEntries;

/***/ }),
/* 468 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var DataReader = __webpack_require__(202);
var utils = __webpack_require__(9);

function StringReader(data) {
    DataReader.call(this, data);
}
utils.inherits(StringReader, DataReader);
/**
 * @see DataReader.byteAt
 */
StringReader.prototype.byteAt = function (i) {
    return this.data.charCodeAt(this.zero + i);
};
/**
 * @see DataReader.lastIndexOfSignature
 */
StringReader.prototype.lastIndexOfSignature = function (sig) {
    return this.data.lastIndexOf(sig) - this.zero;
};
/**
 * @see DataReader.readAndCheckSignature
 */
StringReader.prototype.readAndCheckSignature = function (sig) {
    var data = this.readData(4);
    return sig === data;
};
/**
 * @see DataReader.readData
 */
StringReader.prototype.readData = function (size) {
    this.checkOffset(size);
    // this will work because the constructor applied the "& 0xff" mask.
    var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
    this.index += size;
    return result;
};
module.exports = StringReader;

/***/ }),
/* 469 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var Uint8ArrayReader = __webpack_require__(203);
var utils = __webpack_require__(9);

function NodeBufferReader(data) {
    Uint8ArrayReader.call(this, data);
}
utils.inherits(NodeBufferReader, Uint8ArrayReader);

/**
 * @see DataReader.readData
 */
NodeBufferReader.prototype.readData = function (size) {
    this.checkOffset(size);
    var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
    this.index += size;
    return result;
};
module.exports = NodeBufferReader;

/***/ }),
/* 470 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var readerFor = __webpack_require__(200);
var utils = __webpack_require__(9);
var CompressedObject = __webpack_require__(132);
var crc32fn = __webpack_require__(133);
var utf8 = __webpack_require__(63);
var compressions = __webpack_require__(193);
var support = __webpack_require__(41);

var MADE_BY_DOS = 0x00;
var MADE_BY_UNIX = 0x03;

/**
 * Find a compression registered in JSZip.
 * @param {string} compressionMethod the method magic to find.
 * @return {Object|null} the JSZip compression object, null if none found.
 */
var findCompression = function findCompression(compressionMethod) {
    for (var method in compressions) {
        if (!compressions.hasOwnProperty(method)) {
            continue;
        }
        if (compressions[method].magic === compressionMethod) {
            return compressions[method];
        }
    }
    return null;
};

// class ZipEntry {{{
/**
 * An entry in the zip file.
 * @constructor
 * @param {Object} options Options of the current file.
 * @param {Object} loadOptions Options for loading the stream.
 */
function ZipEntry(options, loadOptions) {
    this.options = options;
    this.loadOptions = loadOptions;
}
ZipEntry.prototype = {
    /**
     * say if the file is encrypted.
     * @return {boolean} true if the file is encrypted, false otherwise.
     */
    isEncrypted: function isEncrypted() {
        // bit 1 is set
        return (this.bitFlag & 0x0001) === 0x0001;
    },
    /**
     * say if the file has utf-8 filename/comment.
     * @return {boolean} true if the filename/comment is in utf-8, false otherwise.
     */
    useUTF8: function useUTF8() {
        // bit 11 is set
        return (this.bitFlag & 0x0800) === 0x0800;
    },
    /**
     * Read the local part of a zip file and add the info in this object.
     * @param {DataReader} reader the reader to use.
     */
    readLocalPart: function readLocalPart(reader) {
        var compression, localExtraFieldsLength;

        // we already know everything from the central dir !
        // If the central dir data are false, we are doomed.
        // On the bright side, the local part is scary  : zip64, data descriptors, both, etc.
        // The less data we get here, the more reliable this should be.
        // Let's skip the whole header and dash to the data !
        reader.skip(22);
        // in some zip created on windows, the filename stored in the central dir contains \ instead of /.
        // Strangely, the filename here is OK.
        // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes
        // or APPNOTE#4.4.17.1, "All slashes MUST be forward slashes '/'") but there are a lot of bad zip generators...
        // Search "unzip mismatching "local" filename continuing with "central" filename version" on
        // the internet.
        //
        // I think I see the logic here : the central directory is used to display
        // content and the local directory is used to extract the files. Mixing / and \
        // may be used to display \ to windows users and use / when extracting the files.
        // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394
        this.fileNameLength = reader.readInt(2);
        localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir
        // the fileName is stored as binary data, the handleUTF8 method will take care of the encoding.
        this.fileName = reader.readData(this.fileNameLength);
        reader.skip(localExtraFieldsLength);

        if (this.compressedSize === -1 || this.uncompressedSize === -1) {
            throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory " + "(compressedSize === -1 || uncompressedSize === -1)");
        }

        compression = findCompression(this.compressionMethod);
        if (compression === null) {
            // no compression found
            throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + utils.transformTo("string", this.fileName) + ")");
        }
        this.decompressed = new CompressedObject(this.compressedSize, this.uncompressedSize, this.crc32, compression, reader.readData(this.compressedSize));
    },

    /**
     * Read the central part of a zip file and add the info in this object.
     * @param {DataReader} reader the reader to use.
     */
    readCentralPart: function readCentralPart(reader) {
        this.versionMadeBy = reader.readInt(2);
        reader.skip(2);
        // this.versionNeeded = reader.readInt(2);
        this.bitFlag = reader.readInt(2);
        this.compressionMethod = reader.readString(2);
        this.date = reader.readDate();
        this.crc32 = reader.readInt(4);
        this.compressedSize = reader.readInt(4);
        this.uncompressedSize = reader.readInt(4);
        var fileNameLength = reader.readInt(2);
        this.extraFieldsLength = reader.readInt(2);
        this.fileCommentLength = reader.readInt(2);
        this.diskNumberStart = reader.readInt(2);
        this.internalFileAttributes = reader.readInt(2);
        this.externalFileAttributes = reader.readInt(4);
        this.localHeaderOffset = reader.readInt(4);

        if (this.isEncrypted()) {
            throw new Error("Encrypted zip are not supported");
        }

        // will be read in the local part, see the comments there
        reader.skip(fileNameLength);
        this.readExtraFields(reader);
        this.parseZIP64ExtraField(reader);
        this.fileComment = reader.readData(this.fileCommentLength);
    },

    /**
     * Parse the external file attributes and get the unix/dos permissions.
     */
    processAttributes: function processAttributes() {
        this.unixPermissions = null;
        this.dosPermissions = null;
        var madeBy = this.versionMadeBy >> 8;

        // Check if we have the DOS directory flag set.
        // We look for it in the DOS and UNIX permissions
        // but some unknown platform could set it as a compatibility flag.
        this.dir = this.externalFileAttributes & 0x0010 ? true : false;

        if (madeBy === MADE_BY_DOS) {
            // first 6 bits (0 to 5)
            this.dosPermissions = this.externalFileAttributes & 0x3F;
        }

        if (madeBy === MADE_BY_UNIX) {
            this.unixPermissions = this.externalFileAttributes >> 16 & 0xFFFF;
            // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8);
        }

        // fail safe : if the name ends with a / it probably means a folder
        if (!this.dir && this.fileNameStr.slice(-1) === '/') {
            this.dir = true;
        }
    },

    /**
     * Parse the ZIP64 extra field and merge the info in the current ZipEntry.
     * @param {DataReader} reader the reader to use.
     */
    parseZIP64ExtraField: function parseZIP64ExtraField(reader) {

        if (!this.extraFields[0x0001]) {
            return;
        }

        // should be something, preparing the extra reader
        var extraReader = readerFor(this.extraFields[0x0001].value);

        // I really hope that these 64bits integer can fit in 32 bits integer, because js
        // won't let us have more.
        if (this.uncompressedSize === utils.MAX_VALUE_32BITS) {
            this.uncompressedSize = extraReader.readInt(8);
        }
        if (this.compressedSize === utils.MAX_VALUE_32BITS) {
            this.compressedSize = extraReader.readInt(8);
        }
        if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) {
            this.localHeaderOffset = extraReader.readInt(8);
        }
        if (this.diskNumberStart === utils.MAX_VALUE_32BITS) {
            this.diskNumberStart = extraReader.readInt(4);
        }
    },
    /**
     * Read the central part of a zip file and add the info in this object.
     * @param {DataReader} reader the reader to use.
     */
    readExtraFields: function readExtraFields(reader) {
        var end = reader.index + this.extraFieldsLength,
            extraFieldId,
            extraFieldLength,
            extraFieldValue;

        if (!this.extraFields) {
            this.extraFields = {};
        }

        while (reader.index < end) {
            extraFieldId = reader.readInt(2);
            extraFieldLength = reader.readInt(2);
            extraFieldValue = reader.readData(extraFieldLength);

            this.extraFields[extraFieldId] = {
                id: extraFieldId,
                length: extraFieldLength,
                value: extraFieldValue
            };
        }
    },
    /**
     * Apply an UTF8 transformation if needed.
     */
    handleUTF8: function handleUTF8() {
        var decodeParamType = support.uint8array ? "uint8array" : "array";
        if (this.useUTF8()) {
            this.fileNameStr = utf8.utf8decode(this.fileName);
            this.fileCommentStr = utf8.utf8decode(this.fileComment);
        } else {
            var upath = this.findExtraFieldUnicodePath();
            if (upath !== null) {
                this.fileNameStr = upath;
            } else {
                // ASCII text or unsupported code page
                var fileNameByteArray = utils.transformTo(decodeParamType, this.fileName);
                this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray);
            }

            var ucomment = this.findExtraFieldUnicodeComment();
            if (ucomment !== null) {
                this.fileCommentStr = ucomment;
            } else {
                // ASCII text or unsupported code page
                var commentByteArray = utils.transformTo(decodeParamType, this.fileComment);
                this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray);
            }
        }
    },

    /**
     * Find the unicode path declared in the extra field, if any.
     * @return {String} the unicode path, null otherwise.
     */
    findExtraFieldUnicodePath: function findExtraFieldUnicodePath() {
        var upathField = this.extraFields[0x7075];
        if (upathField) {
            var extraReader = readerFor(upathField.value);

            // wrong version
            if (extraReader.readInt(1) !== 1) {
                return null;
            }

            // the crc of the filename changed, this field is out of date.
            if (crc32fn(this.fileName) !== extraReader.readInt(4)) {
                return null;
            }

            return utf8.utf8decode(extraReader.readData(upathField.length - 5));
        }
        return null;
    },

    /**
     * Find the unicode comment declared in the extra field, if any.
     * @return {String} the unicode comment, null otherwise.
     */
    findExtraFieldUnicodeComment: function findExtraFieldUnicodeComment() {
        var ucommentField = this.extraFields[0x6375];
        if (ucommentField) {
            var extraReader = readerFor(ucommentField.value);

            // wrong version
            if (extraReader.readInt(1) !== 1) {
                return null;
            }

            // the crc of the comment changed, this field is out of date.
            if (crc32fn(this.fileComment) !== extraReader.readInt(4)) {
                return null;
            }

            return utf8.utf8decode(extraReader.readData(ucommentField.length - 5));
        }
        return null;
    }
};
module.exports = ZipEntry;

/***/ }),
/* 471 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

/**
 *  File    : i18n.js
 *  Created : 26/05/2016
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(206), __webpack_require__(481), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function (i18next, GlobalData, Utils) {

  /**
   * Checks if the language preferred by the user (based on browser and/or specific settings)
   * is in a list of available languages.
   * @param {string[]} availableLanguages - Array of available languages. It should contain at least one item.
   * @param {string=} defaultLanguage -Language to be used by default when not found the selected one
   * @param {string} setLang - Request this specific language
   * @returns {string} - The most suitable language for this request
   */
  var checkPreferredLanguage = function checkPreferredLanguage(availableLanguages, defaultLanguage, setLang) {
    var result = -1;
    // Create an array to store possible values
    var tries = [];
    // If "setLang" is specified, check it
    if (setLang) tries.push(setLang);

    // Add user's preferred languages, if any
    if (window.navigator.languages) tries = tries.concat(window.navigator.languages);

    // Add the navigator main language, if defined
    if (window.navigator.language) tries.push(window.navigator.language);

    // Add English as final option
    tries.push(defaultLanguage || 'en');

    for (var i = 0; i < tries.length; i++) {
      var match = -1;
      for (var n in availableLanguages) {
        if (tries[i].indexOf(availableLanguages[n]) === 0) {
          match = n;
          if (tries[i] === availableLanguages[n]) {
            result = n;
            break;
          }
        }
      }
      if (result >= 0 || (result = match) >= 0) break;
    }
    return availableLanguages[result >= 0 ? result : 0];
  };

  /**
   * Initializes i18next, assigning the translation function to ps
   * @param {type} ps
   */
  return function (ps) {
    i18next.init({
      nsSeparator: false,
      keySeparator: false,
      fallbackLng: 'en',
      lng: checkPreferredLanguage(GlobalData.languages, 'en', ps.options.lang),
      resources: {
        en: { translation: {} },
        ca: { translation: GlobalData.messages.ca },
        'ca_ES@valencia': { translation: GlobalData.messages['ca_ES@valencia'] },
        es: { translation: GlobalData.messages.es }
      }
    }, function (err, t) {
      if (err) Utils.log('error', 'Error initializing "i18next": ' + err.message);else {
        Utils.getMsg = ps.getMsg = t;
        ps.JClicVersion = GlobalData.version;
      }
    });
  };
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 472 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});

var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _logger = __webpack_require__(56);

var _logger2 = _interopRequireDefault(_logger);

var _EventEmitter2 = __webpack_require__(72);

var _EventEmitter3 = _interopRequireDefault(_EventEmitter2);

var _ResourceStore = __webpack_require__(473);

var _ResourceStore2 = _interopRequireDefault(_ResourceStore);

var _Translator = __webpack_require__(474);

var _Translator2 = _interopRequireDefault(_Translator);

var _LanguageUtils = __webpack_require__(475);

var _LanguageUtils2 = _interopRequireDefault(_LanguageUtils);

var _PluralResolver = __webpack_require__(476);

var _PluralResolver2 = _interopRequireDefault(_PluralResolver);

var _Interpolator = __webpack_require__(477);

var _Interpolator2 = _interopRequireDefault(_Interpolator);

var _BackendConnector = __webpack_require__(478);

var _BackendConnector2 = _interopRequireDefault(_BackendConnector);

var _CacheConnector = __webpack_require__(479);

var _CacheConnector2 = _interopRequireDefault(_CacheConnector);

var _defaults2 = __webpack_require__(480);

var _postProcessor = __webpack_require__(207);

var _postProcessor2 = _interopRequireDefault(_postProcessor);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
  return typeof obj === "undefined" ? "undefined" : _typeof2(obj);
} : function (obj) {
  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj);
};

var _extends = Object.assign || function (target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i];for (var key in source) {
      if (Object.prototype.hasOwnProperty.call(source, key)) {
        target[key] = source[key];
      }
    }
  }return target;
};

function _defaults(obj, defaults) {
  var keys = Object.getOwnPropertyNames(defaults);for (var i = 0; i < keys.length; i++) {
    var key = keys[i];var value = Object.getOwnPropertyDescriptor(defaults, key);if (value && value.configurable && obj[key] === undefined) {
      Object.defineProperty(obj, key, value);
    }
  }return obj;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

function _possibleConstructorReturn(self, call) {
  if (!self) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }return call && ((typeof call === "undefined" ? "undefined" : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
}

function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _typeof2(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) : _defaults(subClass, superClass);
}

function noop() {}

var I18n = function (_EventEmitter) {
  _inherits(I18n, _EventEmitter);

  function I18n() {
    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    var callback = arguments[1];

    _classCallCheck(this, I18n);

    var _this = _possibleConstructorReturn(this, _EventEmitter.call(this));

    _this.options = (0, _defaults2.transformOptions)(options);
    _this.services = {};
    _this.logger = _logger2.default;
    _this.modules = { external: [] };

    if (callback && !_this.isInitialized && !options.isClone) {
      var _ret;

      // https://github.com/i18next/i18next/issues/879
      if (!_this.options.initImmediate) return _ret = _this.init(options, callback), _possibleConstructorReturn(_this, _ret);
      setTimeout(function () {
        _this.init(options, callback);
      }, 0);
    }
    return _this;
  }

  I18n.prototype.init = function init() {
    var _this2 = this;

    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    var callback = arguments[1];

    if (typeof options === 'function') {
      callback = options;
      options = {};
    }
    this.options = _extends({}, (0, _defaults2.get)(), this.options, (0, _defaults2.transformOptions)(options));

    this.format = this.options.interpolation.format;
    if (!callback) callback = noop;

    function createClassOnDemand(ClassOrObject) {
      if (!ClassOrObject) return null;
      if (typeof ClassOrObject === 'function') return new ClassOrObject();
      return ClassOrObject;
    }

    // init services
    if (!this.options.isClone) {
      if (this.modules.logger) {
        _logger2.default.init(createClassOnDemand(this.modules.logger), this.options);
      } else {
        _logger2.default.init(null, this.options);
      }

      var lu = new _LanguageUtils2.default(this.options);
      this.store = new _ResourceStore2.default(this.options.resources, this.options);

      var s = this.services;
      s.logger = _logger2.default;
      s.resourceStore = this.store;
      s.resourceStore.on('added removed', function (lng, ns) {
        s.cacheConnector.save();
      });
      s.languageUtils = lu;
      s.pluralResolver = new _PluralResolver2.default(lu, { prepend: this.options.pluralSeparator, compatibilityJSON: this.options.compatibilityJSON, simplifyPluralSuffix: this.options.simplifyPluralSuffix });
      s.interpolator = new _Interpolator2.default(this.options);

      s.backendConnector = new _BackendConnector2.default(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
      // pipe events from backendConnector
      s.backendConnector.on('*', function (event) {
        for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
          args[_key - 1] = arguments[_key];
        }

        _this2.emit.apply(_this2, [event].concat(args));
      });

      s.backendConnector.on('loaded', function (loaded) {
        s.cacheConnector.save();
      });

      s.cacheConnector = new _CacheConnector2.default(createClassOnDemand(this.modules.cache), s.resourceStore, s, this.options);
      // pipe events from backendConnector
      s.cacheConnector.on('*', function (event) {
        for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
          args[_key2 - 1] = arguments[_key2];
        }

        _this2.emit.apply(_this2, [event].concat(args));
      });

      if (this.modules.languageDetector) {
        s.languageDetector = createClassOnDemand(this.modules.languageDetector);
        s.languageDetector.init(s, this.options.detection, this.options);
      }

      this.translator = new _Translator2.default(this.services, this.options);
      // pipe events from translator
      this.translator.on('*', function (event) {
        for (var _len3 = arguments.length, args = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
          args[_key3 - 1] = arguments[_key3];
        }

        _this2.emit.apply(_this2, [event].concat(args));
      });

      this.modules.external.forEach(function (m) {
        if (m.init) m.init(_this2);
      });
    }

    // append api
    var storeApi = ['getResource', 'addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle', 'hasResourceBundle', 'getResourceBundle'];
    storeApi.forEach(function (fcName) {
      _this2[fcName] = function () {
        var _store;

        return (_store = _this2.store)[fcName].apply(_store, arguments);
      };
    });

    var load = function load() {
      _this2.changeLanguage(_this2.options.lng, function (err, t) {
        _this2.isInitialized = true;
        _this2.logger.log('initialized', _this2.options);
        _this2.emit('initialized', _this2.options);

        callback(err, t);
      });
    };

    if (this.options.resources || !this.options.initImmediate) {
      load();
    } else {
      setTimeout(load, 0);
    }

    return this;
  };

  /* eslint consistent-return: 0 */

  I18n.prototype.loadResources = function loadResources() {
    var _this3 = this;

    var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : noop;

    if (!this.options.resources) {
      if (this.language && this.language.toLowerCase() === 'cimode') return callback(); // avoid loading resources for cimode

      var toLoad = [];

      var append = function append(lng) {
        if (!lng) return;
        var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
        lngs.forEach(function (l) {
          if (toLoad.indexOf(l) < 0) toLoad.push(l);
        });
      };

      if (!this.language) {
        // at least load fallbacks in this case
        var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
        fallbacks.forEach(function (l) {
          return append(l);
        });
      } else {
        append(this.language);
      }

      if (this.options.preload) {
        this.options.preload.forEach(function (l) {
          return append(l);
        });
      }

      this.services.cacheConnector.load(toLoad, this.options.ns, function () {
        _this3.services.backendConnector.load(toLoad, _this3.options.ns, callback);
      });
    } else {
      callback(null);
    }
  };

  I18n.prototype.reloadResources = function reloadResources(lngs, ns) {
    if (!lngs) lngs = this.languages;
    if (!ns) ns = this.options.ns;
    this.services.backendConnector.reload(lngs, ns);
  };

  I18n.prototype.use = function use(module) {
    if (module.type === 'backend') {
      this.modules.backend = module;
    }

    if (module.type === 'cache') {
      this.modules.cache = module;
    }

    if (module.type === 'logger' || module.log && module.warn && module.error) {
      this.modules.logger = module;
    }

    if (module.type === 'languageDetector') {
      this.modules.languageDetector = module;
    }

    if (module.type === 'postProcessor') {
      _postProcessor2.default.addPostProcessor(module);
    }

    if (module.type === '3rdParty') {
      this.modules.external.push(module);
    }

    return this;
  };

  I18n.prototype.changeLanguage = function changeLanguage(lng, callback) {
    var _this4 = this;

    var done = function done(err, l) {
      _this4.translator.changeLanguage(l);

      if (l) {
        _this4.emit('languageChanged', l);
        _this4.logger.log('languageChanged', l);
      }

      if (callback) callback(err, function () {
        return _this4.t.apply(_this4, arguments);
      });
    };

    var setLng = function setLng(l) {
      if (l) {
        _this4.language = l;
        _this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);
        if (!_this4.translator.language) _this4.translator.changeLanguage(l);

        if (_this4.services.languageDetector) _this4.services.languageDetector.cacheUserLanguage(l);
      }

      _this4.loadResources(function (err) {
        done(err, l);
      });
    };

    if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
      setLng(this.services.languageDetector.detect());
    } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
      this.services.languageDetector.detect(setLng);
    } else {
      setLng(lng);
    }
  };

  I18n.prototype.getFixedT = function getFixedT(lng, ns) {
    var _this5 = this;

    var fixedT = function fixedT(key, opts) {
      for (var _len4 = arguments.length, rest = Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
        rest[_key4 - 2] = arguments[_key4];
      }

      var options = _extends({}, opts);
      if ((typeof opts === 'undefined' ? 'undefined' : _typeof(opts)) !== 'object') {
        options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
      }

      options.lng = options.lng || fixedT.lng;
      options.lngs = options.lngs || fixedT.lngs;
      options.ns = options.ns || fixedT.ns;
      return _this5.t(key, options);
    };
    if (typeof lng === 'string') {
      fixedT.lng = lng;
    } else {
      fixedT.lngs = lng;
    }
    fixedT.ns = ns;
    return fixedT;
  };

  I18n.prototype.t = function t() {
    var _translator;

    return this.translator && (_translator = this.translator).translate.apply(_translator, arguments);
  };

  I18n.prototype.exists = function exists() {
    var _translator2;

    return this.translator && (_translator2 = this.translator).exists.apply(_translator2, arguments);
  };

  I18n.prototype.setDefaultNamespace = function setDefaultNamespace(ns) {
    this.options.defaultNS = ns;
  };

  I18n.prototype.loadNamespaces = function loadNamespaces(ns, callback) {
    var _this6 = this;

    if (!this.options.ns) return callback && callback();
    if (typeof ns === 'string') ns = [ns];

    ns.forEach(function (n) {
      if (_this6.options.ns.indexOf(n) < 0) _this6.options.ns.push(n);
    });

    this.loadResources(callback);
  };

  I18n.prototype.loadLanguages = function loadLanguages(lngs, callback) {
    if (typeof lngs === 'string') lngs = [lngs];
    var preloaded = this.options.preload || [];

    var newLngs = lngs.filter(function (lng) {
      return preloaded.indexOf(lng) < 0;
    });
    // Exit early if all given languages are already preloaded
    if (!newLngs.length) return callback();

    this.options.preload = preloaded.concat(newLngs);
    this.loadResources(callback);
  };

  I18n.prototype.dir = function dir(lng) {
    if (!lng) lng = this.languages && this.languages.length > 0 ? this.languages[0] : this.language;
    if (!lng) return 'rtl';

    var rtlLngs = ['ar', 'shu', 'sqr', 'ssh', 'xaa', 'yhd', 'yud', 'aao', 'abh', 'abv', 'acm', 'acq', 'acw', 'acx', 'acy', 'adf', 'ads', 'aeb', 'aec', 'afb', 'ajp', 'apc', 'apd', 'arb', 'arq', 'ars', 'ary', 'arz', 'auz', 'avl', 'ayh', 'ayl', 'ayn', 'ayp', 'bbz', 'pga', 'he', 'iw', 'ps', 'pbt', 'pbu', 'pst', 'prp', 'prd', 'ur', 'ydd', 'yds', 'yih', 'ji', 'yi', 'hbo', 'men', 'xmn', 'fa', 'jpr', 'peo', 'pes', 'prs', 'dv', 'sam'];

    return rtlLngs.indexOf(this.services.languageUtils.getLanguagePartFromCode(lng)) >= 0 ? 'rtl' : 'ltr';
  };

  /* eslint class-methods-use-this: 0 */

  I18n.prototype.createInstance = function createInstance() {
    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    var callback = arguments[1];

    return new I18n(options, callback);
  };

  I18n.prototype.cloneInstance = function cloneInstance() {
    var _this7 = this;

    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;

    var mergedOptions = _extends({}, this.options, options, { isClone: true });
    var clone = new I18n(mergedOptions);
    var membersToCopy = ['store', 'services', 'language'];
    membersToCopy.forEach(function (m) {
      clone[m] = _this7[m];
    });
    clone.translator = new _Translator2.default(clone.services, clone.options);
    clone.translator.on('*', function (event) {
      for (var _len5 = arguments.length, args = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
        args[_key5 - 1] = arguments[_key5];
      }

      clone.emit.apply(clone, [event].concat(args));
    });
    clone.init(mergedOptions, callback);
    clone.translator.options = clone.options; // sync options

    return clone;
  };

  return I18n;
}(_EventEmitter3.default);

exports.default = new I18n();

/***/ }),
/* 473 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _EventEmitter2 = __webpack_require__(72);

var _EventEmitter3 = _interopRequireDefault(_EventEmitter2);

var _utils = __webpack_require__(96);

var utils = _interopRequireWildcard(_utils);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _extends = Object.assign || function (target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i];for (var key in source) {
      if (Object.prototype.hasOwnProperty.call(source, key)) {
        target[key] = source[key];
      }
    }
  }return target;
};

function _defaults(obj, defaults) {
  var keys = Object.getOwnPropertyNames(defaults);for (var i = 0; i < keys.length; i++) {
    var key = keys[i];var value = Object.getOwnPropertyDescriptor(defaults, key);if (value && value.configurable && obj[key] === undefined) {
      Object.defineProperty(obj, key, value);
    }
  }return obj;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

function _possibleConstructorReturn(self, call) {
  if (!self) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self;
}

function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _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) : _defaults(subClass, superClass);
}

var ResourceStore = function (_EventEmitter) {
  _inherits(ResourceStore, _EventEmitter);

  function ResourceStore(data) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { ns: ['translation'], defaultNS: 'translation' };

    _classCallCheck(this, ResourceStore);

    var _this = _possibleConstructorReturn(this, _EventEmitter.call(this));

    _this.data = data || {};
    _this.options = options;
    return _this;
  }

  ResourceStore.prototype.addNamespaces = function addNamespaces(ns) {
    if (this.options.ns.indexOf(ns) < 0) {
      this.options.ns.push(ns);
    }
  };

  ResourceStore.prototype.removeNamespaces = function removeNamespaces(ns) {
    var index = this.options.ns.indexOf(ns);
    if (index > -1) {
      this.options.ns.splice(index, 1);
    }
  };

  ResourceStore.prototype.getResource = function getResource(lng, ns, key) {
    var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};

    var keySeparator = options.keySeparator || this.options.keySeparator;
    if (keySeparator === undefined) keySeparator = '.';

    var path = [lng, ns];
    if (key && typeof key !== 'string') path = path.concat(key);
    if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);

    if (lng.indexOf('.') > -1) {
      path = lng.split('.');
    }

    return utils.getPath(this.data, path);
  };

  ResourceStore.prototype.addResource = function addResource(lng, ns, key, value) {
    var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : { silent: false };

    var keySeparator = this.options.keySeparator;
    if (keySeparator === undefined) keySeparator = '.';

    var path = [lng, ns];
    if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);

    if (lng.indexOf('.') > -1) {
      path = lng.split('.');
      value = ns;
      ns = path[1];
    }

    this.addNamespaces(ns);

    utils.setPath(this.data, path, value);

    if (!options.silent) this.emit('added', lng, ns, key, value);
  };

  ResourceStore.prototype.addResources = function addResources(lng, ns, resources) {
    var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : { silent: false };

    /* eslint no-restricted-syntax: 0 */
    for (var m in resources) {
      if (typeof resources[m] === 'string') this.addResource(lng, ns, m, resources[m], { silent: true });
    }
    if (!options.silent) this.emit('added', lng, ns, resources);
  };

  ResourceStore.prototype.addResourceBundle = function addResourceBundle(lng, ns, resources, deep, overwrite) {
    var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : { silent: false };

    var path = [lng, ns];
    if (lng.indexOf('.') > -1) {
      path = lng.split('.');
      deep = resources;
      resources = ns;
      ns = path[1];
    }

    this.addNamespaces(ns);

    var pack = utils.getPath(this.data, path) || {};

    if (deep) {
      utils.deepExtend(pack, resources, overwrite);
    } else {
      pack = _extends({}, pack, resources);
    }

    utils.setPath(this.data, path, pack);

    if (!options.silent) this.emit('added', lng, ns, resources);
  };

  ResourceStore.prototype.removeResourceBundle = function removeResourceBundle(lng, ns) {
    if (this.hasResourceBundle(lng, ns)) {
      delete this.data[lng][ns];
    }
    this.removeNamespaces(ns);

    this.emit('removed', lng, ns);
  };

  ResourceStore.prototype.hasResourceBundle = function hasResourceBundle(lng, ns) {
    return this.getResource(lng, ns) !== undefined;
  };

  ResourceStore.prototype.getResourceBundle = function getResourceBundle(lng, ns) {
    if (!ns) ns = this.options.defaultNS;

    // COMPATIBILITY: remove extend in v2.1.0
    if (this.options.compatibilityAPI === 'v1') return _extends({}, this.getResource(lng, ns));

    return this.getResource(lng, ns);
  };

  ResourceStore.prototype.toJSON = function toJSON() {
    return this.data;
  };

  return ResourceStore;
}(_EventEmitter3.default);

exports.default = ResourceStore;

/***/ }),
/* 474 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});

var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _logger = __webpack_require__(56);

var _logger2 = _interopRequireDefault(_logger);

var _EventEmitter2 = __webpack_require__(72);

var _EventEmitter3 = _interopRequireDefault(_EventEmitter2);

var _postProcessor = __webpack_require__(207);

var _postProcessor2 = _interopRequireDefault(_postProcessor);

var _utils = __webpack_require__(96);

var utils = _interopRequireWildcard(_utils);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _extends = Object.assign || function (target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i];for (var key in source) {
      if (Object.prototype.hasOwnProperty.call(source, key)) {
        target[key] = source[key];
      }
    }
  }return target;
};

var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
  return typeof obj === "undefined" ? "undefined" : _typeof2(obj);
} : function (obj) {
  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj);
};

function _defaults(obj, defaults) {
  var keys = Object.getOwnPropertyNames(defaults);for (var i = 0; i < keys.length; i++) {
    var key = keys[i];var value = Object.getOwnPropertyDescriptor(defaults, key);if (value && value.configurable && obj[key] === undefined) {
      Object.defineProperty(obj, key, value);
    }
  }return obj;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

function _possibleConstructorReturn(self, call) {
  if (!self) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }return call && ((typeof call === "undefined" ? "undefined" : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
}

function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _typeof2(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) : _defaults(subClass, superClass);
}

var Translator = function (_EventEmitter) {
  _inherits(Translator, _EventEmitter);

  function Translator(services) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    _classCallCheck(this, Translator);

    var _this = _possibleConstructorReturn(this, _EventEmitter.call(this));

    utils.copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector'], services, _this);

    _this.options = options;
    _this.logger = _logger2.default.create('translator');
    return _this;
  }

  Translator.prototype.changeLanguage = function changeLanguage(lng) {
    if (lng) this.language = lng;
  };

  Translator.prototype.exists = function exists(key) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { interpolation: {} };

    var resolved = this.resolve(key, options);
    return resolved && resolved.res !== undefined;
  };

  Translator.prototype.extractFromKey = function extractFromKey(key, options) {
    var nsSeparator = options.nsSeparator || this.options.nsSeparator;
    if (nsSeparator === undefined) nsSeparator = ':';
    var keySeparator = options.keySeparator || this.options.keySeparator || '.';

    var namespaces = options.ns || this.options.defaultNS;
    if (nsSeparator && key.indexOf(nsSeparator) > -1) {
      var parts = key.split(nsSeparator);
      if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
      key = parts.join(keySeparator);
    }
    if (typeof namespaces === 'string') namespaces = [namespaces];

    return {
      key: key,
      namespaces: namespaces
    };
  };

  Translator.prototype.translate = function translate(keys, options) {
    var _this2 = this;

    if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object' && this.options.overloadTranslationOptionHandler) {
      /* eslint prefer-rest-params: 0 */
      options = this.options.overloadTranslationOptionHandler(arguments);
    }
    if (!options) options = {};

    // non valid keys handling
    if (keys === undefined || keys === null || keys === '') return '';
    if (typeof keys === 'number') keys = String(keys);
    if (typeof keys === 'string') keys = [keys];

    // separators
    var keySeparator = options.keySeparator || this.options.keySeparator || '.';

    // get namespace(s)

    var _extractFromKey = this.extractFromKey(keys[keys.length - 1], options),
        key = _extractFromKey.key,
        namespaces = _extractFromKey.namespaces;

    var namespace = namespaces[namespaces.length - 1];

    // return key on CIMode
    var lng = options.lng || this.language;
    var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
    if (lng && lng.toLowerCase() === 'cimode') {
      if (appendNamespaceToCIMode) {
        var nsSeparator = options.nsSeparator || this.options.nsSeparator;
        return namespace + nsSeparator + key;
      }

      return key;
    }

    // resolve from store
    var resolved = this.resolve(keys, options);
    var res = resolved && resolved.res;
    var resUsedKey = resolved && resolved.usedKey || key;

    var resType = Object.prototype.toString.apply(res);
    var noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
    var joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;

    // object
    var handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';
    if (res && handleAsObject && noObject.indexOf(resType) < 0 && !(joinArrays && resType === '[object Array]')) {
      if (!options.returnObjects && !this.options.returnObjects) {
        this.logger.warn('accessing an object - but returnObjects options is not enabled!');
        return this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, options) : 'key \'' + key + ' (' + this.language + ')\' returned an object instead of string.';
      }

      // if we got a separator we loop over children - else we just return object as is
      // as having it set to false means no hierarchy so no lookup for nested values
      if (options.keySeparator || this.options.keySeparator) {
        var copy = resType === '[object Array]' ? [] : {}; // apply child translation on a copy

        /* eslint no-restricted-syntax: 0 */
        for (var m in res) {
          if (Object.prototype.hasOwnProperty.call(res, m)) {
            var deepKey = '' + resUsedKey + keySeparator + m;
            copy[m] = this.translate(deepKey, _extends({}, options, { joinArrays: false, ns: namespaces }));
            if (copy[m] === deepKey) copy[m] = res[m]; // if nothing found use orginal value as fallback
          }
        }
        res = copy;
      }
    } else if (joinArrays && resType === '[object Array]') {
      // array special treatment
      res = res.join(joinArrays);
      if (res) res = this.extendTranslation(res, keys, options);
    } else {
      // string, empty or null
      var usedDefault = false;
      var usedKey = false;

      // fallback value
      if (!this.isValidLookup(res) && options.defaultValue !== undefined) {
        usedDefault = true;
        res = options.defaultValue;
      }
      if (!this.isValidLookup(res)) {
        usedKey = true;
        res = key;
      }

      // save missing
      var updateMissing = options.defaultValue && options.defaultValue !== res && this.options.updateMissing;
      if (usedKey || usedDefault || updateMissing) {
        this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? options.defaultValue : res);

        var lngs = [];
        var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
        if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
          for (var i = 0; i < fallbackLngs.length; i++) {
            lngs.push(fallbackLngs[i]);
          }
        } else if (this.options.saveMissingTo === 'all') {
          lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
        } else {
          lngs.push(options.lng || this.language);
        }

        var send = function send(l, k) {
          if (_this2.options.missingKeyHandler) {
            _this2.options.missingKeyHandler(l, namespace, k, updateMissing ? options.defaultValue : res, updateMissing, options);
          } else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {
            _this2.backendConnector.saveMissing(l, namespace, k, updateMissing ? options.defaultValue : res, updateMissing, options);
          }
          _this2.emit('missingKey', l, namespace, k, res);
        };

        if (this.options.saveMissing) {
          if (this.options.saveMissingPlurals && options.count) {
            lngs.forEach(function (l) {
              var plurals = _this2.pluralResolver.getPluralFormsOfKey(l, key);

              plurals.forEach(function (p) {
                return send([l], p);
              });
            });
          } else {
            send(lngs, key);
          }
        }
      }

      // extend
      res = this.extendTranslation(res, keys, options);

      // append namespace if still key
      if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = namespace + ':' + key;

      // parseMissingKeyHandler
      if (usedKey && this.options.parseMissingKeyHandler) res = this.options.parseMissingKeyHandler(res);
    }

    // return
    return res;
  };

  Translator.prototype.extendTranslation = function extendTranslation(res, key, options) {
    var _this3 = this;

    if (options.interpolation) this.interpolator.init(_extends({}, options, { interpolation: _extends({}, this.options.interpolation, options.interpolation) }));

    // interpolate
    var data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
    if (this.options.interpolation.defaultVariables) data = _extends({}, this.options.interpolation.defaultVariables, data);
    res = this.interpolator.interpolate(res, data, options.lng || this.language);

    // nesting
    if (options.nest !== false) res = this.interpolator.nest(res, function () {
      return _this3.translate.apply(_this3, arguments);
    }, options);

    if (options.interpolation) this.interpolator.reset();

    // post process
    var postProcess = options.postProcess || this.options.postProcess;
    var postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;

    if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
      res = _postProcessor2.default.handle(postProcessorNames, res, key, options, this);
    }

    return res;
  };

  Translator.prototype.resolve = function resolve(keys) {
    var _this4 = this;

    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    var found = void 0;
    var usedKey = void 0;

    if (typeof keys === 'string') keys = [keys];

    // forEach possible key
    keys.forEach(function (k) {
      if (_this4.isValidLookup(found)) return;
      var extracted = _this4.extractFromKey(k, options);
      var key = extracted.key;
      usedKey = key;
      var namespaces = extracted.namespaces;
      if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS);

      var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
      var needsContextHandling = options.context !== undefined && typeof options.context === 'string' && options.context !== '';

      var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language);

      namespaces.forEach(function (ns) {
        if (_this4.isValidLookup(found)) return;

        codes.forEach(function (code) {
          if (_this4.isValidLookup(found)) return;

          var finalKey = key;
          var finalKeys = [finalKey];

          var pluralSuffix = void 0;
          if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count);

          // fallback for plural if context not found
          if (needsPluralHandling && needsContextHandling) finalKeys.push(finalKey + pluralSuffix);

          // get key for context if needed
          if (needsContextHandling) finalKeys.push(finalKey += '' + _this4.options.contextSeparator + options.context);

          // get key for plural if needed
          if (needsPluralHandling) finalKeys.push(finalKey += pluralSuffix);

          // iterate over finalKeys starting with most specific pluralkey (-> contextkey only) -> singularkey only
          var possibleKey = void 0;
          /* eslint no-cond-assign: 0 */
          while (possibleKey = finalKeys.pop()) {
            if (!_this4.isValidLookup(found)) {
              found = _this4.getResource(code, ns, possibleKey, options);
            }
          }
        });
      });
    });

    return { res: found, usedKey: usedKey };
  };

  Translator.prototype.isValidLookup = function isValidLookup(res) {
    return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
  };

  Translator.prototype.getResource = function getResource(code, ns, key) {
    var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};

    return this.resourceStore.getResource(code, ns, key, options);
  };

  return Translator;
}(_EventEmitter3.default);

exports.default = Translator;

/***/ }),
/* 475 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});

var _logger = __webpack_require__(56);

var _logger2 = _interopRequireDefault(_logger);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

function capitalize(string) {
  return string.charAt(0).toUpperCase() + string.slice(1);
}

var LanguageUtil = function () {
  function LanguageUtil(options) {
    _classCallCheck(this, LanguageUtil);

    this.options = options;

    this.whitelist = this.options.whitelist || false;
    this.logger = _logger2.default.create('languageUtils');
  }

  LanguageUtil.prototype.getScriptPartFromCode = function getScriptPartFromCode(code) {
    if (!code || code.indexOf('-') < 0) return null;

    var p = code.split('-');
    if (p.length === 2) return null;
    p.pop();
    return this.formatLanguageCode(p.join('-'));
  };

  LanguageUtil.prototype.getLanguagePartFromCode = function getLanguagePartFromCode(code) {
    if (!code || code.indexOf('-') < 0) return code;

    var p = code.split('-');
    return this.formatLanguageCode(p[0]);
  };

  LanguageUtil.prototype.formatLanguageCode = function formatLanguageCode(code) {
    // http://www.iana.org/assignments/language-tags/language-tags.xhtml
    if (typeof code === 'string' && code.indexOf('-') > -1) {
      var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
      var p = code.split('-');

      if (this.options.lowerCaseLng) {
        p = p.map(function (part) {
          return part.toLowerCase();
        });
      } else if (p.length === 2) {
        p[0] = p[0].toLowerCase();
        p[1] = p[1].toUpperCase();

        if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
      } else if (p.length === 3) {
        p[0] = p[0].toLowerCase();

        // if lenght 2 guess it's a country
        if (p[1].length === 2) p[1] = p[1].toUpperCase();
        if (p[0] !== 'sgn' && p[2].length === 2) p[2] = p[2].toUpperCase();

        if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
        if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize(p[2].toLowerCase());
      }

      return p.join('-');
    }

    return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
  };

  LanguageUtil.prototype.isWhitelisted = function isWhitelisted(code) {
    if (this.options.load === 'languageOnly' || this.options.nonExplicitWhitelist) {
      code = this.getLanguagePartFromCode(code);
    }
    return !this.whitelist || !this.whitelist.length || this.whitelist.indexOf(code) > -1;
  };

  LanguageUtil.prototype.getFallbackCodes = function getFallbackCodes(fallbacks, code) {
    if (!fallbacks) return [];
    if (typeof fallbacks === 'string') fallbacks = [fallbacks];
    if (Object.prototype.toString.apply(fallbacks) === '[object Array]') return fallbacks;

    if (!code) return fallbacks.default || [];

    // asume we have an object defining fallbacks
    var found = fallbacks[code];
    if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
    if (!found) found = fallbacks[this.formatLanguageCode(code)];
    if (!found) found = fallbacks.default;

    return found || [];
  };

  LanguageUtil.prototype.toResolveHierarchy = function toResolveHierarchy(code, fallbackCode) {
    var _this = this;

    var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);

    var codes = [];
    var addCode = function addCode(c) {
      if (!c) return;
      if (_this.isWhitelisted(c)) {
        codes.push(c);
      } else {
        _this.logger.warn('rejecting non-whitelisted language code: ' + c);
      }
    };

    if (typeof code === 'string' && code.indexOf('-') > -1) {
      if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
      if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
      if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
    } else if (typeof code === 'string') {
      addCode(this.formatLanguageCode(code));
    }

    fallbackCodes.forEach(function (fc) {
      if (codes.indexOf(fc) < 0) addCode(_this.formatLanguageCode(fc));
    });

    return codes;
  };

  return LanguageUtil;
}();

exports.default = LanguageUtil;

/***/ }),
/* 476 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});

var _logger = __webpack_require__(56);

var _logger2 = _interopRequireDefault(_logger);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

// definition http://translate.sourceforge.net/wiki/l10n/pluralforms
/* eslint-disable */
var sets = [{ lngs: ['ach', 'ak', 'am', 'arn', 'br', 'fil', 'gun', 'ln', 'mfe', 'mg', 'mi', 'oc', 'pt', 'pt-BR', 'tg', 'ti', 'tr', 'uz', 'wa'], nr: [1, 2], fc: 1 }, { lngs: ['af', 'an', 'ast', 'az', 'bg', 'bn', 'ca', 'da', 'de', 'dev', 'el', 'en', 'eo', 'es', 'et', 'eu', 'fi', 'fo', 'fur', 'fy', 'gl', 'gu', 'ha', 'he', 'hi', 'hu', 'hy', 'ia', 'it', 'kn', 'ku', 'lb', 'mai', 'ml', 'mn', 'mr', 'nah', 'nap', 'nb', 'ne', 'nl', 'nn', 'no', 'nso', 'pa', 'pap', 'pms', 'ps', 'pt-PT', 'rm', 'sco', 'se', 'si', 'so', 'son', 'sq', 'sv', 'sw', 'ta', 'te', 'tk', 'ur', 'yo'], nr: [1, 2], fc: 2 }, { lngs: ['ay', 'bo', 'cgg', 'fa', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky', 'lo', 'ms', 'sah', 'su', 'th', 'tt', 'ug', 'vi', 'wo', 'zh'], nr: [1], fc: 3 }, { lngs: ['be', 'bs', 'dz', 'hr', 'ru', 'sr', 'uk'], nr: [1, 2, 5], fc: 4 }, { lngs: ['ar'], nr: [0, 1, 2, 3, 11, 100], fc: 5 }, { lngs: ['cs', 'sk'], nr: [1, 2, 5], fc: 6 }, { lngs: ['csb', 'pl'], nr: [1, 2, 5], fc: 7 }, { lngs: ['cy'], nr: [1, 2, 3, 8], fc: 8 }, { lngs: ['fr'], nr: [1, 2], fc: 9 }, { lngs: ['ga'], nr: [1, 2, 3, 7, 11], fc: 10 }, { lngs: ['gd'], nr: [1, 2, 3, 20], fc: 11 }, { lngs: ['is'], nr: [1, 2], fc: 12 }, { lngs: ['jv'], nr: [0, 1], fc: 13 }, { lngs: ['kw'], nr: [1, 2, 3, 4], fc: 14 }, { lngs: ['lt'], nr: [1, 2, 10], fc: 15 }, { lngs: ['lv'], nr: [1, 2, 0], fc: 16 }, { lngs: ['mk'], nr: [1, 2], fc: 17 }, { lngs: ['mnk'], nr: [0, 1, 2], fc: 18 }, { lngs: ['mt'], nr: [1, 2, 11, 20], fc: 19 }, { lngs: ['or'], nr: [2, 1], fc: 2 }, { lngs: ['ro'], nr: [1, 2, 20], fc: 20 }, { lngs: ['sl'], nr: [5, 1, 2, 3], fc: 21 }];

var _rulesPluralsTypes = {
  1: function _(n) {
    return Number(n > 1);
  },
  2: function _(n) {
    return Number(n != 1);
  },
  3: function _(n) {
    return 0;
  },
  4: function _(n) {
    return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
  },
  5: function _(n) {
    return Number(n === 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5);
  },
  6: function _(n) {
    return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);
  },
  7: function _(n) {
    return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
  },
  8: function _(n) {
    return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);
  },
  9: function _(n) {
    return Number(n >= 2);
  },
  10: function _(n) {
    return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);
  },
  11: function _(n) {
    return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);
  },
  12: function _(n) {
    return Number(n % 10 != 1 || n % 100 == 11);
  },
  13: function _(n) {
    return Number(n !== 0);
  },
  14: function _(n) {
    return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);
  },
  15: function _(n) {
    return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
  },
  16: function _(n) {
    return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);
  },
  17: function _(n) {
    return Number(n == 1 || n % 10 == 1 ? 0 : 1);
  },
  18: function _(n) {
    return Number(n == 0 ? 0 : n == 1 ? 1 : 2);
  },
  19: function _(n) {
    return Number(n == 1 ? 0 : n === 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3);
  },
  20: function _(n) {
    return Number(n == 1 ? 0 : n === 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2);
  },
  21: function _(n) {
    return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);
  }
};
/* eslint-enable */

function createRules() {
  var rules = {};
  sets.forEach(function (set) {
    set.lngs.forEach(function (l) {
      rules[l] = {
        numbers: set.nr,
        plurals: _rulesPluralsTypes[set.fc]
      };
    });
  });
  return rules;
}

var PluralResolver = function () {
  function PluralResolver(languageUtils) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    _classCallCheck(this, PluralResolver);

    this.languageUtils = languageUtils;
    this.options = options;

    this.logger = _logger2.default.create('pluralResolver');

    this.rules = createRules();
  }

  PluralResolver.prototype.addRule = function addRule(lng, obj) {
    this.rules[lng] = obj;
  };

  PluralResolver.prototype.getRule = function getRule(code) {
    return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];
  };

  PluralResolver.prototype.needsPlural = function needsPlural(code) {
    var rule = this.getRule(code);

    return rule && rule.numbers.length > 1;
  };

  PluralResolver.prototype.getPluralFormsOfKey = function getPluralFormsOfKey(code, key) {
    var _this = this;

    var ret = [];

    var rule = this.getRule(code);

    rule.numbers.forEach(function (n) {
      var suffix = _this.getSuffix(code, n);
      ret.push('' + key + suffix);
    });

    return ret;
  };

  PluralResolver.prototype.getSuffix = function getSuffix(code, count) {
    var _this2 = this;

    var rule = this.getRule(code);

    if (rule) {
      // if (rule.numbers.length === 1) return ''; // only singular

      var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
      var suffix = rule.numbers[idx];

      // special treatment for lngs only having singular and plural
      if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
        if (suffix === 2) {
          suffix = 'plural';
        } else if (suffix === 1) {
          suffix = '';
        }
      }

      var returnSuffix = function returnSuffix() {
        return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();
      };

      // COMPATIBILITY JSON
      // v1
      if (this.options.compatibilityJSON === 'v1') {
        if (suffix === 1) return '';
        if (typeof suffix === 'number') return '_plural_' + suffix.toString();
        return returnSuffix();
      } else if ( /* v2 */this.options.compatibilityJSON === 'v2' || rule.numbers.length === 2 && rule.numbers[0] === 1) {
        return returnSuffix();
      } else if ( /* v3 - gettext index */rule.numbers.length === 2 && rule.numbers[0] === 1) {
        return returnSuffix();
      }
      return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
    }

    this.logger.warn('no plural rule found for: ' + code);
    return '';
  };

  return PluralResolver;
}();

exports.default = PluralResolver;

/***/ }),
/* 477 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});

var _utils = __webpack_require__(96);

var utils = _interopRequireWildcard(_utils);

var _logger = __webpack_require__(56);

var _logger2 = _interopRequireDefault(_logger);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

var _extends = Object.assign || function (target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i];for (var key in source) {
      if (Object.prototype.hasOwnProperty.call(source, key)) {
        target[key] = source[key];
      }
    }
  }return target;
};

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

var Interpolator = function () {
  function Interpolator() {
    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

    _classCallCheck(this, Interpolator);

    this.logger = _logger2.default.create('interpolator');

    this.init(options, true);
  }

  /* eslint no-param-reassign: 0 */

  Interpolator.prototype.init = function init() {
    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    var reset = arguments[1];

    if (reset) {
      this.options = options;
      this.format = options.interpolation && options.interpolation.format || function (value) {
        return value;
      };
      this.escape = options.interpolation && options.interpolation.escape || utils.escape;
    }
    if (!options.interpolation) options.interpolation = { escapeValue: true };

    var iOpts = options.interpolation;

    this.escapeValue = iOpts.escapeValue !== undefined ? iOpts.escapeValue : true;

    this.prefix = iOpts.prefix ? utils.regexEscape(iOpts.prefix) : iOpts.prefixEscaped || '{{';
    this.suffix = iOpts.suffix ? utils.regexEscape(iOpts.suffix) : iOpts.suffixEscaped || '}}';

    this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';

    this.unescapePrefix = iOpts.unescapeSuffix ? '' : iOpts.unescapePrefix || '-';
    this.unescapeSuffix = this.unescapePrefix ? '' : iOpts.unescapeSuffix || '';

    this.nestingPrefix = iOpts.nestingPrefix ? utils.regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || utils.regexEscape('$t(');
    this.nestingSuffix = iOpts.nestingSuffix ? utils.regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || utils.regexEscape(')');

    this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1000;

    // the regexp
    this.resetRegExp();
  };

  Interpolator.prototype.reset = function reset() {
    if (this.options) this.init(this.options);
  };

  Interpolator.prototype.resetRegExp = function resetRegExp() {
    // the regexp
    var regexpStr = this.prefix + '(.+?)' + this.suffix;
    this.regexp = new RegExp(regexpStr, 'g');

    var regexpUnescapeStr = '' + this.prefix + this.unescapePrefix + '(.+?)' + this.unescapeSuffix + this.suffix;
    this.regexpUnescape = new RegExp(regexpUnescapeStr, 'g');

    var nestingRegexpStr = this.nestingPrefix + '(.+?)' + this.nestingSuffix;
    this.nestingRegexp = new RegExp(nestingRegexpStr, 'g');
  };

  Interpolator.prototype.interpolate = function interpolate(str, data, lng) {
    var _this = this;

    var match = void 0;
    var value = void 0;
    var replaces = void 0;

    function regexSafe(val) {
      return val.replace(/\$/g, '$$$$');
    }

    var handleFormat = function handleFormat(key) {
      if (key.indexOf(_this.formatSeparator) < 0) return utils.getPath(data, key);

      var p = key.split(_this.formatSeparator);
      var k = p.shift().trim();
      var f = p.join(_this.formatSeparator).trim();

      return _this.format(utils.getPath(data, k), f, lng);
    };

    this.resetRegExp();

    replaces = 0;
    // unescape if has unescapePrefix/Suffix
    /* eslint no-cond-assign: 0 */
    while (match = this.regexpUnescape.exec(str)) {
      value = handleFormat(match[1].trim());
      str = str.replace(match[0], value);
      this.regexpUnescape.lastIndex = 0;
      replaces++;
      if (replaces >= this.maxReplaces) {
        break;
      }
    }

    replaces = 0;
    // regular escape on demand
    while (match = this.regexp.exec(str)) {
      value = handleFormat(match[1].trim());
      if (typeof value !== 'string') value = utils.makeString(value);
      if (!value) {
        this.logger.warn('missed to pass in variable ' + match[1] + ' for interpolating ' + str);
        value = '';
      }
      value = this.escapeValue ? regexSafe(this.escape(value)) : regexSafe(value);
      str = str.replace(match[0], value);
      this.regexp.lastIndex = 0;
      replaces++;
      if (replaces >= this.maxReplaces) {
        break;
      }
    }
    return str;
  };

  Interpolator.prototype.nest = function nest(str, fc) {
    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

    var match = void 0;
    var value = void 0;

    var clonedOptions = _extends({}, options);
    clonedOptions.applyPostProcessor = false; // avoid post processing on nested lookup

    // if value is something like "myKey": "lorem $(anotherKey, { "count": {{aValueInOptions}} })"
    function handleHasOptions(key, inheritedOptions) {
      if (key.indexOf(',') < 0) return key;

      var p = key.split(',');
      key = p.shift();
      var optionsString = p.join(',');
      optionsString = this.interpolate(optionsString, clonedOptions);
      optionsString = optionsString.replace(/'/g, '"');

      try {
        clonedOptions = JSON.parse(optionsString);

        if (inheritedOptions) clonedOptions = _extends({}, inheritedOptions, clonedOptions);
      } catch (e) {
        this.logger.error('failed parsing options string in nesting for key ' + key, e);
      }

      return key;
    }

    // regular escape on demand
    while (match = this.nestingRegexp.exec(str)) {
      value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);

      // is only the nesting key (key1 = '$(key2)') return the value without stringify
      if (value && match[0] === str && typeof value !== 'string') return value;

      // no string to include or empty
      if (typeof value !== 'string') value = utils.makeString(value);
      if (!value) {
        this.logger.warn('missed to resolve ' + match[1] + ' for nesting ' + str);
        value = '';
      }
      // Nested keys should not be escaped by default #854
      // value = this.escapeValue ? regexSafe(utils.escape(value)) : regexSafe(value);
      str = str.replace(match[0], value);
      this.regexp.lastIndex = 0;
    }
    return str;
  };

  return Interpolator;
}();

exports.default = Interpolator;

/***/ }),
/* 478 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _utils = __webpack_require__(96);

var utils = _interopRequireWildcard(_utils);

var _logger = __webpack_require__(56);

var _logger2 = _interopRequireDefault(_logger);

var _EventEmitter2 = __webpack_require__(72);

var _EventEmitter3 = _interopRequireDefault(_EventEmitter2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

var _extends = Object.assign || function (target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i];for (var key in source) {
      if (Object.prototype.hasOwnProperty.call(source, key)) {
        target[key] = source[key];
      }
    }
  }return target;
};

var _slicedToArray = function () {
  function sliceIterator(arr, i) {
    var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
        _arr.push(_s.value);if (i && _arr.length === i) break;
      }
    } catch (err) {
      _d = true;_e = err;
    } finally {
      try {
        if (!_n && _i["return"]) _i["return"]();
      } finally {
        if (_d) throw _e;
      }
    }return _arr;
  }return function (arr, i) {
    if (Array.isArray(arr)) {
      return arr;
    } else if (Symbol.iterator in Object(arr)) {
      return sliceIterator(arr, i);
    } else {
      throw new TypeError("Invalid attempt to destructure non-iterable instance");
    }
  };
}();

function _defaults(obj, defaults) {
  var keys = Object.getOwnPropertyNames(defaults);for (var i = 0; i < keys.length; i++) {
    var key = keys[i];var value = Object.getOwnPropertyDescriptor(defaults, key);if (value && value.configurable && obj[key] === undefined) {
      Object.defineProperty(obj, key, value);
    }
  }return obj;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

function _possibleConstructorReturn(self, call) {
  if (!self) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self;
}

function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _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) : _defaults(subClass, superClass);
}

function remove(arr, what) {
  var found = arr.indexOf(what);

  while (found !== -1) {
    arr.splice(found, 1);
    found = arr.indexOf(what);
  }
}

var Connector = function (_EventEmitter) {
  _inherits(Connector, _EventEmitter);

  function Connector(backend, store, services) {
    var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};

    _classCallCheck(this, Connector);

    var _this = _possibleConstructorReturn(this, _EventEmitter.call(this));

    _this.backend = backend;
    _this.store = store;
    _this.languageUtils = services.languageUtils;
    _this.options = options;
    _this.logger = _logger2.default.create('backendConnector');

    _this.state = {};
    _this.queue = [];

    if (_this.backend && _this.backend.init) {
      _this.backend.init(services, options.backend, options);
    }
    return _this;
  }

  Connector.prototype.queueLoad = function queueLoad(languages, namespaces, callback) {
    var _this2 = this;

    // find what needs to be loaded
    var toLoad = [];
    var pending = [];
    var toLoadLanguages = [];
    var toLoadNamespaces = [];

    languages.forEach(function (lng) {
      var hasAllNamespaces = true;

      namespaces.forEach(function (ns) {
        var name = lng + '|' + ns;

        if (_this2.store.hasResourceBundle(lng, ns)) {
          _this2.state[name] = 2; // loaded
        } else if (_this2.state[name] < 0) {
          // nothing to do for err
        } else if (_this2.state[name] === 1) {
          if (pending.indexOf(name) < 0) pending.push(name);
        } else {
          _this2.state[name] = 1; // pending

          hasAllNamespaces = false;

          if (pending.indexOf(name) < 0) pending.push(name);
          if (toLoad.indexOf(name) < 0) toLoad.push(name);
          if (toLoadNamespaces.indexOf(ns) < 0) toLoadNamespaces.push(ns);
        }
      });

      if (!hasAllNamespaces) toLoadLanguages.push(lng);
    });

    if (toLoad.length || pending.length) {
      this.queue.push({
        pending: pending,
        loaded: {},
        errors: [],
        callback: callback
      });
    }

    return {
      toLoad: toLoad,
      pending: pending,
      toLoadLanguages: toLoadLanguages,
      toLoadNamespaces: toLoadNamespaces
    };
  };

  Connector.prototype.loaded = function loaded(name, err, data) {
    var _this3 = this;

    var _name$split = name.split('|'),
        _name$split2 = _slicedToArray(_name$split, 2),
        lng = _name$split2[0],
        ns = _name$split2[1];

    if (err) this.emit('failedLoading', lng, ns, err);

    if (data) {
      this.store.addResourceBundle(lng, ns, data);
    }

    // set loaded
    this.state[name] = err ? -1 : 2;

    // callback if ready
    this.queue.forEach(function (q) {
      utils.pushPath(q.loaded, [lng], ns);
      remove(q.pending, name);

      if (err) q.errors.push(err);

      if (q.pending.length === 0 && !q.done) {
        _this3.emit('loaded', q.loaded);
        /* eslint no-param-reassign: 0 */
        q.done = true;
        if (q.errors.length) {
          q.callback(q.errors);
        } else {
          q.callback();
        }
      }
    });

    // remove done load requests
    this.queue = this.queue.filter(function (q) {
      return !q.done;
    });
  };

  Connector.prototype.read = function read(lng, ns, fcName) {
    var tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;

    var _this4 = this;

    var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 250;
    var callback = arguments[5];

    if (!lng.length) return callback(null, {}); // noting to load

    return this.backend[fcName](lng, ns, function (err, data) {
      if (err && data /* = retryFlag */ && tried < 5) {
        setTimeout(function () {
          _this4.read.call(_this4, lng, ns, fcName, tried + 1, wait * 2, callback);
        }, wait);
        return;
      }
      callback(err, data);
    });
  };

  /* eslint consistent-return: 0 */

  Connector.prototype.load = function load(languages, namespaces, callback) {
    var _this5 = this;

    if (!this.backend) {
      this.logger.warn('No backend was added via i18next.use. Will not load resources.');
      return callback && callback();
    }
    var options = _extends({}, this.backend.options, this.options.backend);

    if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
    if (typeof namespaces === 'string') namespaces = [namespaces];

    var toLoad = this.queueLoad(languages, namespaces, callback);
    if (!toLoad.toLoad.length) {
      if (!toLoad.pending.length) callback(); // nothing to load and no pendings...callback now
      return null; // pendings will trigger callback
    }

    // load with multi-load
    if (options.allowMultiLoading && this.backend.readMulti) {
      this.read(toLoad.toLoadLanguages, toLoad.toLoadNamespaces, 'readMulti', null, null, function (err, data) {
        if (err) _this5.logger.warn('loading namespaces ' + toLoad.toLoadNamespaces.join(', ') + ' for languages ' + toLoad.toLoadLanguages.join(', ') + ' via multiloading failed', err);
        if (!err && data) _this5.logger.log('successfully loaded namespaces ' + toLoad.toLoadNamespaces.join(', ') + ' for languages ' + toLoad.toLoadLanguages.join(', ') + ' via multiloading', data);

        toLoad.toLoad.forEach(function (name) {
          var _name$split3 = name.split('|'),
              _name$split4 = _slicedToArray(_name$split3, 2),
              l = _name$split4[0],
              n = _name$split4[1];

          var bundle = utils.getPath(data, [l, n]);
          if (bundle) {
            _this5.loaded(name, err, bundle);
          } else {
            var error = 'loading namespace ' + n + ' for language ' + l + ' via multiloading failed';
            _this5.loaded(name, error);
            _this5.logger.error(error);
          }
        });
      });
    } else {
      toLoad.toLoad.forEach(function (name) {
        _this5.loadOne(name);
      });
    }
  };

  Connector.prototype.reload = function reload(languages, namespaces) {
    var _this6 = this;

    if (!this.backend) {
      this.logger.warn('No backend was added via i18next.use. Will not load resources.');
    }
    var options = _extends({}, this.backend.options, this.options.backend);

    if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
    if (typeof namespaces === 'string') namespaces = [namespaces];

    // load with multi-load
    if (options.allowMultiLoading && this.backend.readMulti) {
      this.read(languages, namespaces, 'readMulti', null, null, function (err, data) {
        if (err) _this6.logger.warn('reloading namespaces ' + namespaces.join(', ') + ' for languages ' + languages.join(', ') + ' via multiloading failed', err);
        if (!err && data) _this6.logger.log('successfully reloaded namespaces ' + namespaces.join(', ') + ' for languages ' + languages.join(', ') + ' via multiloading', data);

        languages.forEach(function (l) {
          namespaces.forEach(function (n) {
            var bundle = utils.getPath(data, [l, n]);
            if (bundle) {
              _this6.loaded(l + '|' + n, err, bundle);
            } else {
              var error = 'reloading namespace ' + n + ' for language ' + l + ' via multiloading failed';
              _this6.loaded(l + '|' + n, error);
              _this6.logger.error(error);
            }
          });
        });
      });
    } else {
      languages.forEach(function (l) {
        namespaces.forEach(function (n) {
          _this6.loadOne(l + '|' + n, 're');
        });
      });
    }
  };

  Connector.prototype.loadOne = function loadOne(name) {
    var _this7 = this;

    var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';

    var _name$split5 = name.split('|'),
        _name$split6 = _slicedToArray(_name$split5, 2),
        lng = _name$split6[0],
        ns = _name$split6[1];

    this.read(lng, ns, 'read', null, null, function (err, data) {
      if (err) _this7.logger.warn(prefix + 'loading namespace ' + ns + ' for language ' + lng + ' failed', err);
      if (!err && data) _this7.logger.log(prefix + 'loaded namespace ' + ns + ' for language ' + lng, data);

      _this7.loaded(name, err, data);
    });
  };

  Connector.prototype.saveMissing = function saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
    var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};

    if (this.backend && this.backend.create) {
      this.backend.create(languages, namespace, key, fallbackValue, null /* unused callback */, _extends({}, options, { isUpdate: isUpdate }));
    }

    // write to store to avoid resending
    if (!languages || !languages[0]) return;
    this.store.addResource(languages[0], namespace, key, fallbackValue);
  };

  return Connector;
}(_EventEmitter3.default);

exports.default = Connector;

/***/ }),
/* 479 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _logger = __webpack_require__(56);

var _logger2 = _interopRequireDefault(_logger);

var _EventEmitter2 = __webpack_require__(72);

var _EventEmitter3 = _interopRequireDefault(_EventEmitter2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _extends = Object.assign || function (target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i];for (var key in source) {
      if (Object.prototype.hasOwnProperty.call(source, key)) {
        target[key] = source[key];
      }
    }
  }return target;
};

function _defaults(obj, defaults) {
  var keys = Object.getOwnPropertyNames(defaults);for (var i = 0; i < keys.length; i++) {
    var key = keys[i];var value = Object.getOwnPropertyDescriptor(defaults, key);if (value && value.configurable && obj[key] === undefined) {
      Object.defineProperty(obj, key, value);
    }
  }return obj;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

function _possibleConstructorReturn(self, call) {
  if (!self) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self;
}

function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _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) : _defaults(subClass, superClass);
}

var Connector = function (_EventEmitter) {
  _inherits(Connector, _EventEmitter);

  function Connector(cache, store, services) {
    var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};

    _classCallCheck(this, Connector);

    var _this = _possibleConstructorReturn(this, _EventEmitter.call(this));

    _this.cache = cache;
    _this.store = store;
    _this.services = services;
    _this.options = options;
    _this.logger = _logger2.default.create('cacheConnector');

    if (_this.cache && _this.cache.init) _this.cache.init(services, options.cache, options);
    return _this;
  }

  /* eslint consistent-return: 0 */

  Connector.prototype.load = function load(languages, namespaces, callback) {
    var _this2 = this;

    if (!this.cache) return callback && callback();
    var options = _extends({}, this.cache.options, this.options.cache);

    var loadLngs = typeof languages === 'string' ? this.services.languageUtils.toResolveHierarchy(languages) : languages;

    if (options.enabled) {
      this.cache.load(loadLngs, function (err, data) {
        if (err) _this2.logger.error('loading languages ' + loadLngs.join(', ') + ' from cache failed', err);
        if (data) {
          /* eslint no-restricted-syntax: 0 */
          for (var l in data) {
            if (Object.prototype.hasOwnProperty.call(data, l)) {
              for (var n in data[l]) {
                if (Object.prototype.hasOwnProperty.call(data[l], n)) {
                  if (n !== 'i18nStamp') {
                    var bundle = data[l][n];
                    if (bundle) _this2.store.addResourceBundle(l, n, bundle);
                  }
                }
              }
            }
          }
        }
        if (callback) callback();
      });
    } else if (callback) {
      callback();
    }
  };

  Connector.prototype.save = function save() {
    if (this.cache && this.options.cache && this.options.cache.enabled) this.cache.save(this.store.data);
  };

  return Connector;
}(_EventEmitter3.default);

exports.default = Connector;

/***/ }),
/* 480 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.transformOptions = transformOptions;
exports.get = get;

function get() {
  return {
    debug: false,
    initImmediate: true,

    ns: ['translation'],
    defaultNS: ['translation'],
    fallbackLng: ['dev'],
    fallbackNS: false, // string or array of namespaces

    whitelist: false, // array with whitelisted languages
    nonExplicitWhitelist: false,
    load: 'all', // | currentOnly | languageOnly
    preload: false, // array with preload languages

    simplifyPluralSuffix: true,
    keySeparator: '.',
    nsSeparator: ':',
    pluralSeparator: '_',
    contextSeparator: '_',

    saveMissing: false, // enable to send missing values
    updateMissing: false, // enable to update default values if different from translated value (only useful on initial development, or when keeping code as source of truth)
    saveMissingTo: 'fallback', // 'current' || 'all'
    saveMissingPlurals: true, // will save all forms not only singular key
    missingKeyHandler: false, // function(lng, ns, key, fallbackValue) -> override if prefer on handling

    postProcess: false, // string or array of postProcessor names
    returnNull: true, // allows null value as valid translation
    returnEmptyString: true, // allows empty string value as valid translation
    returnObjects: false,
    joinArrays: false, // or string to join array
    returnedObjectHandler: function returnedObjectHandler() {}, // function(key, value, options) triggered if key returns object but returnObjects is set to false
    parseMissingKeyHandler: false, // function(key) parsed a key that was not found in t() before returning
    appendNamespaceToMissingKey: false,
    appendNamespaceToCIMode: false,
    overloadTranslationOptionHandler: function handle(args) {
      var ret = {};
      if (args[1]) ret.defaultValue = args[1];
      if (args[2]) ret.tDescription = args[2];
      return ret;
    },

    interpolation: {
      escapeValue: true,
      format: function format(value, _format, lng) {
        return value;
      },
      prefix: '{{',
      suffix: '}}',
      formatSeparator: ',',
      // prefixEscaped: '{{',
      // suffixEscaped: '}}',
      // unescapeSuffix: '',
      unescapePrefix: '-',

      nestingPrefix: '$t(',
      nestingSuffix: ')',
      // nestingPrefixEscaped: '$t(',
      // nestingSuffixEscaped: ')',
      // defaultVariables: undefined // object that can have values to interpolate on - extends passed in interpolation data
      maxReplaces: 1000 // max replaces to prevent endless loop
    }
  };
}

/* eslint no-param-reassign: 0 */
function transformOptions(options) {
  // create namespace object if namespace is passed in as string
  if (typeof options.ns === 'string') options.ns = [options.ns];
  if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
  if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];

  // extend whitelist with cimode
  if (options.whitelist && options.whitelist.indexOf('cimode') < 0) options.whitelist.push('cimode');

  return options;
}

/***/ }),
/* 481 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// WARNING: Auto-generated file, based on "language.po" files stored in "/locales". Do not edit!
// Launch "npm run build-locales" to update this file

/* global define */
!(module.exports = { "version": "1.1.4 (2018-02-27)", "languages": ["en", "ar", "ast", "bs", "ca", "ca_ES@valencia", "cs", "da", "de", "el", "es", "eu", "fr", "gl", "he", "it", "ja", "nl", "pt", "pt_BR", "ru", "tr", "vec", "zh_TW"], "messages": { "ar": { "Version": "الإصدار", "time": "الوقت", "actions": "المحاولات", "score": "النتيجة", "Next activity": "النشاط التالي", "Previous activity": "النشاط السابق", "Restart activity": "استئنف النشاط", "Information": "المعلومة", "Current results": "تقارير المستخدم", "User:": "المستخدم:", "Projects:": "المشاريع:", "Project": "المشروع:", "sequence": "التسلسل", "activity": "النشاط", "OK": "موافق", "Total:": "المجموع:" }, "ast": { "Version": "Versión", "time": "tiempu", "actions": "intentos", "score": "marcador", "Next activity": "Xera siguiente", "Previous activity": "Xera anterior", "Restart activity": "Reaniciar xera", "Information": "Información", "Results are not currently being saved": "L'informe nun ta rexistráu en nenguna base de datos", "Current results": "Informes d'usuariu", "Session started:": "Entamu de sesión:", "Reports system:": "Sistema d'informes:", "User:": "Usuariu:", "Projects:": "Proyeutos:", "Sequences:": "Secuencies:", "Activities done:": "Xeres feches:", "Activities solved:": "Xeres correctes:", "Global score:": "Puntuación global:", "Total time in activities:": "Tiempu total en xeres:", "Actions done:": "Aiciones feches:", "No activities done!": "¡Nenguna información sobre xeres!", "Project": "Proyeutu:", "sequence": "Secuencia", "activity": "Xera", "OK": "OK", "YES": "SI", "NO": "NON", "Total:": "Total:" }, "bs": { "Version": "Verzija", "time": "vrijeme", "actions": "pokušaji", "score": "rezultat", "Next activity": "Sljedeća aktivnost", "Previous activity": "Prethodna aktivnost", "Restart activity": "Ponovno pokreni aktivnost", "Information": "Informacije", "Current results": "Izvješća korisnika", "Session started:": "Sesija započeta:", "User:": "Korisnik:", "Projects:": "Projekti:", "Activities done:": "Urađene aktivnosti:", "Activities solved:": "Aktivnosti ok:", "Global score:": "Ukupan rezultat:", "Total time in activities:": "Ukupno vrijeme aktivnosti:", "Actions done:": "Urađene aktivnosti:", "Project": "Projekt:", "sequence": "Sekvenca", "activity": "Aktivnost", "OK": "Uredu", "YES": "DA", "NO": "NE", "Total:": "Ukupno:" }, "ca": { "Version": "Versió", "time": "temps", "actions": "accions", "score": "encerts", "Next activity": "Activitat següent", "Previous activity": "Activitat anterior", "Restart activity": "Reinicia l'activitat", "Information": "Informació", "Results are not currently being saved": "Els resultats no s'estan desant", "Current results": "Resultats actuals", "Session started:": "Inici de sessió:", "Reports system:": "Sistema d'informes:", "User:": "Usuari/ària:", "Projects:": "Projectes:", "Sequences:": "Seqüències:", "Activities done:": "Activitats fetes:", "Activities solved:": "Activitats resoltes:", "Global score:": "Puntuació global:", "(out of all project activities)": "(sobre totes les activitats del projecte)", "Total time in activities:": "Temps total en les activitats:", "Actions done:": "Accions fetes:", "No activities done!": "No heu fet cap activitat!", "Project": "Projecte", "sequence": "seqüència", "activity": "activitat", "OK": "OK", "YES": "SÍ", "NO": "NO", "Total:": "Totals:", "Select group:": "Seleccioneu el grup:", "Select user:": "Seleccioneu l'usuari:", "Cancel": "Cancel·la", "Close": "Tanca", "Copy data to clipboard": "Copia les dades al porta-retalls", "The data has been copied in HTML format. Please paste them into a spreadsheet or in a rich text editor": "Les dades s'han copiat en format HTML. Enganxeu-les a un full de càlcul o a un editor de text enriquit.", "The data has been copied to clipboard": "Les dades s'han copiat al porta-retalls", "not connected": "no connectat", "Please wait until the results of your activities are sent to the reports system": "Si us plau, espereu a que els resultats de les vostres activitats s'enviïn al servidor d'informes", "Password:": "Contrasenya:", "Incorrect password": "Contrasenya incorrecta", "Invalid user": "Usuari/ària incorrecte", "Partial score:": "Puntuació parcial:", "(out of played activities)": "(sobre les activitats fetes)", "Activities played at least once:": "Activitats fetes almenys una vegada:", "Reports": "Informes", "Toggle full screen": "Commuta pantalla completa", "JClic logo": "Logotip del JClic", "message": "missatge", "Activity panel": "Tauler d'activitats", "cell": "cel·la", "image": "imatge", "source": "origen", "target": "destí", "image fragment": "fragment d'imatge" }, "ca_ES@valencia": { "Version": "Versió", "time": "temps", "actions": "accions", "score": "encerts", "Next activity": "Activitat següent", "Previous activity": "Activitat anterior", "Restart activity": "Reinicia l'activitat", "Information": "Informació", "Results are not currently being saved": "Els resultats no s'estan alçant", "Current results": "Resultats actuals", "Session started:": "Inici de sessió:", "Reports system:": "Sistema d'informes:", "User:": "Usuari/ària:", "Projects:": "Projectes:", "Sequences:": "Seqüències:", "Activities done:": "Activitats fetes:", "Activities solved:": "Activitats resoltes:", "Global score:": "Puntuació global:", "Total time in activities:": "Temps total en les activitats:", "Actions done:": "Accions fetes:", "No activities done!": "No heu fet cap activitat!", "Project": "Projecte", "sequence": "seqüència", "activity": "activitat", "OK": "OK", "YES": "SÍ", "NO": "NO", "Total:": "Totals:" }, "cs": { "Version": "Verze", "time": "čas", "actions": "pokusů", "score": "skóre", "Next activity": "Další aktivita", "Previous activity": "Předchozí aktivita", "Restart activity": "Restartovat aktivitu", "Information": "Informace", "Results are not currently being saved": "Zpráva není zaregistrována v žádné DB", "Current results": "Uživatelská sestava", "Session started:": "Sezení spuštěno:", "Reports system:": "Systém zprávy:", "User:": "Uživatel:", "Projects:": "Projekty:", "Sequences:": "Sekvence:", "Activities done:": "Dokončené aktivity:", "Activities solved:": "Aktivity ok:", "Global score:": "Celkové skóre:", "Total time in activities:": "Celkový čas aktivit:", "Actions done:": "Provedené akce:", "No activities done!": "Nebyly nahlášeny žádné aktivity!", "Project": "Projekt", "sequence": "Sekvence", "activity": "Aktivita", "OK": "Ok", "YES": "ANO", "NO": "NE", "Total:": "Celkem:" }, "da": { "Version": "Version", "time": "tid", "actions": "forsøg", "score": "score", "Next activity": "Næste aktivitet", "Previous activity": "Forrige aktivitet", "Restart activity": "Genstart aktivitet", "Information": "Information", "Current results": "Bruger rapport", "User:": "Bruger:", "Projects:": "Projekter:", "Sequences:": "Sekvenser:", "Activities done:": "Aktiviteter udført:", "Activities solved:": "Aktiviteter OK:", "Global score:": "Global score:", "No activities done!": "Ingen aktiviteter rapporteret!", "Project": "Projekt", "sequence": "Sequence", "activity": "Aktivitet", "OK": "Ok", "YES": "JA", "NO": "IKKE", "Total:": "Total:" }, "de": { "Version": "Version", "time": "Zeit", "actions": "Versuche", "score": "Ergebnis", "Next activity": "Nächste Übung", "Previous activity": "Vorherige Übung", "Restart activity": "Übung neu starten", "Information": "Information", "Results are not currently being saved": "Bericht in keiner Datenbank eingetragen", "Current results": "Benutzerberichte", "Session started:": "Sitzung gestartet:", "Reports system:": "Report system:", "User:": "User:", "Projects:": "Projekte:", "Sequences:": "Sequenzen:", "Activities done:": "Beendete Übungen:", "Activities solved:": "Korrekte Übungen:", "Global score:": "Gesamtpunktezahl:", "Total time in activities:": "Übungs-Gesamtzeit:", "Actions done:": "Durchgeführte Aktionen:", "No activities done!": "Keine Übungsberichte vorhanden!", "Project": "Projekt", "sequence": "Sequenz", "activity": "Übung", "OK": "OK", "YES": "JA", "NO": "NEIN", "Total:": "Gesamt:" }, "el": { "Version": "Έκδοση", "time": "χρόνος", "actions": "προσπάθειες", "score": "βαθμολογία", "Next activity": "Επόμενη δραστηριότητα", "Previous activity": "Προηγούμενη δραστηριότητα", "Restart activity": "Επανεκκίνηση δραστηριότητας", "Information": "Πληροφορίες", "Results are not currently being saved": "Η αναφορά δεν εγγράφηκε στις βάσεις δεδομένων", "Current results": "Αναφορές χρήστη", "Session started:": "Έναρξη συνεδρίας:", "Reports system:": "Σύστημα αναφορών:", "User:": "Χρήστης:", "Projects:": "Έργα:", "Sequences:": "Αλληλουχίες:", "Activities done:": "Ολοκληρωμένες δραστηριότητες:", "Activities solved:": "Δραστηριότητες, εντάξει:", "Global score:": "Συνολική βαθμολογία:", "Total time in activities:": "Συνολικός χρόνος δραστηριοτήτων:", "Actions done:": "Οι ενέργειες ολοκληρώθηκαν:", "No activities done!": "Για καμμία δραστηριότητα δεν έχει υποβληθεί αναφορά!", "Project": "Έργο", "sequence": "Αλληλουχία", "activity": "Δραστηριότητα", "OK": "Εντάξει", "YES": "Ναί", "NO": "όχι", "Total:": "Σύνολο:" }, "es": { "Version": "Versión", "time": "tiempo", "actions": "acciones", "score": "aciertos", "Next activity": "Actividad siguiente", "Previous activity": "Actividad anterior", "Restart activity": "Reiniciar actividad", "Information": "Información", "Results are not currently being saved": "Los resultados no se están guardando", "Current results": "Resultados actuales", "Session started:": "Inicio de sesión:", "Reports system:": "Sistema de informes:", "User:": "Usuario/aria:", "Projects:": "Proyectos:", "Sequences:": "Secuencias:", "Activities done:": "Actividades realizadas:", "Activities solved:": "Actividades resueltas:", "Global score:": "Puntuación global:", "(out of all project activities)": "(sobre todas las actividades del proyecto)", "Total time in activities:": "Tiempo total en las actividades:", "Actions done:": "Acciones realizadas:", "No activities done!": "¡No se ha realizado ninguna actividad!", "Project": "Proyecto", "sequence": "secuencia", "activity": "actividad", "OK": "OK", "YES": "SI", "NO": "NO", "Total:": "Totales:", "Select group:": "Seleccionar grupo:", "Select user:": "Seleccionar usuario:", "Cancel": "Cancelar", "Close": "Cerrar", "Copy data to clipboard": "Copiar datos al portapapeles", "The data has been copied in HTML format. Please paste them into a spreadsheet or in a rich text editor": "Los datos se han copiado en formato HTML. Puedes pegarlos en una hoja de cálculo o en un editor de texto rico.", "The data has been copied to clipboard": "Los datos se han copiado al portapapeles", "not connected": "no conectado", "Please wait until the results of your activities are sent to the reports system": "Por favor, espera mientras los resultados de las actividades se envian al servidor de informes", "Password:": "Contraseña:", "Incorrect password": "Contraseña incorrecta", "Invalid user": "Usuario incorrecto", "Partial score:": "Puntuación parcial:", "(out of played activities)": "(sobre las actividades realizadas)", "Activities played at least once:": "Actividades realizadas al menos una vez:", "Reports": "Informes", "Toggle full screen": "Conmutar pantalla completa", "JClic logo": "Logotipo de JClic", "message": "mensaje", "Activity panel": "Panel de actividad", "cell": "celda", "image": "imagen", "source": "origen", "target": "destino", "image fragment": "fragmento de imagen" }, "eu": { "Version": "Bertsioa", "time": "denbora", "actions": "saiakerak", "score": "puntuazioa", "Next activity": "Hurrengo jarduera", "Previous activity": "Aurreko jarduera", "Restart activity": "Jarduera berriro hasi", "Information": "Informazioa", "Results are not currently being saved": "Txostena ez dago ezein datu-basetan", "Current results": "Erabiltzailearen txostenak", "Session started:": "Saio-hasiera:", "Reports system:": "Txosten-sistema:", "User:": "Erabiltzailea:", "Projects:": "Proiektuak:", "Sequences:": "Sekuentziak:", "Activities done:": "Burututako ekinzak:", "Activities solved:": "Jarduera zuzenak:", "Global score:": "Jarduera zuzenak:", "Total time in activities:": "Jardueretan emandako denbora guztira:", "Actions done:": "Burututako ekintzak:", "No activities done!": "Ez da jardueren txostenik!", "Project": "Proiektua", "sequence": "Sekuentzia", "activity": "Jarduera", "OK": "Ados", "YES": "BAI", "NO": "EZ", "Total:": "Guztira:" }, "fr": { "Version": "Version", "time": "temps", "actions": "essais", "score": "résultat", "Next activity": "Activité suivante", "Previous activity": "Activité précédente", "Restart activity": "Recommencer l'activité", "Information": "Information", "Results are not currently being saved": "Le rapport n'est enregistré dans aucune base de données", "Current results": "Rapports utilisateur", "Session started:": "Session démarrée:", "Reports system:": "Report système:", "User:": "Utilisateur:", "Projects:": "Projets:", "Sequences:": "Séquences:", "Activities done:": "Activités faites:", "Activities solved:": "Activités ok:", "Global score:": "Score global:", "(out of all project activities)": "(Hors de toutes les activités du projet)", "Total time in activities:": "Temps total sur les activités:", "Actions done:": "Actions faites:", "No activities done!": "Pas d'activités rapportées!", "Project": "Projet", "sequence": "séquence", "activity": "activité", "OK": "Ok", "YES": "OUI", "NO": "NON", "Total:": "Total:", "Select group:": "Sélectionner un groupe:", "Select user:": "Sélectionner l'utilisateur:", "Cancel": "Annuler", "Close": "Fermer", "Copy data to clipboard": "Copier les données dans le presse-papier", "The data has been copied in HTML format. Please paste them into a spreadsheet or in a rich text editor": "Les données ont été copiées au format HTML. Veuillez les coller dans une feuille de calcul ou dans un éditeur de texte", "The data has been copied to clipboard": "Les données sont copier dans le presse-papier", "not connected": "Non connecté ", "Please wait until the results of your activities are sent to the reports system": "Veuillez patienter durant l'envoi de votre activité au rapport système", "Password:": "Mot de passe: ", "Incorrect password": "Mot de passe incorrect", "Invalid user": "Utilisateur invalide", "Partial score:": "Score partiel:", "(out of played activities)": "(Hors activités jouées)", "Activities played at least once:": "Les activités joué au moins une fois:", "Reports": "Rapport", "Toggle full screen": "Basculer en plein écran", "JClic logo": "JClic logo", "message": "message", "Activity panel": "Groupe d'activités", "cell": "cellule", "image": "image", "source": "source", "target": "cible", "image fragment": "fragment d'image" }, "gl": { "Version": "Versión", "time": "tempo", "actions": "intentos", "score": "acertos", "Next activity": "Seguinte actividade", "Previous activity": "Anterior actividade", "Restart activity": "Reiniciar a actividade", "Information": "Información", "Results are not currently being saved": "O informe non está rexistrado en ningunha base de datos", "Current results": "Informes de usuario", "Session started:": "Inicio de sesión:", "Reports system:": "Sistema de informes:", "User:": "Usuario:", "Projects:": "Proxectos:", "Sequences:": "Secuencias:", "Activities done:": "Actividades realizadas:", "Activities solved:": "Actividades correctas:", "Global score:": "Puntuación global:", "Total time in activities:": "Tempo total nas actividades:", "Actions done:": "Accións efectuadas:", "No activities done!": "Non hai informada ningunha actividade!", "Project": "Proxecto", "sequence": "secuencia", "activity": "actividade", "OK": "Correcta", "YES": "SI", "NO": "NON", "Total:": "Total:" }, "he": { "Version": "גירסה", "time": "זמן", "actions": "נסיונות", "score": "ניקוד", "Next activity": "הפעילות הבאה", "Previous activity": "הפעילות הקודמת", "Restart activity": "התחל פעילות מחדש", "Information": "מידע", "Results are not currently being saved": "הדיווח אינו רשום במסד נתונים כלשהו", "Current results": "דוחות משתמש", "Session started:": "הפעלה החלה:", "Reports system:": "מערכת דוחות:", "User:": "משתמש:", "Projects:": "פרוייקטים:", "Sequences:": "רצפים:", "Activities done:": "פעילויות שהושלמו:", "Activities solved:": "פעילויות מאושרות:", "Global score:": "ניקוד כללי:", "Total time in activities:": "משך הפעילויות המצטבר:", "Actions done:": "פעולות שבוצעו:", "No activities done!": "לא דווחו פעילויות!", "Project": "פרוייקט", "sequence": "רצף", "activity": "פעילות", "OK": "אישור", "YES": "כן", "NO": "לא", "Total:": "סך הכל:" }, "it": { "Version": "Versione", "time": "tempo", "actions": "tentativi", "score": "punteggio", "Next activity": "Attività successiva", "Previous activity": "Attività precedente", "Restart activity": "Riavvia l'attività", "Information": "Informazioni", "Results are not currently being saved": "Rapporto non registrato in alcun database", "Current results": "Rapporti utente", "Session started:": "Sessione avviata:", "Reports system:": "Sistema dei rapporti:", "User:": "Utente:", "Projects:": "Progetti:", "Sequences:": "Sequenze:", "Activities done:": "Attività eseguite:", "Activities solved:": "Attività ok:", "Global score:": "Punteggio globale:", "Total time in activities:": "Tempo totale nelle attività:", "Actions done:": "Azioni compiute:", "No activities done!": "Nessuna attività a rapporto!", "Project": "Progetto", "sequence": "sequenza", "activity": "attività", "OK": "Ok", "YES": "SI", "NO": "NO", "Total:": "Totale:" }, "ja": { "Version": "バージョン", "time": "時間", "actions": "アクション", "score": "スコア", "Next activity": "次のアクティビティ", "Previous activity": "前のアクティビティ", "Restart activity": "アクティビティを再起動", "Information": "情報", "Results are not currently being saved": "結果は、現在保存されていません", "Current results": "現在の結果", "Session started:": "セッションが開始しました:", "Reports system:": "レポート システム:", "User:": "ユーザー:", "Projects:": "プロジェクト:", "Sequences:": "シーケンス:", "Activities done:": "完了したアクティビティ:", "Activities solved:": "解決したアクティビティ:", "Global score:": "グローバル スコア:", "(out of all project activities)": "(すべてのプロジェクト アクティビティの結果)", "Total time in activities:": "アクティビティ時間の合計:", "Actions done:": "完了したアクション:", "No activities done!": "アクティビティは行われていません!", "Project": "プロジェクト", "sequence": "シーケンス", "activity": "アクティビティ", "OK": "OK", "YES": "はい", "NO": "いいえ", "Total:": "合計:", "Select group:": "グループを選択:", "Select user:": "ユーザーを選択:", "Cancel": "キャンセル", "Close": "閉じる", "Copy data to clipboard": "データをクリップボードにコピー", "The data has been copied in HTML format. Please paste them into a spreadsheet or in a rich text editor": "データは HTML 形式でコピーされます。リッチ テキスト エディターやスプレッドシートに貼り付けてください", "The data has been copied to clipboard": "クリップボードにデータがコピーされました", "not connected": "接続されていません", "Please wait until the results of your activities are sent to the reports system": "アクティビティの結果がレポート システムに送信されるまでお待ちください", "Password:": "パスワード:", "Incorrect password": "パスワードが正しくありません", "Invalid user": "無効なユーザー", "Partial score:": "部分スコア:", "(out of played activities)": "(プレイしたアクティビティの結果)", "Activities played at least once:": "少なくとも一度プレイしたアクティビティ:", "Reports": "レポート", "Toggle full screen": "全画面の切り替え", "JClic logo": "JClic ロゴ", "message": "メッセージ", "Activity panel": "アクティビティ パネル", "cell": "セル", "image": "画像", "source": "ソース", "target": "ターゲット", "image fragment": "画像フラグメント" }, "nl": { "Version": "Versie", "time": "tijd", "actions": "pogingen", "score": "punten", "Next activity": "Volgende activiteit", "Previous activity": "Vorige activiteit", "Restart activity": "Herstart activiteit", "Information": "Informatie", "Results are not currently being saved": "Rapport niet geregistreerd in een DB", "Current results": "Gebruikers rapport", "Session started:": "Reeks gestart:", "Reports system:": "Rapporteer systeem:", "User:": "Gebruiker:", "Projects:": "Projecten:", "Sequences:": "Reeksen:", "Activities done:": "Activiteiten klaar:", "Activities solved:": "Activiteiten ok:", "Global score:": "Puntentotaal:", "Total time in activities:": "Totale tijd activiteiten:", "Actions done:": "Einde activiteiten:", "No activities done!": "Geen activiteiten gerapporteerd!", "Project": "Project", "sequence": "Volgorde", "activity": "Activiteit", "OK": "Ok", "YES": "JA", "NO": "NEE", "Total:": "Totaal:" }, "pt": { "Version": "Versão", "time": "tempo", "actions": "tentativas", "score": "acertos", "Next activity": "Actividade seguinte", "Previous activity": "Actividade anterior", "Restart activity": "Reiniciar a actividade", "Information": "Informação", "Results are not currently being saved": "O relatório não está registado em nenhuma base de dados", "Current results": "Relatórios do utilizador", "Session started:": "Início da sessão:", "Reports system:": "Sistema de relatórios:", "User:": "Utilizador:", "Projects:": "Projectos:", "Sequences:": "Sequências:", "Activities done:": "Actividades realizadas:", "Activities solved:": "Actividades correctas:", "Global score:": "Pontuação global:", "Total time in activities:": "Tempo total das actividades:", "Actions done:": "Acções efectuadas:", "No activities done!": "Nenhuma actividade registada!", "Project": "Projecto", "sequence": "sequência", "activity": "Actividade", "OK": "Correcta", "YES": "sim", "NO": "não", "Total:": "Total:" }, "pt_BR": { "Version": "Versão", "time": "tempo", "actions": "tentativas", "score": "acertos", "Next activity": "atividade seguinte", "Previous activity": "atividade anterior", "Restart activity": "Reiniciar a atividade", "Information": "Informação", "Results are not currently being saved": "O relatório não está registrando em nenhuma base de dados", "Current results": "relatórios de usuário", "Session started:": "Início da sessão:", "Reports system:": "Sistema de relatórios:", "User:": "Usuário:", "Projects:": "Projetos:", "Sequences:": "Sequências:", "Activities done:": "Atividades realizadas:", "Activities solved:": "Atividades corretas:", "Global score:": "Pontuação geral:", "Total time in activities:": "Tempo total das atividades:", "Actions done:": "Ações efetuadas:", "No activities done!": "Nenhuma atividade registrada!", "Project": "Projeto", "sequence": "sequência", "activity": "atividade", "OK": "Correta", "YES": "sim", "NO": "não", "Total:": "Total:" }, "ru": { "Version": "Версия", "time": "время", "actions": "попытки", "score": "счёт", "Next activity": "Следующее действие", "Previous activity": "Предыдущее действие", "Restart activity": "Перезапуск действия", "Information": "Информация", "Results are not currently being saved": "Отчёт не зарегистрирован в БД", "Current results": "Отчёты пользователя", "Session started:": "Сессия начата:", "Reports system:": "Система отчётов:", "User:": "Пользователь:", "Projects:": "Проекты:", "Sequences:": "Последовательности:", "Activities done:": "Совершенные действия:", "Activities solved:": "Действия в порядке:", "Global score:": "Общий счёт:", "Total time in activities:": "Общее время активности:", "Actions done:": "Завершено действий:", "No activities done!": "Нет сообщенных действий!", "Project": "Проект", "sequence": "Последовательность", "activity": "Активность", "OK": "ОК", "YES": "да", "NO": "нет", "Total:": "Итого:" }, "tr": { "Version": "Sürüm", "time": "zaman", "actions": "Denemeler", "score": "sonuç", "Next activity": "Bir sonraki etkinlik", "Previous activity": "Bir önceki etkinlik", "Restart activity": "Etkinliği tekrar başlat", "Information": "Bilgi", "Results are not currently being saved": "Rapor herhangi bir veritabanında kaydedilmedi", "Current results": "Kullanıcı raporları", "Session started:": "Oturum başlatıldı", "Reports system:": "Sistem raporu:", "User:": "Kullanıcı:", "Projects:": "Projeler:", "Sequences:": "Etkinlik dizisi", "Activities done:": "Etkinlikler başlatılıyor:", "Activities solved:": "Etkinlikler tamam:", "Global score:": "Genel sonuç:", "Total time in activities:": "Etkinlikde geçirilen toplam zaman:", "Actions done:": "Eylem gerçekleştiriliyor:", "No activities done!": "Etkinlik raporu yok!", "Project": "Proje", "sequence": "Etkinlik dizisi", "activity": "Etkinlik", "OK": "Tamam", "YES": "Evet", "NO": "hiçbir", "Total:": "Toplam:" }, "vec": { "Version": "Version", "time": "tenpo", "actions": "tentadivi", "score": "pontexio", "Next activity": "Pròsima atività", "Previous activity": "Atività presedente", "Restart activity": "Invìa atività da novo", "Information": "Informasion", "Results are not currently being saved": "Report no registrà inte nisun database", "Current results": "Reports utenti", "Session started:": "Sesion inviada:", "Reports system:": "Sistèma de report", "User:": "Utente:", "Projects:": "Proxèti:", "Sequences:": "Secuense:", "Activities done:": "Atività fate:", "Activities solved:": "Atività ok:", "Global score:": "Pontexio global", "Total time in activities:": "Tenpo total so ƚe atività", "Actions done:": "Asion exeguìe", "No activities done!": "No xé stà reportà atività!", "Project": "Proxèto:", "sequence": "secuensa", "activity": "Atività", "OK": "Ok", "YES": "SI", "NO": "NO", "Total:": "Total:" }, "zh_TW": { "Version": "版本", "time": "時間", "actions": "嘗試次數", "score": "分數", "Next activity": "下一個活動", "Previous activity": "上一個活動", "Restart activity": "重設活動", "Information": "相關資訊", "Results are not currently being saved": "回報在DB中無註冊", "Current results": "使用者報告", "Session started:": "工作開始：", "Reports system:": "報告系統:", "User:": "使用者:", "Projects:": "專案：", "Sequences:": "順序：", "Activities done:": "活動結束:", "Activities solved:": "活動完成:", "Global score:": "總成績:", "Total time in activities:": "活動總時間:", "Actions done:": "活動完成：", "No activities done!": "沒有活動報告", "Project": "專案：", "sequence": "順序", "activity": "活動", "OK": "確定", "YES": "是", "NO": "否", "Total:": "總計：" } } });

/***/ }),
/* 482 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : media/ActiveMediaBag.js
 *  Created : 28/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(210), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function (ActiveMediaPlayer, Utils) {

  /**
   * This class stores a collection of realized {@link ActiveMediaPlayer} objects, related to a
   * {@link JClicProject} or {@link Activity}.
   * @exports ActiveMediaBag
   * @class
   */
  var ActiveMediaBag = function () {
    /**
     * ActiveMediaBag constructor
     */
    function ActiveMediaBag() {
      _classCallCheck(this, ActiveMediaBag);

      this.players = [];
    }

    /**
     * Creates a new {@link ActiveMediaPlayer} linked to this media bag
     * @param {MediaContent} mc - The content used by the new player
     * @param {MediaBag} mb - The project's MediaBag
     * @param {PlayStation} ps - An object implementing the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html) interface,
     * usually a {@link JClicPlayer}.
     * @returns {ActiveMediaPlayer}
     */


    _createClass(ActiveMediaBag, [{
      key: "createActiveMediaPlayer",
      value: function createActiveMediaPlayer(mc, mb, ps) {
        var amp = null;
        switch (mc.mediaType) {
          case 'RECORD_AUDIO':
            if (mc.length <= 0 || mc.length >= Utils.settings.MAX_RECORD_LENGTH) break;
          /* falls through */
          case 'PLAY_RECORDED_AUDIO':
            if (mc.recBuffer < 0 || mc.recBuffer >= 10) break;
          /* falls through */
          case 'PLAY_AUDIO':
          case 'PLAY_MIDI':
          case 'PLAY_VIDEO':
            amp = new ActiveMediaPlayer(mc, mb, ps);
            break;
        }
        if (amp !== null) this.players.push(amp);
        return amp;
      }

      /**
       * Looks for an already existing {@link ActiveMediaPlayer} equivalent to the requested.
       * When not found, a new one is created and and returned.
       * @param {MediaContent} mc - The content used by the new player
       * @param {MediaBag} mb - The project's MediaBag
       * @param {PlayStation} ps - An object implementing the
       * {@link http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html|PlayStation} interface,
       * usually a {@link JClicPlayer}.
       * @returns {ActiveMediaPlayer}
       */

    }, {
      key: "getActiveMediaPlayer",
      value: function getActiveMediaPlayer(mc, mb, ps) {
        return this.players.find(function (p) {
          return p.mc === mc || p.mc.isEquivalent(mc);
        }) || this.createActiveMediaPlayer(mc, mb, ps);
      }

      /**
       * Removes from the list of players the {@link ActiveMediaPlayer} related to the specified {@link MediaContent}.
       * @param {MediaContent} mc - The media content to look for.
       */

    }, {
      key: "removeActiveMediaPlayer",
      value: function removeActiveMediaPlayer(mc) {
        var i = this.players.findIndex(function (p) {
          return p.mc === mc;
        });
        if (i >= 0) {
          this.players[i].clear();
          // removes the element pointed by 'i'
          this.players.splice(i, 1);
        }
      }

      /**
       * Realizes all the media elements stored in this bag
       */

    }, {
      key: "realizeAll",
      value: function realizeAll() {
        this.players.forEach(function (p) {
          return p.realize();
        });
      }

      /**
       * Stops playing all media elements stored in this bag
       * @param {number} level - Level at and below what all media players will be muted.
       */

    }, {
      key: "stopAll",
      value: function stopAll(level) {
        if (typeof level === 'undefined') level = -1;
        this.players.forEach(function (amp) {
          if (level === -1 || amp.mc !== null && amp.mc.level <= level) amp.stop();
        });
      }

      /**
       * Removes all players from this media bag
       */

    }, {
      key: "removeAll",
      value: function removeAll() {
        this.players.forEach(function (p) {
          return p.clear();
        });
        // Empty the `players` array
        this.players.length = 0;
        ActiveMediaPlayer.prototype.clearAllAudioBuffers();
      }
    }]);

    return ActiveMediaBag;
  }();

  Object.assign(ActiveMediaBag.prototype, {
    /**
     * The collection of {@link ActiveMediaPlayer} objects stored in this media bag.
     * @name ActiveMediaBag#players
     * @type {ActiveMediaPlayer[]} */
    players: []
  });

  return ActiveMediaBag;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 483 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : media/EventSoundsElement.js
 *  Created : 01/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define, MediaRecorder */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Utils) {
  /**
   * The AudioBuffer object provides sound recording and replaying to activities.
   * @exports AudioBuffer
   * @class
   */
  var AudioBuffer = function () {
    /**
     * AudioBuffer constructor
     * @param {number=} seconds - The maximum amount of time allowed to be recorded by this AudioBuffer
     */
    function AudioBuffer(seconds) {
      _classCallCheck(this, AudioBuffer);

      if (seconds) this.seconds = seconds;
      this.chunks = [];
    }

    /**
     * Starts playing the currently recorded audio, if any.
     */


    _createClass(AudioBuffer, [{
      key: 'play',
      value: function play() {
        this.stop();
        if (this.mediaPlayer) {
          this.mediaPlayer.currentTime = 0;
          this.mediaPlayer.play();
        } else {
          this.playWhenFinished = true;
        }
      }

      /**
       * Stops the current operation, either recording or playing audio
       */

    }, {
      key: 'stop',
      value: function stop() {
        if (this.mediaRecorder && this.mediaRecorder.state === 'recording') this.mediaRecorder.stop();else if (this.mediaPlayer && !this.mediaPlayer.paused) this.mediaPlayer.pause();
      }

      /**
       * Starts recording audio, or stops the recording if already started.
       */

    }, {
      key: 'record',
      value: function record() {
        var _this = this;

        if (this.mediaRecorder && this.mediaRecorder.state === 'recording') this.mediaRecorder.stop();else {
          this.stop();
          this.mediaPlayer = null;

          // TODO: update navigator.getUserMedia to navigator.mediaDevices.getUserMedia (with promises)
          // when supported in Chrome/Chromium
          // (in v. 49 this is supported only when "experimental web extensions" flag is enabled)
          // See: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getUserMedia

          navigator.getUserMedia({ audio: true }, function (stream) {
            _this.mediaRecorder = new MediaRecorder(stream);
            _this.mediaRecorder.ondataavailable = function (ev) {
              return _this.chunks.push(ev.data);
            };
            _this.mediaRecorder.onerror = function (err) {
              Utils.log('error', 'Error recording audio: ' + err);
              _this.mediaRecorder = null;
            };
            _this.mediaRecorder.onstart = function () {
              return Utils.log('debug', 'Recording audio started');
            };
            _this.mediaRecorder.onstop = function () {
              Utils.log('debug', 'Recording audio finished');

              if (_this.timeoutID) {
                window.clearTimeout(_this.timeoutID);
                _this.timeoutID = null;
              }

              var options = {};
              if (_this.chunks.length > 0 && _this.chunks[0].type) options.type = _this.chunks[0].type;
              var blob = new Blob(_this.chunks, options);
              _this.chunks = [];
              _this.mediaPlayer = document.createElement('audio');
              _this.mediaPlayer.src = URL.createObjectURL(blob);
              _this.mediaPlayer.pause();
              _this.mediaRecorder = null;
              if (_this.playWhenFinished) {
                _this.playWhenFinished = false;
                _this.mediaPlayer.play();
              }
            };
            _this.mediaRecorder.onwarning = function (ev) {
              return Utils.log('warn', 'Warning recording audio: ' + ev);
            };

            _this.playWhenFinished = false;
            _this.mediaRecorder.start();
            _this.timeoutID = window.setTimeout(function () {
              if (_this.mediaRecorder) _this.mediaRecorder.stop();
            }, _this.seconds * 1000);
          }, function (error) {
            return Utils.log('error', 'Error recording audio: ' + error);
          });
        }
      }

      /**
       * Clears all data associated to this AudioBuffer
       */

    }, {
      key: 'clear',
      value: function clear() {
        this.stop();
        this.mediaPlayer = null;
      }
    }]);

    return AudioBuffer;
  }();

  /**
   * Maximum amount of time allowed for recordings (in seconds)
   * @type {number}
   */


  AudioBuffer.MAX_RECORD_LENGTH = 180;

  Object.assign(AudioBuffer.prototype, {
    /**
     * Maximum length of recordings allowed to this AudioBuffer (in seconds)
     * @name AudioBuffer#seconds
     * @type {number}
     */
    seconds: 20,
    /**
     * The object used to record audio data and convert it to a valid stream for the {@link mediaPlayer}
     * @name AudioBuffer#mediaRecorder
     * @type {external:MediaRecorder}
     */
    mediaRecorder: null,
    /**
     * Array of data chunks collected during the recording
     * @name AudioBuffer#chunks
     * @type {Blob[]}
     */
    chunks: null,
    /**
     * The HTML audio element used to play the recorded sound
     * @name AudioBuffer#mediaPlayer
     * @type {external:HTMLAudioElement}
     */
    mediaPlayer: null,
    /**
     * The identifier of the timer launched to stop the recording when the maximum time is exceeded.
     * This member is `null` when no timeout function is associated to this AudioBuffer
     * @name AudioBuffer#timeoutID
     * @type {number}
     */
    timeoutID: null,
    /**
     * Instructs this AudioBuffer recorder to start playing the collected audio at the end of the
     * current `mediaRecorder` task.
     * @name AudioBuffer#playWhenFinished
     * @type {boolean}
     */
    playWhenFinished: false
  });

  return AudioBuffer;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 484 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : media/EventSoundsElement.js
 *  Created : 01/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(210), __webpack_require__(97)], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Utils, ActiveMediaPlayer, MediaContent) {

  /**
   * The EventSoundsElement object contains the description of a specific sound to be played when
   * one of the JClic events are fired.
   * For a full list of the JClic events see: {@link EventSounds}
   * @exports EventSoundsElement
   * @class
   */
  var EventSoundsElement = function () {
    /**
     * EventSoundsElement constructor
     * @param {string} id - The identifier of this media sound
     * @param {string=} fileName - An optional file name or URL containing the sound data
     */
    function EventSoundsElement(id, fileName) {
      _classCallCheck(this, EventSoundsElement);

      this.id = id;
      if (fileName) {
        if (Utils.startsWith(fileName, 'data:')) this.audio = new Audio(fileName);else this.fileName = fileName;
      }
    }

    /**
     * Reads the properties of this object from an XML element
     * @param {external:jQuery} $xml - The XML element to be parsed
     */


    _createClass(EventSoundsElement, [{
      key: "setProperties",
      value: function setProperties($xml) {
        this.fileName = $xml.attr('file');
        this.enabled = Utils.getTriState($xml.attr('enabled'));
        return this;
      }

      /**
       * Instantiates this audio object
       * @param {PlayStation} ps
       * @param {MediaBag} mediaBag
       */

    }, {
      key: "realize",
      value: function realize(ps, mediaBag) {
        if (!this.audio && this.player === null && this.fileName !== null) {
          this.player = new ActiveMediaPlayer(new MediaContent('PLAY_AUDIO', this.fileName), mediaBag, ps);
          this.player.realize();
        }
      }

      /**
       * Plays the audio associated to this event
       */

    }, {
      key: "play",
      value: function play() {
        if (this.audio) {
          this.audio.currentTime = 0;
          this.audio.play();
        } else if (this.player) this.player.play();
      }

      /**
       * Stops playing the audio associated to this event
       */

    }, {
      key: "stop",
      value: function stop() {
        if (this.audio) this.audio.pause();else if (this.player) this.player.stop();
      }
    }]);

    return EventSoundsElement;
  }();

  Object.assign(EventSoundsElement.prototype, {
    /**
     * The sound file used by this element
     * @name EventSoundsElement#fileName
     * @type {string} */
    fileName: null,
    /**
     * Whether the sound for this event is enabled or not
     * @name EventSoundsElement#enabled
     * @type {boolean} */
    enabled: Utils.DEFAULT,
    /**
     * Media player used to play this sound
     * @name EventSoundsElement#player
     * @type {ActiveMediaPlayer} */
    player: null,
    /**
     * HTMLAudioElement used to play this sound
     * @name EventSoundsElement#audio
     * @type {HTMLAudioElement} */
    audio: null
  });

  return EventSoundsElement;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 485 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : project/ProjectSettings.js
 *  Created : 01/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define, window */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(136), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, EventSounds, Utils) {

  /**
   * This class contains miscellaneous settings of JClic projects.
   *
   * In addition to the members of this class, there can be other properties in JClic project files
   * that are not currently loaded:
   * - iconFileName
   * - descriptors
   * - area
   * - level
   * - locale
   * - authors
   * - organizations
   * - revisions
   * @exports ProjectSettings
   * @class
   */
  var ProjectSettings = function () {
    /**
     * ProjectSettings constructor
     * @param {JClicProject} project - The project to which this settings belongs
     */
    function ProjectSettings(project) {
      _classCallCheck(this, ProjectSettings);

      this.project = project;
      this.languages = [];
      this.locales = [];
    }

    /**
     * Reads the ProjectSettings values from a JQuery XML element
     * @param {external:jQuery} $xml - The XML element to parse
     */


    _createClass(ProjectSettings, [{
      key: "setProperties",
      value: function setProperties($xml) {
        var _this = this;

        $xml.children().each(function (_n, child) {
          switch (child.nodeName) {
            case 'title':
              _this.title = child.textContent;
              break;
            case 'description':
              _this.description = child.textContent;
              break;
            case 'language':
              _this.languages.push(child.textContent);
              break;
            case 'eventSounds':
              _this.eventSounds = new EventSounds();
              _this.eventSounds.setProperties($(child));
              break;
            case 'skin':
              _this.skinFileName = $(child).attr('file');
              break;
          }
        });

        // Try to find an array of valid locales
        // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl
        if (this.languages.length > 0 && window.Intl && window.Intl.getCanonicalLocales) {
          this.locales = [];
          this.languages.forEach(function (lang) {
            // Languages usually are stored in the form: "English (en)"
            var matches = /\(([a-z,A-Z,-]+)\)/.exec(lang);
            if (matches && matches.length > 1) {
              try {
                var canonicals = window.Intl.getCanonicalLocales(matches[1]);
                if (canonicals) _this.locales = _this.locales.concat(canonicals);
              } catch (err) {
                Utils.log('error', "Invalid language: " + lang);
              }
            }
          });
        }
        return this;
      }
    }]);

    return ProjectSettings;
  }();

  Object.assign(ProjectSettings.prototype, {
    /**
     * The JClicProject to which this ProjectSettings belongs
     * @name ProjectSettings#project
     * @type {JClicProject} */
    project: null,
    /**
     * The project title
     * @name ProjectSettings#title
     * @type {string} */
    title: 'Untitled',
    /**
     * Project's description. Can have multiple paragraphs, separated by `<p>`
     * @name ProjectSettings#description
     * @type {string} */
    description: '',
    /**
     * JClic projects can use more than one language, so use a string array
     * @name ProjectSettings#languages
     * @type {string[]} */
    languages: null,
    /**
     * Array of canonical locales, as defined in 
     * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation|Intl}
     * @name ProjectSettings#locales
     * @type {string[]} */
    locales: null,
    /**
     * The name of an optional 'skin' (visual aspect) can be set for the whole project, or for each {@link Activity}
     * @name ProjectSettings#skinFileName
     * @type {string} */
    skinFileName: null,
    /**
     * The main {@link EventSounds} object of the project
     * @name ProjectSettings#eventSounds
     * @type {EventSounds} */
    eventSounds: new EventSounds()
  });

  return ProjectSettings;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 486 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : bags/ActivitySequence.js
 *  Created : 05/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(98), __webpack_require__(487), __webpack_require__(211), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, JumpInfo, ActivitySequenceElement, ActivitySequenceJump, Utils) {

  /**
   * This class stores the definition of the sequence to follow to show the activities of a
   * {@link JClicProject}. The sequence are formed by an ordered list of objects of type
   * {@link ActivitySequenceElement}.
   * It stores also a transient pointer to the current sequence element.
   * @exports ActivitySequence
   * @class
   */
  var ActivitySequence = function () {
    /**
     * ActivitySequence constructor
     * @param {JClicProject} project - The JClic project to which this ActivitySequence belongs
     */
    function ActivitySequence(project) {
      _classCallCheck(this, ActivitySequence);

      this.project = project;
      this.elements = [];
    }

    /**
     * Loads the object settings from a specific JQuery XML element
     * @param {external:jQuery} $xml - The XML element to parse
     */


    _createClass(ActivitySequence, [{
      key: "setProperties",
      value: function setProperties($xml) {
        var _this = this;

        $xml.children('item').each(function (_i, data) {
          return _this.elements.push(new ActivitySequenceElement().setProperties($(data)));
        });
        return this;
      }

      /**
       * Returns the index of the specified element in the sequence.
       * @param {ActivitySequenceElement} ase - The element to search.
       * @returns {number} - The requested index, or `null` if not found.
       */

    }, {
      key: "getElementIndex",
      value: function getElementIndex(ase) {
        return ase === null ? -1 : this.elements.indexOf(ase);
      }

      /**
       * Returns the nth element of the sequence.
       * @param {number} n - Index of the requested element
       * @param {boolean} updateCurrentAct - when `true`, the `currentAct` index will be updated.
       * @returns {ActivitySequenceElement} - The requested element, or `null` if out of range.
       */

    }, {
      key: "getElement",
      value: function getElement(n, updateCurrentAct) {
        var result = null;
        if (n >= 0 && n < this.elements.length) {
          result = this.elements[n];
          if (updateCurrentAct) this.currentAct = n;
        }
        return result;
      }

      /**
       * Search into the sequence for a element with the provided tag
       * @param {string} tag - The tag to search
       * @param {boolean} updateCurrentAct - when `true`, the `currentAct` index will be updated.
       * @returns {ActivitySequenceElement} - The requested element, or `null` if not found.
       */

    }, {
      key: "getElementByTag",
      value: function getElementByTag(tag, updateCurrentAct) {
        var result = null,
            resultIndex = -1;
        if (tag) {
          tag = Utils.nSlash(tag);
          this.elements.some(function (el, index) {
            if (el.tag === tag) {
              result = el;
              resultIndex = index;
            }
            return resultIndex !== -1;
          });
          if (resultIndex !== -1 && updateCurrentAct) this.currentAct = resultIndex;
        }
        return result;
      }

      /**
       * Gets the sequence element pointed by the `currentAct` member.
       * @returns {ActivitySequenceElement} - The current sequence element, or `null` if not set.
       */

    }, {
      key: "getCurrentAct",
      value: function getCurrentAct() {
        return this.getElement(this.currentAct, false);
      }

      /**
       * Checks if it's possible to go forward from the current position in the sequence.
       * @param {boolean} hasReturn - Indicates whether the history of jumps done since the beginning
       * of the JClic session is empty or not. When not empty, a `RETURN` action is still possible.
       * @returns {boolean} - `true` when the user is allowed to go ahead to a next activity,
       * `false` otherwise. */

    }, {
      key: "hasNextAct",
      value: function hasNextAct(hasReturn) {
        var result = false;
        var ase = this.getCurrentAct();
        if (ase) {
          if (ase.fwdJump === null) result = true;else switch (ase.fwdJump.action) {
            case 'STOP':
              break;
            case 'RETURN':
              result = hasReturn;
              break;
            default:
              result = true;
          }
        }
        return result;
      }

      /**
       * Checks if it's possible to go back from the current position in the sequence.
       * @param {boolean} hasReturn - Indicates whether the history of jumps done since the beginning
       * of the JClic session is empty or not. When not empty, a `RETURN` action is still possible.
       * @returns {boolean} - `true` when the user is allowed to go back to a previous activity,
       * `false` otherwise. */

    }, {
      key: "hasPrevAct",
      value: function hasPrevAct(hasReturn) {
        var result = false;
        var ase = this.getCurrentAct();
        if (ase) {
          if (ase.backJump === null) result = true;else switch (ase.backJump.action) {
            case 'STOP':
              break;
            case 'RETURN':
              result = hasReturn;
              break;
            default:
              result = true;
          }
        }
        return result;
      }

      /**
       * Gets the current state for the 'next' and 'prev' buttons.
       * @returns {string} - One of the possible values of {@link ActivitySequenceElement#navButtons},
       * thus: `none`, `fwd`, `back` or `both`
       */

    }, {
      key: "getNavButtonsFlag",
      value: function getNavButtonsFlag() {
        var flag = 'none';
        var ase = this.getCurrentAct();
        if (ase) flag = ase.navButtons;
        return flag;
      }

      /**
       * Computes the jump to perform from the current position on the sequence
       * @param {boolean} back - When `true`, the request is for the 'go back' button. Otherwise, is
       * for the 'next' one.
       * @param {Reporter} reporter - The reporting engine that will provide values about score average
       * and time spend on the activities, used only to compute conditional jumps.
       * @returns {JumpInfo} - The jump info if a valid jump is possible, `null` otherwise.
       */

    }, {
      key: "getJump",
      value: function getJump(back, reporter) {
        var ase = this.getCurrentAct();
        var result = null;
        if (ase) {
          var asj = back ? ase.backJump : ase.fwdJump;
          if (asj === null) {
            var i = this.currentAct + (back ? -1 : 1);
            if (i >= this.elements.length || i < 0) i = 0;
            result = new JumpInfo('JUMP', i);
          } else {
            var rating = -1,
                time = -1;
            if (reporter !== null) {
              var seqRegInfo = reporter.getCurrentSequenceInfo();
              if (seqRegInfo !== null) {
                rating = Math.round(seqRegInfo.tScore);
                time = Math.round(seqRegInfo.tTime / 1000);
              }
            }
            result = asj.resolveJump(rating, time);
          }
        }
        return result;
      }

      /**
       * Finds the nearest sequence element with a valid 'tag', looking back in the `elements` list.
       * @param {number} num - The point of the sequence from which to start looking back.
       * @returns {string} - The nearest 'tag', or `null` if not found.
       */

    }, {
      key: "getSequenceForElement",
      value: function getSequenceForElement(num) {
        var tag = null;
        if (num >= 0 && num < this.elements.length) for (var i = num; tag === null && i >= 0; i--) {
          tag = this.getElement(i, false).tag;
        }
        return tag;
      }

      /**
       * Gets the first {@link ActivitySequenceElement} in the `elements` list pointing to the
       * specified activity name.
       * The search is always case-insensitive.
       * @param {string} activityName - The activity to search.
       * @returns {ActivitySequenceElement} The requested element or `null` if not found.
       */

    }, {
      key: "getElementByActivityName",
      value: function getElementByActivityName(activityName) {
        var result = null;
        if (activityName !== null) {
          for (var i = 0; result === null && i < this.elements.length; i++) {
            var ase = this.getElement(i, false);
            if (ase.activityName.toLowerCase() === activityName.toLowerCase()) result = ase;
          }
        }
        return result;
      }

      /**
       * Utility function to check if the current sequence element corresponds to the specified
       * activity. If negative, the `currentAct` will be accordingly set.
       * @param {string} activityName - The activity to check
       */

    }, {
      key: "checkCurrentActivity",
      value: function checkCurrentActivity(activityName) {
        var ase = this.getCurrentAct();
        if (ase === null || ase.activityName.toUpperCase() !== activityName.toUpperCase()) {
          for (var i = 0; i < this.elements.length; i++) {
            if (this.getElement(i, false).activityName.toUpperCase() === activityName.toUpperCase()) {
              this.currentAct = i;
              return false;
            }
          }
          ase = new ActivitySequenceElement();
          ase.activityName = activityName;
          ase.fwdJump = new ActivitySequenceJump('STOP');
          ase.backJump = new ActivitySequenceJump('STOP');
          this.elements.push(ase);
          this.currentAct = this.elements.length - 1;
          return false;
        }
        return true;
      }
    }]);

    return ActivitySequence;
  }();

  Object.assign(ActivitySequence.prototype, {
    /**
     * The ordered list of {@link ActivitySequenceElement} objects
     * @name ActivitySequence#elements
     * @type {ActivitySequenceElement[]} */
    elements: null,
    /**
     * The JClic project to which this ActivitySequence belongs.
     * @name ActivitySequence#project
     * @type {JClicProject} */
    project: null,
    /**
     * Pointer to the {@link ActivitySequenceElement} currently running (points inside
     * the `elements` array).
     * @name ActivitySequence#currentAct
     * @type {number} */
    currentAct: -1
  });

  return ActivitySequence;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 487 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : bags/ActivitySequenceElement.js
 *  Created : 05/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(211), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, ActivitySequenceJump, Utils) {

  /**
   *
   * This class is the basic component of {@link ActivitySequence} objects. It represents a specific
   * point in the project's sequence of JClic activities.
   *
   * For each point of the sequence, some options can be set:
   * - What activity must run at this point
   * - What to do or where to jump when the activity finishes
   * - The behavior of the "next" button
   * - The behavior of the  "prev" button
   *
   * Sequence points can also have a "tag", used to refer to them with a unique name.
   * @exports ActivitySequenceElement
   * @class
   */
  var ActivitySequenceElement = function () {
    function ActivitySequenceElement() {
      _classCallCheck(this, ActivitySequenceElement);
    }

    /**
     * Loads the object settings from a specific JQuery XML element
     * @param {external:jQuery} $xml
     */


    _createClass(ActivitySequenceElement, [{
      key: "setProperties",
      value: function setProperties($xml) {
        var _this = this;

        // Iterate on all provided attributes
        Utils.attrForEach($xml.get(0).attributes, function (name, val) {
          switch (name) {
            case 'id':
              _this['tag'] = Utils.nSlash(val);
              break;
            case 'name':
              _this['activityName'] = val;
              break;
            case 'description':
            // possible navButtons values are: `none`, `fwd`, `back` or `both`
            case 'navButtons':
              _this[name] = val;
              break;
            case 'delay':
              _this[name] = Number(val);
              break;
          }
        });

        // Iterate on 'jump' elements to load fwdJump and/or backJump
        $xml.children('jump').each(function (_n, data) {
          var jmp = new ActivitySequenceJump().setProperties($(data));
          if (jmp.id === 'forward') _this.fwdJump = jmp;else if (jmp.id === 'back') _this.backJump = jmp;
        });
        return this;
      }
    }]);

    return ActivitySequenceElement;
  }();

  Object.assign(ActivitySequenceElement.prototype, {
    /**
     * Optional unique identifier of this element in the {@link ActivitySequence}.
     * @name ActivitySequenceElement#tag
     * @type {string} */
    tag: null,
    /**
     * Optional description of this sequence element.
     * @name ActivitySequenceElement#description
     * @type {string} */
    description: null,
    /**
     * Name of the {@link Activity} pointed by this element.
     * @name ActivitySequenceElement#activityName
     * @type {string} */
    activityName: '',
    /**
     * Jump to be processed by the 'next' button action
     * @name ActivitySequenceElement#fwdJump
     * @type {ActivitySequenceJump} */
    fwdJump: null,
    /**
     * Jump to be processed by the 'prev' button action.
     * @name ActivitySequenceElement#backJump
     * @type {ActivitySequenceJump} */
    backJump: null,
    /**
     * What buttons should be active at this point of the sequence. Valid values are:
     * - 'none'
     * - 'fwd'
     * - 'back'
     * - 'both'
     * @name ActivitySequenceElement#navButtons
     * @type {string} */
    navButtons: 'both',
    /**
     * Time delay (in seconds) before passing to the next/prev activity
     * @name ActivitySequenceElement#delay
     * @type {number} */
    delay: 0
  });

  return ActivitySequenceElement;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 488 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : bags/ConditionalJumpInfo.js
 *  Created : 05/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2016 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(98)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, JumpInfo) {

  /**
   * This special case of {@link JumpInfo} is used in {@link ActivitySequenceJump} objects to decide
   * the type of jump or action to be performed, based on the results obtained by the user when
   * playing previous JClic activities.
   *
   * In addition to the standard {@link JumpInfo} fields and methods, this class has two public
   * members where score and time thresholds are stored.
   *
   * The exact meaning of this members will depend on the type of `ConditionalJumpInfo` in the
   * {@link ActivitySequenceJump} (it can be `upperJump` or `lowerJump`).
   * @exports ConditionalJumpInfo
   * @class
   * @extends JumpInfo
   */
  var ConditionalJumpInfo = function (_JumpInfo) {
    _inherits(ConditionalJumpInfo, _JumpInfo);

    /**
     * ConditionalJumpInfo constructor
     * @param {string} action - Must be one of the described actions.
     * @param {(number|string)=} sq - Can be the tag of the sequence element to jump to, or its
     * cardinal number in the list.
     * @param {number=} threshold - Threshold above or below which the action will be triggered,
     * depending on the type of JumpInfo.
     * @param {number=} time - Delay to be applied in automatic jumps.
     */
    function ConditionalJumpInfo(action, sq, threshold, time) {
      _classCallCheck(this, ConditionalJumpInfo);

      var _this = _possibleConstructorReturn(this, (ConditionalJumpInfo.__proto__ || Object.getPrototypeOf(ConditionalJumpInfo)).call(this, action, sq));

      _this.threshold = typeof threshold === 'number' ? threshold : -1;
      _this.time = typeof threshold === 'number' ? time : -1;
      return _this;
    }

    /**
     * Loads this object settings from a specific JQuery XML element
     * @param {external:jQuery} $xml - The XML element to parse
     */


    _createClass(ConditionalJumpInfo, [{
      key: "setProperties",
      value: function setProperties($xml) {
        _get(ConditionalJumpInfo.prototype.__proto__ || Object.getPrototypeOf(ConditionalJumpInfo.prototype), "setProperties", this).call(this, $xml);
        if ($xml.attr('threshold') !== undefined) this.threshold = $xml.attr('threshold');
        if ($xml.attr('time') !== undefined) this.time = $xml.attr('time');
        return this;
      }
    }]);

    return ConditionalJumpInfo;
  }(JumpInfo);

  Object.assign(ConditionalJumpInfo.prototype, {
    /**
     * Threshold above or below which the action will be triggered, depending on the type of JumpInfo.
     * @name ConditionalJumpInfo#threshold
     * @type {number} */
    threshold: -1,
    /**
     * Delay to be applied in automatic jumps.
     * @name ConditionalJumpInfo#time
     * @type {number} */
    time: -1
  });

  return ConditionalJumpInfo;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 489 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : bags/MediaBag.js
 *  Created : 07/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(490), __webpack_require__(34), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, MediaBagElement, Skin, Utils) {

  /**
   * This class stores and manages all the media components (images, sounds, animations, video,
   * MIDI files, etc.) needed to run the activities of a {@link JClicProject}. The main member of
   * the class is `elements`. This is where {@link MediaBagElement} objects are stored.
   * @exports MediaBag
   * @class
   */
  var MediaBag = function () {
    /**
     * MediaBag constructor
     * @param {JClicProject} project - The JClic project to which this media bag belongs
     */
    function MediaBag(project) {
      _classCallCheck(this, MediaBag);

      this.project = project;
      this.elements = {};
    }

    /**
     * Loads this object settings from a specific JQuery XML element
     * @param {external:jQuery} $xml - The XML element to parse
     */


    _createClass(MediaBag, [{
      key: "setProperties",
      value: function setProperties($xml) {
        var _this = this;

        $xml.children('media').each(function (_n, child) {
          var mbe = new MediaBagElement(_this.project.basePath, null, _this.project.zip);
          mbe.setProperties($(child));
          _this.elements[mbe.name] = mbe;
        });
        return this;
      }

      /**
       * Finds a {@link MediaBagElement} by its name, creating a new one if not found and requested.
       * @param {string} name - The name of the element
       * @param {boolean=} create - When `true`, a new MediaBagElement will be created if not found,
       * using 'name' as its fileName..
       * @returns {MediaBagElement}
       */

    }, {
      key: "getElement",
      value: function getElement(name, create) {
        name = Utils.nSlash(name);
        var result = this.elements[name];
        if (create && !result) result = this.getElementByFileName(name, create);
        return result;
      }

      /**
       * Gets a {@link MediaBagElement} by its file name.
       * @param {string} fileName - The requested file name
       * @param {boolean=} create - When `true`, a new {@link MediaBagElement} will be created if not
       * found.
       * @returns {MediaBagElement}
       */

    }, {
      key: "getElementByFileName",
      value: function getElementByFileName(fileName, create) {
        var result = null;
        if (fileName) {
          fileName = Utils.nSlash(fileName);
          for (var name in this.elements) {
            if (this.elements[name].fileName === fileName) {
              result = this.elements[name];
              break;
            }
          }
          if (!result && create) {
            result = new MediaBagElement(this.project.basePath, null, this.project.zip);
            result.name = fileName;
            result.fileName = fileName;
            result.ext = fileName.toLowerCase().split('#')[0].split('.').pop();
            result.type = result.getFileType(result.ext);
            this.elements[result.name] = result;
          }
        }
        return result;
      }

      /**
       * Get the names of the media elements that are of the given type.
       * When the search type is `font`, the `fontName` property is used instead of `name`
       * @param {string} type - The type of elements to search
       * @returns {String[]}
       */

    }, {
      key: "getElementsOfType",
      value: function getElementsOfType(type) {
        var result = [];
        $.each(this.elements, function (name, element) {
          if (element.type === type) result.push(type === 'font' ? element.fontName : name);
        });
        return result;
      }

      /**
       * Preloads all resources.
       *
       * __Use with care!__ Calling this method will start loading all the resources defined in the
       * MediaBag, whether used or not in the current activity.
       * @param {string} type - The type of media to be build. When `null` or `undefined`, all
       * resources will be build.
       * @param {function=} callback - Function to be called when each element is ready.
       * @param {PlayStation=} ps - An optional `PlayStation` (currently a {@link JClicPlayer}) used to dynamically load fonts
       * @returns {number} - The total number of elements that will be build     * 
       */

    }, {
      key: "buildAll",
      value: function buildAll(type, callback, ps) {
        var count = 0;
        $.each(this.elements, function (name, element) {
          if (!type || element.type === type) {
            element.build(callback, ps);
            count++;
          }
        });
        return count;
      }

      /**
       * Checks if there are media waiting to be loaded
       * @returns {number} - The amount of media elements already loaded, or -1 if all elements are ready
       */

    }, {
      key: "countWaitingElements",
      value: function countWaitingElements() {
        var ready = 0,
            allReady = true;

        // Only for debug purposes: return always 'false'
        // TODO: Check loading process!
        $.each(this.elements, function (name, element) {
          if (element.data && !element.ready && !element.checkReady() && !element.checkTimeout()) {
            Utils.log('debug', '... waiting for: %s', name);
            allReady = false;
          } else ready++;
        });
        return allReady ? -1 : ready;
      }

      /**
       * Loads a {@link Skin} object
       * @param {string} name - The skin name to be loaded
       * @param {string} ps - The {@link PlayStation} linked to the skin
       * @returns {Skin}
       */

    }, {
      key: "getSkinElement",
      value: function getSkinElement(name, ps) {
        return Skin.getSkin(name, ps);
      }
    }]);

    return MediaBag;
  }();

  Object.assign(MediaBag.prototype, {
    /**
     * The collection of {@link MediaBagElement} objects
     * @name MediaBag#elements
     * @type {object} */
    elements: null,
    /**
     * The JClic project to which this MediaBag belongs
     * @name MediaBag#project
     * @type {JClicProject} */
    project: null
  });

  return MediaBag;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 490 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : bags/MediaBagElement.js
 *  Created : 07/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define, Uint8Array */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Utils, AWT) {

  /**
   * This kind of objects are the components of {@link MediaBag}.
   *
   * Media elements have a name, a reference to a file (the `fileName` field) and, when initialized,
   * a `data` field pointing to a object containing the real media. They have also a flag indicating
   * if the data must be saved on the {@link JClicProject} zip file or just maintained as a reference
   * to an external file.
   * @exports MediaBagElement
   * @class
   */
  var MediaBagElement = function () {
    /**
     * MediaBagElement constructor
     * @param {string} basePath - Path to be used as a prefix of the file name
     * @param {string} fileName - The media file name
     * @param {external:JSZip=} zip - An optional JSZip object from which the file must be extracted.
     */
    function MediaBagElement(basePath, fileName, zip) {
      _classCallCheck(this, MediaBagElement);

      if (basePath) this.basePath = basePath;
      if (fileName) {
        this.fileName = Utils.nSlash(fileName);
        this.name = Utils.nSlash(fileName);
        this.ext = this.fileName.toLowerCase().split('.').pop();
        this.type = this.getFileType(this.ext);
        if (this.ext === 'gif') this.checkAnimatedGif();
      }
      if (zip) this.zip = zip;
      this.timeout = Date.now() + Utils.settings.LOAD_TIMEOUT;
    }

    /**
     * Loads this object settings from a specific JQuery XML element
     * @param {external:jQuery} $xml - The XML element to parse
     */


    _createClass(MediaBagElement, [{
      key: "setProperties",
      value: function setProperties($xml) {
        this.name = Utils.nSlash($xml.attr('name'));
        this.fileName = Utils.nSlash($xml.attr('file'));
        this.ext = this.fileName.toLowerCase().split('.').pop();
        this.type = this.getFileType(this.ext);
        // Check if it's an animated GIF
        if (this.ext === 'gif') {
          var anim = $xml.attr('animated');
          if (typeof anim === 'undefined') this.checkAnimatedGif();else this.animated = anim === 'true';
        }
        if (this.type === 'font') {
          this.fontName = this.name === this.fileName && this.name.lastIndexOf('.') > 0 ? this.name.substring(0, this.name.lastIndexOf('.')) : this.name;
        }
        return this;
      }

      /**
       * Checks if the image associated with this MediaBagElement is an animated GIF
       *
       * Based on: {@link https://gist.github.com/marckubischta/261ad8427a214022890b}
       * Thanks to `@lakenen` and `@marckubischta`
       */

    }, {
      key: "checkAnimatedGif",
      value: function checkAnimatedGif() {
        var _this = this;

        var request = new XMLHttpRequest();
        request.responseType = 'arraybuffer';
        request.addEventListener('load', function () {
          var arr = new Uint8Array(request.response),
              length = arr.length;

          // make sure it's a gif (GIF8)
          if (arr[0] !== 0x47 || arr[1] !== 0x49 || arr[2] !== 0x46 || arr[3] !== 0x38) {
            _this.animated = false;
            return;
          }

          // Ported from PHP [http://www.php.net/manual/en/function.imagecreatefromgif.php#104473]
          // an animated gif contains multiple "frames", with each frame having a
          // header made up of:
          // * a static 3-byte sequence (\x00\x21\xF9
          // * one byte indicating the length of the header (usually \x04)
          // * variable length header (usually 4 bytes)
          // * a static 2-byte sequence (\x00\x2C) (some variants may use \x00\x21 ?)
          // We read through the file as long as we haven't reached the end of the file
          // and we haven't yet found at least 2 frame headers
          for (var i = 0, len = length - 3, frames = 0; i < len && frames < 2; ++i) {
            if (arr[i] === 0x00 && arr[i + 1] === 0x21 && arr[i + 2] === 0xF9) {
              var blocklength = arr[i + 3],
                  afterblock = i + 4 + blocklength;
              if (afterblock + 1 < length && arr[afterblock] === 0x00 && (arr[afterblock + 1] === 0x2C || arr[afterblock + 1] === 0x21)) {
                if (++frames > 1) {
                  _this.animated = true;
                  Utils.log('debug', "Animated GIF detected: " + _this.fileName);
                  break;
                }
              }
            }
          }
        });

        this.getFullPathPromise().then(function (fullPath) {
          request.open('GET', fullPath, true);
          request.send();
        });
      }

      /**
       * Checks if the MediaBagElement has been initiated
       * @returns {boolean}
       */

    }, {
      key: "isEmpty",
      value: function isEmpty() {
        return this.data === null;
      }

      /**
       * Determines the type of a file from its extension
       * @param {string} ext - The file name extension
       * @returns {string}
       */

    }, {
      key: "getFileType",
      value: function getFileType(ext) {
        var result = null;
        for (var type in Utils.settings.FILE_TYPES) {
          if (Utils.settings.FILE_TYPES[type].indexOf(ext) >= 0) {
            result = type;
            break;
          }
        }
        return result;
      }

      /**
       * Instantiates the media content
       * @param {function} callback - Callback method called when the referred resource is ready
       * @param {PlayStation=} ps - An optional `PlayStation` (currently a {@link JClicPlayer}) used to dynamically load fonts
       */

    }, {
      key: "build",
      value: function build(callback, ps) {
        var _this2 = this;

        if (callback) {
          if (!this._whenReady) this._whenReady = [];
          this._whenReady.push(callback);
        }

        if (!this.data) this.getFullPathPromise().then(function (fullPath) {
          switch (_this2.type) {
            case 'font':
              var format = _this2.ext === 'ttf' ? 'truetype' : _this2.ext === 'otf' ? 'embedded-opentype' : _this2.ext,
                  css = "@font-face{font-family:\"" + _this2.fontName + "\";src:url(" + fullPath + ") format(\"" + format + "\");}";

              Utils.appendStyleAtHead(css, ps);
              _this2.data = new AWT.Font(_this2.name);
              _this2.ready = true;
              break;

            case 'image':
              _this2.data = new Image();
              $(_this2.data).on('load', function () {
                return _this2._onReady.call(_this2);
              });
              _this2.data.src = fullPath;
              break;

            case 'audio':
            case 'video':
              _this2.data = document.createElement(_this2.type);
              $(_this2.data).on('canplay', function () {
                return _this2._onReady.call(_this2);
              });
              _this2.data.src = fullPath;
              _this2.data.pause();
              break;

            case 'anim':
              _this2.data = $("<object type\"application/x-shockwave-flash\" width=\"300\" height=\"200\" data=\"" + fullPath + "\"/>").get(-1);
              // Unable to check the loading progress in elements of type `object`. so we mark it always as `ready`:
              _this2.ready = true;
              break;

            case 'xml':
              $.get(fullPath, null, null, 'xml').done(function (xmlData) {
                _this2.data = Utils.parseXmlNode(xmlData.children[0]);
                _this2._onReady();
              }).fail(function (err) {
                Utils.log('error', "Error loading " + _this2.name + ": " + err);
              });
              //this.data = ''
              //this.ready = true
              // Since we are not yet supporting complex skins, there
              // is no need to read XML files
              break;

            default:
              // TODO: Load the real resource
              Utils.log('trace', "Media currently not supported: " + _this2.name);
              _this2.ready = true;
          }

          if (_this2.ready) _this2._onReady();
        });else if (this.ready) this._onReady();

        return this;
      }

      /**
       * Checks if this media element is ready to start
       * @returns {Boolean} - `true` if ready, `false` otherwise
       */

    }, {
      key: "checkReady",
      value: function checkReady() {
        if (this.data && !this.ready) {
          switch (this.type) {
            case 'image':
              this.ready = this.data.complete === true;
              break;
            case 'audio':
            case 'video':
            case 'anim':
              this.ready = this.data.readyState >= 1;
              break;
            default:
              this.ready = true;
          }
        }
        return this.ready;
      }

      /**
       * Checks if this resource has timed out.
       * @returns {Boolean} - `true` if the resource has exhausted the allowed time to load, `false` otherwise
       */

    }, {
      key: "checkTimeout",
      value: function checkTimeout() {
        var result = Date.now() > this.timeout;
        if (result) Utils.log('warn', "Timeout while loading: " + this.name);
        return result;
      }

      /**
       * Notify listeners that the resource is ready
       */

    }, {
      key: "_onReady",
      value: function _onReady() {
        var _this3 = this;

        this.ready = true;
        if (this._whenReady) {
          this._whenReady.forEach(function (fn) {
            return fn.call(_this3, _this3);
          });
          this._whenReady = null;
        }
      }

      /**
       * Gets the full path of the file associated to this element.
       * WARNING: This function should be called only after a successful call to `getFullPathPromise`
       * @returns {string}
       */

    }, {
      key: "getFullPath",
      value: function getFullPath() {
        return this._fullPath;
      }

      /**
       * Gets a promise with the full path of the file associated to this element.
       * @returns {Promise}
       */

    }, {
      key: "getFullPathPromise",
      value: function getFullPathPromise() {
        var _this4 = this;

        return new Promise(function (resolve, reject) {
          Utils.getPathPromise(_this4.basePath, _this4.fileName, _this4.zip).then(function (fullPath) {
            _this4._fullPath = fullPath;
            resolve(fullPath);
          }).catch(reject);
        });
      }
    }]);

    return MediaBagElement;
  }();

  Object.assign(MediaBagElement.prototype, {
    /**
     * The name of this element. Usually is the same as `fileName`
     * @name MediaBagElement#name
     * @type {string} */
    name: '',
    /**
     * The name of the file where this element is stored
     * @name MediaBagElement#fileName
     * @type {string} */
    fileName: '',
    /**
     * The font family name, used only in elements of type 'font'
     * @name MediaBagElement#fontName
     * @type {string} */
    fontName: '',
    /**
     * The path to be used as base to access this media element
     * @name MediaBagElement#basePath
     * @type {string} */
    basePath: '',
    /**
     * An optional JSZip object that can act as a container of this media
     * @name MediaBagElement#zip
     * @type {external:JSZip} */
    zip: null,
    /**
     * When loaded, this field will store the realized media object
     * @name MediaBagElement#data
     * @type {object} */
    data: null,
    /**
     * Flag indicating that `data` is ready to be used
     * @name MediaBagElement#ready
     * @type {boolean} */
    ready: false,
    /**
     * Array of callback methods to be called when the resource becomes ready
     * @name MediaBagElement#_whenReady
     * @private
     * @type {function[]} */
    _whenReady: null,
    /**
     * Normalized extension of `fileName`, useful to determine the media type
     * @name MediaBagElement#ext
     * @type {string} */
    ext: '',
    /**
     * The resource type ('audio', 'image', 'midi', 'video', 'font')
     * @name MediaBagElement#type
     * @type {string} */
    type: null,
    /**
     * Time set to load the resource before leaving
     * @name MediaBagElement#timeout
     * @type {number} */
    timeout: 0,
    //
    /**
     * Flag used for animated GIFs
     * @name MediaBagElement#animated
     * @type {boolean} */
    animated: false,
    /**
     * Full path obtained after a successful call to getFullPathPromise
     * @name MediaBagElement#_fullPath
     * @private
     * @type {string}
     */
    _fullPath: null
  });

  return MediaBagElement;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 491 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : activities/text/Evaluator.js
 *  Created : 14/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Utils) {

  /**
   * This class and its derivatives {@link BasicEvaluator} and
   * {@link ComplexEvaluator} are used to evaluate the answers written by the final users
   * in text activities.
   * @exports Evaluator
   * @class
   */
  var Evaluator = function () {
    /**
     * Evaluator constructor
     * @param {string} className - The class name of this evaluator.
     */
    function Evaluator(className) {
      var _this = this;

      _classCallCheck(this, Evaluator);

      this.className = className;
      this.collator = window.Intl && window.Intl.Collator ? new window.Intl.Collator() : { compare: function compare(a, b) {
          return _this.checkCase ? a === b : a.toUpperCase() === b.toUpperCase();
        } };
    }

    /**
     * Factory constructor that returns a specific type of {@link Evaluator} based on the `class`
     * attribute declared in the $xml element.
     * @param {external:jQuery} $xml - The XML element to be parsed.
     * @returns {Evaluator}
     */


    _createClass(Evaluator, [{
      key: "setProperties",


      /**
       * Loads the object settings from a specific JQuery XML element
       * @param {external:jQuery} $xml - The jQuery XML element to parse
       */
      value: function setProperties($xml) {
        var _this2 = this;

        Utils.attrForEach($xml.get(0).attributes, function (name, value) {
          switch (name) {
            case 'class':
              _this2.className = value;
              break;
            case 'checkCase':
            case 'checkAccents':
            case 'checkPunctuation':
            case 'checkDoubleSpaces':
            case 'detail':
              _this2[name] = Utils.getBoolean(value);
              break;
            case 'checkSteps':
            case 'checkScope':
              _this2[name] = Number(value);
              break;
          }
        });
        return this;
      }

      /**
       * Initializes this evaluator
       * @param {string[]} _locales - An array of valid locales, to be used by Intl.Collator
       */

    }, {
      key: "init",
      value: function init(_locales) {
        this.initiated = true;
      }

      /**
       * Checks the given text against a set of valid matches
       * @param {string} text - The text to be checked
       * @param {(string|string[])} match - The valid expression or expressions with which to compare.
       * @returns {boolean} - `true` if the checked expression is valid, `false` otherwise.
       */

    }, {
      key: "checkText",
      value: function checkText(text, match) {
        var _this3 = this;

        if (match instanceof Array) return match.some(function (m) {
          return _this3._checkText(text, m);
        });else if (match) return this._checkText(text, match);else return false;
      }

      /**
       * Abstract method to be implemented in subclasses.
       * Performs the validation of a string against a single match.
       * @param {string} _text - The text to be checked
       * @param {string} _match - A valid expression with which to compare.
       * @returns {boolean} - `true` when the two expressions can be considered equivalent.
       */

    }, {
      key: "_checkText",
      value: function _checkText(_text, _match) {
        return false;
      }

      /**
       * Evaluates the given text against a set of valid matches, returning an array of flags useful
       * to indicate where the mistakes are located.
       * @param {string} text - The text to be checked
       * @param {(string|string[])} match - The valid expression or expressions with which to compare.
       * @returns {number[]} - An array of flags (one number for character) indicating whether each
       * position is erroneous or ok.
       */

    }, {
      key: "evalText",
      value: function evalText(text, match) {
        if (!(match instanceof Array)) match = [match];
        return this._evalText(text, match);
      }

      /**
       * Abstract method to be implemented in subclasses.
       * Performs the evaluation of a string against an array of valid matches, returning an array of
       * flags useful to indicate where the mistakes are located.
       * @param {string} _text - The text to be checked
       * @param {string} _match - A valid expression with which to compare.
       * @returns {number[]} - An array of flags (one number for character) indicating whether each
       * position is erroneous or OK.
       */

    }, {
      key: "_evalText",
      value: function _evalText(_text, _match) {
        return [];
      }

      /**
       * Checks if the given array of flags (usually returned by `evalText`) can be considered as a
       * valid or erroneous answer.
       * @param {number[]} flags
       * @returns {boolean} - `true` when there is at least one flag and all flags are 0 (meaning no error).
       */

    }, {
      key: "isOk",
      value: function isOk(flags) {
        return flags && flags.length > 0 && !flags.some(function (f) {
          return f !== 0;
        });
      }
    }], [{
      key: "getEvaluator",
      value: function getEvaluator($xml) {
        var ev = null;
        if ($xml) {
          var className = $xml.attr('class');
          var cl = Evaluator.CLASSES[className];
          if (cl) {
            ev = new cl(className);
            ev.setProperties($xml);
          } else Utils.log('error', "Unknown evaluator class: \"" + className + "\"");
        }
        return ev;
      }
    }]);

    return Evaluator;
  }();

  Object.assign(Evaluator.prototype, {
    /**
     * The type of evaluator.
     * @name Evaluator#className
     * @type {string} */
    className: null,
    /**
     * Whether this evaluator has been initialized or not.
     * @name Evaluator#initiated
     * @type {boolean} */
    initiated: false,
    /**
     * The Intl.Collator object used to compare strings, when available.
     * @name Evaluator#collator
     * @type {external:Collator} */
    collator: null,
    /**
     * Whether uppercase and lowercase expressions must be considered equivalent or not.
     * @name Evaluator#checkcase
     * @type {boolean} */
    checkCase: false
  });

  /**
   * A basic evaluator that just compares texts, without looking for possible coincidences of text
   * fragments once erroneous characters removed.
   * @class
   * @extends Evaluator
   */

  var BasicEvaluator = function (_Evaluator) {
    _inherits(BasicEvaluator, _Evaluator);

    /**
     * BasicEvaluator constructor
     * @param {string} className - The class name of this evaluator.
     */
    function BasicEvaluator(className) {
      _classCallCheck(this, BasicEvaluator);

      return _possibleConstructorReturn(this, (BasicEvaluator.__proto__ || Object.getPrototypeOf(BasicEvaluator)).call(this, className));
    }

    /**
     * Initializes the {@link Evaluator#collator}.
     * @override
     * @param {string[]} locales - An array of valid locales to be used by the Inlt.Collator object
     */


    _createClass(BasicEvaluator, [{
      key: "init",
      value: function init(locales) {
        // Call `init` method on ancestor
        _get(BasicEvaluator.prototype.__proto__ || Object.getPrototypeOf(BasicEvaluator.prototype), "init", this).call(this, [locales]);

        // Get canonical locales
        if (window.Intl && window.Intl.Collator) {
          this.collator = new window.Intl.Collator(locales, {
            sensitivity: this.checkAccents ? this.checkCase ? 'case' : 'accent' : 'base',
            ignorePunctuation: !this.checkPunctuation
          });
        }
      }

      /**
       * Performs the validation of a string against a single match.
       * @override
       * @param {string} text - The text to be checked
       * @param {string} match - A valid expression with which to compare.
       * @returns {boolean} - `true` when the two expressions can be considered equivalent.
       */

    }, {
      key: "_checkText",
      value: function _checkText(text, match) {
        return this.collator.compare(this.getClearedText(text), this.getClearedText(match)) === 0;
      }

      /**
       * Performs the evaluation of a string against an array of valid matches, returning an array of
       * flags useful to indicate where the mistakes are located.
       * In BasicEvaluator, all characters are just marked as 1 (error) or 0 (OK). See
       * {@link ComplexEvaluator} for more detailed analysis of answers.
       * @override
       * @param {string} text - The text to be checked
       * @param {string} match - A valid expression with which to compare.
       * @returns {number[]} - An array of flags (one number for character) indicating whether each
       * position is erroneous or OK.
       */

    }, {
      key: "_evalText",
      value: function _evalText(text, match) {
        return Array(text.length).fill(this._checkText(text, match[0]) ? 0 : 1);
      }

      /**
       * Removes double spaces and erroneous characters from a given text expression.
       * @param {string} src - The text to be processed.
       * @param {boolean[]} skipped - An array of boolean indicating which characters should be removed
       * from the string.
       * @returns {string}
       */

    }, {
      key: "getClearedText",
      value: function getClearedText(src, skipped) {
        if (this.checkPunctuation && this.checkDoubleSpaces) return src;

        if (!skipped) skipped = Array(src.length).fill(false);

        var sb = '';
        for (var i = 0, wasSpace = false; i < src.length; i++) {
          var ch = src.charAt(i);
          if (this.PUNCTUATION.indexOf(ch) >= 0 && !this.checkPunctuation) {
            if (!wasSpace) sb += ' ';else skipped[i] = true;
            wasSpace = true;
          } else if (ch === ' ') {
            if (this.checkDoubleSpaces || !wasSpace) sb += ch;else skipped[i] = true;
            wasSpace = true;
          } else {
            wasSpace = false;
            sb += ch;
          }
        }
        return sb;
      }
    }]);

    return BasicEvaluator;
  }(Evaluator);

  Object.assign(BasicEvaluator.prototype, {
    /**
     * Whether accented letters must be considered equivalent or not.
     * @name BasicEvaluator#checkAccents
     * @type {boolean} */
    checkAccents: true,
    /**
     * Whether to check or not dots, commas and other punctuation marks when comparing texts.
     * @name BasicEvaluator#checkPunctuation
     * @type {boolean} */
    checkPunctuation: true,
    /**
     * Whether to check or not the extra spaces added between words.
     * @name BasicEvaluator#checkDoubleSpaces
     * @type {boolean} */
    checkDoubleSpaces: false,
    /**
     * String containing all the characters considered as punctuation marks (currently ".,;:")
     * @name BasicEvaluator#PUNCTUATION
     * @type {string} */
    PUNCTUATION: '.,;:'
  });

  /**
   * ComplexEvaluator acts like {@link BasicEvaluator}, but providing feedback about
   * the location of mistakes on the user's answer.
   * @class
   * @extends BasicEvaluator
   */

  var ComplexEvaluator = function (_BasicEvaluator) {
    _inherits(ComplexEvaluator, _BasicEvaluator);

    /**
     * ComplexEvaluator constructor
     * @param {string} className - The class name of this evaluator.
     */
    function ComplexEvaluator(className) {
      _classCallCheck(this, ComplexEvaluator);

      return _possibleConstructorReturn(this, (ComplexEvaluator.__proto__ || Object.getPrototypeOf(ComplexEvaluator)).call(this, className));
    }

    /**
     * Performs the evaluation of a string against an array of valid matches, returning an array of
     * flags useful to indicate where the mistakes are located.
     * In BasicEvaluator, all characters are just marked as 1 (error) or 0 (OK). See
     * {@link ComplexEvaluator} for more detailed analysis of answers.
     * @override
     * @param {string} text - The text to be checked
     * @param {string} match - A valid expression with which to compare.
     * @returns {number[]} - An array of flags (one number for character) indicating whether each
     * position is erroneous or OK.
     */


    _createClass(ComplexEvaluator, [{
      key: "_evalText",
      value: function _evalText(text, match) {

        if (!this.detail) return _get(ComplexEvaluator.prototype.__proto__ || Object.getPrototypeOf(ComplexEvaluator.prototype), "_evalText", this).call(this, text, match);

        var skipped = Array(text.length).fill(false),
            sText = this.getClearedText(text, skipped),
            numChecks = Array(match.length),
            flags = Array(match.length),
            returnFlags = Array(text.length);
        var maxCheck = -1,
            maxCheckIndex = -1;

        for (var i = 0; i < match.length; i++) {
          flags[i] = Array(text.length).fill(0);
          var ok = this.compareSegment(sText, sText.length, match[i], match[i].length, flags[i], false);
          numChecks[i] = this.countFlagsOk(flags[i]);
          if (ok) {
            maxCheckIndex = i;
            maxCheck = numChecks[i];
          }
        }

        if (maxCheckIndex === -1) {
          for (var _i = 0; _i < match.length; _i++) {
            if (numChecks[_i] > maxCheck) {
              maxCheck = numChecks[_i];
              maxCheckIndex = _i;
            }
          }
        }

        for (var _i2 = 0, k = 0; _i2 < text.length; _i2++) {
          returnFlags[_i2] = skipped[_i2] ? 0 : flags[maxCheckIndex][k++];
        }return returnFlags;
      }

      /**
       * Counts the number of flags on the provided array that are zero.
       * @param {number[]} flags
       * @returns {number}
       */

    }, {
      key: "countFlagsOk",
      value: function countFlagsOk(flags) {
        return flags.reduce(function (n, v) {
          return v == 0 ? ++n : n;
        }, 0);
      }

      /**
       * Compares two segments of text.
       * This function should make recursive calls.
       * @param {string} src - Text to be compared
       * @param {number} ls - Offset in `src` where to start the comparison
       * @param {string} ok - Text to match against.
       * @param {number} lok - Offset in `ok` where to start the comparison.
       * @param {number[]} attr - Array of integers that will be filled with information about the
       * validity or error of each character in `src`.
       * @param {boolean} iterate - When `true`, the segment will be iterated looking for other
       * coincident fragments.
       * @returns {boolean} - `true` if the comparison was valid.
       */

    }, {
      key: "compareSegment",
      value: function compareSegment(src, ls, ok, lok, attr, iterate) {
        var is = 0,
            iok = 0,
            lastIs = 0,
            lastiok = true,
            result = true,
            chs = '',
            chok = '';

        if (ls === 0 || lok === 0 || src === null || ok === null) return false;

        for (; is < ls; is++, iok++) {
          chs = src.charAt(is);
          lastIs = is;
          if (iok >= 0 && iok < lok) chok = ok.charAt(iok);else chok = 0;
          if (this.collator.compare(chs, chok) === 0) {
            attr[is] = 0;
            lastiok = true;
          } else {
            result = false;
            attr[is] = 1;
            if (!iterate && lastiok && chok !== 0 && this.checkSteps > 0 && this.checkScope > 0) {
              var lbloc = 2 * this.checkSteps + 1,
                  itcoinc = [];
              var i = 0,
                  j = 0;
              for (; j < lbloc; j++) {
                itcoinc[j] = 0;
                i = iok + Math.floor((j + 1) / 2) * ((j & 1) !== 0 ? 1 : -1);
                if (i >= lok) continue;
                var is2 = i < 0 ? is - i : is;
                if (is2 >= ls) continue;
                var ls2 = Math.min(ls - is2, this.checkScope),
                    iok2 = i < 0 ? 0 : i,
                    lok2 = Math.min(lok - iok2, this.checkScope),
                    flags2 = Array(src.length - is2).fill(0),
                    result2 = this.compareSegment(src.substring(is2), ls2, ok.substring(iok2), lok2, flags2, true);
                itcoinc[j] = this.countFlagsOk(flags2);
                if (result2) break;
              }
              if (j === lbloc) {
                var jmax = this.checkSteps;
                for (j = 0; j < lbloc; j++) {
                  if (itcoinc[j] > itcoinc[jmax]) jmax = j;
                }i = iok + Math.floor((jmax + 1) / 2) * ((jmax & 1) !== 0 ? 1 : -1);
              }
              iok = i;
              lastiok = false;
            }
          }
        }
        if (iok !== lok) {
          result = false;
          attr[lastIs] = 1;
        }
        return result;
      }
    }]);

    return ComplexEvaluator;
  }(BasicEvaluator);

  Object.assign(ComplexEvaluator.prototype, {
    /**
     * Whether to detail or not the location of errors found on the analyzed text.
     * @name ComplexEvaluator#detail
     * @type {boolean} */
    detail: true,
    /**
     * Number of times to repeat the evaluation process if an error is found, eliminating in each
     * cycle the extra characters that caused the error.
     * @name ComplexEvaluator#checkSteps
     * @type {number} */
    checkSteps: 3,
    /**
     * When an eror is detected in the analyzed expression, this variable indicates the number of
     * characters the checking pointer will be moved forward and back looking for a coincident
     * expression.
     *
     * For example, comparing the answer "_one lardzy dog_" with the correct answer "_one lazy dog_"
     * will detect an error at position 6 (an "r" instead of "z"). If `checkSteps` is set to 2 or
     * greater, the "_zy dog_" expression at position 8 will be found and evaluated as valid, while
     * a value of 1 or less will not found any coincident expression beyond the error position, thus
     * evaluating all the remaining sentence as erroneous.
     * @name ComplexEvaluator#checkScope
     * @type {number} */
    checkScope: 6
  });

  // List of known Evaluator classes
  Evaluator.CLASSES = {
    '@BasicEvaluator': BasicEvaluator,
    '@ComplexEvaluator': ComplexEvaluator
  };

  return Evaluator;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 492 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : activities/text/TextActivityDocument.js
 *  Created : 14/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2), __webpack_require__(3), __webpack_require__(73), __webpack_require__(97), __webpack_require__(138)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Utils, AWT, ActiveBoxContent, MediaContent, ActiveBagContent) {

  /**
   * This is the HTML DOM element used in text activities like {@link FillInBlanks},
   * {@link IdentifyText}, {@link OrderText} and {@link Complete}. It contains the main document of
   * the activity, usually with some elements marked as "targets". In {@link FillInBlanks}, this
   * targets are encapsulated in {@link TextTarget} objects.
   * @exports TextActivityDocument
   * @class
   */
  var TextActivityDocument = function () {
    /**
     * TextActivityDocument constructor
     */
    function TextActivityDocument() {
      _classCallCheck(this, TextActivityDocument);

      // Make a deep clone of the default style
      this.style = { 'default': $.extend(true, {}, TextActivityDocument.DEFAULT_DOC_STYLE) };
      this.p = [];
      //this.tmb=new TargetMarkerBag();
      this.boxesContent = new ActiveBagContent();
      this.popupsContent = new ActiveBagContent();
    }

    /**
     * Loads the document settings from a specific JQuery XML element
     * @param {external:jQuery} $xml - The XML element to parse
     * @param {MediaBag} mediaBag - The media bag used to load images and media content
     */


    _createClass(TextActivityDocument, [{
      key: "setProperties",
      value: function setProperties($xml, mediaBag) {
        var _this = this;

        // Read named styles
        // Sort styles according to its "base" dependencies
        var styles = $xml.children('style').toArray().sort(function (a, b) {
          var aName = a.attributes.name.value,
              aBase = a.attributes.base ? a.attributes.base.value : null;
          var bName = b.attributes.name.value,
              bBase = b.attributes.base ? b.attributes.base.value : null;
          // Put 'default' always first, then each style below their base (if any)
          return aName === 'default' ? -1 : bName === 'default' ? 1 : aBase === bName ? 1 : bBase === aName ? -1 : !aBase ? -1 : !bBase ? 1 : 0;
        });
        // Process the ordered list of styles
        styles.forEach(function (style) {
          var attr = _this.readDocAttributes($(style));
          // Grant always that basic attributes are defined
          _this.style[attr.name] = attr.name === 'default' ? $.extend(true, _this.style.default, attr) : attr;
          //this.style[attr.name] = attr.name === 'default' ? Object.assign(this.style.default, attr) : attr
        });

        // Read paragraphs
        $xml.find('section > p').each(function (_n, par) {

          var p = { elements: []

            // Read paragraph attributes
          };Utils.attrForEach(par.attributes, function (name, value) {
            switch (name) {
              case 'style':
                p[name] = value;
                break;
              case 'bidiLevel':
              case 'Alignment':
                p[name] = Number(value);
                break;
            }
          });

          // Read paragraph objects
          $(par).children().each(function (_n, child) {
            var obj = void 0;
            var $child = $(child);
            switch (child.nodeName) {

              case 'cell':
                obj = new ActiveBoxContent().setProperties($child, mediaBag);
                break;

              case 'text':
                obj = { text: child.textContent.replace(/\t/g, '&#9;') };
                var attr = _this.readDocAttributes($child);
                if (!$.isEmptyObject(attr)) {
                  obj.attr = attr;
                }
                break;

              case 'target':
                obj = new TextTarget(_this, child.textContent.replace(/\t/g, '&#9;'));
                obj.setProperties($child, mediaBag);
                _this.numTargets++;
                break;

              default:
                Utils.log('error', "Unknown object in activity document: \"" + child.nodeName + "\"");
            }
            if (obj) {
              obj.objectType = child.nodeName;
              p.elements.push(obj);
            }
          });

          _this.p.push(p);
        });
        return this;
      }

      /**
       * Reads sets of text attributes, sometimes in form of named styles
       * @param {external:jQuery} $xml - The XML element to parse
       * @returns {object}
       */

    }, {
      key: "readDocAttributes",
      value: function readDocAttributes($xml) {
        var _this2 = this;

        var attr = {},
            css = {};
        Utils.attrForEach($xml.get(0).attributes, function (name, val) {
          switch (name) {
            case 'background':
              val = Utils.checkColor(val, 'white');
              attr[name] = val;
              css['background-color'] = val;
              break;
            case 'foreground':
              val = Utils.checkColor(val, 'black');
              attr[name] = val;
              css['color'] = val;
              break;
            case 'family':
              css['font-family'] = val;
            /* falls through */
            case 'name':
            case 'style':
              // Attributes specific to named styles:
              attr[name] = val;
              break;
            case 'base':
              attr[name] = val;
              // If base style exists, merge it with current settings
              if (_this2.style[val]) {
                //attr = Object.apply({}, this.style[val], attr)
                attr = $.extend(true, {}, _this2.style[val], attr);
                if (_this2.style[val].css)
                  //css = Object.apply({}, this.style[val].css, css)
                  css = $.extend({}, _this2.style[val].css, css);
              }
              break;
            case 'bold':
              val = Utils.getBoolean(val);
              attr[name] = val;
              css['font-weight'] = val ? 'bold' : 'normal';
              break;
            case 'italic':
              val = Utils.getBoolean(val);
              attr[name] = val;
              css['font-style'] = val ? 'italic' : 'normal';
              break;
            case 'target':
              attr[name] = Utils.getBoolean(val);
              break;
            case 'size':
              attr[name] = Number(val);
              css['font-size'] = val + "px";
              break;
            case 'tabWidth':
              // `tab-size` CSS attribute is only set when the document has a specific `tabWidth`
              // setting. It must be accompanied of `white-space:pre` to successfully work.
              _this2.tabSpc = val;
              css['tab-size'] = _this2.tabSpc;
              css['white-space'] = 'pre-wrap';
              break;
            default:
              Utils.log('warn', "Unknown text attribute: \"" + name + "\" = \"" + val + "\"");
              attr[name] = val;
              break;
          }
        });

        if (!$.isEmptyObject(css)) attr['css'] = css;

        return attr;
      }

      /**
       * Gets the full text of this document in raw format
       * @returns {String} - The text of the document.
       */

    }, {
      key: "getRawText",
      value: function getRawText() {
        var $html = $('<div/>');
        // Process paragraphs
        this.p.forEach(function (p) {
          // Creates a new DOM paragraph
          var $p = $('<p/>');
          var empty = true;
          // Process the paragraph elements
          p.elements.forEach(function (element) {
            switch (element.objectType) {
              case 'text':
              case 'target':
                $p.append(element.text);
                break;
              case 'cell':
                // cells are not considered raw text of the document
                break;
              default:
                break;
            }
            empty = false;
          });
          if (empty) {
            // Don't leave paragraphs empty
            $p.html('&nbsp;');
          }
          // Adds the paragraph to the DOM element
          $html.append($p);
        });
        return $html.text().trim();
      }

      /**
       * Gets a `style` object filled with default attributes plus attributes present in the
       * requested style name.
       * @param {string} name - The requested style name
       * @returns {Object} - The result of combining `default` with the requested style
       */

    }, {
      key: "getFullStyle",
      value: function getFullStyle(name) {
        var st = $.extend(true, {}, this.style.default);
        return $.extend(true, st, this.style[name] ? this.style[name] : {});
        //return Object.assign({}, this.style.default, this.style[name] ? this.style[name] : {})
      }
    }]);

    return TextActivityDocument;
  }();

  Object.assign(TextActivityDocument.prototype, {
    /**
     * Number of blank spaces between tabulators.
     * @name TextActivityDocument#tabSpc
     * @type {number} */
    tabSpc: 12,
    /**
     * Index of the last {@link ActiveBox} activated.
     * @name TextActivityDocument#lastBoxId
     * @type {number} */
    lastBoxId: 0,
    /**
     * A bag of {@link TargetMarker} objects
     * @name TextActivityDocument#tmb
     * @type {object} */
    tmb: null,
    /**
     * Number of targets
     * @name TextActivityDocument#numTargets
     * @type {number} */
    numTargets: 0,
    /**
     * Type of targets used in this activity. Possible values are: `TT_FREE`, `TT_CHAR`, `TT_WORD`
     * and `TT_PARAGRAPH`.
     * @name TextActivityDocument#targetType
     * @type {string} */
    targetType: 'TT_FREE',
    /**
     * Bag with the content of the boxes embedded in the document.
     * @name TextActivityDocument#boxesContent
     * @type {ActiveBagContent} */
    boxesContent: null,
    /**
     * Bag with the content of the pop-ups used by this activity.
     * @name TextActivityDocument#popupsContent
     * @type {ActiveBagContent} */
    popupsContent: null,
    /**
     * Collection of named styles of the document
     * @name TextActivityDocument#style
     * @type {object} */
    style: null,
    /**
     * The main document, represented as a collection of DOM objects
     * @name TextActivityDocument#p
     * @type {object} */
    p: null
  });

  /**
   * Default style for new documents
   * @type {object} */
  TextActivityDocument.DEFAULT_DOC_STYLE = {
    background: 'white',
    foreground: 'black',
    family: 'Arial',
    size: 17,
    css: {
      'font-family': 'Arial,Helvetica,sans-serif',
      'font-size': '17px',
      'background-color': 'white',
      color: 'black'
    }

    /**
     * This class contains the properties and methods of the document elements that are the real
     * targets of user actions in text activities.
     * @class
     */
  };
  var TextTarget = function () {
    /**
     * TextTarget constructor
     * @param {TextActivityDocument} doc - The document to which this target belongs.
     * @param {string} text - Main text of this target.
     */
    function TextTarget(doc, text) {
      _classCallCheck(this, TextTarget);

      this.doc = doc;
      this.text = text;
      this.numIniChars = text.length;
      this.answers = [text];
      this.maxLenResp = this.numIniChars;
    }

    /**
     * Resets the TextTarget status
     * @param {string=} status - The `targetStatus` to be established. Default is `NOT_EDITED`
     */


    _createClass(TextTarget, [{
      key: "reset",
      value: function reset(status) {
        this.targetStatus = status ? status : 'NOT_EDITED';
        this.flagModified = false;
      }

      /**
       * Loads the text target settings from a specific JQuery XML element
       * @param {external:jQuery} $xml - The XML element to parse
       * @param {MediaBag} mediaBag - The media bag used to load images and media content
       */

    }, {
      key: "setProperties",
      value: function setProperties($xml, mediaBag) {
        var _this3 = this;

        var firstAnswer = true;
        // Read specific nodes
        $xml.children().each(function (_n, child) {
          var $node = $(child);
          switch (child.nodeName) {
            case 'answer':
              if (firstAnswer) {
                firstAnswer = false;
                _this3.answers = [];
              }
              if (_this3.answers === null) _this3.answers = [];
              _this3.answers.push(child.textContent);
              break;

            case 'optionList':
              $node.children('option').each(function (_n, opChild) {
                _this3.isList = true;
                if (_this3.options === null) _this3.options = [];
                _this3.options.push(opChild.textContent);
              });
              break;

            case 'response':
              _this3.iniChar = Utils.getVal($node.attr('fill'), _this3.iniChar).charAt(0);
              _this3.numIniChars = Utils.getNumber($node.attr('length'), _this3.numIniChars);
              _this3.maxLenResp = Utils.getNumber($node.attr('maxLength'), _this3.maxLenResp);
              _this3.iniText = Utils.getVal($node.attr('show'), _this3.iniText);
              break;

            case 'info':
              _this3.infoMode = Utils.getVal($node.attr('mode'), 'always');
              _this3.popupDelay = Utils.getNumber($node.attr('delay'), _this3.popupDelay);
              _this3.popupMaxTime = Utils.getNumber($node.attr('maxTime'), _this3.popupMaxTime);
              $node.children('media').each(function (_n, media) {
                _this3.onlyPlay = true;
                _this3.popupContent = new ActiveBoxContent();
                _this3.popupContent.mediaContent = new MediaContent().setProperties($(media));
              });
              if (!_this3.popupContent) {
                $node.children('cell').each(function (_n, cell) {
                  _this3.popupContent = new ActiveBoxContent().setProperties($(cell), mediaBag);
                });
              }
              break;

            case 'text':
              _this3.text = child.textContent.replace(/\t/g, '&#9;');
              var attr = _this3.doc.readDocAttributes($(child));
              if (!$.isEmptyObject(attr)) _this3.attr = attr;
              break;

            default:
              break;
          }
        });
      }

      /**
       * Gets a string with all valid answers of this TextTarget. Useful for reporting users' activity.
       * @returns {string}
       */

    }, {
      key: "getAnswers",
      value: function getAnswers() {
        return this.answers ? this.answers.join('|') : '';
      }

      /**
       * Sets specific colors to the target jQuery element, based on its `targetStatus` value. Red
       * color usually means error.
       */

    }, {
      key: "checkColors",
      value: function checkColors() {
        var $element = this.$comboList || this.$span;
        if ($element) {
          var style = this.doc.style[this.targetStatus === 'WITH_ERROR' ? 'targetError' : this.targetStatus === 'HIDDEN' ? 'default' : 'target'];
          if (style && style.css) {
            $element.css(style.css);
          }
        }
      }

      /**
       * Fills the `currentText` member with the text currently hosted in $span or selected in $comboList
       * @returns {String} - The current text of this target
       */

    }, {
      key: "readCurrentText",
      value: function readCurrentText() {
        if (this.$span) this.currentText = this.$span.text();else if (this.$comboList) this.currentText = this.$comboList.val();
        return this.currentText;
      }
    }]);

    return TextTarget;
  }();

  Object.assign(TextTarget.prototype, {
    /**
     * The {@link TextActivityDocument} to which this target belongs
     * @name TextTarget#doc
     * @type {TextActivityDocument} */
    doc: null,
    /**
     * The current text displayed by this TextTarget
     * @name TextTarget#text
     * @type {string} */
    text: null,
    /**
     * A set of optional attributes for `text`
     * @name TextTarget#attr
     * @type {object} */
    attr: null,
    /**
     * `true` when the target is a drop-down list
     * @name TextTarget#isList
     * @type {boolean} */
    isList: false,
    /**
     * Number of characters initially displayed on the text field
     * @name TextTarget#numIniChars
     * @type {number} */
    numIniChars: 1,
    /**
     * Character used to fill-in the text field
     * @name TextTarget#iniChar
     * @type {string} */
    iniChar: '_',
    /**
     * Maximum length of the answer
     * @name TextTarget#maxLenResp
     * @type {number} */
    maxLenResp: 0,
    /**
     * Array of valid answers
     * @name TextTarget#answers
     * @type {string[]} */
    answers: null,
    /**
     * Set of specific options
     * @name TextTarget#options
     * @type {object} */
    options: null,
    /**
     * Text displayed by the target when the activity begins
     * @name TextTarget#iniText
     * @type {string} */
    iniText: null,
    /**
     * Type of additional information offered to the user. Possible values are: `no_info`, `always`,
     * `onError` and `onDemand`.
     * @name TextTarget#infoMode
     * @type {string} */
    infoMode: 'no_info',
    /**
     * Key that triggers the associated popup when `infoMode` is `onDemand`
     * @name TextTarget#popupKey
     * @type {string} */
    popupKey: 'F1',
    /**
     * An optional {@link ActiveBoxContent} with information about this TextTarget
     * @name TextTarget#popupContent
     * @type {ActiveBoxContent} */
    popupContent: null,
    /**
     * Time (seconds) to wait before showing the additional information
     * @name TextTarget#popupDelay
     * @type {number} */
    popupDelay: 0,
    /**
     * Maximum amount of time (seconds) that the additional information will be shown
     * @name TextTarget#popupMaxTime
     * @type {number} */
    popupMaxTime: 0,
    /**
     * When this flag is `true` and `popupContent` contains audio, no visual feedback will be
     * provided (meaning that audio will be just played)
     * @name TextTarget#onlyPlay
     * @type {boolean} */
    onlyPlay: false,
    //
    // TRANSIENT PROPERTIES
    //
    /**
     * The drop-down list associated to this target
     * @name TextTarget#$comboList
     * @type {external:jQuery} */
    $comboList: null,
    /**
     * The span element associated to this target
     * @name TextTarget#$span
     * @type {external:jQuery} */
    $span: null,
    /**
     * The paragraph element where $span is currently located
     * @name TextTarget#$p
     * @type {external:jQuery} */
    $p: null,
    /**
     * The span element containing the popup
     * @name TextTarget#$popup
     * @type {external:jQuery} */
    $popup: null,
    /**
     * Current text in the $span element
     * @name TextTarget#currentText
     * @type {string} */
    currentText: '',
    /**
     * Ordinal number of this target in the collection of targets
     * @name TextTarget#num
     * @type {number} */
    num: 0,
    /**
     * Current ordinal position of this target in the document
     * (used in {@link OrderText} activities)
     * @name TextTarget#pos
     * @type {number} */
    pos: 0,
    /**
     * Current status of the target. Valid values are: `NOT_EDITED`, `EDITED`, `SOLVED`, `WITH_ERROR` and `HIDDEN`
     * @name TextTarget#targetStatus
     * @type {string} */
    targetStatus: 'NOT_EDITED',
    /**
     * Flag to control if the initial content of this TextTarget has been modified
     * @name TextTarget#flagModified
     * @type {boolean} */
    flagModified: false,
    /**
     * Pointer to the activity panel containing this TextTarget
     * @name TextTarget#parentPane
     * @type {TextActivityBasePanel} */
    parentPane: null
  });

  TextActivityDocument.TextTarget = TextTarget;

  return TextActivityDocument;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 493 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : report/SessionReg.js
 *  Created : 17/05/2016
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2016 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2), __webpack_require__(137), __webpack_require__(494)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Utils, JClicProject, SequenceReg) {

  /**
   * This class encapsulates data of a user's working session, usually associated to a single {@link JClicProject}
   * It's main component is `sequences`, an array of {@link SequenceReg} objects.
   * @exports SessionReg
   * @class
   */
  var SessionReg = function () {
    /**
     * SessionReg constructor
     * @param {JClicProject} project - The JClicProject referenced by this session.
     * @param {string=} code - Optional code to be used by this SessionReg
     */
    function SessionReg(project, code) {
      _classCallCheck(this, SessionReg);

      this.projectName = project.name;
      this.code = code || project.code;
      this.sequences = [];
      this.actNames = [];
      this.started = new Date();
      this.info = new SessionRegInfo(this);
      this.reportableActs = project.reportableActs;
    }

    /**
     * Builds a complex object with the results of all activities done during this working session
     * @param {booolean} recalcInfo - When `true`, global variables (number of sequences, score, total time...)
     * will be recalculated from the data stored in the {@link SequenceReg} objects.
     * @param {booolean} includeEmpty - When `true`, sequences without reported activities will be also included in the results
     * @returns {Object} - An object containing the full session data
     */


    _createClass(SessionReg, [{
      key: "getData",
      value: function getData(recalcInfo, includeEmpty) {
        if (recalcInfo) this.info.recalc();

        var result = {
          projectName: this.projectName,
          played: this.info.nActivities,
          ratioPlayed: Math.round(this.info.ratioPlayed * 100),
          solved: this.info.nActSolved,
          ratioSolved: Math.round(this.info.ratioSolved * 100),
          actions: this.info.nActions,
          score: this.info.tScore,
          time: Math.round(this.info.tTime / 10) / 100,
          sequences: []
        };

        this.sequences.forEach(function (s) {
          var seq = s.getData();
          if (includeEmpty || seq.activities.length > 0) result.sequences.push(seq);
        });
        return result;
      }

      /**
       * Returns the `info` element associated to this SessionReg.
       * @returns {SessionRegInfo}
       */

    }, {
      key: "getInfo",
      value: function getInfo() {
        return this.info.recalc();
      }

      /**
       * Closes this session
       */

    }, {
      key: "end",
      value: function end() {
        this.endSequence();
      }

      /**
       * This method should be called when the current working session finishes.
       */

    }, {
      key: "endSequence",
      value: function endSequence() {
        if (this.currentSequence && this.currentSequence.totalTime === 0) this.currentSequence.endSequence();
        this.currentSequence = null;
        this.info.valid = false;
      }

      /**
       * This method should be invoked when a new sequence starts
       * @param {ActivitySequenceElement} ase - The {@link ActivitySequenceElement} referenced by this sequence.
       */

    }, {
      key: "newSequence",
      value: function newSequence(ase) {
        this.endSequence();
        this.currentSequence = new SequenceReg(ase);
        this.sequences.push(this.currentSequence);
        this.info.valid = false;
      }

      /**
       * This method should be invoked when the user starts a new activity
       * @param {Activity} act - The {@link Activity} that has just started
       */

    }, {
      key: "newActivity",
      value: function newActivity(act) {
        if (this.currentSequence) {
          // Save activity name if not yet registered
          if (this.actNames.indexOf(act.name) === -1) this.actNames.push(act.name);
          this.currentSequence.newActivity(act);
          this.info.valid = false;
        }
      }

      /**
       * This method should be called when the current activity finishes. Data about user's final results
       * on the activity will then be saved.
       * @param {number} score - The final score, usually in a 0-100 scale.
       * @param {number} numActions - The total number of actions done by the user to solve the activity
       * @param {boolean} solved - `true` if the activity was finally solved, `false` otherwise.
       */

    }, {
      key: "endActivity",
      value: function endActivity(score, numActions, solved) {
        if (this.currentSequence) {
          this.currentSequence.endActivity(score, numActions, solved);
          this.info.valid = false;
        }
      }

      /**
       * Reports a new action done by the user while playing the current activity
       * @param {string} type - Type of action (`click`, `write`, `move`, `select`...)
       * @param {string}+ source - Description of the object on which the action is done.
       * @param {string}+ dest - Description of the object that acts as a target of the action (used in pairings)
       * @param {boolean} ok - `true` if the action was OK, `false`, `null` or `undefined` otherwise
       */

    }, {
      key: "newAction",
      value: function newAction(type, source, dest, ok) {
        if (this.currentSequence) {
          this.currentSequence.newAction(type, source, dest, ok);
          this.info.valid = false;
        }
      }

      /**
       * Gets the name of the current sequence
       * @returns {string}
       */

    }, {
      key: "getCurrentSequenceTag",
      value: function getCurrentSequenceTag() {
        return this.currentSequence ? this.currentSequence.name : null;
      }

      /**
       * Gets information about the current sequence
       * @returns {SequenceReg.Info}
       */

    }, {
      key: "getCurrentSequenceInfo",
      value: function getCurrentSequenceInfo() {
        return this.currentSequence ? this.currentSequence.getInfo() : null;
      }
    }]);

    return SessionReg;
  }();

  Object.assign(SessionReg.prototype, {
    /**
     * Number of activities suitable to be reported in this session
     * @name SessionReg#reportableActs
     * @type {number} */
    reportableActs: 0,
    /**
     * Array with unique names of the activities being reported in this session
     * @name SessionReg#actNames
     * @type {string[]} */
    actNames: null,
    /**
     * List of sequences done in this session
     * @name SessionReg#sequences
     * @type {SequenceReg[]} */
    sequences: null,
    /**
     * The sequence currently active
     * @name SessionReg#currentSequence
     * @type {SequenceReg} */
    currentSequence: null,
    /**
     * Starting date and time of this session
     * @name SessionReg#started
     * @type {Date} */
    started: null,
    /**
     * Name of the {@link JClicProject} associated to this session
     * @name SessionReg#projectName
     * @type {string} */
    projectName: '',
    /**
     * Current session info
     * @name SessionReg#info
     * @type {SessionRegInfo} */
    info: null,
    /**
     * Optional code to be used with this session
     * @name SessionReg#code
     * @type {string} */
    code: null
  });

  /**
   * This object stores the global results of a {@link SessionReg}
   * @class
   */

  var SessionRegInfo = function () {
    /**
     * SessionRegInfo constructor
     * @param {SessionReg} sReg - The {@link SessionReg} associated tho this `Info` object.
     */
    function SessionRegInfo(sReg) {
      _classCallCheck(this, SessionRegInfo);

      this.sReg = sReg;
    }

    /**
     * Clears all data associated with this working session
     */


    _createClass(SessionRegInfo, [{
      key: "clear",
      value: function clear() {
        this.numSequences = this.nActivities = this.nActSolved = this.nActScore = 0;
        this.ratioSolved = this.ratioPlayed = this.nActions = this.tScore = this.tTime = 0;
        this.valid = false;
      }

      /**
       * Computes the value of all global variables based on the data stored in `sequences`
       * @returns {SessionRegInfo} - This "info" object
       */

    }, {
      key: "recalc",
      value: function recalc() {
        var _this = this;

        if (!this.valid) {
          this.clear();
          this.sReg.sequences.forEach(function (sr) {
            var sri = sr.getInfo();
            if (sri.nActivities > 0) {
              _this.numSequences++;
              if (sri.nActClosed > 0) {
                _this.nActivities += sri.nActClosed;
                _this.nActions += sri.nActions;
                if (sri.nActScore > 0) {
                  _this.nActScore += sri.nActScore;
                  _this.tScore += sri.tScore * sri.nActScore;
                }
                _this.tTime += sri.tTime;
                _this.nActSolved += sri.nActSolved;
              }
            }
          });
          if (this.nActScore > 0) this.tScore = Math.round(this.tScore / this.nActScore);
          if (this.nActivities > 0) {
            this.ratioSolved = this.nActSolved / this.nActivities;
            if (this.sReg.reportableActs > 0) this.ratioPlayed = this.sReg.actNames.length / this.sReg.reportableActs;
          }
          this.valid = true;
        }
        return this;
      }
    }]);

    return SessionRegInfo;
  }();

  Object.assign(SessionRegInfo.prototype, {
    /**
     * The SessionReg linked to this Info object
     * @name SessionRegInfo#sReg
     * @type {SessionReg} */
    sReg: null,
    /**
     * When `false`, this session info needs to be recalculated
     * @name SessionRegInfo#valid
     * @type {boolean} */
    valid: false,
    /**
     * Number of sequences played
     * @name SessionRegInfo#numSequences
     * @type {number} */
    numSequences: 0,
    /**
     * Number of activities played
     * @name SessionRegInfo#nActivities
     * @type {number} */
    nActivities: 0,
    /**
     * Number of activities solved
     * @name SessionRegInfo#nActSolved
     * @type {number} */
    nActSolved: 0,
    /**
     * Number of activities with score > 0
     * @name SessionRegInfo#nActScore
     * @type {number} */
    nActScore: 0,
    /**
     * Percentage of solved activities
     * @name SessionRegInfo#ratioSolved
     * @type {number} */
    ratioSolved: 0,
    /**
     * Percentage of reportable activities played
     * @name SessionRegInfo#ratioPlayed
     * @type {number} */
    ratioPlayed: 0,
    /**
     * Number of actions done by the user while in this working session
     * @name SessionRegInfo#nActions
     * @type {number} */
    nActions: 0,
    /**
     * Sum of the scores of all the activities played
     * @name SessionRegInfo#tScore
     * @type {number} */
    tScore: 0,
    /**
     * Sum of the playing time reported by each activity (not always equals to the session's total time)
     * @name SessionRegInfo#tTime
     * @type {number} */
    tTime: 0
  });

  SessionReg.Info = SessionRegInfo;

  return SessionReg;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 494 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : report/SequenceReg.js
 *  Created : 17/05/2016
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(495)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, ActivityReg) {

  /**
   * This class stores the results of the activities related to an {@link ActivitySequenceElement}.
   * It's main component is an array of {@link ActivityReg} elements.
   * @exports SequenceReg
   * @class
   */
  var SequenceReg = function () {
    /**
     * SequenceReg constructor
     * @param {ActivitySequenceElement} ase - The {@link ActivitySequenceElement} related to this sequence.
     */
    function SequenceReg(ase) {
      _classCallCheck(this, SequenceReg);

      this.name = ase.tag;
      this.description = ase.description;
      this.activities = [];
      this.currentActivity = null;
      this.totalTime = 0;
      this.closed = false;
      this.info = new SequenceRegInfo(this);
    }

    /**
     * Builds a complex object with data about the results of the activities done in this sequence
     * @returns {Object} - The sequence results
     */


    _createClass(SequenceReg, [{
      key: "getData",
      value: function getData() {
        var result = {
          sequence: this.name,
          activities: []
        };
        this.activities.forEach(function (act) {
          return result.activities.push(act.getData());
        });
        return result;
      }

      /**
       * Returns the `info` element associated to this SequenceReg.
       * @returns {SequenceRegInfo}
       */

    }, {
      key: "getInfo",
      value: function getInfo() {
        return this.info.recalc();
      }

      /**
       * This method should be called when the current working session finishes.
       */

    }, {
      key: "endSequence",
      value: function endSequence() {
        if (this.currentActivity && this.activities.length > 0) {
          if (!this.currentActivity.closed) this.currentActivity.closeActivity();
          this.totalTime = this.currentActivity.startTime + this.currentActivity.totalTime - this.activities[0].startTime;
          this.info.valid = false;
        }
      }

      /**
       * This method should be invoked when the user starts a new activity
       * @param {Activity} act - The {@link Activity} that has just started
       */

    }, {
      key: "newActivity",
      value: function newActivity(act) {
        if (!this.closed) {
          this.currentActivity = new ActivityReg(act);
          this.activities.push(this.currentActivity);
          this.info.valid = false;
        }
      }

      /**
       * This method should be called when the current activity finishes. Data about user's final results
       * on the activity will then be saved.
       * @param {number} score - The final score, usually in a 0-100 scale.
       * @param {number} numActions - The total number of actions done by the user to solve the activity
       * @param {boolean} solved - `true` if the activity was finally solved, `false` otherwise.
       */

    }, {
      key: "endActivity",
      value: function endActivity(score, numActions, solved) {
        if (this.currentActivity) {
          this.currentActivity.endActivity(score, numActions, solved);
          this.info.valid = false;
        }
      }

      /**
       * Reports a new action done by the user while playing the current activity
       * @param {string} type - Type of action (`click`, `write`, `move`, `select`...)
       * @param {string}+ source - Description of the object on which the action is done.
       * @param {string}+ dest - Description of the object that acts as a target of the action (used in pairings)
       * @param {boolean} ok - `true` if the action was OK, `false`, `null` or `undefined` otherwise
       */

    }, {
      key: "newAction",
      value: function newAction(type, source, dest, ok) {
        if (this.currentActivity) {
          this.currentActivity.newAction(type, source, dest, ok);
          this.info.valid = false;
        }
      }
    }]);

    return SequenceReg;
  }();

  Object.assign(SequenceReg.prototype, {
    /**
     * The `tag` member of the associated {@link ActivitySequenceElement}
     * @name SequenceReg#name
     * @type {string} */
    name: '',
    /**
     * Optional description given to the {@link ActivitySequenceElement}
     * @name SequenceReg#description
     * @type {string} */
    description: '',
    /**
     * Collection of all the {@link ActivityReg} elements done during this sequence.
     * @name SequenceReg#activities
     * @type {ActivityReg[]} */
    activities: [],
    /**
     * Registry linked to the {@link Activity} that is currently running
     * @name SequenceReg#currentActivity
     * @type {ActivityReg} */
    currentActivity: null,
    /**
     * Total time spent on the activities of this sequence
     * @name SequenceReg#totalTime
     * @type {number} */
    totalTime: 0,
    /**
     * Flag indicating if the sequence is closed or already available for more activities
     * @name SequenceReg#closed
     * @type {boolean} */
    closed: false,
    /**
     * Object with global information associated to this sequence
     * @name SequenceReg#info
     * @type {SequenceRegInfo} */
    info: null
  });

  /**
   * This object stores the global results of a {@link SequenceReg}
   * @class
   */

  var SequenceRegInfo = function () {
    /**
     * SequenceRegInfo constructor
     * @param {SequenceReg} sqReg - The {@link SequenceReg} associated tho this `Info` object.
     */
    function SequenceRegInfo(sqReg) {
      _classCallCheck(this, SequenceRegInfo);

      this.sqReg = sqReg;
    }

    /**
     * Clears all global data associated with this sequence
     */


    _createClass(SequenceRegInfo, [{
      key: "clear",
      value: function clear() {
        this.nActivities = this.nActClosed = this.nActSolved = this.nActScore = 0;
        this.ratioSolved = this.nActions = this.tScore = this.tTime = 0;
        this.valid = false;
      }

      /**
       * Computes the value of all global variables based on the data stored in `activities`
       * @returns {SequenceRegInfo} - This "info" object
       */

    }, {
      key: "recalc",
      value: function recalc() {
        var _this = this;

        if (!this.valid) {
          this.clear();
          this.nActivities = this.sqReg.activities.length;
          if (this.nActivities > 0) {
            this.sqReg.activities.forEach(function (ar) {
              if (ar.closed) {
                _this.nActClosed++;
                _this.tTime += ar.totalTime;
                _this.nActions += ar.numActions;
                if (ar.solved) _this.nActSolved++;
                var r = ar.getPrecision();
                if (r >= 0) {
                  _this.tScore += r;
                  _this.nActScore++;
                }
              }
            });
            if (this.nActClosed > 0) this.ratioSolved = this.nActSolved / this.nActClosed;
            if (this.nActScore > 0) this.tScore = Math.round(this.tScore / this.nActScore);
          }
          this.valid = true;
        }
        return this;
      }
    }]);

    return SequenceRegInfo;
  }();

  Object.assign(SequenceRegInfo.prototype, {
    /**
     * The {@link SequenceReg} associated to this "info" object
     * @name SequenceRegInfo#sqReg
     * @type {SequenceReg} */
    sqReg: null,
    /**
     * When `false`, data must be recalculated
     * @name SequenceRegInfo#valid
     * @type {boolean} */
    valid: false,
    /**
     * Number of activities played in this sequence
     * @name SequenceRegInfo#nActivities
     * @type {number} */
    nActivities: 0,
    /**
     * Number of activities already closed
     * @name SequenceRegInfo#nActClosed
     * @type {number} */
    nActClosed: 0,
    /**
     * Number of activities solved
     * @name SequenceRegInfo#nActSolved
     * @type {number} */
    nActSolved: 0,
    /**
     * Number of activities with score > 0
     * @name SequenceRegInfo#nActScore
     * @type {number} */
    nActScore: 0,
    /**
     * Percentage of solved activities
     * @name SequenceRegInfo#ratioSolved
     * @type {number} */
    ratioSolved: 0,
    /**
     * Number of actions done by the user while in this sequence
     * @name SequenceRegInfo#nActions
     * @type {number} */
    nActions: 0,
    /**
     * Sum of the scores of all the activities played
     * @name SequenceRegInfo#tScore
     * @type {number} */
    tScore: 0,
    /**
     * Sum of the playing time reported by each activity (not always equals to the sequence's total time)
     * @name SequenceRegInfo#tTime
     * @type {number} */
    tTime: 0
  });

  SequenceReg.Info = SequenceRegInfo;

  return SequenceReg;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 495 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : report/ActivityReg.js
 *  Created : 17/05/2016
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2), __webpack_require__(496)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Utils, ActionReg) {
  /**
   * This class stores miscellaneous data obtained by the current user playing an {@link Activity}.
   * @exports ActivityReg
   * @class
   */
  var ActivityReg = function () {
    /**
     * ActivityReg constructor
     * @param {Activity} act - The {@link Activity} referenced by this object.
     */
    function ActivityReg(act) {
      _classCallCheck(this, ActivityReg);

      this.name = act.name;
      this.code = act.code;
      this.actions = [];
      this.startTime = new Date().valueOf();
      this.minActions = act.getMinNumActions();
      this.reportActions = act.reportActions;
    }

    /**
     * Provides the data associated with the current activity in an XML format suitable for a
     * {@link http://clic.xtec.cat/en/jclic/reports/|JClic Reports Server}.
     * @returns {external:jQuery}
     */


    _createClass(ActivityReg, [{
      key: "$getXML",
      value: function $getXML() {
        var attr = {
          start: this.startTime,
          time: this.totalTime,
          solved: this.solved,
          score: this.score,
          minActions: this.minActions,
          actions: this.numActions
        };
        if (this.name) attr.name = this.name;
        if (this.code) attr.code = this.code;
        if (!this.closed) attr.closed = false;
        if (this.reportActions) attr.reportActions = true;

        var $result = $('<activity/>', attr);
        this.actions.forEach(function (ac) {
          $result.append(ac.$getXML());
        });
        return $result;
      }

      /**
       * Builds an object with relevant data about the results obtained by the current student in this activity
       * @returns {Object} - The results of this activity
       */

    }, {
      key: "getData",
      value: function getData() {
        var result = {
          name: this.name,
          time: Math.round(this.totalTime / 10) / 100,
          solved: this.solved,
          score: this.score,
          minActions: this.minActions,
          actions: this.numActions,
          precision: this.getPrecision(),
          closed: this.closed
        };
        if (this.code) result.code = this.code;
        return result;
      }

      /**
       * Fills this ActivityReg with data provided in XML format
       * @param {external:jQuery} $xml -The XML element to be processed, already wrapped as jQuery object
       */

    }, {
      key: "setProperties",
      value: function setProperties($xml) {
        var _this = this;

        Utils.attrForEach($xml.get(0).attributes, function (name, value) {
          switch (name) {
            case 'name':
            case 'code':
              _this[name] = value;
              break;
            case 'start':
            case 'time':
            case 'score':
            case 'minActions':
            case 'actions':
              _this[name] = Number(value);
              break;
            case 'solved':
            case 'closed':
            case 'reportActions':
              _this[name] = Utils.getBoolean(value, false);
              break;
          }
        });
        $xml.children('action').each(function (_n, child) {
          var action = new ActionReg();
          action.setProperties($(child));
          _this.actions.push(action);
        });
      }

      /**
       * Reports a new action done by the user while playing the current activity
       * @param {string} type - Type of action (`click`, `write`, `move`, `select`...)
       * @param {string}+ source - Description of the object on which the action is done.
       * @param {string}+ dest - Description of the object that acts as a target of the action (used in pairings)
       * @param {boolean} ok - `true` if the action was OK, `false`, `null` or `undefined` otherwise
       */

    }, {
      key: "newAction",
      value: function newAction(type, source, dest, ok) {
        if (!this.closed) {
          this.lastAction = new ActionReg(type, source, dest, ok);
          this.actions.push(this.lastAction);
        }
      }

      /**
       * Retrieves a specific {@link ActionReg} element from `actions`
       * @param {number} index - The nth action to be retrieved
       * @returns {ActionReg}
       */

    }, {
      key: "getActionReg",
      value: function getActionReg(index) {
        return index >= this.actions.length ? null : this.actions[index];
      }

      /**
       * Closes the current activity, adjusting total time if needed
       */

    }, {
      key: "closeActivity",
      value: function closeActivity() {
        if (!this.closed) {
          if (this.lastAction) this.totalTime = this.lastAction.time - this.startTime;else this.totalTime = new Date().valueOf() - this.startTime;
          this.closed = true;
        }
      }

      /**
       * calculates the final score obtained by the user in this activity.
       * The algorithm used takes in account the minimal number of actions needed, the actions
       * really done by the user, and if the activity was finally solved or not.
       * @returns {number}
       */

    }, {
      key: "getPrecision",
      value: function getPrecision() {
        var result = 0;
        if (this.closed && this.minActions > 0 && this.numActions > 0) {
          if (this.solved) {
            if (this.numActions < this.minActions) result = 100;else result = Math.round(this.minActions * 100 / this.numActions);
          } else result = Math.round(100 * (this.score * this.score) / (this.minActions * this.numActions));
        }
        return result;
      }

      /**
       * This method should be called when the current activity finishes. Data about user's final results
       * on the activity will then be saved.
       * @param {number} score - The final score, usually in a 0-100 scale.
       * @param {number} numActions - The total number of actions done by the user to solve the activity
       * @param {boolean} solved - `true` if the activity was finally solved, `false` otherwise.
       */

    }, {
      key: "endActivity",
      value: function endActivity(score, numActions, solved) {
        if (!this.closed) {
          this.solved = solved;
          this.numActions = numActions;
          this.score = score;
          this.closeActivity();
        }
      }
    }]);

    return ActivityReg;
  }();

  Object.assign(ActivityReg.prototype, {
    /**
     * Name of the associated activity
     * @name ActivityReg#name
     * @type {string} */
    name: '',
    /**
     * Optional code assigned to this activity, used for later filtering
     * @name ActivityReg#code
     * @type {string} */
    code: '',
    /**
     * Timestamp when the user starts playing the activity
     * @name ActivityReg#startTime
     * @type {number} */
    startTime: 0,
    /**
     * Total time spent by the user in the activity, measured in milliseconds
     * @name ActivityReg#totalTime
     * @type {number} */
    totalTime: 0,
    /**
     * Collection of actions done by the user while playing the activity
     * @name ActivityReg#actions
     * @type {ActionReg[]} */
    actions: [],
    /**
     * `true` only when the user has finished and solved the activity
     * @name ActivityReg#solved
     * @type {boolean} */
    solved: false,
    /**
     * Last {@link ActionReg} performed by the user in this activity
     * @name ActivityReg#lastAction
     * @type {ActionReg} */
    lastAction: null,
    /**
     * Final score obtained by the current user in this activity
     * @name ActivityReg#score
     * @type {number} */
    score: 0,
    /**
     * Minimum number of actions needed to solve the activity
     * @name ActivityReg#minActions
     * @type {number} */
    minActions: 0,
    /**
     * `true` when the activity has finished, `false` for the activity that is currently playing
     * @name ActivityReg#closed
     * @type {boolean} */
    closed: false,
    /**
     * `true` when this type of activity should record specific actions done by the users
     * @name ActivityReg#reportActions
     * @type {boolean} */
    reportActions: false,
    /**
     * Number of actions done by the user playing this activity
     * @name ActivityReg#numActions
     * @type {number} */
    numActions: 0
  });

  return ActivityReg;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 496 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : report/ActionReg.js
 *  Created : 17/05/2016
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Utils) {

  /**
   * This class stores information about one specific action done by the current user while playing
   * an activity.
   *
   * @exports ActionReg
   * @class
   */
  var ActionReg = function () {
    /**
     * ActionReg constructor
     * @param {string} type - Type of action (`click`, `write`, `move`, `select`...)
     * @param {string}+ source - Description of the object on which the action is done.
     * @param {string}+ dest - Description of the object that acts as a target of the action (used in pairings)
     * @param {boolean} ok - `true` if the action was OK, `false`, `null` or `undefined` otherwise
     */
    function ActionReg(type, source, dest, ok) {
      _classCallCheck(this, ActionReg);

      this.type = type;
      this.source = source || null;
      this.dest = dest || null;
      this.ok = ok || false;
      this.time = new Date().valueOf();
    }

    /**
     * Provides the data associated with this action in XML format suitable for a
     * {@link http://clic.xtec.cat/en/jclic/reports/|JClic Reports Server}.
     * @returns {external:jQuery}
     */


    _createClass(ActionReg, [{
      key: "$getXML",
      value: function $getXML() {
        var attr = { ok: this.ok, time: this.time };
        if (this.type) attr.type = this.type;
        if (this.source) attr.source = this.source;
        if (this.dest) attr.dest = this.dest;
        return $('<action/>', attr);
      }

      /**
       * Fills this ActionReg with data provided in XML format
       * @param {external:jQuery} $xml - The XML element to be processed, already wrapped as jQuery object
       */

    }, {
      key: "setProperties",
      value: function setProperties($xml) {
        var _this = this;

        Utils.attrForEach($xml.get(0).attributes, function (name, value) {
          switch (name) {
            case 'type':
            case 'source':
            case 'dest':
              _this[name] = value;
              break;
            case 'time':
              _this[name] = Number(value);
              break;
            case 'ok':
              _this[name] = Utils.getBoolean(value, false);
              break;
          }
        });
      }
    }]);

    return ActionReg;
  }();

  Object.assign(ActionReg.prototype, {
    /**
     * The type of action (`click`, `write`, `move`, `select`...)
     * @name ActionReg#type
     * @type {string} */
    type: 'unknown',
    /**
     * Description of the object on which the action was done
     * @name ActionReg#source
     * @type {string} */
    source: null,
    /**
     * Description of the object that has acted as a target of the action (used in pairings)
     * @name ActionReg#dest
     * @type {string} */
    dest: null,
    /**
     * Time stamp taken when the action was done
     * @name ActionReg#time
     * @type {number} */
    time: 0,
    /**
     * `true` if the action was OK
     * @name ActionReg#isOk
     * @type {boolean} */
    isOk: false
  });

  return ActionReg;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 497 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : report/Encryption.js
 *  Created : 18/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {

  /**
   *
   * Utilities to encrypt and decrypt strings using simple methods, just to avoid write
   * passwords in plain text in data and configuration files. Do not use it as a
   * secure cryptographic system!
   *
   * Based on {@link https://github.com/projectestac/jclic/blob/master/src/utilities/edu/xtec/util/Encryption.java Encryption}
   * utilities, created by Albert Llastarri for {@link https://github.com/projectestac/jclic JClic}.
   *
   * IMPORTANT: This is a shortened version of Encryption with only the methods needed to decrypt
   * stored passwords. Full version is on file `src/misc/encryption/Encryption.js`
   *
   * @exports Encryption
   * @class
   * @abstract
   */
  var Encryption = function () {
    function Encryption() {
      _classCallCheck(this, Encryption);
    }

    _createClass(Encryption, null, [{
      key: 'Decrypt',

      /**
       * Decrypts the given code
       * @param {string} txt - Code to be decrypted
       * @returns {string}
       */
      value: function Decrypt(txt) {
        if (txt === null || txt.length === 0) return null;
        var s = Encryption.decodify(txt);
        return s === Encryption.BLANK ? '' : s;
      }

      /**
       * @param {string} cA (was char[])
       * @param {integer} fromIndex
       * @returns {string} (was char)
       */

    }, {
      key: 'hexCharArrayToChar',
      value: function hexCharArrayToChar(cA, fromIndex) {
        var n = 0;
        for (var i = 0; i <= 3; i++) {
          var j = Number.parseInt(cA[fromIndex + i], 16);
          if (isNaN(j)) throw 'Invalid expression!';else n = n * 16 + j;
        }
        return String.fromCharCode(n);
      }

      /**
       * @param {string} cA - (was char[])
       * @param {number} fromIndex
       * @returns {number}
       */

    }, {
      key: 'hexCharArrayToInt',
      value: function hexCharArrayToInt(cA, fromIndex) {
        var n = 0;
        for (var i = 0; i <= 1; i++) {
          var j = Number.parseInt(cA[fromIndex + i], 16);
          if (isNaN(j)) throw 'Invalid expression!';else n = n * 16 + j;
        }
        return n;
      }

      /**
       * @param {string} cA - (was char[])
       * @returns {string}
       */

    }, {
      key: 'decodifyZerosField',
      value: function decodifyZerosField(cA) {
        var sb = '',
            num = Number.parseInt(cA[0], 32),
            k = 0,
            i = 0;

        for (i = 0; num !== 0; i++) {
          while (num > 0) {
            sb = sb + cA[i * 3 + 1] + cA[i * 3 + 2];
            num--;
            k++;
          }
          if (cA.length > i * 3 + 3) num = Number.parseInt(cA[i * 3 + 3], 32);else num = 0;
        }
        for (var j = i * 3 + 1; j < cA.length; j++) {
          sb = sb + cA[j];
        }return Number.parseInt(k, 32) + sb;
      }

      /**
       * @param {string} cA - (was char[])
       * @returns {string} (was StringBuilder)
       */

    }, {
      key: 'decompressZeros',
      value: function decompressZeros(cA) {
        cA = Encryption.decodifyZerosField(cA);
        var numBytesZeros = Number.parseInt(cA[0], 32),
            iniNoZeros = numBytesZeros * 2 + 1,
            bFi = false,
            sb = '';

        for (var i = 0; i < numBytesZeros && !bFi; i++) {
          var zeros = Encryption.hexCharArrayToInt(cA, 1 + i * 2);
          var s = zeros.toString(2);
          while (s.length < 8) {
            s = '0' + s;
          }for (var j = 0; j <= 7 && !bFi; j++) {
            if (s[j] === '1') sb = sb + '0';else if (iniNoZeros < cA.length) sb = sb + cA[iniNoZeros++];else bFi = true;
          }
        }
        return sb;
      }

      /**
       * @param {string} sb1 - (was StringBuilder)
       * @returns {string}
       */

    }, {
      key: 'decodifyFromHex',
      value: function decodifyFromHex(sb1) {
        var sb = '',
            j = 0;
        for (var i = 0; j < sb1.length; i++) {
          var c = Encryption.hexCharArrayToChar(sb1, j);
          sb = sb + c;
          j += 4;
        }
        return sb;
      }

      /**
       * @param {string} s
       * @returns {string} (was char[])
       */

    }, {
      key: 'unchangeOrder',
      value: function unchangeOrder(s) {
        var m = 0,
            n = s.length - 1;
        var cA = [];
        for (var p = 0; p < s.length; p++) {
          cA[p] = '';
        }for (var i = 0; i < s.length; i++) {
          if (i % 2 === 0) cA[i] = s[m++];else cA[i] = s[n--];
        }return cA.join('');
      }

      /**
       * @param {string} word
       * @returns {string}
       */

    }, {
      key: 'codify',
      value: function codify(word) {
        if (word.length > 24) throw 'Password is too large!';
        return Encryption.changeOrder(Encryption.compressZeros(Encryption.codifyToHexWord(word)));
      }

      /**
       * @param {string} word
       * @returns {string}
       */

    }, {
      key: 'decodify',
      value: function decodify(word) {
        try {
          return Encryption.decodifyFromHex(Encryption.decompressZeros(Encryption.unchangeOrder(word)));
        } catch (e) {
          //The supplied word was not codified using this system
          return '';
        }
      }
    }]);

    return Encryption;
  }();

  /**
  * Default bank password
  * @type {string}
  */


  Encryption.BLANK = '___blank___##';

  return Encryption;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 498 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : report/SCORM.js
 *  Created : 18/07/2016
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Utils) {

  /**
   * This class detects if JClic.js is running in an SCORM environment and, if true,
   * exposes the methods needed to notify the results of activities.
   * Both SCORM 1.2 and 2004 are supported.
   * @exports SCORM
   * @class
   */
  var SCORM = function () {
    /**
     * SCORM constructor
     * @param {object} API - The global SCORM API object
     * @param {Reporter} reporter - The {@link Reporter} associated to this SCORM object
     */
    function SCORM(API, reporter) {
      _classCallCheck(this, SCORM);

      this.API = API;
      // Check if 'API' has a function named 'Initialized'
      if (typeof API.Initialize === 'function') this.is2004 = true;else {
        // SCORM 1.2
        this.prefix = 'LMS';
        this.core = 'cmi.core.';
      }
      this.reporter = reporter;
    }

    /**
     * Recursive function used to find the SCORM "API" object
     * @param {object} win - The 'window' object to scan for global SCORM API objects
     * @param {number} tries - Recursive attempts currently achieved
     * @returns {object} - The global SCORM API object, or `null` if not found
     */


    _createClass(SCORM, [{
      key: "initialize",


      /**
       * Initializes communication with the SCORM API
       * @returns {Boolean}
       */
      value: function initialize() {
        var _this = this;

        var result = false;
        try {
          result = this.API[this.prefix + 'Initialize']('');
          if (result) {
            this.studentId = this.getValue(this.core + (this.is2004 ? 'learner_id' : 'student_id'));
            this.studentName = this.getValue(this.core + (this.is2004 ? 'learner_name' : 'student_name'));
            this.setValue(this.core + 'score.min', 0);
            this.setValue(this.core + 'score.max', 100);
            $(window).on('unload', function () {
              _this.commitInfo();
              _this.terminate();
              _this.API = null;
            });
          }
          Utils.log('debug', 'SCORM initialized');
        } catch (ex) {
          Utils.log('error', "Error initializing SCORM API: " + ex.message);
        }
        return result;
      }

      /**
       * Terminates communication with the SCORM API
       * @returns {Boolean}
       */

    }, {
      key: "terminate",
      value: function terminate() {
        var result = false;
        try {
          result = this.API[this.is2004 ? 'Terminate' : 'LMSFinish']('');
        } catch (ex) {
          Utils.log('error', "Error terminating SCORM API: " + ex.message);
        }
        return result;
      }

      /**
       * Commits the current information to the SCORM API
       */

    }, {
      key: "commitInfo",
      value: function commitInfo() {
        var info = this.reporter.getInfo(),
            score = Math.round(info.globalScore * 100),
            time = this.getTimeExpression(info.tTime);

        this.setValue(this.core + 'score.raw', score);
        this.setValue(this.core + 'session_time', time);
        this.commit();
        Utils.log('debug', "SCORM results reported: " + score + " (" + time + ")");
      }

      /**
       * Commits current pending data to the SCORM API
       * @returns {Boolean}
       */

    }, {
      key: "commit",
      value: function commit() {
        var result = false;
        try {
          result = this.API[this.prefix + 'Commit']('');
        } catch (ex) {
          Utils.log('error', 'Error commiting data to the SCORM API: ${ex.message}');
        }
        return result;
      }

      /**
       * Sends a specific value to the SCORM API
       * @param {tring} key - A SCORM valid key
       * @param {string|number} value - The value associated with this key
       * @returns {string}
       */

    }, {
      key: "setValue",
      value: function setValue(key, value) {
        var result = false;
        try {
          result = this.API[this.prefix + 'SetValue'](key, value);
        } catch (ex) {
          Utils.log('error', "Error setting value \"" + value + "\" to \"" + key + "\" in SCORM API: " + ex.message);
        }
        return result;
      }

      /**
       * Gets a specific value from the SCORM API
       * @param {tring} key - A SCORM valid key
       * @returns {string} - The value associated with the provided key, or `null` if not found
       */

    }, {
      key: "getValue",
      value: function getValue(key) {
        var result = false;
        try {
          result = this.API[this.prefix + 'GetValue'](key);
        } catch (ex) {
          Utils.log('error', "Error retrieving \"" + key + "\" from SCORM API: " + ex.message);
        }
        return result;
      }

      /**
       * Gets a string expression of the given time (in milliseconds) suitable for a SCORM transaction.
       * @see {@link http://www.ostyn.com/standards/scorm/samples/ISOTimeForSCORM.htm}
       * @param {type} millis - The amount of time, in milliseconds
       * @returns {String} - An ISO8601 valid expression
       */

    }, {
      key: "getTimeExpression",
      value: function getTimeExpression(millis) {
        var d = new Date(millis),
            h = d.getUTCHours(),
            m = d.getUTCMinutes(),
            s = d.getUTCSeconds();

        return this.is2004 ? "PT" + h + "H" + m + "M" + s + "S" : ('0000' + h).slice(-4) + ":" + ('00' + m).slice(-2) + ":" + ('00' + s).slice(-2);
      }

      /**
       * Gets the SCORM type of this SCORM object
       * @returns {string}
       */

    }, {
      key: "getScormType",
      value: function getScormType() {
        return "SCORM " + (this.is2004 ? '2004' : '1.2');
      }
    }], [{
      key: "scanForAPI",
      value: function scanForAPI(win, tries) {
        if (win.API_1484_11 && win.API_1184_11.Initialize && win.API_1184_11.SetValue && win.API_1184_11.Commit) return win.API_1184_11;else if (win.API && win.API.LMSInitialize && win.API.LMSSetValue && win.API.LMSCommit) return win.API;else if (win.parent && win.parent !== win && tries++ < SCORM.DISCOVER_MAX_TRIES) return SCORM.scanForAPI(win.parent, tries);else return null;
      }

      /**
       * Checks for the presence of a SCORM API on the current browser session.
       * @returns {SCORM} - A valid SCORM object, or `null` if no SCORM API was found.
       * @param {Reporter} reporter - The {@link Reporter} linked to the requested SCORM object
       */

    }, {
      key: "getSCORM",
      value: function getSCORM(reporter) {
        var result = null;
        try {
          var api = SCORM.scanForAPI(window, 0);
          if (api === null && window.opener) api = SCORM.scanForAPI(window.opener, 0);

          if (api) {
            result = new SCORM(api, reporter);
            if (!result.initialize()) result = null;
          }
        } catch (ex) {
          result = null;
          Utils.log('warn', 'Unable to use SCORM: %s', ex.toString());
        }
        return result;
      }
    }]);

    return SCORM;
  }();

  Object.assign(SCORM.prototype, {
    /**
     * True when the API is of type SCORM 2004, false for SCORM 1.2
     * @name SCORM#is2004
     * @type {boolean} */
    is2004: false,
    /**
     * The Reporter associated to this SCORM object
     * @name SCORM#reporter
     * @type {Reporter} */
    reporter: null,
    /**
     * Prefix to be used in SCORM function names. Should be 'LMS' for SCORM 1.2
     * @name SCORM#prefix
     * @type {string} */
    prefix: '',
    /**
     * Prefix used in core SCORM keys. Should be 'cmi.core.' for 1.2 and 'cmi.' for 2004
     * @name SCORM#core
     * @type {string} */
    core: 'cmi.',
    /**
     * SCORM API object used to communicate with the LMS
     * @name SCORM#API
     * @type {object} */
    API: null,
    /**
     * The student ID retrieved from the SCORM API
     * @name SCORM#studentId
     * @type {string} */
    studentId: '',
    /**
     * The student name retrieved from the SCORM API
     * @name SCORM#studentName
     * @type {string} */
    studentName: ''
  });

  /**
   * Maximum recursive attempts allowed to find the global SCORM API object
   * @type {number} */
  SCORM.DISCOVER_MAX_TRIES = 50;

  return SCORM;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 499 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 *  File    : PlayerHistory.js
 *  Created : 28/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Utils) {
  /**
   *
   * PlayerHistory uses an array to store the list of projects and activities done by the user.
   * This class allows {@link JClicPlayer} objects to rewind a sequence or to go back to a caller menu.
   * @exports PlayerHistory
   * @class
   */
  var PlayerHistory = function () {
    /**
     * PlayerHistory constructor
     * @param {JClicPlayer} player - The JClicPlayer associated to this history
     */
    function PlayerHistory(player) {
      _classCallCheck(this, PlayerHistory);

      this.player = player;
      this.sequenceStack = [];
    }

    /**
     *
     * Counts the number of {@link PlayerHistory#HistoryElement HistoryElement} objects stored in
     * {@link PlayerHistory#sequenceStack sequenceStack}
     * @returns {number}
     */


    _createClass(PlayerHistory, [{
      key: 'storedElementsCount',
      value: function storedElementsCount() {
        return this.sequenceStack.length;
      }

      /**
       *
       * Removes all elements from {@link PlayerHistory#sequenceStack sequenceStack}
       */

    }, {
      key: 'clearHistory',
      value: function clearHistory() {
        this.sequenceStack = [0];
      }

      /**
       * Adds the current project and activity to the top of the history stack.
       */

    }, {
      key: 'push',
      value: function push() {
        if (this.player.project !== null && this.player.project.path !== null) {
          var ase = this.player.project.activitySequence,
              act = ase.currentAct;
          if (act >= 0) {
            if (this.sequenceStack.length > 0) {
              var last = this.sequenceStack[this.sequenceStack.length - 1];
              if (last.projectPath === this.player.project.path && last.activity === act) return;
            }
            this.sequenceStack.push(new this.HistoryElement(this.player.project.path, ase.getSequenceForElement(act), act, this.player.zip ? this.player.zip.fullZipPath : null));
          }
        }
      }

      /**
       * Retrieves the {@link PlayerHistory#HistoryElement HistoryElement} placed at the top of the
       * stack (if any) and instructs {@link JClicPlayer} to load it. The obtained effect is to
       * "rewind" or "go back", usually to an activity that acts as a menu.
       * @returns {boolean}
       */

    }, {
      key: 'pop',
      value: function pop() {
        // todo: check return value
        if (this.sequenceStack.length > 0) {
          var e = this.sequenceStack.pop();
          if (e.projectPath === this.player.project.path && Utils.isEquivalent(e.fullZipPath, this.player.zip ? this.player.zip.fullZipPath : null)) this.player.load(null, e.activity, null);else if (this.testMode && e.projectPath !== null && e.projectPath.length > 0) Utils.log('info', 'At this point, a jump to "' + e.projectPath + '" should be performed.');else this.player.load(e.fullZipPath || e.projectPath, e.activity, null);
        }
        return true;
      }

      /**
       *
       * Processes the provided {@link JumpInfo} object, instructing {@link JClicPlayer} to go back,
       * stop or jump to another point in the sequence.
       * @param {JumpInfo} ji - The object to be processed
       * @param {boolean} allowReturn - When this parameter is `true`, the jump instructed by `ji` (if any)
       * will be recorded, thus allowing to return to the current activity.
       * @returns {boolean} - `true` if the jump can be processed without errors, `false` otherwise.
       */

    }, {
      key: 'processJump',
      value: function processJump(ji, allowReturn) {
        var result = false;
        if (ji !== null && this.player.project !== null) {
          switch (ji.action) {
            case 'STOP':
              break;
            case 'RETURN':
              if (this.sequenceStack.length > 0 || !this.player.options.returnAsExit) {
                result = this.pop();
                break;
              }
            case 'EXIT':
              if (this.testMode) Utils.log('info', 'At this point, the program should exit.');else this.player.exit(ji.sequence);
              break;
            case 'JUMP':
              if (!ji.sequence && !ji.projectPath) {
                var ase = this.player.project.activitySequence.getElement(ji.actNum, true);
                if (ase !== null) {
                  if (allowReturn) this.push();
                  this.player.load(null, null, ase.activityName);
                  result = true;
                }
              } else {
                if (this.testMode && ji.projectPath !== null && ji.projectPath.length > 0) {
                  Utils.log('info', 'At this point, a jump to "' + ji.projectPath + '" should be performed.');
                } else {
                  result = this.jumpToSequence(ji.sequence, ji.projectPath ? Utils.getPath(this.player.project.basePath, ji.projectPath) : null, allowReturn);
                }
              }
              break;
          }
        }
        return result;
      }

      /**
       * Performs a jump to the specified sequence
       * @param {string} sequence - The {@link ActivitySequence} tag to jump to.
       * @param {?string} path - When not `null`, indicates a new project file that must be loaded.
       * Otherwise, the `sequence` parameter refers to a tag on the {@link ActivitySequence} of the
       * current project.
       * @param {boolean} allowReturn - When this parameter is `true`, the jump will be recorded, thus
       * allowing to return to the current activity.
       */

    }, {
      key: 'jumpToSequence',
      value: function jumpToSequence(sequence, path, allowReturn) {
        if (Utils.isNullOrUndef(sequence) && Utils.isNullOrUndef(path)) return false;
        if (Utils.isNullOrUndef(path)) path = this.player.project.path;
        if (this.sequenceStack.length > 0) {
          var e = this.sequenceStack[this.sequenceStack.length - 1];
          if (!Utils.isNullOrUndef(sequence) && path === e.projectPath) {
            var same = sequence === e.sequence;
            if (path === this.player.project.path) {
              var ase = this.player.project.activitySequence.getElement(e.activity, false);
              same = ase !== null && sequence === ase.tag;
            }
            if (same) return this.pop();
          }
        }
        if (allowReturn) this.push();
        if (path === this.player.project.path) this.player.load(null, sequence, null);else this.player.load(path, sequence, null);
        return true;
      }
    }]);

    return PlayerHistory;
  }();

  Object.assign(PlayerHistory.prototype, {
    /**
     * The {@link JClicPlayer} object to which this `PlayerHistory` belongs
     * @name PlayerHistory#player
     * @type {JClicPlayer} */
    player: null,
    /**
     * This is the main member of the class. PlayerHistory puts and retrieves
     * on it information about the proects and activities done by the current user.
     * @name PlayerHistory#sequenceStack
     * @type {PlayerHistory#HistoryElement[]} */
    sequenceStack: [],
    /**
     * When in test mode, jumps are only simulated.
     * @name PlayerHistory#testMode
     * @type {boolean} */
    testMode: false,
    /**
     * Inner class used to store history elements.
     * @name PlayerHistory#HistoryElement
     * @class
     */
    HistoryElement:
    /**
     * HistoryElement constructor
     * @param {string} projectPath - The full path of the project file
     * @param {?string} sequence - The nearest sequence tag
     * @param {number} activity - The index of the current activity on the project's {@link ActivitySequence}
     * @param {?type} fullZipPath - If `projectPath` resides in a {@link external:JSZip JSZip} object,
     * the full path of the zip file.
     */
    function HistoryElement(projectPath, sequence, activity, fullZipPath) {
      _classCallCheck(this, HistoryElement);

      this.projectPath = projectPath;
      this.sequence = sequence;
      this.activity = activity;
      this.fullZipPath = fullZipPath;
    }
  });

  return PlayerHistory;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 500 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

/**
 *  File    : Deps.js
 *  Created : 19/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

//
// The purpose of this file is to ensure that certain classes derived from the main objects of
// JClic ([Activity](Activity.html), [Shaper](Shaper.html), [Skin](Skin.html) and
// [AutoContentProvider](AutoContentProvider.html)) are loaded at the beginning.
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(66), __webpack_require__(501), __webpack_require__(502), __webpack_require__(503), __webpack_require__(504), __webpack_require__(505), __webpack_require__(506), __webpack_require__(507), __webpack_require__(75), __webpack_require__(508), __webpack_require__(140), __webpack_require__(509), __webpack_require__(510), __webpack_require__(511), __webpack_require__(76), __webpack_require__(512), __webpack_require__(513), __webpack_require__(530), __webpack_require__(514), __webpack_require__(515), __webpack_require__(517), __webpack_require__(518), __webpack_require__(519), __webpack_require__(520), __webpack_require__(521), __webpack_require__(522), __webpack_require__(523), __webpack_require__(524), __webpack_require__(215), __webpack_require__(525), __webpack_require__(526), __webpack_require__(527), __webpack_require__(528), __webpack_require__(529)], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  return 'Deep classes loaded!';
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 501 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : skins/OrangeSkin.js
 *  Created : 04/07/2016
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(34), __webpack_require__(66)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Skin, DefaultSkin) {

  /**
   * This is a variant of the default {@link Skin} used by JClic.js
   * It differs from {@link DefaultSkin} only in some colors
   * @exports OrangeSkin
   * @class
   * @extends DefaultSkin
   */
  var OrangeSkin = function (_DefaultSkin) {
    _inherits(OrangeSkin, _DefaultSkin);

    /**
     * OrangeSkin constructor
     * @param {PlayStation} ps - The PlayStation (currently a {@link JClicPlayer}) used to load and
     * realize the media objects meeded tot build the Skin.
     * @param {string=} name - The skin class name
     * @param {object=} options - Optional parameter with additional options
     */
    function OrangeSkin(ps) {
      var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

      _classCallCheck(this, OrangeSkin);

      // OrangeSkin extends [DefaultSkin](DefaultSkin.html)
      return _possibleConstructorReturn(this, (OrangeSkin.__proto__ || Object.getPrototypeOf(OrangeSkin)).call(this, ps, name, options));
    }

    /**
     * Returns the CSS styles used by this skin. This method should be called only from
     * the `Skin` constructor, and overridded by subclasses if needed.
     * @param {string} media - A specific media size. Possible values are: 'default', 'half' and 'twoThirds'
     * @returns {string}
     */


    _createClass(OrangeSkin, [{
      key: "_getStyleSheets",
      value: function _getStyleSheets() {
        var media = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';

        return _get(OrangeSkin.prototype.__proto__ || Object.getPrototypeOf(OrangeSkin.prototype), "_getStyleSheets", this).call(this, media) + (media === 'default' ? this.skinCSS : '');
      }
    }]);

    return OrangeSkin;
  }(DefaultSkin);

  Object.assign(OrangeSkin.prototype, {
    /**
     * Class name of this skin. It will be used as a base selector in the definition of all CSS styles.
     * @name OrangeSkin#skinId
     * @override
     * @type {string} */
    skinId: 'JClicOrangeSkin',
    /**
     * Styles used in this skin
     * @name OrangeSkin#skinCSS
     * @type {string} */
    skinCSS: '.ID {background-color:#FF8B19;}'
  });

  // Register this class in the list of available skins
  Skin.CLASSES['orange'] = OrangeSkin;

  return OrangeSkin;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 502 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : skins/GreenSkin.js
 *  Created : 04/07/2016
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(34), __webpack_require__(66)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Skin, DefaultSkin) {

  /**
   * This is a variant of the default {@link Skin} used by JClic.js
   * It differs from {@link DefaultSkin} only in some colors
   * @exports GreenSkin
   * @class
   * @extends DefaultSkin
   */
  var GreenSkin = function (_DefaultSkin) {
    _inherits(GreenSkin, _DefaultSkin);

    /**
     * GreenSkin constructor
     * 
     * @param {PlayStation} ps - The PlayStation (currently a {@link JClicPlayer}) used to load and
     * realize the media objects needed to build this Skin.
     * @param {string=} name - The skin class name
     * @param {object=} options - Optional parameter with additional options
     */
    function GreenSkin(ps) {
      var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

      _classCallCheck(this, GreenSkin);

      // GreenSkin extends [DefaultSkin](DefaultSkin.html)
      return _possibleConstructorReturn(this, (GreenSkin.__proto__ || Object.getPrototypeOf(GreenSkin)).call(this, ps, name, options));
    }

    /**
     * Returns the CSS styles used by this skin. This method should be called only from
     * the `Skin` constructor, and overridded by subclasses if needed.
     * @param {string} media - A specific media size. Possible values are: 'default', 'half' and 'twoThirds'
     * @returns {string}
     */


    _createClass(GreenSkin, [{
      key: "_getStyleSheets",
      value: function _getStyleSheets() {
        var media = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';

        return _get(GreenSkin.prototype.__proto__ || Object.getPrototypeOf(GreenSkin.prototype), "_getStyleSheets", this).call(this, media) + (media === 'default' ? this.skinCSS : '');
      }
    }]);

    return GreenSkin;
  }(DefaultSkin);

  Object.assign(GreenSkin.prototype, {
    /**
     * Class name of this skin. It will be used as a base selector in the definition of all CSS styles.
     * @name GreenSkin#skinId
     * @override
     * @type {string} */
    skinId: 'JClicGreenSkin',
    //
    // Buttons and other graphical resources used by this skin:
    /**
     * Fill color for icons
     * @name GreenSkin#iconFill
     * @override
     * @type {string} */
    iconFill: '#20640E',
    /**
     * Fill-in color for counters
     * @name GreenSkin#counterIconFill
     * @override
     * @type {string} */
    counterIconFill: '#20640E',
    /**
     * Styles used in this skin
     * @name GreenSkin#skinCSS
     * @type {string} */
    skinCSS: '.ID {background-color:#4AFF19;}'
  });

  // Register this class in the list of available skins
  Skin.CLASSES['green'] = GreenSkin;

  return GreenSkin;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 503 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : skins/BlueSkin.js
 *  Created : 04/07/2016
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(34), __webpack_require__(66)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Skin, DefaultSkin) {

  /**
   * This is a variant of the default {@link Skin} used by JClic.js
   * It differs from {@link DefaultSkin} only in some colors
   * @exports BlueSkin
   * @class
   * @extends DefaultSkin
   */
  var BlueSkin = function (_DefaultSkin) {
    _inherits(BlueSkin, _DefaultSkin);

    /**
     * BlueSkin constructor
     * @param {PlayStation} ps - The PlayStation (currently a {@link JClicPlayer}) used to load and
     * realize the media objects needed to build the Skin.
     * @param {string=} name - The skin class name
     * @param {object=} options - Optional parameter with additional options
     */
    function BlueSkin(ps) {
      var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

      _classCallCheck(this, BlueSkin);

      // BlueSkin extends [DefaultSkin](DefaultSkin.html)
      return _possibleConstructorReturn(this, (BlueSkin.__proto__ || Object.getPrototypeOf(BlueSkin)).call(this, ps, name, options));
    }

    /**
     * Returns the CSS styles used by this skin. This method should be called only from
     * the `Skin` constructor, and overridded by subclasses if needed.
     * @param {string} media - A specific media size. Possible values are: 'default', 'half' and 'twoThirds'
     * @returns {string}
     */


    _createClass(BlueSkin, [{
      key: "_getStyleSheets",
      value: function _getStyleSheets() {
        var media = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';

        return _get(BlueSkin.prototype.__proto__ || Object.getPrototypeOf(BlueSkin.prototype), "_getStyleSheets", this).call(this, media) + (media === 'default' ? this.skinCSS : '');
      }
    }]);

    return BlueSkin;
  }(DefaultSkin);

  Object.assign(BlueSkin.prototype, {
    /**
     * Class name of this skin. It will be used as a base selector in the definition of all CSS styles.
     * @name BlueSkin#skinId
     * @override
     * @type {string} */
    skinId: 'JClicBlueSkin',
    /**
     * Styles used in this skin
     * @name BlueSkin#skinCSS
     * @type {string} */
    skinCSS: '.ID {background-color:#66ccff;}'
  });

  // Register this class in the list of available skins
  Skin.CLASSES['blue'] = BlueSkin;

  return BlueSkin;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 504 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : skins/SimpleSkin.js
 *  Created : 04/07/2016
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(34), __webpack_require__(66)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Skin, DefaultSkin) {

  /**
   * This is a variant of the default {@link Skin} used by JClic.js
   * It has the buttons at top, and don't has counters.
   * @exports SimpleSkin
   * @class
   * @extends DefaultSkin
   */
  var SimpleSkin = function (_DefaultSkin) {
    _inherits(SimpleSkin, _DefaultSkin);

    /**
     * SimpleSkin constructor
     * @param {PlayStation} ps - The PlayStation (currently a {@link JClicPlayer}) used to load and
     * realize the media objects meeded tot build the Skin.
     * @param {string=} name - The skin class name
     * @param {object=} options - Optional parameter with additional options
     */
    function SimpleSkin(ps) {
      var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

      _classCallCheck(this, SimpleSkin);

      var _this = _possibleConstructorReturn(this, (SimpleSkin.__proto__ || Object.getPrototypeOf(SimpleSkin)).call(this, ps, name, Object.assign({}, options, { counters: false, reportsBtn: true })));
      // OrangeSkin extends [DefaultSkin](DefaultSkin.html)


      _this.$ctrlCnt.detach().prependTo(_this.$div);
      _this.$msgBoxDiv.detach().appendTo(_this.$div);
      // Add a spacing div in substitution of msgBox
      $('<div/>').css({ 'flex-grow': 1 }).insertAfter(_this.$ctrlCnt.children(':nth-child(2)'));
      return _this;
    }

    /**
     * Returns the CSS styles used by this skin. This method should be called only from
     * the `Skin` constructor, and overridded by subclasses if needed.
     * @param {string} media - A specific media size. Possible values are: 'default', 'half' and 'twoThirds'
     * @returns {string}
     */


    _createClass(SimpleSkin, [{
      key: "_getStyleSheets",
      value: function _getStyleSheets() {
        var media = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';

        return "" + _get(SimpleSkin.prototype.__proto__ || Object.getPrototypeOf(SimpleSkin.prototype), "_getStyleSheets", this).call(this, media) + (media === 'default' ? this.skinCSS : media === 'half' ? this.skinCSSHalf : media === 'twoThirds' ? this.skinCSSTwoThirds : '');
      }
    }]);

    return SimpleSkin;
  }(DefaultSkin);

  Object.assign(SimpleSkin.prototype, {
    /**
     * Class name of this skin. It will be used as a base selector in the definition of all CSS styles.
     * @name SimpleSkin#skinId
     * @override
     * @type {string} */
    skinId: 'JClicSimpleSkin',
    /**
     * Styles used in this skin
     * @name SimpleSkin#skinCSS
     * @type {string} */
    skinCSS: '\
.ID {background-color:#888888;}\
.ID .JClicCtrlCnt {margin:9px;}\
.ID .JClicPlayerCnt {margin:0px 18px 18px;}\
.ID .JClicMsgBox {flex-grow:0; margin:0 18px 18px 18px;}',
    skinCSSHalf: '\
.ID .JClicCtrlCnt {margin:4px;}\
.ID .JClicPlayerCnt {margin:0px 9px 9px;}\
.ID .JClicMsgBox {margin:0 9px 9px 9px;}',
    skinCSSTwoThirds: '\
.ID .JClicCtrlCnt {margin:6px;}\
.ID .JClicPlayerCnt {margin:0px 12px 12px;}\
.ID .JClicMsgBox {margin:0 12px 12px 12px;}'
  });

  // Register this class in the list of available skins
  Skin.CLASSES['simple'] = SimpleSkin;

  return SimpleSkin;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 505 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : skins/MiniSkin.js
 *  Created : 05/07/2016
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(34), __webpack_require__(66)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Skin, DefaultSkin) {

  /**
   * This is a variant of the default {@link Skin} used by JClic.js
   * It differs from {@link DefaultSkin} in colors and sizes
   * @exports MiniSkin
   * @class
   * @extends DefaultSkin
   */
  var MiniSkin = function (_DefaultSkin) {
    _inherits(MiniSkin, _DefaultSkin);

    /**
     * MiniSkin constructor
     * 
     * @param {PlayStation} ps - The PlayStation (currently a {@link JClicPlayer}) used to load and
     * realize the media objects meeded tot build the Skin.
     * @param {string=} name - The skin class name
     * @param {object=} options - Optional parameter with additional options
     */
    function MiniSkin(ps) {
      var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

      _classCallCheck(this, MiniSkin);

      // MiniSkin extends [DefaultSkin](DefaultSkin.html)
      return _possibleConstructorReturn(this, (MiniSkin.__proto__ || Object.getPrototypeOf(MiniSkin)).call(this, ps, name, Object.assign({}, options, { counters: false, reportsBtn: true })));
    }

    /**
     * Returns the CSS styles used by this skin. This method should be called only from
     * the `Skin` constructor, and overridded by subclasses if needed.
     * @param {string} media - A specific media size. Possible values are: 'default', 'half' and 'twoThirds'
     * @returns {string}
     */


    _createClass(MiniSkin, [{
      key: "_getStyleSheets",
      value: function _getStyleSheets() {
        var media = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';

        return _get(MiniSkin.prototype.__proto__ || Object.getPrototypeOf(MiniSkin.prototype), "_getStyleSheets", this).call(this, media) + (media === 'default' ? this.skinCSS : '');
      }
    }]);

    return MiniSkin;
  }(DefaultSkin);

  Object.assign(MiniSkin.prototype, {
    /**
     * Class name of this skin. It will be used as a base selector in the definition of all CSS styles.
     * @name MiniSkin#skinId
     * @override
     * @type {string}
     */
    skinId: 'JClicMiniSkin',
    // Buttons and other graphical resources used by this skin.
    //
    /**
     * Icon width
     * @name MiniSkin#iconWidth
     * @override
     * @type {number} */
    iconWidth: 18,
    /**
     * Icon height
     * @name MiniSkin#iconHeight
     * @override
     * @type {number} */
    iconHeight: 18,
    /**
     * Fill color for icons
     * @name MiniSkin#iconFill
     * @override
     * @type {string} */
    iconFill: '#080808',
    /**
     * Fill-in color for counters
     * @name MiniSkin#counterIconFill
     * @override
     * @type {string} */
    counterIconFill: '#080808',
    /**
     * Default margin between elements
     * @name MiniSkin#margin
     * @override
     * @type {number} */
    margin: 8,
    /**
     * Styles used in this skin
     * @name MiniSkin#skinCSS
     * @type {string} */
    skinCSS: '\
.ID {background-color:#F4F4F4;}\
.ID .JClicPlayerCnt {margin:4px;}\
.ID .JClicCtrlCnt {margin:0 2px 4px 2px;}\
.ID .JClicMsgBox {height:25px;}',
    /**
     * Styles used in this skin, sized to half its regular size.
     * (_null_ here because MiniSkin it's already very small)
     * @name MiniSkin#mainCSSHalf
     * @override
     * @type {string} */
    mainCSSHalf: '',
    /**
     * Styles used in this skin, sized to two thirds of its regular size
     * (_null_ here because MiniSkin it's already very small)
     * @name MiniSkin#mainCSSTwoThirds
     * @override
     * @type {string} */
    mainCSSTwoThirds: ''
  });

  // Register this class in the list of available skins
  Skin.CLASSES['mini'] = MiniSkin;

  return MiniSkin;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 506 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : skins/EmptySkin.js
 *  Created : 14/03/2017
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(34)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Skin) {

  /**
   * A minimalist {@link Skin} for JClic.js with just the player, without messages, counters nor any button.
   * @exports EmptySkin
   * @class
   * @extends Skin
   */
  var EmptySkin = function (_Skin) {
    _inherits(EmptySkin, _Skin);

    /**
     * EmptySkin constructor
     * 
     * @param {PlayStation} ps - The PlayStation (currently a {@link JClicPlayer}) used to load and
     * realize the media objects needed tot build the Skin.
     * @param {string=} name - The skin class name
     * @param {object=} options - Optional parameter with additional options
     */
    function EmptySkin(ps) {
      var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

      _classCallCheck(this, EmptySkin);

      // EmptySkin extends [Skin](Skin.html)
      return _possibleConstructorReturn(this, (EmptySkin.__proto__ || Object.getPrototypeOf(EmptySkin)).call(this, ps, name, options));
    }
    /**
     * Returns the CSS styles used by this skin. This method should be called only from
     * the `Skin` constructor, and overridded by subclasses if needed.
     * @param {string} media - A specific media size. Possible values are: 'default', 'half' and 'twoThirds'
     * @returns {string}
     */


    _createClass(EmptySkin, [{
      key: "_getStyleSheets",
      value: function _getStyleSheets() {
        var media = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';

        return _get(EmptySkin.prototype.__proto__ || Object.getPrototypeOf(EmptySkin.prototype), "_getStyleSheets", this).call(this, media) + (media === 'default' ? this.mainCSS : '');
      }
    }]);

    return EmptySkin;
  }(Skin);

  Object.assign(EmptySkin.prototype, {
    /**
     * Class name of this skin. It will be used as a base selector in the definition of all CSS styles.
     * @name EmptySkin#skinId
     * @override
     * @type {string} */
    skinId: 'JClicEmptySkin',
    /**
     * Styles used in this skin
     * @name EmptySkin#skinCSS
     * @override
     * @type {string} */
    mainCSS: '.ID .JClicPlayerCnt {margin:0;}'
  });

  // Register this class in the list of available skins
  Skin.CLASSES['empty'] = EmptySkin;

  return EmptySkin;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 507 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : skins/CustomSkin.js
 *  Created : 12/02/2018
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(34), __webpack_require__(214), __webpack_require__(2), __webpack_require__(3), __webpack_require__(74)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Skin, Counter, Utils, AWT, ActiveBox) {

  /**
   * Custom {@link Skin} for JClic.js, built assembling specific cuts of a canvas (usually a PNG file) defined in an XML file
   * @exports CustomSkin
   * @class
   * @extends Skin
   */
  var CustomSkin = function (_Skin) {
    _inherits(CustomSkin, _Skin);

    /**
     * CustomSkin constructor
     * 
     * @param {PlayStation} ps - The PlayStation (currently a {@link JClicPlayer}) used to load and
     * realize the media objects needed tot build the Skin.
     * @param {string=} name - The skin class name
     * @param {object=} options - Optional parameter with additional options
     */
    function CustomSkin(ps) {
      var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;

      _classCallCheck(this, CustomSkin);

      //console.log(this.options)

      var _this = _possibleConstructorReturn(this, (CustomSkin.__proto__ || Object.getPrototypeOf(CustomSkin)).call(this, ps, name, options));
      // CustomSkin extends [Skin](Skin.html)


      _this.$mainPanel = $('<div/>', { class: 'JClicCustomMainPanel' });
      _this.$gridPanel = $('<div/>', { class: 'JClicGridPanel' });
      for (var i = 0; i < 9; i++) {
        _this.$gridPanel.append($('<div/>', { class: "JClicCell JClicCell" + (i + 1) }));
      }_this.$mainPanel.append(_this.$gridPanel);
      _this.$playerCnt.detach().addClass('JClicPlayerCell').appendTo(_this.$mainPanel);
      _this.$div.prepend(_this.$mainPanel);

      // Add buttons
      if (options.buttons) {
        Object.keys(options.buttons.button).forEach(function (k) {
          var k2 = k === 'about' ? 'reports' : k;
          var msg = ps.getMsg(_this.msgKeys[k2] || k2);
          _this.buttons[k2] = $('<button/>', { class: "JClicBtn JClicTransform Btn-" + k2, title: msg, 'aria-label': msg, disabled: typeof _this.msgKeys[k2] === 'undefined' }).on('click', function (evt) {
            if (ps.actions[k2]) ps.actions[k2].processEvent(evt);
          });
          _this.$mainPanel.append(_this.buttons[k2]);
        });
      }

      // Add message box
      if (options.rectangle.messages) {
        _this.msgBox = new ActiveBox();
        _this.msgBox.role = 'message';
        _this.$msgBoxDiv = $('<div/>', { class: 'JClicMsgBox' }).click(function () {
          _this.msgBox.playMedia(ps);
          return false;
        });
        _this.$mainPanel.append(_this.$msgBoxDiv);
      }

      // Add counters
      if (false !== _this.ps.options.counters && options.counters && options.counters.counter) {
        $.each(Skin.prototype.counters, function (name, _val) {
          if (options.counters.counter[name]) {
            var msg = ps.getMsg(name);
            _this.counters[name] = new Counter(name, $('<div/>', { class: "JClicCounter JClicTransform Counter-" + name, title: msg, 'aria-label': msg }).html('000').appendTo(_this.$mainPanel));
          }
        });
      }

      // Add progress animation
      if (options.progressAnimation) {
        _this.$progressAnimation = $('<div/>', { class: 'JClicProgressAnimation JClicTransform' });
        _this.$mainPanel.append(_this.$progressAnimation);
      }

      return _this;
    }

    /**
     * Enables or disables the `tabindex` attribute of the main buttons. Useful when a modal dialog
     * overlay is active, to avoid direct access to controls not related with the dialog.
     * @param {boolean} status - `true` to make main controls navigable, `false` otherwise
     */


    _createClass(CustomSkin, [{
      key: "enableMainButtons",
      value: function enableMainButtons(status) {
        this.$mainPanel.find('.JClicBtn').attr('tabindex', status ? '0' : '-1');
      }

      /**
       * Computes the CSS styles used by this skin in thre moodes: main, half ant twoThirds.
       * The resulting strings will be stored in `cssVariants`
       * @returns {string}
       */

    }, {
      key: "_computeStyleSheets",
      value: function _computeStyleSheets() {
        var _this2 = this;

        var maxw = this.options.dimension.preferredSize.width,
            maxh = this.options.dimension.preferredSize.height;

        this.twoThirdsMedia = { width: maxw, height: maxh };
        this.halfMedia = {
          width: Math.round(2 * maxw / 3),
          height: Math.round(2 * maxh / 3)

          // Panels:
        };var ph0 = this.options.rectangle.frame.left,
            ph1 = ph0 + this.options.rectangle.player.left,
            ph2 = ph0 + this.options.slicer.left,
            ph3 = ph0 + this.options.slicer.right,
            ph4 = ph1 + this.options.rectangle.player.width,
            ph5 = ph0 + this.options.rectangle.frame.width,
            pv0 = this.options.rectangle.frame.top,
            pv1 = pv0 + this.options.rectangle.player.top,
            pv2 = pv0 + this.options.slicer.top,
            pv3 = pv0 + this.options.slicer.bottom,
            pv4 = pv1 + this.options.rectangle.player.height,
            pv5 = pv0 + this.options.rectangle.frame.height,
            imgElement = this.ps.project.mediaBag.getElement(this.options.image, true),
            imgUrl = imgElement.data && imgElement.data.src ? imgElement.data.src : '',
            box1 = imgElement.data ? Utils.getImgClipUrl(imgElement.data, new AWT.Rectangle(ph0, pv0, ph2 - ph0, pv2 - pv0)) : '',
            box2 = imgElement.data ? Utils.getImgClipUrl(imgElement.data, new AWT.Rectangle(ph2 - ph0, pv0, ph3 - ph2, pv2 - pv0)) : '',
            box3 = imgElement.data ? Utils.getImgClipUrl(imgElement.data, new AWT.Rectangle(ph3, pv0, ph5 - ph3, pv2 - pv0)) : '',
            box4 = imgElement.data ? Utils.getImgClipUrl(imgElement.data, new AWT.Rectangle(ph0, pv2 - pv0, ph2 - ph0, pv3 - pv2)) : '',
            box6 = imgElement.data ? Utils.getImgClipUrl(imgElement.data, new AWT.Rectangle(ph3 - ph0, pv2 - pv0, ph5 - ph3, pv3 - pv2)) : '',
            box7 = imgElement.data ? Utils.getImgClipUrl(imgElement.data, new AWT.Rectangle(ph0, pv3 - pv0, ph2 - ph0, pv5 - pv3)) : '',
            box8 = imgElement.data ? Utils.getImgClipUrl(imgElement.data, new AWT.Rectangle(ph2 - ph0, pv3 - pv0, ph3 - ph2, pv5 - pv3)) : '',
            box9 = imgElement.data ? Utils.getImgClipUrl(imgElement.data, new AWT.Rectangle(ph3, pv3 - pv0, ph5 - ph3, pv5 - pv3)) : '';

        var css = "\n.ID .JClicCustomMainPanel {flex-grow:1;position:relative;background-color: " + Utils.checkColor(this.options.color.fill.value) + ";}\n.ID .JClicGridPanel {position:absolute;width:100%;height:100%;display:grid;grid-template-columns:" + (ph2 - ph0) + "px 1fr " + (ph5 - ph3) + "px;grid-template-rows:" + (pv2 - pv0) + "px 1fr " + (pv5 - pv3) + "px;}\n.ID .JClicCell {background-repeat:no-repeat;background-size:contain;}\n.ID .JClicPlayerCell {position:absolute;top:" + (pv1 - pv0) + "px;right:" + (ph5 - ph4) + "px;bottom:" + (pv5 - pv4) + "px;left:" + (ph1 - ph0) + "px;}\n.ID .JClicCell1 {background-image:url(" + box1 + ");}\n.ID .JClicCell2 {background-image:url(" + box2 + ");background-repeat:repeat-x;}\n.ID .JClicCell3 {background-image:url(" + box3 + ");}\n.ID .JClicCell4 {background-image:url(" + box4 + ");background-repeat:repeat-y;}\n.ID .JClicCell5 {}\n.ID .JClicCell6 {background-image:url(" + box6 + ");background-repeat:repeat-y;}\n.ID .JClicCell7 {background-image:url(" + box7 + ");}\n.ID .JClicCell8 {background-image:url(" + box8 + ");background-repeat:repeat-x;}\n.ID .JClicCell9 {background-image:url(" + box9 + ");}";

        var cssHalf = "\n.ID .JClicGridPanel {grid-template-columns:" + Math.round((ph2 - ph0) / 2) + "px 1fr " + Math.round((ph5 - ph3) / 2) + "px;grid-template-rows:" + Math.round((pv2 - pv0) / 2) + "px 1fr " + Math.round((pv5 - pv3) / 2) + "px;}\n.ID .JClicPlayerCell {top:" + Math.round((pv1 - pv0) / 2) + "px;right:" + Math.round((ph5 - ph4) / 2) + "px;bottom:" + Math.round((pv5 - pv4) / 2) + "px;left:" + Math.round((ph1 - ph0) / 2) + "px;}\n.ID .JClicTransform {transform: scale(0.5);}";

        var cssTwoThirds = "\n.ID .JClicGridPanel {grid-template-columns:" + Math.round(2 * (ph2 - ph0) / 3) + "px 1fr " + Math.round(2 * (ph5 - ph3) / 3) + "px;grid-template-rows:" + Math.round(2 * (pv2 - pv0) / 3) + "px 1fr " + Math.round(2 * (pv5 - pv3) / 3) + "px;}\n.ID .JClicPlayerCell {top:" + Math.round(2 * (pv1 - pv0) / 3) + "px;right:" + Math.round(2 * (ph5 - ph4) / 3) + "px;bottom:" + Math.round(2 * (pv5 - pv4) / 3) + "px;left:" + Math.round(2 * (ph1 - ph0) / 3) + "px;}\n.ID .JClicTransform {transform: scale(0.666);}";

        // Buttons:
        if (this.options.buttons) {
          var bt = this.options.buttons;
          var wBase = 30,
              hBase = 30,
              offsetBase = {};
          if (bt.settings) {
            if (bt.settings.dimension) {
              wBase = bt.settings.dimension.width || wBase;
              hBase = bt.settings.dimension.height || hBase;
            }
            if (bt.settings.offset) Object.assign(offsetBase, bt.settings.offset);
          }
          Object.keys(this.options.buttons.button).forEach(function (k) {
            var btn = bt.button[k],
                k2 = k === 'about' ? 'reports' : k;
            var w = wBase,
                h = hBase,
                offset = offsetBase;
            if (btn.settings) {
              if (btn.settings.dimension) {
                w = btn.settings.dimension.width || w;
                h = btn.settings.dimension.height || h;
              }
              if (btn.settings.offset) offset = Object.assign({}, offsetBase, btn.settings.offset);
            }
            var x = btn.point.pos.left,
                xp = x < ph2 ? "left:" + x : "right:" + (ph5 - x - w),
                xpHalf = x < ph2 ? "left:" + Math.round(x / 2 - w / 4) : "right:" + Math.round((ph5 - x - w) / 2 - w / 4),
                xpTwoThirds = x < ph2 ? "left:" + Math.round(2 * x / 3 - w / 6) : "right:" + Math.round(2 * (ph5 - x - w) / 3 - w / 6),
                y = btn.point.pos.top,
                yp = y < pv2 ? "top:" + y : "bottom:" + (pv5 - y - h),
                ypHalf = y < pv2 ? "top:" + Math.round(y / 2 - h / 4) : "bottom:" + Math.round((pv5 - y - h) / 2 - h / 4),
                ypTwoThirds = y < pv2 ? "top:" + Math.round(2 * y / 3 - h / 6) : "bottom:" + Math.round(2 * (pv5 - y - h) / 3 - h / 6),
                xs = btn.point.source.left,
                ys = btn.point.source.top;
            css += ".ID .Btn-" + k2 + " {position:absolute;" + xp + "px;" + yp + "px;width:" + w + "px;height:" + h + "px;background:url(" + imgUrl + ") !important;background-position:-" + xs + "px -" + ys + "px !important;}\n";
            cssHalf += ".ID .Btn-" + k2 + " {" + xpHalf + "px;" + ypHalf + "px;}\n";
            cssTwoThirds += ".ID .Btn-" + k2 + " {" + xpTwoThirds + "px;" + ypTwoThirds + "px;}\n";
            if (offset.active) css += ".ID .Btn-" + k2 + ":active {background-position:-" + (xs + offset.active.right) + "px -" + (ys + offset.active.down) + "px !important;}\n";
            if (offset.over) css += ".ID .Btn-" + k2 + ":hover {background-position:-" + (xs + offset.over.right) + "px -" + (ys + offset.over.down) + "px !important;}\n";
            if (offset.disabled) css += ".ID .Btn-" + k2 + ":disabled {background-position:-" + (xs + offset.disabled.right) + "px -" + (ys + offset.disabled.down) + "px !important;}\n";
          });
        }

        // Counters:
        if (this.options.counters && this.options.counters.settings) {
          var cnt = this.options.counters;
          var _wBase = 35,
              _hBase = 20;
          if (cnt.settings.dimension && cnt.settings.dimension.counter) {
            _wBase = cnt.settings.dimension.counter.width || _wBase;
            _hBase = cnt.settings.dimension.counter.height || _hBase;
          }
          var wLb = 37,
              hLb = 14;
          if (cnt.settings.dimension && cnt.settings.dimension.label) {
            wLb = cnt.settings.dimension.label.width || wLb;
            hLb = cnt.settings.dimension.label.height || hLb;
          }
          var bColor = 'black';
          if (cnt.style && cnt.style.color && cnt.style.color.foreground) bColor = Utils.checkColor(cnt.style.color.foreground.value || bColor);
          var lbFntSize = hLb - 4;
          var lbFntFamily = 'Roboto';
          if (cnt.style && cnt.style.font && cnt.style.font.label) {
            lbFntSize = Math.max(8, cnt.style.font.label.size || lbFntSize);
            lbFntFamily = (cnt.style.font.label.family || 'Roboto') + ",Roboto,sans-serif";
          }

          css += ".ID .JClicCounter {font-size:" + (_hBase - 2) + "px;color:" + bColor + "}\n";
          Object.keys(this.options.counters.counter).forEach(function (k) {
            var counter = cnt.counter[k];
            var w = _wBase,
                h = _hBase;
            var x = counter.point.counter.left,
                xl = counter.point.label.left || x - Math.round((wLb - _wBase) / 2),
                xp = x < ph2 ? "left:" + x : "right:" + (ph5 - x - w),
                xpHalf = x < ph2 ? "left:" + Math.round(x / 2 - w / 4) : "right:" + Math.round((ph5 - x - w) / 2 - w / 4),
                xpTwoThirds = x < ph2 ? "left:" + Math.round(2 * x / 3 - w / 6) : "right:" + Math.round(2 * (ph5 - x - w) / 3 - w / 6),
                y = counter.point.counter.top,
                yl = counter.point.label.top || y - hLb,
                yp = y < pv2 ? "top:" + y : "bottom:" + (pv5 - y - h),
                ypHalf = y < pv2 ? "top:" + Math.round(y / 2 - h / 4) : "bottom:" + Math.round((pv5 - y - h) / 2 - h / 4),
                ypTwoThirds = y < pv2 ? "top:" + Math.round(2 * y / 3 - h / 6) : "bottom:" + Math.round(2 * (pv5 - y - h) / 3 - h / 6);
            // counter:
            css += ".ID .Counter-" + k + " {position:absolute;" + xp + "px;" + yp + "px;width:" + w + "px;height:" + h + "px;line-height:" + h + "px;}\n";
            // label:
            css += ".ID .Counter-" + k + ":before {content:\"" + _this2.ps.getMsg(k) + "\";font-size:" + lbFntSize + "px;font-family:" + lbFntFamily + ";width:" + wLb + "px;height:" + hLb + "px;line-height:" + hLb + "px;position:absolute;top:" + (yl - y) + "px;left:" + (xl - x) + "px;}";
            // reduced sizes:
            cssHalf += ".ID .Counter-" + k + " {" + xpHalf + "px;" + ypHalf + "px;}\n";
            cssTwoThirds += ".ID .Counter-" + k + " {" + xpTwoThirds + "px;" + ypTwoThirds + "px;}\n";
          });
        }

        // Progress animation:
        if (this.options.progressAnimation) {
          var pa = this.options.progressAnimation;
          var w = 30,
              h = 30;
          if (pa.dimension) {
            w = pa.dimension.width || w;
            h = pa.dimension.height || h;
          }
          var x = pa.point.pos.left,
              xp = x < ph2 ? "left:" + x : "right:" + (ph5 - x - w),
              xpHalf = x < ph2 ? "left:" + Math.round(x / 2 - w / 4) : "right:" + Math.round((ph5 - x - w) / 2 - w / 4),
              xpTwoThirds = x < ph2 ? "left:" + Math.round(2 * x / 3 - w / 6) : "right:" + Math.round(2 * (ph5 - x - w) / 3 - w / 6),
              y = pa.point.pos.top,
              yp = y < pv2 ? "top:" + y : "bottom:" + (pv5 - y - h),
              ypHalf = y < pv2 ? "top:" + Math.round(y / 2 - h / 4) : "bottom:" + Math.round((pv5 - y - h) / 2 - h / 4),
              ypTwoThirds = y < pv2 ? "top:" + Math.round(2 * y / 3 - h / 6) : "bottom:" + Math.round(2 * (pv5 - y - h) / 3 - h / 6),
              xs = pa.point.source.left,
              ys = pa.point.source.top;
          css += ".ID .JClicProgressAnimation {position:absolute;" + xp + "px;" + yp + "px;width:" + w + "px;height:" + h + "px;background:url(" + imgUrl + ");background-position:-" + xs + "px -" + ys + "px;}\n";
          cssHalf += ".ID .JClicProgressAnimation {" + xpHalf + "px;" + ypHalf + "px;}\n";
          cssTwoThirds += ".ID .JClicProgressAnimation {" + xpTwoThirds + "px;" + ypTwoThirds + "px;}\n";

          if (pa.frames && pa.direction) {
            var dx = (pa.step || w) * (pa.direction === 'right' ? 1 : pa.direction === 'left' ? -1 : 0),
                dy = (pa.step || h) * (pa.direction === 'down' ? 1 : pa.direction === 'up' ? -1 : 0);
            css += "\n@keyframes anim {100% {background-position:" + (xs + dx * pa.frames) * -1 + "px " + (ys + dy * pa.frames) * -1 + "px;}}\n.ID .JClicProgressAnimation {animation: anim " + pa.frames * pa.delay + "ms steps(" + pa.frames + ") infinite;}";
          }
        }

        // Messages box:
        if (this.options.rectangle.messages) {
          var bx = this.options.rectangle.messages,
              left = ph0 + bx.left,
              right = ph5 - bx.width - bx.left - ph0,
              tb = bx.top < pv2 ? "top:" + bx.top : "bottom:" + (pv5 - bx.height - bx.top),
              tbHalf = bx.top < pv2 ? "top:" + Math.round(bx.top / 2) : "bottom:" + Math.round((pv5 - bx.height - bx.top) / 2),
              tbTwoThirds = bx.top < pv2 ? "top:" + Math.round(2 * bx.top / 3) : "bottom:" + Math.round(2 * (pv5 - bx.height - bx.top) / 3);

          css += ".ID .JClicMsgBox {position:absolute;left:" + left + "px;right:" + right + "px;height:" + bx.height + "px;" + tb + "px;}";
          cssHalf += ".ID .JClicMsgBox {left:" + Math.round(left / 2) + "px;right:" + Math.round(right / 2) + "px;height:" + Math.round(bx.height / 2) + "px;" + tbHalf + "px;}";
          cssTwoThirds += ".ID .JClicMsgBox {left:" + Math.round(2 * left / 3) + "px;right:" + Math.round(2 * right / 3) + "px;height:" + Math.round(2 * bx.height / 3) + "px;" + tbTwoThirds + "px;}";
        }

        // TODO: Implement status messages?

        // Store results in `cssVariants`
        this.cssVariants = {
          default: this.mainCSS + css,
          half: cssHalf,
          twoThirds: cssTwoThirds
        };
      }

      /**
       * Returns the CSS styles used by this skin. This method should be called only from
       * the `Skin` constructor, and overridded by subclasses if needed.
       * @param {string} media - A specific media size. Possible values are: 'default', 'half' and 'twoThirds'
       * @override
       * @returns {string}
       */

    }, {
      key: "_getStyleSheets",
      value: function _getStyleSheets() {
        var media = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';

        if (!this.cssVariants) this._computeStyleSheets();
        return "" + _get(CustomSkin.prototype.__proto__ || Object.getPrototypeOf(CustomSkin.prototype), "_getStyleSheets", this).call(this, media) + (this.cssVariants[media] || '');
      }

      /**
       * Gets the {@link ActiveBox} used to display the main messages of activities
       * @returns {ActiveBox}
       */

    }, {
      key: "getMsgBox",
      value: function getMsgBox() {
        return this.msgBox;
      }

      /**
       * Sets/unsets the 'wait' state
       * @override
       * @param {boolean} status - Whether to set or unset the wait status. When `undefined`, the
       * `waitCursorCount` member is evaluated to decide if the wait state should be activated or deactivated.
       */

    }, {
      key: "setWaitCursor",
      value: function setWaitCursor(status) {
        _get(CustomSkin.prototype.__proto__ || Object.getPrototypeOf(CustomSkin.prototype), "setWaitCursor", this).call(this, status);
        if (this.$progressAnimation) this.$progressAnimation.css('animation-play-state', this.waitCursorCount > 0 ? 'running' : 'paused');
      }
    }]);

    return CustomSkin;
  }(Skin);

  Object.assign(CustomSkin.prototype, {
    /**
     * Class name of this skin. It will be used as a base selector in the definition of all CSS styles.
     * @name CustomSkin#skinId
     * @override
     * @type {string} */
    skinId: 'JClicCustomSkin',
    /**
     * The name of the image file to be used as a base of this skin.
     * @name CustomSkin#imgName
     * @type {string} */
    imgName: null,
    /**
     * Styles used in this skin
     * @name CustomSkin#skinCSS
     * @override
     * @type {string} */
    mainCSS: '\
.ID .JClicPlayerCnt {margin:0;}\
.ID .JClicBtn:focus {outline:0;}\
.ID .JClicCounter {font-family:Roboto,sans-serif;text-align:center;}',
    /**
     * Specifc styles (`main`, `half` and `twoThirds`) computed at run-time,
     * based on the provided XML file
     * @type {object} */
    cssVariants: null,
    /**
     * Key ids of currently supported buttons, associated with its helper literal
     * @name CustomSkin#msgKeys
     * @type {object} */
    msgKeys: {
      next: 'Next activity',
      prev: 'Previous activity',
      info: 'Information',
      help: 'Help',
      reports: 'Reports',
      // TODO: Implement audio on/off!
      audio: 'Audio on/off',
      reset: 'Reset activity'
    },
    /**
     * Graphic indicator of loading progress
     * @name Skin#$progressAnimation
     * @type {external:jQuery} */
    $progressAnimation: null
  });

  // Register this class in the list of available skins
  Skin.CLASSES['custom'] = CustomSkin;

  return CustomSkin;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 508 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : shapers/Holes.js
 *  Created : 20/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(65)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Shaper) {

  /**
   * This {@link Shaper} consists of a set of arbitrary shapes placed over a main rectangle that
   * acts as a enclosure.
   * The components can be of type {@link AWT.Rectangle}, {@link AWT.Ellipse} or {@link AWT.Path}.
   * This components have internal dimension values relative to the horizontal and vertical
   * sizes of the enclosure. Its values (always between 0 and 1) must be scaled to real sizes
   * of graphic objects.
   * @exports Holes
   * @class
   * @extends Shaper
   */
  var Holes = function (_Shaper) {
    _inherits(Holes, _Shaper);

    /**
     * Holes constructor
     * @param {number} nx - Not used
     * @param {number} ny - Not used
     */
    function Holes(nx, ny) {
      _classCallCheck(this, Holes);

      var _this = _possibleConstructorReturn(this, (Holes.__proto__ || Object.getPrototypeOf(Holes)).call(this, 1, 1));

      _this.nCols = nx;
      _this.nRows = ny;
      _this.showEnclosure = true;
      return _this;
    }

    /**
     * Shapes are already loaded by {@link Shaper}, so this function just sets `initiated` to `true`
     * @override
     */


    _createClass(Holes, [{
      key: "buildShapes",
      value: function buildShapes() {
        if (this.nCells > 0) this.initiated = true;
      }

      /**
       * Gets the rectangle that contains all shapes
       * @override
       * @returns {AWT.Rectangle}
       */

    }, {
      key: "getEnclosingShapeData",
      value: function getEnclosingShapeData() {
        return this.showEnclosure ? this.enclosing || _get(Holes.prototype.__proto__ || Object.getPrototypeOf(Holes.prototype), "getEnclosingShapeData", this).call(this) : null;
      }
    }]);

    return Holes;
  }(Shaper);

  // Register this class in the list of known shapers


  Shaper.CLASSES['@Holes'] = Holes;

  return Holes;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 509 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : shapers/TriangularJigSaw.js
 *  Created : 25/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(65), __webpack_require__(140), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Shaper, JigSaw, AWT) {
  /**
   * This {@link Shaper} returns a set of rectangular shapes with triangular teeth and slots that
   * fit between them.
   * @exports TriangularJigSaw
   * @class
   * @extends JigSaw
   */
  var TriangularJigSaw = function (_JigSaw) {
    _inherits(TriangularJigSaw, _JigSaw);

    /**
     * TriangularJigSaw constructor
     * @param {number} nx - Number of columns
     * @param {number} ny - Number of rows
     */
    function TriangularJigSaw(nx, ny) {
      _classCallCheck(this, TriangularJigSaw);

      return _possibleConstructorReturn(this, (TriangularJigSaw.__proto__ || Object.getPrototypeOf(TriangularJigSaw)).call(this, nx, ny));
    }

    /**
     * Overrides {@link JigSaw#hLine}
     * @override
     * @param {AWT.Path} sd - The Path to which the line will be added
     * @param {number} type - Type  of tooth: 0 is flat (no tooth), 1 means tooth up, and 2 means tooth down
     * @param {number} x - X coordinate of the starting point
     * @param {number} y - Y coordinate of the starting point
     * @param {number} w - Width of the piece
     * @param {number} h - Height of the piece
     * @param {boolean} inv - The line must be drawn right to left
     */


    _createClass(TriangularJigSaw, [{
      key: "hLine",
      value: function hLine(sd, type, x, y, w, h, inv) {
        var kx = inv ? -1 : 1,
            ky = type === 1 ? 1 : -1;

        if (type === 0)
          // Flat line
          sd.addStroke(new AWT.PathStroke('L', [x + w * kx, y]));else {
          var x0 = x + (w - w * this.baseWidthFactor) / 2 * kx;
          var wb = w * this.baseWidthFactor * kx;
          // Approximation to the tooth:
          sd.addStroke(new AWT.PathStroke('L', [x0, y]));
          // This is the tooth:
          var hb = h * this.toothHeightFactor * ky;
          sd.addStroke(new AWT.PathStroke('L', [x0 + wb / 2, y + hb]));
          sd.addStroke(new AWT.PathStroke('L', [x0 + wb, y]));
          // Draw the remaining line
          sd.addStroke(new AWT.PathStroke('L', [x + w * kx, y]));
        }
      }

      /**
       * Overrides {@link JigSaw#vLine}
       * @override
       * @param {AWT.Path} sd - The Path to which the line will be added
       * @param {number} type - Type  of tooth: 0 is flat (no tooth), 1 means tooth right, and 2 means tooth left
       * @param {number} x - X coordinate of the starting point
       * @param {number} y - Y coordinate of the starting point
       * @param {number} w - Width of the piece
       * @param {number} h - Height of the piece
       * @param {boolean} inv - The line must be drawn bottom to top
       */

    }, {
      key: "vLine",
      value: function vLine(sd, type, x, y, w, h, inv) {
        var ky = inv ? -1 : 1,
            kx = type === 1 ? 1 : -1;

        if (type === 0)
          // Flat line
          sd.addStroke(new AWT.PathStroke('L', [x, y + h * ky]));else {
          var y0 = y + (h - h * this.baseWidthFactor) / 2 * ky,
              hb = h * this.baseWidthFactor * ky;

          // Approximation to the tooth:
          sd.addStroke(new AWT.PathStroke('L', [x, y0]));
          // This is the tooth:
          var wb = w * this.toothHeightFactor * kx;
          sd.addStroke(new AWT.PathStroke('L', [x + wb, y0 + hb / 2]));
          sd.addStroke(new AWT.PathStroke('L', [x, y0 + hb]));
          // Draw the remaining line
          sd.addStroke(new AWT.PathStroke('L', [x, y + h * ky]));
        }
      }
    }]);

    return TriangularJigSaw;
  }(JigSaw);

  // Register this class in the list of known shapers


  Shaper.CLASSES['@TriangularJigSaw'] = TriangularJigSaw;

  return TriangularJigSaw;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 510 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : shapers/ClassicJigSaw.js
 *  Created : 25/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(65), __webpack_require__(140), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Shaper, JigSaw, AWT) {
  /**
   * This is the classic {@link JigSaw} {@link Shaper} used in puzzle toys, where teeth and slots
   * are shaped by Bézier curves.
   * @exports ClassicJigSaw
   * @class
   * @extends JigSaw
   */
  var ClassicJigSaw = function (_JigSaw) {
    _inherits(ClassicJigSaw, _JigSaw);

    /**
     * ClassicJigSaw constructor
     * @param {number} nx - Number of columns
     * @param {number} ny - Number of rows
     */
    function ClassicJigSaw(nx, ny) {
      _classCallCheck(this, ClassicJigSaw);

      return _possibleConstructorReturn(this, (ClassicJigSaw.__proto__ || Object.getPrototypeOf(ClassicJigSaw)).call(this, nx, ny));
    }

    /**
     * Overrides {@link JigSaw#hLine}
     * @override
     * @param {AWT.Path} sd - The Path to which the line will be added
     * @param {number} type - Type  of tooth: 0 is flat (no tooth), 1 means tooth up, and 2 means tooth down
     * @param {number} x - X coordinate of the starting point
     * @param {number} y - Y coordinate of the starting point
     * @param {number} w - Width of the piece
     * @param {number} h - Height of the piece
     * @param {boolean} inv - The line must be drawn right to left
     */


    _createClass(ClassicJigSaw, [{
      key: "hLine",
      value: function hLine(sd, type, x, y, w, h, inv) {
        var kx = inv ? -1 : 1,
            ky = type === 1 ? 1 : -1;

        if (type === 0)
          // Flat line
          sd.addStroke(new AWT.PathStroke('L', [x + w * kx, y]));else {
          var x0 = x + (w - w * this.baseWidthFactor) / 2 * kx,
              wb = w * (this.baseWidthFactor / 12) * kx;

          // Approximation to the tooth:
          sd.addStroke(new AWT.PathStroke('L', [x0, y]));
          // This is the tooth:
          var hb = h * this.toothHeightFactor * ky / 8;
          sd.addStroke(new AWT.PathStroke('B', [x0 + 4 * wb, y, x0 + 6 * wb, y - hb, x0 + 4 * wb, y - 3 * hb]));
          sd.addStroke(new AWT.PathStroke('B', [x0 + 2 * wb, y - 5 * hb, x0 + 10 * wb, y - 5 * hb, x0 + 8 * wb, y - 3 * hb]));
          sd.addStroke(new AWT.PathStroke('B', [x0 + 6 * wb, y - 1 * hb, x0 + 8 * wb, y, x0 + 12 * wb, y]));
          // Draw the remaining line
          sd.addStroke(new AWT.PathStroke('L', [x + w * kx, y]));
        }
      }

      /**
       * Overrides {@link JigSaw#vLine}
       * @override
       * @param {AWT.Path} sd - The Path to which the line will be added
       * @param {number} type - Type  of tooth: 0 is flat (no tooth), 1 means tooth right, and 2 means tooth left
       * @param {number} x - X coordinate of the starting point
       * @param {number} y - Y coordinate of the starting point
       * @param {number} w - Width of the piece
       * @param {number} h - Height of the piece
       * @param {boolean} inv - The line must be drawn bottom to top
       */

    }, {
      key: "vLine",
      value: function vLine(sd, type, x, y, w, h, inv) {
        var ky = inv ? -1 : 1,
            kx = type === 1 ? 1 : -1;

        if (type === 0)
          // Flat line
          sd.addStroke(new AWT.PathStroke('L', [x, y + h * ky]));else {
          var y0 = y + (h - h * this.baseWidthFactor) / 2 * ky,
              hb = h * this.baseWidthFactor / 12 * ky;

          // Approximation to the tooth:
          sd.addStroke(new AWT.PathStroke('L', [x, y0]));
          // This is the tooth:
          var wb = w * this.toothHeightFactor * kx / 8;
          sd.addStroke(new AWT.PathStroke('B', [x, y0 + 4 * hb, x - wb, y0 + 6 * hb, x - 3 * wb, y0 + 4 * hb]));
          sd.addStroke(new AWT.PathStroke('B', [x - 5 * wb, y0 + 2 * hb, x - 5 * wb, y0 + 10 * hb, x - 3 * wb, y0 + 8 * hb]));
          sd.addStroke(new AWT.PathStroke('B', [x - 1 * wb, y0 + 6 * hb, x, y0 + 8 * hb, x, y0 + 12 * hb]));
          // Draw the remaining line
          sd.addStroke(new AWT.PathStroke('L', [x, y + h * ky]));
        }
      }
    }]);

    return ClassicJigSaw;
  }(JigSaw);

  Object.assign(ClassicJigSaw.prototype, {
    /**
     * ClassicJigSaw needs a biggest base width
     * @name ClassicJigSaw#baseWidthFactor
     * @type {number} */
    baseWidthFactor: 3.0 / 4,
    /**
     * ClassicJigSaw needs a biggest base height factor
     * @name ClassicJigSaw#toothHeightFactor
     * @type {number} */
    toothHeightFactor: 3.0 / 5
  });

  // Register this class in the list of known shapers
  Shaper.CLASSES['@ClassicJigSaw'] = ClassicJigSaw;

  return ClassicJigSaw;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 511 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : automation/arith/Arith.js
 *  Created : 28/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(212), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, AutoContentProvider, Utils) {

  //
  // Miscellaneous constants used by Arith:
  var NMAXLOOPS = 60,
      OPSTR = ['+', '-', String.fromCharCode(215), ':'],
      RES = -12345,

  // Special blank space
  S = String.fromCharCode(160);

  /**
   * Arith provides randomly generated mental arithmetics operations, ready to be used in JClic activities.
   *
   * The operations can be additions, subtractions, multiplications or divides. The unknown of these
   * operations can be the result of the operation (`A op B = ?`), any of the two operators
   * (`A op ? = C` or `? op B = C`) or also the operator itself (`A ? B = C`).
   * @exports Arith
   * @class
   * @extends AutoContentProvider
   */

  var Arith = function (_AutoContentProvider) {
    _inherits(Arith, _AutoContentProvider);

    /**
     * Arith constructor
     * @param {JClicProject} project - The JClic project to which this provider is related
     */
    function Arith(project) {
      _classCallCheck(this, Arith);

      var _this = _possibleConstructorReturn(this, (Arith.__proto__ || Object.getPrototypeOf(Arith)).call(this, project));

      _this.opA = new Arith.Operator();
      _this.opB = new Arith.Operator();
      return _this;
    }

    /**
     * Formats the number with a fixed number of decimals, optionally filling the result with leading
     * zeroes to have a fixed number of digits.
     * @param {number} val - The value to format
     * @param {number} dec - Number of decimals
     * @param {number} pre - Minimal number of digits before dot.
     * @returns {String}
     */


    _createClass(Arith, [{
      key: "setProperties",


      /**
       * Loads the object settings from a specific JQuery XML element
       * @override
       * @param {external:jQuery} $xml - The XML element to parse
       */
      value: function setProperties($xml) {
        var _this2 = this;

        $xml.children().each(function (_n, child) {
          var $node = $(child);
          var xNum = '';
          switch (child.nodeName) {
            case 'operand':
              switch ($node.attr('id')) {
                case 'A':
                  _this2.opA.setProperties($node);
                  break;
                case 'B':
                  _this2.opB.setProperties($node);
                  break;
              }
              break;
            case 'operations':
              _this2.use_add = Utils.getBoolean($node.attr('plus'));
              _this2.use_subst = Utils.getBoolean($node.attr('minus'));
              _this2.use_mult = Utils.getBoolean($node.attr('multiply'));
              _this2.use_div = Utils.getBoolean($node.attr('divide'));
              break;
            case 'unknown':
              _this2.exp_abx = Utils.getBoolean($node.attr('result'));
              _this2.exp_xbc = Utils.getBoolean($node.attr('first'));
              _this2.exp_axc = Utils.getBoolean($node.attr('last'));
              _this2.exp_axbc = Utils.getBoolean($node.attr('operand'));
              _this2.exp_caxb = Utils.getBoolean($node.attr('inverse'));
              break;
            case 'result':
              xNum = $node.attr('from');
              _this2.resultLimInf = Utils.getNumber(xNum === 'x' ? 0 : xNum, _this2.resultLimInf);
              xNum = $node.attr('to');
              _this2.resultLimSup = Utils.getNumber(xNum === 'x' ? 0 : xNum, _this2.resultLimSup);
              _this2.resultCarry = Utils.getBoolean($node.attr('notCarry'), _this2.resultCarry);
              _this2.resultNoDup = !Utils.getBoolean($node.attr('duplicates'), !_this2.resultNoDup);
              var s = $node.attr('order');
              _this2.resultOrder = s === 'ascending' ? 'SORTASC' : s === 'descending' ? 'SORTDESC' : 'NOSORT';
              s = $node.attr('condition');
              _this2.opCond = s === 'firstBig' ? 'AGB' : s === 'lastBig' ? 'BGA' : 'INDIF';
              break;
          }
        });
        return this;
      }

      /**
       * Fills the `n` parameter (an {@link Arith.Num}) with a value in accordance with the
       * specifications of `op` (an {@link Arith.Operand}), between two limits.
       * @param {Arith.Num} n - The number
       * @param {Arith.Operator} op - The operator
       * @param {number} limInf2 - Lower limit
       * @param {number} limSup2 - Upper limit
       * @returns {boolean} - `true` if all was OK
       */

    }, {
      key: "genNum",
      value: function genNum(n, op, limInf2, limSup2) {
        var solved = false;
        n.c = op.numDec;
        var exp = n.c === 0 ? 1 : n.c === 1 ? 10 : 100;

        var ls = op.limSup;
        if (limSup2 !== RES && limSup2 < ls) ls = limSup2;
        var li = op.limInf;
        if (limInf2 !== RES && limInf2 > li) li = limInf2;

        if (op.fromList > 0) {
          n.vf = op.lst[Math.floor(Math.random() * op.fromList)];
          solved = true;
        }
        if (!solved) {
          var r = Math.floor(Math.random() * 100);
          if (op.wZero && r <= 10) {
            n.vf = 0;
            solved = true;
          } else if (op.wOne && r > 10 && r <= 20) {
            n.vf = 1;
            solved = true;
          } else if (op.wMinusOne && r > 20 && r <= 30) {
            n.vf = -1;
            solved = true;
          }
        }
        if (!solved) {
          if (li > ls) {
            var k = li;
            li = ls;
            ls = k;
          }
          var rang = Math.floor(ls - li + 1);
          if (rang < 0) rang = 1;
          var v = (Math.floor(Math.random() * rang) + li) * exp;
          if (exp > 1) v += Math.floor(Math.random() * exp);
          n.vf = v / exp;
        }
        return true;
      }

      /**
       * Fills the provided {@link Arith.Operator} with real values
       * @param {Arith.Operator} o - The operator to use to generate the operation
       * @returns {boolean} - `true` if all was OK
       */

    }, {
      key: "genOp",
      value: function genOp(o) {
        var i = void 0,
            ri2 = void 0,
            rs2 = void 0,
            q = void 0,
            va = void 0,
            vb = void 0,
            bufa = void 0,
            bufb = void 0;
        var ops = [],
            rlinf = this.resultLimInf,
            rlsup = this.resultLimSup;

        var nops = 0;
        if (this.use_add) ops[nops++] = 'SUM';
        if (this.use_subst) ops[nops++] = 'REST';
        if (this.use_mult) ops[nops++] = 'MULT';
        if (this.use_div) ops[nops++] = 'DIV';

        var op = ops[Math.floor(Math.random() * nops)];
        switch (op) {
          case 'SUM':
            for (i = 0; i < NMAXLOOPS; i++) {
              this.genNum(o.numA, this.opA, this.RES, rlsup);
              ri2 = o.numA.vf < rlinf ? rlinf - Math.floor(o.numA.vf) : this.RES;
              rs2 = rlsup - Math.floor(o.numA.vf);
              switch (this.opCond) {
                case 'AGB':
                  if (rs2 === this.RES || rs2 > o.numA.vf) rs2 = Math.floor(o.numA.vf);
                  break;
                case 'BGA':
                  if (ri2 === this.RES || ri2 < o.numA.vf) ri2 = Math.floor(o.numA.vf);
                  break;
              }
              this.genNum(o.numB, this.opB, ri2, rs2);
              o.numR.vf = o.numA.vf + o.numB.vf;
              if (o.numR.vf >= rlinf && o.numR.vf <= rlsup) break;
            }
            o.numR.c = o.numA.c > o.numB.c ? o.numA.c : o.numB.c;
            o.op = 0;
            if (this.resultCarry && o.numA.vf > 0 && o.numB.vf > 0) {
              q = o.numR.c === 2 ? 100 : o.numR.c === 1 ? 10 : 1;

              bufa = Arith.DecFormat(Math.floor(o.numA.vf * q + 0.5), 0, 10).split('');
              bufb = Arith.DecFormat(Math.floor(o.numB.vf * q + 0.5), 0, 10).split('');
              for (i = 0; i < 10; i++) {
                if (bufa[i] !== '0' || bufb[i] !== '0') break;
              }for (; i < 10; i++) {
                va = parseInt(bufa[i]);
                vb = parseInt(bufb[i]);
                if (va + vb < 10) continue;
                while (va + vb > 9) {
                  if (va > vb) va = va > 0 ? Math.floor(Math.random() * va) : 0;else vb = vb > 0 ? Math.floor(Math.random() * vb) : 0;
                }
                bufa[i] = va.toFixed(0);
                bufb[i] = vb.toFixed(0);
              }

              o.numA.vf = parseInt(bufa.join('')) / q;
              o.numB.vf = parseInt(bufb.join('')) / q;
              o.numR.vf = Math.floor(o.numA.vf + o.numB.vf + 0.5) / q;
            }
            break;

          case 'REST':
            for (i = 0; i < NMAXLOOPS; i++) {
              this.genNum(o.numA, this.opA, rlinf, this.RES);
              ri2 = o.numA.vf > rlsup ? Math.floor(o.numA.vf - rlsup) : this.RES;
              rs2 = Math.floor(o.numA.vf - rlinf);
              switch (this.opCond) {
                case 'AGB':
                  if (rs2 === this.RES || rs2 > o.numA.vf) rs2 = Math.floor(o.numA.vf);
                  break;
                case 'BGA':
                  if (ri2 === this.RES || ri2 < o.numA.vf) ri2 = Math.floor(o.numA.vf);
                  break;
              }
              this.genNum(o.numB, this.opB, ri2, rs2);
              o.numR.vf = o.numA.vf - o.numB.vf;
              if (o.numR.vf >= rlinf && o.numR.vf <= rlsup) break;
            }
            o.numR.c = o.numA.c > o.numB.c ? o.numA.c : o.numB.c;
            o.op = 1;
            if (this.resultCarry && o.numA.vf > 0 && o.numB.vf > 0 && o.numA.vf >= o.numB.vf) {
              q = o.numR.c === 2 ? 100 : o.numR.c === 1 ? 10 : 1;
              bufa = Arith.DecFormat(Math.floor(o.numA.vf * q + 0.5), 0, 10).split('');
              bufb = Arith.DecFormat(Math.floor(o.numB.vf * q + 0.5), 0, 10).split('');
              for (i = 0; i < 10; i++) {
                if (bufb[i] !== '0') break;
              }for (; i < 10; i++) {
                va = parseInt(bufa[i]);
                vb = parseInt(bufb[i]);
                if (va >= vb) continue;
                vb = va > 0 ? Math.floor(Math.random() * va) : 0;
                bufb[i] = vb.toFixed(0);
              }

              o.numA.vf = parseInt(bufa.join('')) / q;
              o.numB.vf = parseInt(bufb.join('')) / q;
              o.numR.vf = Math.floor(o.numA.vf - o.numB.vf + 0.5) / q;
            }
            break;

          case 'MULT':
            for (i = 0; i < NMAXLOOPS; i++) {
              this.genNum(o.numA, this.opA, this.RES, this.RES);
              ri2 = this.opB.limInf;
              rs2 = this.opB.limSup;
              switch (this.opCond) {
                case 'AGB':
                  if (rs2 > o.numA.vf) rs2 = Math.floor(o.numA.vf);
                  break;
                case 'BGA':
                  if (ri2 < o.numA.vf) ri2 = Math.floor(o.numA.vf);
                  break;
              }
              this.genNum(o.numB, this.opB, ri2, rs2);
              o.numR.vf = o.numA.vf * o.numB.vf;
              if (o.numR.vf >= rlinf && o.numR.vf <= rlsup) break;
            }
            o.numR.c = o.numA.c + o.numB.c;
            o.op = 2;
            break;

          case 'DIV':
            for (i = 0; i < NMAXLOOPS; i++) {
              this.genNum(o.numA, this.opA, this.RES, this.RES);
              ri2 = this.opB.limInf;
              rs2 = this.opB.limSup;
              switch (this.opCond) {
                case 'AGB':
                  if (rs2 > o.numA.vf) rs2 = Math.floor(o.numA.vf);
                  break;
                case 'BGA':
                  if (ri2 < o.numA.vf) ri2 = Math.floor(o.numA.vf);
                  break;
              }
              this.genNum(o.numB, this.opB, ri2, rs2);
              if (o.numB.vf !== 0 && Math.abs(o.numA.vf) >= Math.abs(o.numB.vf) && (o.numR.vf = o.numA.vf / o.numB.vf) >= rlinf && o.numR.vf <= rlsup) break;
            }
            if (o.numB.vf === 0) o.numB.vf = 1;
            o.numR.vf = o.numA.vf / o.numB.vf;
            i = o.numA.c - o.numB.c;
            q = Math.pow(10, i);
            o.numA.vf *= q;
            o.numR.vf *= q;
            o.numR.vf = Math.floor(o.numR.vf);
            o.numA.vf = o.numR.vf * o.numB.vf;
            o.numA.vf /= q;
            o.numR.vf /= q;
            o.numR.c = i > 0 ? i : 0;
            o.op = 3;
            break;

          default:
            return false;
        }
        return true;
      }

      /**
       * Fills the provided ActiveBagContentKit with randomly generated operations
       * @override
       * @param {AutoContentProvider.ActiveBagContentKit} kit - The composite object to be filled with data.
       * @returns {boolean} - `true` if all was OK
       */

    }, {
      key: "process",
      value: function process(kit) {
        var nRows = kit.nRows,
            nCols = kit.nCols,
            content = kit.content,
            //Array of ActiveBagContent
        useIds = kit.useIds,
            i = void 0,
            j = void 0,
            k = void 0,
            o = void 0,
            op = [],
            // Array of Arith.Operacio
        tipus = [],
            numTipus = void 0,
            tipX = void 0,
            tipInv = this.exp_caxb,
            va = '',
            vb = '',
            vc = '',
            operator = '',
            stra = [],
            strb = [],
            strc = [],
            nColsB = nCols,
            nRowsB = nRows,
            nCells = nRows * nCols,
            ass = null;

        if (nRows <= 0 || nCols <= 0 || content === null || content.length < 1 || content[0] === null) return false;

        if (nCells < 2) return false;

        numTipus = 0;
        if (this.exp_abx) tipus[numTipus++] = 'ABX';
        if (this.exp_axc) tipus[numTipus++] = 'AXC';
        if (this.exp_xbc) tipus[numTipus++] = 'XBC';
        if (this.exp_axbc) tipus[numTipus++] = 'AXBC';
        if (numTipus === 0) return false;

        for (i = 0; i < nCells; i++) {
          o = new Arith.Operacio();
          for (j = 0; j < NMAXLOOPS; j++) {
            this.genOp(o);
            if (this.resultNoDup) {
              for (k = 0; k < i; k++) {
                if (o.numR.vf === op[k].numR.vf) break;
              }
              if (k === i) break;
            } else break;
          }
          op[i] = o;
        }

        if (this.resultOrder !== 0) {
          for (i = nCells - 1; i > 0; i--) {
            for (j = 0; j < i; j++) {
              if (this.resultOrder === 'SORTASC' && op[j].numR.vf > op[j + 1].numR.vf || this.resultOrder === 'SORTDESC' && op[j].numR.vf < op[j + 1].numR.vf) {
                // Switch values
                o = op[j];
                op[j] = op[j + 1];
                op[j + 1] = o;
              }
            }
          }
        }

        for (i = 0; i < nCells; i++) {
          tipX = tipus[Math.floor(Math.random() * numTipus)];
          va = Arith.DecFormat(op[i].numA.vf, op[0].numA.c);
          vb = Arith.DecFormat(op[i].numB.vf, op[0].numB.c);
          vc = Arith.DecFormat(op[i].numR.vf, op[0].numR.c);
          operator = OPSTR[op[i].op];

          if (tipInv) strc[i] = vc + S + "=" + S + va + S + operator + S + vb;else strc[i] = va + S + operator + S + vb + S + "=" + S + vc;

          switch (tipX) {
            case 'AXC':
              strb[i] = vb;
              stra[i] = tipInv ? "" + vc + S + "=" + S + va + S + operator + S + "?" : "" + va + S + operator + S + "?" + S + "=" + S + vc;
              break;

            case 'XBC':
              strb[i] = va;
              stra[i] = tipInv ? "" + vc + S + "=" + S + "?" + S + operator + S + vb : "?" + S + operator + S + vb + S + "=" + S + vc;
              break;

            case 'AXBC':
              strb[i] = operator;
              stra[i] = tipInv ? "" + vc + S + "=" + S + va + S + "?" + S + vb : "" + va + S + "?" + S + vb + S + "=" + S + vc;
              break;

            default:
              strb[i] = vc;
              stra[i] = tipInv ? "?" + S + "=" + S + va + S + operator + S + vb : "" + va + S + operator + S + vb + S + "=";
              break;
          }
        }

        if (useIds) {
          ass = [];
          var strbx = [];
          k = 0;
          for (i = 0; i < nCells; i++) {
            for (j = 0; j < k; j++) {
              if (strb[i] === strbx[j]) break;
            }if (j === k) {
              strbx[k] = strb[i];
              ass[i] = k;
              k++;
            } else ass[i] = j;
          }

          strb = [];
          for (i = 0; i < k; i++) {
            strb[i] = strbx[i];
          }if (nRowsB * nColsB !== k) {
            var distH = false;
            switch (k) {
              case 6:
                nRowsB = distH ? 2 : 3;
                nColsB = distH ? 3 : 2;
                break;

              case 8:
                nRowsB = distH ? 2 : 4;
                nColsB = distH ? 4 : 2;
                break;

              case 9:
                nRowsB = 3;
                nColsB = 3;
                break;

              case 10:
                nRowsB = distH ? 2 : 5;
                nColsB = distH ? 5 : 2;
                break;

              case 12:
                nRowsB = distH ? 3 : 4;
                nColsB = distH ? 4 : 3;
                break;

              case 14:
                nRowsB = distH ? 2 : 7;
                nColsB = distH ? 7 : 2;
                break;

              case 15:
                nRowsB = distH ? 3 : 5;
                nColsB = distH ? 3 : 5;
                break;

              case 16:
                nRowsB = 4;
                nColsB = 4;
                break;

              case 18:
                nRowsB = distH ? 6 : 3;
                nColsB = distH ? 3 : 6;
                break;

              case 20:
                nRowsB = distH ? 4 : 5;
                nColsB = distH ? 5 : 4;
                break;

              default:
                nRowsB = distH ? 1 : k;
                nColsB = distH ? k : 1;
                break;
            }
          }
        }

        content[0].setTextContent(stra, nCols, nRows);
        if (ass !== null) content[0].setIds(ass);
        if (content.length > 1 && content[1] !== null) {
          content[1].setTextContent(strb, nColsB, nRowsB);
          content[1].getShaper().reset(nColsB, nRowsB);
        }
        if (content.length > 2 && content[2] !== null) content[2].setTextContent(strc, nCols, nRows);

        return true;
      }
    }], [{
      key: "DecFormat",
      value: function DecFormat(val, dec, pre) {
        var result = val.toFixed(dec);
        if (pre) {
          var n = result.indexOf('.');
          if (n < 0) n = result.length;
          for (; n < pre; n++) {
            result = "0" + result;
          }
        }
        return result;
      }
    }]);

    return Arith;
  }(AutoContentProvider);

  Object.assign(Arith.prototype, {
    //
    // Operations use two operators:
    /**
     * First operator
     * @name Arith#opA
     * @type {Arith.Operator} */
    opA: null,
    /**
     * Second operator
     * @name Arith#opB
     * @type {Arith.Operator} */
    opB: null,
    /**
     * Allow additions
     * @name Arith#use_add
     * @type {boolean} */
    use_add: true,
    /**
     * Allow subtractions
     * @name Arith#use_subst
     * @type {boolean} */
    use_subst: false,
    /**
     * Allow multiplications
     * @name Arith#use_mult
     * @type {boolean} */
    use_mult: false,
    /**
     * Allow divides
     * @name Arith#use_div
     * @type {boolean} */
    use_div: false,
    /**
     * Allow expressions of type `A op B = X`
     * @name Arith#exp_abx
     * @type {boolean} */
    exp_abx: true,
    /**
     * Allow expressions of type `A op X = C`
     * @name Arith#exp_axc
     * @type {boolean} */
    exp_axc: false,
    /**
     * Allow expressions of type `X op B = C`
     * @name Arith#exp_xbc
     * @type {boolean} */
    exp_xbc: false,
    /**
     * Allow expressions of type `A x B = C`
     * @name Arith#exp_axbc
     * @type {boolean} */
    exp_axbc: false,
    /**
     * Allow inverse expressions, like `C = A op B`
     * @name Arith#exp_caxb
     * @type {boolean} */
    exp_caxb: false,
    /**
     * Lower limit of the result
     * @name Arith#resultLimInf
     * @type {number} */
    resultLimInf: 0,
    /**
     * Upper limit of the result
     * @name Arith#resultLimSup
     * @type {number} */
    resultLimSup: 9999,
    /**
     * Allow carry operations
     * @see {@link https://en.wikipedia.org/wiki/Carry_(arithmetic)}
     * @name Arith#resultCarry
     * @type {boolean} */
    resultCarry: false,
    /**
     * Avoid operations with the same result
     * @name Arith#resultNoDup
     * @type {boolean} */
    resultNoDup: false,
    /**
     * Type of sorting of results. Possible values are: 'NOSORT', 'SORTASC' and 'SORTDESC'
     * @name Arith#resultOrder
     * @type {string} */
    resultOrder: 'NOSORT',
    /**
     * Sorting of the operands in commutative operations. Possible values are: 'AGB' (_A greater than B_),
     * 'BGA' (_B greater tan A_) and 'INDIF' (default)
     * @name Arith#opCond
     * @type {string} */
    opCond: 'INDIF'
  });

  /**
   * Operator is an Utility class used by Arith to encapsulate the properties and methods related
   * to the members of the operations.
   * @class
   */
  Arith.Operator = function () {
    function _class() {
      _classCallCheck(this, _class);

      this.limInf = 13;
      this.limSup = 17;
      this.lst = [];
    }

    /**
     * Loads Arith.Operator settings from a specific JQuery XML element
     * @param {external:jQuery} $xml - The XML element to parse
     */


    _createClass(_class, [{
      key: "setProperties",
      value: function setProperties($xml) {
        var _this3 = this;

        // Read attributes
        Utils.attrForEach($xml.get(0).attributes, function (name, val) {
          switch (name) {
            case 'decimals':
              _this3.numDec = Number(val);
              break;

            case 'values':
              var values = val.split(' ');
              for (var i = 0; i < values.length; i++) {
                _this3.lst[i] = Number(values[i]);
              }_this3.fromList = _this3.lst.length;
              break;

            case 'from':
              _this3.limInf = Number(val === 'x' ? 0 : val);
              break;

            case 'to':
              _this3.limSup = Number(val === 'x' ? 0 : val);
              break;
          }

          $xml.children().each(function (_n, child) {
            var $node = $(child);
            switch (child.nodeName) {
              case 'include':
                _this3.wZero = Utils.getBoolean($node.attr('zero'));
                _this3.wOne = Utils.getBoolean($node.attr('one'));
                _this3.wMinusOne = Utils.getBoolean($node.attr('minusOne'));
                break;
            }
          });
        });
        return this;
      }
    }]);

    return _class;
  }();

  Object.assign(Arith.Operator.prototype, {
    /**
     * Lower limit
     * @name Arith.Operator#limInf
     * @type {number} */
    limInf: 0,
    /**
     * Upper limit
     * @name Arith.Operator#limSup
     * @type {number} */
    limSup: 10,
    /**
     * Number of decimal places
     * @name Arith.Operator#numDec
     * @type {number} */
    numDec: 0,
    /**
     * Including 0
     * @name Arith.Operator#wZero
     * @type {boolean} */
    wZero: false,
    /**
     * Including 1
     * @name Arith.Operator#wOne
     * @type {boolean} */
    wOne: false,
    /**
     * Including -1
     * @name Arith.Operator#wMinusOne
     * @type {boolean} */
    wMinusOne: false,
    /**
     * Take values from list. This member stores the list length.
     * @name Arith.Operator#fromList
     * @type {number} */
    fromList: 0,
    /**
     * The list of possible values
     * @name Arith.Operator#lst
     * @type {number[]} */
    lst: []
  });

  Arith.Num = function () {
    function _class2() {
      _classCallCheck(this, _class2);

      this.vf = 0.0; // The number value
      this.c = 0; // Number of decimals to be used when representing the number
    }

    _createClass(_class2, [{
      key: "format",
      value: function format() {
        return Arith.DecFormat(this.vf, this.c);
      }
    }]);

    return _class2;
  }();

  Arith.Operacio = function () {
    function _class3() {
      _classCallCheck(this, _class3);

      this.numA = new Arith.Num();
      this.numB = new Arith.Num();
      this.numR = new Arith.Num();
      this.op = 0;
    }

    return _class3;
  }();

  // Register class in AutoContentProvider.CLASSES
  AutoContentProvider.CLASSES['@arith.Arith'] = Arith;

  return Arith;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 512 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/text/FillInBlanks.js
 *  Created : 20/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2016 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2), __webpack_require__(13), __webpack_require__(76)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Utils, Activity, TextActivityBase) {

  /**
   * In this type of activity the text document has some blanks that must be filled-in. The blanks
   * can be drop-down boxes or text fields (empty or pre-filled with an initial text). Blanks can
   * also have associated clues, shown as "pop-ups".
   * @exports FillInBlanks
   * @class
   * @extends TextActivityBase
   */
  var FillInBlanks = function (_TextActivityBase) {
    _inherits(FillInBlanks, _TextActivityBase);

    /**
     * FillInBlanks constructor
     * @param {JClicProject} project - The {@link JClicProject} to which this activity belongs
     */
    function FillInBlanks(project) {
      _classCallCheck(this, FillInBlanks);

      return _possibleConstructorReturn(this, (FillInBlanks.__proto__ || Object.getPrototypeOf(FillInBlanks)).call(this, project));
    }

    /**
     * This kind of activity usually makes use of the keyboard
     * @override
     * @returns {boolean}
     */


    _createClass(FillInBlanks, [{
      key: "needsKeyboard",
      value: function needsKeyboard() {
        return true;
      }
    }]);

    return FillInBlanks;
  }(TextActivityBase);

  Object.assign(FillInBlanks.prototype, {
    /**
     * Whether to jump or not to the next target when the current one is solved.
     * @name FillInBlanks#autoJump
     * @type {boolean} */
    autoJump: false,
    /**
     * Whether to block or not the jump to other targets until the current one
     * is resolved.
     * @name FillInBlanks#forceOkToAdvance
     * @type {boolean} */
    forceOkToAdvance: false
  });

  /**
   * The {@link TextActivityBasePanel} where {@link FillInBlanks} activities are played.
   * @class
   * @extends TextActivityBasePanel
   */

  var FillInBlanksPanel = function (_TextActivityBase$Pan) {
    _inherits(FillInBlanksPanel, _TextActivityBase$Pan);

    /**
     * FillInBlanksPanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function FillInBlanksPanel(act, ps, $div) {
      _classCallCheck(this, FillInBlanksPanel);

      return _possibleConstructorReturn(this, (FillInBlanksPanel.__proto__ || Object.getPrototypeOf(FillInBlanksPanel)).call(this, act, ps, $div));
    }

    /**
     * Creates a target DOM element for the provided target. This DOM element can be an editable
     * `span` or a `select` with specific `option` elements (when the target is a drop-down list)
     * @override
     * @param {TextActivityDocument.TextTarget} target - The target related to the DOM object to be created
     * @param {external:jQuery} $span -  - An initial DOM object (usually a `span`) that can be used
     * to store the target, or replaced by another type of object.
     * @returns {external:jQuery} - The jQuery DOM element loaded with the target data.
     */


    _createClass(FillInBlanksPanel, [{
      key: "$createTargetElement",
      value: function $createTargetElement(target, $span) {
        var _this3 = this;

        $span.addClass('JClicTextTarget');

        var idLabel = "target" + ("000" + (this.targets.length - 1)).slice(-3);
        if (target.isList && target.options && target.options.length > 0) {
          // Use a `select` element
          $span = $('<select/>', { id: idLabel, name: idLabel });
          if (target.options[0].trim() !== '') $('<option selected/>', { value: '', text: '' }).appendTo($span);
          target.options.forEach(function (op) {
            return $('<option/>', { value: op, text: op }).appendTo($span);
          });
          target.$comboList = $span.bind('focus change', function (event) {
            event.textTarget = target;
            _this3.processEvent(event);
          });
        } else {
          // Use a `span` element with the `contentEditable` attribute set `on`
          target.currentText = target.iniText ? target.iniText : Utils.fillString(target.iniChar, target.numIniChars);

          target.$span = $span.text(target.currentText).attr({
            contenteditable: 'true',
            id: idLabel,
            autocomplete: 'off',
            spellcheck: 'false'
          }).bind('focus input blur', function (event) {
            event.textTarget = target;
            _this3.processEvent(event);
          }).bind('keydown keyup', function (event) {
            // Catch `enter` key in Firefox
            if (event.keyCode === 13) {
              event.preventDefault();
              if (event.type === 'keydown') {
                // Simulate a `blur` event
                event.textTarget = target;
                event.type = 'blur';
                _this3.processEvent(event);
              }
            }
          });
        }
        return $span;
      }

      /**
       * Evaluates all the targets in this panel. This method is usually called from the `Check` button.
       * @override
       * @returns {boolean} - `true` when all targets are OK, `false` otherwise.
       */

    }, {
      key: "evaluatePanel",
      value: function evaluatePanel() {
        var _this4 = this;

        var targetsOk = 0;
        var numTargets = this.targets.length;
        this.targets.forEach(function (target) {
          var result = _this4.act.ev.evalText(target.readCurrentText(), target.answers),
              ok = _this4.act.ev.isOk(result);
          target.targetStatus = ok ? 'SOLVED' : 'WITH_ERROR';
          if (ok) targetsOk++;
          _this4.markTarget(target, result);
          _this4.ps.reportNewAction(_this4.act, 'WRITE', target.currentText, target.getAnswers(), ok, targetsOk);
        });
        if (targetsOk === numTargets) {
          this.finishActivity(true);
          return true;
        } else this.playEvent('finishedError');
        return false;
      }

      /**
       * Checks if the specified TextTarget has a valid answer in its `currentText` field
       * @param {TextActivityDocument.TextTarget} target - The target to check
       * @param {boolean} onlyCheck - When `true`, the cursor will no be re-positioned
       * @param {number=} jumpDirection - `1` to go forward, `-1` to go back.
       * @returns {boolean} - `true` when the target contains a valid answer
       */

    }, {
      key: "checkTarget",
      value: function checkTarget(target, onlyCheck, jumpDirection) {
        var result = this.act.ev.evalText(target.currentText, target.answers),
            ok = this.act.ev.isOk(result);

        target.targetStatus = ok ? 'SOLVED' : 'WITH_ERROR';
        if (onlyCheck) return ok;

        this.markTarget(target, result);
        var targetsOk = this.countSolvedTargets(false, false);
        if (target.currentText.length > 0) this.ps.reportNewAction(this.act, 'WRITE', target.currentText, target.getAnswers(), ok, targetsOk);
        if (ok && targetsOk === this.targets.length) {
          this.finishActivity(true);
          return ok;
        } else if (target.currentText.length > 0) this.playEvent(ok ? 'actionOk' : 'actionError');

        if (jumpDirection && jumpDirection !== 0) {
          var p = target.num + jumpDirection;
          if (p >= this.targets.length) p = 0;else if (p < 0) p = this.targets.length - 1;

          var destTarget = this.targets[p];
          if (destTarget.$span) {
            destTarget.$span.focus();
            Utils.setSelectionRange(destTarget.$span.get(-1), 0, 0);
          } else if (destTarget.$comboList) destTarget.$comboList.focus();
        }
        return ok;
      }

      /**
       * Counts the number of targets with `SOLVED` status
       * @param {boolean} checkNow - When `true`, all targets will be evaluated. Otherwise, only the
       * current value of `targetStatus` will be checked.
       * @param {boolean=} mark - When `true`, errors in the target answer will be marked.
       * @returns {number} - The number of targets currently solved.
       */

    }, {
      key: "countSolvedTargets",
      value: function countSolvedTargets(checkNow, mark) {
        var _this5 = this;

        return this.targets.reduce(function (n, target) {
          if (checkNow) {
            target.readCurrentText();
            _this5.checkTarget(target, !mark);
          }
          return target.targetStatus === 'SOLVED' ? ++n : n;
        }, 0);
      }

      /**
       * Visually marks the target as 'solved OK' or 'with errors'.
       * @param {TextActivityDocument.TextTarget} target - The text target to be marked.
       * @param {number[]} attributes -  - Array of flags indicating the status (OK or error) for each
       * character in `target.currentText`.
       */

    }, {
      key: "markTarget",
      value: function markTarget(target, attributes) {
        if (target.$comboList || this.act.ev.isOk(attributes)) target.checkColors();else if (target.$span) {
          // Identify text fragments
          var txt = target.currentText,
              fragments = [];
          var currentStatus = -1,
              currentFragment = -1,
              i = 0;
          for (; i < attributes.length && i < txt.length; i++) {
            if (attributes[i] !== currentStatus) {
              fragments[++currentFragment] = '';
              currentStatus = attributes[i];
            }
            fragments[currentFragment] += txt.charAt(i);
          }
          if (i < txt.length) fragments[currentFragment] += txt.substr(i);
          // Empty and re-fill $span
          target.$span.empty();
          currentStatus = attributes[0];
          fragments.forEach(function (fragment) {
            $('<span/>').text(fragment).css(target.doc.style[currentStatus === 0 ? 'target' : 'targetError'].css).appendTo(target.$span);
            currentStatus ^= 1;
          });
        }
        // Target has been marked, so clear the 'modified' flag
        target.flagModified = false;
      }

      /**
       * Called by {@link JClicPlayer} when this activity panel is fully visible, just after the
       * initialization process.
       * @override
       */

    }, {
      key: "activityReady",
      value: function activityReady() {
        _get(FillInBlanksPanel.prototype.__proto__ || Object.getPrototypeOf(FillInBlanksPanel.prototype), "activityReady", this).call(this);

        // Prevent strange behavior with GoogleChrome when `white-space` CSS attribute is set to
        // `pre-wrap` (needed for tabulated texts)
        $('.JClicTextTarget').css('white-space', 'normal');
        if (this.targets.length > 0 && this.targets[0].$span) this.targets[0].$span.focus();
      }

      /**
       * Ordinary ending of the activity, usually called form `processEvent`
       * @override
       * @param {boolean} result - `true` if the activity was successfully completed, `false` otherwise
       */

    }, {
      key: "finishActivity",
      value: function finishActivity(result) {
        this.targets.forEach(function (target) {
          if (target.$span) target.$span.removeAttr('contenteditable').blur();else if (target.$comboList) target.$comboList.attr('disabled', 'true').blur();
        });
        return _get(FillInBlanksPanel.prototype.__proto__ || Object.getPrototypeOf(FillInBlanksPanel.prototype), "finishActivity", this).call(this, result);
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events.
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (!_get(FillInBlanksPanel.prototype.__proto__ || Object.getPrototypeOf(FillInBlanksPanel.prototype), "processEvent", this).call(this, event)) return false;

        var target = event.textTarget;
        var $span = null,
            pos = 0;
        switch (event.type) {
          case 'focus':
            if (target) {
              if (target.$span && target.$span.children().length > 0) {
                // Clear inner spans used to mark errors
                $span = target.$span;
                pos = Math.min(target.currentText.length, Utils.getCaretCharacterOffsetWithin($span.get(-1)));
                $span.empty();
                $span.text(target.currentText);
                Utils.setSelectionRange($span.get(-1), pos, pos);
                target.flagModified = true;
              } else if (target.$comboList) target.$comboList.css(target.doc.style['target'].css);

              if (target.$popup && (target.infoMode === 'always' || target.infoMode === 'onError' && target.targetStatus === 'WITH_ERROR')) this.showPopup(target.$popup, target.popupMaxTime, target.popupDelay);else this.showPopup(null);
            }
            break;

          case 'blur':
            if (target.flagModified && !this.$checkButton) this.checkTarget(target, false, 1);
            break;

          case 'input':
            if (target && target.$span) {
              $span = target.$span;
              var txt = $span.html();
              // Check for `enter` key
              if (/(<br>|\n|\r)/.test(txt)) {
                txt = txt.replace(/(<br>|\n|\r)/g, '');
                $span.html(txt);
                target.currentText = $span.text();
                return this.$checkButton ? false : this.checkTarget(target, false, 1);
              }
              // Check if text has changed
              // From here, use 'text' instead of 'html' to avoid HTML entities
              txt = $span.text();
              if (txt !== target.currentText) {
                // Span text has changed!
                target.flagModified = true;
                var added = txt.length - target.currentText.length;
                if (added > 0) {
                  if (txt.indexOf(target.iniChar) >= 0) {
                    // Remove filling chars
                    pos = Utils.getCaretCharacterOffsetWithin($span.get(-1));
                    for (var i = 0; i < added; i++) {
                      var p = txt.indexOf(target.iniChar);
                      if (p < 0) break;
                      txt = txt.substr(0, p) + txt.substr(p + 1);
                      if (p < pos) pos--;
                    }
                    $span.text(txt);
                    Utils.setSelectionRange($span.get(-1), pos, pos);
                  }

                  // Check if current text exceeds max length
                  if (txt.length > target.maxLenResp) {
                    pos = Utils.getCaretCharacterOffsetWithin($span.get(-1));
                    txt = txt.substr(0, target.maxLenResp);
                    pos = Math.min(pos, txt.length);
                    $span.text(txt);
                    Utils.setSelectionRange($span.get(-1), pos, pos);
                  }
                } else if (txt === '') {
                  txt = target.iniChar;
                  $span.text(txt);
                  Utils.setSelectionRange($span.get(-1), 0, 0);
                }
                target.currentText = txt;
              }
            }
            break;

          case 'change':
            if (target && target.$comboList) {
              target.currentText = target.$comboList.val();
              target.flagModified = true;
              return this.$checkButton ? false : this.checkTarget(target, false, 1);
            }
            break;

          default:
            break;
        }
        return true;
      }
    }]);

    return FillInBlanksPanel;
  }(TextActivityBase.Panel);

  Object.assign(FillInBlanksPanel.prototype, {
    /**
     * Flag indicating if the activity is open or locked
     * @name FillInBlanksPanel#locked
     * @type {boolean} */
    locked: true
  });

  /**
   * Panel class associated to this type of activity: {@link FillInBlanksPanel}
   * @type {class} */
  FillInBlanks.Panel = FillInBlanksPanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@text.FillInBlanks'] = FillInBlanks;

  return FillInBlanks;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 513 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/text/OrderText.js
 *  Created : 20/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(76), __webpack_require__(58), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, TextActivityBase, BoxConnector, AWT) {

  /**
   * In this type of text activity users must put in order some words or paragraphs that have been
   * initially scrambled.
   * @exports OrderText
   * @class
   * @extends TextActivityBase
   */
  var OrderText = function (_TextActivityBase) {
    _inherits(OrderText, _TextActivityBase);

    /**
     * OrderText constructor
     * @param {JClicProject} project - The project to which this activity belongs
     */
    function OrderText(project) {
      _classCallCheck(this, OrderText);

      return _possibleConstructorReturn(this, (OrderText.__proto__ || Object.getPrototypeOf(OrderText)).call(this, project));
    }

    /**
     * Whether or not the activity uses random to scramble internal components
     * @override
     * @returns {boolean}
     */


    _createClass(OrderText, [{
      key: "hasRandom",
      value: function hasRandom() {
        return true;
      }

      /**
       * When `true`, the activity must always be scrambled
       * @override
       * @returns {boolean}
       */

    }, {
      key: "shuffleAlways",
      value: function shuffleAlways() {
        return true;
      }

      /**
       * Whether the activity allows the user to request help.
       * @override
       * @returns {boolean}
       */

    }, {
      key: "helpSolutionAllowed",
      value: function helpSolutionAllowed() {
        return true;
      }
    }]);

    return OrderText;
  }(TextActivityBase);

  Object.assign(OrderText.prototype, {
    /**
     * Whether to allow or not to scramble words among different paragraphs.
     * @name OrderText#amongParagraphs
     * @type {boolean} */
    amongParagraphs: false,
    /**
     * The box connector
     * @name OrderText#bc
     * @type {BoxConnector} */
    bc: null
  });

  /**
   * The {@link TextActivityBasePanel} where {@link OrderText} activities are played.
   * @class
   * @extends TextActivityBasePanel
   */

  var OrderTextPanel = function (_TextActivityBase$Pan) {
    _inherits(OrderTextPanel, _TextActivityBase$Pan);

    /**
     * OrderTextPanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function OrderTextPanel(act, ps, $div) {
      _classCallCheck(this, OrderTextPanel);

      return _possibleConstructorReturn(this, (OrderTextPanel.__proto__ || Object.getPrototypeOf(OrderTextPanel)).call(this, act, ps, $div));
    }

    /**
     * Prepares the text panel
     * @override
     */


    _createClass(OrderTextPanel, [{
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        this.act.document.style['target'].css.cursor = 'pointer';
        _get(OrderTextPanel.prototype.__proto__ || Object.getPrototypeOf(OrderTextPanel.prototype), "buildVisualComponents", this).call(this);
      }

      /**
       * Sets the size and position of this activity panel
       * @override
       * @param {AWT.Rectangle} rect
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect) {
        if (this.$canvas) this.$canvas.remove();

        _get(OrderTextPanel.prototype.__proto__ || Object.getPrototypeOf(OrderTextPanel.prototype), "setBounds", this).call(this, rect);
        if (!this.act.dragCells) {
          // Create the main canvas
          this.$canvas = $("<canvas width=\"" + rect.dim.width + "\" height=\"" + rect.dim.height + "\"/>").css({
            position: 'absolute',
            top: 0,
            left: 0,
            'pointer-events': 'none'
          });
          this.$div.append(this.$canvas);

          // Create a [BoxConnector](BoxConnector.html) and attach it to the canvas context
          this.bc = new BoxConnector(this, this.$canvas.get(-1).getContext('2d'));
          this.bc.compositeOp = this.bc.DEFAULT_COMPOSITE_OP;

          // Repaint all
          this.invalidate().update();
        }
      }

      /**
       * Creates a target DOM element for the provided target.
       * @override
       * @param {TextActivityDocument.TextTarget} target - The target related to the DOM object to be created
       * @param {external:jQuery} $span -  - An initial DOM object (usually a `span`) that can be used
       * to store the target, or replaced by another type of object.
       * @returns {external:jQuery} - The jQuery DOM element loaded with the target data.
       */

    }, {
      key: "$createTargetElement",
      value: function $createTargetElement(target, $span) {
        var _this3 = this;

        _get(OrderTextPanel.prototype.__proto__ || Object.getPrototypeOf(OrderTextPanel.prototype), "$createTargetElement", this).call(this, target, $span);
        var idLabel = "target" + ("000" + (this.targets.length - 1)).slice(-3);
        $span.addClass('JClicTextTarget').bind('click', function (event) {
          event.textTarget = target;
          event.idLabel = idLabel;
          _this3.processEvent(event);
        });
        return $span;
      }

      /**
       * Swaps the position of two targets in the document
       * @param {TextActivityDocument.TextTarget} t1 - One target
       * @param {TextActivityDocument.TextTarget} t2 - Another target
       */

    }, {
      key: "swapTargets",
      value: function swapTargets(t1, t2) {
        var $span1 = t1.$span,
            $span2 = t2.$span,
            $marker = $('<span/>');
        $marker.insertAfter($span2);
        $span2.detach();
        $span2.insertAfter($span1);
        $span1.detach();
        $span1.insertAfter($marker);
        $marker.remove();

        var pos = t1.pos,
            $p = t1.$p;
        t1.pos = t2.pos;
        t1.$p = t2.$p;
        t2.pos = pos;
        t2.$p = $p;
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(OrderTextPanel.prototype.__proto__ || Object.getPrototypeOf(OrderTextPanel.prototype), "initActivity", this).call(this);
        if (!this.firstRun) this.buildVisualComponents();else this.firstRun = false;
      }

      /**
       * Called when the activity starts playing
       * @override
       */

    }, {
      key: "startActivity",
      value: function startActivity() {
        var _this4 = this;

        _get(OrderTextPanel.prototype.__proto__ || Object.getPrototypeOf(OrderTextPanel.prototype), "startActivity", this).call(this);
        if (!this.showingPrevScreen) {
          if (this.act.type === 'orderWords' && !this.act.amongParagraphs) {
            // Group targets by paragraph
            var groups = [];
            var lastTarget = null,
                currentGroup = [];
            this.targets.forEach(function (t) {
              if (lastTarget !== null && lastTarget.$p !== t.$p) {
                groups.push(currentGroup);
                currentGroup = [];
              }
              currentGroup.push(t);
              lastTarget = t;
            });
            if (currentGroup.length > 0) groups.push(currentGroup);

            // Scramble group by group
            groups.forEach(function (group) {
              return _this4.shuffleTargets(group, _this4.act.shuffles);
            });
          } else this.shuffleTargets(this.targets, this.act.shuffles);

          this.playing = true;
        }
        this.setBounds(this);
      }

      /**
       * Randomly shuffles a set of targets
       * @param {TextActivityDocument.TextTarget[]} targets - The set of targets to shuffle (can be all
       * document targets or just the targets belonging to the same paragraph, depending on the value of
       * `amongParagraphs` in {@link Activity}.
       * @param {number} steps - The number of times to shuffle the elements
       */

    }, {
      key: "shuffleTargets",
      value: function shuffleTargets(targets, steps) {
        var nt = targets.length;
        if (nt > 1) {
          var repeatCount = 100;
          for (var i = 0; i < steps; i++) {
            var r1 = Math.floor(Math.random() * nt),
                r2 = Math.floor(Math.random() * nt);
            if (r1 !== r2) {
              this.swapTargets(targets[r1], targets[r2]);
            } else {
              if (--repeatCount) i++;
            }
          }
        }
      }

      /**
       * Sets the current target
       * @param {TextActivityDocument.TextTarget} target - The currently selected target. Can be `null`.
       */

    }, {
      key: "setCurrentTarget",
      value: function setCurrentTarget(target) {
        var targetCss = this.act.document.getFullStyle('target').css;
        if (this.currentTarget && this.currentTarget.$span) this.currentTarget.$span.css(targetCss);
        if (target && target.$span) {
          target.$span.css({
            color: targetCss['background-color'],
            'background-color': targetCss.color
          });
        }
        this.currentTarget = target;
      }

      /**
       * Counts the number of targets that are at right position
       * @returns {number}
       */

    }, {
      key: "countSolvedTargets",
      value: function countSolvedTargets() {
        return this.targets.reduce(function (n, target) {
          return target.num === target.pos ? ++n : n;
        }, 0);
      }

      /**
       * Evaluates all the targets in this panel. This method is usually called from the `Check` button.
       * @override
       * @returns {boolean} - `true` when all targets are OK, `false` otherwise.
       */

    }, {
      key: "evaluatePanel",
      value: function evaluatePanel() {
        var _this5 = this;

        if (this.bc && this.bc.active) this.bc.end();
        this.setCurrentTarget(null);

        var targetsOk = 0;
        this.targets.forEach(function (target) {
          var ok = target.num === target.pos;
          target.targetStatus = ok ? 'SOLVED' : 'WITH_ERROR';
          if (ok) targetsOk++;
          target.checkColors();
          _this5.ps.reportNewAction(_this5.act, 'PLACE', target.text, target.pos, ok, targetsOk);
        });
        if (targetsOk === this.targets.length) {
          this.finishActivity(true);
          return true;
        } else {
          this.playEvent('finishedError');
        }
        return false;
      }

      /**
       * Ordinary ending of the activity, usually called form `processEvent`
       * @override
       * @param {boolean} result - `true` if the activity was successfully completed, `false` otherwise
       */

    }, {
      key: "finishActivity",
      value: function finishActivity(result) {
        $('.JClicTextTarget').css('cursor', 'pointer');
        return _get(OrderTextPanel.prototype.__proto__ || Object.getPrototypeOf(OrderTextPanel.prototype), "finishActivity", this).call(this, result);
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events.
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (!_get(OrderTextPanel.prototype.__proto__ || Object.getPrototypeOf(OrderTextPanel.prototype), "processEvent", this).call(this, event)) return false;

        var target = event.textTarget;
        var p = null;
        if (this.bc && this.playing && !this.showingPrevScreen) {
          //
          // _touchend_ event don't provide pageX nor pageY information
          if (event.type === 'touchend') p = this.bc.active ? this.bc.dest.clone() : new AWT.Point();else {
            // Touch events can have more than one touch, so `pageX` must be obtained from `touches[0]`
            var x = event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX,
                y = event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY;
            p = new AWT.Point(x - this.$div.offset().left, y - this.$div.offset().top);
          }

          switch (event.type) {
            case 'click':
              if (target && target !== this.currentTarget) {
                if (this.currentTarget) {
                  if (this.bc && this.bc.active) this.bc.end();
                  this.swapTargets(target, this.currentTarget);
                  this.setCurrentTarget(null);

                  if (!this.$checkButton) {
                    // Check and notify action
                    var cellsAtPlace = this.countSolvedTargets(),
                        ok = target.pos === target.num;
                    this.ps.reportNewAction(this.act, 'PLACE', target.text, target.pos, ok, cellsAtPlace);

                    // End activity or play event sound
                    if (ok && cellsAtPlace === this.targets.length) this.finishActivity(true);else this.playEvent(ok ? 'actionOk' : 'actionError');
                  }
                } else {
                  this.setCurrentTarget(target);
                  this.bc.begin(p);
                  this.playEvent('click');
                }
              }
              break;

            case 'mousemove':
              this.bc.moveTo(p);
              break;

            default:
              break;
          }
          event.preventDefault();
          return true;
        }
      }
    }]);

    return OrderTextPanel;
  }(TextActivityBase.Panel);

  // Properties and methods specific to OrderTextPanel


  Object.assign(OrderTextPanel.prototype, {
    /**
     * Currently selected text target
     * @name OrderTextPanel#currentTarget
     * @type {TextActivityDocument.TextTarget} */
    currentTarget: null,
    /**
     * The box connector
     * @name OrderTextPanel#bc
     * @type {BoxConnector} */
    bc: null,
    /**
     * List of mouse, touch and keyboard events intercepted by this panel
     * @override
     * @name OrderTextPanel#events
     * @type {string[]} */
    events: ['click', 'mousemove']
  });

  /**
   * Panel class associated to this type of activity: {@link OrderTextPanel}
   * @type {class} */
  OrderText.Panel = OrderTextPanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@text.Order'] = OrderText;

  return OrderText;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 514 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/text/Identify.js
 *  Created : 20/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(76)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, TextActivityBase) {

  /**
   * This type of text activity suggests users to click on specific words or single letters of a
   * given text, without any help on where these elements are placed.
   * @exports IdentifyText
   * @class
   * @extends TextActivityBase
   */
  var IdentifyText = function (_TextActivityBase) {
    _inherits(IdentifyText, _TextActivityBase);

    /**
     * IdentifyText constructor
     * @param {JClicProject} project - The project to which this activity belongs
     */
    function IdentifyText(project) {
      _classCallCheck(this, IdentifyText);

      return _possibleConstructorReturn(this, (IdentifyText.__proto__ || Object.getPrototypeOf(IdentifyText)).call(this, project));
    }

    return IdentifyText;
  }(TextActivityBase);

  /**
   * The {@link TextActivityBasePanel} where {@link IdentifyText} activities are played.
   * @class
   * @extends TextActivityBasePanel
   */


  var IdentifyTextPanel = function (_TextActivityBase$Pan) {
    _inherits(IdentifyTextPanel, _TextActivityBase$Pan);

    /**
     * IdentifyTextPanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function IdentifyTextPanel(act, ps, $div) {
      _classCallCheck(this, IdentifyTextPanel);

      return _possibleConstructorReturn(this, (IdentifyTextPanel.__proto__ || Object.getPrototypeOf(IdentifyTextPanel)).call(this, act, ps, $div));
    }

    /**
     * Creates a target DOM element for the provided target.
     * @override
     * @param {TextActivityDocument.TextTarget} target - The target related to the DOM object to be created
     * @param {external:jQuery} $span -  - An initial DOM object (usually a `span`) that can be used
     * to store the target, or replaced by another type of object.
     * @returns {external:jQuery} - The jQuery DOM element loaded with the target data.
     */


    _createClass(IdentifyTextPanel, [{
      key: "$createTargetElement",
      value: function $createTargetElement(target, $span) {
        var _this3 = this;

        _get(IdentifyTextPanel.prototype.__proto__ || Object.getPrototypeOf(IdentifyTextPanel.prototype), "$createTargetElement", this).call(this, target, $span);
        var idLabel = "target" + ("000" + (this.targets.length - 1)).slice(-3);
        $span.bind('click', function (event) {
          event.textTarget = target;
          event.idLabel = idLabel;
          _this3.processEvent(event);
        });
        return $span;
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(IdentifyTextPanel.prototype.__proto__ || Object.getPrototypeOf(IdentifyTextPanel.prototype), "initActivity", this).call(this, this);
        this.$div.find('.JClicTextDocument > p').css('cursor', 'pointer');
        this.playing = true;
      }

      /**
       * Counts the number of targets that are solved
       * @returns {number}
       */

    }, {
      key: "countSolvedTargets",
      value: function countSolvedTargets() {
        return this.targets.length.reduce(function (n, target) {
          return target.targetStatus === 'SOLVED' ? ++n : n;
        }, 0);
      }

      /**
       * Evaluates all the targets in this panel. This method is usually called from the `Check` button.
       * @override
       * @returns {boolean} - `true` when all targets are OK, `false` otherwise.
       */

    }, {
      key: "evaluatePanel",
      value: function evaluatePanel() {
        var _this4 = this;

        var targetsOk = 0;
        this.targets.forEach(function (target) {
          var ok = target.targetStatus === 'SOLVED';
          if (ok) targetsOk++;
          target.checkColors();
          _this4.ps.reportNewAction(_this4.act, 'SELECT', target.text, target.pos, ok, targetsOk);
        });
        if (targetsOk === this.targets.length) {
          this.finishActivity(true);
          return true;
        } else this.playEvent('finishedError');
        return false;
      }

      /**
       * Ordinary ending of the activity, usually called form `processEvent`
       * @override
       * @param {boolean} result - `true` if the activity was successfully completed, `false` otherwise
       */

    }, {
      key: "finishActivity",
      value: function finishActivity(result) {
        this.$div.find('.JClicTextDocument > p').css('cursor', 'pointer');
        return _get(IdentifyTextPanel.prototype.__proto__ || Object.getPrototypeOf(IdentifyTextPanel.prototype), "finishActivity", this).call(this, result);
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events.
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (!_get(IdentifyTextPanel.prototype.__proto__ || Object.getPrototypeOf(IdentifyTextPanel.prototype), "processEvent", this).call(this, event) || event.timeStamp === this.lastTimeStamp) return false;

        if (event.timeStamp) this.lastTimeStamp = event.timeStamp;

        var target = event.textTarget;
        switch (event.type) {
          case 'click':
            var text = void 0,
                pos = void 0,
                ok = false;
            if (target) {
              if (target.targetStatus === 'SOLVED') target.targetStatus = 'HIDDEN';else {
                target.targetStatus = 'SOLVED';
                ok = true;
              }
              text = target.text;
              pos = target.pos;
              // TODO: Just on/off target colors, don't mark it as error!
              target.checkColors();
            } else {
              // TODO: Get current text at click position, perhaps using [window|document].getSelection
              text = 'unknown';
              pos = 0;
            }

            if (!this.$checkButton) {
              // Check and notify action
              var cellsAtPlace = this.countSolvedTargets();
              this.ps.reportNewAction(this.act, 'SELECT', text, pos, ok, cellsAtPlace);

              // End activity or play event sound
              if (ok && cellsAtPlace === this.targets.length) this.finishActivity(true);else this.playEvent(ok ? 'actionOk' : 'actionError');
            }
            event.preventDefault();
            break;

          default:
            break;
        }
        return true;
      }
    }]);

    return IdentifyTextPanel;
  }(TextActivityBase.Panel);

  Object.assign(IdentifyTextPanel.prototype, {
    /**
     * Flag indicating if targets must be visually marked when the activity begins. In this type of
     * activity should be always `false` to avoid revealing the words o letters that must be found.
     * @name IdentifyTextPanel#targetsMarked
     * @type {boolean} */
    targetsMarked: false,
    /**
     * Used to avoid duplicate event processing
     * @name IdentifyTextPanel#lastTimeStamp
     * @type {number}
     */
    lastTimeStamp: 0
  });

  /**
   * Panel class associated to this type of activity: {@link IdentifyTextPanel}
   * @type {class} */
  IdentifyText.Panel = IdentifyTextPanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@text.Identify'] = IdentifyText;

  return IdentifyText;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 515 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/text/WrittenAnswer.js
 *  Created : 04/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(35), __webpack_require__(24), __webpack_require__(3), __webpack_require__(2), __webpack_require__(75)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, ActiveBoxGrid, BoxBag, AWT, Utils, Rectangular) {

  /**
   * This class of {@link Activity} shows a panel with {@link ActiveBox} objects acting as cells
   * with questions. The answers to these questions must be written in a separate text field.
   *
   * The ActiveBox objects are filled with data stored in {@link ActiveBagContent} repositories.
   *
   * A second {@link ActiveBagContent} can be used as alternative content, revealed as the questions
   * are solved.
   * @exports WrittenAnswer
   * @class
   * @extends Activity
   */
  var WrittenAnswer = function (_Activity) {
    _inherits(WrittenAnswer, _Activity);

    /**
     * WrittenAnswer constructor
     * @param {JClicProject} project - The JClic project to which this activity belongs
     */
    function WrittenAnswer(project) {
      _classCallCheck(this, WrittenAnswer);

      return _possibleConstructorReturn(this, (WrittenAnswer.__proto__ || Object.getPrototypeOf(WrittenAnswer)).call(this, project));
    }

    /**
     * Loads this object settings from an XML element
     * @override
     * @param {external:jQuery} $xml - The jQuery XML element to parse
     */


    _createClass(WrittenAnswer, [{
      key: "setProperties",
      value: function setProperties($xml) {
        _get(WrittenAnswer.prototype.__proto__ || Object.getPrototypeOf(WrittenAnswer.prototype), "setProperties", this).call(this, $xml);
        this.abc['primary'].avoidAllIdsNull(this.abc['answers'].getNumCells());
      }

      /**
       * Retrieves the minimum number of actions needed to solve this activity
       * @override
       * @returns {number}
       */

    }, {
      key: "getMinNumActions",
      value: function getMinNumActions() {
        return this.invAss ? this.abc['answers'].getNumCells() : this.abc['primary'].getNumCells() - this.nonAssignedCells;
      }

      /**
       * This activity uses random values to scramble its internal components
       * @override
       * @returns {boolean}
       */

    }, {
      key: "hasRandom",
      value: function hasRandom() {
        return true;
      }

      /**
       * This activity makes use of the keyboard
       * @override
       * @returns {boolean}
       */

    }, {
      key: "needsKeyboard",
      value: function needsKeyboard() {
        return true;
      }

      /**
       * This activity can permit the user to display the solution
       * @override
       * @returns {boolean}
       */

    }, {
      key: "helpSolutionAllowed",
      value: function helpSolutionAllowed() {
        return true;
      }
    }]);

    return WrittenAnswer;
  }(Activity);

  Object.assign(WrittenAnswer.prototype, {
    /**
     * Number of unassigned cells
     * @name WrittenAnswer#nonAssignedCells
     * @type {number} */
    nonAssignedCells: 0,
    /**
     * Whether to use or not the cell's `idAss` field to check if pairings match
     * @name WrittenAnswer#useIdAss
     * @type {boolean} */
    useIdAss: true
  });

  /**
   * The {@link ActivityPanel} where {@link WrittenAnswer} activities are played.
   * @class
   * @extends ActivityPanel
   */

  var WrittenAnswerPanel = function (_Activity$Panel) {
    _inherits(WrittenAnswerPanel, _Activity$Panel);

    /**
     * WrittenAnswerPanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function WrittenAnswerPanel(act, ps, $div) {
      _classCallCheck(this, WrittenAnswerPanel);

      return _possibleConstructorReturn(this, (WrittenAnswerPanel.__proto__ || Object.getPrototypeOf(WrittenAnswerPanel)).call(this, act, ps, $div));
    }

    /**
     * Performs miscellaneous cleaning operations
     * @override
     */


    _createClass(WrittenAnswerPanel, [{
      key: "clear",
      value: function clear() {
        if (this.bgA) {
          this.bgA.end();
          this.bgA = null;
        }
        if (this.bgB) {
          this.bgB.end();
          this.bgB = null;
        }
      }

      /**
       * Prepares the visual components of the activity
       * @override
       */

    }, {
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        var _this3 = this;

        if (this.firstRun) _get(WrittenAnswerPanel.prototype.__proto__ || Object.getPrototypeOf(WrittenAnswerPanel.prototype), "buildVisualComponents", this).call(this);

        this.clear();

        var abcA = this.act.abc['primary'],
            abcB = this.act.abc['answers'],
            solved = this.act.abc['solvedPrimary'];

        if (abcA && abcB) {
          if (this.act.invAss) this.invAssCheck = Array(abcB.getNumCells()).fill(false);

          if (abcA.imgName) {
            abcA.setImgContent(this.act.project.mediaBag, null, false);
            if (abcA.animatedGifFile && !abcA.shaper.rectangularShapes && !this.act.scramble['primary']) this.$animatedBg = $('<span/>').css({
              'background-image': 'url(' + abcA.animatedGifFile + ')',
              'background-position': 'center',
              'background-repeat': 'no-repeat',
              position: 'absolute'
            }).appendTo(this.$div);
          }

          if (solved && solved.imgName) solved.setImgContent(this.act.project.mediaBag, null, false);

          if (this.act.acp !== null) {
            var contentKit = [abcA, abcB];
            if (solved) contentKit.push(solved);
            this.act.acp.generateContent(abcA.nch, abcA.ncw, contentKit, false);
          }

          this.bgA = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abcA);

          var w = abcB.w;
          if (this.act.boxGridPos === 'AUB' || this.act.boxGridPos === 'BUA') w = abcA.getTotalWidth();
          //
          // bgB will be used only as a placeholder for `$textField`
          this.bgB = new ActiveBoxGrid(null, this, abcB.bb, this.act.margin, this.act.margin, w, abcB.h, new Rectangular(1, 1));
          this.$form = $('<form/>', { id: 'form1', action: '#' });
          this.$form.submit(function (event) {
            event.preventDefault();
            if (_this3.playing) {
              _this3.setCurrentCell(_this3.currentCell);
            }
          });

          this.$textField = $('<input/>', { type: 'text', size: 200 }).css(abcB.bb.getCSS()).css({
            position: 'absolute', top: 0, left: 0,
            border: 0, padding: 0, margin: 0,
            'text-align': 'center'
          });

          this.$div.append(this.$form.append(this.$textField));
          this.bgA.setContent(abcA, solved || null);
          this.bgA.setDefaultIdAss();
          if (this.$animatedBg) this.bgA.setCellAttr('tmpTrans', true);

          this.act.nonAssignedCells = 0;
          for (var i = 0; i < this.bgA.getNumCells(); i++) {
            var bx = this.bgA.getActiveBox(i);
            if (bx.idAss === -1) {
              this.act.nonAssignedCells++;
              bx.switchToAlt(this.ps);
            }
          }
          this.bgA.setVisible(true);
          this.bgB.setVisible(false);
        }
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(WrittenAnswerPanel.prototype.__proto__ || Object.getPrototypeOf(WrittenAnswerPanel.prototype), "initActivity", this).call(this);
        if (!this.firstRun) this.buildVisualComponents();else this.firstRun = false;

        if (this.bgA && this.bgB) {
          // Scramble cells
          if (this.act.scramble.primary) this.shuffle([this.bgA], true, true);

          if (this.useOrder) this.currentItem = this.bgA.getNextItem(-1);

          this.setAndPlayMsg('initial', 'start');
          this.invalidate().update();
          this.playing = true;
        }
      }

      /**
       * Called by [JClicPlayer](JClicPlayer.html) when this activity panel is fully visible, just
       * after the initialization process.
       * @override
       */

    }, {
      key: "activityReady",
      value: function activityReady() {
        _get(WrittenAnswerPanel.prototype.__proto__ || Object.getPrototypeOf(WrittenAnswerPanel.prototype), "activityReady", this).call(this);
        this.setCurrentCell(0);
      }

      /**
       * Updates the graphic content of this panel.
       * This method will be called from {@link AWT.Container#update} when needed.
       * @override
       * @param {AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
       * it's the whole panel.
       */

    }, {
      key: "updateContent",
      value: function updateContent(dirtyRegion) {
        _get(WrittenAnswerPanel.prototype.__proto__ || Object.getPrototypeOf(WrittenAnswerPanel.prototype), "updateContent", this).call(this, dirtyRegion);
        if (this.bgA && this.$canvas) {
          var canvas = this.$canvas.get(-1),
              ctx = canvas.getContext('2d');
          if (!dirtyRegion) dirtyRegion = new AWT.Rectangle(0, 0, canvas.width, canvas.height);
          ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
          this.bgA.update(ctx, dirtyRegion);
        }
        return this;
      }

      /**
       * Sets the real dimension of this panel.
       * @override
       * @param {AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
       * @returns {AWT.Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(preferredMaxSize) {
        return !this.bgA || !this.bgB || this.getBounds().equals(preferredMaxSize) ? preferredMaxSize : BoxBag.layoutDouble(preferredMaxSize, this.bgA, this.bgB, this.act.boxGridPos, this.act.margin);
      }

      /**
       * Sets the size and position of this activity panel
       * @override
       * @param {AWT.Rectangle} rect
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect) {
        if (this.$canvas) this.$canvas.remove();

        _get(WrittenAnswerPanel.prototype.__proto__ || Object.getPrototypeOf(WrittenAnswerPanel.prototype), "setBounds", this).call(this, rect);
        if (this.bgA || this.bgB) {
          var r = rect.clone();
          if (this.act.boxGridPos === 'AUB') r.height -= this.bgB.pos.y + this.act.margin / 2;else if (this.act.boxGridPos === 'AB') r.width -= this.bgB.pos.x + this.act.margin / 2;

          // Create the main canvas
          this.$canvas = $('<canvas width="' + r.dim.width + '" height="' + r.dim.height + '"/>').css({
            position: 'absolute',
            top: 0,
            left: 0
          });

          // Resize animated gif background
          if (this.bgA && this.$animatedBg) {
            var bgRect = this.bgA.getBounds();
            this.$animatedBg.css({
              left: bgRect.pos.x,
              top: bgRect.pos.y,
              width: bgRect.dim.width + 'px',
              height: bgRect.dim.height + 'px',
              'background-size': bgRect.dim.width + 'px ' + bgRect.dim.height + 'px'
            });
            this.$canvas.insertAfter(this.$animatedBg);
          } else this.$div.prepend(this.$canvas);

          if (this.$textField) {
            this.$textField.css({
              top: this.bgB.pos.y,
              left: this.bgB.pos.x,
              width: this.bgB.dim.width,
              height: this.bgB.dim.height,
              zIndex: 9
            });
          }
          // Repaint all
          this.invalidate().update();
        }
      }

      /**
       * Checks if all inverse associations are done
       * @returns {boolean}
       */

    }, {
      key: "checkInvAss",
      value: function checkInvAss() {
        return this.act.invAss && this.invAssCheck && this.invAssCheck.every(function (chk) {
          return chk;
        });
      }

      /**
       * Updates the currently selected cell, evaluating the answer written by the user on the text field.
       * @param {number} i - Index into the {@link ActiveBoxBag} of the cell to make active
       * @param {function[]} delayedActions - If set, store the the action in this array for future execution
       */

    }, {
      key: "setCurrentCell",
      value: function setCurrentCell(i) {
        var delayedActions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

        if (!this.playing) return;

        var bx = null,
            m = false;

        if (this.currentCell !== -1) {
          var ok = false;
          bx = this.bgA ? this.bgA.getActiveBoxWithIdLoc(this.currentCell) : null;
          if (bx) {
            bx.setMarked(false);
            var src = bx.getDescription(),
                id = bx.idAss,
                txCheck = id >= 0 ? this.act.abc['answers'].getActiveBoxContent(id).text : '',
                txAnswer = this.$textField.val().trim();
            if (Utils.compareMultipleOptions(txAnswer, txCheck, false)) {
              ok = true;
              bx.idAss = -1;
              // When in multiple-answer, fill-in textField with the first valid option:
              var p = txCheck.indexOf('|');
              if (p >= 0) this.$textField.val(txCheck.substring(0, p));

              if (this.act.abc['solvedPrimary']) {
                bx.switchToAlt(this.ps);
                m = bx.playMedia(this.ps, delayedActions);
              } else bx.clear();
              if (this.act.invAss && id >= 0 && id < this.invAssCheck.length) {
                this.invAssCheck[id] = true;
              }
              if (this.act.useOrder) this.currentItem = this.bgA.getNextItem(this.currentItem);
            }

            var cellsPlaced = this.bgA.countCellsWithIdAss(-1);
            if (txAnswer.length > 0) {
              this.ps.reportNewAction(this.act, 'WRITE', src, txAnswer, ok, cellsPlaced);
            }
            if (ok && (this.checkInvAss() || cellsPlaced === this.bgA.getNumCells())) {
              this.finishActivity(true);
              this.$textField.prop('disabled', true);
              this.invalidate().update();
              return;
            } else if (!m && txAnswer.length > 0) this.playEvent(ok ? 'actionOk' : 'actionError');
          }
        }

        bx = this.bgA ? this.act.useOrder ? this.bgA.getBox(this.currentItem) : this.bgA.getActiveBoxWithIdLoc(i) : null;

        if (this.bgA && (!bx || bx.idAss === -1)) {
          for (var j = 0; j < this.bgA.getNumCells(); j++) {
            bx = this.bgA.getActiveBoxWithIdLoc(j);
            if (bx.idAss !== -1) break;
          }
          if (bx && bx.idAss === -1) {
            this.finishActivity(false);
            this.$textField.prop('disabled', true);
            this.invalidate().update();
            return;
          }
        }
        // Draw border only if it has more than one cell
        if (bx && this.bgA && this.bgA.getNumCells() > 1) bx.setMarked(true);
        if (bx) this.currentCell = bx.idLoc;
        this.$textField.val('');
        this.$textField.focus();
        this.invalidate().update();
        if (bx) bx.playMedia(this.ps, delayedActions);
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (this.playing) {
          // Array to be filled with actions to be executed at the end of event processing
          var delayedActions = [];
          switch (event.type) {
            case 'click':
              event.preventDefault();
              this.ps.stopMedia(1);
              var p = new AWT.Point(event.pageX - this.$div.offset().left, event.pageY - this.$div.offset().top);

              // Avoid clicks on the text field
              if (this.bgB.contains(p)) {
                this.$textField.focus();
                break;
              }

              var bx = this.bgA ? this.bgA.findActiveBox(p) : null;
              if (bx && !bx.isInactive()) {
                if (bx.getContent() && bx.getContent().mediaContent === null) this.playEvent('CLICK');
                this.setCurrentCell(bx.idLoc, delayedActions);
              }
              break;

            case 'change':
              event.preventDefault();
              this.setCurrentCell(this.currentCell, delayedActions);
              break;
          }
          delayedActions.forEach(function (action) {
            return action();
          });
          return false;
        }
      }
    }]);

    return WrittenAnswerPanel;
  }(Activity.Panel);

  Object.assign(WrittenAnswerPanel.prototype, {
    /**
     * The input text field where users write the answers
     * @name WrittenAnswerPanel#$textField
     * @type {external:jQuery} */
    $textField: null,
    /**
     * Array for storing checked associations
     * @name WrittenAnswerPanel#invAssCheck
     * @type {boolean[]} */
    invAssCheck: null,
    /**
     * The {@link ActiveBoxBag} object containing the questions
     * @name WrittenAnswerPanel#bgA
     * @type {ActiveBoxBag} */
    bgA: null,
    /**
     * An optional {@link ActiveBoxBag} with content displayed as cells are solved.
     * @name WrittenAnswerPanel#bgB
     * @type {ActiveBoxBag} */
    bgB: null,
    /**
     * The currently selected cell
     * @name WrittenAnswerPanel#currentCell
     * @type {number} */
    currentCell: -1,
    /**
     * Mouse events intercepted by this panel
     * @override
     * @name WrittenAnswerPanel#events
     * @type {string[]} */
    events: ['click', 'change']
  });

  /**
   * Panel class associated to this type of activity: {@link WrittenAnswerPanel}
   * @type {class} */
  WrittenAnswer.Panel = WrittenAnswerPanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@text.WrittenAnswer'] = WrittenAnswer;

  return WrittenAnswer;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 516 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : boxes/ActiveBoxBag.js
 *  Created : 21/04/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(24), __webpack_require__(3), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, BoxBag, AWT, Utils) {

  /**
   * This class is a special case of {@link BoxBag} containing only objects of type {@link ActiveBox}.
   * In addition to the members and methods of `BoxBag`, it implements specific methods to deal with
   * {@link ActiveBagContent} objects and with the other specific members of `ActiveBox` like its "ids"
   * (`idOrder`, `idLoc` and `idAss`).
   * @exports ActiveBoxBag
   * @class
   * @extends BoxBag
   */
  var ActiveBoxBag = function (_BoxBag) {
    _inherits(ActiveBoxBag, _BoxBag);

    /**
     * ActiveBoxBag constructor
     * @param {?AbstractBox} parent - The AbstractBox to which this box bag belongs
     * @param {?AWT.Container} container - The container where this box bag is placed.
     * @param {?BoxBase} boxBase - The object where colors, fonts, border and other graphic properties
     * of this box bag are defined.
     */
    function ActiveBoxBag(parent, container, boxBase) {
      _classCallCheck(this, ActiveBoxBag);

      // ActiveBoxBag extends BoxBag
      return _possibleConstructorReturn(this, (ActiveBoxBag.__proto__ || Object.getPrototypeOf(ActiveBoxBag)).call(this, parent, container, boxBase));
    }

    /**
     * Adds an {@link ActiveBox} to this bag
     * @param {ActiveBox} bx - The ActiveBox to be added to this bag
     */


    _createClass(ActiveBoxBag, [{
      key: "addActiveBox",
      value: function addActiveBox(bx) {
        bx.idLoc = this.cells.length;
        bx.idOrder = bx.idLoc;
        return this.addBox(bx);
      }

      /**
       * Finds an ActiveBox by its relative location (`idLoc` field)
       * @param {number} idLoc
       * @returns {ActiveBox}
       */

    }, {
      key: "getActiveBox",
      value: function getActiveBox(idLoc) {
        return this.getBox(idLoc);
      }

      /**
       * Gets the background box
       * @returns {ActiveBox}
       */

    }, {
      key: "getBackgroundActiveBox",
      value: function getBackgroundActiveBox() {
        return this.getBackgroundBox();
      }

      /**
       * Sets the content of members of this ActiveBoxBag, based on one or more {@link ActiveBagContent}
       * objects.
       * @param {ActiveBagContent} abc - The main bag of content
       * @param {?ActiveBagContent=} altAbc - The alternative bag of content
       * @param {number=} fromIndex - Starts taking the cell content located at this position on the bag
       * @param {number=} toCell - Starts filling the box located at this position on the ActiveBoxBag
       * @param {type=} numCells - Acts only with a limited number of elements.
       */

    }, {
      key: "setContent",
      value: function setContent(abc, altAbc, fromIndex, toCell, numCells) {
        if (!fromIndex) fromIndex = 0;
        if (!toCell) toCell = 0;
        if (!numCells) numCells = this.cells.length;

        for (var i = 0; i < numCells; i++) {
          var bx = this.getActiveBox(toCell + i);
          bx.setContent(abc, fromIndex + i);
          bx.setAlternative(false);
          if (altAbc) bx.setAltContent(altAbc, fromIndex + i);
        }

        if (abc.backgroundContent !== null && this.getBackgroundActiveBox() !== null) {
          var _bx = this.getBackgroundActiveBox();
          _bx.setContent(abc.backgroundContent);
          if (abc.bb !== _bx.boxBase) _bx.setBoxBase(abc.bb);
        }
      }

      /**
       * Finds an ActiveBox by location
       * @param {AWT.Point} point - The location to search for
       * @returns {ActiveBox}
       */

    }, {
      key: "findActiveBox",
      value: function findActiveBox(point) {
        return this.findBox(point);
      }

      /**
       * Clears the content of all boxes
       */

    }, {
      key: "clearAllBoxes",
      value: function clearAllBoxes() {
        this.cells.forEach(function (bx) {
          return bx.clear();
        });
      }

      /**
       * Clears the content of all boxes and background box
       */

    }, {
      key: "clearAll",
      value: function clearAll() {
        this.clearAllBoxes();
        if (this.backgroundBox !== null) this.getBackgroundActiveBox().clear();
      }

      /**
       * Count the number of cells that are at its original place
       * @returns {number}
       */

    }, {
      key: "countCellsAtPlace",
      value: function countCellsAtPlace() {
        return this.cells.reduce(function (n, bx) {
          return bx.isAtPlace() ? ++n : n;
        }, 0);
      }

      /**
       * Finds the {@link ActiveBox} that has the specified `idLoc` attribute
       * @param {number} idLoc - The idLoc to search for
       * @returns {ActiveBox}
       */

    }, {
      key: "getActiveBoxWithIdLoc",
      value: function getActiveBoxWithIdLoc(idLoc) {
        return this.cells.find(function (bx) {
          return bx.idLoc === idLoc;
        }) || null;
      }

      /**
       * Checks if the place occupied by a cell corresponds to a cell with equivalent content.
       * @param {ActiveBox} bx - The box to check
       * @param {boolean} checkCase - If `true`, check case when comparing texts
       * @returns {boolean}
       */

    }, {
      key: "cellIsAtEquivalentPlace",
      value: function cellIsAtEquivalentPlace(bx, checkCase) {
        return bx.isAtPlace() || bx.isEquivalent(this.getActiveBoxWithIdLoc(bx.idOrder), checkCase);
      }

      /**
       * Count the number of cells that are at its original place or equivalent
       * @param {type} checkCase -  - If `true`, check case when comparing texts
       * @returns {number}
       */

    }, {
      key: "countCellsAtEquivalentPlace",
      value: function countCellsAtEquivalentPlace(checkCase) {
        var _this2 = this;

        return this.cells.reduce(function (n, bx) {
          return _this2.cellIsAtEquivalentPlace(bx, checkCase) ? ++n : n;
        }, 0);
      }

      /**
       * Counts the number of cells that have the provided `idAss` attribute
       * @param {number} idAss - The `idAss` attribute to search
       * @returns {number}
       */

    }, {
      key: "countCellsWithIdAss",
      value: function countCellsWithIdAss(idAss) {
        return this.cells.reduce(function (n, bx) {
          return bx.idAss === idAss ? ++n : n;
        }, 0);
      }

      /**
       * Resets the default `idAss` attribute on all cells
       */

    }, {
      key: "setDefaultIdAss",
      value: function setDefaultIdAss() {
        this.cells.map(function (bx) {
          return bx.setDefaultIdAss();
        });
      }

      /**
       * Shuffles the cells
       * @param {number} times - Number of times to shuffle
       * @param {boolean} fitInArea - Ensure that all cells are inside the bag rectangle
       */

    }, {
      key: "scrambleCells",
      value: function scrambleCells(times, fitInArea) {
        var nc = this.cells.length;
        if (nc >= 2) {
          // Array of AWT.Point objects
          var pos = [],
              idLoc = [],
              p = new AWT.Point();

          for (var i = 0; i < nc; i++) {
            var bx = this.getActiveBox(i);
            pos[i] = new AWT.Point(bx.pos);
            idLoc[i] = bx.idLoc;
          }

          for (var _i = 0; _i < times; _i++) {
            var r1 = Math.floor(Math.random() * nc),
                r2 = Math.floor(Math.random() * nc);
            if (r1 !== r2) {
              p.moveTo(pos[r1]);
              pos[r1].moveTo(pos[r2]);
              pos[r2].moveTo(p);
              var j = idLoc[r1];
              idLoc[r1] = idLoc[r2];
              idLoc[r2] = j;
            }
          }

          for (var _i2 = 0; _i2 < nc; _i2++) {
            var _bx2 = this.getActiveBox(_i2),
                px = pos[_i2].x,
                py = pos[_i2].y;
            _bx2.moveTo(new AWT.Point(px, py));
            if (fitInArea) this.fitCellsInArea([_bx2]);
            _bx2.idLoc = idLoc[_i2];
          }
        }
      }

      /**
       * Fits cells inside the ActiveBoxBag area. Useful when non-rectangular cells exchange its positions.
       * @param {ActiveBox[]} boxes - The boxes to be checked
       */

    }, {
      key: "fitCellsInArea",
      value: function fitCellsInArea(boxes) {
        var _this3 = this;

        var maxX = this.pos.x + this.dim.width,
            maxY = this.pos.y + this.dim.height;

        boxes.forEach(function (bx) {
          // Save original position
          if (!bx.pos0) bx.pos0 = new AWT.Point(bx.pos);

          var px = Math.min(Math.max(bx.pos.x, _this3.pos.x), maxX - bx.dim.width),
              py = Math.min(Math.max(bx.pos.y, _this3.pos.y), maxY - bx.dim.height);
          if (px !== bx.pos.x || py !== bx.pos.y) bx.moveTo(new AWT.Point(px, py));
        });
      }

      /**
       * Exchange the positions of two cells inside the ActiveBoxBag area.
       * @param {ActiveBox} bxa - The first box
       * @param {ActiveBox} bxb - The second box
       * @param {boolean} fitInArea - Ensure that all cells are inside the bag rectangle
       */

    }, {
      key: "swapCellPositions",
      value: function swapCellPositions(bxa, bxb, fitInArea) {
        // Save backup of bxb significant properties
        var posB = new AWT.Point(bxb.pos),
            posB0 = bxb.pos0,
            idLocB = bxb.idLoc;

        bxb.moveTo(bxa.pos0 || bxa.pos);
        bxb.pos0 = bxa.pos0;
        bxb.idLoc = bxa.idLoc;

        bxa.moveTo(posB0 || posB);
        bxa.pos0 = posB0;
        bxa.idLoc = idLocB;

        if (fitInArea) this.fitCellsInArea([bxa, bxb]);
      }

      /**
       * Resets the IDs of all cells
       */

    }, {
      key: "resetIds",
      value: function resetIds() {
        this.cells.forEach(function (bx, i) {
          if (bx) {
            bx.idOrder = i;
            bx.idAss = i;
            bx.idLoc = i;
          }
        });
      }

      /**
       * Gets the index of box located in the `cells` array after the provided index, having the
       * provided `idAssValid` value as `idAss` attribute.
       * When `idAssValid` is `null` or `undefined`, search for the next cell with `idAss>0`
       * @param {type} currentItem - The index after to which start scanning
       * @param {type=} idAssValid - The `idAss` attribute value to search
       * @returns {number}
       */

    }, {
      key: "getNextItem",
      value: function getNextItem(currentItem, idAssValid) {
        var IDASSNOTUSED = -12345;
        if (!idAssValid) idAssValid = IDASSNOTUSED;
        var i = currentItem + 1;
        for (; i < this.cells.length; i++) {
          var bx = this.cells[i];
          if (!bx) break;
          if (idAssValid !== IDASSNOTUSED) {
            if (idAssValid === bx.idAss) break;
          } else if (bx.idAss >= 0) break;
        }
        return i;
      }

      /**
       * Builds a group of hidden `buton` elements that will act as a accessible objects associated
       * to the canvas area of this ActiveBoxBag.
       * The buttons will only be created when `CanvasRenderingContext2D` has a method named `addHitRegion`.
       * See https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Hit_regions_and_accessibility
       * for more information and supported browsers.
       * @param {external:jQuery} $canvas - The `canvas` where this `ActiveBoxBag` will deploy, wrapped up in a jQuery object
       * @param {external:jQuery} $clickReceiver - The DOM element that will be notified  when a button is clicked.
       * @param {string=} eventType - Type of event sent to $clickReceiver. Default is `click`.
       * @returns {external:jQuery} - The $accessibleDiv member, containing the accessible elements associated to this ActiveBoxBag.
       */

    }, {
      key: "buildAccessibleElements",
      value: function buildAccessibleElements($canvas, $clickReceiver, eventType) {
        var _this4 = this;

        if (Utils.settings.CANVAS_HITREGIONS) {
          this.$accessibleDiv = this.accessibleText !== '' ? $('<div/>', { 'aria-label': this.accessibleText, tabindex: 0 }) : null;
          $canvas.append(this.$accessibleDiv);
          this.cells.forEach(function (bx) {
            return bx.buildAccessibleElement($canvas, $clickReceiver, _this4.$accessibleDiv, eventType);
          });
        }
        return this.$accessibleDiv;
      }
    }]);

    return ActiveBoxBag;
  }(BoxBag);

  Object.assign(ActiveBoxBag.prototype, {
    /**
     * `div` containing the accessible elements associated to this ActiveBoxBag
     * @name ActiveBoxBag#$accessibleDiv
     * @type {external:jQuery} */
    $accessibleDiv: null
  });

  return ActiveBoxBag;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 517 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/panels/InformationScreen.js
 *  Created : 19/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(35), __webpack_require__(24), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, ActiveBoxGrid, BoxBag, AWT) {

  /**
   * This class of {@link Activity} just shows a panel with {@link ActiveBox} objects.
   * Because active boxes can act as a links to specific points in the project's sequence of
   * activities, this kind of activity is often used as a menu where users can choose from different
   * options.
   * @exports InformationScreen
   * @class
   * @extends Activity
   */
  var InformationScreen = function (_Activity) {
    _inherits(InformationScreen, _Activity);

    /**
     * InformationScreen constructor
     * @param {JClicProject} project - The {@link JClicProject} to which this activity belongs
     */
    function InformationScreen(project) {
      _classCallCheck(this, InformationScreen);

      // This kind of activities are not reported
      var _this = _possibleConstructorReturn(this, (InformationScreen.__proto__ || Object.getPrototypeOf(InformationScreen)).call(this, project));

      _this.includeInReports = false;
      _this.reportActions = false;
      return _this;
    }

    return InformationScreen;
  }(Activity);

  /**
   * The {@link ActivityPanel} where {@link InformationScreen} activities should display its content
   * @class
   * @extends ActivityPanel
   * @param {Activity} act - The {@link Activity} to which this Panel belongs
   * @param {JClicPlayer} ps - Any object implementing the methods defined in the
   * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
   * Java interface.
   */


  var InformationScreenPanel = function (_Activity$Panel) {
    _inherits(InformationScreenPanel, _Activity$Panel);

    /**
     * InformationScreenPanel constructor
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function InformationScreenPanel(act, ps, $div) {
      _classCallCheck(this, InformationScreenPanel);

      return _possibleConstructorReturn(this, (InformationScreenPanel.__proto__ || Object.getPrototypeOf(InformationScreenPanel)).call(this, act, ps, $div));
    }

    /**
     * Miscellaneous cleaning operations
     * @override
     */


    _createClass(InformationScreenPanel, [{
      key: "clear",
      value: function clear() {
        if (this.bg) {
          this.bg.end();
          this.bg = null;
        }
      }

      /**
       * Prepares the visual components of the activity
       * @override
       */

    }, {
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        if (this.firstRun) _get(InformationScreenPanel.prototype.__proto__ || Object.getPrototypeOf(InformationScreenPanel.prototype), "buildVisualComponents", this).call(this);
        this.clear();
        var abc = this.act.abc['primary'];
        if (abc) {
          if (abc.imgName) {
            abc.setImgContent(this.act.project.mediaBag, null, false);
            if (abc.animatedGifFile && !abc.shaper.rectangularShapes) this.$animatedBg = $('<span/>').css({
              'background-image': "url(" + abc.animatedGifFile + ")",
              'background-position': 'center',
              'background-repeat': 'no-repeat',
              position: 'absolute'
            }).appendTo(this.$div);
          }

          if (this.act.acp !== null) this.act.acp.generateContent(abc.nch, abc.ncw, [abc], false);

          this.bg = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abc);
          this.bg.setContent(abc);
          if (this.$animatedBg) this.bg.setCellAttr('tmpTrans', true);
          this.bg.setVisible(true);
        }
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(InformationScreenPanel.prototype.__proto__ || Object.getPrototypeOf(InformationScreenPanel.prototype), "initActivity", this).call(this);
        if (!this.firstRun) this.buildVisualComponents();else this.firstRun = false;

        this.invalidate().update();
        this.setAndPlayMsg('initial', 'start');
        this.playing = true;
      }

      /**
       * Updates the graphic content of this panel.
       * This method will be called from {@link AWT.Container#update} when needed.
       * @override
       * @param {AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
       * it's the whole panel.
       */

    }, {
      key: "updateContent",
      value: function updateContent(dirtyRegion) {
        _get(InformationScreenPanel.prototype.__proto__ || Object.getPrototypeOf(InformationScreenPanel.prototype), "updateContent", this).call(this, dirtyRegion);
        if (this.bg && this.$canvas) {
          var canvas = this.$canvas.get(-1),
              ctx = canvas.getContext('2d');
          if (!dirtyRegion) dirtyRegion = new AWT.Rectangle(0, 0, canvas.width, canvas.height);
          ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
          this.bg.update(ctx, dirtyRegion);
        }
        return this;
      }

      /**
       * Sets the real dimension of this panel.
       * @override
       * @param {AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
       * @returns {AWT.Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(preferredMaxSize) {
        return this.getBounds().equals(preferredMaxSize) ? preferredMaxSize : BoxBag.layoutSingle(preferredMaxSize, this.bg, this.act.margin);
      }

      /**
       * Sets the size and position of this activity panel
       * @override
       * @param {AWT.Rectangle} rect
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect) {
        var _this3 = this;

        if (this.$canvas) this.$canvas.remove();

        _get(InformationScreenPanel.prototype.__proto__ || Object.getPrototypeOf(InformationScreenPanel.prototype), "setBounds", this).call(this, rect);
        if (this.bg) {
          this.$canvas = $('<canvas width="' + rect.dim.width + '" height="' + rect.dim.height + '"/>').css({
            position: 'absolute',
            top: 0,
            left: 0
          });
          // Resize animated gif background
          if (this.$animatedBg) {
            var bgRect = this.bg.getBounds();
            this.$animatedBg.css({
              left: bgRect.pos.x,
              top: bgRect.pos.y,
              width: bgRect.dim.width + "px",
              height: bgRect.dim.height + "px",
              'background-size': bgRect.dim.width + "px " + bgRect.dim.height + "px"
            });
          }
          this.$div.append(this.$canvas);
          this.invalidate().update();
          setTimeout(function () {
            return _this3.bg ? _this3.bg.buildAccessibleElements(_this3.$canvas, _this3.$div) : null;
          }, 0);
        }
      }

      /**
       * Builds the accessible components needed for this ActivityPanel
       * This method is called when all main elements are placed and visible, when the activity is ready
       * to start or when resized.
       * @override
       */

    }, {
      key: "buildAccessibleComponents",
      value: function buildAccessibleComponents() {
        if (this.$canvas && this.accessibleCanvas && this.bg) {
          _get(InformationScreenPanel.prototype.__proto__ || Object.getPrototypeOf(InformationScreenPanel.prototype), "buildAccessibleComponents", this).call(this);
          this.bg.buildAccessibleElements(this.$canvas, this.$div);
        }
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (this.playing) {
          var p = new AWT.Point(event.pageX - this.$div.offset().left, event.pageY - this.$div.offset().top);
          // Array to be filled with actions to be executed at the end of event processing
          var delayedActions = [];
          this.ps.stopMedia(1);
          var bx = this.bg.findActiveBox(p);
          if (bx) {
            if (!bx.playMedia(this.ps, delayedActions)) this.playEvent('click');
          }
          delayedActions.forEach(function (action) {
            return action();
          });
          event.preventDefault();
        }
      }
    }]);

    return InformationScreenPanel;
  }(Activity.Panel);

  Object.assign(InformationScreenPanel.prototype, {
    /**
     * The {@link ActiveBoxBag} containing the information to be displayed.
     * @name InformationScreenPanel#bg
     * @type {ActiveBoxBag} */
    bg: null,
    /**
     * List of mouse, touch and keyboard events intercepted by this panel
     * @override
     * @name InformationScreenPanel#events
     * @type {string[]} */
    events: ['click']
  });

  /**
   * Panel class associated to this type of activity: {@link InformationScreenPanel}
   * @type {class} */
  InformationScreen.Panel = InformationScreenPanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@panels.InformationScreen'] = InformationScreen;

  return InformationScreen;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 518 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/panels/Identify.js
 *  Created : 03/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(35), __webpack_require__(24), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, ActiveBoxGrid, BoxBag, AWT) {

  /**
   * The aim of this type of {@link Activity} is to identify {@link ActiveBox} elements in a panel
   * that satisfy a specific condition, usually exposed in the main message.
   * @exports Identify
   * @class
   * @extends Activity
   */
  var Identify = function (_Activity) {
    _inherits(Identify, _Activity);

    /**
     * Identify constructor
     * @param {JClicProject} project - The {@link JClicProject} to which this activity belongs
     */
    function Identify(project) {
      _classCallCheck(this, Identify);

      return _possibleConstructorReturn(this, (Identify.__proto__ || Object.getPrototypeOf(Identify)).call(this, project));
    }

    /**
     * Retrieves the minimum number of actions needed to solve this activity
     * @override
     * @returns {number}
     */


    _createClass(Identify, [{
      key: "getMinNumActions",
      value: function getMinNumActions() {
        return this.cellsToMatch;
      }

      /**
       * Whether or not the activity uses random to scramble internal components
       * @override
       * @returns {boolean}
       */

    }, {
      key: "hasRandom",
      value: function hasRandom() {
        return true;
      }
    }]);

    return Identify;
  }(Activity);

  Object.assign(Identify.prototype, {
    /**
     * Number of not assigned cells (calculated in {@link IdentifyPanel#buildVisualComponents})
     * @name Identify#nonAssignedCells
     * @type {number} */
    nonAssignedCells: 0,
    /**
     * Number of cells the user must identify to complete the activity (calculated in
     * {@link IdentifyPanel#buildVisualComponents})
     * @name Identify#cellsToMatch
     * @type {number} */
    cellsToMatch: 1
  });

  /**
   * The {@link ActivityPanel} where {@link Identify} activities are played.
   * @class
   * @extends ActivityPanel
   * @param {Activity} act - The {@link Activity} to which this Panel belongs
   * @param {JClicPlayer} ps - Any object implementing the methods defined in the
   * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
   * Java interface.
   */

  var IdentifyPanel = function (_Activity$Panel) {
    _inherits(IdentifyPanel, _Activity$Panel);

    /**
     * IdentifyPanel constructor
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function IdentifyPanel(act, ps, $div) {
      _classCallCheck(this, IdentifyPanel);

      return _possibleConstructorReturn(this, (IdentifyPanel.__proto__ || Object.getPrototypeOf(IdentifyPanel)).call(this, act, ps, $div));
    }

    /**
     * Miscellaneous cleaning operations
     * @override
     */


    _createClass(IdentifyPanel, [{
      key: "clear",
      value: function clear() {
        if (this.bg) {
          this.bg.end();
          this.bg = null;
        }
      }

      /**
       * Prepares the visual components of the activity
       * @override
       */

    }, {
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        if (this.firstRun) _get(IdentifyPanel.prototype.__proto__ || Object.getPrototypeOf(IdentifyPanel.prototype), "buildVisualComponents", this).call(this);
        this.clear();
        var abc = this.act.abc['primary'],
            solved = this.act.abc['solvedPrimary'];
        if (abc) {
          if (abc.imgName) {
            abc.setImgContent(this.act.project.mediaBag, null, false);
            if (abc.animatedGifFile && !abc.shaper.rectangularShapes && !this.act.scramble['primary']) this.$animatedBg = $('<span/>').css({
              'background-image': "url(" + abc.animatedGifFile + ")",
              'background-position': 'center',
              'background-repeat': 'no-repeat',
              position: 'absolute'
            }).appendTo(this.$div);
          }

          if (solved && solved.imgName) solved.setImgContent(this.act.project.mediaBag, null, false);

          if (this.act.acp !== null) {
            var contentKit = [abc];
            if (solved) {
              contentKit.push(null);
              contentKit.push(solved);
            }
            this.act.acp.generateContent(abc.nch, abc.ncw, contentKit, false);
          }
          this.bg = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abc);
          this.bg.setContent(abc, solved || null);
          this.bg.setAlternative(false);
          if (this.$animatedBg) this.bg.setCellAttr('tmpTrans', true);
          this.bg.setDefaultIdAss();
          this.act.nonAssignedCells = 0;
          this.act.cellsToMatch = 0;
          var n = this.bg.getNumCells();
          for (var i = 0; i < n; i++) {
            var bx = this.bg.getActiveBox(i),
                id = bx.idAss;
            if (id === 1) this.act.cellsToMatch++;else if (id === -1) {
              this.act.nonAssignedCells++;
              bx.switchToAlt(this.ps);
            }
          }
          this.bg.setVisible(true);
        }
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(IdentifyPanel.prototype.__proto__ || Object.getPrototypeOf(IdentifyPanel.prototype), "initActivity", this).call(this);
        if (!this.firstRun) this.buildVisualComponents();else this.firstRun = false;

        if (this.bg) {
          if (this.act.scramble['primary']) this.shuffle([this.bg], true, true);

          if (this.useOrder) this.currentItem = this.bg.getNextItem(-1);

          this.setAndPlayMsg('initial', 'start');
          this.invalidate().update();
          this.playing = true;
        }
      }

      /**
       * Updates the graphic content of this panel.
       * This method will be called from {@link AWT.Container#update} when needed.
       * @override
       * @param {AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
       * it's the whole panel.
       */

    }, {
      key: "updateContent",
      value: function updateContent(dirtyRegion) {
        _get(IdentifyPanel.prototype.__proto__ || Object.getPrototypeOf(IdentifyPanel.prototype), "updateContent", this).call(this, dirtyRegion);

        if (this.bg && this.$canvas) {
          var canvas = this.$canvas.get(-1),
              ctx = canvas.getContext('2d');
          if (!dirtyRegion) dirtyRegion = new AWT.Rectangle(0, 0, canvas.width, canvas.height);
          ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
          this.bg.update(ctx, dirtyRegion);
        }
        return _get(IdentifyPanel.prototype.__proto__ || Object.getPrototypeOf(IdentifyPanel.prototype), "updateContent", this).call(this, dirtyRegion);
      }

      /**
       * Sets the real dimension of this panel.
       * @override
       * @param {AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
       * @returns {AWT.Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(preferredMaxSize) {
        return this.getBounds().equals(preferredMaxSize) ? preferredMaxSize : BoxBag.layoutSingle(preferredMaxSize, this.bg, this.act.margin);
      }

      /**
       * Sets the size and position of this activity panel
       * @override
       * @param {AWT.Rectangle} rect
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect) {
        var _this3 = this;

        if (this.$canvas) this.$canvas.remove();

        _get(IdentifyPanel.prototype.__proto__ || Object.getPrototypeOf(IdentifyPanel.prototype), "setBounds", this).call(this, rect);
        if (this.bg) {
          this.$canvas = $("<canvas width=\"" + rect.dim.width + "\" height=\"" + rect.dim.height + "\"/>").css({
            position: 'absolute',
            top: 0,
            left: 0
          });
          // Resize animated gif background
          if (this.$animatedBg) {
            var bgRect = this.bg.getBounds();
            this.$animatedBg.css({
              left: bgRect.pos.x,
              top: bgRect.pos.y,
              width: bgRect.dim.width + "px",
              height: bgRect.dim.height + "px",
              'background-size': bgRect.dim.width + "px " + bgRect.dim.height + "px"
            });
          }
          this.$div.append(this.$canvas);
          this.invalidate().update();
          setTimeout(function () {
            return _this3.bg ? _this3.bg.buildAccessibleElements(_this3.$canvas, _this3.$div) : null;
          }, 0);
        }
      }

      /**
       * Builds the accessible components needed for this ActivityPanel
       * This method is called when all main elements are placed and visible, when the activity is ready
       * to start or when resized.
       * @override
       */

    }, {
      key: "buildAccessibleComponents",
      value: function buildAccessibleComponents() {
        if (this.bg && this.$canvas && this.accessibleCanvas) {
          _get(IdentifyPanel.prototype.__proto__ || Object.getPrototypeOf(IdentifyPanel.prototype), "buildAccessibleComponents", this).call(this);
          this.bg.buildAccessibleElements(this.$canvas, this.$div);
        }
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events
       * @override
       * @param {Event} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (this.playing) {
          var p = new AWT.Point(event.pageX - this.$div.offset().left, event.pageY - this.$div.offset().top);
          // Flag for assuring that only one media plays per event (avoid event sounds overlapping
          // cell's media sounds)
          var m = false;
          // Array to be filled with actions to be executed at the end of event processing
          var delayedActions = [];

          switch (event.type) {
            case 'click':
              this.ps.stopMedia(1);
              // Find the box behind the clicked point
              var bx = this.bg ? this.bg.findActiveBox(p) : null;
              if (bx) {
                if (bx.idAss !== -1) {
                  // Check if it's a valid move
                  var ok = false;
                  var src = bx.getDescription();
                  m = m || bx.playMedia(this.ps, delayedActions);
                  if (bx.idAss === 1 && (!this.act.useOrder || bx.idOrder === this.currentItem)) {
                    ok = true;
                    bx.idAss = -1;
                    if (bx.switchToAlt(this.ps)) m = m || bx.playMedia(this.ps, delayedActions);else bx.clear();
                    if (this.act.useOrder) this.currentItem = this.bg.getNextItem(this.currentItem, 1);
                  }
                  var cellsOk = this.bg.countCellsWithIdAss(-1);
                  this.ps.reportNewAction(this.act, 'SELECT', src, null, ok, cellsOk - this.act.nonAssignedCells);
                  if (ok && cellsOk === this.act.cellsToMatch + this.act.nonAssignedCells) this.finishActivity(true);else if (!m) this.playEvent(ok ? 'actionOk' : 'actionError');
                  this.update();
                } else {
                  this.playEvent('actionError');
                }
              }
              break;
          }
          delayedActions.forEach(function (action) {
            return action();
          });
          event.preventDefault();
        }
      }
    }]);

    return IdentifyPanel;
  }(Activity.Panel);

  Object.assign(IdentifyPanel.prototype, {
    /**
     * The {@link ActiveBoxBag} containing the information to be displayed on the panel.
     * @name IdentifyPanel#bg
     * @type {ActiveBoxBag} */
    bg: null,
    /**
     * List of mouse, touch and keyboard events intercepted by this panel
     * @override
     * @name IdentifyPanel#events
     * @type {string[]} */
    events: ['click']
  });

  /**
   * Panel class associated to this type of activity: {@link IdentifyPanel}
   * @type {class} */
  Identify.Panel = IdentifyPanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@panels.Identify'] = Identify;

  return Identify;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 519 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/panels/Explore.js
 *  Created : 04/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(35), __webpack_require__(24), __webpack_require__(3), __webpack_require__(75)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, ActiveBoxGrid, BoxBag, AWT, Rectangular) {

  /**
   * This class of {@link Activity} shows a panel with {@link ActiveBox} objects. Users can click
   * on this objects to obtain associated information. This associated information, displayed in
   * a second panel, can be text graphics, sound, video... or a combination of them.
   * @exports Explore
   * @class
   * @extends Activity
   */
  var Explore = function (_Activity) {
    _inherits(Explore, _Activity);

    /**
     * Explore constructor
     * @param {JClicProject} project - The {@link JClicProject} to which this activity belongs
     */
    function Explore(project) {
      _classCallCheck(this, Explore);

      return _possibleConstructorReturn(this, (Explore.__proto__ || Object.getPrototypeOf(Explore)).call(this, project));
    }

    /**
     * Activities of this type never end, so automatic sequences must pause here
     * @override
     * @returns {boolean}
     */


    _createClass(Explore, [{
      key: "mustPauseSequence",
      value: function mustPauseSequence() {
        return true;
      }

      /**
       * Retrieves the minimum number of actions needed to solve this activity
       * @override
       * @returns {number}
       */

    }, {
      key: "getMinNumActions",
      value: function getMinNumActions() {
        return 0;
      }

      /**
       * Usually this activity don't use random to scramble internal components, but in some cases
       * can make use of it.
       * @override
       * @returns {boolean}
       */

    }, {
      key: "hasRandom",
      value: function hasRandom() {
        return true;
      }
    }]);

    return Explore;
  }(Activity);

  /**
   * The {@link ActivityPanel} where {@link Explore} activities are played.
   * @class
   * @extends ActivityPanel
   * @param {Activity} act - The {@link Activity} to which this Panel belongs
   * @param {JClicPlayer} ps - Any object implementing the methods defined in the
   * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
   * Java interface.
   */


  var ExplorePanel = function (_Activity$Panel) {
    _inherits(ExplorePanel, _Activity$Panel);

    /**
     * ExplorePanel constructor
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function ExplorePanel(act, ps, $div) {
      _classCallCheck(this, ExplorePanel);

      return _possibleConstructorReturn(this, (ExplorePanel.__proto__ || Object.getPrototypeOf(ExplorePanel)).call(this, act, ps, $div));
    }

    /**
     * Miscellaneous cleaning operations
     * @override
     */


    _createClass(ExplorePanel, [{
      key: "clear",
      value: function clear() {
        if (this.bgA) {
          this.bgA.end();
          this.bgA = null;
        }
        if (this.bgB) {
          this.bgB.end();
          this.bgB = null;
        }
      }

      /**
       * Prepares the visual components of the activity
       * @override
       */

    }, {
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        if (this.firstRun) _get(ExplorePanel.prototype.__proto__ || Object.getPrototypeOf(ExplorePanel.prototype), "buildVisualComponents", this).call(this);
        this.clear();
        var abcA = this.act.abc['primary'],
            abcB = this.act.abc['secondary'];

        if (abcA && abcB) {
          if (abcA.imgName) {
            abcA.setImgContent(this.act.project.mediaBag, null, false);
            if (abcA.animatedGifFile && !abcA.shaper.rectangularShapes && !this.act.scramble['primary']) this.$animatedBg = $('<span/>').css({
              'background-image': "url(" + abcA.animatedGifFile + ")",
              'background-position': 'center',
              'background-repeat': 'no-repeat',
              position: 'absolute'
            }).appendTo(this.$div);
          }

          if (abcB.imgName) abcB.setImgContent(this.act.project.mediaBag, null, false);

          if (this.act.acp !== null) this.act.acp.generateContent(abcA.nch, abcA.ncw, [abcA, abcB], false);

          this.bgA = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abcA);
          var w = this.act.boxGridPos === 'AUB' || this.act.boxGridPos === 'BUA' ? abcA.getTotalWidth() : abcB.w;
          this.bgB = new ActiveBoxGrid(null, this, abcB.bb, this.act.margin, this.act.margin, w, abcB.h, new Rectangular(1, 1));

          this.bgA.setContent(abcA);
          this.bgA.setDefaultIdAss();
          if (this.$animatedBg) this.bgA.setCellAttr('tmpTrans', true);
          this.bgB.getActiveBox(0).setInactive(false);
          this.bgA.setVisible(true);
          this.bgB.setVisible(true);
        }
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(ExplorePanel.prototype.__proto__ || Object.getPrototypeOf(ExplorePanel.prototype), "initActivity", this).call(this);
        if (!this.firstRun) this.buildVisualComponents();else this.firstRun = false;

        if (this.bgA && this.bgB) {
          // Scramble cells
          if (this.act.scramble.primary) this.shuffle([this.bgA], true, true);

          if (this.useOrder) this.currentItem = this.bgA.getNextItem(-1);

          this.setAndPlayMsg('initial', 'start');
          this.invalidate().update();
          this.playing = true;
        }
      }

      /**
       * Updates the graphic content of this panel.
       * This method will be called from {@link AWT.Container#update} when needed.
       * @override
       * @param {AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
       * it's the whole panel.
       */

    }, {
      key: "updateContent",
      value: function updateContent(dirtyRegion) {
        _get(ExplorePanel.prototype.__proto__ || Object.getPrototypeOf(ExplorePanel.prototype), "updateContent", this).call(this, dirtyRegion);
        if (this.bgA && this.bgB && this.$canvas) {
          var canvas = this.$canvas.get(-1),
              ctx = canvas.getContext('2d');
          if (!dirtyRegion) dirtyRegion = new AWT.Rectangle(0, 0, canvas.width, canvas.height);
          ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
          this.bgA.update(ctx, dirtyRegion);
          this.bgB.update(ctx, dirtyRegion);
        }
        return this;
      }

      /**
       * Sets the real dimension of this panel.
       * @override
       * @param {AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
       * @returns {AWT.Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(preferredMaxSize) {
        return !this.bgA || !this.bgB || this.getBounds().equals(preferredMaxSize) ? preferredMaxSize : BoxBag.layoutDouble(preferredMaxSize, this.bgA, this.bgB, this.act.boxGridPos, this.act.margin);
      }

      /**
       * Sets the size and position of this activity panel
       * @override
       * @param {AWT.Rectangle} rect
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect) {
        if (this.$canvas) this.$canvas.remove();
        _get(ExplorePanel.prototype.__proto__ || Object.getPrototypeOf(ExplorePanel.prototype), "setBounds", this).call(this, rect);

        if (this.bgA || this.bgB) {
          // Create the main canvas
          this.$canvas = $("<canvas width=\"" + rect.dim.width + "\" height=\"" + rect.dim.height + "\"/>").css({
            position: 'absolute',
            top: 0,
            left: 0
          });
          // Resize animated gif background
          if (this.$animatedBg) {
            var bgRect = this.bgA.getBounds();
            this.$animatedBg.css({
              left: bgRect.pos.x,
              top: bgRect.pos.y,
              width: bgRect.dim.width + "px",
              height: bgRect.dim.height + "px",
              'background-size': bgRect.dim.width + "px " + bgRect.dim.height + "px"
            });
          }
          this.$div.append(this.$canvas);
          // Repaint all
          this.invalidate().update();
        }
      }

      /**
       * Builds the accessible components needed for this ActivityPanel
       * This method is called when all main elements are placed and visible, when the activity is ready
       * to start or when resized.
       * @override
       */

    }, {
      key: "buildAccessibleComponents",
      value: function buildAccessibleComponents() {
        if (this.$canvas && this.accessibleCanvas) {
          _get(ExplorePanel.prototype.__proto__ || Object.getPrototypeOf(ExplorePanel.prototype), "buildAccessibleComponents", this).call(this);
          if (this.bgA) this.bgA.buildAccessibleElements(this.$canvas, this.$div);
          if (this.bgB) this.bgB.buildAccessibleElements(this.$canvas, this.$div);
        }
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (this.playing) {
          var p = new AWT.Point(event.pageX - this.$div.offset().left, event.pageY - this.$div.offset().top),

          // Array to be filled with actions to be executed at the end of event processing
          delayedActions = [];

          switch (event.type) {
            case 'click':
              this.ps.stopMedia(1);
              var bx1 = this.bgA.findActiveBox(p);
              if (bx1) {
                var bx2 = this.bgB.getActiveBox(0);
                if (bx1.idAss !== -1 && (!this.act.useOrder || bx1.idOrder === this.currentItem)) {
                  bx2.setContent(this.act.abc['secondary'], bx1.idAss);
                  if (!bx2.playMedia(this.ps, delayedActions) && !bx1.playMedia(this.ps, delayedActions)) this.playEvent('CLICK');
                  if (this.act.useOrder) this.currentItem = this.bgA.getNextItem(this.currentItem);
                  this.ps.reportNewAction(this.act, 'SELECT', bx1.getDescription(), bx2.getDescription(), true, 0);
                  if (bx2.$accessibleElement) bx2.$accessibleElement.focus();
                } else {
                  bx2.clear();
                  bx2.setInactive(false);
                }
                this.update();
              }
              break;
          }
          delayedActions.forEach(function (action) {
            return action();
          });
          event.preventDefault();
        }
      }
    }]);

    return ExplorePanel;
  }(Activity.Panel);

  Object.assign(ExplorePanel.prototype, {
    /**
     * The {@link ActiveBoxBag} object containing the information to be displayed in the `primary` panel
     * @name ExplorePanel#bgA
     * @type {ActiveBoxBag} */
    bgA: null,
    /**
     * The {@link ActiveBoxBag} object containing the information associated to `primary` elements.
     * Only one of this elements will be showed for each click done in the `primary` panel.
     * @name ExplorePanel#bgB
     * @type {ActiveBoxBag} */
    bgB: null,
    /**
     * List of mouse, touch and keyboard events intercepted by this panel
     * @override
     * @name ExplorePanel#events
     * @type {string[]} */
    events: ['click']
  });

  /**
   * Panel class associated to this type of activity: {@link ExplorePanel}
   * @type {class} */
  Explore.Panel = ExplorePanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@panels.Explore'] = Explore;

  return Explore;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 520 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _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; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/panels/Menu.js
 *  Created : 20/07/2017
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(97), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, MediaContent, Utils) {

  /**
   * This class of {@link Activity} is only used in legacy JClic project libraries. It contains
   * one or more buttons pointing to specific JClic projects or to other `Menu` activity panels.
   * @exports Menu
   * @class
   * @extends Activity
   */
  var Menu = function (_Activity) {
    _inherits(Menu, _Activity);

    /**
     * Menu constructor
     * @param {JClicProject} project - The {@link JClicProject} to which this activity belongs
     */
    function Menu(project) {
      _classCallCheck(this, Menu);

      var _this = _possibleConstructorReturn(this, (Menu.__proto__ || Object.getPrototypeOf(Menu)).call(this, project));

      _this.menuElements = [];
      // This kind of activities are not reported
      _this.includeInReports = false;
      _this.reportActions = false;
      return _this;
    }

    return Menu;
  }(Activity);

  /**
   * The {@link ActivityPanel} where Menu will show its content.
   * @class
   * @extends ActivityPanel
   * @param {Activity} act - The {@link Activity} to which this Panel belongs
   * @param {JClicPlayer} ps - Any object implementing the methods defined in the
   * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
   * Java interface.
   */


  var MenuPanel = function (_Activity$Panel) {
    _inherits(MenuPanel, _Activity$Panel);

    /**
     * MenuPanel constructor
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function MenuPanel(act, ps, $div) {
      _classCallCheck(this, MenuPanel);

      // This kind of activity will always clean the "last project skin" setting
      var _this2 = _possibleConstructorReturn(this, (MenuPanel.__proto__ || Object.getPrototypeOf(MenuPanel)).call(this, act, ps, $div));

      ps.lastProjectSkin = null;
      return _this2;
    }

    /**
     * Prepares the visual components of the activity
     * @override
     */


    _createClass(MenuPanel, [{
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        var _this3 = this;

        if (this.firstRun) _get(MenuPanel.prototype.__proto__ || Object.getPrototypeOf(MenuPanel.prototype), "buildVisualComponents", this).call(this);
        // This `div` will contain the action buttons
        var $btnDiv = $('<div/>').css(_defineProperty({
          'width': '100%',
          'max-height': '100%',
          'position': 'absolute',
          'top': '50%',
          'transform': 'translateY(-50%)',
          'display': 'flex',
          'flex-wrap': 'wrap',
          'overflow-y': 'auto',
          'place-content': 'center'
        }, "overflow-y", 'auto'));
        this.act.menuElements.forEach(function (me) {
          // Create a button for each menu element
          var caption = me.description || me.caption || 'JClic';
          var $btn = $('<button/>', {
            class: 'StockBtn',
            title: caption,
            'aria-label': caption
          }).css({
            'min-width': '80px',
            'max-width': '200px',
            'min-height': '80px',
            'margin': '4px',
            'padding': '4px',
            'display': 'flex',
            'flex-direction': 'column',
            'justify-content': 'center',
            'align-items': 'center'
          });

          // Set the button icon
          var iconSrc = MenuPanel.icons[me.icon || '@ico00.png'],
              $img = $('<img/>', { src: iconSrc || '' }).css({
            'max-width': '180px',
            'max-height': '100px',
            'margin': '4px'
          });
          if (!iconSrc) {
            // It's not a stock image, so load `src` when available
            var mbe = _this3.act.project.mediaBag.getElement(me.icon, true);
            mbe.getFullPathPromise().then(function (imgFullPath) {
              return $img.attr('src', imgFullPath);
            });
          }
          $btn.append($img);

          // Set the button text
          $btn.append($('<span/>').css({
            'max-width': '180px',
            'overflow': 'hidden',
            'white-space': 'nowrap',
            'text-overflow': 'ellipsis'
          }).html(me.caption));

          // Set a click listener method
          // $btn.on('click', function...) does not work!
          $btn[0].addEventListener('click', function (ev) {
            var mc = new MediaContent(me.projectPath ? 'RUN_CLIC_PACKAGE' : 'RUN_CLIC_ACTIVITY', me.sequence);
            if (me.projectPath) mc.externalParam = me.projectPath;
            Utils.log('info', "Launching " + (me.projectPath || '') + " " + (me.sequence || ''));
            _this3.ps.playMedia(mc);
            ev.preventDefault();
          });

          // Place the created button on the container
          $btnDiv.append($btn);
        });

        // Add the buttons container on the main panel `div`
        this.$div.empty().append($btnDiv);
      }

      /**
       * Sets the real dimension of this panel.
       * @override
       * @param {AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
       * @returns {AWT.Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(preferredMaxSize) {
        return preferredMaxSize;
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(MenuPanel.prototype.__proto__ || Object.getPrototypeOf(MenuPanel.prototype), "initActivity", this).call(this);

        if (!this.firstRun) this.buildVisualComponents();else this.firstRun = false;

        this.setAndPlayMsg('initial', 'start');
        this.playing = true;
      }
    }]);

    return MenuPanel;
  }(Activity.Panel);

  /**
   * Default icons used in buttons, inherited from JClic
   * @type {object}
   */


  MenuPanel.icons = {
    '@ico00.png': 'data:image/png;base64,\
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAB1UExURUxpcZVZAGyAAGyAAJVZAJVZAJVZAIhmAJVZAJVZAJVZAIhmAGyAAGyAAGyA\
AGyAAGyAAJVZAJVZAGyAAJVZANj+AP+ZAMFzAPWSALVsANyEAM57AJ66AOiLALXVAM3xAK1nAI6oAIabAJWwAMTnAKFgAGyAAIlz9xYAAAAVdFJOUwB9oCIiZpkRRKq7M4BVu9VmVd1EzJvdA7gAAAE0\
SURBVDjLjZPZkoMgEEVFFsHdZBQR3M38/ycOKQ1gJKnpV051nwtNEPyrsjBNom9AqNSapxn8CBRjXY+DmjXkbQSXeq9tWJe7ByhVberXqzCY8yGM6GVK9FQ4SpVUxAwnJ+A+2wkLBLLppYgJRgZIrcJY\
BKxvdLUdFzE4mHBzFNDUvKoVdFfI7YQ1q7gD7LowXNRwaM4R6AzQEXNRWZrPT2jLA9YaQOIXQHV0WIbFvKZImPNGmLCMCwY0lJQQS6vAzEXFjY7Of5iORXwKySHe8+kWWwVeGQUnmW3QTMgDONUbhQ+A\
BAZwozkTqH1Ox8za3Jz3drLZDMABquuM9nFaKXZpwfFpp+j0ZiHJ21pifiIkQ++Lix+9nc+Z5/tQwrt2fxEBvN8vooQJLgTDX74xSi6z/wAoQC7hWsslMgAAAABJRU5ErkJggg==',

    '@ico01.png': 'data:image/png;base64,\
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAByUExURUxpcfzZt/rfw/pycvrcv/3UrJqf/QAAAP/hxPvOov9sbPqFhYmN/f7nz3V4\
+/3ky/+AgPrIl11g/P/Klf+Kiv9XV//q1vtHR/rCim1w//pcXISI//tfX5WY/VNT///Dh/86OvwhISUl/js7+klM+vq6e8H/VfEAAAABdFJOUwBA5thmAAABGElEQVQ4y62T23aCMBBFiU48iQlELoJW\
7b3//4udBIi0MqsvDU+w95yEGSiK/15YrlVhd1+C8Nk05+ribzcvCJlXklBV3u/8pToLAnMk3kiCh0Hkz4LA/NSC+YcgANTWYP4OqVGmtmAuC2St2Mn4EMbq9TaPvABpDborD+OB0QqG8hbo3HTNAikF\
CtEZBTcMx+t+ewC2U4IyMAFUTgVd5nukHYlrqYcxSBlw15k/gTlXx/ySPT5NLOkyP7IQq0PoOd/wSZLgmLtD5AMLsS70ZbnZEL+LTQmZv6aEQIkrpTUlwWX+FhNCyNzaOiVkHgXODyHzFr87ye/3g+Nx\
GrTgJ6zNa8nXJ04zf4Ew88ylr8KM/At//sB88w0/sBcK3bRRzgAAAABJRU5ErkJggg==',

    '@ico02.png': 'data:image/png;base64,\
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAtUExURUxpcQAAAP///8zMzJmZmfrdwP/hxPvOov3UrP3JlvzZt/zlzf/p0/zBh/rD\
jUN28cYAAAABdFJOUwBA5thmAAAAyklEQVQ4y6WT6w6DIAxG/YS2XHTv/7grLshF0C1r+KE5n6fFpMvybQHt6bldbXfQcazNsTD4MdCV+S+AQcBUBYa5M4BfHrcB8oNA08HLg0EeAiwOuGtBzoE0Mje4\
AO4S7QwhgDhlZrcISiNoqxzFoGbSb5Uyozhs4ckdD4M+OfQtUmeKcUsGnaQEyoSp/6YJIr2LXAPqp4OH4BzJtUXyZy7iBwbl8eSDALUc/Z/Sv1DxHfVm5ao5hjtIme+YbOnJMdlj/vCJoB5HX97wIgms\
7CtjdwAAAABJRU5ErkJggg==',

    '@ico03.png': 'data:image/png;base64,\
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAwUExURUxpcQAAAPrdwP/hxP7mz/8AAAAAmfvOov3UrAAA//3JlvzZtwCZAP8A//zC\
ifq6e7UN6GsAAAABdFJOUwBA5thmAAABA0lEQVQ4y5WS2RbDIAhEHdyTJv3/vy2osVj1oR6zeYcBDcb8NV6v9fp1NV7mgq8cMs/cDWYHhrmomsM1pcj9pgS7FL3IZ6AI8nazsCiCnPOG3wf0QpArfDno\
GATC6mwc9oi/AtMFgAFFLQhDCuZcQ0yAMghB+cuNUgJpSVM1zg7phGUFpv3VFdB5gqxolpwdTqYO5EaPJ57PgWOZWgvt0bl4u+LAbwmzv0Q7JxquJM2FSpwTBRHvRU7Mey/E16f4FwfeSkpUBD26CIQ+\
PMajODTmaw0Dr7/V1zRVQCNvAvNw6QbFb5iWwvRaWKE4Vh3H/6LxG+ueROfYdXXlb+zavg/++ADYLwfSmmk9oQAAAABJRU5ErkJggg==',

    '@icofolder.png': 'data:image/png;base64,\
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUxpcffvhP///2VlZczMZv//zPf39+/nc8zMzDMzmZmZZrW1tbWttcl3sA0A\
AAABdFJOUwBA5thmAAAAgklEQVQ4y9WSQQ6AIAwEsVtFwf+/14JGbcHeTHSuO9kFQggfBE8BFwLR+mBwFGYSZvh53zjzZTdkLTXCkS/ViDHBCLe8Gla48qpkGEHl+8pdYJo0yOouPA2GhLLiCCyC28DI\
cAXZ0IfsVKS3BTGUMDas0E9NfkO/ovmQBv2v0BJ+xAaYuQX2hCJNtwAAAABJRU5ErkJggg=='

    /**
     * Panel class associated to this type of activity: {@link MenuPanel}
     * @type {class} */
  };Menu.Panel = MenuPanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@panels.Menu'] = Menu;

  return Menu;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 521 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/puzzles/DoublePuzzle.js
 *  Created : 22/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(35), __webpack_require__(24), __webpack_require__(58), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, ActiveBoxGrid, BoxBag, BoxConnector, AWT) {

  /**
   * The aim of this class of {@link Activity} is to put in order the scrambled elements of an
   * {@link ActiveBagContent} that contains an image, sounds, text... or any other media content.
   *
   * The activity uses two panels: one with the scrambled cells, and other initially empty where
   * this cells must be placed in order.
   * @exports DoublePuzzle
   * @class
   * @extends Activity
   */
  var DoublePuzzle = function (_Activity) {
    _inherits(DoublePuzzle, _Activity);

    /**
     * DoublePuzzle constructor
     * @param {JClicProject} project - The {@link JClicProject} to which this activity belongs
     */
    function DoublePuzzle(project) {
      _classCallCheck(this, DoublePuzzle);

      return _possibleConstructorReturn(this, (DoublePuzzle.__proto__ || Object.getPrototypeOf(DoublePuzzle)).call(this, project));
    }

    /**
     * Retrieves the minimum number of actions needed to solve this activity.
     * @override
     * @returns {number}
     */


    _createClass(DoublePuzzle, [{
      key: "getMinNumActions",
      value: function getMinNumActions() {
        return this.abc.primary.getNumCells();
      }

      /**
       * Whether or not the activity uses random to scramble internal components
       * @override
       * @returns {boolean}
       */

    }, {
      key: "hasRandom",
      value: function hasRandom() {
        return true;
      }

      /**
       * When `true`, the activity must always be scrambled
       * @override
       * @returns {boolean}
       */

    }, {
      key: "shuffleAlways",
      value: function shuffleAlways() {
        return true;
      }

      /**
       * Whether the activity allows the user to request help.
       * @override
       * @returns {boolean}
       */

    }, {
      key: "helpSolutionAllowed",
      value: function helpSolutionAllowed() {
        return true;
      }
    }]);

    return DoublePuzzle;
  }(Activity);

  /**
   * The {@link ActivityPanel} where {@link DoublePuzzle} activities are played.
   * @class
   * @extends ActivityPanel
   */


  var DoublePuzzlePanel = function (_Activity$Panel) {
    _inherits(DoublePuzzlePanel, _Activity$Panel);

    /**
     * DoublePuzzlePanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function DoublePuzzlePanel(act, ps, $div) {
      _classCallCheck(this, DoublePuzzlePanel);

      return _possibleConstructorReturn(this, (DoublePuzzlePanel.__proto__ || Object.getPrototypeOf(DoublePuzzlePanel)).call(this, act, ps, $div));
    }

    /**
     * Miscellaneous cleaning operations
     * @override
     */


    _createClass(DoublePuzzlePanel, [{
      key: "clear",
      value: function clear() {
        if (this.bgA) {
          this.bgA.end();
          this.bgA = null;
        }
        if (this.bgB) {
          this.bgB.end();
          this.bgB = null;
        }
      }

      /**
       * Prepares the visual components of the activity
       * @override
       */

    }, {
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        if (this.firstRun) _get(DoublePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(DoublePuzzlePanel.prototype), "buildVisualComponents", this).call(this);
        this.clear();

        var abc = this.act.abc['primary'];
        if (abc) {
          if (abc.imgName) abc.setImgContent(this.act.project.mediaBag, null, false);

          if (this.act.acp !== null) this.act.acp.generateContent(abc.nch, abc.ncw, [abc], false);

          this.bgA = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abc);
          this.bgB = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abc);

          this.bgA.setContent(abc);

          this.bgA.accessibleText = this.ps.getMsg('source');
          this.bgB.accessibleText = this.ps.getMsg('target');

          this.bgA.setVisible(true);
          this.bgB.setVisible(true);

          var bgbA = this.bgA.getBackgroundActiveBox();
          var bgbB = this.bgB.getBackgroundActiveBox();
          if (bgbA && bgbB) bgbB.exchangeContent(bgbA);
        }
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(DoublePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(DoublePuzzlePanel.prototype), "initActivity", this).call(this);
        if (!this.firstRun) this.buildVisualComponents();else this.firstRun = false;

        if (this.bgA && this.bgB) {
          this.shuffle([this.bgA], true, true);
          if (this.useOrder) this.currentItem = this.bgA.getNextItem(-1);
          this.setAndPlayMsg('initial', 'start');
          this.invalidate().update();
          this.playing = true;
        }
      }

      /**
       * Updates the graphic content of this panel.
       * This method will be called from {@link AWT.Container#update} when needed.
       * @override
       * @param {AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
       * it's the whole panel.
       */

    }, {
      key: "updateContent",
      value: function updateContent(dirtyRegion) {
        _get(DoublePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(DoublePuzzlePanel.prototype), "updateContent", this).call(this);
        if (this.bgA && this.bgB && this.$canvas) {
          var canvas = this.$canvas.get(-1),
              ctx = canvas.getContext('2d');
          if (!dirtyRegion) dirtyRegion = new AWT.Rectangle(0, 0, canvas.width, canvas.height);
          ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
          this.bgA.update(ctx, dirtyRegion);
          this.bgB.update(ctx, dirtyRegion);
        }
        return this;
      }

      /**
       * Sets the real dimension of this panel.
       * @override
       * @param {AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
       * @returns {AWT.Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(preferredMaxSize) {
        return !this.bgA || !this.bgB || this.getBounds().equals(preferredMaxSize) ? preferredMaxSize : BoxBag.layoutDouble(preferredMaxSize, this.bgA, this.bgB, this.act.boxGridPos, this.act.margin);
      }

      /**
       * Sets the size and position of this activity panel
       * @override
       * @param {AWT.Rectangle} rect
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect) {
        if (this.$canvas) this.$canvas.remove();

        _get(DoublePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(DoublePuzzlePanel.prototype), "setBounds", this).call(this, rect);
        if (this.bgA || this.bgB) {
          // Create the main canvas
          this.$canvas = $("<canvas width=\"" + rect.dim.width + "\" height=\"" + rect.dim.height + "\"/>").css({
            position: 'absolute',
            top: 0,
            left: 0
          });
          this.$div.append(this.$canvas);

          // Create a [BoxConnector](BoxConnector.html) and attach it to the canvas context
          this.bc = new BoxConnector(this, this.$canvas.get(-1).getContext('2d'));

          // Repaint all
          this.invalidate().update();
        }
      }

      /**
       * Builds the accessible components needed for this ActivityPanel
       * This method is called when all main elements are placed and visible, when the activity is ready
       * to start or when resized.
       * @override
       */

    }, {
      key: "buildAccessibleComponents",
      value: function buildAccessibleComponents() {
        if (this.$canvas && this.accessibleCanvas) {
          _get(DoublePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(DoublePuzzlePanel.prototype), "buildAccessibleComponents", this).call(this);
          if (this.bgA) this.bgA.buildAccessibleElements(this.$canvas, this.$div, 'mousedown');
          if (this.bgB) {
            this.bgB.setCellAttr('accessibleAlwaysActive', true);
            this.bgB.buildAccessibleElements(this.$canvas, this.$div, 'mousedown');
          }
        }
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (this.bc && this.playing) {
          //
          // The [AWT.Point](AWT.html#Point) where the mouse or touch event has been originated
          var p = null;
          //
          // Two [ActiveBox](ActiveBox.html) pointers used for the [BoxConnector](BoxConnector.html)
          // `origin` and `dest` points.
          var bx1 = void 0,
              bx2 = void 0;
          // Array to be filled with actions to be executed at the end of event processing
          var delayedActions = [];
          //
          // _touchend_ event don't provide pageX nor pageY information
          if (event.type === 'touchend') p = this.bc.active ? this.bc.dest.clone() : new AWT.Point();else {
            // Touch events can have more than one touch, so `pageX` must be obtained from `touches[0]`
            var x = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX,
                y = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY;
            p = new AWT.Point(x - this.$div.offset().left, y - this.$div.offset().top);
          }

          // Flag for tracking `mouseup` events
          var up = false;
          switch (event.type) {
            case 'touchcancel':
              // Canvel movement
              if (this.bc.active) this.bc.end();
              break;

            case 'mouseup':
              // Don't consider drag moves below 3 pixels. Can be a "trembling click"
              if (this.bc.active && p.distanceTo(this.bc.origin) <= 3) break;

              up = true;
            /* falls through */
            case 'touchend':
            case 'touchstart':
            case 'mousedown':
              if (!this.bc.active) {
                //
                // A new pairing starts
                //
                // Pairings can never start with a `mouseup` event
                if (up) break;

                this.ps.stopMedia(1);
                //
                // Find the ActiveBox behind the clicked point
                bx1 = this.bgA.findActiveBox(p);
                if (bx1 && !bx1.isInactive() && (!this.act.useOrder || bx1.idOrder === this.currentItem)) {
                  // Start the [BoxConnector](BoxConnector.html)
                  if (this.act.dragCells) this.bc.begin(p, bx1);else this.bc.begin(p);
                  // Play cell media or event sound
                  if (!bx1.playMedia(this.ps, delayedActions)) this.playEvent('click');

                  // Move the focus to the opposite accessible group
                  if (this.bgB.$accessibleDiv) this.bgB.$accessibleDiv.focus();
                }
              } else {
                this.ps.stopMedia(1);
                // Pairing completed
                //
                // Find the active boxes behind `bc.origin` and `p`
                if (this.act.dragCells) bx1 = this.bc.bx;else bx1 = this.bgA.findActiveBox(this.bc.origin);
                bx2 = this.bgB.findActiveBox(p);

                // BoxConnector ends here
                this.bc.end();

                // Check if the pairing was OK
                if (bx1 && bx2 && bx2.isInactive()) {
                  var ok = false;
                  var src = bx1.getDescription() + " (" + bx1.idOrder + ")",
                      dest = "(" + bx2.idOrder + ")",
                      target = this.act.abc['primary'].getActiveBoxContent(bx2.idOrder);
                  if (bx1.getContent().isEquivalent(target, true)) {
                    // Pairing OK
                    ok = true;
                    bx1.exchangeContent(bx2);
                    bx1.setVisible(false);
                    if (this.act.useOrder) this.currentItem = this.bgA.getNextItem(this.currentItem);
                  }
                  // Check results and notify action
                  var cellsAtPlace = this.bgA.countInactiveCells();
                  this.ps.reportNewAction(this.act, 'PLACE', src, dest, ok, cellsAtPlace);
                  // Finish activity or play event sound
                  if (ok && cellsAtPlace === this.bgA.getNumCells()) this.finishActivity(true);else this.playEvent(ok ? 'actionOk' : 'actionError');
                }
                this.update();

                // Move the focus to the `source` accessible group
                if (this.bgA.$accessibleDiv) this.bgA.$accessibleDiv.focus();
              }
              break;

            case 'mousemove':
            case 'touchmove':
              this.bc.moveTo(p);
              break;
          }
          delayedActions.forEach(function (action) {
            return action();
          });
          event.preventDefault();
        }
      }
    }]);

    return DoublePuzzlePanel;
  }(Activity.Panel);

  Object.assign(DoublePuzzlePanel.prototype, {
    /**
     * The {@link ActiveBoxBag} object containing the information to be displayed in the `primary` panel
     * @name DoublePuzzlePanel#bgA
     * @type {ActiveBoxBag} */
    bgA: null,
    /**
     * The secondary {@link ActiveBoxBag}, initially empty.
     * @name DoublePuzzlePanel#bgB
     * @type {ActiveBoxBag} */
    bgB: null,
    /**
     * The box connector
     * @name DoublePuzzlePanel#bc
     * @type {BoxConnector} */
    bc: null,
    /**
     * List of mouse, touch and keyboard events intercepted by this panel
     * @override
     * @name DoublePuzzlePanel#events
     * @type {string[]} */
    events: ['mousedown', 'mouseup', 'mousemove', 'touchstart', 'touchend', 'touchmove', 'touchcancel']
  });

  /**
   * Panel class associated to this type of activity: {@link DoublePuzzlePanel}
   * @type {class} */
  DoublePuzzle.Panel = DoublePuzzlePanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@puzzles.DoublePuzzle'] = DoublePuzzle;

  return DoublePuzzle;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 522 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/puzzles/ExchangePuzzle.js
 *  Created : 30/05/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(35), __webpack_require__(24), __webpack_require__(58), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, ActiveBoxGrid, BoxBag, BoxConnector, AWT) {

  /**
   * This class of {@link Activity} shows only one panel with scrambled {@link ActiveBox} objects.
   * To solve the activity, each cell must exchange its location with another one. When all cells are
   * on place, the activity is done.
   * @exports ExchangePuzzle
   * @class
   * @extends Activity
   */
  var ExchangePuzzle = function (_Activity) {
    _inherits(ExchangePuzzle, _Activity);

    /**
     * ExchangePuzzle constructor
     * @param {JClicProject} project - The {@link JClicProject} to which this activity belongs
     */
    function ExchangePuzzle(project) {
      _classCallCheck(this, ExchangePuzzle);

      return _possibleConstructorReturn(this, (ExchangePuzzle.__proto__ || Object.getPrototypeOf(ExchangePuzzle)).call(this, project));
    }

    /**
     * Retrieves the minimum number of actions needed to solve this activity.
     * @override
     * @returns {number}
     */


    _createClass(ExchangePuzzle, [{
      key: "getMinNumActions",
      value: function getMinNumActions() {
        return this.abc.primary.getNumCells();
      }

      /**
       * Whether or not the activity uses random to scramble internal components
       * @override
       * @returns {boolean}
       */

    }, {
      key: "hasRandom",
      value: function hasRandom() {
        return true;
      }

      /**
       * When `true`, the activity must always be scrambled
       * @override
       * @returns {boolean}
       */

    }, {
      key: "shuffleAlways",
      value: function shuffleAlways() {
        return true;
      }

      /**
       * Whether the activity allows the user to request help.
       * @override
       * @returns {boolean}
       */

    }, {
      key: "helpSolutionAllowed",
      value: function helpSolutionAllowed() {
        return true;
      }
    }]);

    return ExchangePuzzle;
  }(Activity);

  /**
   * The {@link ActivityPanel} where activities of type {@link ExchangePuzzle} are played.
   * @class
   * @extends ActivityPanel
   */


  var ExchangePuzzlePanel = function (_Activity$Panel) {
    _inherits(ExchangePuzzlePanel, _Activity$Panel);

    /**
     * ExchangePuzzlePanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function ExchangePuzzlePanel(act, ps, $div) {
      _classCallCheck(this, ExchangePuzzlePanel);

      return _possibleConstructorReturn(this, (ExchangePuzzlePanel.__proto__ || Object.getPrototypeOf(ExchangePuzzlePanel)).call(this, act, ps, $div));
    }

    /**
     * Miscellaneous cleaning operations
     * @override
     */


    _createClass(ExchangePuzzlePanel, [{
      key: "clear",
      value: function clear() {
        if (this.bg) {
          this.bg.end();
          this.bg = null;
        }
      }

      /**
       * Prepares the visual components of the activity
       * @override
       */

    }, {
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        if (this.firstRun) _get(ExchangePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(ExchangePuzzlePanel.prototype), "buildVisualComponents", this).call(this);
        this.clear();

        var abc = this.act.abc['primary'];
        if (abc) {
          if (abc.imgName) abc.setImgContent(this.act.project.mediaBag, null, false);

          if (this.act.acp !== null) this.act.acp.generateContent(abc.nch, abc.ncw, [abc], false);

          this.bg = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abc);
          this.bg.setContent(abc);
          this.bg.setVisible(true);
        }
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(ExchangePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(ExchangePuzzlePanel.prototype), "initActivity", this).call(this);
        if (!this.firstRun) this.buildVisualComponents();else this.firstRun = false;

        if (this.bg) {
          this.shuffle([this.bg], true, true);
          if (this.useOrder) this.currentItem = this.bg.getNextItem(-1);
          this.setAndPlayMsg('initial', 'start');
          this.invalidate().update();
          this.playing = true;
        }
      }

      /**
       * Updates the graphic content of this panel.
       * This method will be called from {@link AWT.Container#update} when needed.
       * @override
       * @param {AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
       * it's the whole panel.
       */

    }, {
      key: "updateContent",
      value: function updateContent(dirtyRegion) {
        _get(ExchangePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(ExchangePuzzlePanel.prototype), "updateContent", this).call(this, dirtyRegion);
        if (this.bg && this.$canvas) {
          var canvas = this.$canvas.get(-1),
              ctx = canvas.getContext('2d');
          if (!dirtyRegion) dirtyRegion = new AWT.Rectangle(0, 0, canvas.width, canvas.height);
          ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
          this.bg.update(ctx, dirtyRegion);
        }
        return this;
      }

      /**
       * Sets the real dimension of this panel.
       * @override
       * @param {AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
       * @returns {AWT.Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(preferredMaxSize) {
        return !this.bg || this.getBounds().equals(preferredMaxSize) ? preferredMaxSize : BoxBag.layoutSingle(preferredMaxSize, this.bg, this.act.margin);
      }

      /**
       * Sets the size and position of this activity panel
       * @override
       * @param {AWT.Rectangle} rect
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect) {
        if (this.$canvas) this.$canvas.remove();

        _get(ExchangePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(ExchangePuzzlePanel.prototype), "setBounds", this).call(this, rect);
        if (this.bg) {
          // Create the main canvas
          this.$canvas = $("<canvas width=\"" + rect.dim.width + "\" height=\"" + rect.dim.height + "\"/>").css({
            position: 'absolute',
            top: 0,
            left: 0
          });
          this.$div.append(this.$canvas);

          // Create a [BoxConnector](BoxConnector.html) and attach it to the canvas context
          this.bc = new BoxConnector(this, this.$canvas.get(-1).getContext('2d'));

          // Repaint all
          this.invalidate().update();
        }
      }

      /**
       * Builds the accessible components needed for this ActivityPanel
       * This method is called when all main elements are placed and visible, when the activity is ready
       * to start or when resized.
       * @override
       */

    }, {
      key: "buildAccessibleComponents",
      value: function buildAccessibleComponents() {
        if (this.$canvas && this.accessibleCanvas && this.bg) {
          _get(ExchangePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(ExchangePuzzlePanel.prototype), "buildAccessibleComponents", this).call(this);
          this.bg.buildAccessibleElements(this.$canvas, this.$div, 'mousedown');
        }
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (this.bc && this.playing) {

          //
          // The [AWT.Point](AWT.html#Point) where the mouse or touch event has been originated
          var p = null;
          //
          // Two [ActiveBox](ActiveBox.html) pointers used for the [BoxConnector](BoxConnector.html)
          // `origin` and `dest` points.
          var bx1 = void 0,
              bx2 = void 0;
          // Array to be filled with actions to be executed at the end of event processing
          var delayedActions = [];
          //
          // _touchend_ event don't provide pageX nor pageY information
          if (event.type === 'touchend') p = this.bc.active ? this.bc.dest.clone() : new AWT.Point();else {
            // Touch events can have more than one touch, so `pageX` must be obtained from `touches[0]`
            var x = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX,
                y = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY;
            p = new AWT.Point(x - this.$div.offset().left, y - this.$div.offset().top);
          }

          // Flag for tracking `mouseup` events
          var up = false;

          switch (event.type) {
            case 'touchcancel':
              // Canvel movement
              if (this.bc.active) this.bc.end();
              break;

            case 'mouseup':
              // Don't consider drag moves below 3 pixels. Can be a "trembling click"
              if (this.bc.active && p.distanceTo(this.bc.origin) <= 3) break;

              up = true;
            /* falls through */
            case 'touchend':
            case 'touchstart':
            case 'mousedown':
              if (!this.bc.active) {
                // New pairing starts
                //
                // Pairings never can start with a `mouseup` event
                if (up) break;

                this.ps.stopMedia(1);
                // Find the ActiveBox behind the clicked point
                bx1 = this.bg.findActiveBox(p);
                if (bx1) {
                  // Start the [BoxConnector](BoxConnector.html)
                  if (this.act.dragCells) this.bc.begin(p, bx1);else this.bc.begin(p);
                  // Play cell media or event sound
                  if (!bx1.playMedia(this.ps, delayedActions)) this.playEvent('click');
                }
              } else {
                this.ps.stopMedia(1);
                // Pairing completed
                //
                // Find the active boxes behind `bc.origin` and `p`
                if (this.act.dragCells) bx1 = this.bc.bx;else bx1 = this.bg.findActiveBox(this.bc.origin);
                this.bc.end();
                bx2 = this.bg.findActiveBox(p);
                //
                // Check if the pairing was OK
                if (bx1 && bx2) {
                  var src = bx1.getDescription() + " (" + bx1.idOrder + ")",
                      dest = "(" + bx2.idLoc + ")";
                  var ok = bx1.idOrder === bx2.idLoc;
                  this.bg.swapCellPositions(bx1, bx2, true);
                  // Check results and notify action
                  var cellsAtPlace = this.bg.countCellsAtEquivalentPlace(true);
                  this.ps.reportNewAction(this.act, 'PLACE', src, dest, ok, cellsAtPlace);
                  // End activity or play event sound
                  if (ok && cellsAtPlace === this.bg.getNumCells()) this.finishActivity(true);else this.playEvent(ok ? 'actionOk' : 'actionError');
                }
                this.update();
              }
              break;

            case 'mousemove':
            case 'touchmove':
              this.bc.moveTo(p);
              break;
          }
          delayedActions.forEach(function (action) {
            return action();
          });
          event.preventDefault();
        }
      }
    }]);

    return ExchangePuzzlePanel;
  }(Activity.Panel);

  Object.assign(ExchangePuzzlePanel.prototype, {
    /**
     * The {@link ActiveBoxBag} object containing the information to be displayed in the panel.
     * @name ExchangePuzzlePanel#bg
     * @type {ActiveBoxBag} */
    bg: null,
    /**
     * The box connector
     * @name ExchangePuzzlePanel#bc
     * @type {BoxConnector} */
    bc: null,
    /**
     * List of mouse, touch and keyboard events intercepted by this panel
     * @override
     * @name ExchangePuzzlePanel#events
     * @type {string[]} */
    events: ['mousedown', 'mouseup', 'mousemove', 'touchstart', 'touchend', 'touchmove', 'touchcancel']
  });

  /**
   * Panel class associated to this type of activity: {@link ExchangePuzzlePanel}
   * @type {class} */
  ExchangePuzzle.Panel = ExchangePuzzlePanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@puzzles.ExchangePuzzle'] = ExchangePuzzle;

  return ExchangePuzzle;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 523 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/puzzles/HolePuzzle.js
 *  Created : 01/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(35), __webpack_require__(24), __webpack_require__(58), __webpack_require__(3), __webpack_require__(75)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, ActiveBoxGrid, BoxBag, BoxConnector, AWT, Rectangular) {

  /**
   * This class of {@link Activity} shows only one panel with scrambled {@link ActiveBox} cells.
   *
   * One of the cells is out of the main panel, thus allowing its neighbors occupy their space.
   * Only immediate neighbors of the "hole" can move into it.
   *
   * When all cells are on place, the initially "expulsed" cell comes back home and the activity is done.
   * @exports HolePuzzle
   * @class
   * @extends Activity
   */
  var HolePuzzle = function (_Activity) {
    _inherits(HolePuzzle, _Activity);

    /**
     * HolePuzzle constructor
     * @param {JClicProject} project - The {@link JClicProject} to which this activity belongs
     */
    function HolePuzzle(project) {
      _classCallCheck(this, HolePuzzle);

      return _possibleConstructorReturn(this, (HolePuzzle.__proto__ || Object.getPrototypeOf(HolePuzzle)).call(this, project));
    }

    /**
     * Retrieves the minimum number of actions needed to solve this activity.
     * @override
     * @returns {number}
     */


    _createClass(HolePuzzle, [{
      key: "getMinNumActions",
      value: function getMinNumActions() {
        return this.abc.primary.getNumCells();
      }

      /**
       * Whether or not the activity uses random to scramble internal components
       * @override
       * @returns {boolean}
       */

    }, {
      key: "hasRandom",
      value: function hasRandom() {
        return true;
      }

      /**
       * When `true`, the activity must always be scrambled
       * @override
       * @returns {boolean}
       */

    }, {
      key: "shuffleAlways",
      value: function shuffleAlways() {
        return true;
      }

      /**
       * Whether the activity allows the user to request help
       * @override
       * @returns {boolean}
       */

    }, {
      key: "helpSolutionAllowed",
      value: function helpSolutionAllowed() {
        return true;
      }
    }]);

    return HolePuzzle;
  }(Activity);

  /**
   * The {@link ActivityPanel} where {@link HolePuzzle} activities are played
   * @class
   * @extends ActivityPanel
   */


  var HolePuzzlePanel = function (_Activity$Panel) {
    _inherits(HolePuzzlePanel, _Activity$Panel);

    /**
     * HolePuzzlePanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function HolePuzzlePanel(act, ps, $div) {
      _classCallCheck(this, HolePuzzlePanel);

      return _possibleConstructorReturn(this, (HolePuzzlePanel.__proto__ || Object.getPrototypeOf(HolePuzzlePanel)).call(this, act, ps, $div));
    }

    /**
     * Miscellaneous cleaning operations
     * @override
     */


    _createClass(HolePuzzlePanel, [{
      key: "clear",
      value: function clear() {
        if (this.bg) {
          this.bg.end();
          this.bg = null;
        }
        if (this.parkBg) {
          this.parkBg.end();
          this.parkBg = null;
        }
      }

      /**
       * Prepares the visual components of the activity
       * @override
       */

    }, {
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        if (this.firstRun) _get(HolePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(HolePuzzlePanel.prototype), "buildVisualComponents", this).call(this);
        this.clear();

        var abc = this.act.abc['primary'];
        if (abc) {
          if (abc.imgName) abc.setImgContent(this.act.project.mediaBag, null, false);

          if (this.act.acp !== null) this.act.acp.generateContent(abc.nch, abc.ncw, [abc], false);

          this.bg = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abc);
          this.bg.setContent(abc);
          this.bg.setVisible(true);

          this.hiddenBoxIndex = Math.floor(Math.random() * this.bg.getNumCells());
          this.hiddenBox = this.bg.getActiveBox(this.hiddenBoxIndex);
          this.hiddenBox.setVisible(false);
          this.parkBg = new ActiveBoxGrid(null, this, abc.bb, this.act.margin, this.act.margin, this.hiddenBox.dim.width, this.hiddenBox.dim.height, new Rectangular(1, 1));
          this.parkBg.setContent(abc, null, this.hiddenBoxIndex, 0, 1);
          this.parkBg.setBorder(this.bg.hasBorder());
          this.parkBg.setVisible(true);
        }
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(HolePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(HolePuzzlePanel.prototype), "initActivity", this).call(this);
        if (!this.firstRun) this.buildVisualComponents();else this.firstRun = false;

        if (this.bg) {
          //
          // This activity has an special shuffle method. Cells can move only to places near the 'hole'
          if (this.act.shuffles % 2 !== 1) this.act.shuffles++;
          for (var i = 0; i < this.act.shuffles; i++) {
            var pth = this.bg.getCoord(this.hiddenBox);
            var v = Math.floor(Math.random() * 2) === 0 ? 1 : -1;

            if (Math.floor(Math.random() * 2) === 0) {
              pth.x += v;
              if (pth.x < 0 || pth.x >= this.bg.nCols) pth.x -= 2 * v;
            } else {
              pth.y += v;
              if (pth.y < 0 || pth.y >= this.bg.nRows) pth.y -= 2 * v;
            }
            var dstBx = this.bg.getActiveBoxWithIdLoc(pth.y * this.bg.nCols + pth.x);
            if (dstBx !== null) this.hiddenBox.exchangeLocation(dstBx);
          }
          this.setAndPlayMsg('initial', 'start');
          this.invalidate().update();
          this.playing = true;
        }
      }

      /**
       * Updates the graphic content of this panel.
       * This method will be called from {@link AWT.Container#update} when needed.
       * @override
       * @param {AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
       * it's the whole panel.
       */

    }, {
      key: "updateContent",
      value: function updateContent(dirtyRegion) {
        _get(HolePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(HolePuzzlePanel.prototype), "updateContent", this).call(this, dirtyRegion);
        if (this.bg && this.parkBg && this.$canvas) {
          var canvas = this.$canvas.get(-1),
              ctx = canvas.getContext('2d');
          if (!dirtyRegion) dirtyRegion = new AWT.Rectangle(0, 0, canvas.width, canvas.height);
          ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
          this.bg.update(ctx, dirtyRegion);
          this.parkBg.update(ctx, dirtyRegion);
        }
        return this;
      }

      /**
       * Sets the real dimension of this panel.
       * @override
       * @param {AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
       * @returns {AWT.Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(preferredMaxSize) {
        return !this.bg || !this.parkBg || this.getBounds().equals(preferredMaxSize) ? preferredMaxSize : BoxBag.layoutDouble(preferredMaxSize, this.bg, this.parkBg, this.act.boxGridPos, this.act.margin);
      }

      /**
       * Sets the size and position of this activity panel
       * @override
       * @param {AWT.Rectangle} rect
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect) {
        if (this.$canvas) this.$canvas.remove();

        _get(HolePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(HolePuzzlePanel.prototype), "setBounds", this).call(this, rect);
        if (this.bg && this.parkBg) {
          // Create the main canvas
          this.$canvas = $("<canvas width=\"" + rect.dim.width + "\" height=\"" + rect.dim.height + "\"/>").css({
            position: 'absolute',
            top: 0,
            left: 0
          });
          this.$div.append(this.$canvas);

          // Repaint all
          this.invalidate().update();
        }
      }

      /**
       * Builds the accessible components needed for this ActivityPanel
       * This method is called when all main elements are placed and visible, when the activity is ready
       * to start or when resized.
       * @override
       */

    }, {
      key: "buildAccessibleComponents",
      value: function buildAccessibleComponents() {
        if (this.$canvas && this.accessibleCanvas && this.bg) {
          _get(HolePuzzlePanel.prototype.__proto__ || Object.getPrototypeOf(HolePuzzlePanel.prototype), "buildAccessibleComponents", this).call(this);
          this.bg.buildAccessibleElements(this.$canvas, this.$div);
        }
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (this.playing) {
          var p = new AWT.Point(event.pageX - this.$div.offset().left, event.pageY - this.$div.offset().top);
          // Array to be filled with actions to be executed at the end of event processing
          var delayedActions = [];

          switch (event.type) {
            case 'click':
              this.ps.stopMedia(1);
              // Find the box behind the clicked point
              var bx = this.bg.findActiveBox(p);
              if (bx) {
                if (bx.isVisible()) {
                  // Check if it's a valid move
                  var pt = this.bg.getCoordDist(bx, this.hiddenBox);
                  if (Math.abs(pt.x) + Math.abs(pt.y) === 1) {
                    // Ok, the cell is adjacent to the hole. Complete the move.
                    var m = bx.playMedia(this.ps, delayedActions);
                    var src = bx.getDescription() + " (" + bx.idOrder + ")",
                        dest = "(" + this.hiddenBox.idLoc + ")";
                    bx.exchangeLocation(this.hiddenBox);
                    var ok = bx.idOrder === bx.idLoc;
                    // Check results and notify action
                    var cellsAtPlace = this.bg.countCellsAtEquivalentPlace(true);
                    this.ps.reportNewAction(this.act, 'SELECT', src, dest, ok, cellsAtPlace);
                    if (ok && cellsAtPlace === this.bg.getNumCells()) {
                      // Activity completed!
                      this.hiddenBox.setVisible(true);
                      this.parkBg.setVisible(false);
                      this.finishActivity(true);
                    } else if (!m) this.playEvent('click');
                  }
                  this.update();
                } else {
                  this.playEvent('actionError');
                }
              }
              break;
          }
          delayedActions.forEach(function (action) {
            return action();
          });
          event.preventDefault();
        }
      }
    }]);

    return HolePuzzlePanel;
  }(Activity.Panel);

  Object.assign(HolePuzzlePanel.prototype, {
    /**
     * The {@link ActiveBoxBag} object containing the information to be displayed in the panel.
     * @name HolePuzzlePanel#bg
     * @type {ActiveBoxBag} */
    bg: null,
    /**
     * An auxiliary box bag with only one box, used to store the "missing piece" of
     * the puzzle.
     * @name HolePuzzlePanel#parkBg
     * @type {ActiveBoxGrid} */
    parkBg: null,
    /**
     * The hidden cell
     * @name HolePuzzlePanel#hiddenBox
     * @type {ActiveBox} */
    hiddenBox: null,
    /**
     * Index of the hidden cell on the ActiveBagContent
     * @name HolePuzzlePanel#hiddenBoxIndex
     * @type {number} */
    hiddenBoxIndex: -1,
    /**
     * List of mouse, touch and keyboard events intercepted by this panel
     * @override
     * @name HolePuzzlePanel#events
     * @type {string[]} */
    events: ['click']
  });

  /**
   * Panel class associated to this type of activity: {@link HolePuzzlePanel}
   * @type {class} */
  HolePuzzle.Panel = HolePuzzlePanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@puzzles.HolePuzzle'] = HolePuzzle;

  return HolePuzzle;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 524 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/memory/MemoryGame.js
 *  Created : 04/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(35), __webpack_require__(24), __webpack_require__(58), __webpack_require__(3), __webpack_require__(75)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, ActiveBoxGrid, BoxBag, BoxConnector, AWT, Rectangular) {

  /**
   * This class of {@link Activity} shows a panel with duplicate {@link ActiveBox} objects initially
   * hidden and scrambled. To complete the activity, all object pairs must be found. Only two objects
   * are revealed in every move, so the user must remember the content of each cell.
   *
   * The cell pairs can have identical content, defined in the `primary` {@link ActiveBagContent} of
   * the activity, or two different contents. In this case, the `secondary` bag elements will have
   * content related to each `primary` element.
   * @exports MemoryGame
   * @class
   * @extends Activity
   */
  var MemoryGame = function (_Activity) {
    _inherits(MemoryGame, _Activity);

    /**
     * MemoryGame constructor
     * @param {JClicProject} project - The {@link JClicProject} to which this activity belongs
     */
    function MemoryGame(project) {
      _classCallCheck(this, MemoryGame);

      return _possibleConstructorReturn(this, (MemoryGame.__proto__ || Object.getPrototypeOf(MemoryGame)).call(this, project));
    }

    /**
     * Retrieves the minimum number of actions needed to solve this activity.
     * @override
     * @returns {number}
     */


    _createClass(MemoryGame, [{
      key: "getMinNumActions",
      value: function getMinNumActions() {
        return this.abc.primary.getNumCells();
      }

      /**
       * Whether or not the activity uses random to scramble internal components
       * @override
       * @returns {boolean}
       */

    }, {
      key: "hasRandom",
      value: function hasRandom() {
        return true;
      }

      /**
       * When `true`, the activity must always be scrambled
       * @override
       * @returns {boolean}
       */

    }, {
      key: "shuffleAlways",
      value: function shuffleAlways() {
        return true;
      }
    }]);

    return MemoryGame;
  }(Activity);

  /**
   * The {@link ActivityPanel} where {@link MemoryGame} activities are played.
   * @class
   * @extends ActivityPanel
   */


  var MemoryGamePanel = function (_Activity$Panel) {
    _inherits(MemoryGamePanel, _Activity$Panel);

    /**
     * MemoryGamePanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function MemoryGamePanel(act, ps, $div) {
      _classCallCheck(this, MemoryGamePanel);

      return _possibleConstructorReturn(this, (MemoryGamePanel.__proto__ || Object.getPrototypeOf(MemoryGamePanel)).call(this, act, ps, $div));
    }

    /**
     * Miscellaneous cleaning operations
     * @override
     */


    _createClass(MemoryGamePanel, [{
      key: "clear",
      value: function clear() {
        if (this.bg) {
          this.bg.end();
          this.bg = null;
        }
      }

      /**
       * Prepares the visual components of the activity
       * @override
       */

    }, {
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        if (this.firstRun) _get(MemoryGamePanel.prototype.__proto__ || Object.getPrototypeOf(MemoryGamePanel.prototype), "buildVisualComponents", this).call(this);
        this.clear();

        var abcA = this.act.abc['primary'],
            abcB = this.act.abc['secondary'];

        if (abcA) {
          if (abcA.imgName) abcA.setImgContent(this.act.project.mediaBag, null, false);
          if (abcB && abcB.imgName) abcB.setImgContent(this.act.project.mediaBag, null, false);
          if (this.act.acp !== null) {
            var contentKit = [abcA];
            if (abcB) contentKit.push(abcB);
            this.act.acp.generateContent(abcA.nch, abcA.ncw, contentKit, false);
          }

          var ncw = abcA.ncw,
              nch = abcA.nch;
          if (this.act.boxGridPos === 'AB' || this.act.boxGridPos === 'BA') ncw *= 2;else nch *= 2;

          this.bg = new ActiveBoxGrid(null, this, abcA.bb, this.act.margin, this.act.margin, abcA.w * ncw, abcA.h * nch, new Rectangular(ncw, nch));

          var nc = abcA.getNumCells();
          this.bg.setBorder(abcA.border);
          this.bg.setContent(abcA, null, 0, 0, nc);
          this.bg.setContent(abcB ? abcB : abcA, null, 0, nc, nc);
          for (var i = 0; i < 2; i++) {
            for (var j = 0; j < nc; j++) {
              var bx = this.bg.getActiveBox(i * nc + j);
              bx.idAss = j;
              bx.setInactive(true);
            }
          }
          this.bg.setVisible(true);
        }
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(MemoryGamePanel.prototype.__proto__ || Object.getPrototypeOf(MemoryGamePanel.prototype), "initActivity", this).call(this);

        if (!this.firstRun) this.buildVisualComponents();else this.firstRun = false;

        if (this.bg) {
          this.shuffle([this.bg], true, true);
          this.invalidate().update();
          this.setAndPlayMsg('initial', 'start');
          this.playing = true;
        }
      }

      /**
       * Updates the graphic content of this panel.
       * This method will be called from {@link AWT.Container#update} when needed.
       * @override
       * @param {AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
       * it's the whole panel.
       */

    }, {
      key: "updateContent",
      value: function updateContent(dirtyRegion) {
        _get(MemoryGamePanel.prototype.__proto__ || Object.getPrototypeOf(MemoryGamePanel.prototype), "updateContent", this).call(this, dirtyRegion);
        if (this.bg && this.$canvas) {
          var canvas = this.$canvas.get(-1),
              ctx = canvas.getContext('2d');
          if (!dirtyRegion) dirtyRegion = new AWT.Rectangle(0, 0, canvas.width, canvas.height);
          ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
          this.bg.update(ctx, dirtyRegion);
        }
        return this;
      }

      /**
       * Sets the real dimension of this panel.
       * @override
       * @param {AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
       * @returns {AWT.Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(preferredMaxSize) {
        if (!this.bg || this.getBounds().equals(preferredMaxSize)) return preferredMaxSize;
        return BoxBag.layoutSingle(preferredMaxSize, this.bg, this.act.margin);
      }

      /**
       * Sets the size and position of this activity panel
       * @override
       * @param {AWT.Rectangle} rect
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect) {
        if (this.$canvas) this.$canvas.remove();

        _get(MemoryGamePanel.prototype.__proto__ || Object.getPrototypeOf(MemoryGamePanel.prototype), "setBounds", this).call(this, rect);
        if (this.bg) {
          // Create the main canvas
          this.$canvas = $("<canvas width=\"" + rect.dim.width + "\" height=\"" + rect.dim.height + "\"/>").css({
            position: 'absolute',
            top: 0,
            left: 0
          });
          this.$div.append(this.$canvas);

          // Create a [BoxConnector](BoxConnector.html) and attach it to the canvas context
          this.bc = new BoxConnector(this, this.$canvas.get(-1).getContext('2d'));

          // Repaint all
          this.invalidate().update();
        }
      }

      /**
       * Builds the accessible components needed for this ActivityPanel
       * This method is called when all main elements are placed and visible, when the activity is ready
       * to start or when resized.
       * @override
       */

    }, {
      key: "buildAccessibleComponents",
      value: function buildAccessibleComponents() {
        if (this.$canvas && this.accessibleCanvas && this.bg) {
          _get(MemoryGamePanel.prototype.__proto__ || Object.getPrototypeOf(MemoryGamePanel.prototype), "buildAccessibleComponents", this).call(this);
          this.bg.setCellAttr('accessibleAlwaysActive', true);
          this.bg.buildAccessibleElements(this.$canvas, this.$div, 'mousedown');
        }
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (this.bc && this.playing) {
          //
          // The [AWT.Point](AWT.html#Point) where the mouse or touch event has been originated
          var p = null;
          //
          // Two [ActiveBox](ActiveBox.html) pointers used for the [BoxConnector](BoxConnector.html)
          // `origin` and `dest` points.
          var bx1 = void 0,
              bx2 = void 0,

          // Array to be filled with actions to be executed at the end of event processing
          delayedActions = [];
          //
          // _touchend_ event don't provide pageX nor pageY information
          if (event.type === 'touchend') p = this.bc.active ? this.bc.dest.clone() : new AWT.Point();else {
            // Touch events can have more than one touch, so `pageX` must be obtained from `touches[0]`
            var x = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX,
                y = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY;
            p = new AWT.Point(x - this.$div.offset().left, y - this.$div.offset().top);
          }

          // Flag for tracking `mouseup` events
          var up = false;
          switch (event.type) {
            case 'touchcancel':
              // Canvel movement
              if (this.bc.active) this.bc.end();
              break;

            case 'mouseup':
            case 'touchend':
              // Don't consider drag moves below 3 pixels. Can be a "trembling click"
              if (this.bc.active && p.distanceTo(this.bc.origin) <= 3) break;

              up = true;
            /* falls through */
            case 'touchstart':
            case 'mousedown':
              if (!this.bc.active) {
                // New pairing starts
                //
                // Pairings can never start with a `mouseup` event
                if (up) break;

                this.ps.stopMedia(1);
                //
                // Find the ActiveBox behind the clicked point
                bx1 = this.bg ? this.bg.findActiveBox(p) : null;
                if (bx1 && bx1.idAss !== -1) {
                  // Play cell media or event sound
                  if (!bx1.playMedia(this.ps, delayedActions)) this.playEvent('click');
                  bx1.setInactive(false);
                  // Start the [BoxConnector](BoxConnector.html)
                  this.update();
                  if (this.act.dragCells) this.bc.begin(p, bx1);else this.bc.begin(p);
                }
              } else {
                this.ps.stopMedia(1);
                // Pairing completed
                //
                // Find the active boxes behind `bc.origin` and `p`
                if (this.act.dragCells) bx1 = this.bc.bx;else bx1 = this.bg ? this.bg.findActiveBox(this.bc.origin) : null;
                this.bc.end();
                bx2 = this.bg ? this.bg.findActiveBox(p) : null;
                //
                // Check if the pairing was OK
                if (bx1 && bx1.idAss !== -1 && bx2 && bx2.idAss !== -1) {
                  if (bx1 !== bx2) {
                    var ok = false;
                    if (bx1.idAss === bx2.idAss || bx1.getContent().isEquivalent(bx2.getContent(), true)) {
                      ok = true;
                      bx1.idAss = -1;
                      bx1.setInactive(false);
                      bx2.idAss = -1;
                      bx2.setInactive(false);
                    } else {
                      bx1.setInactive(true);
                      if (this.act.dragCells) bx2.setInactive(true);else {
                        bx2.setInactive(false);
                        // Start the [BoxConnector](BoxConnector.html)
                        this.update();
                        if (this.act.dragCells) this.bc.begin(p, bx1);else this.bc.begin(p);
                      }
                    }
                    var m = bx2.playMedia(this.ps, delayedActions);
                    if (this.bg) {
                      var cellsAtPlace = this.bg.countCellsWithIdAss(-1);
                      this.ps.reportNewAction(this.act, 'MATCH', bx1.getDescription(), bx2.getDescription(), ok, cellsAtPlace / 2);
                      if (ok && cellsAtPlace === this.bg.getNumCells()) this.finishActivity(true);else if (!m) this.playEvent(ok ? 'actionOk' : 'actionError');
                    }
                  } else {
                    this.playEvent('CLICK');
                    bx1.setInactive(true);
                  }
                } else if (bx1 !== null) bx1.setInactive(true);

                this.invalidate().update();
              }
              break;

            case 'mousemove':
            case 'touchmove':
              this.bc.moveTo(p);
              break;
          }
          delayedActions.forEach(function (action) {
            return action();
          });
          event.preventDefault();
        }
      }
    }]);

    return MemoryGamePanel;
  }(Activity.Panel);

  Object.assign(MemoryGamePanel.prototype, {
    /**
     * The {@link ActiveBoxBag} containing the information to be displayed.
     * @name MemoryGamePanel#bg
     * @type {ActiveBoxBag} */
    bg: null,
    /**
     * The {@link BoxConnector} used to reveal pairs of cells
     * @name MemoryGamePanel#bc
     * @type {BoxConnector} */
    bc: null,
    /**
     * List of mouse, touch and keyboard events intercepted by this panel
     * @override
     * @name MemoryGamePanel#events
     * @type {string[]} */
    events: ['mousedown', 'mouseup', 'mousemove', 'touchstart', 'touchend', 'touchmove', 'touchcancel']
  });

  /**
   * Panel class associated to this type of activity: {@link MemoryGamePanel}
   * @type {class} */
  MemoryGame.Panel = MemoryGamePanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@memory.MemoryGame'] = MemoryGame;

  return MemoryGame;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 525 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/associations/ComplexAssociation.js
 *  Created : 03/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(3), __webpack_require__(215)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, AWT, SimpleAssociation) {

  /**
   * This is a special case of {@link SimpleAssociation} where the elements of the 'secondary' panel
   * can have zero, one or more associated elements in the 'primary' panel.
   * @exports ComplexAssociation
   * @class
   * @extends SimpleAssociation
   */
  var ComplexAssociation = function (_SimpleAssociation) {
    _inherits(ComplexAssociation, _SimpleAssociation);

    /**
     * ComplexAssociation constructor
     * @param {JClicProject} project - The JClic project to which this activity belongs
     */
    function ComplexAssociation(project) {
      _classCallCheck(this, ComplexAssociation);

      var _this = _possibleConstructorReturn(this, (ComplexAssociation.__proto__ || Object.getPrototypeOf(ComplexAssociation)).call(this, project));

      _this.useIdAss = true;
      return _this;
    }

    /**
     * Loads this object settings from an XML element
     * @override
     * @param {external:jQuery} $xml - The jQuery XML element to parse
     */


    _createClass(ComplexAssociation, [{
      key: "setProperties",
      value: function setProperties($xml) {
        _get(ComplexAssociation.prototype.__proto__ || Object.getPrototypeOf(ComplexAssociation.prototype), "setProperties", this).call(this, $xml);
        this.abc['primary'].avoidAllIdsNull(this.abc['secondary'].getNumCells());
      }

      /**
       * Retrieves the minimum number of actions needed to solve this activity.
       * @override
       * @returns {number}
       */

    }, {
      key: "getMinNumActions",
      value: function getMinNumActions() {
        if (this.invAss) return this.abc['secondary'].getNumCells();else return this.abc['primary'].getNumCells() - this.nonAssignedCells;
      }
    }]);

    return ComplexAssociation;
  }(SimpleAssociation);

  Object.assign(ComplexAssociation.prototype, {
    /**
     * Number of unassigned cells
     * @name ComplexAssociation#nonAssignedCells
     * @type {number} */
    nonAssignedCells: 0,
    /**
     * Uses cell's `idAss` field to check if pairings match
     * @name ComplexAssociation#useIdAss
     * @type {boolean} */
    useIdAss: false
  });

  /**
   * The {@link ActivityPanel} where {@link ComplexAssociation} activities are played.
   * @class
   * @extends SimpleAssociationPanel
   */

  var ComplexAssociationPanel = function (_SimpleAssociation$Pa) {
    _inherits(ComplexAssociationPanel, _SimpleAssociation$Pa);

    /**
     * ComplexAssociationPanel prototype
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function ComplexAssociationPanel(act, ps, $div) {
      _classCallCheck(this, ComplexAssociationPanel);

      return _possibleConstructorReturn(this, (ComplexAssociationPanel.__proto__ || Object.getPrototypeOf(ComplexAssociationPanel)).call(this, act, ps, $div));
    }

    /**
     * Prepares the visual components of the activity
     * @override
     */


    _createClass(ComplexAssociationPanel, [{
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        var _this3 = this;

        _get(ComplexAssociationPanel.prototype.__proto__ || Object.getPrototypeOf(ComplexAssociationPanel.prototype), "buildVisualComponents", this).call(this);

        var abcA = this.act.abc['primary'],
            abcB = this.act.abc['secondary'];

        if (abcA && abcB) {
          if (this.act.invAss) this.invAssCheck = Array(abcB.getNumCells()).fill(false);
          this.bgA.setDefaultIdAss();
          this.act.nonAssignedCells = 0;
          this.bgA.cells.forEach(function (bx) {
            if (bx.idAss === -1) {
              _this3.act.nonAssignedCells++;
              bx.switchToAlt(_this3.ps);
            }
          });
        }
      }

      /**
       * Checks if all inverse associations are done
       * @returns {boolean}
       */

    }, {
      key: "checkInvAss",
      value: function checkInvAss() {
        if (!this.act.invAss || !this.invAssCheck) return false;
        return this.invAssCheck.every(function (chk) {
          return chk;
        });
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (this.bc && this.playing) {
          //
          // The [AWT.Point](AWT.html#Point) where the mouse or touch event has been originated
          // and two [ActiveBox](ActiveBox.html) pointers used for the [BoxConnector](BoxConnector.html)
          // `origin` and `dest` points.
          var p = null,
              bx1 = void 0,
              bx2 = void 0;

          //
          // _touchend_ event don't provide pageX nor pageY information
          if (event.type === 'touchend') {
            p = this.bc.active ? this.bc.dest.clone() : new AWT.Point();
          } else {
            // Touch events can have more than one touch, so `pageX` must be obtained from `touches[0]`
            var x = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX,
                y = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY;
            p = new AWT.Point(x - this.$div.offset().left, y - this.$div.offset().top);
          }

          var
          // Flag for tracking `mouseup` events
          up = false,

          // Flag for assuring that only one media plays per event (avoid event sounds overlapping
          // cell's media sounds)
          m = false,

          // Flag for tracking clicks on the background of grid A
          clickOnBg0 = false,

          // Array to be filled with actions to be executed at the end of event processing
          delayedActions = [];

          switch (event.type) {
            case 'touchcancel':
              // Canvel movement
              if (this.bc.active) this.bc.end();
              break;

            case 'mouseup':
              // Don't consider drag moves below 3 pixels. Can be a "trembling click"
              if (this.bc.active && p.distanceTo(this.bc.origin) <= 3) {
                break;
              }
              up = true;
            /* falls through */
            case 'touchend':
            case 'touchstart':
            case 'mousedown':
              if (!this.bc.active) {
                // New pairing starts
                //
                // Pairings can never start with a `mouseup` event
                if (up) break;

                this.ps.stopMedia(1);
                // Determine if click was done on panel A or panel B
                bx1 = this.bgA ? this.bgA.findActiveBox(p) : null;
                bx2 = this.bgB ? this.bgB.findActiveBox(p) : null;
                if (bx1 && bx1.idAss !== -1 && (!this.act.useOrder || bx1.idOrder === this.currentItem) || !this.act.useOrder && bx2) {
                  // Start the [BoxConnector](BoxConnector.html)
                  if (this.act.dragCells) this.bc.begin(p, bx1 || bx2);else this.bc.begin(p);
                  // Play cell media or event sound
                  m = m || (bx1 || bx2).playMedia(this.ps, delayedActions);
                  if (!m) this.playEvent('click');
                }

                // Move the focus to the opposite accessible group
                var bg = bx1 ? this.bgA : this.bgB;
                if (bg && bg.$accessibleDiv) {
                  bg = bx1 ? this.bgB : this.bgA;
                  if (bg && bg.$accessibleDiv) bg.$accessibleDiv.focus();
                }
              } else {
                this.ps.stopMedia(1);
                // Pairing completed
                //
                // Find the active boxes behind `bc.origin` and `p`
                var origin = this.bc.origin;
                this.bc.end();
                bx1 = this.bgA ? this.bgA.findActiveBox(origin) : null;
                if (bx1) {
                  bx2 = this.bgB ? this.bgB.findActiveBox(p) : null;
                } else {
                  bx2 = this.bgB ? this.bgB.findActiveBox(origin) : null;
                  if (bx2) {
                    bx1 = this.bgA ? this.bgA.findActiveBox(p) : null;
                    clickOnBg0 = true;
                  }
                }
                // Check if the pairing was correct
                if (bx1 && bx2 && bx1.idAss !== -1 && !bx2.isInactive() && this.act.abc['secondary']) {
                  var src = bx1.getDescription(),
                      dest = bx2.getDescription(),
                      matchingDest = this.act.abc['secondary'].getActiveBoxContent(bx1.idAss);
                  var ok = false;

                  if (bx1.idAss === bx2.idOrder || bx2.getContent().isEquivalent(matchingDest, true)) {
                    // Pairing was OK. Play media and disable involved cells
                    ok = true;
                    bx1.idAss = -1;
                    if (this.act.abc['solvedPrimary']) {
                      bx1.switchToAlt(this.ps);
                      m = m || bx1.playMedia(this.ps, delayedActions);
                    } else {
                      if (clickOnBg0) m = m || bx1.playMedia(this.ps, delayedActions);else m = m || bx2.playMedia(this.ps, delayedActions);
                      bx1.clear();
                    }
                    if (this.act.invAss) {
                      this.invAssCheck[bx2.idOrder] = true;
                      bx2.clear();
                    }
                    if (this.act.useOrder && this.bgA)
                      // Load next item
                      this.currentItem = this.bgA.getNextItem(this.currentItem);
                  }
                  // Check results and notify action
                  if (this.bgA) {
                    var cellsPlaced = this.bgA.countCellsWithIdAss(-1);
                    this.ps.reportNewAction(this.act, 'MATCH', src, dest, ok, cellsPlaced - this.act.nonAssignedCells);
                    // End activity or play event sound
                    if (ok && (this.checkInvAss() || cellsPlaced === this.bgA.getNumCells())) this.finishActivity(true);else if (!m) this.playEvent(ok ? 'actionOk' : 'actionError');
                  }
                } else if (this.bgB && (clickOnBg0 && this.bgA && this.bgA.contains(p) || !clickOnBg0 && this.bgB.contains(p))) {
                  // click on grid, out of cell
                  var srcOut = bx1 ? bx1.getDescription() : bx2 ? bx2.getDescription() : 'null';
                  this.ps.reportNewAction(this.act, 'MATCH', srcOut, 'null', false, this.bgB.countCellsWithIdAss(-1));
                  this.playEvent('actionError');
                }
                this.update();

                // Move the focus to the `source` accessible group
                if (this.bgA && this.bgA.$accessibleDiv) this.bgA.$accessibleDiv.focus();
              }
              break;

            case 'mousemove':
            case 'touchmove':
              this.bc.moveTo(p);
              break;
          }
          delayedActions.forEach(function (action) {
            return action();
          });
          event.preventDefault();
        }
      }
    }]);

    return ComplexAssociationPanel;
  }(SimpleAssociation.Panel);

  Object.assign(ComplexAssociationPanel.prototype, {
    /**
     * Array for storing checked associations
     * @name ComplexAssociation#Panel#invAssCheck
     * @type {boolean[]} */
    invAssCheck: null
  });

  /**
   * Panel class associated to this type of activity: {@link ComplexAssociationPanel}
   * @type {class} */
  ComplexAssociation.Panel = ComplexAssociationPanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@associations.ComplexAssociation'] = ComplexAssociation;

  return ComplexAssociation;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 526 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/textGrid/WordSearch.js
 *  Created : 15/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(35), __webpack_require__(24), __webpack_require__(58), __webpack_require__(3), __webpack_require__(216)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, ActiveBoxGrid, BoxBag, BoxConnector, AWT, TextGrid) {

  /**
   * This class of {@link Activity} shows a {@link TextGrid} with some words placed in horizontal,
   * vertical or diagonal direction, written right or upside down. The remaining grid cells will be
   * filled with randomly selected characters.
   *
   * The aim of the activity is to find all the words hidden on the text grid.
   * The content of an optional {@link ActiveBagContent} can be revealed on an auxiliary panel as
   * words are found.
   * @exports WordSearch
   * @class
   * @extends Activity
   */
  var WordSearch = function (_Activity) {
    _inherits(WordSearch, _Activity);

    /**
     * WordSearch constructor
     * @param {JClicProject} project - The JClic project to which this activity belongs
     */
    function WordSearch(project) {
      _classCallCheck(this, WordSearch);

      return _possibleConstructorReturn(this, (WordSearch.__proto__ || Object.getPrototypeOf(WordSearch)).call(this, project));
    }

    /**
     * Retrieves the minimum number of actions needed to solve this activity
     * @override
     * @returns {number}
     */


    _createClass(WordSearch, [{
      key: "getMinNumActions",
      value: function getMinNumActions() {
        return this.clues.length;
      }

      /**
       * This type of activity permits the user to display the solution
       * @override
       * @returns {boolean}
       */

    }, {
      key: "helpSolutionAllowed",
      value: function helpSolutionAllowed() {
        return true;
      }

      /**
       * This kind of activity uses random numbers to generate the filling characters
       * @override
       * @returns {boolean}
       */

    }, {
      key: "hasRandom",
      value: function hasRandom() {
        return true;
      }
    }]);

    return WordSearch;
  }(Activity);

  Object.assign(WordSearch.prototype, {
    /**
     * String array containing all the valid clues.
     * @name WordSearch#clues
     * @type {string[]} */
    clues: null,
    /**
     * Array of integers containing __for each clue__ the index
     * of an associated {@link ActiveBoxContent} located on the secondary {@link ActiveBoxBag}.
     * This associated element is optional.
     * @name WordSearch#clueItems
     * @type {number[]} */
    clueItems: null,
    /**
     * Object that indicates if box grids A and B must be scrambled.
     * (defaults to _false_ in WordSearch activities)
     * @name WordSearch#scramble
     * @type {Activity~scrambleType} */
    scramble: { primary: false, secondary: false }
  });

  /**
   * The {@link ActivityPanel} where {@link WordSearch} activities are played.
   * @class
   * @extends ActivityPanel
   */

  var WordSearchPanel = function (_Activity$Panel) {
    _inherits(WordSearchPanel, _Activity$Panel);

    /**
     * WordSearchPanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function WordSearchPanel(act, ps, $div) {
      _classCallCheck(this, WordSearchPanel);

      var _this2 = _possibleConstructorReturn(this, (WordSearchPanel.__proto__ || Object.getPrototypeOf(WordSearchPanel)).call(this, act, ps, $div));

      _this2.resolvedClues = [];
      return _this2;
    }

    /**
     * Performs miscellaneous cleaning operations
     * @override
     */


    _createClass(WordSearchPanel, [{
      key: "clear",
      value: function clear() {
        if (this.grid) {
          this.grid.end();
          this.grid = null;
        }
        if (this.bgAlt) {
          this.bgAlt.end();
          this.bgAlt = null;
        }
      }

      /**
       * Prepares the visual components of the activity
       * @override
       */

    }, {
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        if (this.firstRun) _get(WordSearchPanel.prototype.__proto__ || Object.getPrototypeOf(WordSearchPanel.prototype), "buildVisualComponents", this).call(this);
        this.clear();

        var tgc = this.act.tgc,
            abcAlt = this.act.abc['secondary'];
        if (abcAlt) {
          if (abcAlt.imgName) {
            abcAlt.setImgContent(this.act.project.mediaBag, null, false);
            if (abcAlt.animatedGifFile && !abcAlt.shaper.rectangularShapes && !this.act.scramble['secondary']) this.$animatedBg = $('<span/>').css({
              'background-image': "url(" + abcAlt.animatedGifFile + ")",
              'background-position': 'center',
              'background-repeat': 'no-repeat',
              position: 'absolute'
            }).appendTo(this.$div);
          }

          if (this.act.acp !== null) this.act.acp.generateContent(0, 0, [abcAlt], false);
        }

        if (tgc) {
          this.grid = TextGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, tgc, false);
          if (abcAlt) {
            this.bgAlt = ActiveBoxGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, abcAlt);
            if (this.$animatedBg && this.bgAlt.backgroundBox) this.bgAlt.backgroundBox['tmpTrans'] = true;
          }
          this.grid.setVisible(true);
        }
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(WordSearchPanel.prototype.__proto__ || Object.getPrototypeOf(WordSearchPanel.prototype), "initActivity", this).call(this);
        if (!this.firstRun) this.buildVisualComponents();else this.firstRun = false;

        if (this.grid) {
          this.grid.setChars(this.act.tgc.text);
          this.grid.randomize();
          this.grid.setAllCellsAttribute(TextGrid.flags.INVERTED, false);

          this.resolvedClues = Array(this.act.clueItems.length).fill(false);

          if (this.bgAlt) {
            this.bgAlt.setContent(this.act.abc['secondary']);
            if (this.$animatedBg) this.bgAlt.clearAllBoxes();
            if (this.act.scramble['secondary']) this.shuffle([this.bgAlt], true, true);
            this.bgAlt.setVisible(this.$animatedBg !== null);
          }

          this.setAndPlayMsg('initial', 'start');
          this.invalidate().update();
          this.playing = true;
        }
      }

      /**
       * Updates the graphic content of this panel.
       * This method will be called from {@link AWT.Container#update} when needed.
       * @override
       * @param {AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
       * it's the whole panel.
       */

    }, {
      key: "updateContent",
      value: function updateContent(dirtyRegion) {
        _get(WordSearchPanel.prototype.__proto__ || Object.getPrototypeOf(WordSearchPanel.prototype), "updateContent", this).call(this, dirtyRegion);
        if (this.grid && this.$canvas) {
          var canvas = this.$canvas.get(-1),
              ctx = canvas.getContext('2d');
          if (!dirtyRegion) dirtyRegion = new AWT.Rectangle(0, 0, canvas.width, canvas.height);
          ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
          this.grid.update(ctx, dirtyRegion);
          if (this.bgAlt) this.bgAlt.update(ctx, dirtyRegion);
        }
        return this;
      }

      /**
       * Sets the real dimension of this panel.
       * @override
       * @param {AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
       * @returns {AWT.Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(preferredMaxSize) {
        if (!this.grid || this.getBounds().equals(preferredMaxSize)) return preferredMaxSize;
        if (this.bgAlt) return BoxBag.layoutDouble(preferredMaxSize, this.grid, this.bgAlt, this.act.boxGridPos, this.act.margin);else return BoxBag.layoutSingle(preferredMaxSize, this.grid, this.act.margin);
      }

      /**
       * Sets the size and position of this activity panel
       * @override
       * @param {AWT.Rectangle} rect
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect) {
        if (this.$canvas) this.$canvas.remove();
        _get(WordSearchPanel.prototype.__proto__ || Object.getPrototypeOf(WordSearchPanel.prototype), "setBounds", this).call(this, rect);
        if (this.grid) {
          // Create the main canvas
          this.$canvas = $("<canvas width=\"" + rect.dim.width + "\" height=\"" + rect.dim.height + "\"/>").css({
            position: 'absolute',
            top: 0,
            left: 0
          });
          // Resize animated gif background
          if (this.$animatedBg && this.bgAlt) {
            var bgRect = this.bgAlt.getBounds();
            this.$animatedBg.css({
              left: bgRect.pos.x,
              top: bgRect.pos.y,
              width: bgRect.dim.width + "px",
              height: bgRect.dim.height + "px",
              'background-size': bgRect.dim.width + "px " + bgRect.dim.height + "px"
            });
          }
          this.$div.append(this.$canvas);

          // Create a [BoxConnector](BoxConnector.html) and attach it to the canvas context
          this.bc = new BoxConnector(this, this.$canvas.get(-1).getContext('2d'));

          // Repaint all
          this.invalidate().update();
        }
      }

      /**
       * Calculates the current score
       * @returns {number}
       */

    }, {
      key: "getCurrentScore",
      value: function getCurrentScore() {
        return this.resolvedClues.reduce(function (n, resolved) {
          return resolved ? ++n : n;
        }, 0);
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (this.bc && this.playing) {
          //
          // The [AWT.Point](AWT.html#Point) where the mouse or touch event has been originated
          var p = null;
          //
          // _touchend_ event don't provide pageX nor pageY information
          if (event.type === 'touchend') p = this.bc.active ? this.bc.dest.clone() : new AWT.Point();else {
            // Touch events can have more than one touch, so `pageX` must be obtained from `touches[0]`
            var x = event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX,
                y = event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY;
            p = new AWT.Point(x - this.$div.offset().left, y - this.$div.offset().top);
          }

          // Flag for tracking `mouseup` events
          var up = false;
          // Flag for assuring that only one media plays per event (avoid event sounds overlapping
          // cell's media sounds)
          var m = false;
          // Array to be filled with actions to be executed at the end of event processing
          var delayedActions = [];

          switch (event.type) {
            case 'touchcancel':
              // Canvel movement
              if (this.bc.active) this.bc.end();
              break;

            case 'mouseup':
              // Don't consider drag moves below 3 pixels. Can be a "trembling click"
              if (this.bc.active && p.distanceTo(this.bc.origin) <= 3) break;

              up = true;
            /* falls through */
            case 'touchend':
            case 'touchstart':
            case 'mousedown':
              if (!this.bc.active) {
                // A new word selection starts
                //
                // Selection of words can never start with a `mouseup` event
                if (up) break;

                this.ps.stopMedia(1);
                if (this.grid.contains(p)) {
                  this.playEvent('click');
                  this.bc.begin(p);
                }
              } else {
                this.ps.stopMedia(1);
                // Word selection completed
                //
                // Find the active boxes behind `bc.origin` and `p`
                var pt1 = this.grid.getLogicalCoords(this.bc.origin),
                    pt2 = this.grid.getLogicalCoords(this.bc.dest);
                this.bc.end();
                var s = this.grid.getStringBetween(pt1.x, pt1.y, pt2.x, pt2.y);
                if (s !== null && s.length > 0) {
                  var ok = false,
                      c = 0;
                  for (; c < this.act.clues.length; c++) {
                    if (s === this.act.clues[c]) {
                      ok = true;
                      break;
                    }
                  }
                  var repeated = this.resolvedClues[c];
                  if (ok && !repeated) {
                    this.resolvedClues[c] = true;
                    this.grid.setAttributeBetween(pt1.x, pt1.y, pt2.x, pt2.y, TextGrid.flags.INVERTED, true);
                    if (this.bgAlt !== null) {
                      var k = this.act.clueItems[c];
                      if (k >= 0 && k < this.bgAlt.getNumCells()) {
                        var bx = this.bgAlt.getActiveBox(this.act.clueItems[c]);
                        if (bx) {
                          bx.setVisible(this.$animatedBg === null);
                          m = bx.playMedia(this.ps, delayedActions);
                        }
                      }
                    }
                  }
                  if (!repeated) {
                    var r = this.getCurrentScore();
                    this.ps.reportNewAction(this.act, 'ACTION_SELECT', s, null, ok, r);
                    if (r === this.act.clues.length) this.finishActivity(true);else if (!m) this.playEvent(ok ? 'actionOK' : 'actionError');
                    this.invalidate();
                  } else if (!ok && !m) this.playEvent('actionError');
                } else this.playEvent('actionError');

                this.update();
              }
              break;

            case 'mousemove':
            case 'touchmove':
              this.bc.moveTo(p);
              break;
          }
          delayedActions.forEach(function (action) {
            return action();
          });
          event.preventDefault();
        }
      }
    }]);

    return WordSearchPanel;
  }(Activity.Panel);

  Object.assign(WordSearchPanel.prototype, {
    /**
     * The {@link TextGrid} object of this ActivityPanel
     * @name WordSearchPanel#grid
     * @type {TextGrid} */
    grid: null,
    /**
     * An optional {@link ActiveBoxBag} used to display information associated with the hidden words.
     * @name WordSearchPanel#bgAlt
     * @type {ActiveBoxBag} */
    bgAlt: null,
    /**
     * An array of boolean values indicating which clues have been found
     * @name WordSearchPanel#resolvedClues
     * @type {boolean[]} */
    resolvedClues: null,
    /**
     * The box connector object
     * @name WordSearchPanel#bc
     * @type {BoxConnector} */
    bc: null,
    /**
     * Mouse and touch events intercepted by this panel
     * @override
     * @name WordSearchPanel#events
     * @type {string[]} */
    events: ['mousedown', 'mouseup', 'mousemove', 'touchstart', 'touchend', 'touchmove', 'touchcancel']
  });

  /**
   * Panel class associated to this type of activity: {@link WordSearchPanel}
   * @type {class} */
  WordSearch.Panel = WordSearchPanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@textGrid.WordSearch'] = WordSearch;

  return WordSearch;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 527 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

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; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/textGrid/CrossWord.js
 *  Created : 17/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(57), __webpack_require__(24), __webpack_require__(216), __webpack_require__(99), __webpack_require__(74), __webpack_require__(3), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, BoxBase, BoxBag, TextGrid, AbstractBox, ActiveBox, AWT, Utils) {

  var K = Utils.settings;

  /**
   * This class of {@link Activity} shows a {@link TextGrid} initially empty, with some cells
   * marked in negative color that act as word stoppers. A blinking "cursor" indicates the cell that
   * will receive the next character entered by the user on the keyboard.
   *
   * The letter in each cell of the grid is always shared by two words: one in horizontal direction
   * and the other one in vertical direction. Two {@link ActiveBox} objects are placed next to the
   * {@link TextGrid}, hosting the definitions of the horizontal and vertical words crossing at the
   * cell currently marked by the cursor.
   *
   * Two special buttons placed near this boxes allow to write on the grid horizontally or vertically.
   * The aim of the activity is to fill all the text grid with the correct words.
   * @exports CrossWord
   * @class
   * @extends Activity
   */

  var CrossWord = function (_Activity) {
    _inherits(CrossWord, _Activity);

    /**
     * CrossWord constructor
     * @param {JClicProject} project - The JClic project to which this activity belongs
     */
    function CrossWord(project) {
      _classCallCheck(this, CrossWord);

      return _possibleConstructorReturn(this, (CrossWord.__proto__ || Object.getPrototypeOf(CrossWord)).call(this, project));
    }

    /**
     * Retrieves the minimum number of actions needed to solve this activity
     * @override
     * @returns {number}
     */


    _createClass(CrossWord, [{
      key: "getMinNumActions",
      value: function getMinNumActions() {
        return this.tgc.getNumChars() - this.tgc.countWildChars();
      }

      /**
       * Crossword activities always make use of the keyboard
       * @override
       * @returns {boolean}
       */

    }, {
      key: "needsKeyboard",
      value: function needsKeyboard() {
        return true;
      }
    }]);

    return CrossWord;
  }(Activity);

  Object.assign(CrossWord.prototype, {
    /**
     * Whether all letters of the {@link TextGrid} should be displayed in upper case
     * @name CrossWord#upperCase
     * @type {boolean} */
    upperCase: true,
    /**
     * Whether the case is significant to evaluate answers
     * @name CrossWord#checkCase
     * @type {boolean} */
    checkCase: true,
    /**
     * When `true`, the wildcard character of the {@link TextGrid} will be transparent.
     * @name CrossWord#wildTransparent
     * @type {boolean} */
    wildTransparent: false
  });

  /**
   * The {@link ActivityPanel} where {@link CrossWord} activities are played.
   * @class
   * @extends ActivityPanel
   */

  var CrossWordPanel = function (_Activity$Panel) {
    _inherits(CrossWordPanel, _Activity$Panel);

    /**
     * CrossWordPanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function CrossWordPanel(act, ps, $div) {
      _classCallCheck(this, CrossWordPanel);

      return _possibleConstructorReturn(this, (CrossWordPanel.__proto__ || Object.getPrototypeOf(CrossWordPanel)).call(this, act, ps, $div));
    }

    /**
     * Performs miscellaneous cleaning operations
     * @override
     */


    _createClass(CrossWordPanel, [{
      key: "clear",
      value: function clear() {
        if (this.grid) {
          this.grid.end();
          this.grid = null;
        }
        if (this.bb) {
          this.bb.end();
          this.bb = null;
        }
      }

      /**
       * Creates a {@link BoxBag} with a label ("Horizontal" or "Vertical") and an {@link ActiveBox}
       * that will be used to display clues.
       * @param {string} type - `acrossClues` for horizontal clues, 'downClues' for vertical.
       * @returns {BoxBag}
       */

    }, {
      key: "createBoxBag",
      value: function createBoxBag(type) {
        var _this3 = this;

        var bxb = new BoxBag(null, this, null),
            sb = new AbstractBox(bxb, this, this.icoBB);

        sb.setBounds(0, 0, this.LABEL_WIDTH, this.act.abc[type].h);
        var $btn = $('<button/>', { class: 'StockBtn' }).css({
          'width': this.LABEL_WIDTH,
          'height': this.act.abc[type].h,
          'background-image': "url(" + (type === 'acrossClues' ? this.hIcon : this.vIcon) + ")",
          'background-repeat': 'no-repeat',
          'background-position': 'center',
          'border-radius': 6,
          'z-index': 10
        }).click(function () {
          _this3.advance = type === 'acrossClues' ? _this3.advance === 'ADVANCE_RIGHT' ? 'NO_ADVANCE' : 'ADVANCE_RIGHT' : _this3.advance === 'ADVANCE_DOWN' ? 'NO_ADVANCE' : 'ADVANCE_DOWN';
          _this3.setBtnStatus();
        }).on('keypress', function (event) {
          if (String.fromCharCode(event.charCode || event.keyCode) === ' ') event.stopPropagation();
        }).appendTo(this.$div);

        sb.setHostedComponent($btn);
        bxb.addBox(sb);

        var ab = new ActiveBox(bxb, null, null, type, new AWT.Rectangle(this.LABEL_WIDTH + this.act.margin, 0, this.act.abc[type].w, this.act.abc[type].h));
        bxb.addBox(ab);
        bxb.setBoxBase(this.act.abc[type].bb);

        if (type === 'acrossClues') {
          // Horizontal
          this.hClue = ab;
          this.hClueBtn = sb;
        } else {
          this.vClue = ab;
          this.vClueBtn = sb;
        }
        return bxb;
      }

      /**
       * Prepares the visual components of the activity
       * @override
       */

    }, {
      key: "buildVisualComponents",
      value: function buildVisualComponents() {
        if (this.firstRun) _get(CrossWordPanel.prototype.__proto__ || Object.getPrototypeOf(CrossWordPanel.prototype), "buildVisualComponents", this).call(this);
        this.clear();

        var tgc = this.act.tgc,
            abcH = this.act.abc['acrossClues'],
            abcV = this.act.abc['downClues'];

        if (abcH.imgName) abcH.setImgContent(this.act.project.mediaBag, null, false);
        if (abcV.imgName) abcV.setImgContent(this.act.project.mediaBag, null, false);

        if (this.act.acp !== null) {
          this.act.acp.generateContent(0, 0, this.act.abc, false);
        }

        if (tgc) {
          this.grid = TextGrid.createEmptyGrid(null, this, this.act.margin, this.act.margin, tgc, this.act.wildTransparent);
          this.bb = new BoxBag(null, this, null);
          var bxbh = this.createBoxBag('acrossClues'),
              bxbv = this.createBoxBag('downClues');
          if (this.act.boxGridPos === 'AUB' || this.act.boxGridPos === 'BUA') bxbv.moveTo(new AWT.Point(bxbh.dim.width + this.act.margin, 0));else bxbv.moveTo(new AWT.Point(0, bxbh.dim.height + this.act.margin));
          this.bb.addBox(bxbh);
          this.bb.addBox(bxbv);
          this.grid.setVisible(true);
          this.bb.setVisible(true);
        }
      }

      /**
       * Basic initialization procedure
       * @override
       */

    }, {
      key: "initActivity",
      value: function initActivity() {
        _get(CrossWordPanel.prototype.__proto__ || Object.getPrototypeOf(CrossWordPanel.prototype), "initActivity", this).call(this);
        if (!this.firstRun) this.buildVisualComponents();else this.firstRun = false;

        if (this.grid) {
          this.grid.setChars(this.act.tgc.text);
          this.numLetters = this.act.getMinNumActions();
          this.grid.setCellAttributes(true, true);
          this.grid.setCursorEnabled(true);
          this.setCursorAt(0, 0);
          this.advance = 'ADVANCE_RIGHT';
          this.setBtnStatus();
          this.setAndPlayMsg('initial', 'start');
          this.invalidate().update();
          this.$div.attr("tabindex", 0);
          this.$div.focus();
          this.playing = true;
        }
      }

      /**
       * Calculates the current score
       * @returns {number}
       */

    }, {
      key: "getCurrentScore",
      value: function getCurrentScore() {
        return this.grid ? this.grid.countCoincidences(this.act.checkCase) : 0;
      }

      /**
       * Updates the graphic content of this panel.
       * This method will be called from {@link AWT.Container#update} when needed.
       * @override
       * @param {AWT.Rectangle} dirtyRegion - Specifies the area to be updated. When `null`,
       * it's the whole panel.
       */

    }, {
      key: "updateContent",
      value: function updateContent(dirtyRegion) {
        _get(CrossWordPanel.prototype.__proto__ || Object.getPrototypeOf(CrossWordPanel.prototype), "updateContent", this).call(this, dirtyRegion);
        if (this.grid && this.$canvas) {
          var canvas = this.$canvas.get(-1),
              ctx = canvas.getContext('2d');
          if (!dirtyRegion) dirtyRegion = new AWT.Rectangle(0, 0, canvas.width, canvas.height);
          ctx.clearRect(dirtyRegion.pos.x, dirtyRegion.pos.y, dirtyRegion.dim.width, dirtyRegion.dim.height);
          this.grid.update(ctx, dirtyRegion);
          this.bb.update(ctx, dirtyRegion);
        }
        return this;
      }

      /**
       * Sets the real dimension of this panel.
       * @override
       * @param {AWT.Dimension} preferredMaxSize - The maximum surface available for the activity panel
       * @returns {AWT.Dimension}
       */

    }, {
      key: "setDimension",
      value: function setDimension(preferredMaxSize) {
        return !this.grid || !this.bb || this.getBounds().equals(preferredMaxSize) ? preferredMaxSize : BoxBag.layoutDouble(preferredMaxSize, this.grid, this.bb, this.act.boxGridPos, this.act.margin);
      }

      /**
       * Sets the size and position of this activity panel
       * @override
       * @param {AWT.Rectangle} rect
       */

    }, {
      key: "setBounds",
      value: function setBounds(rect) {
        if (this.$canvas) {
          this.$canvas.remove();
          this.$canvas = null;
        }
        _get(CrossWordPanel.prototype.__proto__ || Object.getPrototypeOf(CrossWordPanel.prototype), "setBounds", this).call(this, rect);

        if (this.grid) {
          // Create the main canvas
          this.$canvas = $("<canvas width=\"" + rect.dim.width + "\" height=\"" + rect.dim.height + "\"/>").css({
            position: 'absolute',
            top: 0,
            left: 0
          });
          this.$div.append(this.$canvas);
          // Repaint all
          this.invalidate().update();
        }
      }

      /**
       * Main handler used to process mouse, touch, keyboard and edit events
       * @override
       * @param {HTMLEvent} event - The HTML event to be processed
       * @returns {boolean=} - When this event handler returns `false`, jQuery will stop its
       * propagation through the DOM tree. See: {@link http://api.jquery.com/on}
       */

    }, {
      key: "processEvent",
      value: function processEvent(event) {
        if (this.playing) {
          switch (event.type) {
            case 'click':
              //
              // The [AWT.Point](AWT.html#Point) where the mouse or touch event has been originated
              // Touch events can have more than one touch, so `pageX` must be obtained from `touches[0]`
              var x = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX,
                  y = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY,
                  p = new AWT.Point(x - this.$div.offset().left, y - this.$div.offset().top),

              // Array to be filled with actions to be executed at the end of event processing
              delayedActions = [];

              this.ps.stopMedia(1);
              if (this.grid.contains(p)) {
                var pt = this.grid.getLogicalCoords(p);
                if (pt !== null) {
                  this.setCursorAt(pt.x, pt.y);
                  if (K.TOUCH_DEVICE) {
                    // We are in a touch device, so prompt user to write text:
                    var d = this.advance === 'ADVANCE_DOWN';
                    var txt = window.prompt((d ? 'Vertical' : 'Horizontal') + " word:", '');
                    this.writeChars(txt);
                  }
                }
              } else if (this.hClue.contains(p)) this.hClue.playMedia(this.ps, delayedActions);else if (this.vClue.contains(p)) this.vClue.playMedia(this.ps, delayedActions);else break;

              this.update();
              delayedActions.forEach(function (action) {
                return action();
              });
              break;

            case 'keypress':
              var code = event.charCode || event.keyCode;
              if (code && this.grid.getCursor()) {
                event.preventDefault();
                this.writeChars(String.fromCharCode(code));
              }
              break;

            case 'keydown':
              var dx = 0,
                  dy = 0;
              switch (event.keyCode) {
                case K.VK.RIGHT:
                  dx = 1;
                  break;
                case K.VK.LEFT:
                  dx = -1;
                  break;
                case K.VK.DOWN:
                  dy = 1;
                  break;
                case K.VK.UP:
                  dy = -1;
                  break;
              }
              if (dx || dy) {
                event.preventDefault();
                this.moveCursor(dx, dy);
                this.update();
              }
              break;
          }
        }
      }

      /**
       * Moves the cursor the specified `dx` and `dy` amount (in logical coordinates)
       * @param {number} dx - Amount of cells to horizontally move on
       * @param {number} dy - Amount of cells to vertically move on
       */

    }, {
      key: "moveCursor",
      value: function moveCursor(dx, dy) {
        if (this.grid) {
          this.grid.moveCursor(dx, dy, true);
          this.cursorPosChanged();
        }
      }

      /**
       * Places the cursor at the specified location (in logical coordinates)
       * @param {number} x
       * @param {number} y
       */

    }, {
      key: "setCursorAt",
      value: function setCursorAt(x, y) {
        this.grid.setCursorAt(x, y, true);
        this.cursorPosChanged();
      }

      /**
       * Method called when the cursor moves to a different location
       */

    }, {
      key: "cursorPosChanged",
      value: function cursorPosChanged() {
        var pt = this.grid.getCursor();
        if (pt !== null && this.bb !== null) {
          var items = this.grid.getItemFor(pt.x, pt.y);
          if (items !== null) {
            this.hClue.setContent(this.act.abc['acrossClues'].getActiveBoxContentWith(pt.y, items.x));
            this.vClue.setContent(this.act.abc['downClues'].getActiveBoxContentWith(pt.x, items.y));
          }
        }
      }

      /**
       * Writes a string on the grid starting at the current cursor position and
       * following the direction marked by the `advance` field
       * @param {string} txt - Text to write
       */

    }, {
      key: "writeChars",
      value: function writeChars(txt) {
        if (txt && txt.length > 0) {
          for (var i = 0; i < txt.length; i++) {
            var cur = this.grid.getCursor();
            var ch = txt.charAt(i);
            if (this.act.upperCase) ch = ch.toLocaleUpperCase();
            this.grid.setCharAt(cur.x, cur.y, ch);
            var ok = this.grid.isCellOk(cur.x, cur.y, this.act.checkCase),
                r = this.getCurrentScore();
            this.ps.reportNewAction(this.act, 'WRITE', ch, "X:" + cur.x + " Y:" + cur.y, ok, r);
            // End activity or play event sound
            if (r === this.numLetters) {
              this.grid.setCursorEnabled(false);
              this.grid.stopCursorBlink();
              this.finishActivity(true);
            } else {
              this.playEvent('click');
              if (this.advance === 'ADVANCE_DOWN') this.moveCursor(0, 1);else if (this.advance === 'ADVANCE_RIGHT') this.moveCursor(1, 0);
            }
          }
        }
        this.update();
      }

      /**
       * Sets the status of horizontal and vertical buttons based on the value of `advance`
       */

    }, {
      key: "setBtnStatus",
      value: function setBtnStatus() {
        if (this.hClueBtn) this.hClueBtn.setInactive(this.advance !== 'ADVANCE_RIGHT');
        if (this.vClueBtn) this.vClueBtn.setInactive(this.advance !== 'ADVANCE_DOWN');
      }
    }]);

    return CrossWordPanel;
  }(Activity.Panel);

  Object.assign(CrossWordPanel.prototype, {
    /**
     * The default width of the 'Horizontal' and 'Vertical' buttons (currently 40 pixels)
     * @name CrossWordPanel#LABEL_WIDTH
     * @type {number} */
    LABEL_WIDTH: 40,
    /**
     * The text grid of this ActivityPanel
     * @name CrossWordPanel#grid
     * @type {textGrid} */
    grid: null,
    /**
     * A BoxBag used to place the across and down clues, and the `toggle direction` button.
     * @name CrossWordPanel#bb
     * @type {BoxBag} */
    bb: null,
    /**
     * The total number of letters of this cross word
     * @name CrossWordPanel#numLetters
     * @type {number} */
    numLetters: 0,
    /**
     * Flag indicating the type of automatic advance of the cursor.
     * Possible values are: `NO_ADVANCE` (default), 'ADVANCE_RIGHT' and 'ADVANCE_DOWN'.
     * TODO: Implement 'ADVANCE_LEFT' for LTR languages
     * @name CrossWordPanel#advance
     * @type {string} */
    advance: 'NO_ADVANCE',
    /**
     * The ActiveBox object used to display the 'across' clues
     * @name CrossWordPanel#hClue
     * @type {ActiveBox} */
    hClue: null,
    /**
     * The ActiveBox object used to display the 'down' clues
     * @name CrossWordPanel#vClue
     * @type {ActiveBox} */
    vClue: null,
    /**
     * Button used to set the advance mode to 'ADVANCE_RIGHT'
     * @name CrossWordPanel#hClueBtn
     * @type {ActiveBox} */
    hClueBtn: null,
    /**
     * Button used to set the advance mode to 'ADVANCE_BOTTOM'
     * @name CrossWordPanel#vClueBtn
     * @type {ActiveBox} */
    vClueBtn: null,
    /**
     * Mouse and touch events intercepted by this panel
     * @override
     * @name CrossWordPanel#events
     * @type {string[]} */
    events: ['click', 'keydown', 'keypress'],
    /**
     * Graphic icon for the horizontal direction button, represented as a string containing
     * an SVG file codified in base64.
     * @name CrossWordPanel#hIcon
     * @type {string} */
    hIcon: 'data:image/svg+xml;base64,' + 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGZpbGw9IiNGRkZGRkYi' + 'IGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjM2IiB4bWxucz0iaHR0cDov' + 'L3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUi' + 'PjwvcGF0aD48cGF0aCBkPSJNNiAxMGMtMS4xIDAtMiAuOS0yIDJzLjkgMiAyIDIgMi0uOSAyLTIt' + 'LjktMi0yLTJ6bTEyIDBjLTEuMSAwLTIgLjktMiAycy45IDIgMiAyIDItLjkgMi0yLS45LTItMi0y' + 'em0tNiAwYy0xLjEgMC0yIC45LTIgMnMuOSAyIDIgMiAyLS45IDItMi0uOS0yLTItMnoiPjwvcGF0' + 'aD48L3N2Zz4K',
    /**
     * Graphic icon for the vertical direction button, represented as a string containing
     * an SVG file codified in base64.
     * @name CrossWordPanel#vIcon
     * @type {string} */
    vIcon: 'data:image/svg+xml;base64,' + 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGZpbGw9IiNGRkZGRkYi' + 'IGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjM2IiB4bWxucz0iaHR0cDov' + 'L3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUi' + 'PjwvcGF0aD48cGF0aCBkPSJNMTIgOGMxLjEgMCAyLS45IDItMnMtLjktMi0yLTItMiAuOS0yIDIg' + 'LjkgMiAyIDJ6bTAgMmMtMS4xIDAtMiAuOS0yIDJzLjkgMiAyIDIgMi0uOSAyLTItLjktMi0yLTJ6' + 'bTAgNmMtMS4xIDAtMiAuOS0yIDJzLjkgMiAyIDIgMi0uOSAyLTItLjktMi0yLTJ6Ij48L3BhdGg+' + 'PC9zdmc+Cg==',
    /**
     * Sizes of the icons (currently 36 x 36 pixel)
     * @name CrossWordPanel#icoSize
     * @type {Object} */
    icoSize: { w: 36, h: 36 },
    /**
     * BoxBase with the style to be used by the direction buttons.
     * @name CrossWordPanel#icoBB
     * @type {BoxBase} */
    icoBB: new BoxBase().set('backColor', '#4285F4').set('inactiveColor', '#70A2F6').set('dontFill', true)
  });

  /**
   * Panel class associated to this type of activity: {@link CrossWordPanel}
   * @type {class} */
  CrossWord.Panel = CrossWordPanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@textGrid.CrossWord'] = CrossWord;

  return CrossWord;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 528 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : report/TCPReporter.js
 *  Created : 08/06/2016
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2016 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define, document */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(139), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Reporter, Utils) {

  /**
   * This special case of {@link Reporter} connects with an external service reporter providing
   * the {@link https://github.com/projectestac/jclic/wiki/JClic-Reports-developers-guide JClic Reports API}.
   * Connection parameters to the reports server (`path`, `service`, `userId`, `key`, `context`...)
   * are passed through the `options` element of {@link JClicPlayer} (acting as {@link PlayStation}).
   * @exports TCPReporter
   * @class
   * @extends Reporter
   */
  var TCPReporter = function (_Reporter) {
    _inherits(TCPReporter, _Reporter);

    /**
     * TCPReporter constructor
     * @param {PlayStation} ps - The {@link PlayStation} used to retrieve settings and localized messages
     */
    function TCPReporter(ps) {
      _classCallCheck(this, TCPReporter);

      var _this = _possibleConstructorReturn(this, (TCPReporter.__proto__ || Object.getPrototypeOf(TCPReporter)).call(this, ps));

      _this.tasks = [];
      return _this;
    }

    /**
     * Gets a specific property from this reporting system
     * @override
     * @param {string} key - Requested property
     * @param {string}+ defaultValue - Default return value when requested property does not exist
     * @returns {string}
     */


    _createClass(TCPReporter, [{
      key: "getProperty",
      value: function getProperty(key, defaultValue) {
        return this.dbProperties !== null && this.dbProperties.hasOwnProperty(key) ? this.dbProperties[key] : defaultValue;
      }

      /**
       * Adds a new element to the list of report beans pending to be transmitted.
       * @param {ReportBean} bean
       */

    }, {
      key: "addTask",
      value: function addTask(bean) {
        if (this.processingTasks) {
          if (this.waitingTasks === null) this.waitingTasks = [bean];else this.waitingTasks.push(bean);
        } else this.tasks.push(bean);
      }

      /**
       * Transmits all report beans currently stored in `tasks` to the reports server
       * @returns {Promise}
       */

    }, {
      key: "flushTasksPromise",
      value: function flushTasksPromise() {
        var _this2 = this;

        if (this.processingTasks || this.currentSessionId === null || this.tasks.length === 0 || this.serviceUrl === null) {
          // The task list cannot be processed now. Pass and wait until the next timer cycle:
          if (this.processingTasks) this.forceFlush = true;
          return Promise.resolve(true);
        } else {
          // Set up the `processingTasks` flag to avoid re-entrant processing
          this.processingTasks = true;

          var reportBean = new ReportBean('multiple');
          for (var i = 0; i < this.tasks.length; i++) {
            reportBean.appendData(this.tasks[i].$bean);
          }Utils.log('debug', 'Reporting:', reportBean.$bean[0]);

          return new Promise(function (resolve, reject) {
            _this2.transaction(reportBean.$bean).done(function (_data, _textStatus, _jqXHR) {
              // TODO: Check returned message for possible errors on the server side
              _this2.failCount = 0;

              // Clear waiting tasks
              if (_this2.waitingTasks) {
                _this2.tasks = _this2.waitingTasks;
                _this2.waitingTasks = null;
              } else {
                _this2.forceFlush = false;
                _this2.tasks = [];
              }

              if (_this2.forceFlush && _this2.tasks.length > 0) {
                _this2.forceFlush = false;
                _this2.processingTasks = false;
                _this2.flushTasksPromise().then(function () {
                  resolve(true);
                });
              } else {
                _this2.forceFlush = false;
                resolve(true);
                _this2.processingTasks = false;
              }
            }).fail(function (jqXHR, textStatus, errorThrown) {
              if (++_this2.failCount > _this2.maxFails) _this2.stopReporting().then();
              reject("Error reporting results to " + _this2.serviceUrl + " [" + textStatus + " " + errorThrown + "]");
              _this2.processingTasks = false;
            });
          });
        }
      }

      /**
       * Initializes this report system with an optional set of parameters.
       * Returns a Promise, fulfilled when the reporter is fully initialized.
       * @override
       * @param {?Object} options - Initial settings passed to the reporting system
       * @returns {Promise}
       */

    }, {
      key: "init",
      value: function init(options) {
        var _this3 = this;

        if (typeof options === 'undefined' || options === null) options = this.ps.options;
        _get(TCPReporter.prototype.__proto__ || Object.getPrototypeOf(TCPReporter.prototype), "init", this).call(this, options);
        this.initiated = false;
        this.stopReporting();

        this.serverPath = options.path || this.DEFAULT_SERVER_PATH;
        this.descriptionDetail = this.serverPath;
        var serverService = options.service || this.DEFAULT_SERVER_SERVICE;
        if (!Utils.startsWith(serverService, '/')) serverService = "/" + serverService;
        var serverProtocol = options.protocol || this.DEFAULT_SERVER_PROTOCOL;
        this.serviceUrl = serverProtocol + "://" + this.serverPath + serverService;

        var bean = new ReportBean('get_properties');
        return new Promise(function (resolve, reject) {
          _this3.transaction(bean.$bean).done(function (data, _textStatus, _jqXHR) {
            _this3.dbProperties = {};
            $(data).find('param').each(function (_n, param) {
              var $param = $(param);
              _this3.dbProperties[$param.attr('name')] = $param.attr('value');
            });
            _this3.promptUserId(false).then(function (userId) {
              _this3.userId = userId;
              var tl = options.lap || _this3.getProperty('TIME_LAP', _this3.DEFAULT_TIMER_LAP);
              _this3.timerLap = Math.min(30, Math.max(1, parseInt(tl)));
              _this3.timer = window.setInterval(function () {
                return _this3.flushTasksPromise().then();
              }, _this3.timerLap * 1000);
              // Warn before leaving the current page with unsaved data:
              _this3.beforeUnloadFunction = function (event) {
                if (_this3.serviceUrl !== null && (_this3.tasks.length > 0 || _this3.processingTasks)) {
                  _this3.flushTasksPromise().then();
                  var result = _this3.ps.getMsg('Please wait until the results of your activities are sent to the reports system');
                  if (event) event.returnValue = result;
                  return result;
                }
              };
              window.addEventListener('beforeunload', _this3.beforeUnloadFunction);
              _this3.initiated = true;
              resolve(true);
            }).catch(function (msg) {
              _this3.stopReporting();
              reject("Error getting the user ID: " + msg);
            });
          }).fail(function (jqXHR, textStatus, errorThrown) {
            _this3.stopReporting();
            reject("Error initializing reports service " + _this3.serviceUrl + " [" + textStatus + " " + errorThrown + "]");
          });
        });
      }

      /**
       * This method should be invoked when a new session starts.
       * @override
       * @param {JClicProject} jcp - The {@link JClicProject} this session refers to.
       */

    }, {
      key: "newSession",
      value: function newSession(jcp) {
        _get(TCPReporter.prototype.__proto__ || Object.getPrototypeOf(TCPReporter.prototype), "newSession", this).call(this, jcp);
        if (this.serviceUrl && this.userId !== null) {
          // Session ID will be obtained when reporting first activity
          this.currentSessionId = null;
        }
      }

      /**
       * Creates a new session in the remote database and records its ID for future use
       * @param {boolean} forceNewSession - When `true`, a new session will always be created.
       * @returns {Promise} - A Promise reporter will be successfully resolved
       * only when `currentSessionId` have a valid value.
       */

    }, {
      key: "createDBSession",
      value: function createDBSession(forceNewSession) {
        var _this4 = this;

        if (this.currentSessionId !== null && !forceNewSession)
          // A valid session is available, so just return it
          return Promise.resolve(this.currentSessionId);else
          // A new session must be created:
          return new Promise(function (resolve, reject) {
            if (_this4.initiated && _this4.userId !== null && _this4.currentSession !== null) {
              _this4.flushTasksPromise().then(function () {
                _this4.currentSessionId = null;
                var bean = new ReportBean('add session');

                bean.setParam('project', _this4.currentSession.projectName);
                bean.setParam('activities', Number(_this4.currentSession.reportableActs));
                bean.setParam('time', Number(_this4.currentSession.started));
                bean.setParam('code', _this4.currentSession.code);
                bean.setParam('user', _this4.userId);
                bean.setParam('key', _this4.sessionKey);
                bean.setParam('context', _this4.sessionContext);

                _this4.transaction(bean.$bean).done(function (data, _textStatus, _jqXHR) {
                  _this4.currentSessionId = $(data).find('param[name="session"]').attr('value');
                  resolve(_this4.currentSessionId);
                }).fail(function (jqXHR, textStatus, errorThrown) {
                  _this4.stopReporting();
                  reject("Error creating new reports session in " + _this4.serviceUrl + " [" + textStatus + " " + errorThrown + "]");
                });
              });
            } else reject('Unable to start session in remote server!');
          });
      }

      /**
       * Closes this reporting system
       * @override
       * @returns {Promise} - A promise to be fullfilled when all pending tasks are finished, or _null_ if not active.
       */

    }, {
      key: "end",
      value: function end() {
        this.reportActivity(true);
        return this.stopReporting().then(_get(TCPReporter.prototype.__proto__ || Object.getPrototypeOf(TCPReporter.prototype), "end", this).call(this));
      }

      /**
       * Performs a transaction on the remote server
       * @param {external:jQuery} $xml - The XML element to be transmited, wrapped into a jQuery object
       * @returns {external:jqXHR} - The {@link external:jqXHR} obtained as a result of a call to `$.ajax`.
       * This object should be treated as a Promise or
       * as a JQuery {@link https://api.jquery.com/category/deferred-object|Deferred} object.
       */

    }, {
      key: "transaction",
      value: function transaction($xml) {
        return this.serviceUrl === null ? null : $.ajax({
          method: 'POST',
          url: this.serviceUrl,
          data: '<?xml version="1.0" encoding="UTF-8"?>' + new XMLSerializer().serializeToString($xml.get(0)).replace('minactions', 'minActions').replace('reportactions', 'reportActions'),
          contentType: 'text/xml',
          dataType: 'xml'
        });
      }

      /**
       * Gets the list of current groups or organizations registered on this reporting system.
       * @override
       * @returns {Promise} - When fulfilled, an array of group data is returned as a result
       */

    }, {
      key: "getGroups",
      value: function getGroups() {
        var _this5 = this;

        return new Promise(function (resolve, reject) {
          if (!_this5.userBased()) reject('This system does not manage users!');else {
            var bean = new ReportBean('get groups');
            _this5.transaction(bean.$bean).done(function (data, _textStatus, _jqXHR) {
              var currentGroups = [];
              $(data).find('group').each(function (_n, gr) {
                var $group = $(gr);
                currentGroups.push({ id: $group.attr('id'), name: $group.attr('name') });
              });
              resolve(currentGroups);
            }).fail(function (jqXHR, textStatus, errorThrown) {
              reject("Error retrieving groups list from " + _this5.serviceUrl + " [" + textStatus + " " + errorThrown + "]");
            });
          }
        });
      }

      /**
       * Gets the list of users currently registered in the system, optionally filtered by
       * a specific group ID.
       * @override
       * @param {string}+ groupId - Optional group ID to be used as a filter criteria
       * @returns {Promise} - When fulfilled, an object with a collection of user data records
       * is returned
       */

    }, {
      key: "getUsers",
      value: function getUsers(groupId) {
        var _this6 = this;

        return new Promise(function (resolve, reject) {
          if (!_this6.userBased()) reject('This system does not manage users!');else {
            var bean = new ReportBean('get users');
            if (typeof groupId !== 'undefined' && groupId !== null) bean.setParam('group', groupId);
            _this6.transaction(bean.$bean).done(function (data, _textStatus, _jqXHR) {
              var currentUsers = [];
              $(data).find('user').each(function (_n, usr) {
                var $user = $(usr);
                var user = { id: $user.attr('id'), name: $user.attr('name') };
                if ($user.attr('pwd')) user.pwd = $user.attr('pwd');
                currentUsers.push(user);
              });
              resolve(currentUsers);
            }).fail(function (jqXHR, textStatus, errorThrown) {
              reject("Error retrieving users list from " + _this6.serviceUrl + " [" + textStatus + " " + errorThrown + "]");
            });
          }
        });
      }

      /**
       * Gets extended data associated with a specific user.
       * @param {string} userId - The requested user ID
       * @returns {Promise} - When fulfilled, an object with user data is returned.
       */

    }, {
      key: "getUserData",
      value: function getUserData(userId) {
        var _this7 = this;

        return new Promise(function (resolve, reject) {
          if (!_this7.userBased()) reject('This system does not manage users!');else {
            var bean = new ReportBean('get user data');

            if (typeof userId !== 'undefined' && userId !== null) bean.setParam('user', userId);else reject('Invalid user ID');

            _this7.transaction(bean.$bean).done(function (data, _textStatus, _jqXHR) {
              var $user = $(data).find('user');
              if ($user.length !== 1) {
                alert(_this7.ps.getMsg('Invalid user'));
                resolve('Invalid user ID');
              } else {
                var user = { id: $user.attr('id'), name: $user.attr('name') };
                if ($user.attr('pwd')) user.pwd = $user.attr('pwd');
                resolve(user);
              }
            }).fail(function (jqXHR, textStatus, errorThrown) {
              reject("Error retrieving user data from " + _this7.serviceUrl + " [" + textStatus + " " + errorThrown + "]");
            });
          }
        });
      }

      /**
       * Stops the reporting system, usually as a result of repeated errors or because the player
       * shuts down.
       * @returns {Promise} - A promise to be fullfilled when all pending tasks are finished.
       */

    }, {
      key: "stopReporting",
      value: function stopReporting() {
        var _this8 = this;

        var result = null;
        if (this.timer >= 0) {
          window.clearInterval(this.timer);
          this.timer = -1;
        }
        if (this.beforeUnloadFunction) {
          window.removeEventListener('beforeunload', this.beforeUnloadFunction);
          this.beforeUnloadFunction = null;
        }
        if (this.initiated) {
          result = this.flushTasksPromise().then(function () {
            _this8.serviceUrl = null;
            _this8.descriptionDetail = _this8.serverPath + " (" + _this8.ps.getMsg('not connected') + ")";
            _this8.initiated = false;
          });
        }
        return result || Promise.resolve(true);
      }

      /**
       * Prepares a {@link ReportBean} object with information related to the current
       * activity, and pushes it into the list of pending `tasks`, to be processed by the main `timer`.
       * @param {boolean} flushNow - When `true`, the activity data will be sent to server as soon as possible
       */

    }, {
      key: "reportActivity",
      value: function reportActivity(flushNow) {
        var _this9 = this;

        if (this.lastActivity) {
          if (!this.lastActivity.closed) this.lastActivity.closeActivity();
          var actCount = this.actCount++,
              act = this.lastActivity;
          this.createDBSession(false).then(function () {
            var bean = new ReportBean('add activity');
            bean.setParam('session', _this9.currentSessionId);
            bean.setParam('num', actCount);
            bean.appendData(act.$getXML());
            _this9.addTask(bean);
            if (flushNow) _this9.flushTasksPromise().then();
          });
        }
        if (this.currentSession !== null && this.currentSession.currentSequence !== null && this.currentSession.currentSequence.currentActivity !== this.lastActivity) {
          this.lastActivity = this.currentSession.currentSequence.currentActivity;
        } else this.lastActivity = null;
      }

      /**
       * This method should be invoked when the user starts a new activity
       * @override
       * @param {Activity} act - The {@link Activity} reporter has just started
       */

    }, {
      key: "newActivity",
      value: function newActivity(act) {
        _get(TCPReporter.prototype.__proto__ || Object.getPrototypeOf(TCPReporter.prototype), "newActivity", this).call(this, act);
        this.reportActivity(false);
      }

      /**
       * This method should be called when the current activity finishes. Data about user's final results
       * on the activity will then be saved.
       * @override
       * @param {number} score - The final score, usually in a 0-100 scale.
       * @param {number} numActions - The total number of actions done by the user to solve the activity
       * @param {boolean} solved - `true` if the activity was finally solved, `false` otherwise.
       */

    }, {
      key: "endActivity",
      value: function endActivity(score, numActions, solved) {
        _get(TCPReporter.prototype.__proto__ || Object.getPrototypeOf(TCPReporter.prototype), "endActivity", this).call(this, score, numActions, solved);
        this.reportActivity(true);
      }
    }]);

    return TCPReporter;
  }(Reporter);

  Object.assign(TCPReporter.prototype, {
    /**
     * Description of this reporting system
     * @name TCPReporter#descriptionKey
     * @override
     * @type {string} */
    descriptionKey: 'Reporting to remote server',
    /**
     * Additional info to display after the reporter's `description`
     * @name TCPReporter#descriptionDetail
     * @override
     * @type {string} */
    descriptionDetail: '(not connected)',
    /**
     * Main path of the reports server (without protocol nor service)
     * @name TCPReporter#serverPath
     * @type {string} */
    serverPath: '',
    /**
     * Function to be called by the browser before leaving the current page
     * @name TCPReporter#beforeUnloadFunction
     * @type {function} */
    beforeUnloadFunction: null,
    /**
     * Identifier of the current session, provided by the server
     * @name TCPReporter#currentSessionId
     * @type {string} */
    currentSessionId: '',
    /**
     * Last activity reported
     * @name TCPReporter#lastActivity
     * @type {ActivityReg} */
    lastActivity: null,
    /**
     * Number of activities processed
     * @name TCPReporter#actCount
     * @type {number} */
    actCount: 0,
    /**
     * Service URL of the JClic Reports server
     * @name TCPReporter#serviceUrl
     * @type {string} */
    serviceUrl: null,
    /**
     * Object used to store specific properties of the connected reports system
     * @name TCPReporter#dbProperties
     * @type {object} */
    dbProperties: null,
    /**
     * List of {@link ReportBean} objects pending to be processed
     * @name TCPReporter#tasks
     * @type {ReportBean[]} */
    tasks: null,
    /**
     * Waiting list of tasks, to be used while `tasks` is being processed
     * @name TCPReporter#waitingTasks
     * @type {ReportBean[]} */
    waitingTasks: null,
    /**
     * Flag used to indicate if `transaction` is currently running
     * @name TCPReporter#processingTasks
     * @type {boolean} */
    processingTasks: false,
    /**
     * Force processing of pending tasks as soon as possible
     * @name TCPReporter#forceFlush
     * @type {boolean} */
    forceFlush: false,
    /**
     * Identifier of the background function obtained with a call to `window.setInterval`
     * @name TCPReporter#timer
     * @type {number} */
    timer: -1,
    /**
     * Time between calls to the background function, in seconds
     * @name TCPReporter#timerLap
     * @type {number} */
    timerLap: 5,
    /**
     * Counter of unsuccessful connection attempts with the report server
     * @name TCPReporter#failCount
     * @type {number} */
    failCount: 0,
    /**
     * Maximum number of failed attempts allowed before disconnecting
     * @name TCPReporter#maxFails
     * @type {number} */
    maxFails: 5,
    /**
     * Default path of JClic Reports Server
     * @name TCPReporter#DEFAULT_SERVER_PATH
     * @type {string} */
    DEFAULT_SERVER_PATH: 'localhost:9000',
    /**
     * Default name for the reports service
     * @name TCPReporter#DEFAULT_SERVER_SERVICE
     * @type {string} */
    DEFAULT_SERVER_SERVICE: '/JClicReportService',
    /**
     * Default server protocol
     * Use always 'https' except when in 'http' and protocol not set in options
     * @name TCPReporter#DEFAULT_SERVER_PROTOCOL
     * @type {string} */
    DEFAULT_SERVER_PROTOCOL: document && document.location && document.location.protocol === 'http:' ? 'http' : 'https',
    /**
     * Default lap between calls to `flushTasks`, in seconds
     * @name TCPReporter#DEFAULT_TIMER_LAP
     * @type {number} */
    DEFAULT_TIMER_LAP: 20
  });

  /**
   * This inner class encapsulates a chunk of information in XML format, ready to be
   * transmitted to the remote reports server.
   * @class
   */

  var ReportBean = function () {
    /**
     * ReportBean constructor
     * @param id {string} - The main identifier of this ReportBean. Current valid values are:
     * `get property`, `get_properties`, `add session`, `add activity`, `get groups`, `get users`,
     * `get user data`, `get group data`, `new group`, `new user` and `multiple`.
     * @param $data {external:jQuery}+ - Optional XML data to be added to this bean
     */
    function ReportBean(id, $data) {
      _classCallCheck(this, ReportBean);

      this.$bean = $('<bean/>').attr({ id: id });
      if ($data) this.appendData($data);
    }

    /**
     * Adds  an XML element to the bean
     * @param {external:jQuery} $data - The XML element to be added to this bean
     */


    _createClass(ReportBean, [{
      key: "appendData",
      value: function appendData($data) {
        if ($data) {
          this.$bean.append($data);
        }
      }

      /**
       * Adds an XML element of type `param` to this ReportBean
       * @param {string} name - The key name of the parameter
       * @param {string|number|boolean} value - The value of the parameter
       */

    }, {
      key: "setParam",
      value: function setParam(name, value) {
        if (typeof value !== 'undefined' && value !== null) this.appendData($('<param/>').attr({ name: name, value: value }));
      }
    }]);

    return ReportBean;
  }();

  Object.assign(ReportBean.prototype, {
    /**
     * The main jQuery XML object managed by this ReportBean
     * @name ReportBean#$bean
     * @type {external:jQuery} */
    $bean: null
  });

  TCPReporter.ReportBean = ReportBean;

  // Register class in Reporter.CLASSES
  Reporter.CLASSES['TCPReporter'] = TCPReporter;

  return TCPReporter;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 529 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : report/SessionStorageReporter.js
 *  Created : 06/09/2017
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define, window */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(139)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Reporter) {

  /**
   * This JClic {@link Reporter} writes persistent data to the browser local session storage. It uses some of
   * the {@link https://github.com/projectestac/jclic/wiki/JClic-Reports-developers-guide JClic Reports API}.
   * Connection parameters (`key`, `context`...) are passed through the `options` element of {@link JClicPlayer} (acting as {@link PlayStation}).
   * Set `storage=local` in `options` to store reports in [`window.localStorage`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage}
   * instead of [`window.sessionStorage`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage} (default).
   * @exports SessionStorageReporter
   * @class
   * @extends Reporter
   */
  var SessionStorageReporter = function (_Reporter) {
    _inherits(SessionStorageReporter, _Reporter);

    /**
     * SessionStorageReporter constructor
     * @param {PlayStation} ps - The {@link PlayStation} used to retrieve settings and localized messages
     */
    function SessionStorageReporter(ps) {
      _classCallCheck(this, SessionStorageReporter);

      var _this = _possibleConstructorReturn(this, (SessionStorageReporter.__proto__ || Object.getPrototypeOf(SessionStorageReporter)).call(this, ps));

      _this.key = "jclic_" + new Date().toISOString() + "#" + Math.ceil(Math.random() * 1000);
      return _this;
    }

    /**
     * Initializes this report system with an optional set of parameters.
     * Returns a Promise, fulfilled when the reporter is fully initialized.
     * @override
     * @param {?Object} options - Initial settings passed to the reporting system
     * @returns {Promise}
     */


    _createClass(SessionStorageReporter, [{
      key: "init",
      value: function init(options) {
        if (typeof options === 'undefined' || options === null) options = this.ps.options;
        if (options.storage === 'local') {
          this.storage = window.localStorage;
          this.descriptionKey = 'Reporting to local storage';
        }
        return Reporter.prototype.init.call(this, options);
      }

      /**
       * 
       * Saves the current report data to sessionStorage
       */

    }, {
      key: "saveCurrentReport",
      value: function saveCurrentReport() {
        var _this2 = this;

        // Update results out of current thread
        window.setTimeout(function () {
          _this2.storage.setItem(_this2.key, JSON.stringify(_this2.getData()));
        }, 0);
      }

      /**
       * Finalizes the current sequence
       * @override
       */

    }, {
      key: "endSequence",
      value: function endSequence() {
        _get(SessionStorageReporter.prototype.__proto__ || Object.getPrototypeOf(SessionStorageReporter.prototype), "endSequence", this).call(this);
        this.saveCurrentReport();
      }

      /**
       * This method should be called when the current activity finishes. Data about user's final results
       * on the activity will then be saved.
       * @override
       * @param {number} score - The final score, usually in a 0-100 scale.
       * @param {number} numActions - The total number of actions done by the user to solve the activity
       * @param {boolean} solved - `true` if the activity was finally solved, `false` otherwise.
       */

    }, {
      key: "endActivity",
      value: function endActivity(score, numActions, solved) {
        _get(SessionStorageReporter.prototype.__proto__ || Object.getPrototypeOf(SessionStorageReporter.prototype), "endActivity", this).call(this, score, numActions, solved);
        this.saveCurrentReport();
      }
    }]);

    return SessionStorageReporter;
  }(Reporter);

  Object.assign(SessionStorageReporter.prototype, {
    /**
     * Type of storage to be used. Defaults to `window.sessionStorage`
     * @name SessionStorageReporter#storage
     * @type {external:Storage} */
    storage: window.sessionStorage,
    /**
     * Description of this reporting system
     * @name SessionStorageReporter#descriptionKey
     * @override
     * @type {string} */
    descriptionKey: 'Reporting to session storage',
    /**
     * Additional info to display after the reporter's `description`
     * @name SessionStorageReporter#descriptionDetail
     * @override
     * @type {string} */
    descriptionDetail: '(browser session)',
    /**
     * Key used to save the report into sessionStorage
     * @name SessionStorageReporter#key 
     * @type {string} */
    key: null
  });

  // Register class in Reporter.CLASSES
  Reporter.CLASSES['SessionStorageReporter'] = SessionStorageReporter;

  return SessionStorageReporter;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ }),
/* 530 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;

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; }; }();

var _get = function get(object, property, receiver) { 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 { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _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; }

/**
 *  File    : activities/text/Complete.js
 *  Created : 20/06/2015
 *  By      : Francesc Busquets <francesc@gmail.com>
 *
 *  JClic.js
 *  An HTML5 player of JClic activities
 *  https://projectestac.github.io/jclic.js
 *
 *  @source https://github.com/projectestac/jclic.js
 *
 *  @license EUPL-1.1
 *  @licstart
 *  (c) 2000-2018 Catalan Educational Telematic Network (XTEC)
 *
 *  Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
 *  the European Commission- subsequent versions of the EUPL (the "Licence");
 *  You may not use this work except in compliance with the Licence.
 *
 *  You may obtain a copy of the Licence at:
 *  https://joinup.ec.europa.eu/software/page/eupl
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  Licence for the specific language governing permissions and limitations
 *  under the Licence.
 *  @licend
 */

/* global define */

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(13), __webpack_require__(76)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, Activity, TextActivityBase) {

  /**
   * This type of text activity suggests users to complete a given text, without any help on where to
   * write the missing words or phrases.
   * @exports Complete
   * @class
   * @extends TextActivityBase
   */
  var Complete = function (_TextActivityBase) {
    _inherits(Complete, _TextActivityBase);

    /**
     * Complete constructor
     * @param {JClicProject} project - The project to which this activity belongs
     */
    function Complete(project) {
      _classCallCheck(this, Complete);

      return _possibleConstructorReturn(this, (Complete.__proto__ || Object.getPrototypeOf(Complete)).call(this, project));
    }

    return Complete;
  }(TextActivityBase);

  /**
   * The {@link TextActivityBasePanel} where {@link Complete} activities are played.
   * @class
   * @extends TextActivityBasePanel
   */


  var CompletePanel = function (_TextActivityBase$Pan) {
    _inherits(CompletePanel, _TextActivityBase$Pan);

    /**
     * CompletePanel constructor
     * @param {Activity} act - The {@link Activity} to which this Panel belongs
     * @param {JClicPlayer} ps - Any object implementing the methods defined in the
     * [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html)
     * Java interface.
     * @param {external:jQuery=} $div - The jQuery DOM element where this Panel will deploy
     */
    function CompletePanel(act, ps, $div) {
      _classCallCheck(this, CompletePanel);

      return _possibleConstructorReturn(this, (CompletePanel.__proto__ || Object.getPrototypeOf(CompletePanel)).call(this, act, ps, $div));
    }

    /**
     * Creates a target DOM element for the provided target.
     * @override
     * @param {TextActivityDocument.TextTarget} _target - The target related to the DOM object to be created
     * @param {external:jQuery} _$span -  - An initial DOM object (usually a `span`) that can be used
     * to store the target, or replaced by another type of object.
     * @returns {external:jQuery} - The jQuery DOM element loaded with the target data.
     */


    _createClass(CompletePanel, [{
      key: "$createTargetElement",
      value: function $createTargetElement(_target, _$span) {
        // Targets are always hidden in this type of activities
        return null;
      }

      /**
       * Called when the activity starts playing
       * @override
       */

    }, {
      key: "startActivity",
      value: function startActivity() {
        _get(CompletePanel.prototype.__proto__ || Object.getPrototypeOf(CompletePanel.prototype), "startActivity", this).call(this);
        this.$div.find('.JClicTextDocument').attr('contenteditable', 'true').attr('spellcheck', 'false');
      }

      /**
       * Evaluates all the targets in this panel. This method is usually called from the `Check` button.
       * @override
       * @returns {boolean} - `true` when all targets are OK, `false` otherwise.
       */

    }, {
      key: "evaluatePanel",
      value: function evaluatePanel() {
        // TODO: Mark errors!
        var currentText = this.$div.find('.JClicTextDocument').text().trim(),
            originalText = this.act.document.getRawText(),
            ok = this.act.ev.checkText(currentText, originalText);

        this.ps.reportNewAction(this.act, 'WRITE', currentText, originalText, ok, this.targets.length);

        if (ok) {
          this.finishActivity(true);
          return true;
        } else {
          this.playEvent('finishedError');
        }
        return false;
      }

      /**
       * Ordinary ending of the activity, usually called form `processEvent`
       * @param {boolean} result - `true` if the activity was successfully completed, `false` otherwise
       */

    }, {
      key: "finishActivity",
      value: function finishActivity(result) {
        this.$div.find('.JClicTextDocument').attr('contenteditable', 'false');
        return _get(CompletePanel.prototype.__proto__ || Object.getPrototypeOf(CompletePanel.prototype), "finishActivity", this).call(this, result);
      }
    }]);

    return CompletePanel;
  }(TextActivityBase.Panel);

  /**
   * Panel class associated to this type of activity: {@link CompletePanel}
   * @type {class} */


  Complete.Panel = CompletePanel;

  // Register class in Activity.prototype
  Activity.CLASSES['@text.Complete'] = Complete;

  return Complete;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

/***/ })
/******/ ]);
//# sourceMappingURL=jclic.js.map