/* Source: src/mt-includes/assets/jquery/jquery-2.1.4.js*/ /*! * jQuery JavaScript Library v2.1.4 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2015-04-28T16:01Z */ (function( global, factory ) { if ( 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 : this, function( window, noGlobal ) { // Support: Firefox 18+ // Can't be in strict mode, several libs including ASP.NET trace // the stack via arguments.caller.callee and Firefox dies if // you try to trace through "use strict" call chains. (#13335) // var arr = []; 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 support = {}; var // Use the correct document accordingly with window argument (sandbox) document = window.document, version = "2.1.4", // Define a local copy of jQuery jQuery = function( 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.1 // Make sure we trim BOM and NBSP rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; jQuery.fn = jQuery.prototype = { // The current version of jQuery being used jquery: version, constructor: jQuery, // Start with an empty selector selector: "", // The default length of a jQuery object is 0 length: 0, toArray: function() { 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( num ) { return num != null ? // Return just the one element from the set ( num < 0 ? this[ num + this.length ] : this[ num ] ) : // Return all the elements in a clean array slice.call( this ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( 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; ret.context = this.context; // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, slice: function() { return this.pushStack( slice.apply( this, arguments ) ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, eq: function( i ) { var len = this.length, j = +i + ( i < 0 ? len : 0 ); return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); }, end: function() { return this.prevObject || this.constructor(null); }, // 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 !== "object" && !jQuery.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 = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.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( msg ) { throw new Error( msg ); }, noop: function() {}, isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray, isWindow: function( obj ) { return obj != null && obj === obj.window; }, isNumeric: function( obj ) { // parseFloat NaNs numeric-cast false positives (null|true|false|"") // ...but misinterprets leading-number strings, particularly hex literals ("0x...") // subtraction forces infinities to NaN // adding 1 corrects loss of precision from parseFloat (#15100) return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0; }, isPlainObject: function( obj ) { // Not plain objects: // - Any object or value whose internal [[Class]] property is not "[object Object]" // - DOM nodes // - window if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } if ( obj.constructor && !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { return false; } // If the function hasn't returned already, we're confident that // |obj| is a plain object, created by {} or constructed with new Object return true; }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, type: function( obj ) { if ( obj == null ) { return obj + ""; } // Support: Android<4.0, iOS<6 (functionish RegExp) return typeof obj === "object" || typeof obj === "function" ? class2type[ toString.call(obj) ] || "object" : typeof obj; }, // Evaluates a script in a global context globalEval: function( code ) { var script, indirect = eval; code = jQuery.trim( code ); if ( code ) { // If the code includes a valid, prologue position // strict mode pragma, execute code by injecting a // script tag into the document. if ( code.indexOf("use strict") === 1 ) { script = document.createElement("script"); script.text = code; document.head.appendChild( script ).parentNode.removeChild( script ); } else { // Otherwise, avoid the DOM node creation, insertion // and removal by using an indirect global eval indirect( code ); } } }, // Convert dashed to camelCase; used by the css and data modules // Support: IE9-11+ // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, // args is for internal usage only each: function( obj, callback, args ) { var value, i = 0, length = obj.length, isArray = isArraylike( obj ); if ( args ) { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } } return obj; }, // Support: Android<4.1 trim: function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( 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( elem, arr, i ) { return arr == null ? -1 : indexOf.call( arr, elem, i ); }, merge: function( 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( 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( elems, callback, arg ) { var value, i = 0, length = elems.length, isArray = isArraylike( elems ), ret = []; // Go through the array, translating each of the items to their new values if ( isArray ) { 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, // Bind a function to a context, optionally partially applying any // arguments. 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 ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = slice.call( arguments, 2 ); proxy = function() { 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; }, now: Date.now, // jQuery.support is not used in Core but other projects attach their // properties to it so it needs to exist. support: support }); // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); function isArraylike( obj ) { // Support: iOS 8.2 (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 = "length" in obj && obj.length, type = jQuery.type( obj ); if ( type === "function" || jQuery.isWindow( obj ) ) { return false; } if ( obj.nodeType === 1 && length ) { return true; } return type === "array" || length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj; } var Sizzle = /*! * Sizzle CSS Selector Engine v2.2.0-pre * http://sizzlejs.com/ * * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2014-12-16 */ (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( a, b ) { if ( a === b ) { hasDuplicate = true; } return 0; }, // General-purpose constants MAX_NEGATIVE = 1 << 31, // 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 // http://jsperf.com/thor-indexof-vs-for/5 indexOf = function( 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 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/css3-syntax/#characters characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", // Loosely modeled on CSS identifier characters // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace( "w", "w#" ), // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + // Operator (capture 2) "*([*^$|!~]?=)" + whitespace + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + characterEncoding + ")(?:\\((" + // 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( "^#(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), "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 = /[+~]/, rescape = /'|\\/g, // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), funescape = function( _, 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 ); }, // Used for iframes // See setDocument() // Removing the function wrapper causes a "Permission Denied" // error in IE unloadHandler = function() { setDocument(); }; // 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 match, elem, m, nodeType, // QSA vars i, groups, old, nid, newContext, newSelector; if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { setDocument( context ); } context = context || document; results = results || []; nodeType = context.nodeType; if ( typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { return results; } if ( !seed && documentIsHTML ) { // Try to shortcut find operations when possible (e.g., not under DocumentFragment) if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { // Speed-up: Sizzle("#ID") if ( (m = match[1]) ) { if ( nodeType === 9 ) { elem = context.getElementById( m ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document (jQuery #6963) if ( elem && elem.parentNode ) { // Handle the case where IE, Opera, and Webkit return items // by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } } else { // Context is not a document if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Speed-up: Sizzle("TAG") } else if ( match[2] ) { push.apply( results, context.getElementsByTagName( selector ) ); return results; // Speed-up: Sizzle(".CLASS") } else if ( (m = match[3]) && support.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } } // QSA path if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { nid = old = expando; newContext = context; newSelector = nodeType !== 1 && selector; // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { groups = tokenize( selector ); if ( (old = context.getAttribute("id")) ) { nid = old.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", nid ); } nid = "[id='" + nid + "'] "; i = groups.length; while ( i-- ) { groups[i] = nid + toSelector( groups[i] ); } newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; newSelector = groups.join(","); } if ( newSelector ) { try { push.apply( results, newContext.querySelectorAll( newSelector ) ); return results; } catch(qsaError) { } finally { if ( !old ) { 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 div and expects a boolean result */ function assert( fn ) { var div = document.createElement("div"); try { return !!fn( div ); } catch (e) { return false; } finally { // Remove from its parent by default if ( div.parentNode ) { div.parentNode.removeChild( div ); } // release memory in IE div = 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 = attrs.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 && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); // 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 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, parent, doc = node ? node.ownerDocument || node : preferredDoc; // If no document and documentElement is available, return if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { return document; } // Set our document document = doc; docElem = doc.documentElement; parent = doc.defaultView; // Support: IE>8 // If iframe document is assigned to "document" variable and if iframe has been reloaded, // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 // IE6-8 do not support the defaultView property so parent will be undefined if ( parent && parent !== parent.top ) { // IE11 does not have attachEvent, so all must suffer if ( parent.addEventListener ) { parent.addEventListener( "unload", unloadHandler, false ); } else if ( parent.attachEvent ) { parent.attachEvent( "onunload", unloadHandler ); } } /* Support tests ---------------------------------------------------------------------- */ documentIsHTML = !isXML( doc ); /* Attributes ---------------------------------------------------------------------- */ // Support: IE<8 // Verify that getAttribute really returns attributes and not properties // (excepting IE8 booleans) support.attributes = assert(function( div ) { div.className = "i"; return !div.getAttribute("className"); }); /* getElement(s)By* ---------------------------------------------------------------------- */ // Check if getElementsByTagName("*") returns only elements support.getElementsByTagName = assert(function( div ) { div.appendChild( doc.createComment("") ); return !div.getElementsByTagName("*").length; }); // Support: IE<9 support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); // Support: IE<10 // Check if getElementById returns elements by name // The broken getElementById methods don't pick up programatically-set names, // so use a roundabout getElementsByName test support.getById = assert(function( div ) { docElem.appendChild( div ).id = expando; return !doc.getElementsByName || !doc.getElementsByName( expando ).length; }); // ID find and filter if ( support.getById ) { Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [ m ] : []; } }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; } else { // Support: IE6/7 // getElementById is not reliable as a find shortcut delete Expr.find["ID"]; 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; }; }; } // 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 ( 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 http://bugs.jquery.com/ticket/13378 rbuggyQSA = []; if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { // 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 // http://bugs.jquery.com/ticket/12359 docElem.appendChild( div ).innerHTML = "" + ""; // 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 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section if ( div.querySelectorAll("[msallowcapture^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } // Support: IE8 // Boolean attributes and "value" are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); } // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+ if ( !div.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 ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } // Support: Safari 8+, iOS 8+ // https://bugs.webkit.org/show_bug.cgi?id=136851 // In-page `selector#id sibing-combinator selector` fails if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { rbuggyQSA.push(".#.+[+~]"); } }); assert(function( div ) { // Support: Windows 8 Native Apps // The type and name attributes are restricted during .innerHTML assignment var input = doc.createElement("input"); input.setAttribute( "type", "hidden" ); div.appendChild( input ).setAttribute( "name", "D" ); // Support: IE8 // Enforce case-sensitivity of name attribute if ( div.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 ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Opera 10-11 does not throw on post-comma invalid pseudos div.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) support.disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead matches.call( div, "[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 does not implement inclusive descendent // 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 === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { return -1; } if ( b === doc || 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 === doc ? -1 : b === doc ? 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 doc; }; 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 && ( !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.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( 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( 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( 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( nodeNameSelector ) { var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); return nodeNameSelector === "*" ? function() { return true; } : function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( 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( 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( 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, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType; 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 outerCache = parent[ expando ] || (parent[ expando ] = {}); cache = outerCache[ type ] || []; nodeIndex = cache[0] === dirruns && cache[1]; diff = cache[0] === dirruns && 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 ) { outerCache[ type ] = [ dirruns, nodeIndex, diff ]; break; } } // Use previously-cached element index if available } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { diff = cache[1]; // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) } else { // 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 ) { (node[ expando ] || (node[ expando ] = {}))[ 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, 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( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, "root": function( elem ) { return elem === docElem; }, "focus": function( elem ) { return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, // Boolean properties "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( 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( 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( 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( elem ) { return !Expr.pseudos["empty"]( elem ); }, // Element/input types "header": function( elem ) { return rheader.test( elem.nodeName ); }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function( 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, checkNonElements = base && dir === "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 ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { var oldCache, outerCache, newCache = [ dirruns, doneName ]; // We can't set arbitrary data on XML nodes, so they don't benefit from dir 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 ] = {}); if ( (oldCache = outerCache[ dir ]) && 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 outerCache[ dir ] = newCache; // A match means we're done; a fail means we have to keep checking if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { return true; } } } } } }; } 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( 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; } // Add elements passing elementMatchers directly to results // Keep `i` a string if there are no elements so `matchedCount` will be "00" below // Support: IE<9, Safari // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id for ( ; i !== len && (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context, 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 ); } } } // Apply set filters to unmatched elements matchedCount += i; 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 no seed and only one group if ( match.length === 1 ) { // Take a shortcut and set the context if the root selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && support.getById && 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, 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( div1 ) { // Should return 1, but returns 4 (following) return div1.compareDocumentPosition( document.createElement("div") ) & 1; }); // Support: IE<8 // Prevent attribute/property "interpolation" // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx if ( !assert(function( div ) { div.innerHTML = ""; return div.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( div ) { div.innerHTML = ""; div.firstChild.setAttribute( "value", "" ); return div.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( div ) { return div.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; jQuery.expr[":"] = jQuery.expr.pseudos; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; var rneedsContext = jQuery.expr.match.needsContext; var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); var risSimple = /^.[^:#\[\.,]*$/; // Implement the identical functionality for filter and not function winnow( elements, qualifier, not ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { /* jshint -W018 */ return !!qualifier.call( elem, i, elem ) !== not; }); } if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; }); } if ( typeof qualifier === "string" ) { if ( risSimple.test( qualifier ) ) { return jQuery.filter( qualifier, elements, not ); } qualifier = jQuery.filter( qualifier, elements ); } return jQuery.grep( elements, function( elem ) { return ( indexOf.call( qualifier, elem ) >= 0 ) !== not; }); } jQuery.filter = function( expr, elems, not ) { var elem = elems[ 0 ]; if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { return elem.nodeType === 1; })); }; jQuery.fn.extend({ find: function( selector ) { var i, len = this.length, ret = [], 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; } } }) ); } for ( i = 0; i < len; i++ ) { jQuery.find( selector, self[ i ], ret ); } // Needed because $( selector, context ) becomes $( context ).find( selector ) ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); ret.selector = this.selector ? this.selector + " " + selector : selector; return ret; }, filter: function( selector ) { return this.pushStack( winnow(this, selector || [], false) ); }, not: function( selector ) { return this.pushStack( winnow(this, selector || [], true) ); }, is: function( 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 to avoid XSS via location.hash (#9521) // Strict HTML recognition (#11290: must start with <) rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, init = jQuery.fn.init = function( selector, context ) { var match, elem; // HANDLE: $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // 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 ( jQuery.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] ); // Support: Blackberry 4.6 // gEBID returns nodes no longer in the document (#6963) if ( elem && elem.parentNode ) { // Inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || rootjQuery ).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.context = this[0] = selector; this.length = 1; return this; // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return typeof rootjQuery.ready !== "undefined" ? rootjQuery.ready( selector ) : // Execute immediately if ready is not present selector( jQuery ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } 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.extend({ dir: function( 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; }, sibling: function( n, elem ) { var matched = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { matched.push( n ); } } return matched; } }); jQuery.fn.extend({ has: function( 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( selectors, context ) { var cur, i = 0, l = this.length, matched = [], pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { // Always skip document fragments if ( cur.nodeType < 11 && (pos ? pos.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.unique( matched ) : matched ); }, // Determine the position of an element within the set index: function( 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( selector, context ) { return this.pushStack( jQuery.unique( jQuery.merge( this.get(), jQuery( selector, context ) ) ) ); }, addBack: function( 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( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return elem.contentDocument || 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.unique( matched ); } // Reverse order for parents* and prev-derivatives if ( rparentsprev.test( name ) ) { matched.reverse(); } } return this.pushStack( matched ); }; }); var rnotwhite = (/\S+/g); // String to Object options format cache var optionsCache = {}; // Convert String-formatted options into Object-formatted ones and store in cache function createOptions( options ) { var object = optionsCache[ options ] = {}; jQuery.each( options.match( rnotwhite ) || [], 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" ? ( optionsCache[ options ] || createOptions( options ) ) : jQuery.extend( {}, options ); var // Last fire value (for non-forgettable lists) memory, // Flag to know if list was already fired fired, // Flag to know if list is currently firing firing, // First callback to fire (used internally by add and fireWith) firingStart, // End of the loop when firing firingLength, // Index of currently firing callback (modified by remove if needed) firingIndex, // Actual callback list list = [], // Stack of fire calls for repeatable lists stack = !options.once && [], // Fire callbacks fire = function( data ) { memory = options.memory && data; fired = true; firingIndex = firingStart || 0; firingStart = 0; firingLength = list.length; firing = true; for ( ; list && firingIndex < firingLength; firingIndex++ ) { if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { memory = false; // To prevent further calls using add break; } } firing = false; if ( list ) { if ( stack ) { if ( stack.length ) { fire( stack.shift() ); } } else if ( memory ) { list = []; } else { self.disable(); } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { // First, we save the current length var start = list.length; (function add( args ) { jQuery.each( args, function( _, arg ) { var type = jQuery.type( arg ); if ( type === "function" ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && type !== "string" ) { // Inspect recursively add( arg ); } }); })( arguments ); // Do we need to add the callbacks to the // current firing batch? if ( firing ) { firingLength = list.length; // With memory, if we're not firing then // we should call right away } else if ( memory ) { firingStart = start; fire( memory ); } } return this; }, // Remove a callback from the list remove: function() { if ( list ) { jQuery.each( arguments, function( _, arg ) { var index; while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( firing ) { if ( index <= firingLength ) { firingLength--; } 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( fn ) { return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); }, // Remove all callbacks from the list empty: function() { list = []; firingLength = 0; return this; }, // Have the list do nothing anymore disable: function() { list = stack = memory = undefined; return this; }, // Is it disabled? disabled: function() { return !list; }, // Lock the list in its current state lock: function() { stack = undefined; if ( !memory ) { self.disable(); } return this; }, // Is it locked? locked: function() { return !stack; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { if ( list && ( !fired || stack ) ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; if ( firing ) { stack.push( args ); } else { fire( args ); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; jQuery.extend({ Deferred: function( func ) { var tuples = [ // action, add listener, listener list, final state [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], [ "notify", "progress", jQuery.Callbacks("memory") ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred(function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[1] ](function() { var returned = fn && fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .done( newDefer.resolve ) .fail( newDefer.reject ) .progress( newDefer.notify ); } else { newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); } }); }); fns = null; }).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; // Keep pipe for back-compat promise.pipe = promise.then; // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 3 ]; // promise[ done | fail | progress ] = list.add promise[ tuple[1] ] = list.add; // Handle state if ( stateString ) { list.add(function() { // state = [ resolved | rejected ] state = stateString; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } // deferred[ resolve | reject | notify ] deferred[ tuple[0] ] = function() { deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); return this; }; 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( subordinate /* , ..., subordinateN */ ) { var i = 0, resolveValues = slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, // the master Deferred. If resolveValues consist of only a single Deferred, just use that. deferred = remaining === 1 ? subordinate : jQuery.Deferred(), // Update function for both resolve and progress values updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; if ( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !( --remaining ) ) { deferred.resolveWith( contexts, values ); } }; }, progressValues, progressContexts, resolveContexts; // Add listeners to Deferred subordinates; treat others as resolved if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); resolveContexts = new Array( length ); for ( ; i < length; i++ ) { if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { resolveValues[ i ].promise() .done( updateFunc( i, resolveContexts, resolveValues ) ) .fail( deferred.reject ) .progress( updateFunc( i, progressContexts, progressValues ) ); } else { --remaining; } } } // If we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } return deferred.promise(); } }); // The deferred used on DOM ready var readyList; jQuery.fn.ready = function( fn ) { // Add the callback jQuery.ready.promise().done( fn ); 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, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( 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 ] ); // Trigger any bound ready events if ( jQuery.fn.triggerHandler ) { jQuery( document ).triggerHandler( "ready" ); jQuery( document ).off( "ready" ); } } }); /** * The ready event handler and self cleanup method */ function completed() { document.removeEventListener( "DOMContentLoaded", completed, false ); window.removeEventListener( "load", completed, false ); jQuery.ready(); } jQuery.ready.promise = function( obj ) { if ( !readyList ) { readyList = jQuery.Deferred(); // Catch cases where $(document).ready() is called after the browser event has already occurred. // We once tried to use readyState "interactive" here, but it caused issues like the one // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 if ( document.readyState === "complete" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout( jQuery.ready ); } else { // Use the handy event callback document.addEventListener( "DOMContentLoaded", completed, false ); // A fallback to window.onload, that will always work window.addEventListener( "load", completed, false ); } } return readyList.promise( obj ); }; // Kick off the DOM ready check even if the user does not jQuery.ready.promise(); // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { var i = 0, len = elems.length, bulk = key == null; // Sets many values if ( jQuery.type( key ) === "object" ) { chainable = true; for ( i in key ) { jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); } // Sets one value } else if ( value !== undefined ) { chainable = true; if ( !jQuery.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( 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 ) ) ); } } } return chainable ? elems : // Gets bulk ? fn.call( elems ) : len ? fn( elems[0], key ) : emptyGet; }; /** * Determines whether an object can have data */ jQuery.acceptData = function( owner ) { // Accepts only: // - Node // - Node.ELEMENT_NODE // - Node.DOCUMENT_NODE // - Object // - Any /* jshint -W018 */ return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); }; function Data() { // Support: Android<4, // Old WebKit does not have Object.preventExtensions/freeze method, // return new empty object instead with no [[set]] accessor Object.defineProperty( this.cache = {}, 0, { get: function() { return {}; } }); this.expando = jQuery.expando + Data.uid++; } Data.uid = 1; Data.accepts = jQuery.acceptData; Data.prototype = { key: function( owner ) { // We can accept data for non-element nodes in modern browsers, // but we should not, see #8335. // Always return the key for a frozen object. if ( !Data.accepts( owner ) ) { return 0; } var descriptor = {}, // Check if the owner object already has a cache key unlock = owner[ this.expando ]; // If not, create one if ( !unlock ) { unlock = Data.uid++; // Secure it in a non-enumerable, non-writable property try { descriptor[ this.expando ] = { value: unlock }; Object.defineProperties( owner, descriptor ); // Support: Android<4 // Fallback to a less secure definition } catch ( e ) { descriptor[ this.expando ] = unlock; jQuery.extend( owner, descriptor ); } } // Ensure the cache object if ( !this.cache[ unlock ] ) { this.cache[ unlock ] = {}; } return unlock; }, set: function( owner, data, value ) { var prop, // There may be an unlock assigned to this node, // if there is no entry for this "owner", create one inline // and set the unlock as though an owner entry had always existed unlock = this.key( owner ), cache = this.cache[ unlock ]; // Handle: [ owner, key, value ] args if ( typeof data === "string" ) { cache[ data ] = value; // Handle: [ owner, { properties } ] args } else { // Fresh assignments by object are shallow copied if ( jQuery.isEmptyObject( cache ) ) { jQuery.extend( this.cache[ unlock ], data ); // Otherwise, copy the properties one-by-one to the cache object } else { for ( prop in data ) { cache[ prop ] = data[ prop ]; } } } return cache; }, get: function( owner, key ) { // Either a valid cache is found, or will be created. // New caches will be created and the unlock returned, // allowing direct access to the newly created // empty data object. A valid owner object must be provided. var cache = this.cache[ this.key( owner ) ]; return key === undefined ? cache : cache[ key ]; }, access: function( owner, key, value ) { var stored; // 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) ) { stored = this.get( owner, key ); return stored !== undefined ? stored : this.get( owner, jQuery.camelCase(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( owner, key ) { var i, name, camel, unlock = this.key( owner ), cache = this.cache[ unlock ]; if ( key === undefined ) { this.cache[ unlock ] = {}; } else { // Support array or space separated string of keys if ( jQuery.isArray( key ) ) { // If "name" is an array of keys... // When data is initially created, via ("key", "val") signature, // keys will be converted to camelCase. // Since there is no way to tell _how_ a key was added, remove // both plain key and camelCase key. #12786 // This will only penalize the array argument path. name = key.concat( key.map( jQuery.camelCase ) ); } else { camel = jQuery.camelCase( key ); // Try the string as a key before any manipulation if ( key in cache ) { name = [ key, camel ]; } else { // If a key with the spaces exists, use it. // Otherwise, create an array by matching non-whitespace name = camel; name = name in cache ? [ name ] : ( name.match( rnotwhite ) || [] ); } } i = name.length; while ( i-- ) { delete cache[ name[ i ] ]; } } }, hasData: function( owner ) { return !jQuery.isEmptyObject( this.cache[ owner[ this.expando ] ] || {} ); }, discard: function( owner ) { if ( owner[ this.expando ] ) { delete this.cache[ owner[ this.expando ] ]; } } }; var data_priv = new Data(); var data_user = 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 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, "-$1" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} // Make sure we set the data so it isn't changed later data_user.set( elem, key, data ); } else { data = undefined; } } return data; } jQuery.extend({ hasData: function( elem ) { return data_user.hasData( elem ) || data_priv.hasData( elem ); }, data: function( elem, name, data ) { return data_user.access( elem, name, data ); }, removeData: function( elem, name ) { data_user.remove( elem, name ); }, // TODO: Now that all calls to _data and _removeData have been replaced // with direct calls to data_priv methods, these can be deprecated. _data: function( elem, name, data ) { return data_priv.access( elem, name, data ); }, _removeData: function( elem, name ) { data_priv.remove( elem, name ); } }); jQuery.fn.extend({ data: function( key, value ) { var i, name, data, elem = this[ 0 ], attrs = elem && elem.attributes; // Gets all values if ( key === undefined ) { if ( this.length ) { data = data_user.get( elem ); if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) { i = attrs.length; while ( i-- ) { // Support: IE11+ // The attrs elements can be null (#14894) if ( attrs[ i ] ) { name = attrs[ i ].name; if ( name.indexOf( "data-" ) === 0 ) { name = jQuery.camelCase( name.slice(5) ); dataAttr( elem, name, data[ name ] ); } } } data_priv.set( elem, "hasDataAttrs", true ); } } return data; } // Sets multiple values if ( typeof key === "object" ) { return this.each(function() { data_user.set( this, key ); }); } return access( this, function( value ) { var data, camelKey = jQuery.camelCase( key ); // 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 // with the key as-is data = data_user.get( elem, key ); if ( data !== undefined ) { return data; } // Attempt to get data from the cache // with the key camelized data = data_user.get( elem, camelKey ); if ( data !== undefined ) { return data; } // Attempt to "discover" the data in // HTML5 custom data-* attrs data = dataAttr( elem, camelKey, undefined ); if ( data !== undefined ) { return data; } // We tried really hard, but the data doesn't exist. return; } // Set the data... this.each(function() { // First, attempt to store a copy or reference of any // data that might've been store with a camelCased key. var data = data_user.get( this, camelKey ); // For HTML5 data-* attribute interop, we have to // store property names with dashes in a camelCase form. // This might not apply to all properties...* data_user.set( this, camelKey, value ); // *... In the case of properties that might _actually_ // have dashes, we need to also store a copy of that // unchanged property. if ( key.indexOf("-") !== -1 && data !== undefined ) { data_user.set( this, key, value ); } }); }, null, value, arguments.length > 1, null, true ); }, removeData: function( key ) { return this.each(function() { data_user.remove( this, key ); }); } }); jQuery.extend({ queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = data_priv.get( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jQuery.isArray( data ) ) { queue = data_priv.access( elem, type, jQuery.makeArray(data) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { 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( elem, type ) { var key = type + "queueHooks"; return data_priv.get( elem, key ) || data_priv.access( elem, key, { empty: jQuery.Callbacks("once memory").add(function() { data_priv.remove( elem, [ type + "queue", key ] ); }) }); } }); jQuery.fn.extend({ queue: function( 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( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, clearQueue: function( 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( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while ( i-- ) { tmp = data_priv.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 cssExpand = [ "Top", "Right", "Bottom", "Left" ]; var isHidden = function( elem, el ) { // isHidden might be called from jQuery#filter function; // in that case, element will be second argument elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); }; var rcheckableType = (/^(?:checkbox|radio)$/i); (function() { var fragment = document.createDocumentFragment(), div = fragment.appendChild( document.createElement( "div" ) ), input = document.createElement( "input" ); // Support: Safari<=5.1 // 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: Safari<=5.1, Android<4.2 // Older WebKit doesn't clone checked state correctly in fragments support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; // Support: IE<=11+ // Make sure textarea (and checkbox) defaultValue is properly cloned div.innerHTML = ""; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; })(); var strundefined = typeof undefined; support.focusinBubbles = "onfocusin" in window; var rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; function returnTrue() { return true; } function returnFalse() { return false; } function safeActiveElement() { try { return document.activeElement; } catch ( err ) { } } /* * 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( elem, types, handler, data, selector ) { var handleObjIn, eventHandle, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = data_priv.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; } // 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 !== strundefined && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply( elem, arguments ) : undefined; }; } // Handle multiple events separated by a space types = ( types || "" ).match( rnotwhite ) || [ "" ]; 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, false ); } } } 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( elem, types, handler, selector, mappedTypes ) { var j, origCount, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = data_priv.hasData( elem ) && data_priv.get( elem ); if ( !elemData || !(events = elemData.events) ) { return; } // Once for each type.namespace in types; type may be omitted types = ( types || "" ).match( rnotwhite ) || [ "" ]; 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 the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { delete elemData.handle; data_priv.remove( elem, "events" ); } }, trigger: function( event, data, elem, onlyHandlers ) { var i, cur, tmp, bubbleType, ontype, handle, special, eventPath = [ elem || document ], type = hasOwn.call( event, "type" ) ? event.type : event, namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; cur = 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(".") >= 0 ) { // 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 === "object" && event ); // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) event.isTrigger = onlyHandlers ? 2 : 3; event.namespace = namespaces.join("."); event.namespace_re = 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 && !jQuery.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() ) { event.type = i > 1 ? bubbleType : special.bindType || type; // jQuery handler handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Native handler handle = ontype && cur[ ontype ]; if ( handle && handle.apply && jQuery.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) && jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Don't do default actions on window, that's where global variables be (#6170) if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.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; elem[ type ](); jQuery.event.triggered = undefined; if ( tmp ) { elem[ ontype ] = tmp; } } } } return event.result; }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event ); var i, j, ret, matched, handleObj, handlerQueue = [], args = slice.call( arguments ), handlers = ( data_priv.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; 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.namespace_re || event.namespace_re.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( event, handlers ) { var i, matches, sel, handleObj, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; // Find delegate handlers // Black-hole SVG instance trees (#13180) // Avoid non-left-click bubbling in Firefox (#3861) if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { for ( ; cur !== this; cur = cur.parentNode || this ) { // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) if ( cur.disabled !== true || event.type !== "click" ) { matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; // Don't conflict with Object.prototype properties (#13203) sel = handleObj.selector + " "; if ( matches[ sel ] === undefined ) { matches[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) >= 0 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( matches[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push({ elem: cur, handlers: matches }); } } } } // Add the remaining (directly-bound) handlers if ( delegateCount < handlers.length ) { handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); } return handlerQueue; }, // Includes some event props shared by KeyEvent and MouseEvent props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function( event, original ) { var eventDoc, doc, body, button = original.button; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, copy, type = event.type, originalEvent = event, fixHook = this.fixHooks[ type ]; if ( !fixHook ) { this.fixHooks[ type ] = fixHook = rmouseEvent.test( type ) ? this.mouseHooks : rkeyEvent.test( type ) ? this.keyHooks : {}; } copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = new jQuery.Event( originalEvent ); i = copy.length; while ( i-- ) { prop = copy[ i ]; event[ prop ] = originalEvent[ prop ]; } // Support: Cordova 2.5 (WebKit) (#13255) // All events should have a target; Cordova deviceready doesn't if ( !event.target ) { event.target = document; } // Support: Safari 6.0+, Chrome<28 // Target should not be a text node (#504, #13143) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }, 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() { if ( this !== safeActiveElement() && this.focus ) { this.focus(); return false; } }, delegateType: "focusin" }, blur: { trigger: function() { 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() { if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { this.click(); return false; } }, // For cross-browser consistency, don't fire native .click() on links _default: function( event ) { return jQuery.nodeName( event.target, "a" ); } }, beforeunload: { postDispatch: function( 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; } } } }, simulate: function( type, elem, event, bubble ) { // Piggyback on a donor event to simulate a different one. // Fake originalEvent to avoid donor's stopPropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if ( bubble ) { jQuery.event.trigger( e, null, elem ); } else { jQuery.event.dispatch.call( elem, e ); } if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; jQuery.removeEvent = function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } }; 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<4.0 src.returnValue === false ? returnTrue : returnFalse; // 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 || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, preventDefault: function() { var e = this.originalEvent; this.isDefaultPrevented = returnTrue; if ( e && e.preventDefault ) { e.preventDefault(); } }, stopPropagation: function() { var e = this.originalEvent; this.isPropagationStopped = returnTrue; if ( e && e.stopPropagation ) { e.stopPropagation(); } }, stopImmediatePropagation: function() { var e = this.originalEvent; this.isImmediatePropagationStopped = returnTrue; if ( e && e.stopImmediatePropagation ) { e.stopImmediatePropagation(); } this.stopPropagation(); } }; // Create mouseenter/leave events using mouseover/out and event-time checks // Support: Chrome 15+ jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout", pointerenter: "pointerover", pointerleave: "pointerout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; // For mousenter/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; } }; }); // Support: Firefox, Chrome, Safari // Create "bubbling" focus and blur events if ( !support.focusinBubbles ) { 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( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { var doc = this.ownerDocument || this, attaches = data_priv.access( doc, fix ); if ( !attaches ) { doc.addEventListener( orig, handler, true ); } data_priv.access( doc, fix, ( attaches || 0 ) + 1 ); }, teardown: function() { var doc = this.ownerDocument || this, attaches = data_priv.access( doc, fix ) - 1; if ( !attaches ) { doc.removeEventListener( orig, handler, true ); data_priv.remove( doc, fix ); } else { data_priv.access( doc, fix, attaches ); } } }; }); } jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { var origFn, type; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } 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 this; } if ( one === 1 ) { origFn = fn; fn = function( 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 this.each( function() { jQuery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on( types, selector, data, fn, 1 ); }, off: function( 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 === "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 ); }); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { var elem = this[0]; if ( elem ) { return jQuery.event.trigger( type, data, elem, true ); } } }); var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rhtml = /<|&#?\w+;/, rnoInnerhtml = /<(?:script|style|link)/i, // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptType = /^$|\/(?:java|ecma)script/i, rscriptTypeMasked = /^true\/(.*)/, rcleanScript = /^\s*\s*$/g, // We have to close these tags to support XHTML (#13200) wrapMap = { // Support: IE9 option: [ 1, "" ], thead: [ 1, "", "
" ], col: [ 2, "", "
" ], tr: [ 2, "", "
" ], td: [ 3, "", "
" ], _default: [ 0, "", "" ] }; // Support: IE9 wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; // Support: 1.x compatibility // Manipulating tables requires a tbody function manipulationTarget( elem, content ) { return jQuery.nodeName( elem, "table" ) && jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? elem.getElementsByTagName("tbody")[0] || elem.appendChild( elem.ownerDocument.createElement("tbody") ) : 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 ) { var match = rscriptTypeMasked.exec( elem.type ); if ( match ) { elem.type = match[ 1 ]; } else { elem.removeAttribute("type"); } return elem; } // Mark scripts as having already been evaluated function setGlobalEval( elems, refElements ) { var i = 0, l = elems.length; for ( ; i < l; i++ ) { data_priv.set( elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" ) ); } } 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 ( data_priv.hasData( src ) ) { pdataOld = data_priv.access( src ); pdataCur = data_priv.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 ( data_user.hasData( src ) ) { udataOld = data_user.access( src ); udataCur = jQuery.extend( {}, udataOld ); data_user.set( dest, udataCur ); } } function getAll( context, tag ) { var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) : context.querySelectorAll ? context.querySelectorAll( tag || "*" ) : []; return tag === undefined || tag && jQuery.nodeName( context, tag ) ? jQuery.merge( [ context ], ret ) : ret; } // 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; } } jQuery.extend({ clone: function( 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: http://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; }, buildFragment: function( elems, context, scripts, selection ) { 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 ( jQuery.type( elem ) === "object" ) { // Support: QtWebKit, PhantomJS // 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 ] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[ 2 ]; // Descend through wrappers to the right content j = wrap[ 0 ]; while ( j-- ) { tmp = tmp.lastChild; } // Support: QtWebKit, PhantomJS // 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++ ]) ) { // #4087 - If origin and destination elements are the same, and this is // that element, do not do anything if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { 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; }, cleanData: function( elems ) { var data, elem, type, key, special = jQuery.event.special, i = 0; for ( ; (elem = elems[ i ]) !== undefined; i++ ) { if ( jQuery.acceptData( elem ) ) { key = elem[ data_priv.expando ]; if ( key && (data = data_priv.cache[ key ]) ) { 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 ); } } } if ( data_priv.cache[ key ] ) { // Discard any remaining `private` data delete data_priv.cache[ key ]; } } } // Discard any remaining `user` data delete data_user.cache[ elem[ data_user.expando ] ]; } } }); jQuery.fn.extend({ text: function( 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() { return this.domManip( arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.appendChild( elem ); } }); }, prepend: function() { return this.domManip( 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() { return this.domManip( arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this ); } }); }, after: function() { return this.domManip( arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this.nextSibling ); } }); }, remove: function( selector, keepData /* Internal Use Only */ ) { var elem, elems = selector ? jQuery.filter( selector, this ) : this, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { if ( !keepData && elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem ) ); } if ( elem.parentNode ) { if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { setGlobalEval( getAll( elem, "script" ) ); } elem.parentNode.removeChild( elem ); } } return this; }, empty: function() { 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( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map(function() { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); }); }, html: function( 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 = value.replace( rxhtmlTag, "<$1>" ); 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() { var arg = arguments[ 0 ]; // Make the changes, replacing each context element with the new content this.domManip( arguments, function( elem ) { arg = this.parentNode; jQuery.cleanData( getAll( this ) ); if ( arg ) { arg.replaceChild( elem, this ); } }); // Force removal if there was no new content (e.g., from empty arguments) return arg && (arg.length || arg.nodeType) ? this : this.remove(); }, detach: function( selector ) { return this.remove( selector, true ); }, domManip: function( args, callback ) { // Flatten any nested arrays args = concat.apply( [], args ); var fragment, first, scripts, hasScripts, node, doc, i = 0, l = this.length, set = this, iNoClone = l - 1, value = args[ 0 ], isFunction = jQuery.isFunction( value ); // We can't cloneNode fragments that contain checked, in WebKit if ( isFunction || ( l > 1 && typeof value === "string" && !support.checkClone && rchecked.test( value ) ) ) { return this.each(function( index ) { var self = set.eq( index ); if ( isFunction ) { args[ 0 ] = value.call( this, index, self.html() ); } self.domManip( args, callback ); }); } if ( l ) { fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } if ( first ) { 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: QtWebKit // jQuery.merge because push.apply(_, arraylike) throws jQuery.merge( scripts, getAll( node, "script" ) ); } } callback.call( this[ 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 || "" ) && !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { if ( node.src ) { // Optional AJAX dependency, but won't run scripts if not present if ( jQuery._evalUrl ) { jQuery._evalUrl( node.src ); } } else { jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); } } } } } } return this; } }); 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: QtWebKit // .get() because push.apply(_, arraylike) throws push.apply( ret, elems.get() ); } return this.pushStack( ret ); }; }); var iframe, elemdisplay = {}; /** * Retrieve the actual display of a element * @param {String} name nodeName of the element * @param {Object} doc Document object */ // Called only from within defaultDisplay function actualDisplay( name, doc ) { var style, elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), // getDefaultComputedStyle might be reliably used only on attached element display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? // Use of this method is a temporary fix (more like optimization) until something better comes along, // since it was removed from specification and supported only in FF style.display : jQuery.css( elem[ 0 ], "display" ); // We don't have any data stored on the element, // so use "detach" method as fast way to get rid of the element elem.detach(); return display; } /** * Try to determine the default display value of an element * @param {String} nodeName */ function defaultDisplay( nodeName ) { var doc = document, display = elemdisplay[ nodeName ]; if ( !display ) { display = actualDisplay( nodeName, doc ); // If the simple way fails, read from inside an iframe if ( display === "none" || !display ) { // Use the already-created iframe if possible iframe = (iframe || jQuery( "',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){return e.indexOf(this.index)>-1?(this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1):void 0});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:0>a?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery",g=Boolean(a.fn.mfpFastClick);return b.direction=!0,c&&c.enabled?(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s),h=g?"mfpFastClick":"click";e[h](function(){b.prev()}),f[h](function(){b.next()}),b.isIE7&&(x("b",e[0],!1,!0),x("a",e[0],!1,!0),x("b",f[0],!1,!0),x("a",f[0],!1,!0)),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowLeft&&g&&b.arrowLeft.add(b.arrowRight).destroyMfpFastClick(),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){v.off("touchmove"+f+" touchend"+f)},e="mfpFastClick",f="."+e;a.fn.mfpFastClick=function(e){return a(this).each(function(){var g,h=a(this);if(c){var i,j,k,l,m,n;h.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalEvent?a.originalEvent.touches[0]:a.touches[0],j=m.clientX,k=m.clientY,v.on("touchmove"+f,function(a){m=a.originalEvent?a.originalEvent.touches:a.touches,n=m.length,m=m[0],(Math.abs(m.clientX-j)>10||Math.abs(m.clientY-k)>10)&&(l=!0,d())}).on("touchend"+f,function(a){d(),l||n>1||(g=!0,a.preventDefault(),clearTimeout(i),i=setTimeout(function(){g=!1},b),e())})})}h.on("click"+f,function(){g||e()})})},a.fn.destroyMfpFastClick=function(){a(this).off("touchstart"+f+" click"+f),c&&v.off("touchmove"+f+" touchend"+f)}}(),A()}); /* Source: src/mt-includes/assets/mediaelement/mediaelement-and-player.js*/ /*! * MediaElement.js * http://www.mediaelementjs.com/ * * Wrapper that mimics native HTML5 MediaElement (audio and video) * using a variety of technologies (pure JavaScript, Flash, iframe) * * Copyright 2010-2017, John Dyer (http://j.hn/) * License: MIT * */(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 1 && arguments[1] !== undefined ? arguments[1] : null; if (typeof message === 'string' && message.length) { var str = void 0, pluralForm = void 0; var language = i18n.language(); var _plural = function _plural(input, number, form) { if ((typeof input === 'undefined' ? 'undefined' : _typeof(input)) !== 'object' || typeof number !== 'number' || typeof form !== 'number') { return input; } var _pluralForms = function () { return [function () { return arguments.length <= 1 ? undefined : arguments[1]; }, function () { return (arguments.length <= 0 ? undefined : arguments[0]) === 1 ? arguments.length <= 1 ? undefined : arguments[1] : arguments.length <= 2 ? undefined : arguments[2]; }, function () { return (arguments.length <= 0 ? undefined : arguments[0]) === 0 || (arguments.length <= 0 ? undefined : arguments[0]) === 1 ? arguments.length <= 1 ? undefined : arguments[1] : arguments.length <= 2 ? undefined : arguments[2]; }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 !== 11) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) !== 0) { return arguments.length <= 2 ? undefined : arguments[2]; } else { return arguments.length <= 3 ? undefined : arguments[3]; } }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) === 1 || (arguments.length <= 0 ? undefined : arguments[0]) === 11) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2 || (arguments.length <= 0 ? undefined : arguments[0]) === 12) { return arguments.length <= 2 ? undefined : arguments[2]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) > 2 && (arguments.length <= 0 ? undefined : arguments[0]) < 20) { return arguments.length <= 3 ? undefined : arguments[3]; } else { return arguments.length <= 4 ? undefined : arguments[4]; } }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 0 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 > 0 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 < 20) { return arguments.length <= 2 ? undefined : arguments[2]; } else { return arguments.length <= 3 ? undefined : arguments[3]; } }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 !== 11) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 >= 2 && ((arguments.length <= 0 ? undefined : arguments[0]) % 100 < 10 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 20)) { return arguments.length <= 2 ? undefined : arguments[2]; } else { return [3]; } }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 !== 11) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 >= 2 && (arguments.length <= 0 ? undefined : arguments[0]) % 10 <= 4 && ((arguments.length <= 0 ? undefined : arguments[0]) % 100 < 10 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 20)) { return arguments.length <= 2 ? undefined : arguments[2]; } else { return arguments.length <= 3 ? undefined : arguments[3]; } }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) >= 2 && (arguments.length <= 0 ? undefined : arguments[0]) <= 4) { return arguments.length <= 2 ? undefined : arguments[2]; } else { return arguments.length <= 3 ? undefined : arguments[3]; } }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 >= 2 && (arguments.length <= 0 ? undefined : arguments[0]) % 10 <= 4 && ((arguments.length <= 0 ? undefined : arguments[0]) % 100 < 10 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 20)) { return arguments.length <= 2 ? undefined : arguments[2]; } else { return arguments.length <= 3 ? undefined : arguments[3]; } }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 === 1) { return arguments.length <= 2 ? undefined : arguments[2]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 === 2) { return arguments.length <= 3 ? undefined : arguments[3]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 === 3 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 === 4) { return arguments.length <= 4 ? undefined : arguments[4]; } else { return arguments.length <= 1 ? undefined : arguments[1]; } }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2) { return arguments.length <= 2 ? undefined : arguments[2]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) > 2 && (arguments.length <= 0 ? undefined : arguments[0]) < 7) { return arguments.length <= 3 ? undefined : arguments[3]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) > 6 && (arguments.length <= 0 ? undefined : arguments[0]) < 11) { return arguments.length <= 4 ? undefined : arguments[4]; } else { return arguments.length <= 5 ? undefined : arguments[5]; } }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) === 0) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { return arguments.length <= 2 ? undefined : arguments[2]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2) { return arguments.length <= 3 ? undefined : arguments[3]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 3 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 <= 10) { return arguments.length <= 4 ? undefined : arguments[4]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 11) { return arguments.length <= 5 ? undefined : arguments[5]; } else { return arguments.length <= 6 ? undefined : arguments[6]; } }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 0 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 > 1 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 < 11) { return arguments.length <= 2 ? undefined : arguments[2]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 > 10 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 < 20) { return arguments.length <= 3 ? undefined : arguments[3]; } else { return arguments.length <= 4 ? undefined : arguments[4]; } }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 2) { return arguments.length <= 2 ? undefined : arguments[2]; } else { return arguments.length <= 3 ? undefined : arguments[3]; } }, function () { return (arguments.length <= 0 ? undefined : arguments[0]) !== 11 && (arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1 ? arguments.length <= 1 ? undefined : arguments[1] : arguments.length <= 2 ? undefined : arguments[2]; }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 >= 2 && (arguments.length <= 0 ? undefined : arguments[0]) % 10 <= 4 && ((arguments.length <= 0 ? undefined : arguments[0]) % 100 < 10 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 20)) { return arguments.length <= 2 ? undefined : arguments[2]; } else { return arguments.length <= 3 ? undefined : arguments[3]; } }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2) { return arguments.length <= 2 ? undefined : arguments[2]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) !== 8 && (arguments.length <= 0 ? undefined : arguments[0]) !== 11) { return arguments.length <= 3 ? undefined : arguments[3]; } else { return arguments.length <= 4 ? undefined : arguments[4]; } }, function () { return (arguments.length <= 0 ? undefined : arguments[0]) === 0 ? arguments.length <= 1 ? undefined : arguments[1] : arguments.length <= 2 ? undefined : arguments[2]; }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2) { return arguments.length <= 2 ? undefined : arguments[2]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 3) { return arguments.length <= 3 ? undefined : arguments[3]; } else { return arguments.length <= 4 ? undefined : arguments[4]; } }, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) === 0) { return arguments.length <= 1 ? undefined : arguments[1]; } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { return arguments.length <= 2 ? undefined : arguments[2]; } else { return arguments.length <= 3 ? undefined : arguments[3]; } }]; }(); return _pluralForms[form].apply(null, [number].concat(input)); }; if (i18n[language] !== undefined) { str = i18n[language][message]; if (pluralParam !== null && typeof pluralParam === 'number') { pluralForm = i18n[language]['mejs.plural-form']; str = _plural.apply(null, [str, pluralParam, pluralForm]); } } if (!str && i18n.en) { str = i18n.en[message]; if (pluralParam !== null && typeof pluralParam === 'number') { pluralForm = i18n.en['mejs.plural-form']; str = _plural.apply(null, [str, pluralParam, pluralForm]); } } str = str || message; if (pluralParam !== null && typeof pluralParam === 'number') { str = str.replace('%1', pluralParam); } return (0, _general.escapeHTML)(str); } return message; }; _mejs2.default.i18n = i18n; if (typeof mejsL10n !== 'undefined') { _mejs2.default.i18n.language(mejsL10n.language, mejsL10n.strings); } exports.default = i18n; },{"15":15,"27":27,"7":7}],6:[function(_dereq_,module,exports){ '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 _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); var _general = _dereq_(27); var _media2 = _dereq_(28); var _renderer = _dereq_(8); var _constants = _dereq_(25); 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"); } } var MediaElement = function MediaElement(idOrNode, options, sources) { var _this = this; _classCallCheck(this, MediaElement); var t = this; sources = Array.isArray(sources) ? sources : null; t.defaults = { renderers: [], fakeNodeName: 'mediaelementwrapper', pluginPath: 'build/', shimScriptAccess: 'sameDomain' }; options = Object.assign(t.defaults, options); t.mediaElement = _document2.default.createElement(options.fakeNodeName); var id = idOrNode, error = false; if (typeof idOrNode === 'string') { t.mediaElement.originalNode = _document2.default.getElementById(idOrNode); } else { t.mediaElement.originalNode = idOrNode; id = idOrNode.id; } if (t.mediaElement.originalNode === undefined || t.mediaElement.originalNode === null) { return null; } t.mediaElement.options = options; id = id || 'mejs_' + Math.random().toString().slice(2); t.mediaElement.originalNode.setAttribute('id', id + '_from_mejs'); var tagName = t.mediaElement.originalNode.tagName.toLowerCase(); if (['video', 'audio'].indexOf(tagName) > -1 && !t.mediaElement.originalNode.getAttribute('preload')) { t.mediaElement.originalNode.setAttribute('preload', 'none'); } t.mediaElement.originalNode.parentNode.insertBefore(t.mediaElement, t.mediaElement.originalNode); t.mediaElement.appendChild(t.mediaElement.originalNode); var processURL = function processURL(url, type) { if (_window2.default.location.protocol === 'https:' && url.indexOf('http:') === 0 && _constants.IS_IOS && _mejs2.default.html5media.mediaTypes.indexOf(type) > -1) { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (this.readyState === 4 && this.status === 200) { var _url = _window2.default.URL || _window2.default.webkitURL, blobUrl = _url.createObjectURL(this.response); t.mediaElement.originalNode.setAttribute('src', blobUrl); return blobUrl; } return url; }; xhr.open('GET', url); xhr.responseType = 'blob'; xhr.send(); } return url; }; var mediaFiles = void 0; if (sources !== null) { mediaFiles = sources; } else if (t.mediaElement.originalNode !== null) { mediaFiles = []; switch (t.mediaElement.originalNode.nodeName.toLowerCase()) { case 'iframe': mediaFiles.push({ type: '', src: t.mediaElement.originalNode.getAttribute('src') }); break; case 'audio': case 'video': var _sources = t.mediaElement.originalNode.children.length, nodeSource = t.mediaElement.originalNode.getAttribute('src'); if (nodeSource) { var node = t.mediaElement.originalNode, type = (0, _media2.formatType)(nodeSource, node.getAttribute('type')); mediaFiles.push({ type: type, src: processURL(nodeSource, type) }); } for (var i = 0; i < _sources; i++) { var n = t.mediaElement.originalNode.children[i]; if (n.tagName.toLowerCase() === 'source') { var src = n.getAttribute('src'), _type = (0, _media2.formatType)(src, n.getAttribute('type')); mediaFiles.push({ type: _type, src: processURL(src, _type) }); } } break; } } t.mediaElement.id = id; t.mediaElement.renderers = {}; t.mediaElement.events = {}; t.mediaElement.promises = []; t.mediaElement.renderer = null; t.mediaElement.rendererName = null; t.mediaElement.changeRenderer = function (rendererName, mediaFiles) { var t = _this, media = Object.keys(mediaFiles[0]).length > 2 ? mediaFiles[0] : mediaFiles[0].src; if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && t.mediaElement.renderer.name === rendererName) { t.mediaElement.renderer.pause(); if (t.mediaElement.renderer.stop) { t.mediaElement.renderer.stop(); } t.mediaElement.renderer.show(); t.mediaElement.renderer.setSrc(media); return true; } if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null) { t.mediaElement.renderer.pause(); if (t.mediaElement.renderer.stop) { t.mediaElement.renderer.stop(); } t.mediaElement.renderer.hide(); } var newRenderer = t.mediaElement.renderers[rendererName], newRendererType = null; if (newRenderer !== undefined && newRenderer !== null) { newRenderer.show(); newRenderer.setSrc(media); t.mediaElement.renderer = newRenderer; t.mediaElement.rendererName = rendererName; return true; } var rendererArray = t.mediaElement.options.renderers.length ? t.mediaElement.options.renderers : _renderer.renderer.order; for (var _i = 0, total = rendererArray.length; _i < total; _i++) { var index = rendererArray[_i]; if (index === rendererName) { var rendererList = _renderer.renderer.renderers; newRendererType = rendererList[index]; var renderOptions = Object.assign(newRendererType.options, t.mediaElement.options); newRenderer = newRendererType.create(t.mediaElement, renderOptions, mediaFiles); newRenderer.name = rendererName; t.mediaElement.renderers[newRendererType.name] = newRenderer; t.mediaElement.renderer = newRenderer; t.mediaElement.rendererName = rendererName; newRenderer.show(); return true; } } return false; }; t.mediaElement.setSize = function (width, height) { if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null) { t.mediaElement.renderer.setSize(width, height); } }; t.mediaElement.generateError = function (message, urlList) { message = message || ''; urlList = Array.isArray(urlList) ? urlList : []; var event = (0, _general.createEvent)('error', t.mediaElement); event.message = message; event.urls = urlList; t.mediaElement.dispatchEvent(event); error = true; }; var props = _mejs2.default.html5media.properties, methods = _mejs2.default.html5media.methods, addProperty = function addProperty(obj, name, onGet, onSet) { var oldValue = obj[name]; var getFn = function getFn() { return onGet.apply(obj, [oldValue]); }, setFn = function setFn(newValue) { oldValue = onSet.apply(obj, [newValue]); return oldValue; }; Object.defineProperty(obj, name, { get: getFn, set: setFn }); }, assignGettersSetters = function assignGettersSetters(propName) { if (propName !== 'src') { var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1), getFn = function getFn() { return t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && typeof t.mediaElement.renderer['get' + capName] === 'function' ? t.mediaElement.renderer['get' + capName]() : null; }, setFn = function setFn(value) { if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && typeof t.mediaElement.renderer['set' + capName] === 'function') { t.mediaElement.renderer['set' + capName](value); } }; addProperty(t.mediaElement, propName, getFn, setFn); t.mediaElement['get' + capName] = getFn; t.mediaElement['set' + capName] = setFn; } }, getSrc = function getSrc() { return t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null ? t.mediaElement.renderer.getSrc() : null; }, setSrc = function setSrc(value) { var mediaFiles = []; if (typeof value === 'string') { mediaFiles.push({ src: value, type: value ? (0, _media2.getTypeFromFile)(value) : '' }); } else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src !== undefined) { var _src = (0, _media2.absolutizeUrl)(value.src), _type2 = value.type, media = Object.assign(value, { src: _src, type: (_type2 === '' || _type2 === null || _type2 === undefined) && _src ? (0, _media2.getTypeFromFile)(_src) : _type2 }); mediaFiles.push(media); } else if (Array.isArray(value)) { for (var _i2 = 0, total = value.length; _i2 < total; _i2++) { var _src2 = (0, _media2.absolutizeUrl)(value[_i2].src), _type3 = value[_i2].type, _media = Object.assign(value[_i2], { src: _src2, type: (_type3 === '' || _type3 === null || _type3 === undefined) && _src2 ? (0, _media2.getTypeFromFile)(_src2) : _type3 }); mediaFiles.push(_media); } } var renderInfo = _renderer.renderer.select(mediaFiles, t.mediaElement.options.renderers.length ? t.mediaElement.options.renderers : []), event = void 0; if (!t.mediaElement.paused) { t.mediaElement.pause(); event = (0, _general.createEvent)('pause', t.mediaElement); t.mediaElement.dispatchEvent(event); } t.mediaElement.originalNode.src = mediaFiles[0].src || ''; if (renderInfo === null && mediaFiles[0].src) { t.mediaElement.generateError('No renderer found', mediaFiles); return; } return mediaFiles[0].src ? t.mediaElement.changeRenderer(renderInfo.rendererName, mediaFiles) : null; }, triggerAction = function triggerAction(methodName, args) { try { if (methodName === 'play' && t.mediaElement.rendererName === 'native_dash') { var response = t.mediaElement.renderer[methodName](args); if (response && typeof response.then === 'function') { response.catch(function () { if (t.mediaElement.paused) { setTimeout(function () { var tmpResponse = t.mediaElement.renderer.play(); if (tmpResponse !== undefined) { tmpResponse.catch(function () { if (!t.mediaElement.renderer.paused) { t.mediaElement.renderer.pause(); } }); } }, 150); } }); } } else { t.mediaElement.renderer[methodName](args); } } catch (e) { t.mediaElement.generateError(e, mediaFiles); } }, assignMethods = function assignMethods(methodName) { t.mediaElement[methodName] = function () { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && typeof t.mediaElement.renderer[methodName] === 'function') { if (t.mediaElement.promises.length) { Promise.all(t.mediaElement.promises).then(function () { triggerAction(methodName, args); }).catch(function (e) { t.mediaElement.generateError(e, mediaFiles); }); } else { triggerAction(methodName, args); } } return null; }; }; addProperty(t.mediaElement, 'src', getSrc, setSrc); t.mediaElement.getSrc = getSrc; t.mediaElement.setSrc = setSrc; for (var _i3 = 0, total = props.length; _i3 < total; _i3++) { assignGettersSetters(props[_i3]); } for (var _i4 = 0, _total = methods.length; _i4 < _total; _i4++) { assignMethods(methods[_i4]); } t.mediaElement.addEventListener = function (eventName, callback) { t.mediaElement.events[eventName] = t.mediaElement.events[eventName] || []; t.mediaElement.events[eventName].push(callback); }; t.mediaElement.removeEventListener = function (eventName, callback) { if (!eventName) { t.mediaElement.events = {}; return true; } var callbacks = t.mediaElement.events[eventName]; if (!callbacks) { return true; } if (!callback) { t.mediaElement.events[eventName] = []; return true; } for (var _i5 = 0; _i5 < callbacks.length; _i5++) { if (callbacks[_i5] === callback) { t.mediaElement.events[eventName].splice(_i5, 1); return true; } } return false; }; t.mediaElement.dispatchEvent = function (event) { var callbacks = t.mediaElement.events[event.type]; if (callbacks) { for (var _i6 = 0; _i6 < callbacks.length; _i6++) { callbacks[_i6].apply(null, [event]); } } }; t.mediaElement.destroy = function () { var mediaElement = t.mediaElement.originalNode.cloneNode(true); var wrapper = t.mediaElement.parentElement; mediaElement.removeAttribute('id'); mediaElement.remove(); t.mediaElement.remove(); wrapper.append(mediaElement); }; if (mediaFiles.length) { t.mediaElement.src = mediaFiles; } if (t.mediaElement.promises.length) { Promise.all(t.mediaElement.promises).then(function () { if (t.mediaElement.options.success) { t.mediaElement.options.success(t.mediaElement, t.mediaElement.originalNode); } }).catch(function () { if (error && t.mediaElement.options.error) { t.mediaElement.options.error(t.mediaElement, t.mediaElement.originalNode); } }); } else { if (t.mediaElement.options.success) { t.mediaElement.options.success(t.mediaElement, t.mediaElement.originalNode); } if (error && t.mediaElement.options.error) { t.mediaElement.options.error(t.mediaElement, t.mediaElement.originalNode); } } return t.mediaElement; }; _window2.default.MediaElement = MediaElement; _mejs2.default.MediaElement = MediaElement; exports.default = MediaElement; },{"2":2,"25":25,"27":27,"28":28,"3":3,"7":7,"8":8}],7:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var mejs = {}; mejs.version = '4.2.9'; mejs.html5media = { properties: ['volume', 'src', 'currentTime', 'muted', 'duration', 'paused', 'ended', 'buffered', 'error', 'networkState', 'readyState', 'seeking', 'seekable', 'currentSrc', 'preload', 'bufferedBytes', 'bufferedTime', 'initialTime', 'startOffsetTime', 'defaultPlaybackRate', 'playbackRate', 'played', 'autoplay', 'loop', 'controls'], readOnlyProperties: ['duration', 'paused', 'ended', 'buffered', 'error', 'networkState', 'readyState', 'seeking', 'seekable'], methods: ['load', 'play', 'pause', 'canPlayType'], events: ['loadstart', 'durationchange', 'loadedmetadata', 'loadeddata', 'progress', 'canplay', 'canplaythrough', 'suspend', 'abort', 'error', 'emptied', 'stalled', 'play', 'playing', 'pause', 'waiting', 'seeking', 'seeked', 'timeupdate', 'ended', 'ratechange', 'volumechange'], mediaTypes: ['audio/mp3', 'audio/ogg', 'audio/oga', 'audio/wav', 'audio/x-wav', 'audio/wave', 'audio/x-pn-wav', 'audio/mpeg', 'audio/mp4', 'video/mp4', 'video/webm', 'video/ogg', 'video/ogv'] }; _window2.default.mejs = mejs; exports.default = mejs; },{"3":3}],8:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.renderer = undefined; 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; }; }(); var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); 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"); } } var Renderer = function () { function Renderer() { _classCallCheck(this, Renderer); this.renderers = {}; this.order = []; } _createClass(Renderer, [{ key: 'add', value: function add(renderer) { if (renderer.name === undefined) { throw new TypeError('renderer must contain at least `name` property'); } this.renderers[renderer.name] = renderer; this.order.push(renderer.name); } }, { key: 'select', value: function select(mediaFiles) { var renderers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; var renderersLength = renderers.length; renderers = renderers.length ? renderers : this.order; if (!renderersLength) { var rendererIndicator = [/^(html5|native)/i, /^flash/i, /iframe$/i], rendererRanking = function rendererRanking(renderer) { for (var i = 0, total = rendererIndicator.length; i < total; i++) { if (rendererIndicator[i].test(renderer)) { return i; } } return rendererIndicator.length; }; renderers.sort(function (a, b) { return rendererRanking(a) - rendererRanking(b); }); } for (var i = 0, total = renderers.length; i < total; i++) { var key = renderers[i], _renderer = this.renderers[key]; if (_renderer !== null && _renderer !== undefined) { for (var j = 0, jl = mediaFiles.length; j < jl; j++) { if (typeof _renderer.canPlayType === 'function' && typeof mediaFiles[j].type === 'string' && _renderer.canPlayType(mediaFiles[j].type)) { return { rendererName: _renderer.name, src: mediaFiles[j].src }; } } } } return null; } }, { key: 'order', set: function set(order) { if (!Array.isArray(order)) { throw new TypeError('order must be an array of strings.'); } this._order = order; }, get: function get() { return this._order; } }, { key: 'renderers', set: function set(renderers) { if (renderers !== null && (typeof renderers === 'undefined' ? 'undefined' : _typeof(renderers)) !== 'object') { throw new TypeError('renderers must be an array of objects.'); } this._renderers = renderers; }, get: function get() { return this._renderers; } }]); return Renderer; }(); var renderer = exports.renderer = new Renderer(); _mejs2.default.Renderers = renderer; },{"7":7}],9:[function(_dereq_,module,exports){ 'use strict'; var _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _i18n = _dereq_(5); var _i18n2 = _interopRequireDefault(_i18n); var _player = _dereq_(16); var _player2 = _interopRequireDefault(_player); var _constants = _dereq_(25); var Features = _interopRequireWildcard(_constants); var _general = _dereq_(27); var _dom = _dereq_(26); var _media = _dereq_(28); 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 }; } Object.assign(_player.config, { usePluginFullScreen: true, fullscreenText: null, useFakeFullscreen: false }); Object.assign(_player2.default.prototype, { isFullScreen: false, isNativeFullScreen: false, isInIframe: false, isPluginClickThroughCreated: false, fullscreenMode: '', containerSizeTimeout: null, buildfullscreen: function buildfullscreen(player) { if (!player.isVideo) { return; } player.isInIframe = _window2.default.location !== _window2.default.parent.location; player.detectFullscreenMode(); var t = this, fullscreenTitle = (0, _general.isString)(t.options.fullscreenText) ? t.options.fullscreenText : _i18n2.default.t('mejs.fullscreen'), fullscreenBtn = _document2.default.createElement('div'); fullscreenBtn.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'fullscreen-button'; fullscreenBtn.innerHTML = ''; t.addControlElement(fullscreenBtn, 'fullscreen'); fullscreenBtn.addEventListener('click', function () { var isFullScreen = Features.HAS_TRUE_NATIVE_FULLSCREEN && Features.IS_FULLSCREEN || player.isFullScreen; if (isFullScreen) { player.exitFullScreen(); } else { player.enterFullScreen(); } }); player.fullscreenBtn = fullscreenBtn; t.options.keyActions.push({ keys: [70], action: function action(player, media, key, event) { if (!event.ctrlKey) { if (typeof player.enterFullScreen !== 'undefined') { if (player.isFullScreen) { player.exitFullScreen(); } else { player.enterFullScreen(); } } } } }); t.exitFullscreenCallback = function (e) { var key = e.which || e.keyCode || 0; if (t.options.enableKeyboard && key === 27 && (Features.HAS_TRUE_NATIVE_FULLSCREEN && Features.IS_FULLSCREEN || t.isFullScreen)) { player.exitFullScreen(); } }; t.globalBind('keydown', t.exitFullscreenCallback); t.normalHeight = 0; t.normalWidth = 0; if (Features.HAS_TRUE_NATIVE_FULLSCREEN) { var fullscreenChanged = function fullscreenChanged() { if (player.isFullScreen) { if (Features.isFullScreen()) { player.isNativeFullScreen = true; player.setControlsSize(); } else { player.isNativeFullScreen = false; player.exitFullScreen(); } } }; player.globalBind(Features.FULLSCREEN_EVENT_NAME, fullscreenChanged); } }, cleanfullscreen: function cleanfullscreen(player) { player.exitFullScreen(); player.globalUnbind('keydown', player.exitFullscreenCallback); }, detectFullscreenMode: function detectFullscreenMode() { var t = this, isNative = t.media.rendererName !== null && /(native|html5)/i.test(t.media.rendererName); var mode = ''; if (Features.HAS_TRUE_NATIVE_FULLSCREEN && isNative) { mode = 'native-native'; } else if (Features.HAS_TRUE_NATIVE_FULLSCREEN && !isNative) { mode = 'plugin-native'; } else if (t.usePluginFullScreen && Features.SUPPORT_POINTER_EVENTS) { mode = 'plugin-click'; } t.fullscreenMode = mode; return mode; }, enterFullScreen: function enterFullScreen() { var t = this, isNative = t.media.rendererName !== null && /(html5|native)/i.test(t.media.rendererName), containerStyles = getComputedStyle(t.getElement(t.container)); if (!t.isVideo) { return; } if (t.options.useFakeFullscreen === false && Features.IS_IOS && Features.HAS_IOS_FULLSCREEN && typeof t.media.originalNode.webkitEnterFullscreen === 'function' && t.media.originalNode.canPlayType((0, _media.getTypeFromFile)(t.media.getSrc()))) { t.media.originalNode.webkitEnterFullscreen(); return; } (0, _dom.addClass)(_document2.default.documentElement, t.options.classPrefix + 'fullscreen'); (0, _dom.addClass)(t.getElement(t.container), t.options.classPrefix + 'container-fullscreen'); t.normalHeight = parseFloat(containerStyles.height); t.normalWidth = parseFloat(containerStyles.width); if (t.fullscreenMode === 'native-native' || t.fullscreenMode === 'plugin-native') { Features.requestFullScreen(t.getElement(t.container)); if (t.isInIframe) { setTimeout(function checkFullscreen() { if (t.isNativeFullScreen) { var percentErrorMargin = 0.002, windowWidth = _window2.default.innerWidth || _document2.default.documentElement.clientWidth || _document2.default.body.clientWidth, screenWidth = screen.width, absDiff = Math.abs(screenWidth - windowWidth), marginError = screenWidth * percentErrorMargin; if (absDiff > marginError) { t.exitFullScreen(); } else { setTimeout(checkFullscreen, 500); } } }, 1000); } } t.getElement(t.container).style.width = '100%'; t.getElement(t.container).style.height = '100%'; t.containerSizeTimeout = setTimeout(function () { t.getElement(t.container).style.width = '100%'; t.getElement(t.container).style.height = '100%'; t.setControlsSize(); }, 500); if (isNative) { t.node.style.width = '100%'; t.node.style.height = '100%'; } else { var elements = t.getElement(t.container).querySelectorAll('embed, object, video'), _total = elements.length; for (var i = 0; i < _total; i++) { elements[i].style.width = '100%'; elements[i].style.height = '100%'; } } if (t.options.setDimensions && typeof t.media.setSize === 'function') { t.media.setSize(screen.width, screen.height); } var layers = t.getElement(t.layers).children, total = layers.length; for (var _i = 0; _i < total; _i++) { layers[_i].style.width = '100%'; layers[_i].style.height = '100%'; } if (t.fullscreenBtn) { (0, _dom.removeClass)(t.fullscreenBtn, t.options.classPrefix + 'fullscreen'); (0, _dom.addClass)(t.fullscreenBtn, t.options.classPrefix + 'unfullscreen'); } t.setControlsSize(); t.isFullScreen = true; var zoomFactor = Math.min(screen.width / t.width, screen.height / t.height), captionText = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-text'); if (captionText) { captionText.style.fontSize = zoomFactor * 100 + '%'; captionText.style.lineHeight = 'normal'; t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-position').style.bottom = (screen.height - t.normalHeight) / 2 - t.getElement(t.controls).offsetHeight / 2 + zoomFactor + 15 + 'px'; } var event = (0, _general.createEvent)('enteredfullscreen', t.getElement(t.container)); t.getElement(t.container).dispatchEvent(event); }, exitFullScreen: function exitFullScreen() { var t = this, isNative = t.media.rendererName !== null && /(native|html5)/i.test(t.media.rendererName); if (!t.isVideo) { return; } clearTimeout(t.containerSizeTimeout); if (Features.HAS_TRUE_NATIVE_FULLSCREEN && (Features.IS_FULLSCREEN || t.isFullScreen)) { Features.cancelFullScreen(); } (0, _dom.removeClass)(_document2.default.documentElement, t.options.classPrefix + 'fullscreen'); (0, _dom.removeClass)(t.getElement(t.container), t.options.classPrefix + 'container-fullscreen'); if (t.options.setDimensions) { t.getElement(t.container).style.width = t.normalWidth + 'px'; t.getElement(t.container).style.height = t.normalHeight + 'px'; if (isNative) { t.node.style.width = t.normalWidth + 'px'; t.node.style.height = t.normalHeight + 'px'; } else { var elements = t.getElement(t.container).querySelectorAll('embed, object, video'), _total2 = elements.length; for (var i = 0; i < _total2; i++) { elements[i].style.width = t.normalWidth + 'px'; elements[i].style.height = t.normalHeight + 'px'; } } if (typeof t.media.setSize === 'function') { t.media.setSize(t.normalWidth, t.normalHeight); } var layers = t.getElement(t.layers).children, total = layers.length; for (var _i2 = 0; _i2 < total; _i2++) { layers[_i2].style.width = t.normalWidth + 'px'; layers[_i2].style.height = t.normalHeight + 'px'; } } if (t.fullscreenBtn) { (0, _dom.removeClass)(t.fullscreenBtn, t.options.classPrefix + 'unfullscreen'); (0, _dom.addClass)(t.fullscreenBtn, t.options.classPrefix + 'fullscreen'); } t.setControlsSize(); t.isFullScreen = false; var captionText = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-text'); if (captionText) { captionText.style.fontSize = ''; captionText.style.lineHeight = ''; t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-position').style.bottom = ''; } var event = (0, _general.createEvent)('exitedfullscreen', t.getElement(t.container)); t.getElement(t.container).dispatchEvent(event); } }); },{"16":16,"2":2,"25":25,"26":26,"27":27,"28":28,"3":3,"5":5}],10:[function(_dereq_,module,exports){ 'use strict'; var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _player = _dereq_(16); var _player2 = _interopRequireDefault(_player); var _i18n = _dereq_(5); var _i18n2 = _interopRequireDefault(_i18n); var _general = _dereq_(27); var _dom = _dereq_(26); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } Object.assign(_player.config, { playText: null, pauseText: null }); Object.assign(_player2.default.prototype, { buildplaypause: function buildplaypause(player, controls, layers, media) { var t = this, op = t.options, playTitle = (0, _general.isString)(op.playText) ? op.playText : _i18n2.default.t('mejs.play'), pauseTitle = (0, _general.isString)(op.pauseText) ? op.pauseText : _i18n2.default.t('mejs.pause'), play = _document2.default.createElement('div'); play.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'playpause-button ' + t.options.classPrefix + 'play'; play.innerHTML = ''; play.addEventListener('click', function () { if (t.paused) { t.play(); } else { t.pause(); } }); var playBtn = play.querySelector('button'); t.addControlElement(play, 'playpause'); function togglePlayPause(which) { if ('play' === which) { (0, _dom.removeClass)(play, t.options.classPrefix + 'play'); (0, _dom.removeClass)(play, t.options.classPrefix + 'replay'); (0, _dom.addClass)(play, t.options.classPrefix + 'pause'); playBtn.setAttribute('title', pauseTitle); playBtn.setAttribute('aria-label', pauseTitle); } else { (0, _dom.removeClass)(play, t.options.classPrefix + 'pause'); (0, _dom.removeClass)(play, t.options.classPrefix + 'replay'); (0, _dom.addClass)(play, t.options.classPrefix + 'play'); playBtn.setAttribute('title', playTitle); playBtn.setAttribute('aria-label', playTitle); } } togglePlayPause('pse'); media.addEventListener('loadedmetadata', function () { if (media.rendererName.indexOf('flash') === -1) { togglePlayPause('pse'); } }); media.addEventListener('play', function () { togglePlayPause('play'); }); media.addEventListener('playing', function () { togglePlayPause('play'); }); media.addEventListener('pause', function () { togglePlayPause('pse'); }); media.addEventListener('ended', function () { if (!player.options.loop) { (0, _dom.removeClass)(play, t.options.classPrefix + 'pause'); (0, _dom.removeClass)(play, t.options.classPrefix + 'play'); (0, _dom.addClass)(play, t.options.classPrefix + 'replay'); playBtn.setAttribute('title', playTitle); playBtn.setAttribute('aria-label', playTitle); } }); } }); },{"16":16,"2":2,"26":26,"27":27,"5":5}],11:[function(_dereq_,module,exports){ 'use strict'; var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _player = _dereq_(16); var _player2 = _interopRequireDefault(_player); var _i18n = _dereq_(5); var _i18n2 = _interopRequireDefault(_i18n); var _constants = _dereq_(25); var _time = _dereq_(30); var _dom = _dereq_(26); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } Object.assign(_player.config, { enableProgressTooltip: true, useSmoothHover: true, forceLive: false }); Object.assign(_player2.default.prototype, { buildprogress: function buildprogress(player, controls, layers, media) { var lastKeyPressTime = 0, mouseIsDown = false, startedPaused = false; var t = this, autoRewindInitial = player.options.autoRewind, tooltip = player.options.enableProgressTooltip ? '' + ('00:00') + ('') + '' : '', rail = _document2.default.createElement('div'); rail.className = t.options.classPrefix + 'time-rail'; rail.innerHTML = '' + ('') + ('') + ('') + ('') + ('') + ('' + tooltip) + ''; t.addControlElement(rail, 'progress'); t.options.keyActions.push({ keys: [37, 227], action: function action(player) { if (!isNaN(player.duration) && player.duration > 0) { if (player.isVideo) { player.showControls(); player.startControlsTimer(); } player.getElement(player.container).querySelector('.' + _player.config.classPrefix + 'time-total').focus(); var newTime = Math.max(player.currentTime - player.options.defaultSeekBackwardInterval(player), 0); player.setCurrentTime(newTime); } } }, { keys: [39, 228], action: function action(player) { if (!isNaN(player.duration) && player.duration > 0) { if (player.isVideo) { player.showControls(); player.startControlsTimer(); } player.getElement(player.container).querySelector('.' + _player.config.classPrefix + 'time-total').focus(); var newTime = Math.min(player.currentTime + player.options.defaultSeekForwardInterval(player), player.duration); player.setCurrentTime(newTime); } } }); t.rail = controls.querySelector('.' + t.options.classPrefix + 'time-rail'); t.total = controls.querySelector('.' + t.options.classPrefix + 'time-total'); t.loaded = controls.querySelector('.' + t.options.classPrefix + 'time-loaded'); t.current = controls.querySelector('.' + t.options.classPrefix + 'time-current'); t.handle = controls.querySelector('.' + t.options.classPrefix + 'time-handle'); t.timefloat = controls.querySelector('.' + t.options.classPrefix + 'time-float'); t.timefloatcurrent = controls.querySelector('.' + t.options.classPrefix + 'time-float-current'); t.slider = controls.querySelector('.' + t.options.classPrefix + 'time-slider'); t.hovered = controls.querySelector('.' + t.options.classPrefix + 'time-hovered'); t.buffer = controls.querySelector('.' + t.options.classPrefix + 'time-buffering'); t.newTime = 0; t.forcedHandlePause = false; t.setTransformStyle = function (element, value) { element.style.transform = value; element.style.webkitTransform = value; element.style.MozTransform = value; element.style.msTransform = value; element.style.OTransform = value; }; t.buffer.style.display = 'none'; var handleMouseMove = function handleMouseMove(e) { var totalStyles = getComputedStyle(t.total), offsetStyles = (0, _dom.offset)(t.total), width = t.total.offsetWidth, transform = function () { if (totalStyles.webkitTransform !== undefined) { return 'webkitTransform'; } else if (totalStyles.mozTransform !== undefined) { return 'mozTransform '; } else if (totalStyles.oTransform !== undefined) { return 'oTransform'; } else if (totalStyles.msTransform !== undefined) { return 'msTransform'; } else { return 'transform'; } }(), cssMatrix = function () { if ('WebKitCSSMatrix' in window) { return 'WebKitCSSMatrix'; } else if ('MSCSSMatrix' in window) { return 'MSCSSMatrix'; } else if ('CSSMatrix' in window) { return 'CSSMatrix'; } }(); var percentage = 0, leftPos = 0, pos = 0, x = void 0; if (e.originalEvent && e.originalEvent.changedTouches) { x = e.originalEvent.changedTouches[0].pageX; } else if (e.changedTouches) { x = e.changedTouches[0].pageX; } else { x = e.pageX; } if (t.getDuration()) { if (x < offsetStyles.left) { x = offsetStyles.left; } else if (x > width + offsetStyles.left) { x = width + offsetStyles.left; } pos = x - offsetStyles.left; percentage = pos / width; t.newTime = percentage <= 0.02 ? 0 : percentage * t.getDuration(); if (mouseIsDown && t.getCurrentTime() !== null && t.newTime.toFixed(4) !== t.getCurrentTime().toFixed(4)) { t.setCurrentRailHandle(t.newTime); t.updateCurrent(t.newTime); } if (!_constants.IS_IOS && !_constants.IS_ANDROID) { if (pos < 0) { pos = 0; } if (t.options.useSmoothHover && cssMatrix !== null && typeof window[cssMatrix] !== 'undefined') { var matrix = new window[cssMatrix](getComputedStyle(t.handle)[transform]), handleLocation = matrix.m41, hoverScaleX = pos / parseFloat(getComputedStyle(t.total).width) - handleLocation / parseFloat(getComputedStyle(t.total).width); t.hovered.style.left = handleLocation + 'px'; t.setTransformStyle(t.hovered, 'scaleX(' + hoverScaleX + ')'); t.hovered.setAttribute('pos', pos); if (hoverScaleX >= 0) { (0, _dom.removeClass)(t.hovered, 'negative'); } else { (0, _dom.addClass)(t.hovered, 'negative'); } } if (t.timefloat) { var half = t.timefloat.offsetWidth / 2, offsetContainer = mejs.Utils.offset(t.getElement(t.container)), tooltipStyles = getComputedStyle(t.timefloat); if (x - offsetContainer.left < t.timefloat.offsetWidth) { leftPos = half; } else if (x - offsetContainer.left >= t.getElement(t.container).offsetWidth - half) { leftPos = t.total.offsetWidth - half; } else { leftPos = pos; } if ((0, _dom.hasClass)(t.getElement(t.container), t.options.classPrefix + 'long-video')) { leftPos += parseFloat(tooltipStyles.marginLeft) / 2 + t.timefloat.offsetWidth / 2; } t.timefloat.style.left = leftPos + 'px'; t.timefloatcurrent.innerHTML = (0, _time.secondsToTimeCode)(t.newTime, player.options.alwaysShowHours, player.options.showTimecodeFrameCount, player.options.framesPerSecond, player.options.secondsDecimalLength, player.options.timeFormat); t.timefloat.style.display = 'block'; } } } else if (!_constants.IS_IOS && !_constants.IS_ANDROID && t.timefloat) { leftPos = t.timefloat.offsetWidth + width >= t.getElement(t.container).offsetWidth ? t.timefloat.offsetWidth / 2 : 0; t.timefloat.style.left = leftPos + 'px'; t.timefloat.style.left = leftPos + 'px'; t.timefloat.style.display = 'block'; } }, updateSlider = function updateSlider() { var seconds = t.getCurrentTime(), timeSliderText = _i18n2.default.t('mejs.time-slider'), time = (0, _time.secondsToTimeCode)(seconds, player.options.alwaysShowHours, player.options.showTimecodeFrameCount, player.options.framesPerSecond, player.options.secondsDecimalLength, player.options.timeFormat), duration = t.getDuration(); t.slider.setAttribute('role', 'slider'); t.slider.tabIndex = 0; if (media.paused) { t.slider.setAttribute('aria-label', timeSliderText); t.slider.setAttribute('aria-valuemin', 0); t.slider.setAttribute('aria-valuemax', duration); t.slider.setAttribute('aria-valuenow', seconds); t.slider.setAttribute('aria-valuetext', time); } else { t.slider.removeAttribute('aria-label'); t.slider.removeAttribute('aria-valuemin'); t.slider.removeAttribute('aria-valuemax'); t.slider.removeAttribute('aria-valuenow'); t.slider.removeAttribute('aria-valuetext'); } }, restartPlayer = function restartPlayer() { if (new Date() - lastKeyPressTime >= 1000) { t.play(); } }, handleMouseup = function handleMouseup() { if (mouseIsDown && t.getCurrentTime() !== null && t.newTime.toFixed(4) !== t.getCurrentTime().toFixed(4)) { t.setCurrentTime(t.newTime); t.setCurrentRailHandle(t.newTime); t.updateCurrent(t.newTime); } if (t.forcedHandlePause) { t.slider.focus(); t.play(); } t.forcedHandlePause = false; }; t.slider.addEventListener('focus', function () { player.options.autoRewind = false; }); t.slider.addEventListener('blur', function () { player.options.autoRewind = autoRewindInitial; }); t.slider.addEventListener('keydown', function (e) { if (new Date() - lastKeyPressTime >= 1000) { startedPaused = t.paused; } if (t.options.enableKeyboard && t.options.keyActions.length) { var keyCode = e.which || e.keyCode || 0, duration = t.getDuration(), seekForward = player.options.defaultSeekForwardInterval(media), seekBackward = player.options.defaultSeekBackwardInterval(media); var seekTime = t.getCurrentTime(); var volume = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-slider'); if (keyCode === 38 || keyCode === 40) { if (volume) { volume.style.display = 'block'; } if (t.isVideo) { t.showControls(); t.startControlsTimer(); } var newVolume = keyCode === 38 ? Math.min(t.volume + 0.1, 1) : Math.max(t.volume - 0.1, 0), mutePlayer = newVolume <= 0; t.setVolume(newVolume); t.setMuted(mutePlayer); return; } else { if (volume) { volume.style.display = 'none'; } } switch (keyCode) { case 37: if (t.getDuration() !== Infinity) { seekTime -= seekBackward; } break; case 39: if (t.getDuration() !== Infinity) { seekTime += seekForward; } break; case 36: seekTime = 0; break; case 35: seekTime = duration; break; case 13: case 32: if (_constants.IS_FIREFOX) { if (t.paused) { t.play(); } else { t.pause(); } } return; default: return; } seekTime = seekTime < 0 ? 0 : seekTime >= duration ? duration : Math.floor(seekTime); lastKeyPressTime = new Date(); if (!startedPaused) { player.pause(); } if (seekTime < t.getDuration() && !startedPaused) { setTimeout(restartPlayer, 1100); } t.setCurrentTime(seekTime); player.showControls(); e.preventDefault(); e.stopPropagation(); } }); var events = ['mousedown', 'touchstart']; t.slider.addEventListener('dragstart', function () { return false; }); for (var i = 0, total = events.length; i < total; i++) { t.slider.addEventListener(events[i], function (e) { t.forcedHandlePause = false; if (t.getDuration() !== Infinity) { if (e.which === 1 || e.which === 0) { if (!t.paused) { t.pause(); t.forcedHandlePause = true; } mouseIsDown = true; handleMouseMove(e); var endEvents = ['mouseup', 'touchend']; for (var j = 0, totalEvents = endEvents.length; j < totalEvents; j++) { t.getElement(t.container).addEventListener(endEvents[j], function (event) { var target = event.target; if (target === t.slider || target.closest('.' + t.options.classPrefix + 'time-slider')) { handleMouseMove(event); } }); } t.globalBind('mouseup.dur touchend.dur', function () { handleMouseup(); mouseIsDown = false; if (t.timefloat) { t.timefloat.style.display = 'none'; } }); } } }, _constants.SUPPORT_PASSIVE_EVENT && events[i] === 'touchstart' ? { passive: true } : false); } t.slider.addEventListener('mouseenter', function (e) { if (e.target === t.slider && t.getDuration() !== Infinity) { t.getElement(t.container).addEventListener('mousemove', function (event) { var target = event.target; if (target === t.slider || target.closest('.' + t.options.classPrefix + 'time-slider')) { handleMouseMove(event); } }); if (t.timefloat && !_constants.IS_IOS && !_constants.IS_ANDROID) { t.timefloat.style.display = 'block'; } if (t.hovered && !_constants.IS_IOS && !_constants.IS_ANDROID && t.options.useSmoothHover) { (0, _dom.removeClass)(t.hovered, 'no-hover'); } } }); t.slider.addEventListener('mouseleave', function () { if (t.getDuration() !== Infinity) { if (!mouseIsDown) { if (t.timefloat) { t.timefloat.style.display = 'none'; } if (t.hovered && t.options.useSmoothHover) { (0, _dom.addClass)(t.hovered, 'no-hover'); } } } }); t.broadcastCallback = function (e) { var broadcast = controls.querySelector('.' + t.options.classPrefix + 'broadcast'); if (!t.options.forceLive && t.getDuration() !== Infinity) { if (broadcast) { t.slider.style.display = ''; broadcast.remove(); } player.setProgressRail(e); if (!t.forcedHandlePause) { player.setCurrentRail(e); } updateSlider(); } else if (!broadcast || t.options.forceLive) { var label = _document2.default.createElement('span'); label.className = t.options.classPrefix + 'broadcast'; label.innerText = _i18n2.default.t('mejs.live-broadcast'); t.slider.style.display = 'none'; t.rail.appendChild(label); } }; media.addEventListener('progress', t.broadcastCallback); media.addEventListener('timeupdate', t.broadcastCallback); media.addEventListener('play', function () { t.buffer.style.display = 'none'; }); media.addEventListener('playing', function () { t.buffer.style.display = 'none'; }); media.addEventListener('seeking', function () { t.buffer.style.display = ''; }); media.addEventListener('seeked', function () { t.buffer.style.display = 'none'; }); media.addEventListener('pause', function () { t.buffer.style.display = 'none'; }); media.addEventListener('waiting', function () { t.buffer.style.display = ''; }); media.addEventListener('loadeddata', function () { t.buffer.style.display = ''; }); media.addEventListener('canplay', function () { t.buffer.style.display = 'none'; }); media.addEventListener('error', function () { t.buffer.style.display = 'none'; }); t.getElement(t.container).addEventListener('controlsresize', function (e) { if (t.getDuration() !== Infinity) { player.setProgressRail(e); if (!t.forcedHandlePause) { player.setCurrentRail(e); } } }); }, cleanprogress: function cleanprogress(player, controls, layers, media) { media.removeEventListener('progress', player.broadcastCallback); media.removeEventListener('timeupdate', player.broadcastCallback); if (player.rail) { player.rail.remove(); } }, setProgressRail: function setProgressRail(e) { var t = this, target = e !== undefined ? e.detail.target || e.target : t.media; var percent = null; if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && t.getDuration()) { percent = target.buffered.end(target.buffered.length - 1) / t.getDuration(); } else if (target && target.bytesTotal !== undefined && target.bytesTotal > 0 && target.bufferedBytes !== undefined) { percent = target.bufferedBytes / target.bytesTotal; } else if (e && e.lengthComputable && e.total !== 0) { percent = e.loaded / e.total; } if (percent !== null) { percent = Math.min(1, Math.max(0, percent)); if (t.loaded) { t.setTransformStyle(t.loaded, 'scaleX(' + percent + ')'); } } }, setCurrentRailHandle: function setCurrentRailHandle(fakeTime) { var t = this; t.setCurrentRailMain(t, fakeTime); }, setCurrentRail: function setCurrentRail() { var t = this; t.setCurrentRailMain(t); }, setCurrentRailMain: function setCurrentRailMain(t, fakeTime) { if (t.getCurrentTime() !== undefined && t.getDuration()) { var nTime = typeof fakeTime === 'undefined' ? t.getCurrentTime() : fakeTime; if (t.total && t.handle) { var tW = parseFloat(getComputedStyle(t.total).width); var newWidth = Math.round(tW * nTime / t.getDuration()), handlePos = newWidth - Math.round(t.handle.offsetWidth / 2); handlePos = handlePos < 0 ? 0 : handlePos; t.setTransformStyle(t.current, 'scaleX(' + newWidth / tW + ')'); t.setTransformStyle(t.handle, 'translateX(' + handlePos + 'px)'); if (t.options.useSmoothHover && !(0, _dom.hasClass)(t.hovered, 'no-hover')) { var pos = parseInt(t.hovered.getAttribute('pos'), 10); pos = isNaN(pos) ? 0 : pos; var hoverScaleX = pos / tW - handlePos / tW; t.hovered.style.left = handlePos + 'px'; t.setTransformStyle(t.hovered, 'scaleX(' + hoverScaleX + ')'); if (hoverScaleX >= 0) { (0, _dom.removeClass)(t.hovered, 'negative'); } else { (0, _dom.addClass)(t.hovered, 'negative'); } } } } } }); },{"16":16,"2":2,"25":25,"26":26,"30":30,"5":5}],12:[function(_dereq_,module,exports){ 'use strict'; var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _player = _dereq_(16); var _player2 = _interopRequireDefault(_player); var _time = _dereq_(30); var _dom = _dereq_(26); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } Object.assign(_player.config, { duration: 0, timeAndDurationSeparator: ' | ' }); Object.assign(_player2.default.prototype, { buildcurrent: function buildcurrent(player, controls, layers, media) { var t = this, time = _document2.default.createElement('div'); time.className = t.options.classPrefix + 'time'; time.setAttribute('role', 'timer'); time.setAttribute('aria-live', 'off'); time.innerHTML = '' + (0, _time.secondsToTimeCode)(0, player.options.alwaysShowHours, player.options.showTimecodeFrameCount, player.options.framesPerSecond, player.options.secondsDecimalLength, player.options.timeFormat) + ''; t.addControlElement(time, 'current'); player.updateCurrent(); t.updateTimeCallback = function () { if (t.controlsAreVisible) { player.updateCurrent(); } }; media.addEventListener('timeupdate', t.updateTimeCallback); }, cleancurrent: function cleancurrent(player, controls, layers, media) { media.removeEventListener('timeupdate', player.updateTimeCallback); }, buildduration: function buildduration(player, controls, layers, media) { var t = this, currTime = controls.lastChild.querySelector('.' + t.options.classPrefix + 'currenttime'); if (currTime) { controls.querySelector('.' + t.options.classPrefix + 'time').innerHTML += t.options.timeAndDurationSeparator + '' + ((0, _time.secondsToTimeCode)(t.options.duration, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond, t.options.secondsDecimalLength, t.options.timeFormat) + ''); } else { if (controls.querySelector('.' + t.options.classPrefix + 'currenttime')) { (0, _dom.addClass)(controls.querySelector('.' + t.options.classPrefix + 'currenttime').parentNode, t.options.classPrefix + 'currenttime-container'); } var duration = _document2.default.createElement('div'); duration.className = t.options.classPrefix + 'time ' + t.options.classPrefix + 'duration-container'; duration.innerHTML = '' + ((0, _time.secondsToTimeCode)(t.options.duration, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond, t.options.secondsDecimalLength, t.options.timeFormat) + ''); t.addControlElement(duration, 'duration'); } t.updateDurationCallback = function () { if (t.controlsAreVisible) { player.updateDuration(); } }; media.addEventListener('timeupdate', t.updateDurationCallback); }, cleanduration: function cleanduration(player, controls, layers, media) { media.removeEventListener('timeupdate', player.updateDurationCallback); }, updateCurrent: function updateCurrent() { var t = this; var currentTime = t.getCurrentTime(); if (isNaN(currentTime)) { currentTime = 0; } var timecode = (0, _time.secondsToTimeCode)(currentTime, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond, t.options.secondsDecimalLength, t.options.timeFormat); if (timecode.length > 5) { (0, _dom.addClass)(t.getElement(t.container), t.options.classPrefix + 'long-video'); } else { (0, _dom.removeClass)(t.getElement(t.container), t.options.classPrefix + 'long-video'); } if (t.getElement(t.controls).querySelector('.' + t.options.classPrefix + 'currenttime')) { t.getElement(t.controls).querySelector('.' + t.options.classPrefix + 'currenttime').innerText = timecode; } }, updateDuration: function updateDuration() { var t = this; var duration = t.getDuration(); if (t.media !== undefined && (isNaN(duration) || duration === Infinity || duration < 0)) { t.media.duration = t.options.duration = duration = 0; } if (t.options.duration > 0) { duration = t.options.duration; } var timecode = (0, _time.secondsToTimeCode)(duration, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond, t.options.secondsDecimalLength, t.options.timeFormat); if (timecode.length > 5) { (0, _dom.addClass)(t.getElement(t.container), t.options.classPrefix + 'long-video'); } else { (0, _dom.removeClass)(t.getElement(t.container), t.options.classPrefix + 'long-video'); } if (t.getElement(t.controls).querySelector('.' + t.options.classPrefix + 'duration') && duration > 0) { t.getElement(t.controls).querySelector('.' + t.options.classPrefix + 'duration').innerHTML = timecode; } } }); },{"16":16,"2":2,"26":26,"30":30}],13:[function(_dereq_,module,exports){ 'use strict'; var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); var _i18n = _dereq_(5); var _i18n2 = _interopRequireDefault(_i18n); var _player = _dereq_(16); var _player2 = _interopRequireDefault(_player); var _time = _dereq_(30); var _general = _dereq_(27); var _dom = _dereq_(26); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } Object.assign(_player.config, { startLanguage: '', tracksText: null, chaptersText: null, tracksAriaLive: false, hideCaptionsButtonWhenEmpty: true, toggleCaptionsButtonWhenOnlyOne: false, slidesSelector: '' }); Object.assign(_player2.default.prototype, { hasChapters: false, buildtracks: function buildtracks(player, controls, layers, media) { this.findTracks(); if (!player.tracks.length && (!player.trackFiles || !player.trackFiles.length === 0)) { return; } var t = this, attr = t.options.tracksAriaLive ? ' role="log" aria-live="assertive" aria-atomic="false"' : '', tracksTitle = (0, _general.isString)(t.options.tracksText) ? t.options.tracksText : _i18n2.default.t('mejs.captions-subtitles'), chaptersTitle = (0, _general.isString)(t.options.chaptersText) ? t.options.chaptersText : _i18n2.default.t('mejs.captions-chapters'), total = player.trackFiles === null ? player.tracks.length : player.trackFiles.length; if (t.domNode.textTracks) { for (var i = t.domNode.textTracks.length - 1; i >= 0; i--) { t.domNode.textTracks[i].mode = 'hidden'; } } t.cleartracks(player); player.captions = _document2.default.createElement('div'); player.captions.className = t.options.classPrefix + 'captions-layer ' + t.options.classPrefix + 'layer'; player.captions.innerHTML = '
' + ('') + '
'; player.captions.style.display = 'none'; layers.insertBefore(player.captions, layers.firstChild); player.captionsText = player.captions.querySelector('.' + t.options.classPrefix + 'captions-text'); player.captionsButton = _document2.default.createElement('div'); player.captionsButton.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'captions-button'; player.captionsButton.innerHTML = '' + ('
') + ('
    ') + ('
  • ') + ('' + ('') + '
  • ' + '
' + '
'; t.addControlElement(player.captionsButton, 'tracks'); player.captionsButton.querySelector('.' + t.options.classPrefix + 'captions-selector-input').disabled = false; player.chaptersButton = _document2.default.createElement('div'); player.chaptersButton.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'chapters-button'; player.chaptersButton.innerHTML = '' + ('
') + ('
    ') + '
    '; var subtitleCount = 0; for (var _i = 0; _i < total; _i++) { var kind = player.tracks[_i].kind, src = player.tracks[_i].src; if (src.trim()) { if (kind === 'subtitles' || kind === 'captions') { subtitleCount++; } else if (kind === 'chapters' && !controls.querySelector('.' + t.options.classPrefix + 'chapter-selector')) { player.captionsButton.parentNode.insertBefore(player.chaptersButton, player.captionsButton); } } } player.trackToLoad = -1; player.selectedTrack = null; player.isLoadingTrack = false; for (var _i2 = 0; _i2 < total; _i2++) { var _kind = player.tracks[_i2].kind; if (player.tracks[_i2].src.trim() && (_kind === 'subtitles' || _kind === 'captions')) { player.addTrackButton(player.tracks[_i2].trackId, player.tracks[_i2].srclang, player.tracks[_i2].label); } } player.loadNextTrack(); var inEvents = ['mouseenter', 'focusin'], outEvents = ['mouseleave', 'focusout']; if (t.options.toggleCaptionsButtonWhenOnlyOne && subtitleCount === 1) { player.captionsButton.addEventListener('click', function (e) { var trackId = 'none'; if (player.selectedTrack === null) { trackId = player.tracks[0].trackId; } var keyboard = e.keyCode || e.which; player.setTrack(trackId, typeof keyboard !== 'undefined'); }); } else { var labels = player.captionsButton.querySelectorAll('.' + t.options.classPrefix + 'captions-selector-label'), captions = player.captionsButton.querySelectorAll('input[type=radio]'); for (var _i3 = 0, _total = inEvents.length; _i3 < _total; _i3++) { player.captionsButton.addEventListener(inEvents[_i3], function () { (0, _dom.removeClass)(this.querySelector('.' + t.options.classPrefix + 'captions-selector'), t.options.classPrefix + 'offscreen'); }); } for (var _i4 = 0, _total2 = outEvents.length; _i4 < _total2; _i4++) { player.captionsButton.addEventListener(outEvents[_i4], function () { (0, _dom.addClass)(this.querySelector('.' + t.options.classPrefix + 'captions-selector'), t.options.classPrefix + 'offscreen'); }); } for (var _i5 = 0, _total3 = captions.length; _i5 < _total3; _i5++) { captions[_i5].addEventListener('click', function (e) { var keyboard = e.keyCode || e.which; player.setTrack(this.value, typeof keyboard !== 'undefined'); }); } for (var _i6 = 0, _total4 = labels.length; _i6 < _total4; _i6++) { labels[_i6].addEventListener('click', function (e) { var radio = (0, _dom.siblings)(this, function (el) { return el.tagName === 'INPUT'; })[0], event = (0, _general.createEvent)('click', radio); radio.dispatchEvent(event); e.preventDefault(); }); } player.captionsButton.addEventListener('keydown', function (e) { e.stopPropagation(); }); } for (var _i7 = 0, _total5 = inEvents.length; _i7 < _total5; _i7++) { player.chaptersButton.addEventListener(inEvents[_i7], function () { if (this.querySelector('.' + t.options.classPrefix + 'chapters-selector-list').children.length) { (0, _dom.removeClass)(this.querySelector('.' + t.options.classPrefix + 'chapters-selector'), t.options.classPrefix + 'offscreen'); } }); } for (var _i8 = 0, _total6 = outEvents.length; _i8 < _total6; _i8++) { player.chaptersButton.addEventListener(outEvents[_i8], function () { (0, _dom.addClass)(this.querySelector('.' + t.options.classPrefix + 'chapters-selector'), t.options.classPrefix + 'offscreen'); }); } player.chaptersButton.addEventListener('keydown', function (e) { e.stopPropagation(); }); if (!player.options.alwaysShowControls) { player.getElement(player.container).addEventListener('controlsshown', function () { (0, _dom.addClass)(player.getElement(player.container).querySelector('.' + t.options.classPrefix + 'captions-position'), t.options.classPrefix + 'captions-position-hover'); }); player.getElement(player.container).addEventListener('controlshidden', function () { if (!media.paused) { (0, _dom.removeClass)(player.getElement(player.container).querySelector('.' + t.options.classPrefix + 'captions-position'), t.options.classPrefix + 'captions-position-hover'); } }); } else { (0, _dom.addClass)(player.getElement(player.container).querySelector('.' + t.options.classPrefix + 'captions-position'), t.options.classPrefix + 'captions-position-hover'); } media.addEventListener('timeupdate', function () { player.displayCaptions(); }); if (player.options.slidesSelector !== '') { player.slidesContainer = _document2.default.querySelectorAll(player.options.slidesSelector); media.addEventListener('timeupdate', function () { player.displaySlides(); }); } }, cleartracks: function cleartracks(player) { if (player) { if (player.captions) { player.captions.remove(); } if (player.chapters) { player.chapters.remove(); } if (player.captionsText) { player.captionsText.remove(); } if (player.captionsButton) { player.captionsButton.remove(); } if (player.chaptersButton) { player.chaptersButton.remove(); } } }, rebuildtracks: function rebuildtracks() { var t = this; t.findTracks(); t.buildtracks(t, t.getElement(t.controls), t.getElement(t.layers), t.media); }, findTracks: function findTracks() { var t = this, tracktags = t.trackFiles === null ? t.node.querySelectorAll('track') : t.trackFiles, total = tracktags.length; t.tracks = []; for (var i = 0; i < total; i++) { var track = tracktags[i], srclang = track.getAttribute('srclang').toLowerCase() || '', trackId = t.id + '_track_' + i + '_' + track.getAttribute('kind') + '_' + srclang; t.tracks.push({ trackId: trackId, srclang: srclang, src: track.getAttribute('src'), kind: track.getAttribute('kind'), label: track.getAttribute('label') || '', entries: [], isLoaded: false }); } }, setTrack: function setTrack(trackId, setByKeyboard) { var t = this, radios = t.captionsButton.querySelectorAll('input[type="radio"]'), captions = t.captionsButton.querySelectorAll('.' + t.options.classPrefix + 'captions-selected'), track = t.captionsButton.querySelector('input[value="' + trackId + '"]'); for (var i = 0, total = radios.length; i < total; i++) { radios[i].checked = false; } for (var _i9 = 0, _total7 = captions.length; _i9 < _total7; _i9++) { (0, _dom.removeClass)(captions[_i9], t.options.classPrefix + 'captions-selected'); } track.checked = true; var labels = (0, _dom.siblings)(track, function (el) { return (0, _dom.hasClass)(el, t.options.classPrefix + 'captions-selector-label'); }); for (var _i10 = 0, _total8 = labels.length; _i10 < _total8; _i10++) { (0, _dom.addClass)(labels[_i10], t.options.classPrefix + 'captions-selected'); } if (trackId === 'none') { t.selectedTrack = null; (0, _dom.removeClass)(t.captionsButton, t.options.classPrefix + 'captions-enabled'); } else { for (var _i11 = 0, _total9 = t.tracks.length; _i11 < _total9; _i11++) { var _track = t.tracks[_i11]; if (_track.trackId === trackId) { if (t.selectedTrack === null) { (0, _dom.addClass)(t.captionsButton, t.options.classPrefix + 'captions-enabled'); } t.selectedTrack = _track; t.captions.setAttribute('lang', t.selectedTrack.srclang); t.displayCaptions(); break; } } } var event = (0, _general.createEvent)('captionschange', t.media); event.detail.caption = t.selectedTrack; t.media.dispatchEvent(event); if (!setByKeyboard) { setTimeout(function () { t.getElement(t.container).focus(); }, 500); } }, loadNextTrack: function loadNextTrack() { var t = this; t.trackToLoad++; if (t.trackToLoad < t.tracks.length) { t.isLoadingTrack = true; t.loadTrack(t.trackToLoad); } else { t.isLoadingTrack = false; t.checkForTracks(); } }, loadTrack: function loadTrack(index) { var t = this, track = t.tracks[index]; if (track !== undefined && (track.src !== undefined || track.src !== "")) { (0, _dom.ajax)(track.src, 'text', function (d) { track.entries = typeof d === 'string' && /' + ('') + ('') + ''; }, checkForTracks: function checkForTracks() { var t = this; var hasSubtitles = false; if (t.options.hideCaptionsButtonWhenEmpty) { for (var i = 0, total = t.tracks.length; i < total; i++) { var kind = t.tracks[i].kind; if ((kind === 'subtitles' || kind === 'captions') && t.tracks[i].isLoaded) { hasSubtitles = true; break; } } t.captionsButton.style.display = hasSubtitles ? '' : 'none'; t.setControlsSize(); } }, displayCaptions: function displayCaptions() { if (this.tracks === undefined) { return; } var t = this, track = t.selectedTrack, sanitize = function sanitize(html) { var div = _document2.default.createElement('div'); div.innerHTML = html; var scripts = div.getElementsByTagName('script'); var i = scripts.length; while (i--) { scripts[i].remove(); } var allElements = div.getElementsByTagName('*'); for (var _i12 = 0, n = allElements.length; _i12 < n; _i12++) { var attributesObj = allElements[_i12].attributes, attributes = Array.prototype.slice.call(attributesObj); for (var j = 0, total = attributes.length; j < total; j++) { if (attributes[j].name.startsWith('on') || attributes[j].value.startsWith('javascript')) { allElements[_i12].remove(); } else if (attributes[j].name === 'style') { allElements[_i12].removeAttribute(attributes[j].name); } } } return div.innerHTML; }; if (track !== null && track.isLoaded) { var i = t.searchTrackPosition(track.entries, t.media.currentTime); if (i > -1) { t.captionsText.innerHTML = sanitize(track.entries[i].text); t.captionsText.className = t.options.classPrefix + 'captions-text ' + (track.entries[i].identifier || ''); t.captions.style.display = ''; t.captions.style.height = '0px'; return; } t.captions.style.display = 'none'; } else { t.captions.style.display = 'none'; } }, setupSlides: function setupSlides(track) { var t = this; t.slides = track; t.slides.entries.imgs = [t.slides.entries.length]; t.showSlide(0); }, showSlide: function showSlide(index) { var _this = this; var t = this; if (t.tracks === undefined || t.slidesContainer === undefined) { return; } var url = t.slides.entries[index].text; var img = t.slides.entries[index].imgs; if (img === undefined || img.fadeIn === undefined) { var image = _document2.default.createElement('img'); image.src = url; image.addEventListener('load', function () { var self = _this, visible = (0, _dom.siblings)(self, function (el) { return visible(el); }); self.style.display = 'none'; t.slidesContainer.innerHTML += self.innerHTML; (0, _dom.fadeIn)(t.slidesContainer.querySelector(image)); for (var i = 0, total = visible.length; i < total; i++) { (0, _dom.fadeOut)(visible[i], 400); } }); t.slides.entries[index].imgs = img = image; } else if (!(0, _dom.visible)(img)) { var _visible = (0, _dom.siblings)(self, function (el) { return _visible(el); }); (0, _dom.fadeIn)(t.slidesContainer.querySelector(img)); for (var i = 0, total = _visible.length; i < total; i++) { (0, _dom.fadeOut)(_visible[i]); } } }, displaySlides: function displaySlides() { var t = this; if (this.slides === undefined) { return; } var slides = t.slides, i = t.searchTrackPosition(slides.entries, t.media.currentTime); if (i > -1) { t.showSlide(i); } }, drawChapters: function drawChapters(chapters) { var t = this, total = chapters.entries.length; if (!total) { return; } t.chaptersButton.querySelector('ul').innerHTML = ''; for (var i = 0; i < total; i++) { t.chaptersButton.querySelector('ul').innerHTML += '
  • ' + ('') + ('') + '
  • '; } var radios = t.chaptersButton.querySelectorAll('input[type="radio"]'), labels = t.chaptersButton.querySelectorAll('.' + t.options.classPrefix + 'chapters-selector-label'); for (var _i13 = 0, _total10 = radios.length; _i13 < _total10; _i13++) { radios[_i13].disabled = false; radios[_i13].checked = false; radios[_i13].addEventListener('click', function (e) { var self = this, listItems = t.chaptersButton.querySelectorAll('li'), label = (0, _dom.siblings)(self, function (el) { return (0, _dom.hasClass)(el, t.options.classPrefix + 'chapters-selector-label'); })[0]; self.checked = true; self.parentNode.setAttribute('aria-checked', true); (0, _dom.addClass)(label, t.options.classPrefix + 'chapters-selected'); (0, _dom.removeClass)(t.chaptersButton.querySelector('.' + t.options.classPrefix + 'chapters-selected'), t.options.classPrefix + 'chapters-selected'); for (var _i14 = 0, _total11 = listItems.length; _i14 < _total11; _i14++) { listItems[_i14].setAttribute('aria-checked', false); } var keyboard = e.keyCode || e.which; if (typeof keyboard === 'undefined') { setTimeout(function () { t.getElement(t.container).focus(); }, 500); } t.media.setCurrentTime(parseFloat(self.value)); if (t.media.paused) { t.media.play(); } }); } for (var _i15 = 0, _total12 = labels.length; _i15 < _total12; _i15++) { labels[_i15].addEventListener('click', function (e) { var radio = (0, _dom.siblings)(this, function (el) { return el.tagName === 'INPUT'; })[0], event = (0, _general.createEvent)('click', radio); radio.dispatchEvent(event); e.preventDefault(); }); } }, searchTrackPosition: function searchTrackPosition(tracks, currentTime) { var lo = 0, hi = tracks.length - 1, mid = void 0, start = void 0, stop = void 0; while (lo <= hi) { mid = lo + hi >> 1; start = tracks[mid].start; stop = tracks[mid].stop; if (currentTime >= start && currentTime < stop) { return mid; } else if (start < currentTime) { lo = mid + 1; } else if (start > currentTime) { hi = mid - 1; } } return -1; } }); _mejs2.default.language = { codes: { af: 'mejs.afrikaans', sq: 'mejs.albanian', ar: 'mejs.arabic', be: 'mejs.belarusian', bg: 'mejs.bulgarian', ca: 'mejs.catalan', zh: 'mejs.chinese', 'zh-cn': 'mejs.chinese-simplified', 'zh-tw': 'mejs.chines-traditional', hr: 'mejs.croatian', cs: 'mejs.czech', da: 'mejs.danish', nl: 'mejs.dutch', en: 'mejs.english', et: 'mejs.estonian', fl: 'mejs.filipino', fi: 'mejs.finnish', fr: 'mejs.french', gl: 'mejs.galician', de: 'mejs.german', el: 'mejs.greek', ht: 'mejs.haitian-creole', iw: 'mejs.hebrew', hi: 'mejs.hindi', hu: 'mejs.hungarian', is: 'mejs.icelandic', id: 'mejs.indonesian', ga: 'mejs.irish', it: 'mejs.italian', ja: 'mejs.japanese', ko: 'mejs.korean', lv: 'mejs.latvian', lt: 'mejs.lithuanian', mk: 'mejs.macedonian', ms: 'mejs.malay', mt: 'mejs.maltese', no: 'mejs.norwegian', fa: 'mejs.persian', pl: 'mejs.polish', pt: 'mejs.portuguese', ro: 'mejs.romanian', ru: 'mejs.russian', sr: 'mejs.serbian', sk: 'mejs.slovak', sl: 'mejs.slovenian', es: 'mejs.spanish', sw: 'mejs.swahili', sv: 'mejs.swedish', tl: 'mejs.tagalog', th: 'mejs.thai', tr: 'mejs.turkish', uk: 'mejs.ukrainian', vi: 'mejs.vietnamese', cy: 'mejs.welsh', yi: 'mejs.yiddish' } }; _mejs2.default.TrackFormatParser = { webvtt: { pattern: /^((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/, parse: function parse(trackText) { var lines = trackText.split(/\r?\n/), entries = []; var timecode = void 0, text = void 0, identifier = void 0; for (var i = 0, total = lines.length; i < total; i++) { timecode = this.pattern.exec(lines[i]); if (timecode && i < lines.length) { if (i - 1 >= 0 && lines[i - 1] !== '') { identifier = lines[i - 1]; } i++; text = lines[i]; i++; while (lines[i] !== '' && i < lines.length) { text = text + '\n' + lines[i]; i++; } text = text.trim().replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "$1"); entries.push({ identifier: identifier, start: (0, _time.convertSMPTEtoSeconds)(timecode[1]) === 0 ? 0.200 : (0, _time.convertSMPTEtoSeconds)(timecode[1]), stop: (0, _time.convertSMPTEtoSeconds)(timecode[3]), text: text, settings: timecode[5] }); } identifier = ''; } return entries; } }, dfxp: { parse: function parse(trackText) { trackText = $(trackText).filter('tt'); var container = trackText.firstChild, lines = container.querySelectorAll('p'), styleNode = trackText.getElementById('' + container.attr('style')), entries = []; var styles = void 0; if (styleNode.length) { styleNode.removeAttribute('id'); var attributes = styleNode.attributes; if (attributes.length) { styles = {}; for (var i = 0, total = attributes.length; i < total; i++) { styles[attributes[i].name.split(":")[1]] = attributes[i].value; } } } for (var _i16 = 0, _total13 = lines.length; _i16 < _total13; _i16++) { var style = void 0, _temp = { start: null, stop: null, style: null, text: null }; if (lines.eq(_i16).attr('begin')) { _temp.start = (0, _time.convertSMPTEtoSeconds)(lines.eq(_i16).attr('begin')); } if (!_temp.start && lines.eq(_i16 - 1).attr('end')) { _temp.start = (0, _time.convertSMPTEtoSeconds)(lines.eq(_i16 - 1).attr('end')); } if (lines.eq(_i16).attr('end')) { _temp.stop = (0, _time.convertSMPTEtoSeconds)(lines.eq(_i16).attr('end')); } if (!_temp.stop && lines.eq(_i16 + 1).attr('begin')) { _temp.stop = (0, _time.convertSMPTEtoSeconds)(lines.eq(_i16 + 1).attr('begin')); } if (styles) { style = ''; for (var _style in styles) { style += _style + ':' + styles[_style] + ';'; } } if (style) { _temp.style = style; } if (_temp.start === 0) { _temp.start = 0.200; } _temp.text = lines.eq(_i16).innerHTML.trim().replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "$1"); entries.push(_temp); } return entries; } } }; },{"16":16,"2":2,"26":26,"27":27,"30":30,"5":5,"7":7}],14:[function(_dereq_,module,exports){ 'use strict'; var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _player = _dereq_(16); var _player2 = _interopRequireDefault(_player); var _i18n = _dereq_(5); var _i18n2 = _interopRequireDefault(_i18n); var _constants = _dereq_(25); var _general = _dereq_(27); var _dom = _dereq_(26); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } Object.assign(_player.config, { muteText: null, unmuteText: null, allyVolumeControlText: null, hideVolumeOnTouchDevices: true, audioVolume: 'horizontal', videoVolume: 'vertical', startVolume: 0.8 }); Object.assign(_player2.default.prototype, { buildvolume: function buildvolume(player, controls, layers, media) { if ((_constants.IS_ANDROID || _constants.IS_IOS) && this.options.hideVolumeOnTouchDevices) { return; } var t = this, mode = t.isVideo ? t.options.videoVolume : t.options.audioVolume, muteText = (0, _general.isString)(t.options.muteText) ? t.options.muteText : _i18n2.default.t('mejs.mute'), unmuteText = (0, _general.isString)(t.options.unmuteText) ? t.options.unmuteText : _i18n2.default.t('mejs.unmute'), volumeControlText = (0, _general.isString)(t.options.allyVolumeControlText) ? t.options.allyVolumeControlText : _i18n2.default.t('mejs.volume-help-text'), mute = _document2.default.createElement('div'); mute.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'volume-button ' + t.options.classPrefix + 'mute'; mute.innerHTML = mode === 'horizontal' ? '' : '' + ('' + ('' + volumeControlText + '') + ('
    ') + ('
    ') + ('
    ') + '
    ' + '
    '; t.addControlElement(mute, 'volume'); t.options.keyActions.push({ keys: [38], action: function action(player) { var volumeSlider = player.getElement(player.container).querySelector('.' + _player.config.classPrefix + 'volume-slider'); if (volumeSlider || player.getElement(player.container).querySelector('.' + _player.config.classPrefix + 'volume-slider').matches(':focus')) { volumeSlider.style.display = 'block'; } if (player.isVideo) { player.showControls(); player.startControlsTimer(); } var newVolume = Math.min(player.volume + 0.1, 1); player.setVolume(newVolume); if (newVolume > 0) { player.setMuted(false); } } }, { keys: [40], action: function action(player) { var volumeSlider = player.getElement(player.container).querySelector('.' + _player.config.classPrefix + 'volume-slider'); if (volumeSlider) { volumeSlider.style.display = 'block'; } if (player.isVideo) { player.showControls(); player.startControlsTimer(); } var newVolume = Math.max(player.volume - 0.1, 0); player.setVolume(newVolume); if (newVolume <= 0.1) { player.setMuted(true); } } }, { keys: [77], action: function action(player) { player.getElement(player.container).querySelector('.' + _player.config.classPrefix + 'volume-slider').style.display = 'block'; if (player.isVideo) { player.showControls(); player.startControlsTimer(); } if (player.media.muted) { player.setMuted(false); } else { player.setMuted(true); } } }); if (mode === 'horizontal') { var anchor = _document2.default.createElement('a'); anchor.className = t.options.classPrefix + 'horizontal-volume-slider'; anchor.href = 'javascript:void(0);'; anchor.setAttribute('aria-label', _i18n2.default.t('mejs.volume-slider')); anchor.setAttribute('aria-valuemin', 0); anchor.setAttribute('aria-valuemax', 100); anchor.setAttribute('role', 'slider'); anchor.innerHTML += '' + volumeControlText + '' + ('
    ') + ('
    ') + ('
    ') + '
    '; mute.parentNode.insertBefore(anchor, mute.nextSibling); } var mouseIsDown = false, mouseIsOver = false, modified = false, updateVolumeSlider = function updateVolumeSlider() { var volume = Math.floor(media.volume * 100); volumeSlider.setAttribute('aria-valuenow', volume); volumeSlider.setAttribute('aria-valuetext', volume + '%'); }; var volumeSlider = mode === 'vertical' ? t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-slider') : t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'horizontal-volume-slider'), volumeTotal = mode === 'vertical' ? t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-total') : t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'horizontal-volume-total'), volumeCurrent = mode === 'vertical' ? t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-current') : t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'horizontal-volume-current'), volumeHandle = mode === 'vertical' ? t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-handle') : t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'horizontal-volume-handle'), positionVolumeHandle = function positionVolumeHandle(volume) { if (volume === null || isNaN(volume) || volume === undefined) { return; } volume = Math.max(0, volume); volume = Math.min(volume, 1); if (volume === 0) { (0, _dom.removeClass)(mute, t.options.classPrefix + 'mute'); (0, _dom.addClass)(mute, t.options.classPrefix + 'unmute'); var button = mute.firstElementChild; button.setAttribute('title', unmuteText); button.setAttribute('aria-label', unmuteText); } else { (0, _dom.removeClass)(mute, t.options.classPrefix + 'unmute'); (0, _dom.addClass)(mute, t.options.classPrefix + 'mute'); var _button = mute.firstElementChild; _button.setAttribute('title', muteText); _button.setAttribute('aria-label', muteText); } var volumePercentage = volume * 100 + '%', volumeStyles = getComputedStyle(volumeHandle); if (mode === 'vertical') { volumeCurrent.style.bottom = 0; volumeCurrent.style.height = volumePercentage; volumeHandle.style.bottom = volumePercentage; volumeHandle.style.marginBottom = -parseFloat(volumeStyles.height) / 2 + 'px'; } else { volumeCurrent.style.left = 0; volumeCurrent.style.width = volumePercentage; volumeHandle.style.left = volumePercentage; volumeHandle.style.marginLeft = -parseFloat(volumeStyles.width) / 2 + 'px'; } }, handleVolumeMove = function handleVolumeMove(e) { var totalOffset = (0, _dom.offset)(volumeTotal), volumeStyles = getComputedStyle(volumeTotal); modified = true; var volume = null; if (mode === 'vertical') { var railHeight = parseFloat(volumeStyles.height), newY = e.pageY - totalOffset.top; volume = (railHeight - newY) / railHeight; if (totalOffset.top === 0 || totalOffset.left === 0) { return; } } else { var railWidth = parseFloat(volumeStyles.width), newX = e.pageX - totalOffset.left; volume = newX / railWidth; } volume = Math.max(0, volume); volume = Math.min(volume, 1); positionVolumeHandle(volume); t.setMuted(volume === 0); t.setVolume(volume); e.preventDefault(); e.stopPropagation(); }, toggleMute = function toggleMute() { if (t.muted) { positionVolumeHandle(0); (0, _dom.removeClass)(mute, t.options.classPrefix + 'mute'); (0, _dom.addClass)(mute, t.options.classPrefix + 'unmute'); } else { positionVolumeHandle(media.volume); (0, _dom.removeClass)(mute, t.options.classPrefix + 'unmute'); (0, _dom.addClass)(mute, t.options.classPrefix + 'mute'); } }; player.getElement(player.container).addEventListener('keydown', function (e) { var hasFocus = !!e.target.closest('.' + t.options.classPrefix + 'container'); if (!hasFocus && mode === 'vertical') { volumeSlider.style.display = 'none'; } }); mute.addEventListener('mouseenter', function (e) { if (e.target === mute) { volumeSlider.style.display = 'block'; mouseIsOver = true; e.preventDefault(); e.stopPropagation(); } }); mute.addEventListener('focusin', function () { volumeSlider.style.display = 'block'; mouseIsOver = true; }); mute.addEventListener('focusout', function (e) { if ((!e.relatedTarget || e.relatedTarget && !e.relatedTarget.matches('.' + t.options.classPrefix + 'volume-slider')) && mode === 'vertical') { volumeSlider.style.display = 'none'; } }); mute.addEventListener('mouseleave', function () { mouseIsOver = false; if (!mouseIsDown && mode === 'vertical') { volumeSlider.style.display = 'none'; } }); mute.addEventListener('focusout', function () { mouseIsOver = false; }); mute.addEventListener('keydown', function (e) { if (t.options.enableKeyboard && t.options.keyActions.length) { var keyCode = e.which || e.keyCode || 0, volume = media.volume; switch (keyCode) { case 38: volume = Math.min(volume + 0.1, 1); break; case 40: volume = Math.max(0, volume - 0.1); break; default: return true; } mouseIsDown = false; positionVolumeHandle(volume); media.setVolume(volume); e.preventDefault(); e.stopPropagation(); } }); mute.querySelector('button').addEventListener('click', function () { media.setMuted(!media.muted); var event = (0, _general.createEvent)('volumechange', media); media.dispatchEvent(event); }); volumeSlider.addEventListener('dragstart', function () { return false; }); volumeSlider.addEventListener('mouseover', function () { mouseIsOver = true; }); volumeSlider.addEventListener('focusin', function () { volumeSlider.style.display = 'block'; mouseIsOver = true; }); volumeSlider.addEventListener('focusout', function () { mouseIsOver = false; if (!mouseIsDown && mode === 'vertical') { volumeSlider.style.display = 'none'; } }); volumeSlider.addEventListener('mousedown', function (e) { handleVolumeMove(e); t.globalBind('mousemove.vol', function (event) { var target = event.target; if (mouseIsDown && (target === volumeSlider || target.closest(mode === 'vertical' ? '.' + t.options.classPrefix + 'volume-slider' : '.' + t.options.classPrefix + 'horizontal-volume-slider'))) { handleVolumeMove(event); } }); t.globalBind('mouseup.vol', function () { mouseIsDown = false; if (!mouseIsOver && mode === 'vertical') { volumeSlider.style.display = 'none'; } }); mouseIsDown = true; e.preventDefault(); e.stopPropagation(); }); media.addEventListener('volumechange', function (e) { if (!mouseIsDown) { toggleMute(); } updateVolumeSlider(e); }); var rendered = false; media.addEventListener('rendererready', function () { if (!modified) { setTimeout(function () { rendered = true; if (player.options.startVolume === 0 || media.originalNode.muted) { media.setMuted(true); player.options.startVolume = 0; } media.setVolume(player.options.startVolume); t.setControlsSize(); }, 250); } }); media.addEventListener('loadedmetadata', function () { setTimeout(function () { if (!modified && !rendered) { if (player.options.startVolume === 0 || media.originalNode.muted) { media.setMuted(true); } media.setVolume(player.options.startVolume); t.setControlsSize(); } rendered = false; }, 250); }); if (player.options.startVolume === 0 || media.originalNode.muted) { media.setMuted(true); player.options.startVolume = 0; toggleMute(); } t.getElement(t.container).addEventListener('controlsresize', function () { toggleMute(); }); } }); },{"16":16,"2":2,"25":25,"26":26,"27":27,"5":5}],15:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var EN = exports.EN = { 'mejs.plural-form': 1, 'mejs.download-file': 'Download File', 'mejs.install-flash': 'You are using a browser that does not have Flash player enabled or installed. Please turn on your Flash player plugin or download the latest version from https://get.adobe.com/flashplayer/', 'mejs.fullscreen': 'Fullscreen', 'mejs.play': 'Play', 'mejs.pause': 'Pause', 'mejs.time-slider': 'Time Slider', 'mejs.time-help-text': 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.', 'mejs.live-broadcast': 'Live Broadcast', 'mejs.volume-help-text': 'Use Up/Down Arrow keys to increase or decrease volume.', 'mejs.unmute': 'Unmute', 'mejs.mute': 'Mute', 'mejs.volume-slider': 'Volume Slider', 'mejs.video-player': 'Video Player', 'mejs.audio-player': 'Audio Player', 'mejs.captions-subtitles': 'Captions/Subtitles', 'mejs.captions-chapters': 'Chapters', 'mejs.none': 'None', 'mejs.afrikaans': 'Afrikaans', 'mejs.albanian': 'Albanian', 'mejs.arabic': 'Arabic', 'mejs.belarusian': 'Belarusian', 'mejs.bulgarian': 'Bulgarian', 'mejs.catalan': 'Catalan', 'mejs.chinese': 'Chinese', 'mejs.chinese-simplified': 'Chinese (Simplified)', 'mejs.chinese-traditional': 'Chinese (Traditional)', 'mejs.croatian': 'Croatian', 'mejs.czech': 'Czech', 'mejs.danish': 'Danish', 'mejs.dutch': 'Dutch', 'mejs.english': 'English', 'mejs.estonian': 'Estonian', 'mejs.filipino': 'Filipino', 'mejs.finnish': 'Finnish', 'mejs.french': 'French', 'mejs.galician': 'Galician', 'mejs.german': 'German', 'mejs.greek': 'Greek', 'mejs.haitian-creole': 'Haitian Creole', 'mejs.hebrew': 'Hebrew', 'mejs.hindi': 'Hindi', 'mejs.hungarian': 'Hungarian', 'mejs.icelandic': 'Icelandic', 'mejs.indonesian': 'Indonesian', 'mejs.irish': 'Irish', 'mejs.italian': 'Italian', 'mejs.japanese': 'Japanese', 'mejs.korean': 'Korean', 'mejs.latvian': 'Latvian', 'mejs.lithuanian': 'Lithuanian', 'mejs.macedonian': 'Macedonian', 'mejs.malay': 'Malay', 'mejs.maltese': 'Maltese', 'mejs.norwegian': 'Norwegian', 'mejs.persian': 'Persian', 'mejs.polish': 'Polish', 'mejs.portuguese': 'Portuguese', 'mejs.romanian': 'Romanian', 'mejs.russian': 'Russian', 'mejs.serbian': 'Serbian', 'mejs.slovak': 'Slovak', 'mejs.slovenian': 'Slovenian', 'mejs.spanish': 'Spanish', 'mejs.swahili': 'Swahili', 'mejs.swedish': 'Swedish', 'mejs.tagalog': 'Tagalog', 'mejs.thai': 'Thai', 'mejs.turkish': 'Turkish', 'mejs.ukrainian': 'Ukrainian', 'mejs.vietnamese': 'Vietnamese', 'mejs.welsh': 'Welsh', 'mejs.yiddish': 'Yiddish' }; },{}],16:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.config = undefined; 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; }; }(); var _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); var _mediaelement = _dereq_(6); var _mediaelement2 = _interopRequireDefault(_mediaelement); var _default = _dereq_(17); var _default2 = _interopRequireDefault(_default); var _i18n = _dereq_(5); var _i18n2 = _interopRequireDefault(_i18n); var _constants = _dereq_(25); var _general = _dereq_(27); var _time = _dereq_(30); var _media = _dereq_(28); var _dom = _dereq_(26); var dom = _interopRequireWildcard(_dom); 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 }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } _mejs2.default.mepIndex = 0; _mejs2.default.players = {}; var config = exports.config = { poster: '', showPosterWhenEnded: false, showPosterWhenPaused: false, defaultVideoWidth: 480, defaultVideoHeight: 270, videoWidth: -1, videoHeight: -1, defaultAudioWidth: 400, defaultAudioHeight: 40, defaultSeekBackwardInterval: function defaultSeekBackwardInterval(media) { return media.getDuration() * 0.05; }, defaultSeekForwardInterval: function defaultSeekForwardInterval(media) { return media.getDuration() * 0.05; }, setDimensions: true, audioWidth: -1, audioHeight: -1, loop: false, autoRewind: true, enableAutosize: true, timeFormat: '', alwaysShowHours: false, showTimecodeFrameCount: false, framesPerSecond: 25, alwaysShowControls: false, hideVideoControlsOnLoad: false, hideVideoControlsOnPause: false, clickToPlayPause: true, controlsTimeoutDefault: 1500, controlsTimeoutMouseEnter: 2500, controlsTimeoutMouseLeave: 1000, iPadUseNativeControls: false, iPhoneUseNativeControls: false, AndroidUseNativeControls: false, features: ['playpause', 'current', 'progress', 'duration', 'tracks', 'volume', 'fullscreen'], useDefaultControls: false, isVideo: true, stretching: 'auto', classPrefix: 'mejs__', enableKeyboard: true, pauseOtherPlayers: true, secondsDecimalLength: 0, customError: null, keyActions: [{ keys: [32, 179], action: function action(player) { if (!_constants.IS_FIREFOX) { if (player.paused || player.ended) { player.play(); } else { player.pause(); } } } }] }; _mejs2.default.MepDefaults = config; var MediaElementPlayer = function () { function MediaElementPlayer(node, o) { _classCallCheck(this, MediaElementPlayer); var t = this, element = typeof node === 'string' ? _document2.default.getElementById(node) : node; if (!(t instanceof MediaElementPlayer)) { return new MediaElementPlayer(element, o); } t.node = t.media = element; if (!t.node) { return; } if (t.media.player) { return t.media.player; } t.hasFocus = false; t.controlsAreVisible = true; t.controlsEnabled = true; t.controlsTimer = null; t.currentMediaTime = 0; t.proxy = null; if (o === undefined) { var options = t.node.getAttribute('data-mejsoptions'); o = options ? JSON.parse(options) : {}; } t.options = Object.assign({}, config, o); if (t.options.loop && !t.media.getAttribute('loop')) { t.media.loop = true; t.node.loop = true; } else if (t.media.loop) { t.options.loop = true; } if (!t.options.timeFormat) { t.options.timeFormat = 'mm:ss'; if (t.options.alwaysShowHours) { t.options.timeFormat = 'hh:mm:ss'; } if (t.options.showTimecodeFrameCount) { t.options.timeFormat += ':ff'; } } (0, _time.calculateTimeFormat)(0, t.options, t.options.framesPerSecond || 25); t.id = 'mep_' + _mejs2.default.mepIndex++; _mejs2.default.players[t.id] = t; t.init(); return t; } _createClass(MediaElementPlayer, [{ key: 'getElement', value: function getElement(element) { return element; } }, { key: 'init', value: function init() { var t = this, playerOptions = Object.assign({}, t.options, { success: function success(media, domNode) { t._meReady(media, domNode); }, error: function error(e) { t._handleError(e); } }), tagName = t.node.tagName.toLowerCase(); t.isDynamic = tagName !== 'audio' && tagName !== 'video' && tagName !== 'iframe'; t.isVideo = t.isDynamic ? t.options.isVideo : tagName !== 'audio' && t.options.isVideo; t.mediaFiles = null; t.trackFiles = null; if (_constants.IS_IPAD && t.options.iPadUseNativeControls || _constants.IS_IPHONE && t.options.iPhoneUseNativeControls) { t.node.setAttribute('controls', true); if (_constants.IS_IPAD && t.node.getAttribute('autoplay')) { t.play(); } } else if ((t.isVideo || !t.isVideo && (t.options.features.length || t.options.useDefaultControls)) && !(_constants.IS_ANDROID && t.options.AndroidUseNativeControls)) { t.node.removeAttribute('controls'); var videoPlayerTitle = t.isVideo ? _i18n2.default.t('mejs.video-player') : _i18n2.default.t('mejs.audio-player'); var offscreen = _document2.default.createElement('span'); offscreen.className = t.options.classPrefix + 'offscreen'; offscreen.innerText = videoPlayerTitle; t.media.parentNode.insertBefore(offscreen, t.media); t.container = _document2.default.createElement('div'); t.getElement(t.container).id = t.id; t.getElement(t.container).className = t.options.classPrefix + 'container ' + t.options.classPrefix + 'container-keyboard-inactive ' + t.media.className; t.getElement(t.container).tabIndex = 0; t.getElement(t.container).setAttribute('role', 'application'); t.getElement(t.container).setAttribute('aria-label', videoPlayerTitle); t.getElement(t.container).innerHTML = '
    ' + ('
    ') + ('
    ') + ('
    ') + '
    '; t.getElement(t.container).addEventListener('focus', function (e) { if (!t.controlsAreVisible && !t.hasFocus && t.controlsEnabled) { t.showControls(true); var btnSelector = (0, _general.isNodeAfter)(e.relatedTarget, t.getElement(t.container)) ? '.' + t.options.classPrefix + 'controls .' + t.options.classPrefix + 'button:last-child > button' : '.' + t.options.classPrefix + 'playpause-button > button', button = t.getElement(t.container).querySelector(btnSelector); button.focus(); } }); t.node.parentNode.insertBefore(t.getElement(t.container), t.node); if (!t.options.features.length && !t.options.useDefaultControls) { t.getElement(t.container).style.background = 'transparent'; t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'controls').style.display = 'none'; } if (t.isVideo && t.options.stretching === 'fill' && !dom.hasClass(t.getElement(t.container).parentNode, t.options.classPrefix + 'fill-container')) { t.outerContainer = t.media.parentNode; var wrapper = _document2.default.createElement('div'); wrapper.className = t.options.classPrefix + 'fill-container'; t.getElement(t.container).parentNode.insertBefore(wrapper, t.getElement(t.container)); wrapper.appendChild(t.getElement(t.container)); } if (_constants.IS_ANDROID) { dom.addClass(t.getElement(t.container), t.options.classPrefix + 'android'); } if (_constants.IS_IOS) { dom.addClass(t.getElement(t.container), t.options.classPrefix + 'ios'); } if (_constants.IS_IPAD) { dom.addClass(t.getElement(t.container), t.options.classPrefix + 'ipad'); } if (_constants.IS_IPHONE) { dom.addClass(t.getElement(t.container), t.options.classPrefix + 'iphone'); } dom.addClass(t.getElement(t.container), t.isVideo ? t.options.classPrefix + 'video' : t.options.classPrefix + 'audio'); if (_constants.IS_SAFARI && !_constants.IS_IOS) { dom.addClass(t.getElement(t.container), t.options.classPrefix + 'hide-cues'); var cloneNode = t.node.cloneNode(), children = t.node.children, mediaFiles = [], tracks = []; for (var i = 0, total = children.length; i < total; i++) { var childNode = children[i]; (function () { switch (childNode.tagName.toLowerCase()) { case 'source': var elements = {}; Array.prototype.slice.call(childNode.attributes).forEach(function (item) { elements[item.name] = item.value; }); elements.type = (0, _media.formatType)(elements.src, elements.type); mediaFiles.push(elements); break; case 'track': childNode.mode = 'hidden'; tracks.push(childNode); break; default: cloneNode.appendChild(childNode); break; } })(); } t.node.remove(); t.node = t.media = cloneNode; if (mediaFiles.length) { t.mediaFiles = mediaFiles; } if (tracks.length) { t.trackFiles = tracks; } } t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'mediaelement').appendChild(t.node); t.media.player = t; t.controls = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'controls'); t.layers = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'layers'); var tagType = t.isVideo ? 'video' : 'audio', capsTagName = tagType.substring(0, 1).toUpperCase() + tagType.substring(1); if (t.options[tagType + 'Width'] > 0 || t.options[tagType + 'Width'].toString().indexOf('%') > -1) { t.width = t.options[tagType + 'Width']; } else if (t.node.style.width !== '' && t.node.style.width !== null) { t.width = t.node.style.width; } else if (t.node.getAttribute('width')) { t.width = t.node.getAttribute('width'); } else { t.width = t.options['default' + capsTagName + 'Width']; } if (t.options[tagType + 'Height'] > 0 || t.options[tagType + 'Height'].toString().indexOf('%') > -1) { t.height = t.options[tagType + 'Height']; } else if (t.node.style.height !== '' && t.node.style.height !== null) { t.height = t.node.style.height; } else if (t.node.getAttribute('height')) { t.height = t.node.getAttribute('height'); } else { t.height = t.options['default' + capsTagName + 'Height']; } t.initialAspectRatio = t.height >= t.width ? t.width / t.height : t.height / t.width; t.setPlayerSize(t.width, t.height); playerOptions.pluginWidth = t.width; playerOptions.pluginHeight = t.height; } else if (!t.isVideo && !t.options.features.length && !t.options.useDefaultControls) { t.node.style.display = 'none'; } _mejs2.default.MepDefaults = playerOptions; new _mediaelement2.default(t.media, playerOptions, t.mediaFiles); if (t.getElement(t.container) !== undefined && t.options.features.length && t.controlsAreVisible && !t.options.hideVideoControlsOnLoad) { var event = (0, _general.createEvent)('controlsshown', t.getElement(t.container)); t.getElement(t.container).dispatchEvent(event); } } }, { key: 'showControls', value: function showControls(doAnimation) { var t = this; doAnimation = doAnimation === undefined || doAnimation; if (t.controlsAreVisible || !t.isVideo) { return; } if (doAnimation) { (function () { dom.fadeIn(t.getElement(t.controls), 200, function () { dom.removeClass(t.getElement(t.controls), t.options.classPrefix + 'offscreen'); var event = (0, _general.createEvent)('controlsshown', t.getElement(t.container)); t.getElement(t.container).dispatchEvent(event); }); var controls = t.getElement(t.container).querySelectorAll('.' + t.options.classPrefix + 'control'); var _loop = function _loop(i, total) { dom.fadeIn(controls[i], 200, function () { dom.removeClass(controls[i], t.options.classPrefix + 'offscreen'); }); }; for (var i = 0, total = controls.length; i < total; i++) { _loop(i, total); } })(); } else { dom.removeClass(t.getElement(t.controls), t.options.classPrefix + 'offscreen'); t.getElement(t.controls).style.display = ''; t.getElement(t.controls).style.opacity = 1; var controls = t.getElement(t.container).querySelectorAll('.' + t.options.classPrefix + 'control'); for (var i = 0, total = controls.length; i < total; i++) { dom.removeClass(controls[i], t.options.classPrefix + 'offscreen'); controls[i].style.display = ''; } var event = (0, _general.createEvent)('controlsshown', t.getElement(t.container)); t.getElement(t.container).dispatchEvent(event); } t.controlsAreVisible = true; t.setControlsSize(); } }, { key: 'hideControls', value: function hideControls(doAnimation, forceHide) { var t = this; doAnimation = doAnimation === undefined || doAnimation; if (forceHide !== true && (!t.controlsAreVisible || t.options.alwaysShowControls || t.paused && t.readyState === 4 && (!t.options.hideVideoControlsOnLoad && t.currentTime <= 0 || !t.options.hideVideoControlsOnPause && t.currentTime > 0) || t.isVideo && !t.options.hideVideoControlsOnLoad && !t.readyState || t.ended)) { return; } if (doAnimation) { (function () { dom.fadeOut(t.getElement(t.controls), 200, function () { dom.addClass(t.getElement(t.controls), t.options.classPrefix + 'offscreen'); t.getElement(t.controls).style.display = ''; var event = (0, _general.createEvent)('controlshidden', t.getElement(t.container)); t.getElement(t.container).dispatchEvent(event); }); var controls = t.getElement(t.container).querySelectorAll('.' + t.options.classPrefix + 'control'); var _loop2 = function _loop2(i, total) { dom.fadeOut(controls[i], 200, function () { dom.addClass(controls[i], t.options.classPrefix + 'offscreen'); controls[i].style.display = ''; }); }; for (var i = 0, total = controls.length; i < total; i++) { _loop2(i, total); } })(); } else { dom.addClass(t.getElement(t.controls), t.options.classPrefix + 'offscreen'); t.getElement(t.controls).style.display = ''; t.getElement(t.controls).style.opacity = 0; var controls = t.getElement(t.container).querySelectorAll('.' + t.options.classPrefix + 'control'); for (var i = 0, total = controls.length; i < total; i++) { dom.addClass(controls[i], t.options.classPrefix + 'offscreen'); controls[i].style.display = ''; } var event = (0, _general.createEvent)('controlshidden', t.getElement(t.container)); t.getElement(t.container).dispatchEvent(event); } t.controlsAreVisible = false; } }, { key: 'startControlsTimer', value: function startControlsTimer(timeout) { var t = this; timeout = typeof timeout !== 'undefined' ? timeout : t.options.controlsTimeoutDefault; t.killControlsTimer('start'); t.controlsTimer = setTimeout(function () { t.hideControls(); t.killControlsTimer('hide'); }, timeout); } }, { key: 'killControlsTimer', value: function killControlsTimer() { var t = this; if (t.controlsTimer !== null) { clearTimeout(t.controlsTimer); delete t.controlsTimer; t.controlsTimer = null; } } }, { key: 'disableControls', value: function disableControls() { var t = this; t.killControlsTimer(); t.controlsEnabled = false; t.hideControls(false, true); } }, { key: 'enableControls', value: function enableControls() { var t = this; t.controlsEnabled = true; t.showControls(false); } }, { key: '_setDefaultPlayer', value: function _setDefaultPlayer() { var t = this; if (t.proxy) { t.proxy.pause(); } t.proxy = new _default2.default(t); t.media.addEventListener('loadedmetadata', function () { if (t.getCurrentTime() > 0 && t.currentMediaTime > 0) { t.setCurrentTime(t.currentMediaTime); if (!_constants.IS_IOS && !_constants.IS_ANDROID) { t.play(); } } }); } }, { key: '_meReady', value: function _meReady(media, domNode) { var t = this, autoplayAttr = domNode.getAttribute('autoplay'), autoplay = !(autoplayAttr === undefined || autoplayAttr === null || autoplayAttr === 'false'), isNative = media.rendererName !== null && /(native|html5)/i.test(t.media.rendererName); if (t.getElement(t.controls)) { t.enableControls(); } if (t.getElement(t.container) && t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-play')) { t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-play').style.display = ''; } if (t.created) { return; } t.created = true; t.media = media; t.domNode = domNode; if (!(_constants.IS_ANDROID && t.options.AndroidUseNativeControls) && !(_constants.IS_IPAD && t.options.iPadUseNativeControls) && !(_constants.IS_IPHONE && t.options.iPhoneUseNativeControls)) { if (!t.isVideo && !t.options.features.length && !t.options.useDefaultControls) { if (autoplay && isNative) { t.play(); } if (t.options.success) { if (typeof t.options.success === 'string') { _window2.default[t.options.success](t.media, t.domNode, t); } else { t.options.success(t.media, t.domNode, t); } } return; } t.featurePosition = {}; t._setDefaultPlayer(); t.buildposter(t, t.getElement(t.controls), t.getElement(t.layers), t.media); t.buildkeyboard(t, t.getElement(t.controls), t.getElement(t.layers), t.media); t.buildoverlays(t, t.getElement(t.controls), t.getElement(t.layers), t.media); if (t.options.useDefaultControls) { var defaultControls = ['playpause', 'current', 'progress', 'duration', 'tracks', 'volume', 'fullscreen']; t.options.features = defaultControls.concat(t.options.features.filter(function (item) { return defaultControls.indexOf(item) === -1; })); } t.buildfeatures(t, t.getElement(t.controls), t.getElement(t.layers), t.media); var event = (0, _general.createEvent)('controlsready', t.getElement(t.container)); t.getElement(t.container).dispatchEvent(event); t.setPlayerSize(t.width, t.height); t.setControlsSize(); if (t.isVideo) { t.clickToPlayPauseCallback = function () { if (t.options.clickToPlayPause) { var button = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-button'), pressed = button.getAttribute('aria-pressed'); if (t.paused && pressed) { t.pause(); } else if (t.paused) { t.play(); } else { t.pause(); } button.setAttribute('aria-pressed', !pressed); t.getElement(t.container).focus(); } }; t.createIframeLayer(); t.media.addEventListener('click', t.clickToPlayPauseCallback); if ((_constants.IS_ANDROID || _constants.IS_IOS) && !t.options.alwaysShowControls) { t.node.addEventListener('touchstart', function () { if (t.controlsAreVisible) { t.hideControls(false); } else { if (t.controlsEnabled) { t.showControls(false); } } }, _constants.SUPPORT_PASSIVE_EVENT ? { passive: true } : false); } else { t.getElement(t.container).addEventListener('mouseenter', function () { if (t.controlsEnabled) { if (!t.options.alwaysShowControls) { t.killControlsTimer('enter'); t.showControls(); t.startControlsTimer(t.options.controlsTimeoutMouseEnter); } } }); t.getElement(t.container).addEventListener('mousemove', function () { if (t.controlsEnabled) { if (!t.controlsAreVisible) { t.showControls(); } if (!t.options.alwaysShowControls) { t.startControlsTimer(t.options.controlsTimeoutMouseEnter); } } }); t.getElement(t.container).addEventListener('mouseleave', function () { if (t.controlsEnabled) { if (!t.paused && !t.options.alwaysShowControls) { t.startControlsTimer(t.options.controlsTimeoutMouseLeave); } } }); } if (t.options.hideVideoControlsOnLoad) { t.hideControls(false); } if (t.options.enableAutosize) { t.media.addEventListener('loadedmetadata', function (e) { var target = e !== undefined ? e.detail.target || e.target : t.media; if (t.options.videoHeight <= 0 && !t.domNode.getAttribute('height') && !t.domNode.style.height && target !== null && !isNaN(target.videoHeight)) { t.setPlayerSize(target.videoWidth, target.videoHeight); t.setControlsSize(); t.media.setSize(target.videoWidth, target.videoHeight); } }); } } t.media.addEventListener('play', function () { t.hasFocus = true; for (var playerIndex in _mejs2.default.players) { if (_mejs2.default.players.hasOwnProperty(playerIndex)) { var p = _mejs2.default.players[playerIndex]; if (p.id !== t.id && t.options.pauseOtherPlayers && !p.paused && !p.ended) { p.pause(); p.hasFocus = false; } } } if (!(_constants.IS_ANDROID || _constants.IS_IOS) && !t.options.alwaysShowControls && t.isVideo) { t.hideControls(); } }); t.media.addEventListener('ended', function () { if (t.options.autoRewind) { try { t.setCurrentTime(0); setTimeout(function () { var loadingElement = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-loading'); if (loadingElement && loadingElement.parentNode) { loadingElement.parentNode.style.display = 'none'; } }, 20); } catch (exp) { } } if (typeof t.media.renderer.stop === 'function') { t.media.renderer.stop(); } else { t.pause(); } if (t.setProgressRail) { t.setProgressRail(); } if (t.setCurrentRail) { t.setCurrentRail(); } if (t.options.loop) { t.play(); } else if (!t.options.alwaysShowControls && t.controlsEnabled) { t.showControls(); } }); t.media.addEventListener('loadedmetadata', function () { (0, _time.calculateTimeFormat)(t.getDuration(), t.options, t.options.framesPerSecond || 25); if (t.updateDuration) { t.updateDuration(); } if (t.updateCurrent) { t.updateCurrent(); } if (!t.isFullScreen) { t.setPlayerSize(t.width, t.height); t.setControlsSize(); } }); var duration = null; t.media.addEventListener('timeupdate', function () { if (!isNaN(t.getDuration()) && duration !== t.getDuration()) { duration = t.getDuration(); (0, _time.calculateTimeFormat)(duration, t.options, t.options.framesPerSecond || 25); if (t.updateDuration) { t.updateDuration(); } if (t.updateCurrent) { t.updateCurrent(); } t.setControlsSize(); } }); t.getElement(t.container).addEventListener('click', function (e) { dom.addClass(e.currentTarget, t.options.classPrefix + 'container-keyboard-inactive'); }); t.getElement(t.container).addEventListener('focusin', function (e) { dom.removeClass(e.currentTarget, t.options.classPrefix + 'container-keyboard-inactive'); if (t.isVideo && !_constants.IS_ANDROID && !_constants.IS_IOS && t.controlsEnabled && !t.options.alwaysShowControls) { t.killControlsTimer('enter'); t.showControls(); t.startControlsTimer(t.options.controlsTimeoutMouseEnter); } }); t.getElement(t.container).addEventListener('focusout', function (e) { setTimeout(function () { if (e.relatedTarget) { if (t.keyboardAction && !e.relatedTarget.closest('.' + t.options.classPrefix + 'container')) { t.keyboardAction = false; if (t.isVideo && !t.options.alwaysShowControls && !t.paused) { t.startControlsTimer(t.options.controlsTimeoutMouseLeave); } } } }, 0); }); setTimeout(function () { t.setPlayerSize(t.width, t.height); t.setControlsSize(); }, 0); t.globalResizeCallback = function () { if (!(t.isFullScreen || _constants.HAS_TRUE_NATIVE_FULLSCREEN && _document2.default.webkitIsFullScreen)) { t.setPlayerSize(t.width, t.height); } t.setControlsSize(); }; t.globalBind('resize', t.globalResizeCallback); } if (autoplay && isNative) { t.play(); } if (t.options.success) { if (typeof t.options.success === 'string') { _window2.default[t.options.success](t.media, t.domNode, t); } else { t.options.success(t.media, t.domNode, t); } } } }, { key: '_handleError', value: function _handleError(e, media, node) { var t = this, play = t.getElement(t.layers).querySelector('.' + t.options.classPrefix + 'overlay-play'); if (play) { play.style.display = 'none'; } if (t.options.error) { t.options.error(e, media, node); } if (t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'cannotplay')) { t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'cannotplay').remove(); } var errorContainer = _document2.default.createElement('div'); errorContainer.className = t.options.classPrefix + 'cannotplay'; errorContainer.style.width = '100%'; errorContainer.style.height = '100%'; var errorContent = typeof t.options.customError === 'function' ? t.options.customError(t.media, t.media.originalNode) : t.options.customError, imgError = ''; if (!errorContent) { var poster = t.media.originalNode.getAttribute('poster'); if (poster) { imgError = '' + _mejs2.default.i18n.t('mejs.download-file') + ''; } if (e.message) { errorContent = '

    ' + e.message + '

    '; } if (e.urls) { for (var i = 0, total = e.urls.length; i < total; i++) { var url = e.urls[i]; errorContent += '' + _mejs2.default.i18n.t('mejs.download-file') + ': ' + url.src + ''; } } } if (errorContent && t.getElement(t.layers).querySelector('.' + t.options.classPrefix + 'overlay-error')) { errorContainer.innerHTML = errorContent; t.getElement(t.layers).querySelector('.' + t.options.classPrefix + 'overlay-error').innerHTML = '' + imgError + errorContainer.outerHTML; t.getElement(t.layers).querySelector('.' + t.options.classPrefix + 'overlay-error').parentNode.style.display = 'block'; } if (t.controlsEnabled) { t.disableControls(); } } }, { key: 'setPlayerSize', value: function setPlayerSize(width, height) { var t = this; if (!t.options.setDimensions) { return false; } if (typeof width !== 'undefined') { t.width = width; } if (typeof height !== 'undefined') { t.height = height; } switch (t.options.stretching) { case 'fill': if (t.isVideo) { t.setFillMode(); } else { t.setDimensions(t.width, t.height); } break; case 'responsive': t.setResponsiveMode(); break; case 'none': t.setDimensions(t.width, t.height); break; default: if (t.hasFluidMode() === true) { t.setResponsiveMode(); } else { t.setDimensions(t.width, t.height); } break; } } }, { key: 'hasFluidMode', value: function hasFluidMode() { var t = this; return t.height.toString().indexOf('%') !== -1 || t.node && t.node.style.maxWidth && t.node.style.maxWidth !== 'none' && t.node.style.maxWidth !== t.width || t.node && t.node.currentStyle && t.node.currentStyle.maxWidth === '100%'; } }, { key: 'setResponsiveMode', value: function setResponsiveMode() { var t = this, parent = function () { var parentEl = void 0, el = t.getElement(t.container); while (el) { try { if (_constants.IS_FIREFOX && el.tagName.toLowerCase() === 'html' && _window2.default.self !== _window2.default.top && _window2.default.frameElement !== null) { return _window2.default.frameElement; } else { parentEl = el.parentElement; } } catch (e) { parentEl = el.parentElement; } if (parentEl && dom.visible(parentEl)) { return parentEl; } el = parentEl; } return null; }(), parentStyles = parent ? getComputedStyle(parent, null) : getComputedStyle(_document2.default.body, null), nativeWidth = function () { if (t.isVideo) { if (t.node.videoWidth && t.node.videoWidth > 0) { return t.node.videoWidth; } else if (t.node.getAttribute('width')) { return t.node.getAttribute('width'); } else { return t.options.defaultVideoWidth; } } else { return t.options.defaultAudioWidth; } }(), nativeHeight = function () { if (t.isVideo) { if (t.node.videoHeight && t.node.videoHeight > 0) { return t.node.videoHeight; } else if (t.node.getAttribute('height')) { return t.node.getAttribute('height'); } else { return t.options.defaultVideoHeight; } } else { return t.options.defaultAudioHeight; } }(), aspectRatio = function () { var ratio = 1; if (!t.isVideo) { return ratio; } if (t.node.videoWidth && t.node.videoWidth > 0 && t.node.videoHeight && t.node.videoHeight > 0) { ratio = t.height >= t.width ? t.node.videoWidth / t.node.videoHeight : t.node.videoHeight / t.node.videoWidth; } else { ratio = t.initialAspectRatio; } if (isNaN(ratio) || ratio < 0.01 || ratio > 100) { ratio = 1; } return ratio; }(), parentHeight = parseFloat(parentStyles.height); var newHeight = void 0, parentWidth = parseFloat(parentStyles.width); if (t.isVideo) { if (t.height === '100%') { newHeight = parseFloat(parentWidth * nativeHeight / nativeWidth, 10); } else { newHeight = t.height >= t.width ? parseFloat(parentWidth / aspectRatio, 10) : parseFloat(parentWidth * aspectRatio, 10); } } else { newHeight = nativeHeight; } if (isNaN(newHeight)) { newHeight = parentHeight; } if (t.getElement(t.container).parentNode.length > 0 && t.getElement(t.container).parentNode.tagName.toLowerCase() === 'body') { parentWidth = _window2.default.innerWidth || _document2.default.documentElement.clientWidth || _document2.default.body.clientWidth; newHeight = _window2.default.innerHeight || _document2.default.documentElement.clientHeight || _document2.default.body.clientHeight; } if (newHeight && parentWidth) { t.getElement(t.container).style.width = parentWidth + 'px'; t.getElement(t.container).style.height = newHeight + 'px'; t.node.style.width = '100%'; t.node.style.height = '100%'; if (t.isVideo && t.media.setSize) { t.media.setSize(parentWidth, newHeight); } var layerChildren = t.getElement(t.layers).children; for (var i = 0, total = layerChildren.length; i < total; i++) { layerChildren[i].style.width = '100%'; layerChildren[i].style.height = '100%'; } } } }, { key: 'setFillMode', value: function setFillMode() { var t = this; var isIframe = _window2.default.self !== _window2.default.top && _window2.default.frameElement !== null; var parent = function () { var parentEl = void 0, el = t.getElement(t.container); while (el) { try { if (_constants.IS_FIREFOX && el.tagName.toLowerCase() === 'html' && _window2.default.self !== _window2.default.top && _window2.default.frameElement !== null) { return _window2.default.frameElement; } else { parentEl = el.parentElement; } } catch (e) { parentEl = el.parentElement; } if (parentEl && dom.visible(parentEl)) { return parentEl; } el = parentEl; } return null; }(); var parentStyles = parent ? getComputedStyle(parent, null) : getComputedStyle(_document2.default.body, null); if (t.node.style.height !== 'none' && t.node.style.height !== t.height) { t.node.style.height = 'auto'; } if (t.node.style.maxWidth !== 'none' && t.node.style.maxWidth !== t.width) { t.node.style.maxWidth = 'none'; } if (t.node.style.maxHeight !== 'none' && t.node.style.maxHeight !== t.height) { t.node.style.maxHeight = 'none'; } if (t.node.currentStyle) { if (t.node.currentStyle.height === '100%') { t.node.currentStyle.height = 'auto'; } if (t.node.currentStyle.maxWidth === '100%') { t.node.currentStyle.maxWidth = 'none'; } if (t.node.currentStyle.maxHeight === '100%') { t.node.currentStyle.maxHeight = 'none'; } } if (!isIframe && !parseFloat(parentStyles.width)) { parent.style.width = t.media.offsetWidth + 'px'; } if (!isIframe && !parseFloat(parentStyles.height)) { parent.style.height = t.media.offsetHeight + 'px'; } parentStyles = getComputedStyle(parent); var parentWidth = parseFloat(parentStyles.width), parentHeight = parseFloat(parentStyles.height); t.setDimensions('100%', '100%'); var poster = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'poster>img'); if (poster) { poster.style.display = ''; } var targetElement = t.getElement(t.container).querySelectorAll('object, embed, iframe, video'), initHeight = t.height, initWidth = t.width, scaleX1 = parentWidth, scaleY1 = initHeight * parentWidth / initWidth, scaleX2 = initWidth * parentHeight / initHeight, scaleY2 = parentHeight, bScaleOnWidth = scaleX2 > parentWidth === false, finalWidth = bScaleOnWidth ? Math.floor(scaleX1) : Math.floor(scaleX2), finalHeight = bScaleOnWidth ? Math.floor(scaleY1) : Math.floor(scaleY2), width = bScaleOnWidth ? parentWidth + 'px' : finalWidth + 'px', height = bScaleOnWidth ? finalHeight + 'px' : parentHeight + 'px'; for (var i = 0, total = targetElement.length; i < total; i++) { targetElement[i].style.height = height; targetElement[i].style.width = width; if (t.media.setSize) { t.media.setSize(width, height); } targetElement[i].style.marginLeft = Math.floor((parentWidth - finalWidth) / 2) + 'px'; targetElement[i].style.marginTop = 0; } } }, { key: 'setDimensions', value: function setDimensions(width, height) { var t = this; width = (0, _general.isString)(width) && width.indexOf('%') > -1 ? width : parseFloat(width) + 'px'; height = (0, _general.isString)(height) && height.indexOf('%') > -1 ? height : parseFloat(height) + 'px'; t.getElement(t.container).style.width = width; t.getElement(t.container).style.height = height; var layers = t.getElement(t.layers).children; for (var i = 0, total = layers.length; i < total; i++) { layers[i].style.width = width; layers[i].style.height = height; } } }, { key: 'setControlsSize', value: function setControlsSize() { var t = this; if (!dom.visible(t.getElement(t.container))) { return; } if (t.rail && dom.visible(t.rail)) { var totalStyles = t.total ? getComputedStyle(t.total, null) : null, totalMargin = totalStyles ? parseFloat(totalStyles.marginLeft) + parseFloat(totalStyles.marginRight) : 0, railStyles = getComputedStyle(t.rail), railMargin = parseFloat(railStyles.marginLeft) + parseFloat(railStyles.marginRight); var siblingsWidth = 0; var siblings = dom.siblings(t.rail, function (el) { return el !== t.rail; }), total = siblings.length; for (var i = 0; i < total; i++) { siblingsWidth += siblings[i].offsetWidth; } siblingsWidth += totalMargin + (totalMargin === 0 ? railMargin * 2 : railMargin) + 1; t.getElement(t.container).style.minWidth = siblingsWidth + 'px'; var event = (0, _general.createEvent)('controlsresize', t.getElement(t.container)); t.getElement(t.container).dispatchEvent(event); } else { var children = t.getElement(t.controls).children; var minWidth = 0; for (var _i = 0, _total = children.length; _i < _total; _i++) { minWidth += children[_i].offsetWidth; } t.getElement(t.container).style.minWidth = minWidth + 'px'; } } }, { key: 'addControlElement', value: function addControlElement(element, key) { var t = this; if (t.featurePosition[key] !== undefined) { var child = t.getElement(t.controls).children[t.featurePosition[key] - 1]; child.parentNode.insertBefore(element, child.nextSibling); } else { t.getElement(t.controls).appendChild(element); var children = t.getElement(t.controls).children; for (var i = 0, total = children.length; i < total; i++) { if (element === children[i]) { t.featurePosition[key] = i; break; } } } } }, { key: 'createIframeLayer', value: function createIframeLayer() { var t = this; if (t.isVideo && t.media.rendererName !== null && t.media.rendererName.indexOf('iframe') > -1 && !_document2.default.getElementById(t.media.id + '-iframe-overlay')) { var layer = _document2.default.createElement('div'), target = _document2.default.getElementById(t.media.id + '_' + t.media.rendererName); layer.id = t.media.id + '-iframe-overlay'; layer.className = t.options.classPrefix + 'iframe-overlay'; layer.addEventListener('click', function (e) { if (t.options.clickToPlayPause) { if (t.paused) { t.play(); } else { t.pause(); } e.preventDefault(); e.stopPropagation(); } }); target.parentNode.insertBefore(layer, target); } } }, { key: 'resetSize', value: function resetSize() { var t = this; setTimeout(function () { t.setPlayerSize(t.width, t.height); t.setControlsSize(); }, 50); } }, { key: 'setPoster', value: function setPoster(url) { var t = this; if (t.getElement(t.container)) { var posterDiv = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'poster'); if (!posterDiv) { posterDiv = _document2.default.createElement('div'); posterDiv.className = t.options.classPrefix + 'poster ' + t.options.classPrefix + 'layer'; t.getElement(t.layers).appendChild(posterDiv); } var posterImg = posterDiv.querySelector('img'); if (!posterImg && url) { posterImg = _document2.default.createElement('img'); posterImg.className = t.options.classPrefix + 'poster-img'; posterImg.width = '100%'; posterImg.height = '100%'; posterDiv.style.display = ''; posterDiv.appendChild(posterImg); } if (url) { posterImg.setAttribute('src', url); posterDiv.style.backgroundImage = 'url("' + url + '")'; posterDiv.style.display = ''; } else if (posterImg) { posterDiv.style.backgroundImage = 'none'; posterDiv.style.display = 'none'; posterImg.remove(); } else { posterDiv.style.display = 'none'; } } else if (_constants.IS_IPAD && t.options.iPadUseNativeControls || _constants.IS_IPHONE && t.options.iPhoneUseNativeControls || _constants.IS_ANDROID && t.options.AndroidUseNativeControls) { t.media.originalNode.poster = url; } } }, { key: 'changeSkin', value: function changeSkin(className) { var t = this; t.getElement(t.container).className = t.options.classPrefix + 'container ' + className; t.setPlayerSize(t.width, t.height); t.setControlsSize(); } }, { key: 'globalBind', value: function globalBind(events, callback) { var t = this, doc = t.node ? t.node.ownerDocument : _document2.default; events = (0, _general.splitEvents)(events, t.id); if (events.d) { var eventList = events.d.split(' '); for (var i = 0, total = eventList.length; i < total; i++) { eventList[i].split('.').reduce(function (part, e) { doc.addEventListener(e, callback, false); return e; }, ''); } } if (events.w) { var _eventList = events.w.split(' '); for (var _i2 = 0, _total2 = _eventList.length; _i2 < _total2; _i2++) { _eventList[_i2].split('.').reduce(function (part, e) { _window2.default.addEventListener(e, callback, false); return e; }, ''); } } } }, { key: 'globalUnbind', value: function globalUnbind(events, callback) { var t = this, doc = t.node ? t.node.ownerDocument : _document2.default; events = (0, _general.splitEvents)(events, t.id); if (events.d) { var eventList = events.d.split(' '); for (var i = 0, total = eventList.length; i < total; i++) { eventList[i].split('.').reduce(function (part, e) { doc.removeEventListener(e, callback, false); return e; }, ''); } } if (events.w) { var _eventList2 = events.w.split(' '); for (var _i3 = 0, _total3 = _eventList2.length; _i3 < _total3; _i3++) { _eventList2[_i3].split('.').reduce(function (part, e) { _window2.default.removeEventListener(e, callback, false); return e; }, ''); } } } }, { key: 'buildfeatures', value: function buildfeatures(player, controls, layers, media) { var t = this; for (var i = 0, total = t.options.features.length; i < total; i++) { var feature = t.options.features[i]; if (t['build' + feature]) { try { t['build' + feature](player, controls, layers, media); } catch (e) { console.error('error building ' + feature, e); } } } } }, { key: 'buildposter', value: function buildposter(player, controls, layers, media) { var t = this, poster = _document2.default.createElement('div'); poster.className = t.options.classPrefix + 'poster ' + t.options.classPrefix + 'layer'; layers.appendChild(poster); var posterUrl = media.originalNode.getAttribute('poster'); if (player.options.poster !== '') { if (posterUrl && _constants.IS_IOS) { media.originalNode.removeAttribute('poster'); } posterUrl = player.options.poster; } if (posterUrl) { t.setPoster(posterUrl); } else if (t.media.renderer !== null && typeof t.media.renderer.getPosterUrl === 'function') { t.setPoster(t.media.renderer.getPosterUrl()); } else { poster.style.display = 'none'; } media.addEventListener('play', function () { poster.style.display = 'none'; }); media.addEventListener('playing', function () { poster.style.display = 'none'; }); if (player.options.showPosterWhenEnded && player.options.autoRewind) { media.addEventListener('ended', function () { poster.style.display = ''; }); } media.addEventListener('error', function () { poster.style.display = 'none'; }); if (player.options.showPosterWhenPaused) { media.addEventListener('pause', function () { if (!player.ended) { poster.style.display = ''; } }); } } }, { key: 'buildoverlays', value: function buildoverlays(player, controls, layers, media) { if (!player.isVideo) { return; } var t = this, loading = _document2.default.createElement('div'), error = _document2.default.createElement('div'), bigPlay = _document2.default.createElement('div'); loading.style.display = 'none'; loading.className = t.options.classPrefix + 'overlay ' + t.options.classPrefix + 'layer'; loading.innerHTML = '
    ' + ('') + '
    '; layers.appendChild(loading); error.style.display = 'none'; error.className = t.options.classPrefix + 'overlay ' + t.options.classPrefix + 'layer'; error.innerHTML = '
    '; layers.appendChild(error); bigPlay.className = t.options.classPrefix + 'overlay ' + t.options.classPrefix + 'layer ' + t.options.classPrefix + 'overlay-play'; bigPlay.innerHTML = '
    '); bigPlay.addEventListener('click', function () { if (t.options.clickToPlayPause) { var button = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-button'), pressed = button.getAttribute('aria-pressed'); if (t.paused) { t.play(); } else { t.pause(); } button.setAttribute('aria-pressed', !!pressed); t.getElement(t.container).focus(); } }); bigPlay.addEventListener('keydown', function (e) { var keyPressed = e.keyCode || e.which || 0; if (keyPressed === 13 || _constants.IS_FIREFOX && keyPressed === 32) { var event = (0, _general.createEvent)('click', bigPlay); bigPlay.dispatchEvent(event); return false; } }); layers.appendChild(bigPlay); if (t.media.rendererName !== null && (/(youtube|facebook)/i.test(t.media.rendererName) && !(t.media.originalNode.getAttribute('poster') || player.options.poster || typeof t.media.renderer.getPosterUrl === 'function' && t.media.renderer.getPosterUrl()) || _constants.IS_STOCK_ANDROID || t.media.originalNode.getAttribute('autoplay'))) { bigPlay.style.display = 'none'; } var hasError = false; media.addEventListener('play', function () { bigPlay.style.display = 'none'; loading.style.display = 'none'; error.style.display = 'none'; hasError = false; }); media.addEventListener('playing', function () { bigPlay.style.display = 'none'; loading.style.display = 'none'; error.style.display = 'none'; hasError = false; }); media.addEventListener('seeking', function () { bigPlay.style.display = 'none'; loading.style.display = ''; hasError = false; }); media.addEventListener('seeked', function () { bigPlay.style.display = t.paused && !_constants.IS_STOCK_ANDROID ? '' : 'none'; loading.style.display = 'none'; hasError = false; }); media.addEventListener('pause', function () { loading.style.display = 'none'; if (!_constants.IS_STOCK_ANDROID && !hasError) { bigPlay.style.display = ''; } hasError = false; }); media.addEventListener('waiting', function () { loading.style.display = ''; hasError = false; }); media.addEventListener('loadeddata', function () { loading.style.display = ''; if (_constants.IS_ANDROID) { media.canplayTimeout = setTimeout(function () { if (_document2.default.createEvent) { var evt = _document2.default.createEvent('HTMLEvents'); evt.initEvent('canplay', true, true); return media.dispatchEvent(evt); } }, 300); } hasError = false; }); media.addEventListener('canplay', function () { loading.style.display = 'none'; clearTimeout(media.canplayTimeout); hasError = false; }); media.addEventListener('error', function (e) { t._handleError(e, t.media, t.node); loading.style.display = 'none'; bigPlay.style.display = 'none'; hasError = true; }); media.addEventListener('loadedmetadata', function () { if (!t.controlsEnabled) { t.enableControls(); } }); media.addEventListener('keydown', function (e) { t.onkeydown(player, media, e); hasError = false; }); } }, { key: 'buildkeyboard', value: function buildkeyboard(player, controls, layers, media) { var t = this; t.getElement(t.container).addEventListener('keydown', function () { t.keyboardAction = true; }); t.globalKeydownCallback = function (event) { var container = _document2.default.activeElement.closest('.' + t.options.classPrefix + 'container'), target = t.media.closest('.' + t.options.classPrefix + 'container'); t.hasFocus = !!(container && target && container.id === target.id); return t.onkeydown(player, media, event); }; t.globalClickCallback = function (event) { t.hasFocus = !!event.target.closest('.' + t.options.classPrefix + 'container'); }; t.globalBind('keydown', t.globalKeydownCallback); t.globalBind('click', t.globalClickCallback); } }, { key: 'onkeydown', value: function onkeydown(player, media, e) { if (player.hasFocus && player.options.enableKeyboard) { for (var i = 0, total = player.options.keyActions.length; i < total; i++) { var keyAction = player.options.keyActions[i]; for (var j = 0, jl = keyAction.keys.length; j < jl; j++) { if (e.keyCode === keyAction.keys[j]) { keyAction.action(player, media, e.keyCode, e); e.preventDefault(); e.stopPropagation(); return; } } } } return true; } }, { key: 'play', value: function play() { this.proxy.play(); } }, { key: 'pause', value: function pause() { this.proxy.pause(); } }, { key: 'load', value: function load() { this.proxy.load(); } }, { key: 'setCurrentTime', value: function setCurrentTime(time) { this.proxy.setCurrentTime(time); } }, { key: 'getCurrentTime', value: function getCurrentTime() { return this.proxy.currentTime; } }, { key: 'getDuration', value: function getDuration() { return this.proxy.duration; } }, { key: 'setVolume', value: function setVolume(volume) { this.proxy.volume = volume; } }, { key: 'getVolume', value: function getVolume() { return this.proxy.getVolume(); } }, { key: 'setMuted', value: function setMuted(value) { this.proxy.setMuted(value); } }, { key: 'setSrc', value: function setSrc(src) { if (!this.controlsEnabled) { this.enableControls(); } this.proxy.setSrc(src); } }, { key: 'getSrc', value: function getSrc() { return this.proxy.getSrc(); } }, { key: 'canPlayType', value: function canPlayType(type) { return this.proxy.canPlayType(type); } }, { key: 'remove', value: function remove() { var t = this, rendererName = t.media.rendererName, src = t.media.originalNode.src; for (var featureIndex in t.options.features) { var feature = t.options.features[featureIndex]; if (t['clean' + feature]) { try { t['clean' + feature](t, t.getElement(t.layers), t.getElement(t.controls), t.media); } catch (e) { console.error('error cleaning ' + feature, e); } } } var nativeWidth = t.node.getAttribute('width'), nativeHeight = t.node.getAttribute('height'); if (nativeWidth) { if (nativeWidth.indexOf('%') === -1) { nativeWidth = nativeWidth + 'px'; } } else { nativeWidth = 'auto'; } if (nativeHeight) { if (nativeHeight.indexOf('%') === -1) { nativeHeight = nativeHeight + 'px'; } } else { nativeHeight = 'auto'; } t.node.style.width = nativeWidth; t.node.style.height = nativeHeight; t.setPlayerSize(0, 0); if (!t.isDynamic) { (function () { t.node.setAttribute('controls', true); t.node.setAttribute('id', t.node.getAttribute('id').replace('_' + rendererName, '').replace('_from_mejs', '')); var poster = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'poster>img'); if (poster) { t.node.setAttribute('poster', poster.src); } delete t.node.autoplay; t.node.setAttribute('src', ''); if (t.media.canPlayType((0, _media.getTypeFromFile)(src)) !== '') { t.node.setAttribute('src', src); } if (rendererName && rendererName.indexOf('iframe') > -1) { var layer = _document2.default.getElementById(t.media.id + '-iframe-overlay'); layer.remove(); } var node = t.node.cloneNode(); node.style.display = ''; t.getElement(t.container).parentNode.insertBefore(node, t.getElement(t.container)); t.node.remove(); if (t.mediaFiles) { for (var i = 0, total = t.mediaFiles.length; i < total; i++) { var source = _document2.default.createElement('source'); source.setAttribute('src', t.mediaFiles[i].src); source.setAttribute('type', t.mediaFiles[i].type); node.appendChild(source); } } if (t.trackFiles) { var _loop3 = function _loop3(_i4, _total4) { var track = t.trackFiles[_i4]; var newTrack = _document2.default.createElement('track'); newTrack.kind = track.kind; newTrack.label = track.label; newTrack.srclang = track.srclang; newTrack.src = track.src; node.appendChild(newTrack); newTrack.addEventListener('load', function () { this.mode = 'showing'; node.textTracks[_i4].mode = 'showing'; }); }; for (var _i4 = 0, _total4 = t.trackFiles.length; _i4 < _total4; _i4++) { _loop3(_i4, _total4); } } delete t.node; delete t.mediaFiles; delete t.trackFiles; })(); } else { t.getElement(t.container).parentNode.insertBefore(t.node, t.getElement(t.container)); } if (t.media.renderer && typeof t.media.renderer.destroy === 'function') { t.media.renderer.destroy(); } delete _mejs2.default.players[t.id]; if (_typeof(t.getElement(t.container)) === 'object') { var offscreen = t.getElement(t.container).parentNode.querySelector('.' + t.options.classPrefix + 'offscreen'); offscreen.remove(); t.getElement(t.container).remove(); } t.globalUnbind('resize', t.globalResizeCallback); t.globalUnbind('keydown', t.globalKeydownCallback); t.globalUnbind('click', t.globalClickCallback); delete t.media.player; } }, { key: 'paused', get: function get() { return this.proxy.paused; } }, { key: 'muted', get: function get() { return this.proxy.muted; }, set: function set(muted) { this.setMuted(muted); } }, { key: 'ended', get: function get() { return this.proxy.ended; } }, { key: 'readyState', get: function get() { return this.proxy.readyState; } }, { key: 'currentTime', set: function set(time) { this.setCurrentTime(time); }, get: function get() { return this.getCurrentTime(); } }, { key: 'duration', get: function get() { return this.getDuration(); } }, { key: 'volume', set: function set(volume) { this.setVolume(volume); }, get: function get() { return this.getVolume(); } }, { key: 'src', set: function set(src) { this.setSrc(src); }, get: function get() { return this.getSrc(); } }]); return MediaElementPlayer; }(); _window2.default.MediaElementPlayer = MediaElementPlayer; _mejs2.default.MediaElementPlayer = MediaElementPlayer; exports.default = MediaElementPlayer; },{"17":17,"2":2,"25":25,"26":26,"27":27,"28":28,"3":3,"30":30,"5":5,"6":6,"7":7}],17:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); 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"); } } var DefaultPlayer = function () { function DefaultPlayer(player) { _classCallCheck(this, DefaultPlayer); this.media = player.media; this.isVideo = player.isVideo; this.classPrefix = player.options.classPrefix; this.createIframeLayer = function () { return player.createIframeLayer(); }; this.setPoster = function (url) { return player.setPoster(url); }; return this; } _createClass(DefaultPlayer, [{ key: 'play', value: function play() { this.media.play(); } }, { key: 'pause', value: function pause() { this.media.pause(); } }, { key: 'load', value: function load() { var t = this; if (!t.isLoaded) { t.media.load(); } t.isLoaded = true; } }, { key: 'setCurrentTime', value: function setCurrentTime(time) { this.media.setCurrentTime(time); } }, { key: 'getCurrentTime', value: function getCurrentTime() { return this.media.currentTime; } }, { key: 'getDuration', value: function getDuration() { return this.media.getDuration(); } }, { key: 'setVolume', value: function setVolume(volume) { this.media.setVolume(volume); } }, { key: 'getVolume', value: function getVolume() { return this.media.getVolume(); } }, { key: 'setMuted', value: function setMuted(value) { this.media.setMuted(value); } }, { key: 'setSrc', value: function setSrc(src) { var t = this, layer = document.getElementById(t.media.id + '-iframe-overlay'); if (layer) { layer.remove(); } t.media.setSrc(src); t.createIframeLayer(); if (t.media.renderer !== null && typeof t.media.renderer.getPosterUrl === 'function') { t.setPoster(t.media.renderer.getPosterUrl()); } } }, { key: 'getSrc', value: function getSrc() { return this.media.getSrc(); } }, { key: 'canPlayType', value: function canPlayType(type) { return this.media.canPlayType(type); } }, { key: 'paused', get: function get() { return this.media.paused; } }, { key: 'muted', set: function set(muted) { this.setMuted(muted); }, get: function get() { return this.media.muted; } }, { key: 'ended', get: function get() { return this.media.ended; } }, { key: 'readyState', get: function get() { return this.media.readyState; } }, { key: 'currentTime', set: function set(time) { this.setCurrentTime(time); }, get: function get() { return this.getCurrentTime(); } }, { key: 'duration', get: function get() { return this.getDuration(); } }, { key: 'remainingTime', get: function get() { return this.getDuration() - this.currentTime(); } }, { key: 'volume', set: function set(volume) { this.setVolume(volume); }, get: function get() { return this.getVolume(); } }, { key: 'src', set: function set(src) { this.setSrc(src); }, get: function get() { return this.getSrc(); } }]); return DefaultPlayer; }(); exports.default = DefaultPlayer; _window2.default.DefaultPlayer = DefaultPlayer; },{"3":3}],18:[function(_dereq_,module,exports){ 'use strict'; var _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); var _player = _dereq_(16); var _player2 = _interopRequireDefault(_player); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } if (typeof jQuery !== 'undefined') { _mejs2.default.$ = _window2.default.jQuery = _window2.default.$ = jQuery; } else if (typeof Zepto !== 'undefined') { _mejs2.default.$ = _window2.default.Zepto = _window2.default.$ = Zepto; } else if (typeof ender !== 'undefined') { _mejs2.default.$ = _window2.default.ender = _window2.default.$ = ender; } (function ($) { if (typeof $ !== 'undefined') { $.fn.mediaelementplayer = function (options) { if (options === false) { this.each(function () { var player = $(this).data('mediaelementplayer'); if (player) { player.remove(); } $(this).removeData('mediaelementplayer'); }); } else { this.each(function () { $(this).data('mediaelementplayer', new _player2.default(this, options)); }); } return this; }; $(document).ready(function () { $('.' + _mejs2.default.MepDefaults.classPrefix + 'player').mediaelementplayer(); }); } })(_mejs2.default.$); },{"16":16,"3":3,"7":7}],19:[function(_dereq_,module,exports){ '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 _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); var _renderer = _dereq_(8); var _general = _dereq_(27); var _media = _dereq_(28); var _constants = _dereq_(25); var _dom = _dereq_(26); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var NativeDash = { promise: null, load: function load(settings) { if (typeof dashjs !== 'undefined') { NativeDash.promise = new Promise(function (resolve) { resolve(); }).then(function () { NativeDash._createPlayer(settings); }); } else { settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdn.dashjs.org/latest/dash.all.min.js'; NativeDash.promise = NativeDash.promise || (0, _dom.loadScript)(settings.options.path); NativeDash.promise.then(function () { NativeDash._createPlayer(settings); }); } return NativeDash.promise; }, _createPlayer: function _createPlayer(settings) { var player = dashjs.MediaPlayer().create(); _window2.default['__ready__' + settings.id](player); return player; } }; var DashNativeRenderer = { name: 'native_dash', options: { prefix: 'native_dash', dash: { path: 'https://cdn.dashjs.org/latest/dash.all.min.js', debug: false, drm: {}, robustnessLevel: '' } }, canPlayType: function canPlayType(type) { return _constants.HAS_MSE && ['application/dash+xml'].indexOf(type.toLowerCase()) > -1; }, create: function create(mediaElement, options, mediaFiles) { var originalNode = mediaElement.originalNode, id = mediaElement.id + '_' + options.prefix, autoplay = originalNode.autoplay, children = originalNode.children; var node = null, dashPlayer = null; originalNode.removeAttribute('type'); for (var i = 0, total = children.length; i < total; i++) { children[i].removeAttribute('type'); } node = originalNode.cloneNode(true); options = Object.assign(options, mediaElement.options); var props = _mejs2.default.html5media.properties, events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) { return e !== 'error'; }), attachNativeEvents = function attachNativeEvents(e) { var event = (0, _general.createEvent)(e.type, mediaElement); mediaElement.dispatchEvent(event); }, assignGettersSetters = function assignGettersSetters(propName) { var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); node['get' + capName] = function () { return dashPlayer !== null ? node[propName] : null; }; node['set' + capName] = function (value) { if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) { if (propName === 'src') { var source = (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src ? value.src : value; node[propName] = source; if (dashPlayer !== null) { dashPlayer.reset(); for (var _i = 0, _total = events.length; _i < _total; _i++) { node.removeEventListener(events[_i], attachNativeEvents); } dashPlayer = NativeDash._createPlayer({ options: options.dash, id: id }); if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && _typeof(value.drm) === 'object') { dashPlayer.setProtectionData(value.drm); if ((0, _general.isString)(options.dash.robustnessLevel) && options.dash.robustnessLevel) { dashPlayer.getProtectionController().setRobustnessLevel(options.dash.robustnessLevel); } } dashPlayer.attachSource(source); if (autoplay) { dashPlayer.play(); } } } else { node[propName] = value; } } }; }; for (var _i2 = 0, _total2 = props.length; _i2 < _total2; _i2++) { assignGettersSetters(props[_i2]); } _window2.default['__ready__' + id] = function (_dashPlayer) { mediaElement.dashPlayer = dashPlayer = _dashPlayer; var dashEvents = dashjs.MediaPlayer.events, assignEvents = function assignEvents(eventName) { if (eventName === 'loadedmetadata') { dashPlayer.getDebug().setLogToBrowserConsole(options.dash.debug); dashPlayer.initialize(); dashPlayer.setScheduleWhilePaused(false); dashPlayer.setFastSwitchEnabled(true); dashPlayer.attachView(node); dashPlayer.setAutoPlay(false); if (_typeof(options.dash.drm) === 'object' && !_mejs2.default.Utils.isObjectEmpty(options.dash.drm)) { dashPlayer.setProtectionData(options.dash.drm); if ((0, _general.isString)(options.dash.robustnessLevel) && options.dash.robustnessLevel) { dashPlayer.getProtectionController().setRobustnessLevel(options.dash.robustnessLevel); } } dashPlayer.attachSource(node.getSrc()); } node.addEventListener(eventName, attachNativeEvents); }; for (var _i3 = 0, _total3 = events.length; _i3 < _total3; _i3++) { assignEvents(events[_i3]); } var assignMdashEvents = function assignMdashEvents(e) { if (e.type.toLowerCase() === 'error') { mediaElement.generateError(e.message, node.src); console.error(e); } else { var _event = (0, _general.createEvent)(e.type, mediaElement); _event.data = e; mediaElement.dispatchEvent(_event); } }; for (var eventType in dashEvents) { if (dashEvents.hasOwnProperty(eventType)) { dashPlayer.on(dashEvents[eventType], function (e) { return assignMdashEvents(e); }); } } }; if (mediaFiles && mediaFiles.length > 0) { for (var _i4 = 0, _total4 = mediaFiles.length; _i4 < _total4; _i4++) { if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[_i4].type)) { node.setAttribute('src', mediaFiles[_i4].src); if (typeof mediaFiles[_i4].drm !== 'undefined') { options.dash.drm = mediaFiles[_i4].drm; } break; } } } node.setAttribute('id', id); originalNode.parentNode.insertBefore(node, originalNode); originalNode.autoplay = false; originalNode.style.display = 'none'; node.setSize = function (width, height) { node.style.width = width + 'px'; node.style.height = height + 'px'; return node; }; node.hide = function () { node.pause(); node.style.display = 'none'; return node; }; node.show = function () { node.style.display = ''; return node; }; node.destroy = function () { if (dashPlayer !== null) { dashPlayer.reset(); } }; var event = (0, _general.createEvent)('rendererready', node); mediaElement.dispatchEvent(event); mediaElement.promises.push(NativeDash.load({ options: options.dash, id: id })); return node; } }; _media.typeChecks.push(function (url) { return ~url.toLowerCase().indexOf('.mpd') ? 'application/dash+xml' : null; }); _renderer.renderer.add(DashNativeRenderer); },{"25":25,"26":26,"27":27,"28":28,"3":3,"7":7,"8":8}],20:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.PluginDetector = undefined; 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 _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); var _i18n = _dereq_(5); var _i18n2 = _interopRequireDefault(_i18n); var _renderer = _dereq_(8); var _general = _dereq_(27); var _constants = _dereq_(25); var _media = _dereq_(28); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var PluginDetector = exports.PluginDetector = { plugins: [], hasPluginVersion: function hasPluginVersion(plugin, v) { var pv = PluginDetector.plugins[plugin]; v[1] = v[1] || 0; v[2] = v[2] || 0; return pv[0] > v[0] || pv[0] === v[0] && pv[1] > v[1] || pv[0] === v[0] && pv[1] === v[1] && pv[2] >= v[2]; }, addPlugin: function addPlugin(p, pluginName, mimeType, activeX, axDetect) { PluginDetector.plugins[p] = PluginDetector.detectPlugin(pluginName, mimeType, activeX, axDetect); }, detectPlugin: function detectPlugin(pluginName, mimeType, activeX, axDetect) { var version = [0, 0, 0], description = void 0, ax = void 0; if (_constants.NAV.plugins !== null && _constants.NAV.plugins !== undefined && _typeof(_constants.NAV.plugins[pluginName]) === 'object') { description = _constants.NAV.plugins[pluginName].description; if (description && !(typeof _constants.NAV.mimeTypes !== 'undefined' && _constants.NAV.mimeTypes[mimeType] && !_constants.NAV.mimeTypes[mimeType].enabledPlugin)) { version = description.replace(pluginName, '').replace(/^\s+/, '').replace(/\sr/gi, '.').split('.'); for (var i = 0, total = version.length; i < total; i++) { version[i] = parseInt(version[i].match(/\d+/), 10); } } } else if (_window2.default.ActiveXObject !== undefined) { try { ax = new ActiveXObject(activeX); if (ax) { version = axDetect(ax); } } catch (e) { } } return version; } }; PluginDetector.addPlugin('flash', 'Shockwave Flash', 'application/x-shockwave-flash', 'ShockwaveFlash.ShockwaveFlash', function (ax) { var version = [], d = ax.GetVariable("$version"); if (d) { d = d.split(" ")[1].split(","); version = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; } return version; }); var FlashMediaElementRenderer = { create: function create(mediaElement, options, mediaFiles) { var flash = {}; var isActive = false; flash.options = options; flash.id = mediaElement.id + '_' + flash.options.prefix; flash.mediaElement = mediaElement; flash.flashState = {}; flash.flashApi = null; flash.flashApiStack = []; var props = _mejs2.default.html5media.properties, assignGettersSetters = function assignGettersSetters(propName) { flash.flashState[propName] = null; var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); flash['get' + capName] = function () { if (flash.flashApi !== null) { if (typeof flash.flashApi['get_' + propName] === 'function') { var value = flash.flashApi['get_' + propName](); if (propName === 'buffered') { return { start: function start() { return 0; }, end: function end() { return value; }, length: 1 }; } return value; } else { return null; } } else { return null; } }; flash['set' + capName] = function (value) { if (propName === 'src') { value = (0, _media.absolutizeUrl)(value); } if (flash.flashApi !== null && flash.flashApi['set_' + propName] !== undefined) { try { flash.flashApi['set_' + propName](value); } catch (e) { } } else { flash.flashApiStack.push({ type: 'set', propName: propName, value: value }); } }; }; for (var i = 0, total = props.length; i < total; i++) { assignGettersSetters(props[i]); } var methods = _mejs2.default.html5media.methods, assignMethods = function assignMethods(methodName) { flash[methodName] = function () { if (isActive) { if (flash.flashApi !== null) { if (flash.flashApi['fire_' + methodName]) { try { flash.flashApi['fire_' + methodName](); } catch (e) { } } else { } } else { flash.flashApiStack.push({ type: 'call', methodName: methodName }); } } }; }; methods.push('stop'); for (var _i = 0, _total = methods.length; _i < _total; _i++) { assignMethods(methods[_i]); } var initEvents = ['rendererready']; for (var _i2 = 0, _total2 = initEvents.length; _i2 < _total2; _i2++) { var event = (0, _general.createEvent)(initEvents[_i2], flash); mediaElement.dispatchEvent(event); } _window2.default['__ready__' + flash.id] = function () { flash.flashReady = true; flash.flashApi = _document2.default.getElementById('__' + flash.id); if (flash.flashApiStack.length) { for (var _i3 = 0, _total3 = flash.flashApiStack.length; _i3 < _total3; _i3++) { var stackItem = flash.flashApiStack[_i3]; if (stackItem.type === 'set') { var propName = stackItem.propName, capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); flash['set' + capName](stackItem.value); } else if (stackItem.type === 'call') { flash[stackItem.methodName](); } } } }; _window2.default['__event__' + flash.id] = function (eventName, message) { var event = (0, _general.createEvent)(eventName, flash); if (message) { try { event.data = JSON.parse(message); event.details.data = JSON.parse(message); } catch (e) { event.message = message; } } flash.mediaElement.dispatchEvent(event); }; flash.flashWrapper = _document2.default.createElement('div'); if (['always', 'sameDomain'].indexOf(flash.options.shimScriptAccess) === -1) { flash.options.shimScriptAccess = 'sameDomain'; } var autoplay = mediaElement.originalNode.autoplay, flashVars = ['uid=' + flash.id, 'autoplay=' + autoplay, 'allowScriptAccess=' + flash.options.shimScriptAccess, 'preload=' + (mediaElement.originalNode.getAttribute('preload') || '')], isVideo = mediaElement.originalNode !== null && mediaElement.originalNode.tagName.toLowerCase() === 'video', flashHeight = isVideo ? mediaElement.originalNode.height : 1, flashWidth = isVideo ? mediaElement.originalNode.width : 1; if (mediaElement.originalNode.getAttribute('src')) { flashVars.push('src=' + mediaElement.originalNode.getAttribute('src')); } if (flash.options.enablePseudoStreaming === true) { flashVars.push('pseudostreamstart=' + flash.options.pseudoStreamingStartQueryParam); flashVars.push('pseudostreamtype=' + flash.options.pseudoStreamingType); } if (flash.options.streamDelimiter) { flashVars.push('streamdelimiter=' + encodeURIComponent(flash.options.streamDelimiter)); } if (flash.options.proxyType) { flashVars.push('proxytype=' + flash.options.proxyType); } mediaElement.appendChild(flash.flashWrapper); mediaElement.originalNode.style.display = 'none'; var settings = []; if (_constants.IS_IE || _constants.IS_EDGE) { var specialIEContainer = _document2.default.createElement('div'); flash.flashWrapper.appendChild(specialIEContainer); if (_constants.IS_EDGE) { settings = ['type="application/x-shockwave-flash"', 'data="' + flash.options.pluginPath + flash.options.filename + '"', 'id="__' + flash.id + '"', 'width="' + flashWidth + '"', 'height="' + flashHeight + '\'"']; } else { settings = ['classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"', 'codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"', 'id="__' + flash.id + '"', 'width="' + flashWidth + '"', 'height="' + flashHeight + '"']; } if (!isVideo) { settings.push('style="clip: rect(0 0 0 0); position: absolute;"'); } specialIEContainer.outerHTML = '' + ('') + ('') + '' + '' + '' + ('') + '' + ('
    ' + _i18n2.default.t('mejs.install-flash') + '
    ') + '
    '; } else { settings = ['id="__' + flash.id + '"', 'name="__' + flash.id + '"', 'play="true"', 'loop="false"', 'quality="high"', 'bgcolor="#000000"', 'wmode="transparent"', 'allowScriptAccess="' + flash.options.shimScriptAccess + '"', 'allowFullScreen="true"', 'type="application/x-shockwave-flash"', 'pluginspage="//www.macromedia.com/go/getflashplayer"', 'src="' + flash.options.pluginPath + flash.options.filename + '"', 'flashvars="' + flashVars.join('&') + '"']; if (isVideo) { settings.push('width="' + flashWidth + '"'); settings.push('height="' + flashHeight + '"'); } else { settings.push('style="position: fixed; left: -9999em; top: -9999em;"'); } flash.flashWrapper.innerHTML = ''; } flash.flashNode = flash.flashWrapper.lastChild; flash.hide = function () { isActive = false; if (isVideo) { flash.flashNode.style.display = 'none'; } }; flash.show = function () { isActive = true; if (isVideo) { flash.flashNode.style.display = ''; } }; flash.setSize = function (width, height) { flash.flashNode.style.width = width + 'px'; flash.flashNode.style.height = height + 'px'; if (flash.flashApi !== null && typeof flash.flashApi.fire_setSize === 'function') { flash.flashApi.fire_setSize(width, height); } }; flash.destroy = function () { flash.flashNode.remove(); }; if (mediaFiles && mediaFiles.length > 0) { for (var _i4 = 0, _total4 = mediaFiles.length; _i4 < _total4; _i4++) { if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[_i4].type)) { flash.setSrc(mediaFiles[_i4].src); break; } } } return flash; } }; var hasFlash = PluginDetector.hasPluginVersion('flash', [10, 0, 0]); if (hasFlash) { _media.typeChecks.push(function (url) { url = url.toLowerCase(); if (url.startsWith('rtmp')) { if (~url.indexOf('.mp3')) { return 'audio/rtmp'; } else { return 'video/rtmp'; } } else if (/\.og(a|g)/i.test(url)) { return 'audio/ogg'; } else if (~url.indexOf('.m3u8')) { return 'application/x-mpegURL'; } else if (~url.indexOf('.mpd')) { return 'application/dash+xml'; } else if (~url.indexOf('.flv')) { return 'video/flv'; } else { return null; } }); var FlashMediaElementVideoRenderer = { name: 'flash_video', options: { prefix: 'flash_video', filename: 'mediaelement-flash-video.swf', enablePseudoStreaming: false, pseudoStreamingStartQueryParam: 'start', pseudoStreamingType: 'byte', proxyType: '', streamDelimiter: '' }, canPlayType: function canPlayType(type) { return ~['video/mp4', 'video/rtmp', 'audio/rtmp', 'rtmp/mp4', 'audio/mp4', 'video/flv', 'video/x-flv'].indexOf(type.toLowerCase()); }, create: FlashMediaElementRenderer.create }; _renderer.renderer.add(FlashMediaElementVideoRenderer); var FlashMediaElementHlsVideoRenderer = { name: 'flash_hls', options: { prefix: 'flash_hls', filename: 'mediaelement-flash-video-hls.swf' }, canPlayType: function canPlayType(type) { return ~['application/x-mpegurl', 'application/vnd.apple.mpegurl', 'audio/mpegurl', 'audio/hls', 'video/hls'].indexOf(type.toLowerCase()); }, create: FlashMediaElementRenderer.create }; _renderer.renderer.add(FlashMediaElementHlsVideoRenderer); var FlashMediaElementMdashVideoRenderer = { name: 'flash_dash', options: { prefix: 'flash_dash', filename: 'mediaelement-flash-video-mdash.swf' }, canPlayType: function canPlayType(type) { return ~['application/dash+xml'].indexOf(type.toLowerCase()); }, create: FlashMediaElementRenderer.create }; _renderer.renderer.add(FlashMediaElementMdashVideoRenderer); var FlashMediaElementAudioRenderer = { name: 'flash_audio', options: { prefix: 'flash_audio', filename: 'mediaelement-flash-audio.swf' }, canPlayType: function canPlayType(type) { return ~['audio/mp3'].indexOf(type.toLowerCase()); }, create: FlashMediaElementRenderer.create }; _renderer.renderer.add(FlashMediaElementAudioRenderer); var FlashMediaElementAudioOggRenderer = { name: 'flash_audio_ogg', options: { prefix: 'flash_audio_ogg', filename: 'mediaelement-flash-audio-ogg.swf' }, canPlayType: function canPlayType(type) { return ~['audio/ogg', 'audio/oga', 'audio/ogv'].indexOf(type.toLowerCase()); }, create: FlashMediaElementRenderer.create }; _renderer.renderer.add(FlashMediaElementAudioOggRenderer); } },{"2":2,"25":25,"27":27,"28":28,"3":3,"5":5,"7":7,"8":8}],21:[function(_dereq_,module,exports){ '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 _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); var _renderer = _dereq_(8); var _general = _dereq_(27); var _constants = _dereq_(25); var _media = _dereq_(28); var _dom = _dereq_(26); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var NativeFlv = { promise: null, load: function load(settings) { if (typeof flvjs !== 'undefined') { NativeFlv.promise = new Promise(function (resolve) { resolve(); }).then(function () { NativeFlv._createPlayer(settings); }); } else { settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdn.jsdelivr.net/npm/flv.js@latest'; NativeFlv.promise = NativeFlv.promise || (0, _dom.loadScript)(settings.options.path); NativeFlv.promise.then(function () { NativeFlv._createPlayer(settings); }); } return NativeFlv.promise; }, _createPlayer: function _createPlayer(settings) { flvjs.LoggingControl.enableDebug = settings.options.debug; flvjs.LoggingControl.enableVerbose = settings.options.debug; var player = flvjs.createPlayer(settings.options, settings.configs); _window2.default['__ready__' + settings.id](player); return player; } }; var FlvNativeRenderer = { name: 'native_flv', options: { prefix: 'native_flv', flv: { path: 'https://cdn.jsdelivr.net/npm/flv.js@latest', cors: true, debug: false } }, canPlayType: function canPlayType(type) { return _constants.HAS_MSE && ['video/x-flv', 'video/flv'].indexOf(type.toLowerCase()) > -1; }, create: function create(mediaElement, options, mediaFiles) { var originalNode = mediaElement.originalNode, id = mediaElement.id + '_' + options.prefix; var node = null, flvPlayer = null; node = originalNode.cloneNode(true); options = Object.assign(options, mediaElement.options); var props = _mejs2.default.html5media.properties, events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) { return e !== 'error'; }), attachNativeEvents = function attachNativeEvents(e) { var event = (0, _general.createEvent)(e.type, mediaElement); mediaElement.dispatchEvent(event); }, assignGettersSetters = function assignGettersSetters(propName) { var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); node['get' + capName] = function () { return flvPlayer !== null ? node[propName] : null; }; node['set' + capName] = function (value) { if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) { if (propName === 'src') { node[propName] = (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src ? value.src : value; if (flvPlayer !== null) { var _flvOptions = {}; _flvOptions.type = 'flv'; _flvOptions.url = value; _flvOptions.cors = options.flv.cors; _flvOptions.debug = options.flv.debug; _flvOptions.path = options.flv.path; var _flvConfigs = options.flv.configs; flvPlayer.destroy(); for (var i = 0, total = events.length; i < total; i++) { node.removeEventListener(events[i], attachNativeEvents); } flvPlayer = NativeFlv._createPlayer({ options: _flvOptions, configs: _flvConfigs, id: id }); flvPlayer.attachMediaElement(node); flvPlayer.load(); } } else { node[propName] = value; } } }; }; for (var i = 0, total = props.length; i < total; i++) { assignGettersSetters(props[i]); } _window2.default['__ready__' + id] = function (_flvPlayer) { mediaElement.flvPlayer = flvPlayer = _flvPlayer; var flvEvents = flvjs.Events, assignEvents = function assignEvents(eventName) { if (eventName === 'loadedmetadata') { flvPlayer.unload(); flvPlayer.detachMediaElement(); flvPlayer.attachMediaElement(node); flvPlayer.load(); } node.addEventListener(eventName, attachNativeEvents); }; for (var _i = 0, _total = events.length; _i < _total; _i++) { assignEvents(events[_i]); } var assignFlvEvents = function assignFlvEvents(name, data) { if (name === 'error') { var message = data[0] + ': ' + data[1] + ' ' + data[2].msg; mediaElement.generateError(message, node.src); } else { var _event = (0, _general.createEvent)(name, mediaElement); _event.data = data; mediaElement.dispatchEvent(_event); } }; var _loop = function _loop(eventType) { if (flvEvents.hasOwnProperty(eventType)) { flvPlayer.on(flvEvents[eventType], function () { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return assignFlvEvents(flvEvents[eventType], args); }); } }; for (var eventType in flvEvents) { _loop(eventType); } }; if (mediaFiles && mediaFiles.length > 0) { for (var _i2 = 0, _total2 = mediaFiles.length; _i2 < _total2; _i2++) { if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[_i2].type)) { node.setAttribute('src', mediaFiles[_i2].src); break; } } } node.setAttribute('id', id); originalNode.parentNode.insertBefore(node, originalNode); originalNode.autoplay = false; originalNode.style.display = 'none'; var flvOptions = {}; flvOptions.type = 'flv'; flvOptions.url = node.src; flvOptions.cors = options.flv.cors; flvOptions.debug = options.flv.debug; flvOptions.path = options.flv.path; var flvConfigs = options.flv.configs; node.setSize = function (width, height) { node.style.width = width + 'px'; node.style.height = height + 'px'; return node; }; node.hide = function () { if (flvPlayer !== null) { flvPlayer.pause(); } node.style.display = 'none'; return node; }; node.show = function () { node.style.display = ''; return node; }; node.destroy = function () { if (flvPlayer !== null) { flvPlayer.destroy(); } }; var event = (0, _general.createEvent)('rendererready', node); mediaElement.dispatchEvent(event); mediaElement.promises.push(NativeFlv.load({ options: flvOptions, configs: flvConfigs, id: id })); return node; } }; _media.typeChecks.push(function (url) { return ~url.toLowerCase().indexOf('.flv') ? 'video/flv' : null; }); _renderer.renderer.add(FlvNativeRenderer); },{"25":25,"26":26,"27":27,"28":28,"3":3,"7":7,"8":8}],22:[function(_dereq_,module,exports){ '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 _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); var _renderer = _dereq_(8); var _general = _dereq_(27); var _constants = _dereq_(25); var _media = _dereq_(28); var _dom = _dereq_(26); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var NativeHls = { promise: null, load: function load(settings) { if (typeof Hls !== 'undefined') { NativeHls.promise = new Promise(function (resolve) { resolve(); }).then(function () { NativeHls._createPlayer(settings); }); } else { settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdn.jsdelivr.net/npm/hls.js@latest'; NativeHls.promise = NativeHls.promise || (0, _dom.loadScript)(settings.options.path); NativeHls.promise.then(function () { NativeHls._createPlayer(settings); }); } return NativeHls.promise; }, _createPlayer: function _createPlayer(settings) { var player = new Hls(settings.options); _window2.default['__ready__' + settings.id](player); return player; } }; var HlsNativeRenderer = { name: 'native_hls', options: { prefix: 'native_hls', hls: { path: 'https://cdn.jsdelivr.net/npm/hls.js@latest', autoStartLoad: false, debug: false } }, canPlayType: function canPlayType(type) { return _constants.HAS_MSE && ['application/x-mpegurl', 'application/vnd.apple.mpegurl', 'audio/mpegurl', 'audio/hls', 'video/hls'].indexOf(type.toLowerCase()) > -1; }, create: function create(mediaElement, options, mediaFiles) { var originalNode = mediaElement.originalNode, id = mediaElement.id + '_' + options.prefix, preload = originalNode.getAttribute('preload'), autoplay = originalNode.autoplay; var hlsPlayer = null, node = null, index = 0, total = mediaFiles.length; node = originalNode.cloneNode(true); options = Object.assign(options, mediaElement.options); options.hls.autoStartLoad = preload && preload !== 'none' || autoplay; var props = _mejs2.default.html5media.properties, events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) { return e !== 'error'; }), attachNativeEvents = function attachNativeEvents(e) { var event = (0, _general.createEvent)(e.type, mediaElement); mediaElement.dispatchEvent(event); }, assignGettersSetters = function assignGettersSetters(propName) { var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); node['get' + capName] = function () { return hlsPlayer !== null ? node[propName] : null; }; node['set' + capName] = function (value) { if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) { if (propName === 'src') { node[propName] = (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src ? value.src : value; if (hlsPlayer !== null) { hlsPlayer.destroy(); for (var i = 0, _total = events.length; i < _total; i++) { node.removeEventListener(events[i], attachNativeEvents); } hlsPlayer = NativeHls._createPlayer({ options: options.hls, id: id }); hlsPlayer.loadSource(value); hlsPlayer.attachMedia(node); } } else { node[propName] = value; } } }; }; for (var i = 0, _total2 = props.length; i < _total2; i++) { assignGettersSetters(props[i]); } _window2.default['__ready__' + id] = function (_hlsPlayer) { mediaElement.hlsPlayer = hlsPlayer = _hlsPlayer; var hlsEvents = Hls.Events, assignEvents = function assignEvents(eventName) { if (eventName === 'loadedmetadata') { var url = mediaElement.originalNode.src; hlsPlayer.detachMedia(); hlsPlayer.loadSource(url); hlsPlayer.attachMedia(node); } node.addEventListener(eventName, attachNativeEvents); }; for (var _i = 0, _total3 = events.length; _i < _total3; _i++) { assignEvents(events[_i]); } var recoverDecodingErrorDate = void 0, recoverSwapAudioCodecDate = void 0; var assignHlsEvents = function assignHlsEvents(name, data) { if (name === 'hlsError') { console.warn(data); data = data[1]; if (data.fatal) { switch (data.type) { case 'mediaError': var now = new Date().getTime(); if (!recoverDecodingErrorDate || now - recoverDecodingErrorDate > 3000) { recoverDecodingErrorDate = new Date().getTime(); hlsPlayer.recoverMediaError(); } else if (!recoverSwapAudioCodecDate || now - recoverSwapAudioCodecDate > 3000) { recoverSwapAudioCodecDate = new Date().getTime(); console.warn('Attempting to swap Audio Codec and recover from media error'); hlsPlayer.swapAudioCodec(); hlsPlayer.recoverMediaError(); } else { var message = 'Cannot recover, last media error recovery failed'; mediaElement.generateError(message, node.src); console.error(message); } break; case 'networkError': if (data.details === 'manifestLoadError') { if (index < total && mediaFiles[index + 1] !== undefined) { node.setSrc(mediaFiles[index++].src); node.load(); node.play(); } else { var _message = 'Network error'; mediaElement.generateError(_message, mediaFiles); console.error(_message); } } else { var _message2 = 'Network error'; mediaElement.generateError(_message2, mediaFiles); console.error(_message2); } break; default: hlsPlayer.destroy(); break; } } } else { var _event = (0, _general.createEvent)(name, mediaElement); _event.data = data; mediaElement.dispatchEvent(_event); } }; var _loop = function _loop(eventType) { if (hlsEvents.hasOwnProperty(eventType)) { hlsPlayer.on(hlsEvents[eventType], function () { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return assignHlsEvents(hlsEvents[eventType], args); }); } }; for (var eventType in hlsEvents) { _loop(eventType); } }; if (total > 0) { for (; index < total; index++) { if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[index].type)) { node.setAttribute('src', mediaFiles[index].src); break; } } } if (preload !== 'auto' && !autoplay) { node.addEventListener('play', function () { if (hlsPlayer !== null) { hlsPlayer.startLoad(); } }); node.addEventListener('pause', function () { if (hlsPlayer !== null) { hlsPlayer.stopLoad(); } }); } node.setAttribute('id', id); originalNode.parentNode.insertBefore(node, originalNode); originalNode.autoplay = false; originalNode.style.display = 'none'; node.setSize = function (width, height) { node.style.width = width + 'px'; node.style.height = height + 'px'; return node; }; node.hide = function () { node.pause(); node.style.display = 'none'; return node; }; node.show = function () { node.style.display = ''; return node; }; node.destroy = function () { if (hlsPlayer !== null) { hlsPlayer.stopLoad(); hlsPlayer.destroy(); } }; var event = (0, _general.createEvent)('rendererready', node); mediaElement.dispatchEvent(event); mediaElement.promises.push(NativeHls.load({ options: options.hls, id: id })); return node; } }; _media.typeChecks.push(function (url) { return ~url.toLowerCase().indexOf('.m3u8') ? 'application/x-mpegURL' : null; }); _renderer.renderer.add(HlsNativeRenderer); },{"25":25,"26":26,"27":27,"28":28,"3":3,"7":7,"8":8}],23:[function(_dereq_,module,exports){ 'use strict'; var _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); var _renderer = _dereq_(8); var _general = _dereq_(27); var _constants = _dereq_(25); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var HtmlMediaElement = { name: 'html5', options: { prefix: 'html5' }, canPlayType: function canPlayType(type) { var mediaElement = _document2.default.createElement('video'); if (_constants.IS_ANDROID && /\/mp(3|4)$/i.test(type) || ~['application/x-mpegurl', 'vnd.apple.mpegurl', 'audio/mpegurl', 'audio/hls', 'video/hls'].indexOf(type.toLowerCase()) && _constants.SUPPORTS_NATIVE_HLS) { return 'yes'; } else if (mediaElement.canPlayType) { return mediaElement.canPlayType(type.toLowerCase()).replace(/no/, ''); } else { return ''; } }, create: function create(mediaElement, options, mediaFiles) { var id = mediaElement.id + '_' + options.prefix; var isActive = false; var node = null; if (mediaElement.originalNode === undefined || mediaElement.originalNode === null) { node = _document2.default.createElement('audio'); mediaElement.appendChild(node); } else { node = mediaElement.originalNode; } node.setAttribute('id', id); var props = _mejs2.default.html5media.properties, assignGettersSetters = function assignGettersSetters(propName) { var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); node['get' + capName] = function () { return node[propName]; }; node['set' + capName] = function (value) { if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) { node[propName] = value; } }; }; for (var i = 0, _total = props.length; i < _total; i++) { assignGettersSetters(props[i]); } var events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) { return e !== 'error'; }), assignEvents = function assignEvents(eventName) { node.addEventListener(eventName, function (e) { if (isActive) { var _event = (0, _general.createEvent)(e.type, e.target); mediaElement.dispatchEvent(_event); } }); }; for (var _i = 0, _total2 = events.length; _i < _total2; _i++) { assignEvents(events[_i]); } node.setSize = function (width, height) { node.style.width = width + 'px'; node.style.height = height + 'px'; return node; }; node.hide = function () { isActive = false; node.style.display = 'none'; return node; }; node.show = function () { isActive = true; node.style.display = ''; return node; }; var index = 0, total = mediaFiles.length; if (total > 0) { for (; index < total; index++) { if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[index].type)) { node.setAttribute('src', mediaFiles[index].src); break; } } } node.addEventListener('error', function (e) { if (e.target.error.code === 4 && isActive) { if (index < total && mediaFiles[index + 1] !== undefined) { node.src = mediaFiles[index++].src; node.load(); node.play(); } else { mediaElement.generateError('Media error: Format(s) not supported or source(s) not found', mediaFiles); } } }); var event = (0, _general.createEvent)('rendererready', node); mediaElement.dispatchEvent(event); return node; } }; _window2.default.HtmlMediaElement = _mejs2.default.HtmlMediaElement = HtmlMediaElement; _renderer.renderer.add(HtmlMediaElement); },{"2":2,"25":25,"27":27,"3":3,"7":7,"8":8}],24:[function(_dereq_,module,exports){ 'use strict'; var _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); var _renderer = _dereq_(8); var _general = _dereq_(27); var _media = _dereq_(28); var _dom = _dereq_(26); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var YouTubeApi = { isIframeStarted: false, isIframeLoaded: false, iframeQueue: [], enqueueIframe: function enqueueIframe(settings) { YouTubeApi.isLoaded = typeof YT !== 'undefined' && YT.loaded; if (YouTubeApi.isLoaded) { YouTubeApi.createIframe(settings); } else { YouTubeApi.loadIframeApi(); YouTubeApi.iframeQueue.push(settings); } }, loadIframeApi: function loadIframeApi() { if (!YouTubeApi.isIframeStarted) { (0, _dom.loadScript)('https://www.youtube.com/player_api'); YouTubeApi.isIframeStarted = true; } }, iFrameReady: function iFrameReady() { YouTubeApi.isLoaded = true; YouTubeApi.isIframeLoaded = true; while (YouTubeApi.iframeQueue.length > 0) { var settings = YouTubeApi.iframeQueue.pop(); YouTubeApi.createIframe(settings); } }, createIframe: function createIframe(settings) { return new YT.Player(settings.containerId, settings); }, getYouTubeId: function getYouTubeId(url) { var youTubeId = ''; if (url.indexOf('?') > 0) { youTubeId = YouTubeApi.getYouTubeIdFromParam(url); if (youTubeId === '') { youTubeId = YouTubeApi.getYouTubeIdFromUrl(url); } } else { youTubeId = YouTubeApi.getYouTubeIdFromUrl(url); } var id = youTubeId.substring(youTubeId.lastIndexOf('/') + 1); youTubeId = id.split('?'); return youTubeId[0]; }, getYouTubeIdFromParam: function getYouTubeIdFromParam(url) { if (url === undefined || url === null || !url.trim().length) { return null; } var parts = url.split('?'), parameters = parts[1].split('&'); var youTubeId = ''; for (var i = 0, total = parameters.length; i < total; i++) { var paramParts = parameters[i].split('='); if (paramParts[0] === 'v') { youTubeId = paramParts[1]; break; } } return youTubeId; }, getYouTubeIdFromUrl: function getYouTubeIdFromUrl(url) { if (url === undefined || url === null || !url.trim().length) { return null; } var parts = url.split('?'); url = parts[0]; return url.substring(url.lastIndexOf('/') + 1); }, getYouTubeNoCookieUrl: function getYouTubeNoCookieUrl(url) { if (url === undefined || url === null || !url.trim().length || url.indexOf('//www.youtube') === -1) { return url; } var parts = url.split('/'); parts[2] = parts[2].replace('.com', '-nocookie.com'); return parts.join('/'); } }; var YouTubeIframeRenderer = { name: 'youtube_iframe', options: { prefix: 'youtube_iframe', youtube: { autoplay: 0, controls: 0, disablekb: 1, end: 0, loop: 0, modestbranding: 0, playsinline: 0, rel: 0, showinfo: 0, start: 0, iv_load_policy: 3, nocookie: false, imageQuality: null } }, canPlayType: function canPlayType(type) { return ~['video/youtube', 'video/x-youtube'].indexOf(type.toLowerCase()); }, create: function create(mediaElement, options, mediaFiles) { var youtube = {}, apiStack = [], readyState = 4; var youTubeApi = null, paused = true, ended = false, youTubeIframe = null, volume = 1; youtube.options = options; youtube.id = mediaElement.id + '_' + options.prefix; youtube.mediaElement = mediaElement; var props = _mejs2.default.html5media.properties, assignGettersSetters = function assignGettersSetters(propName) { var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); youtube['get' + capName] = function () { if (youTubeApi !== null) { var value = null; switch (propName) { case 'currentTime': return youTubeApi.getCurrentTime(); case 'duration': return youTubeApi.getDuration(); case 'volume': volume = youTubeApi.getVolume() / 100; return volume; case 'paused': return paused; case 'ended': return ended; case 'muted': return youTubeApi.isMuted(); case 'buffered': var percentLoaded = youTubeApi.getVideoLoadedFraction(), duration = youTubeApi.getDuration(); return { start: function start() { return 0; }, end: function end() { return percentLoaded * duration; }, length: 1 }; case 'src': return youTubeApi.getVideoUrl(); case 'readyState': return readyState; } return value; } else { return null; } }; youtube['set' + capName] = function (value) { if (youTubeApi !== null) { switch (propName) { case 'src': var url = typeof value === 'string' ? value : value[0].src, _videoId = YouTubeApi.getYouTubeId(url); if (mediaElement.originalNode.autoplay) { youTubeApi.loadVideoById(_videoId); } else { youTubeApi.cueVideoById(_videoId); } break; case 'currentTime': youTubeApi.seekTo(value); break; case 'muted': if (value) { youTubeApi.mute(); } else { youTubeApi.unMute(); } setTimeout(function () { var event = (0, _general.createEvent)('volumechange', youtube); mediaElement.dispatchEvent(event); }, 50); break; case 'volume': volume = value; youTubeApi.setVolume(value * 100); setTimeout(function () { var event = (0, _general.createEvent)('volumechange', youtube); mediaElement.dispatchEvent(event); }, 50); break; case 'readyState': var event = (0, _general.createEvent)('canplay', youtube); mediaElement.dispatchEvent(event); break; default: break; } } else { apiStack.push({ type: 'set', propName: propName, value: value }); } }; }; for (var i = 0, total = props.length; i < total; i++) { assignGettersSetters(props[i]); } var methods = _mejs2.default.html5media.methods, assignMethods = function assignMethods(methodName) { youtube[methodName] = function () { if (youTubeApi !== null) { switch (methodName) { case 'play': paused = false; return youTubeApi.playVideo(); case 'pause': paused = true; return youTubeApi.pauseVideo(); case 'load': return null; } } else { apiStack.push({ type: 'call', methodName: methodName }); } }; }; for (var _i = 0, _total = methods.length; _i < _total; _i++) { assignMethods(methods[_i]); } var errorHandler = function errorHandler(error) { var message = ''; switch (error.data) { case 2: message = 'The request contains an invalid parameter value. Verify that video ID has 11 characters and that contains no invalid characters, such as exclamation points or asterisks.'; break; case 5: message = 'The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.'; break; case 100: message = 'The video requested was not found. Either video has been removed or has been marked as private.'; break; case 101: case 105: message = 'The owner of the requested video does not allow it to be played in embedded players.'; break; default: message = 'Unknown error.'; break; } mediaElement.generateError('Code ' + error.data + ': ' + message, mediaFiles); }; var youtubeContainer = _document2.default.createElement('div'); youtubeContainer.id = youtube.id; if (youtube.options.youtube.nocookie) { mediaElement.originalNode.src = YouTubeApi.getYouTubeNoCookieUrl(mediaFiles[0].src); } mediaElement.originalNode.parentNode.insertBefore(youtubeContainer, mediaElement.originalNode); mediaElement.originalNode.style.display = 'none'; var isAudio = mediaElement.originalNode.tagName.toLowerCase() === 'audio', height = isAudio ? '1' : mediaElement.originalNode.height, width = isAudio ? '1' : mediaElement.originalNode.width, videoId = YouTubeApi.getYouTubeId(mediaFiles[0].src), youtubeSettings = { id: youtube.id, containerId: youtubeContainer.id, videoId: videoId, height: height, width: width, playerVars: Object.assign({ controls: 0, rel: 0, disablekb: 1, showinfo: 0, modestbranding: 0, html5: 1, iv_load_policy: 3 }, youtube.options.youtube), origin: _window2.default.location.host, events: { onReady: function onReady(e) { mediaElement.youTubeApi = youTubeApi = e.target; mediaElement.youTubeState = { paused: true, ended: false }; if (apiStack.length) { for (var _i2 = 0, _total2 = apiStack.length; _i2 < _total2; _i2++) { var stackItem = apiStack[_i2]; if (stackItem.type === 'set') { var propName = stackItem.propName, capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); youtube['set' + capName](stackItem.value); } else if (stackItem.type === 'call') { youtube[stackItem.methodName](); } } } youTubeIframe = youTubeApi.getIframe(); if (mediaElement.originalNode.muted) { youTubeApi.mute(); } var events = ['mouseover', 'mouseout'], assignEvents = function assignEvents(e) { var newEvent = (0, _general.createEvent)(e.type, youtube); mediaElement.dispatchEvent(newEvent); }; for (var _i3 = 0, _total3 = events.length; _i3 < _total3; _i3++) { youTubeIframe.addEventListener(events[_i3], assignEvents, false); } var initEvents = ['rendererready', 'loadedmetadata', 'loadeddata', 'canplay']; for (var _i4 = 0, _total4 = initEvents.length; _i4 < _total4; _i4++) { var event = (0, _general.createEvent)(initEvents[_i4], youtube); mediaElement.dispatchEvent(event); } }, onStateChange: function onStateChange(e) { var events = []; switch (e.data) { case -1: events = ['loadedmetadata']; paused = true; ended = false; break; case 0: events = ['ended']; paused = false; ended = !youtube.options.youtube.loop; if (!youtube.options.youtube.loop) { youtube.stopInterval(); } break; case 1: events = ['play', 'playing']; paused = false; ended = false; youtube.startInterval(); break; case 2: events = ['pause']; paused = true; ended = false; youtube.stopInterval(); break; case 3: events = ['progress']; ended = false; break; case 5: events = ['loadeddata', 'loadedmetadata', 'canplay']; paused = true; ended = false; break; } for (var _i5 = 0, _total5 = events.length; _i5 < _total5; _i5++) { var event = (0, _general.createEvent)(events[_i5], youtube); mediaElement.dispatchEvent(event); } }, onError: function onError(e) { return errorHandler(e); } } }; if (isAudio || mediaElement.originalNode.hasAttribute('playsinline')) { youtubeSettings.playerVars.playsinline = 1; } if (mediaElement.originalNode.controls) { youtubeSettings.playerVars.controls = 1; } if (mediaElement.originalNode.autoplay) { youtubeSettings.playerVars.autoplay = 1; } if (mediaElement.originalNode.loop) { youtubeSettings.playerVars.loop = 1; } if ((youtubeSettings.playerVars.loop && parseInt(youtubeSettings.playerVars.loop, 10) === 1 || mediaElement.originalNode.src.indexOf('loop=') > -1) && !youtubeSettings.playerVars.playlist && mediaElement.originalNode.src.indexOf('playlist=') === -1) { youtubeSettings.playerVars.playlist = YouTubeApi.getYouTubeId(mediaElement.originalNode.src); } YouTubeApi.enqueueIframe(youtubeSettings); youtube.onEvent = function (eventName, player, _youTubeState) { if (_youTubeState !== null && _youTubeState !== undefined) { mediaElement.youTubeState = _youTubeState; } }; youtube.setSize = function (width, height) { if (youTubeApi !== null) { youTubeApi.setSize(width, height); } }; youtube.hide = function () { youtube.stopInterval(); youtube.pause(); if (youTubeIframe) { youTubeIframe.style.display = 'none'; } }; youtube.show = function () { if (youTubeIframe) { youTubeIframe.style.display = ''; } }; youtube.destroy = function () { youTubeApi.destroy(); }; youtube.interval = null; youtube.startInterval = function () { youtube.interval = setInterval(function () { var event = (0, _general.createEvent)('timeupdate', youtube); mediaElement.dispatchEvent(event); }, 250); }; youtube.stopInterval = function () { if (youtube.interval) { clearInterval(youtube.interval); } }; youtube.getPosterUrl = function () { var quality = options.youtube.imageQuality, resolutions = ['default', 'hqdefault', 'mqdefault', 'sddefault', 'maxresdefault'], id = YouTubeApi.getYouTubeId(mediaElement.originalNode.src); return quality && resolutions.indexOf(quality) > -1 && id ? 'https://img.youtube.com/vi/' + id + '/' + quality + '.jpg' : ''; }; return youtube; } }; _window2.default.onYouTubePlayerAPIReady = function () { YouTubeApi.iFrameReady(); }; _media.typeChecks.push(function (url) { return (/\/\/(www\.youtube|youtu\.?be)/i.test(url) ? 'video/x-youtube' : null ); }); _renderer.renderer.add(YouTubeIframeRenderer); },{"2":2,"26":26,"27":27,"28":28,"3":3,"7":7,"8":8}],25:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.cancelFullScreen = exports.requestFullScreen = exports.isFullScreen = exports.FULLSCREEN_EVENT_NAME = exports.HAS_NATIVE_FULLSCREEN_ENABLED = exports.HAS_TRUE_NATIVE_FULLSCREEN = exports.HAS_IOS_FULLSCREEN = exports.HAS_MS_NATIVE_FULLSCREEN = exports.HAS_MOZ_NATIVE_FULLSCREEN = exports.HAS_WEBKIT_NATIVE_FULLSCREEN = exports.HAS_NATIVE_FULLSCREEN = exports.SUPPORTS_NATIVE_HLS = exports.SUPPORT_PASSIVE_EVENT = exports.SUPPORT_POINTER_EVENTS = exports.HAS_MSE = exports.IS_STOCK_ANDROID = exports.IS_SAFARI = exports.IS_FIREFOX = exports.IS_CHROME = exports.IS_EDGE = exports.IS_IE = exports.IS_ANDROID = exports.IS_IOS = exports.IS_IPOD = exports.IS_IPHONE = exports.IS_IPAD = exports.UA = exports.NAV = undefined; var _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var NAV = exports.NAV = _window2.default.navigator; var UA = exports.UA = NAV.userAgent.toLowerCase(); var IS_IPAD = exports.IS_IPAD = /ipad/i.test(UA) && !_window2.default.MSStream; var IS_IPHONE = exports.IS_IPHONE = /iphone/i.test(UA) && !_window2.default.MSStream; var IS_IPOD = exports.IS_IPOD = /ipod/i.test(UA) && !_window2.default.MSStream; var IS_IOS = exports.IS_IOS = /ipad|iphone|ipod/i.test(UA) && !_window2.default.MSStream; var IS_ANDROID = exports.IS_ANDROID = /android/i.test(UA); var IS_IE = exports.IS_IE = /(trident|microsoft)/i.test(NAV.appName); var IS_EDGE = exports.IS_EDGE = 'msLaunchUri' in NAV && !('documentMode' in _document2.default); var IS_CHROME = exports.IS_CHROME = /chrome/i.test(UA); var IS_FIREFOX = exports.IS_FIREFOX = /firefox/i.test(UA); var IS_SAFARI = exports.IS_SAFARI = /safari/i.test(UA) && !IS_CHROME; var IS_STOCK_ANDROID = exports.IS_STOCK_ANDROID = /^mozilla\/\d+\.\d+\s\(linux;\su;/i.test(UA); var HAS_MSE = exports.HAS_MSE = 'MediaSource' in _window2.default; var SUPPORT_POINTER_EVENTS = exports.SUPPORT_POINTER_EVENTS = function () { var element = _document2.default.createElement('x'), documentElement = _document2.default.documentElement, getComputedStyle = _window2.default.getComputedStyle; if (!('pointerEvents' in element.style)) { return false; } element.style.pointerEvents = 'auto'; element.style.pointerEvents = 'x'; documentElement.appendChild(element); var supports = getComputedStyle && (getComputedStyle(element, '') || {}).pointerEvents === 'auto'; element.remove(); return !!supports; }(); var SUPPORT_PASSIVE_EVENT = exports.SUPPORT_PASSIVE_EVENT = function () { var supportsPassive = false; try { var opts = Object.defineProperty({}, 'passive', { get: function get() { supportsPassive = true; } }); _window2.default.addEventListener('test', null, opts); } catch (e) {} return supportsPassive; }(); var html5Elements = ['source', 'track', 'audio', 'video']; var video = void 0; for (var i = 0, total = html5Elements.length; i < total; i++) { video = _document2.default.createElement(html5Elements[i]); } var SUPPORTS_NATIVE_HLS = exports.SUPPORTS_NATIVE_HLS = IS_SAFARI || IS_ANDROID && (IS_CHROME || IS_STOCK_ANDROID) || IS_IE && /edge/i.test(UA); var hasiOSFullScreen = video.webkitEnterFullscreen !== undefined; var hasNativeFullscreen = video.requestFullscreen !== undefined; if (hasiOSFullScreen && /mac os x 10_5/i.test(UA)) { hasNativeFullscreen = false; hasiOSFullScreen = false; } var hasWebkitNativeFullScreen = video.webkitRequestFullScreen !== undefined; var hasMozNativeFullScreen = video.mozRequestFullScreen !== undefined; var hasMsNativeFullScreen = video.msRequestFullscreen !== undefined; var hasTrueNativeFullScreen = hasWebkitNativeFullScreen || hasMozNativeFullScreen || hasMsNativeFullScreen; var nativeFullScreenEnabled = hasTrueNativeFullScreen; var fullScreenEventName = ''; var isFullScreen = void 0, requestFullScreen = void 0, cancelFullScreen = void 0; if (hasMozNativeFullScreen) { nativeFullScreenEnabled = _document2.default.mozFullScreenEnabled; } else if (hasMsNativeFullScreen) { nativeFullScreenEnabled = _document2.default.msFullscreenEnabled; } if (IS_CHROME) { hasiOSFullScreen = false; } if (hasTrueNativeFullScreen) { if (hasWebkitNativeFullScreen) { fullScreenEventName = 'webkitfullscreenchange'; } else if (hasMozNativeFullScreen) { fullScreenEventName = 'mozfullscreenchange'; } else if (hasMsNativeFullScreen) { fullScreenEventName = 'MSFullscreenChange'; } exports.isFullScreen = isFullScreen = function isFullScreen() { if (hasMozNativeFullScreen) { return _document2.default.mozFullScreen; } else if (hasWebkitNativeFullScreen) { return _document2.default.webkitIsFullScreen; } else if (hasMsNativeFullScreen) { return _document2.default.msFullscreenElement !== null; } }; exports.requestFullScreen = requestFullScreen = function requestFullScreen(el) { if (hasWebkitNativeFullScreen) { el.webkitRequestFullScreen(); } else if (hasMozNativeFullScreen) { el.mozRequestFullScreen(); } else if (hasMsNativeFullScreen) { el.msRequestFullscreen(); } }; exports.cancelFullScreen = cancelFullScreen = function cancelFullScreen() { if (hasWebkitNativeFullScreen) { _document2.default.webkitCancelFullScreen(); } else if (hasMozNativeFullScreen) { _document2.default.mozCancelFullScreen(); } else if (hasMsNativeFullScreen) { _document2.default.msExitFullscreen(); } }; } var HAS_NATIVE_FULLSCREEN = exports.HAS_NATIVE_FULLSCREEN = hasNativeFullscreen; var HAS_WEBKIT_NATIVE_FULLSCREEN = exports.HAS_WEBKIT_NATIVE_FULLSCREEN = hasWebkitNativeFullScreen; var HAS_MOZ_NATIVE_FULLSCREEN = exports.HAS_MOZ_NATIVE_FULLSCREEN = hasMozNativeFullScreen; var HAS_MS_NATIVE_FULLSCREEN = exports.HAS_MS_NATIVE_FULLSCREEN = hasMsNativeFullScreen; var HAS_IOS_FULLSCREEN = exports.HAS_IOS_FULLSCREEN = hasiOSFullScreen; var HAS_TRUE_NATIVE_FULLSCREEN = exports.HAS_TRUE_NATIVE_FULLSCREEN = hasTrueNativeFullScreen; var HAS_NATIVE_FULLSCREEN_ENABLED = exports.HAS_NATIVE_FULLSCREEN_ENABLED = nativeFullScreenEnabled; var FULLSCREEN_EVENT_NAME = exports.FULLSCREEN_EVENT_NAME = fullScreenEventName; exports.isFullScreen = isFullScreen; exports.requestFullScreen = requestFullScreen; exports.cancelFullScreen = cancelFullScreen; _mejs2.default.Features = _mejs2.default.Features || {}; _mejs2.default.Features.isiPad = IS_IPAD; _mejs2.default.Features.isiPod = IS_IPOD; _mejs2.default.Features.isiPhone = IS_IPHONE; _mejs2.default.Features.isiOS = _mejs2.default.Features.isiPhone || _mejs2.default.Features.isiPad; _mejs2.default.Features.isAndroid = IS_ANDROID; _mejs2.default.Features.isIE = IS_IE; _mejs2.default.Features.isEdge = IS_EDGE; _mejs2.default.Features.isChrome = IS_CHROME; _mejs2.default.Features.isFirefox = IS_FIREFOX; _mejs2.default.Features.isSafari = IS_SAFARI; _mejs2.default.Features.isStockAndroid = IS_STOCK_ANDROID; _mejs2.default.Features.hasMSE = HAS_MSE; _mejs2.default.Features.supportsNativeHLS = SUPPORTS_NATIVE_HLS; _mejs2.default.Features.supportsPointerEvents = SUPPORT_POINTER_EVENTS; _mejs2.default.Features.supportsPassiveEvent = SUPPORT_PASSIVE_EVENT; _mejs2.default.Features.hasiOSFullScreen = HAS_IOS_FULLSCREEN; _mejs2.default.Features.hasNativeFullscreen = HAS_NATIVE_FULLSCREEN; _mejs2.default.Features.hasWebkitNativeFullScreen = HAS_WEBKIT_NATIVE_FULLSCREEN; _mejs2.default.Features.hasMozNativeFullScreen = HAS_MOZ_NATIVE_FULLSCREEN; _mejs2.default.Features.hasMsNativeFullScreen = HAS_MS_NATIVE_FULLSCREEN; _mejs2.default.Features.hasTrueNativeFullScreen = HAS_TRUE_NATIVE_FULLSCREEN; _mejs2.default.Features.nativeFullScreenEnabled = HAS_NATIVE_FULLSCREEN_ENABLED; _mejs2.default.Features.fullScreenEventName = FULLSCREEN_EVENT_NAME; _mejs2.default.Features.isFullScreen = isFullScreen; _mejs2.default.Features.requestFullScreen = requestFullScreen; _mejs2.default.Features.cancelFullScreen = cancelFullScreen; },{"2":2,"3":3,"7":7}],26:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.removeClass = exports.addClass = exports.hasClass = undefined; exports.loadScript = loadScript; exports.offset = offset; exports.toggleClass = toggleClass; exports.fadeOut = fadeOut; exports.fadeIn = fadeIn; exports.siblings = siblings; exports.visible = visible; exports.ajax = ajax; var _window = _dereq_(3); var _window2 = _interopRequireDefault(_window); var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function loadScript(url) { return new Promise(function (resolve, reject) { var script = _document2.default.createElement('script'); script.src = url; script.async = true; script.onload = function () { script.remove(); resolve(); }; script.onerror = function () { script.remove(); reject(); }; _document2.default.head.appendChild(script); }); } function offset(el) { var rect = el.getBoundingClientRect(), scrollLeft = _window2.default.pageXOffset || _document2.default.documentElement.scrollLeft, scrollTop = _window2.default.pageYOffset || _document2.default.documentElement.scrollTop; return { top: rect.top + scrollTop, left: rect.left + scrollLeft }; } var hasClassMethod = void 0, addClassMethod = void 0, removeClassMethod = void 0; if ('classList' in _document2.default.documentElement) { hasClassMethod = function hasClassMethod(el, className) { return el.classList !== undefined && el.classList.contains(className); }; addClassMethod = function addClassMethod(el, className) { return el.classList.add(className); }; removeClassMethod = function removeClassMethod(el, className) { return el.classList.remove(className); }; } else { hasClassMethod = function hasClassMethod(el, className) { return new RegExp('\\b' + className + '\\b').test(el.className); }; addClassMethod = function addClassMethod(el, className) { if (!hasClass(el, className)) { el.className += ' ' + className; } }; removeClassMethod = function removeClassMethod(el, className) { el.className = el.className.replace(new RegExp('\\b' + className + '\\b', 'g'), ''); }; } var hasClass = exports.hasClass = hasClassMethod; var addClass = exports.addClass = addClassMethod; var removeClass = exports.removeClass = removeClassMethod; function toggleClass(el, className) { hasClass(el, className) ? removeClass(el, className) : addClass(el, className); } function fadeOut(el) { var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400; var callback = arguments[2]; if (!el.style.opacity) { el.style.opacity = 1; } var start = null; _window2.default.requestAnimationFrame(function animate(timestamp) { start = start || timestamp; var progress = timestamp - start; var opacity = parseFloat(1 - progress / duration, 2); el.style.opacity = opacity < 0 ? 0 : opacity; if (progress > duration) { if (callback && typeof callback === 'function') { callback(); } } else { _window2.default.requestAnimationFrame(animate); } }); } function fadeIn(el) { var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400; var callback = arguments[2]; if (!el.style.opacity) { el.style.opacity = 0; } var start = null; _window2.default.requestAnimationFrame(function animate(timestamp) { start = start || timestamp; var progress = timestamp - start; var opacity = parseFloat(progress / duration, 2); el.style.opacity = opacity > 1 ? 1 : opacity; if (progress > duration) { if (callback && typeof callback === 'function') { callback(); } } else { _window2.default.requestAnimationFrame(animate); } }); } function siblings(el, filter) { var siblings = []; el = el.parentNode.firstChild; do { if (!filter || filter(el)) { siblings.push(el); } } while (el = el.nextSibling); return siblings; } function visible(elem) { if (elem.getClientRects !== undefined && elem.getClientRects === 'function') { return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length); } return !!(elem.offsetWidth || elem.offsetHeight); } function ajax(url, dataType, success, error) { var xhr = _window2.default.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); var type = 'application/x-www-form-urlencoded; charset=UTF-8', completed = false, accept = '*/'.concat('*'); switch (dataType) { case 'text': type = 'text/plain'; break; case 'json': type = 'application/json, text/javascript'; break; case 'html': type = 'text/html'; break; case 'xml': type = 'application/xml, text/xml'; break; } if (type !== 'application/x-www-form-urlencoded') { accept = type + ', */*; q=0.01'; } if (xhr) { xhr.open('GET', url, true); xhr.setRequestHeader('Accept', accept); xhr.onreadystatechange = function () { if (completed) { return; } if (xhr.readyState === 4) { if (xhr.status === 200) { completed = true; var data = void 0; switch (dataType) { case 'json': data = JSON.parse(xhr.responseText); break; case 'xml': data = xhr.responseXML; break; default: data = xhr.responseText; break; } success(data); } else if (typeof error === 'function') { error(xhr.status); } } }; xhr.send(); } } _mejs2.default.Utils = _mejs2.default.Utils || {}; _mejs2.default.Utils.offset = offset; _mejs2.default.Utils.hasClass = hasClass; _mejs2.default.Utils.addClass = addClass; _mejs2.default.Utils.removeClass = removeClass; _mejs2.default.Utils.toggleClass = toggleClass; _mejs2.default.Utils.fadeIn = fadeIn; _mejs2.default.Utils.fadeOut = fadeOut; _mejs2.default.Utils.siblings = siblings; _mejs2.default.Utils.visible = visible; _mejs2.default.Utils.ajax = ajax; _mejs2.default.Utils.loadScript = loadScript; },{"2":2,"3":3,"7":7}],27:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.escapeHTML = escapeHTML; exports.debounce = debounce; exports.isObjectEmpty = isObjectEmpty; exports.splitEvents = splitEvents; exports.createEvent = createEvent; exports.isNodeAfter = isNodeAfter; exports.isString = isString; var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function escapeHTML(input) { if (typeof input !== 'string') { throw new Error('Argument passed must be a string'); } var map = { '&': '&', '<': '<', '>': '>', '"': '"' }; return input.replace(/[&<>"]/g, function (c) { return map[c]; }); } function debounce(func, wait) { var _this = this, _arguments = arguments; var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (typeof func !== 'function') { throw new Error('First argument must be a function'); } if (typeof wait !== 'number') { throw new Error('Second argument must be a numeric value'); } var timeout = void 0; return function () { var context = _this, args = _arguments; var later = function later() { timeout = null; if (!immediate) { func.apply(context, args); } }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) { func.apply(context, args); } }; } function isObjectEmpty(instance) { return Object.getOwnPropertyNames(instance).length <= 0; } function splitEvents(events, id) { var rwindow = /^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/; var ret = { d: [], w: [] }; (events || '').split(' ').forEach(function (v) { var eventName = '' + v + (id ? '.' + id : ''); if (eventName.startsWith('.')) { ret.d.push(eventName); ret.w.push(eventName); } else { ret[rwindow.test(v) ? 'w' : 'd'].push(eventName); } }); ret.d = ret.d.join(' '); ret.w = ret.w.join(' '); return ret; } function createEvent(eventName, target) { if (typeof eventName !== 'string') { throw new Error('Event name must be a string'); } var eventFrags = eventName.match(/([a-z]+\.([a-z]+))/i), detail = { target: target }; if (eventFrags !== null) { eventName = eventFrags[1]; detail.namespace = eventFrags[2]; } return new window.CustomEvent(eventName, { detail: detail }); } function isNodeAfter(sourceNode, targetNode) { return !!(sourceNode && targetNode && sourceNode.compareDocumentPosition(targetNode) & 2); } function isString(value) { return typeof value === 'string'; } _mejs2.default.Utils = _mejs2.default.Utils || {}; _mejs2.default.Utils.escapeHTML = escapeHTML; _mejs2.default.Utils.debounce = debounce; _mejs2.default.Utils.isObjectEmpty = isObjectEmpty; _mejs2.default.Utils.splitEvents = splitEvents; _mejs2.default.Utils.createEvent = createEvent; _mejs2.default.Utils.isNodeAfter = isNodeAfter; _mejs2.default.Utils.isString = isString; },{"7":7}],28:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.typeChecks = undefined; exports.absolutizeUrl = absolutizeUrl; exports.formatType = formatType; exports.getMimeFromType = getMimeFromType; exports.getTypeFromFile = getTypeFromFile; exports.getExtension = getExtension; exports.normalizeExtension = normalizeExtension; var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); var _general = _dereq_(27); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var typeChecks = exports.typeChecks = []; function absolutizeUrl(url) { if (typeof url !== 'string') { throw new Error('`url` argument must be a string'); } var el = document.createElement('div'); el.innerHTML = 'x'; return el.firstChild.href; } function formatType(url) { var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; return url && !type ? getTypeFromFile(url) : type; } function getMimeFromType(type) { if (typeof type !== 'string') { throw new Error('`type` argument must be a string'); } return type && type.indexOf(';') > -1 ? type.substr(0, type.indexOf(';')) : type; } function getTypeFromFile(url) { if (typeof url !== 'string') { throw new Error('`url` argument must be a string'); } for (var i = 0, total = typeChecks.length; i < total; i++) { var type = typeChecks[i](url); if (type) { return type; } } var ext = getExtension(url), normalizedExt = normalizeExtension(ext); var mime = 'video/mp4'; if (normalizedExt) { if (~['mp4', 'm4v', 'ogg', 'ogv', 'webm', 'flv', 'mpeg', 'mov'].indexOf(normalizedExt)) { mime = 'video/' + normalizedExt; } else if (~['mp3', 'oga', 'wav', 'mid', 'midi'].indexOf(normalizedExt)) { mime = 'audio/' + normalizedExt; } } return mime; } function getExtension(url) { if (typeof url !== 'string') { throw new Error('`url` argument must be a string'); } var baseUrl = url.split('?')[0], baseName = baseUrl.split('\\').pop().split('/').pop(); return ~baseName.indexOf('.') ? baseName.substring(baseName.lastIndexOf('.') + 1) : ''; } function normalizeExtension(extension) { if (typeof extension !== 'string') { throw new Error('`extension` argument must be a string'); } switch (extension) { case 'mp4': case 'm4v': return 'mp4'; case 'webm': case 'webma': case 'webmv': return 'webm'; case 'ogg': case 'oga': case 'ogv': return 'ogg'; default: return extension; } } _mejs2.default.Utils = _mejs2.default.Utils || {}; _mejs2.default.Utils.typeChecks = typeChecks; _mejs2.default.Utils.absolutizeUrl = absolutizeUrl; _mejs2.default.Utils.formatType = formatType; _mejs2.default.Utils.getMimeFromType = getMimeFromType; _mejs2.default.Utils.getTypeFromFile = getTypeFromFile; _mejs2.default.Utils.getExtension = getExtension; _mejs2.default.Utils.normalizeExtension = normalizeExtension; },{"27":27,"7":7}],29:[function(_dereq_,module,exports){ 'use strict'; var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); var _promisePolyfill = _dereq_(4); var _promisePolyfill2 = _interopRequireDefault(_promisePolyfill); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } (function (arr) { arr.forEach(function (item) { if (item.hasOwnProperty('remove')) { return; } Object.defineProperty(item, 'remove', { configurable: true, enumerable: true, writable: true, value: function remove() { this.parentNode.removeChild(this); } }); }); })([Element.prototype, CharacterData.prototype, DocumentType.prototype]); (function () { if (typeof window.CustomEvent === 'function') { return false; } function CustomEvent(event, params) { params = params || { bubbles: false, cancelable: false, detail: undefined }; var evt = _document2.default.createEvent('CustomEvent'); evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); return evt; } CustomEvent.prototype = window.Event.prototype; window.CustomEvent = CustomEvent; })(); if (typeof Object.assign !== 'function') { Object.assign = function (target) { if (target === null || target === undefined) { throw new TypeError('Cannot convert undefined or null to object'); } var to = Object(target); for (var index = 1, total = arguments.length; index < total; index++) { var nextSource = arguments[index]; if (nextSource !== null) { for (var nextKey in nextSource) { if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { to[nextKey] = nextSource[nextKey]; } } } } return to; }; } if (!String.prototype.startsWith) { String.prototype.startsWith = function (searchString, position) { position = position || 0; return this.substr(position, searchString.length) === searchString; }; } if (!Element.prototype.matches) { Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function (s) { var matches = (this.document || this.ownerDocument).querySelectorAll(s), i = matches.length - 1; while (--i >= 0 && matches.item(i) !== this) {} return i > -1; }; } if (window.Element && !Element.prototype.closest) { Element.prototype.closest = function (s) { var matches = (this.document || this.ownerDocument).querySelectorAll(s), i = void 0, el = this; do { i = matches.length; while (--i >= 0 && matches.item(i) !== el) {} } while (i < 0 && (el = el.parentElement)); return el; }; } (function () { var lastTime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; } if (!window.requestAnimationFrame) window.requestAnimationFrame = function (callback) { var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); var id = window.setTimeout(function () { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return id; }; if (!window.cancelAnimationFrame) window.cancelAnimationFrame = function (id) { clearTimeout(id); }; })(); if (/firefox/i.test(navigator.userAgent)) { var getComputedStyle = window.getComputedStyle; window.getComputedStyle = function (el, pseudoEl) { var t = getComputedStyle(el, pseudoEl); return t === null ? { getPropertyValue: function getPropertyValue() {} } : t; }; } if (!window.Promise) { window.Promise = _promisePolyfill2.default; } (function (constructor) { if (constructor && constructor.prototype && constructor.prototype.children === null) { Object.defineProperty(constructor.prototype, 'children', { get: function get() { var i = 0, node = void 0, nodes = this.childNodes, children = []; while (node = nodes[i++]) { if (node.nodeType === 1) { children.push(node); } } return children; } }); } })(window.Node || window.Element); },{"2":2,"4":4}],30:[function(_dereq_,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.isDropFrame = isDropFrame; exports.secondsToTimeCode = secondsToTimeCode; exports.timeCodeToSeconds = timeCodeToSeconds; exports.calculateTimeFormat = calculateTimeFormat; exports.convertSMPTEtoSeconds = convertSMPTEtoSeconds; var _mejs = _dereq_(7); var _mejs2 = _interopRequireDefault(_mejs); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function isDropFrame() { var fps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 25; return !(fps % 1 === 0); } function secondsToTimeCode(time) { var forceHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var showFrameCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var fps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 25; var secondsDecimalLength = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; var timeFormat = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'hh:mm:ss'; time = !time || typeof time !== 'number' || time < 0 ? 0 : time; var dropFrames = Math.round(fps * 0.066666), timeBase = Math.round(fps), framesPer24Hours = Math.round(fps * 3600) * 24, framesPer10Minutes = Math.round(fps * 600), frameSep = isDropFrame(fps) ? ';' : ':', hours = void 0, minutes = void 0, seconds = void 0, frames = void 0, f = Math.round(time * fps); if (isDropFrame(fps)) { if (f < 0) { f = framesPer24Hours + f; } f = f % framesPer24Hours; var d = Math.floor(f / framesPer10Minutes); var m = f % framesPer10Minutes; f = f + dropFrames * 9 * d; if (m > dropFrames) { f = f + dropFrames * Math.floor((m - dropFrames) / Math.round(timeBase * 60 - dropFrames)); } var timeBaseDivision = Math.floor(f / timeBase); hours = Math.floor(Math.floor(timeBaseDivision / 60) / 60); minutes = Math.floor(timeBaseDivision / 60) % 60; if (showFrameCount) { seconds = timeBaseDivision % 60; } else { seconds = Math.floor(f / timeBase % 60).toFixed(secondsDecimalLength); } } else { hours = Math.floor(time / 3600) % 24; minutes = Math.floor(time / 60) % 60; if (showFrameCount) { seconds = Math.floor(time % 60); } else { seconds = Math.floor(time % 60).toFixed(secondsDecimalLength); } } hours = hours <= 0 ? 0 : hours; minutes = minutes <= 0 ? 0 : minutes; seconds = seconds <= 0 ? 0 : seconds; seconds = seconds === 60 ? 0 : seconds; minutes = minutes === 60 ? 0 : minutes; var timeFormatFrags = timeFormat.split(':'); var timeFormatSettings = {}; for (var i = 0, total = timeFormatFrags.length; i < total; ++i) { var unique = ''; for (var j = 0, t = timeFormatFrags[i].length; j < t; j++) { if (unique.indexOf(timeFormatFrags[i][j]) < 0) { unique += timeFormatFrags[i][j]; } } if (~['f', 's', 'm', 'h'].indexOf(unique)) { timeFormatSettings[unique] = timeFormatFrags[i].length; } } var result = forceHours || hours > 0 ? (hours < 10 && timeFormatSettings.h > 1 ? '0' + hours : hours) + ':' : ''; result += (minutes < 10 && timeFormatSettings.m > 1 ? '0' + minutes : minutes) + ':'; result += '' + (seconds < 10 && timeFormatSettings.s > 1 ? '0' + seconds : seconds); if (showFrameCount) { frames = (f % timeBase).toFixed(0); frames = frames <= 0 ? 0 : frames; result += frames < 10 && timeFormatSettings.f ? frameSep + '0' + frames : '' + frameSep + frames; } return result; } function timeCodeToSeconds(time) { var fps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 25; if (typeof time !== 'string') { throw new TypeError('Time must be a string'); } if (time.indexOf(';') > 0) { time = time.replace(';', ':'); } if (!/\d{2}(\:\d{2}){0,3}/i.test(time)) { throw new TypeError('Time code must have the format `00:00:00`'); } var parts = time.split(':'); var output = void 0, hours = 0, minutes = 0, seconds = 0, frames = 0, totalMinutes = 0, dropFrames = Math.round(fps * 0.066666), timeBase = Math.round(fps), hFrames = timeBase * 3600, mFrames = timeBase * 60; switch (parts.length) { default: case 1: seconds = parseInt(parts[0], 10); break; case 2: minutes = parseInt(parts[0], 10); seconds = parseInt(parts[1], 10); break; case 3: hours = parseInt(parts[0], 10); minutes = parseInt(parts[1], 10); seconds = parseInt(parts[2], 10); break; case 4: hours = parseInt(parts[0], 10); minutes = parseInt(parts[1], 10); seconds = parseInt(parts[2], 10); frames = parseInt(parts[3], 10); break; } if (isDropFrame(fps)) { totalMinutes = 60 * hours + minutes; output = hFrames * hours + mFrames * minutes + timeBase * seconds + frames - dropFrames * (totalMinutes - Math.floor(totalMinutes / 10)); } else { output = (hFrames * hours + mFrames * minutes + fps * seconds + frames) / fps; } return parseFloat(output.toFixed(3)); } function calculateTimeFormat(time, options) { var fps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 25; time = !time || typeof time !== 'number' || time < 0 ? 0 : time; var hours = Math.floor(time / 3600) % 24, minutes = Math.floor(time / 60) % 60, seconds = Math.floor(time % 60), frames = Math.floor((time % 1 * fps).toFixed(3)), lis = [[frames, 'f'], [seconds, 's'], [minutes, 'm'], [hours, 'h']]; var format = options.timeFormat, firstTwoPlaces = format[1] === format[0], separatorIndex = firstTwoPlaces ? 2 : 1, separator = format.length < separatorIndex ? format[separatorIndex] : ':', firstChar = format[0], required = false; for (var i = 0, len = lis.length; i < len; i++) { if (~format.indexOf(lis[i][1])) { required = true; } else if (required) { var hasNextValue = false; for (var j = i; j < len; j++) { if (lis[j][0] > 0) { hasNextValue = true; break; } } if (!hasNextValue) { break; } if (!firstTwoPlaces) { format = firstChar + format; } format = lis[i][1] + separator + format; if (firstTwoPlaces) { format = lis[i][1] + format; } firstChar = lis[i][1]; } } options.timeFormat = format; } function convertSMPTEtoSeconds(SMPTE) { if (typeof SMPTE !== 'string') { throw new TypeError('Argument must be a string value'); } SMPTE = SMPTE.replace(',', '.'); var decimalLen = ~SMPTE.indexOf('.') ? SMPTE.split('.')[1].length : 0; var secs = 0, multiplier = 1; SMPTE = SMPTE.split(':').reverse(); for (var i = 0, total = SMPTE.length; i < total; i++) { multiplier = 1; if (i > 0) { multiplier = Math.pow(60, i); } secs += Number(SMPTE[i]) * multiplier; } return Number(secs.toFixed(decimalLen)); } _mejs2.default.Utils = _mejs2.default.Utils || {}; _mejs2.default.Utils.secondsToTimeCode = secondsToTimeCode; _mejs2.default.Utils.timeCodeToSeconds = timeCodeToSeconds; _mejs2.default.Utils.calculateTimeFormat = calculateTimeFormat; _mejs2.default.Utils.convertSMPTEtoSeconds = convertSMPTEtoSeconds; },{"7":7}]},{},[29,6,5,15,23,20,19,21,22,24,16,18,17,9,10,11,12,13,14]); /* Source: src/mt-includes/assets/mediaelement/moto-skin.js*/ (function($) { $.extend(MediaElementPlayer.prototype, { buildmototrackname: function(player, controls) { var trackNameElement; trackNameElement = $('
    ' + player.options.motoTrackName + '
    '); trackNameElement.attr('title', trackNameElement.text()); trackNameElement.appendTo($(controls).find('.mejs-time-rail')); }, buildmotoloop: function(player, controls) { var loopElement; loopElement = $('
    ') .appendTo(controls) .click(function() { player.options.loop = !player.options.loop; loopElement.toggleClass('mejs-button_active'); }); }, buildmotoskin: function(player, controls, layers, media) { var stopElement; var playpauseElement; var $controls; var volumeButtonElement; var $playerContainer; var $volumeControls; function toggleVolumeControls(containerSize) { // 350px is the smallest width when controls look good if (containerSize < 350) { $volumeControls.hide(); } else { $volumeControls.show(); } } $playerContainer = $(player.container); $controls = $(controls); $volumeControls = $controls.find('.mejs-volume-button'); stopElement = $controls.find('.mejs-stop'); playpauseElement = $controls.find('.mejs-playpause-button'); stopElement.on('click', function() { stopElement.toggleClass('mejs-button_active'); }); playpauseElement.on('click', function() { stopElement.removeClass('mejs-button_active'); }); $controls.find('.mejs-volume-button').append($controls.find('.mejs-horizontal-volume-slider')); $controls.find('.mejs-time-rail').append($controls.find('.mejs-time')); volumeButtonElement = $controls.find('.mejs-volume-button button').attr('title', ''); $controls.append($('
    ')); toggleVolumeControls($playerContainer.innerWidth()); $(window).on('resize', function() { toggleVolumeControls($playerContainer.innerWidth()); }); function animationEndHandler() { var count = 2; var intervalID; player.setPlayerSize(); player.setControlsSize(); intervalID = setInterval(function() { count--; player.setPlayerSize(); player.setControlsSize(); if (count <= 0) { clearInterval(intervalID); } }, 500); } function hideMuteTitleText() { var count = 2; var intervalID; volumeButtonElement.attr('title', ''); intervalID = setInterval(function() { count--; volumeButtonElement.attr('title', ''); if (count <= 0) { clearInterval(intervalID); } }, 500); } $controls.closest('.moto-widget-audio_player').on('animationend', animationEndHandler); volumeButtonElement.on('mousemove', hideMuteTitleText); media.addEventListener('volumechange', hideMuteTitleText); }, // Copied from 2.22 version of mediaelement.js plugin buildstop: function(player, controls, layers, media) { var t = this; $('
    ' + '' + '
    ') .appendTo(controls) .click(function() { if (!media.paused) { media.pause(); } if (media.currentTime > 0) { media.setCurrentTime(0); media.pause(); } }); }, buildmotodownload: function(player, controls) { function getUrl() { var mp4Element = $(player.domNode).find('source[type="video/mp4"]'); if (mp4Element.length) { return mp4Element.attr('src'); } else { return player.getSrc(); } } $('
    ').appendTo(controls); } }); })($); /* Source: src/mt-includes/assets/humanize-duration/humanize-duration.js*/ // HumanizeDuration.js - http://git.io/j0HgmQ ;(function () { var languages = { ar: { y: function (c) { return c === 1 ? 'سنة' : 'سنوات' }, mo: function (c) { return c === 1 ? 'شهر' : 'أشهر' }, w: function (c) { return c === 1 ? 'أسبوع' : 'أسابيع' }, d: function (c) { return c === 1 ? 'يوم' : 'أيام' }, h: function (c) { return c === 1 ? 'ساعة' : 'ساعات' }, m: function (c) { return c === 1 ? 'دقيقة' : 'دقائق' }, s: function (c) { return c === 1 ? 'ثانية' : 'ثواني' }, ms: function (c) { return c === 1 ? 'جزء من الثانية' : 'أجزاء من الثانية' }, decimal: ',' }, ca: { y: function (c) { return 'any' + (c !== 1 ? 's' : '') }, mo: function (c) { return 'mes' + (c !== 1 ? 'os' : '') }, w: function (c) { return 'setman' + (c !== 1 ? 'es' : 'a') }, d: function (c) { return 'di' + (c !== 1 ? 'es' : 'a') }, h: function (c) { return 'hor' + (c !== 1 ? 'es' : 'a') }, m: function (c) { return 'minut' + (c !== 1 ? 's' : '') }, s: function (c) { return 'segon' + (c !== 1 ? 's' : '') }, ms: function (c) { return 'milisegon' + (c !== 1 ? 's' : '') }, decimal: ',' }, cs: { y: function (c) { return ['rok', 'roku', 'roky', 'let'][getCzechForm(c)] }, mo: function (c) { return ['měsíc', 'měsíce', 'měsíce', 'měsíců'][getCzechForm(c)] }, w: function (c) { return ['týden', 'týdne', 'týdny', 'týdnů'][getCzechForm(c)] }, d: function (c) { return ['den', 'dne', 'dny', 'dní'][getCzechForm(c)] }, h: function (c) { return ['hodina', 'hodiny', 'hodiny', 'hodin'][getCzechForm(c)] }, m: function (c) { return ['minuta', 'minuty', 'minuty', 'minut'][getCzechForm(c)] }, s: function (c) { return ['sekunda', 'sekundy', 'sekundy', 'sekund'][getCzechForm(c)] }, ms: function (c) { return ['milisekunda', 'milisekundy', 'milisekundy', 'milisekund'][getCzechForm(c)] }, decimal: ',' }, da: { y: 'år', mo: function (c) { return 'måned' + (c !== 1 ? 'er' : '') }, w: function (c) { return 'uge' + (c !== 1 ? 'r' : '') }, d: function (c) { return 'dag' + (c !== 1 ? 'e' : '') }, h: function (c) { return 'time' + (c !== 1 ? 'r' : '') }, m: function (c) { return 'minut' + (c !== 1 ? 'ter' : '') }, s: function (c) { return 'sekund' + (c !== 1 ? 'er' : '') }, ms: function (c) { return 'millisekund' + (c !== 1 ? 'er' : '') }, decimal: ',' }, de: { y: function (c) { return 'Jahr' + (c !== 1 ? 'e' : '') }, mo: function (c) { return 'Monat' + (c !== 1 ? 'e' : '') }, w: function (c) { return 'Woche' + (c !== 1 ? 'n' : '') }, d: function (c) { return 'Tag' + (c !== 1 ? 'e' : '') }, h: function (c) { return 'Stunde' + (c !== 1 ? 'n' : '') }, m: function (c) { return 'Minute' + (c !== 1 ? 'n' : '') }, s: function (c) { return 'Sekunde' + (c !== 1 ? 'n' : '') }, ms: function (c) { return 'Millisekunde' + (c !== 1 ? 'n' : '') }, decimal: ',' }, en: { y: function (c) { return 'year' + (c !== 1 ? 's' : '') }, mo: function (c) { return 'month' + (c !== 1 ? 's' : '') }, w: function (c) { return 'week' + (c !== 1 ? 's' : '') }, d: function (c) { return 'day' + (c !== 1 ? 's' : '') }, h: function (c) { return 'hour' + (c !== 1 ? 's' : '') }, m: function (c) { return 'minute' + (c !== 1 ? 's' : '') }, s: function (c) { return 'second' + (c !== 1 ? 's' : '') }, ms: function (c) { return 'millisecond' + (c !== 1 ? 's' : '') }, decimal: '.' }, es: { y: function (c) { return 'año' + (c !== 1 ? 's' : '') }, mo: function (c) { return 'mes' + (c !== 1 ? 'es' : '') }, w: function (c) { return 'semana' + (c !== 1 ? 's' : '') }, d: function (c) { return 'día' + (c !== 1 ? 's' : '') }, h: function (c) { return 'hora' + (c !== 1 ? 's' : '') }, m: function (c) { return 'minuto' + (c !== 1 ? 's' : '') }, s: function (c) { return 'segundo' + (c !== 1 ? 's' : '') }, ms: function (c) { return 'milisegundo' + (c !== 1 ? 's' : '') }, decimal: ',' }, fi: { y: function (c) { return c === 1 ? 'vuosi' : 'vuotta' }, mo: function (c) { return c === 1 ? 'kuukausi' : 'kuukautta' }, w: function (c) { return 'viikko' + (c !== 1 ? 'a' : '') }, d: function (c) { return 'päivä' + (c !== 1 ? 'ä' : '') }, h: function (c) { return 'tunti' + (c !== 1 ? 'a' : '') }, m: function (c) { return 'minuutti' + (c !== 1 ? 'a' : '') }, s: function (c) { return 'sekunti' + (c !== 1 ? 'a' : '') }, ms: function (c) { return 'millisekunti' + (c !== 1 ? 'a' : '') }, decimal: ',' }, fr: { y: function (c) { return 'an' + (c !== 1 ? 's' : '') }, mo: 'mois', w: function (c) { return 'semaine' + (c !== 1 ? 's' : '') }, d: function (c) { return 'jour' + (c !== 1 ? 's' : '') }, h: function (c) { return 'heure' + (c !== 1 ? 's' : '') }, m: function (c) { return 'minute' + (c !== 1 ? 's' : '') }, s: function (c) { return 'seconde' + (c !== 1 ? 's' : '') }, ms: function (c) { return 'milliseconde' + (c !== 1 ? 's' : '') }, decimal: ',' }, gr: { y: function (c) { return c === 1 ? 'χρόνος' : 'χρόνια' }, mo: function (c) { return c === 1 ? 'μήνας' : 'μήνες' }, w: function (c) { return c === 1 ? 'εβδομάδα' : 'εβδομάδες' }, d: function (c) { return c === 1 ? 'μέρα' : 'μέρες' }, h: function (c) { return c === 1 ? 'ώρα' : 'ώρες' }, m: function (c) { return c === 1 ? 'λεπτό' : 'λεπτά' }, s: function (c) { return c === 1 ? 'δευτερόλεπτο' : 'δευτερόλεπτα' }, ms: function (c) { return c === 1 ? 'χιλιοστό του δευτερολέπτου' : 'χιλιοστά του δευτερολέπτου' }, decimal: ',' }, hu: { y: 'év', mo: 'hónap', w: 'hét', d: 'nap', h: 'óra', m: 'perc', s: 'másodperc', ms: 'ezredmásodperc', decimal: ',' }, id: { y: 'tahun', mo: 'bulan', w: 'minggu', d: 'hari', h: 'jam', m: 'menit', s: 'detik', ms: 'milidetik', decimal: '.' }, it: { y: function (c) { return 'ann' + (c !== 1 ? 'i' : 'o') }, mo: function (c) { return 'mes' + (c !== 1 ? 'i' : 'e') }, w: function (c) { return 'settiman' + (c !== 1 ? 'e' : 'a') }, d: function (c) { return 'giorn' + (c !== 1 ? 'i' : 'o') }, h: function (c) { return 'or' + (c !== 1 ? 'e' : 'a') }, m: function (c) { return 'minut' + (c !== 1 ? 'i' : 'o') }, s: function (c) { return 'second' + (c !== 1 ? 'i' : 'o') }, ms: function (c) { return 'millisecond' + (c !== 1 ? 'i' : 'o') }, decimal: ',' }, ja: { y: '年', mo: '月', w: '週', d: '日', h: '時間', m: '分', s: '秒', ms: 'ミリ秒', decimal: '.' }, ko: { y: '년', mo: '개월', w: '주일', d: '일', h: '시간', m: '분', s: '초', ms: '밀리 초', decimal: '.' }, lt: { y: function (c) { return ((c % 10 === 0) || (c % 100 >= 10 && c % 100 <= 20)) ? 'metų' : 'metai' }, mo: function (c) { return ['mėnuo', 'mėnesiai', 'mėnesių'][getLithuanianForm(c)] }, w: function (c) { return ['savaitė', 'savaitės', 'savaičių'][getLithuanianForm(c)] }, d: function (c) { return ['diena', 'dienos', 'dienų'][getLithuanianForm(c)] }, h: function (c) { return ['valanda', 'valandos', 'valandų'][getLithuanianForm(c)] }, m: function (c) { return ['minutė', 'minutės', 'minučių'][getLithuanianForm(c)] }, s: function (c) { return ['sekundė', 'sekundės', 'sekundžių'][getLithuanianForm(c)] }, ms: function (c) { return ['milisekundė', 'milisekundės', 'milisekundžių'][getLithuanianForm(c)] }, decimal: ',' }, ms: { y: 'tahun', mo: 'bulan', w: 'minggu', d: 'hari', h: 'jam', m: 'minit', s: 'saat', ms: 'milisaat', decimal: '.' }, nl: { y: 'jaar', mo: function (c) { return c === 1 ? 'maand' : 'maanden' }, w: function (c) { return c === 1 ? 'week' : 'weken' }, d: function (c) { return c === 1 ? 'dag' : 'dagen' }, h: 'uur', m: function (c) { return c === 1 ? 'minuut' : 'minuten' }, s: function (c) { return c === 1 ? 'seconde' : 'seconden' }, ms: function (c) { return c === 1 ? 'milliseconde' : 'milliseconden' }, decimal: ',' }, no: { y: 'år', mo: function (c) { return 'måned' + (c !== 1 ? 'er' : '') }, w: function (c) { return 'uke' + (c !== 1 ? 'r' : '') }, d: function (c) { return 'dag' + (c !== 1 ? 'er' : '') }, h: function (c) { return 'time' + (c !== 1 ? 'r' : '') }, m: function (c) { return 'minutt' + (c !== 1 ? 'er' : '') }, s: function (c) { return 'sekund' + (c !== 1 ? 'er' : '') }, ms: function (c) { return 'millisekund' + (c !== 1 ? 'er' : '') }, decimal: ',' }, pl: { y: function (c) { return ['rok', 'roku', 'lata', 'lat'][getPolishForm(c)] }, mo: function (c) { return ['miesiąc', 'miesiąca', 'miesiące', 'miesięcy'][getPolishForm(c)] }, w: function (c) { return ['tydzień', 'tygodnia', 'tygodnie', 'tygodni'][getPolishForm(c)] }, d: function (c) { return ['dzień', 'dnia', 'dni', 'dni'][getPolishForm(c)] }, h: function (c) { return ['godzina', 'godziny', 'godziny', 'godzin'][getPolishForm(c)] }, m: function (c) { return ['minuta', 'minuty', 'minuty', 'minut'][getPolishForm(c)] }, s: function (c) { return ['sekunda', 'sekundy', 'sekundy', 'sekund'][getPolishForm(c)] }, ms: function (c) { return ['milisekunda', 'milisekundy', 'milisekundy', 'milisekund'][getPolishForm(c)] }, decimal: ',' }, pt: { y: function (c) { return 'ano' + (c !== 1 ? 's' : '') }, mo: function (c) { return c !== 1 ? 'meses' : 'mês' }, w: function (c) { return 'semana' + (c !== 1 ? 's' : '') }, d: function (c) { return 'dia' + (c !== 1 ? 's' : '') }, h: function (c) { return 'hora' + (c !== 1 ? 's' : '') }, m: function (c) { return 'minuto' + (c !== 1 ? 's' : '') }, s: function (c) { return 'segundo' + (c !== 1 ? 's' : '') }, ms: function (c) { return 'milissegundo' + (c !== 1 ? 's' : '') }, decimal: ',' }, ru: { y: function (c) { return ['лет', 'год', 'года'][getSlavicForm(c)] }, mo: function (c) { return ['месяцев', 'месяц', 'месяца'][getSlavicForm(c)] }, w: function (c) { return ['недель', 'неделя', 'недели'][getSlavicForm(c)] }, d: function (c) { return ['дней', 'день', 'дня'][getSlavicForm(c)] }, h: function (c) { return ['часов', 'час', 'часа'][getSlavicForm(c)] }, m: function (c) { return ['минут', 'минута', 'минуты'][getSlavicForm(c)] }, s: function (c) { return ['секунд', 'секунда', 'секунды'][getSlavicForm(c)] }, ms: function (c) { return ['миллисекунд', 'миллисекунда', 'миллисекунды'][getSlavicForm(c)] }, decimal: ',' }, uk: { y: function (c) { return ['років', 'рік', 'роки'][getSlavicForm(c)] }, mo: function (c) { return ['місяців', 'місяць', 'місяці'][getSlavicForm(c)] }, w: function (c) { return ['неділь', 'неділя', 'неділі'][getSlavicForm(c)] }, d: function (c) { return ['днів', 'день', 'дні'][getSlavicForm(c)] }, h: function (c) { return ['годин', 'година', 'години'][getSlavicForm(c)] }, m: function (c) { return ['хвилин', 'хвилина', 'хвилини'][getSlavicForm(c)] }, s: function (c) { return ['секунд', 'секунда', 'секунди'][getSlavicForm(c)] }, ms: function (c) { return ['мілісекунд', 'мілісекунда', 'мілісекунди'][getSlavicForm(c)] }, decimal: ',' }, sv: { y: 'år', mo: function (c) { return 'månad' + (c !== 1 ? 'er' : '') }, w: function (c) { return 'veck' + (c !== 1 ? 'or' : 'a') }, d: function (c) { return 'dag' + (c !== 1 ? 'ar' : '') }, h: function (c) { return 'timm' + (c !== 1 ? 'ar' : 'e') }, m: function (c) { return 'minut' + (c !== 1 ? 'er' : '') }, s: function (c) { return 'sekund' + (c !== 1 ? 'er' : '') }, ms: function (c) { return 'millisekund' + (c !== 1 ? 'er' : '') }, decimal: ',' }, tr: { y: 'yıl', mo: 'ay', w: 'hafta', d: 'gün', h: 'saat', m: 'dakika', s: 'saniye', ms: 'milisaniye', decimal: ',' }, vi: { y: 'năm', mo: 'tháng', w: 'tuần', d: 'ngày', h: 'giờ', m: 'phút', s: 'giây', ms: 'mili giây', decimal: ',' }, zh_CN: { y: '年', mo: '个月', w: '周', d: '天', h: '小时', m: '分钟', s: '秒', ms: '毫秒', decimal: '.' }, zh_TW: { y: '年', mo: '個月', w: '周', d: '天', h: '小時', m: '分鐘', s: '秒', ms: '毫秒', decimal: '.' } } // You can create a humanizer, which returns a function with default // parameters. function humanizer (passedOptions) { var result = function humanizer (ms, humanizerOptions) { var options = extend({}, result, humanizerOptions || {}) return doHumanization(ms, options) } return extend(result, { language: 'en', delimiter: ', ', spacer: ' ', conjunction: '', serialComma: true, units: ['y', 'mo', 'w', 'd', 'h', 'm', 's'], languages: {}, round: false, unitMeasures: { y: 31557600000, mo: 2629800000, w: 604800000, d: 86400000, h: 3600000, m: 60000, s: 1000, ms: 1 } }, passedOptions) } // The main function is just a wrapper around a default humanizer. var humanizeDuration = humanizer({}) // doHumanization does the bulk of the work. function doHumanization (ms, options) { var i, len, piece // Make sure we have a positive number. // Has the nice sideffect of turning Number objects into primitives. ms = Math.abs(ms) var dictionary = options.languages[options.language] || languages[options.language] if (!dictionary) { throw new Error('No language ' + dictionary + '.') } var pieces = [] // Start at the top and keep removing units, bit by bit. var unitName, unitMS, unitCount for (i = 0, len = options.units.length; i < len; i++) { unitName = options.units[i] unitMS = options.unitMeasures[unitName] // What's the number of full units we can fit? if (i + 1 === len) { unitCount = ms / unitMS } else { unitCount = Math.floor(ms / unitMS) } // Add the string. pieces.push({ unitCount: unitCount, unitName: unitName }) // Remove what we just figured out. ms -= unitCount * unitMS } var firstOccupiedUnitIndex = 0 for (i = 0; i < pieces.length; i++) { if (pieces[i].unitCount) { firstOccupiedUnitIndex = i break } } if (options.round) { var ratioToLargerUnit, previousPiece for (i = pieces.length - 1; i >= 0; i--) { piece = pieces[i] piece.unitCount = Math.round(piece.unitCount) if (i === 0) { break } previousPiece = pieces[i - 1] ratioToLargerUnit = options.unitMeasures[previousPiece.unitName] / options.unitMeasures[piece.unitName] if ((piece.unitCount % ratioToLargerUnit) === 0 || (options.largest && ((options.largest - 1) < (i - firstOccupiedUnitIndex)))) { previousPiece.unitCount += piece.unitCount / ratioToLargerUnit piece.unitCount = 0 } } } var result = [] for (i = 0, pieces.length; i < len; i++) { piece = pieces[i] if (piece.unitCount) { result.push(render(piece.unitCount, piece.unitName, dictionary, options)) } if (result.length === options.largest) { break } } if (result.length) { if (!options.conjunction || result.length === 1) { return result.join(options.delimiter) } else if (result.length === 2) { return result.join(options.conjunction) } else if (result.length > 2) { return result.slice(0, -1).join(options.delimiter) + (options.serialComma ? ',' : '') + options.conjunction + result.slice(-1) } } else { return render(0, options.units[options.units.length - 1], dictionary, options) } } function render (count, type, dictionary, options) { var decimal if (options.decimal === void 0) { decimal = dictionary.decimal } else { decimal = options.decimal } var countStr = count.toString().replace('.', decimal) var dictionaryValue = dictionary[type] var word if (typeof dictionaryValue === 'function') { word = dictionaryValue(count) } else { word = dictionaryValue } return countStr + options.spacer + word } function extend (destination) { var source for (var i = 1; i < arguments.length; i++) { source = arguments[i] for (var prop in source) { if (source.hasOwnProperty(prop)) { destination[prop] = source[prop] } } } return destination } // Internal helper function for Czech language. function getCzechForm (c) { if (c === 1) { return 0 } else if (Math.floor(c) !== c) { return 1 } else if (c % 10 >= 2 && c % 10 <= 4 && c % 100 < 10) { return 2 } else { return 3 } } // Internal helper function for Polish language. function getPolishForm (c) { if (c === 1) { return 0 } else if (Math.floor(c) !== c) { return 1 } else if (c % 10 >= 2 && c % 10 <= 4 && !(c % 100 > 10 && c % 100 < 20)) { return 2 } else { return 3 } } // Internal helper function for Russian and Ukranian languages. function getSlavicForm (c) { if (Math.floor(c) !== c) { return 2 } else if ((c % 100 >= 5 && c % 100 <= 20) || (c % 10 >= 5 && c % 10 <= 9) || c % 10 === 0) { return 0 } else if (c % 10 === 1) { return 1 } else if (c > 1) { return 2 } else { return 0 } } // Internal helper function for Lithuanian language. function getLithuanianForm (c) { if (c === 1 || (c % 10 === 1 && c % 100 > 20)) { return 0 } else if (Math.floor(c) !== c || (c % 10 >= 2 && c % 100 > 20) || (c % 10 >= 2 && c % 100 < 10)) { return 1 } else { return 2 } } humanizeDuration.getSupportedLanguages = function getSupportedLanguages () { var result = [] for (var language in languages) { if (languages.hasOwnProperty(language)) { result.push(language) } } return result } humanizeDuration.humanizer = humanizer if (typeof define === 'function' && define.amd) { define(function () { return humanizeDuration }) } else if (typeof module !== 'undefined' && module.exports) { module.exports = humanizeDuration } else { this.humanizeDuration = humanizeDuration } })(); // eslint-disable-line semi /* Source: src/mt-includes/assets/momentjs/moment.js*/ //! moment.js //! version : 2.20.1 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com ;(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.moment = factory() }(this, (function () { 'use strict'; var hookCallback; function hooks () { return hookCallback.apply(null, arguments); } // This is done to register the method called with moment() // without creating circular dependencies. function setHookCallback (callback) { hookCallback = callback; } function isArray(input) { return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; } function isObject(input) { // IE8 will treat undefined and null as object if it wasn't for // input != null return input != null && Object.prototype.toString.call(input) === '[object Object]'; } function isObjectEmpty(obj) { if (Object.getOwnPropertyNames) { return (Object.getOwnPropertyNames(obj).length === 0); } else { var k; for (k in obj) { if (obj.hasOwnProperty(k)) { return false; } } return true; } } function isUndefined(input) { return input === void 0; } function isNumber(input) { return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; } function isDate(input) { return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; } function map(arr, fn) { var res = [], i; for (i = 0; i < arr.length; ++i) { res.push(fn(arr[i], i)); } return res; } function hasOwnProp(a, b) { return Object.prototype.hasOwnProperty.call(a, b); } function extend(a, b) { for (var i in b) { if (hasOwnProp(b, i)) { a[i] = b[i]; } } if (hasOwnProp(b, 'toString')) { a.toString = b.toString; } if (hasOwnProp(b, 'valueOf')) { a.valueOf = b.valueOf; } return a; } function createUTC (input, format, locale, strict) { return createLocalOrUTC(input, format, locale, strict, true).utc(); } function defaultParsingFlags() { // We need to deep clone this object. return { empty : false, unusedTokens : [], unusedInput : [], overflow : -2, charsLeftOver : 0, nullInput : false, invalidMonth : null, invalidFormat : false, userInvalidated : false, iso : false, parsedDateParts : [], meridiem : null, rfc2822 : false, weekdayMismatch : false }; } function getParsingFlags(m) { if (m._pf == null) { m._pf = defaultParsingFlags(); } return m._pf; } var some; if (Array.prototype.some) { some = Array.prototype.some; } else { some = function (fun) { var t = Object(this); var len = t.length >>> 0; for (var i = 0; i < len; i++) { if (i in t && fun.call(this, t[i], i, t)) { return true; } } return false; }; } function isValid(m) { if (m._isValid == null) { var flags = getParsingFlags(m); var parsedParts = some.call(flags.parsedDateParts, function (i) { return i != null; }); var isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || (flags.meridiem && parsedParts)); if (m._strict) { isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined; } if (Object.isFrozen == null || !Object.isFrozen(m)) { m._isValid = isNowValid; } else { return isNowValid; } } return m._isValid; } function createInvalid (flags) { var m = createUTC(NaN); if (flags != null) { extend(getParsingFlags(m), flags); } else { getParsingFlags(m).userInvalidated = true; } return m; } // Plugins that add properties should also add the key here (null value), // so we can properly clone ourselves. var momentProperties = hooks.momentProperties = []; function copyConfig(to, from) { var i, prop, val; if (!isUndefined(from._isAMomentObject)) { to._isAMomentObject = from._isAMomentObject; } if (!isUndefined(from._i)) { to._i = from._i; } if (!isUndefined(from._f)) { to._f = from._f; } if (!isUndefined(from._l)) { to._l = from._l; } if (!isUndefined(from._strict)) { to._strict = from._strict; } if (!isUndefined(from._tzm)) { to._tzm = from._tzm; } if (!isUndefined(from._isUTC)) { to._isUTC = from._isUTC; } if (!isUndefined(from._offset)) { to._offset = from._offset; } if (!isUndefined(from._pf)) { to._pf = getParsingFlags(from); } if (!isUndefined(from._locale)) { to._locale = from._locale; } if (momentProperties.length > 0) { for (i = 0; i < momentProperties.length; i++) { prop = momentProperties[i]; val = from[prop]; if (!isUndefined(val)) { to[prop] = val; } } } return to; } var updateInProgress = false; // Moment prototype object function Moment(config) { copyConfig(this, config); this._d = new Date(config._d != null ? config._d.getTime() : NaN); if (!this.isValid()) { this._d = new Date(NaN); } // Prevent infinite loop in case updateOffset creates new moment // objects. if (updateInProgress === false) { updateInProgress = true; hooks.updateOffset(this); updateInProgress = false; } } function isMoment (obj) { return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); } function absFloor (number) { if (number < 0) { // -0 -> 0 return Math.ceil(number) || 0; } else { return Math.floor(number); } } function toInt(argumentForCoercion) { var coercedNumber = +argumentForCoercion, value = 0; if (coercedNumber !== 0 && isFinite(coercedNumber)) { value = absFloor(coercedNumber); } return value; } // compare two arrays, return the number of differences function compareArrays(array1, array2, dontConvert) { var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; for (i = 0; i < len; i++) { if ((dontConvert && array1[i] !== array2[i]) || (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { diffs++; } } return diffs + lengthDiff; } function warn(msg) { if (hooks.suppressDeprecationWarnings === false && (typeof console !== 'undefined') && console.warn) { console.warn('Deprecation warning: ' + msg); } } function deprecate(msg, fn) { var firstTime = true; return extend(function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }, fn); } var deprecations = {}; function deprecateSimple(name, msg) { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(name, msg); } if (!deprecations[name]) { warn(msg); deprecations[name] = true; } } hooks.suppressDeprecationWarnings = false; hooks.deprecationHandler = null; function isFunction(input) { return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; } function set (config) { var prop, i; for (i in config) { prop = config[i]; if (isFunction(prop)) { this[i] = prop; } else { this['_' + i] = prop; } } this._config = config; // Lenient ordinal parsing accepts just a number in addition to // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. // TODO: Remove "ordinalParse" fallback in next major release. this._dayOfMonthOrdinalParseLenient = new RegExp( (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + (/\d{1,2}/).source); } function mergeConfigs(parentConfig, childConfig) { var res = extend({}, parentConfig), prop; for (prop in childConfig) { if (hasOwnProp(childConfig, prop)) { if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { res[prop] = {}; extend(res[prop], parentConfig[prop]); extend(res[prop], childConfig[prop]); } else if (childConfig[prop] != null) { res[prop] = childConfig[prop]; } else { delete res[prop]; } } } for (prop in parentConfig) { if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) { // make sure changes to properties don't modify parent config res[prop] = extend({}, res[prop]); } } return res; } function Locale(config) { if (config != null) { this.set(config); } } var keys; if (Object.keys) { keys = Object.keys; } else { keys = function (obj) { var i, res = []; for (i in obj) { if (hasOwnProp(obj, i)) { res.push(i); } } return res; }; } var defaultCalendar = { sameDay : '[Today at] LT', nextDay : '[Tomorrow at] LT', nextWeek : 'dddd [at] LT', lastDay : '[Yesterday at] LT', lastWeek : '[Last] dddd [at] LT', sameElse : 'L' }; function calendar (key, mom, now) { var output = this._calendar[key] || this._calendar['sameElse']; return isFunction(output) ? output.call(mom, now) : output; } var defaultLongDateFormat = { LTS : 'h:mm:ss A', LT : 'h:mm A', L : 'MM/DD/YYYY', LL : 'MMMM D, YYYY', LLL : 'MMMM D, YYYY h:mm A', LLLL : 'dddd, MMMM D, YYYY h:mm A' }; function longDateFormat (key) { var format = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()]; if (format || !formatUpper) { return format; } this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { return val.slice(1); }); return this._longDateFormat[key]; } var defaultInvalidDate = 'Invalid date'; function invalidDate () { return this._invalidDate; } var defaultOrdinal = '%d'; var defaultDayOfMonthOrdinalParse = /\d{1,2}/; function ordinal (number) { return this._ordinal.replace('%d', number); } var defaultRelativeTime = { future : 'in %s', past : '%s ago', s : 'a few seconds', ss : '%d seconds', m : 'a minute', mm : '%d minutes', h : 'an hour', hh : '%d hours', d : 'a day', dd : '%d days', M : 'a month', MM : '%d months', y : 'a year', yy : '%d years' }; function relativeTime (number, withoutSuffix, string, isFuture) { var output = this._relativeTime[string]; return (isFunction(output)) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number); } function pastFuture (diff, output) { var format = this._relativeTime[diff > 0 ? 'future' : 'past']; return isFunction(format) ? format(output) : format.replace(/%s/i, output); } var aliases = {}; function addUnitAlias (unit, shorthand) { var lowerCase = unit.toLowerCase(); aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; } function normalizeUnits(units) { return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; } function normalizeObjectUnits(inputObject) { var normalizedInput = {}, normalizedProp, prop; for (prop in inputObject) { if (hasOwnProp(inputObject, prop)) { normalizedProp = normalizeUnits(prop); if (normalizedProp) { normalizedInput[normalizedProp] = inputObject[prop]; } } } return normalizedInput; } var priorities = {}; function addUnitPriority(unit, priority) { priorities[unit] = priority; } function getPrioritizedUnits(unitsObj) { var units = []; for (var u in unitsObj) { units.push({unit: u, priority: priorities[u]}); } units.sort(function (a, b) { return a.priority - b.priority; }); return units; } function zeroFill(number, targetLength, forceSign) { var absNumber = '' + Math.abs(number), zerosToFill = targetLength - absNumber.length, sign = number >= 0; return (sign ? (forceSign ? '+' : '') : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; } var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; var formatFunctions = {}; var formatTokenFunctions = {}; // token: 'M' // padded: ['MM', 2] // ordinal: 'Mo' // callback: function () { this.month() + 1 } function addFormatToken (token, padded, ordinal, callback) { var func = callback; if (typeof callback === 'string') { func = function () { return this[callback](); }; } if (token) { formatTokenFunctions[token] = func; } if (padded) { formatTokenFunctions[padded[0]] = function () { return zeroFill(func.apply(this, arguments), padded[1], padded[2]); }; } if (ordinal) { formatTokenFunctions[ordinal] = function () { return this.localeData().ordinal(func.apply(this, arguments), token); }; } } function removeFormattingTokens(input) { if (input.match(/\[[\s\S]/)) { return input.replace(/^\[|\]$/g, ''); } return input.replace(/\\/g, ''); } function makeFormatFunction(format) { var array = format.match(formattingTokens), i, length; for (i = 0, length = array.length; i < length; i++) { if (formatTokenFunctions[array[i]]) { array[i] = formatTokenFunctions[array[i]]; } else { array[i] = removeFormattingTokens(array[i]); } } return function (mom) { var output = '', i; for (i = 0; i < length; i++) { output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; } return output; }; } // format date using native date object function formatMoment(m, format) { if (!m.isValid()) { return m.localeData().invalidDate(); } format = expandFormat(format, m.localeData()); formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); return formatFunctions[format](m); } function expandFormat(format, locale) { var i = 5; function replaceLongDateFormatTokens(input) { return locale.longDateFormat(input) || input; } localFormattingTokens.lastIndex = 0; while (i >= 0 && localFormattingTokens.test(format)) { format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); localFormattingTokens.lastIndex = 0; i -= 1; } return format; } var match1 = /\d/; // 0 - 9 var match2 = /\d\d/; // 00 - 99 var match3 = /\d{3}/; // 000 - 999 var match4 = /\d{4}/; // 0000 - 9999 var match6 = /[+-]?\d{6}/; // -999999 - 999999 var match1to2 = /\d\d?/; // 0 - 99 var match3to4 = /\d\d\d\d?/; // 999 - 9999 var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 var match1to3 = /\d{1,3}/; // 0 - 999 var match1to4 = /\d{1,4}/; // 0 - 9999 var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 var matchUnsigned = /\d+/; // 0 - inf var matchSigned = /[+-]?\d+/; // -inf - inf var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 // any word (or two) characters or numbers including two/three word month in arabic. // includes scottish gaelic two word and hyphenated months var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i; var regexes = {}; function addRegexToken (token, regex, strictRegex) { regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { return (isStrict && strictRegex) ? strictRegex : regex; }; } function getParseRegexForToken (token, config) { if (!hasOwnProp(regexes, token)) { return new RegExp(unescapeFormat(token)); } return regexes[token](config._strict, config._locale); } // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript function unescapeFormat(s) { return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { return p1 || p2 || p3 || p4; })); } function regexEscape(s) { return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); } var tokens = {}; function addParseToken (token, callback) { var i, func = callback; if (typeof token === 'string') { token = [token]; } if (isNumber(callback)) { func = function (input, array) { array[callback] = toInt(input); }; } for (i = 0; i < token.length; i++) { tokens[token[i]] = func; } } function addWeekParseToken (token, callback) { addParseToken(token, function (input, array, config, token) { config._w = config._w || {}; callback(input, config._w, config, token); }); } function addTimeToArrayFromToken(token, input, config) { if (input != null && hasOwnProp(tokens, token)) { tokens[token](input, config._a, config, token); } } var YEAR = 0; var MONTH = 1; var DATE = 2; var HOUR = 3; var MINUTE = 4; var SECOND = 5; var MILLISECOND = 6; var WEEK = 7; var WEEKDAY = 8; // FORMATTING addFormatToken('Y', 0, 0, function () { var y = this.year(); return y <= 9999 ? '' + y : '+' + y; }); addFormatToken(0, ['YY', 2], 0, function () { return this.year() % 100; }); addFormatToken(0, ['YYYY', 4], 0, 'year'); addFormatToken(0, ['YYYYY', 5], 0, 'year'); addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); // ALIASES addUnitAlias('year', 'y'); // PRIORITIES addUnitPriority('year', 1); // PARSING addRegexToken('Y', matchSigned); addRegexToken('YY', match1to2, match2); addRegexToken('YYYY', match1to4, match4); addRegexToken('YYYYY', match1to6, match6); addRegexToken('YYYYYY', match1to6, match6); addParseToken(['YYYYY', 'YYYYYY'], YEAR); addParseToken('YYYY', function (input, array) { array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); }); addParseToken('YY', function (input, array) { array[YEAR] = hooks.parseTwoDigitYear(input); }); addParseToken('Y', function (input, array) { array[YEAR] = parseInt(input, 10); }); // HELPERS function daysInYear(year) { return isLeapYear(year) ? 366 : 365; } function isLeapYear(year) { return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; } // HOOKS hooks.parseTwoDigitYear = function (input) { return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); }; // MOMENTS var getSetYear = makeGetSet('FullYear', true); function getIsLeapYear () { return isLeapYear(this.year()); } function makeGetSet (unit, keepTime) { return function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }; } function get (mom, unit) { return mom.isValid() ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; } function set$1 (mom, unit, value) { if (mom.isValid() && !isNaN(value)) { if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) { mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month())); } else { mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); } } } // MOMENTS function stringGet (units) { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](); } return this; } function stringSet (units, value) { if (typeof units === 'object') { units = normalizeObjectUnits(units); var prioritized = getPrioritizedUnits(units); for (var i = 0; i < prioritized.length; i++) { this[prioritized[i].unit](units[prioritized[i].unit]); } } else { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](value); } } return this; } function mod(n, x) { return ((n % x) + x) % x; } var indexOf; if (Array.prototype.indexOf) { indexOf = Array.prototype.indexOf; } else { indexOf = function (o) { // I know var i; for (i = 0; i < this.length; ++i) { if (this[i] === o) { return i; } } return -1; }; } function daysInMonth(year, month) { if (isNaN(year) || isNaN(month)) { return NaN; } var modMonth = mod(month, 12); year += (month - modMonth) / 12; return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2); } // FORMATTING addFormatToken('M', ['MM', 2], 'Mo', function () { return this.month() + 1; }); addFormatToken('MMM', 0, 0, function (format) { return this.localeData().monthsShort(this, format); }); addFormatToken('MMMM', 0, 0, function (format) { return this.localeData().months(this, format); }); // ALIASES addUnitAlias('month', 'M'); // PRIORITY addUnitPriority('month', 8); // PARSING addRegexToken('M', match1to2); addRegexToken('MM', match1to2, match2); addRegexToken('MMM', function (isStrict, locale) { return locale.monthsShortRegex(isStrict); }); addRegexToken('MMMM', function (isStrict, locale) { return locale.monthsRegex(isStrict); }); addParseToken(['M', 'MM'], function (input, array) { array[MONTH] = toInt(input) - 1; }); addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { var month = config._locale.monthsParse(input, token, config._strict); // if we didn't find a month name, mark the date as invalid. if (month != null) { array[MONTH] = month; } else { getParsingFlags(config).invalidMonth = input; } }); // LOCALES var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/; var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); function localeMonths (m, format) { if (!m) { return isArray(this._months) ? this._months : this._months['standalone']; } return isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; } var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); function localeMonthsShort (m, format) { if (!m) { return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort['standalone']; } return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; } function handleStrictParse(monthName, format, strict) { var i, ii, mom, llc = monthName.toLocaleLowerCase(); if (!this._monthsParse) { // this is not used this._monthsParse = []; this._longMonthsParse = []; this._shortMonthsParse = []; for (i = 0; i < 12; ++i) { mom = createUTC([2000, i]); this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); } } if (strict) { if (format === 'MMM') { ii = indexOf.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } } else { if (format === 'MMM') { ii = indexOf.call(this._shortMonthsParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._longMonthsParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } } } function localeMonthsParse (monthName, format, strict) { var i, mom, regex; if (this._monthsParseExact) { return handleStrictParse.call(this, monthName, format, strict); } if (!this._monthsParse) { this._monthsParse = []; this._longMonthsParse = []; this._shortMonthsParse = []; } // TODO: add sorting // Sorting makes sure if one month (or abbr) is a prefix of another // see sorting in computeMonthsParse for (i = 0; i < 12; i++) { // make the regex if we don't have it already mom = createUTC([2000, i]); if (strict && !this._longMonthsParse[i]) { this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); } if (!strict && !this._monthsParse[i]) { regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); } // test the regex if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { return i; } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { return i; } else if (!strict && this._monthsParse[i].test(monthName)) { return i; } } } // MOMENTS function setMonth (mom, value) { var dayOfMonth; if (!mom.isValid()) { // No op return mom; } if (typeof value === 'string') { if (/^\d+$/.test(value)) { value = toInt(value); } else { value = mom.localeData().monthsParse(value); // TODO: Another silent failure? if (!isNumber(value)) { return mom; } } } dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); return mom; } function getSetMonth (value) { if (value != null) { setMonth(this, value); hooks.updateOffset(this, true); return this; } else { return get(this, 'Month'); } } function getDaysInMonth () { return daysInMonth(this.year(), this.month()); } var defaultMonthsShortRegex = matchWord; function monthsShortRegex (isStrict) { if (this._monthsParseExact) { if (!hasOwnProp(this, '_monthsRegex')) { computeMonthsParse.call(this); } if (isStrict) { return this._monthsShortStrictRegex; } else { return this._monthsShortRegex; } } else { if (!hasOwnProp(this, '_monthsShortRegex')) { this._monthsShortRegex = defaultMonthsShortRegex; } return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex; } } var defaultMonthsRegex = matchWord; function monthsRegex (isStrict) { if (this._monthsParseExact) { if (!hasOwnProp(this, '_monthsRegex')) { computeMonthsParse.call(this); } if (isStrict) { return this._monthsStrictRegex; } else { return this._monthsRegex; } } else { if (!hasOwnProp(this, '_monthsRegex')) { this._monthsRegex = defaultMonthsRegex; } return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex; } } function computeMonthsParse () { function cmpLenRev(a, b) { return b.length - a.length; } var shortPieces = [], longPieces = [], mixedPieces = [], i, mom; for (i = 0; i < 12; i++) { // make the regex if we don't have it already mom = createUTC([2000, i]); shortPieces.push(this.monthsShort(mom, '')); longPieces.push(this.months(mom, '')); mixedPieces.push(this.months(mom, '')); mixedPieces.push(this.monthsShort(mom, '')); } // Sorting makes sure if one month (or abbr) is a prefix of another it // will match the longer piece. shortPieces.sort(cmpLenRev); longPieces.sort(cmpLenRev); mixedPieces.sort(cmpLenRev); for (i = 0; i < 12; i++) { shortPieces[i] = regexEscape(shortPieces[i]); longPieces[i] = regexEscape(longPieces[i]); } for (i = 0; i < 24; i++) { mixedPieces[i] = regexEscape(mixedPieces[i]); } this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); this._monthsShortRegex = this._monthsRegex; this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); } function createDate (y, m, d, h, M, s, ms) { // can't just apply() to create a date: // https://stackoverflow.com/q/181348 var date = new Date(y, m, d, h, M, s, ms); // the date constructor remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { date.setFullYear(y); } return date; } function createUTCDate (y) { var date = new Date(Date.UTC.apply(null, arguments)); // the Date.UTC function remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { date.setUTCFullYear(y); } return date; } // start-of-first-week - start-of-year function firstWeekOffset(year, dow, doy) { var // first-week day -- which january is always in the first week (4 for iso, 1 for other) fwd = 7 + dow - doy, // first-week day local weekday -- which local weekday is fwd fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; return -fwdlw + fwd - 1; } // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday function dayOfYearFromWeeks(year, week, weekday, dow, doy) { var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear; if (dayOfYear <= 0) { resYear = year - 1; resDayOfYear = daysInYear(resYear) + dayOfYear; } else if (dayOfYear > daysInYear(year)) { resYear = year + 1; resDayOfYear = dayOfYear - daysInYear(year); } else { resYear = year; resDayOfYear = dayOfYear; } return { year: resYear, dayOfYear: resDayOfYear }; } function weekOfYear(mom, dow, doy) { var weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear; if (week < 1) { resYear = mom.year() - 1; resWeek = week + weeksInYear(resYear, dow, doy); } else if (week > weeksInYear(mom.year(), dow, doy)) { resWeek = week - weeksInYear(mom.year(), dow, doy); resYear = mom.year() + 1; } else { resYear = mom.year(); resWeek = week; } return { week: resWeek, year: resYear }; } function weeksInYear(year, dow, doy) { var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy); return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; } // FORMATTING addFormatToken('w', ['ww', 2], 'wo', 'week'); addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); // ALIASES addUnitAlias('week', 'w'); addUnitAlias('isoWeek', 'W'); // PRIORITIES addUnitPriority('week', 5); addUnitPriority('isoWeek', 5); // PARSING addRegexToken('w', match1to2); addRegexToken('ww', match1to2, match2); addRegexToken('W', match1to2); addRegexToken('WW', match1to2, match2); addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { week[token.substr(0, 1)] = toInt(input); }); // HELPERS // LOCALES function localeWeek (mom) { return weekOfYear(mom, this._week.dow, this._week.doy).week; } var defaultLocaleWeek = { dow : 0, // Sunday is the first day of the week. doy : 6 // The week that contains Jan 1st is the first week of the year. }; function localeFirstDayOfWeek () { return this._week.dow; } function localeFirstDayOfYear () { return this._week.doy; } // MOMENTS function getSetWeek (input) { var week = this.localeData().week(this); return input == null ? week : this.add((input - week) * 7, 'd'); } function getSetISOWeek (input) { var week = weekOfYear(this, 1, 4).week; return input == null ? week : this.add((input - week) * 7, 'd'); } // FORMATTING addFormatToken('d', 0, 'do', 'day'); addFormatToken('dd', 0, 0, function (format) { return this.localeData().weekdaysMin(this, format); }); addFormatToken('ddd', 0, 0, function (format) { return this.localeData().weekdaysShort(this, format); }); addFormatToken('dddd', 0, 0, function (format) { return this.localeData().weekdays(this, format); }); addFormatToken('e', 0, 0, 'weekday'); addFormatToken('E', 0, 0, 'isoWeekday'); // ALIASES addUnitAlias('day', 'd'); addUnitAlias('weekday', 'e'); addUnitAlias('isoWeekday', 'E'); // PRIORITY addUnitPriority('day', 11); addUnitPriority('weekday', 11); addUnitPriority('isoWeekday', 11); // PARSING addRegexToken('d', match1to2); addRegexToken('e', match1to2); addRegexToken('E', match1to2); addRegexToken('dd', function (isStrict, locale) { return locale.weekdaysMinRegex(isStrict); }); addRegexToken('ddd', function (isStrict, locale) { return locale.weekdaysShortRegex(isStrict); }); addRegexToken('dddd', function (isStrict, locale) { return locale.weekdaysRegex(isStrict); }); addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { var weekday = config._locale.weekdaysParse(input, token, config._strict); // if we didn't get a weekday name, mark the date as invalid if (weekday != null) { week.d = weekday; } else { getParsingFlags(config).invalidWeekday = input; } }); addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { week[token] = toInt(input); }); // HELPERS function parseWeekday(input, locale) { if (typeof input !== 'string') { return input; } if (!isNaN(input)) { return parseInt(input, 10); } input = locale.weekdaysParse(input); if (typeof input === 'number') { return input; } return null; } function parseIsoWeekday(input, locale) { if (typeof input === 'string') { return locale.weekdaysParse(input) % 7 || 7; } return isNaN(input) ? null : input; } // LOCALES var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); function localeWeekdays (m, format) { if (!m) { return isArray(this._weekdays) ? this._weekdays : this._weekdays['standalone']; } return isArray(this._weekdays) ? this._weekdays[m.day()] : this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; } var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); function localeWeekdaysShort (m) { return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort; } var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); function localeWeekdaysMin (m) { return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin; } function handleStrictParse$1(weekdayName, format, strict) { var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); if (!this._weekdaysParse) { this._weekdaysParse = []; this._shortWeekdaysParse = []; this._minWeekdaysParse = []; for (i = 0; i < 7; ++i) { mom = createUTC([2000, 1]).day(i); this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); } } if (strict) { if (format === 'dddd') { ii = indexOf.call(this._weekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format === 'ddd') { ii = indexOf.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } } else { if (format === 'dddd') { ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format === 'ddd') { ii = indexOf.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._minWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } } } function localeWeekdaysParse (weekdayName, format, strict) { var i, mom, regex; if (this._weekdaysParseExact) { return handleStrictParse$1.call(this, weekdayName, format, strict); } if (!this._weekdaysParse) { this._weekdaysParse = []; this._minWeekdaysParse = []; this._shortWeekdaysParse = []; this._fullWeekdaysParse = []; } for (i = 0; i < 7; i++) { // make the regex if we don't have it already mom = createUTC([2000, 1]).day(i); if (strict && !this._fullWeekdaysParse[i]) { this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); } if (!this._weekdaysParse[i]) { regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); } // test the regex if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { return i; } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { return i; } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { return i; } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { return i; } } } // MOMENTS function getSetDayOfWeek (input) { if (!this.isValid()) { return input != null ? this : NaN; } var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); if (input != null) { input = parseWeekday(input, this.localeData()); return this.add(input - day, 'd'); } else { return day; } } function getSetLocaleDayOfWeek (input) { if (!this.isValid()) { return input != null ? this : NaN; } var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; return input == null ? weekday : this.add(input - weekday, 'd'); } function getSetISODayOfWeek (input) { if (!this.isValid()) { return input != null ? this : NaN; } // behaves the same as moment#day except // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) // as a setter, sunday should belong to the previous week. if (input != null) { var weekday = parseIsoWeekday(input, this.localeData()); return this.day(this.day() % 7 ? weekday : weekday - 7); } else { return this.day() || 7; } } var defaultWeekdaysRegex = matchWord; function weekdaysRegex (isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, '_weekdaysRegex')) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysStrictRegex; } else { return this._weekdaysRegex; } } else { if (!hasOwnProp(this, '_weekdaysRegex')) { this._weekdaysRegex = defaultWeekdaysRegex; } return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex; } } var defaultWeekdaysShortRegex = matchWord; function weekdaysShortRegex (isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, '_weekdaysRegex')) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysShortStrictRegex; } else { return this._weekdaysShortRegex; } } else { if (!hasOwnProp(this, '_weekdaysShortRegex')) { this._weekdaysShortRegex = defaultWeekdaysShortRegex; } return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex; } } var defaultWeekdaysMinRegex = matchWord; function weekdaysMinRegex (isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, '_weekdaysRegex')) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysMinStrictRegex; } else { return this._weekdaysMinRegex; } } else { if (!hasOwnProp(this, '_weekdaysMinRegex')) { this._weekdaysMinRegex = defaultWeekdaysMinRegex; } return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex; } } function computeWeekdaysParse () { function cmpLenRev(a, b) { return b.length - a.length; } var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], i, mom, minp, shortp, longp; for (i = 0; i < 7; i++) { // make the regex if we don't have it already mom = createUTC([2000, 1]).day(i); minp = this.weekdaysMin(mom, ''); shortp = this.weekdaysShort(mom, ''); longp = this.weekdays(mom, ''); minPieces.push(minp); shortPieces.push(shortp); longPieces.push(longp); mixedPieces.push(minp); mixedPieces.push(shortp); mixedPieces.push(longp); } // Sorting makes sure if one weekday (or abbr) is a prefix of another it // will match the longer piece. minPieces.sort(cmpLenRev); shortPieces.sort(cmpLenRev); longPieces.sort(cmpLenRev); mixedPieces.sort(cmpLenRev); for (i = 0; i < 7; i++) { shortPieces[i] = regexEscape(shortPieces[i]); longPieces[i] = regexEscape(longPieces[i]); mixedPieces[i] = regexEscape(mixedPieces[i]); } this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); this._weekdaysShortRegex = this._weekdaysRegex; this._weekdaysMinRegex = this._weekdaysRegex; this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); } // FORMATTING function hFormat() { return this.hours() % 12 || 12; } function kFormat() { return this.hours() || 24; } addFormatToken('H', ['HH', 2], 0, 'hour'); addFormatToken('h', ['hh', 2], 0, hFormat); addFormatToken('k', ['kk', 2], 0, kFormat); addFormatToken('hmm', 0, 0, function () { return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); }); addFormatToken('hmmss', 0, 0, function () { return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); }); addFormatToken('Hmm', 0, 0, function () { return '' + this.hours() + zeroFill(this.minutes(), 2); }); addFormatToken('Hmmss', 0, 0, function () { return '' + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); }); function meridiem (token, lowercase) { addFormatToken(token, 0, 0, function () { return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); }); } meridiem('a', true); meridiem('A', false); // ALIASES addUnitAlias('hour', 'h'); // PRIORITY addUnitPriority('hour', 13); // PARSING function matchMeridiem (isStrict, locale) { return locale._meridiemParse; } addRegexToken('a', matchMeridiem); addRegexToken('A', matchMeridiem); addRegexToken('H', match1to2); addRegexToken('h', match1to2); addRegexToken('k', match1to2); addRegexToken('HH', match1to2, match2); addRegexToken('hh', match1to2, match2); addRegexToken('kk', match1to2, match2); addRegexToken('hmm', match3to4); addRegexToken('hmmss', match5to6); addRegexToken('Hmm', match3to4); addRegexToken('Hmmss', match5to6); addParseToken(['H', 'HH'], HOUR); addParseToken(['k', 'kk'], function (input, array, config) { var kInput = toInt(input); array[HOUR] = kInput === 24 ? 0 : kInput; }); addParseToken(['a', 'A'], function (input, array, config) { config._isPm = config._locale.isPM(input); config._meridiem = input; }); addParseToken(['h', 'hh'], function (input, array, config) { array[HOUR] = toInt(input); getParsingFlags(config).bigHour = true; }); addParseToken('hmm', function (input, array, config) { var pos = input.length - 2; array[HOUR] = toInt(input.substr(0, pos)); array[MINUTE] = toInt(input.substr(pos)); getParsingFlags(config).bigHour = true; }); addParseToken('hmmss', function (input, array, config) { var pos1 = input.length - 4; var pos2 = input.length - 2; array[HOUR] = toInt(input.substr(0, pos1)); array[MINUTE] = toInt(input.substr(pos1, 2)); array[SECOND] = toInt(input.substr(pos2)); getParsingFlags(config).bigHour = true; }); addParseToken('Hmm', function (input, array, config) { var pos = input.length - 2; array[HOUR] = toInt(input.substr(0, pos)); array[MINUTE] = toInt(input.substr(pos)); }); addParseToken('Hmmss', function (input, array, config) { var pos1 = input.length - 4; var pos2 = input.length - 2; array[HOUR] = toInt(input.substr(0, pos1)); array[MINUTE] = toInt(input.substr(pos1, 2)); array[SECOND] = toInt(input.substr(pos2)); }); // LOCALES function localeIsPM (input) { // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays // Using charAt should be more compatible. return ((input + '').toLowerCase().charAt(0) === 'p'); } var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; function localeMeridiem (hours, minutes, isLower) { if (hours > 11) { return isLower ? 'pm' : 'PM'; } else { return isLower ? 'am' : 'AM'; } } // MOMENTS // Setting the hour should keep the time, because the user explicitly // specified which hour he wants. So trying to maintain the same hour (in // a new timezone) makes sense. Adding/subtracting hours does not follow // this rule. var getSetHour = makeGetSet('Hours', true); // months // week // weekdays // meridiem var baseConfig = { calendar: defaultCalendar, longDateFormat: defaultLongDateFormat, invalidDate: defaultInvalidDate, ordinal: defaultOrdinal, dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, relativeTime: defaultRelativeTime, months: defaultLocaleMonths, monthsShort: defaultLocaleMonthsShort, week: defaultLocaleWeek, weekdays: defaultLocaleWeekdays, weekdaysMin: defaultLocaleWeekdaysMin, weekdaysShort: defaultLocaleWeekdaysShort, meridiemParse: defaultLocaleMeridiemParse }; // internal storage for locale config files var locales = {}; var localeFamilies = {}; var globalLocale; function normalizeLocale(key) { return key ? key.toLowerCase().replace('_', '-') : key; } // pick the locale from the array // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root function chooseLocale(names) { var i = 0, j, next, locale, split; while (i < names.length) { split = normalizeLocale(names[i]).split('-'); j = split.length; next = normalizeLocale(names[i + 1]); next = next ? next.split('-') : null; while (j > 0) { locale = loadLocale(split.slice(0, j).join('-')); if (locale) { return locale; } if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { //the next array item is better than a shallower substring of this one break; } j--; } i++; } return null; } function loadLocale(name) { var oldLocale = null; // TODO: Find a better way to register and load all the locales in Node if (!locales[name] && (typeof module !== 'undefined') && module && module.exports) { try { oldLocale = globalLocale._abbr; var aliasedRequire = require; aliasedRequire('./locale/' + name); getSetGlobalLocale(oldLocale); } catch (e) {} } return locales[name]; } // This function will load locale and then set the global locale. If // no arguments are passed in, it will simply return the current global // locale key. function getSetGlobalLocale (key, values) { var data; if (key) { if (isUndefined(values)) { data = getLocale(key); } else { data = defineLocale(key, values); } if (data) { // moment.duration._locale = moment._locale = data; globalLocale = data; } } return globalLocale._abbr; } function defineLocale (name, config) { if (config !== null) { var parentConfig = baseConfig; config.abbr = name; if (locales[name] != null) { deprecateSimple('defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); parentConfig = locales[name]._config; } else if (config.parentLocale != null) { if (locales[config.parentLocale] != null) { parentConfig = locales[config.parentLocale]._config; } else { if (!localeFamilies[config.parentLocale]) { localeFamilies[config.parentLocale] = []; } localeFamilies[config.parentLocale].push({ name: name, config: config }); return null; } } locales[name] = new Locale(mergeConfigs(parentConfig, config)); if (localeFamilies[name]) { localeFamilies[name].forEach(function (x) { defineLocale(x.name, x.config); }); } // backwards compat for now: also set the locale // make sure we set the locale AFTER all child locales have been // created, so we won't end up with the child locale set. getSetGlobalLocale(name); return locales[name]; } else { // useful for testing delete locales[name]; return null; } } function updateLocale(name, config) { if (config != null) { var locale, tmpLocale, parentConfig = baseConfig; // MERGE tmpLocale = loadLocale(name); if (tmpLocale != null) { parentConfig = tmpLocale._config; } config = mergeConfigs(parentConfig, config); locale = new Locale(config); locale.parentLocale = locales[name]; locales[name] = locale; // backwards compat for now: also set the locale getSetGlobalLocale(name); } else { // pass null for config to unupdate, useful for tests if (locales[name] != null) { if (locales[name].parentLocale != null) { locales[name] = locales[name].parentLocale; } else if (locales[name] != null) { delete locales[name]; } } } return locales[name]; } // returns locale data function getLocale (key) { var locale; if (key && key._locale && key._locale._abbr) { key = key._locale._abbr; } if (!key) { return globalLocale; } if (!isArray(key)) { //short-circuit everything else locale = loadLocale(key); if (locale) { return locale; } key = [key]; } return chooseLocale(key); } function listLocales() { return keys(locales); } function checkOverflow (m) { var overflow; var a = m._a; if (a && getParsingFlags(m).overflow === -2) { overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1; if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { overflow = DATE; } if (getParsingFlags(m)._overflowWeeks && overflow === -1) { overflow = WEEK; } if (getParsingFlags(m)._overflowWeekday && overflow === -1) { overflow = WEEKDAY; } getParsingFlags(m).overflow = overflow; } return m; } // Pick the first defined of two or three arguments. function defaults(a, b, c) { if (a != null) { return a; } if (b != null) { return b; } return c; } function currentDateArray(config) { // hooks is actually the exported moment object var nowValue = new Date(hooks.now()); if (config._useUTC) { return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; } return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; } // convert an array to a date. // the array should mirror the parameters below // note: all values past the year are optional and will default to the lowest possible value. // [year, month, day , hour, minute, second, millisecond] function configFromArray (config) { var i, date, input = [], currentDate, expectedWeekday, yearToUse; if (config._d) { return; } currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { dayOfYearFromWeekInfo(config); } //if the day of the year is set, figure out what it is if (config._dayOfYear != null) { yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { getParsingFlags(config)._overflowDayOfYear = true; } date = createUTCDate(yearToUse, 0, config._dayOfYear); config._a[MONTH] = date.getUTCMonth(); config._a[DATE] = date.getUTCDate(); } // Default to current date. // * if no year, month, day of month are given, default to today // * if day of month is given, default month and year // * if month is given, default only year // * if year is given, don't default anything for (i = 0; i < 3 && config._a[i] == null; ++i) { config._a[i] = input[i] = currentDate[i]; } // Zero out whatever was not defaulted, including time for (; i < 7; i++) { config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; } // Check for 24:00:00.000 if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) { config._nextDay = true; config._a[HOUR] = 0; } config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); // Apply timezone offset from input. The actual utcOffset can be changed // with parseZone. if (config._tzm != null) { config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); } if (config._nextDay) { config._a[HOUR] = 24; } // check for mismatching day of week if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) { getParsingFlags(config).weekdayMismatch = true; } } function dayOfYearFromWeekInfo(config) { var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; w = config._w; if (w.GG != null || w.W != null || w.E != null) { dow = 1; doy = 4; // TODO: We need to take the current isoWeekYear, but that depends on // how we interpret now (local, utc, fixed offset). So create // a now version of current config (take local/utc/offset flags, and // create now). weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); week = defaults(w.W, 1); weekday = defaults(w.E, 1); if (weekday < 1 || weekday > 7) { weekdayOverflow = true; } } else { dow = config._locale._week.dow; doy = config._locale._week.doy; var curWeek = weekOfYear(createLocal(), dow, doy); weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); // Default to current week. week = defaults(w.w, curWeek.week); if (w.d != null) { // weekday -- low day numbers are considered next week weekday = w.d; if (weekday < 0 || weekday > 6) { weekdayOverflow = true; } } else if (w.e != null) { // local weekday -- counting starts from begining of week weekday = w.e + dow; if (w.e < 0 || w.e > 6) { weekdayOverflow = true; } } else { // default to begining of week weekday = dow; } } if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { getParsingFlags(config)._overflowWeeks = true; } else if (weekdayOverflow != null) { getParsingFlags(config)._overflowWeekday = true; } else { temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); config._a[YEAR] = temp.year; config._dayOfYear = temp.dayOfYear; } } // iso 8601 regex // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; var isoDates = [ ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], ['GGGG-[W]WW', /\d{4}-W\d\d/, false], ['YYYY-DDD', /\d{4}-\d{3}/], ['YYYY-MM', /\d{4}-\d\d/, false], ['YYYYYYMMDD', /[+-]\d{10}/], ['YYYYMMDD', /\d{8}/], // YYYYMM is NOT allowed by the standard ['GGGG[W]WWE', /\d{4}W\d{3}/], ['GGGG[W]WW', /\d{4}W\d{2}/, false], ['YYYYDDD', /\d{7}/] ]; // iso time formats and regexes var isoTimes = [ ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], ['HH:mm:ss', /\d\d:\d\d:\d\d/], ['HH:mm', /\d\d:\d\d/], ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], ['HHmmss', /\d\d\d\d\d\d/], ['HHmm', /\d\d\d\d/], ['HH', /\d\d/] ]; var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; // date from iso format function configFromISO(config) { var i, l, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), allowTime, dateFormat, timeFormat, tzFormat; if (match) { getParsingFlags(config).iso = true; for (i = 0, l = isoDates.length; i < l; i++) { if (isoDates[i][1].exec(match[1])) { dateFormat = isoDates[i][0]; allowTime = isoDates[i][2] !== false; break; } } if (dateFormat == null) { config._isValid = false; return; } if (match[3]) { for (i = 0, l = isoTimes.length; i < l; i++) { if (isoTimes[i][1].exec(match[3])) { // match[2] should be 'T' or space timeFormat = (match[2] || ' ') + isoTimes[i][0]; break; } } if (timeFormat == null) { config._isValid = false; return; } } if (!allowTime && timeFormat != null) { config._isValid = false; return; } if (match[4]) { if (tzRegex.exec(match[4])) { tzFormat = 'Z'; } else { config._isValid = false; return; } } config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); configFromStringAndFormat(config); } else { config._isValid = false; } } // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/; function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { var result = [ untruncateYear(yearStr), defaultLocaleMonthsShort.indexOf(monthStr), parseInt(dayStr, 10), parseInt(hourStr, 10), parseInt(minuteStr, 10) ]; if (secondStr) { result.push(parseInt(secondStr, 10)); } return result; } function untruncateYear(yearStr) { var year = parseInt(yearStr, 10); if (year <= 49) { return 2000 + year; } else if (year <= 999) { return 1900 + year; } return year; } function preprocessRFC2822(s) { // Remove comments and folding whitespace and replace multiple-spaces with a single space return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim(); } function checkWeekday(weekdayStr, parsedInput, config) { if (weekdayStr) { // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay(); if (weekdayProvided !== weekdayActual) { getParsingFlags(config).weekdayMismatch = true; config._isValid = false; return false; } } return true; } var obsOffsets = { UT: 0, GMT: 0, EDT: -4 * 60, EST: -5 * 60, CDT: -5 * 60, CST: -6 * 60, MDT: -6 * 60, MST: -7 * 60, PDT: -7 * 60, PST: -8 * 60 }; function calculateOffset(obsOffset, militaryOffset, numOffset) { if (obsOffset) { return obsOffsets[obsOffset]; } else if (militaryOffset) { // the only allowed military tz is Z return 0; } else { var hm = parseInt(numOffset, 10); var m = hm % 100, h = (hm - m) / 100; return h * 60 + m; } } // date and time from ref 2822 format function configFromRFC2822(config) { var match = rfc2822.exec(preprocessRFC2822(config._i)); if (match) { var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]); if (!checkWeekday(match[1], parsedArray, config)) { return; } config._a = parsedArray; config._tzm = calculateOffset(match[8], match[9], match[10]); config._d = createUTCDate.apply(null, config._a); config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); getParsingFlags(config).rfc2822 = true; } else { config._isValid = false; } } // date from iso format or fallback function configFromString(config) { var matched = aspNetJsonRegex.exec(config._i); if (matched !== null) { config._d = new Date(+matched[1]); return; } configFromISO(config); if (config._isValid === false) { delete config._isValid; } else { return; } configFromRFC2822(config); if (config._isValid === false) { delete config._isValid; } else { return; } // Final attempt, use Input Fallback hooks.createFromInputFallback(config); } hooks.createFromInputFallback = deprecate( 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + 'discouraged and will be removed in an upcoming major release. Please refer to ' + 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', function (config) { config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); } ); // constant that refers to the ISO standard hooks.ISO_8601 = function () {}; // constant that refers to the RFC 2822 form hooks.RFC_2822 = function () {}; // date from string and format string function configFromStringAndFormat(config) { // TODO: Move this to another part of the creation flow to prevent circular deps if (config._f === hooks.ISO_8601) { configFromISO(config); return; } if (config._f === hooks.RFC_2822) { configFromRFC2822(config); return; } config._a = []; getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC` var string = '' + config._i, i, parsedInput, tokens, token, skipped, stringLength = string.length, totalParsedInputLength = 0; tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; for (i = 0; i < tokens.length; i++) { token = tokens[i]; parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; // console.log('token', token, 'parsedInput', parsedInput, // 'regex', getParseRegexForToken(token, config)); if (parsedInput) { skipped = string.substr(0, string.indexOf(parsedInput)); if (skipped.length > 0) { getParsingFlags(config).unusedInput.push(skipped); } string = string.slice(string.indexOf(parsedInput) + parsedInput.length); totalParsedInputLength += parsedInput.length; } // don't parse if it's not a known token if (formatTokenFunctions[token]) { if (parsedInput) { getParsingFlags(config).empty = false; } else { getParsingFlags(config).unusedTokens.push(token); } addTimeToArrayFromToken(token, parsedInput, config); } else if (config._strict && !parsedInput) { getParsingFlags(config).unusedTokens.push(token); } } // add remaining unparsed input length to the string getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; if (string.length > 0) { getParsingFlags(config).unusedInput.push(string); } // clear _12h flag if hour is <= 12 if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) { getParsingFlags(config).bigHour = undefined; } getParsingFlags(config).parsedDateParts = config._a.slice(0); getParsingFlags(config).meridiem = config._meridiem; // handle meridiem config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); configFromArray(config); checkOverflow(config); } function meridiemFixWrap (locale, hour, meridiem) { var isPm; if (meridiem == null) { // nothing to do return hour; } if (locale.meridiemHour != null) { return locale.meridiemHour(hour, meridiem); } else if (locale.isPM != null) { // Fallback isPm = locale.isPM(meridiem); if (isPm && hour < 12) { hour += 12; } if (!isPm && hour === 12) { hour = 0; } return hour; } else { // this is not supposed to happen return hour; } } // date from string and array of format strings function configFromStringAndArray(config) { var tempConfig, bestMoment, scoreToBeat, i, currentScore; if (config._f.length === 0) { getParsingFlags(config).invalidFormat = true; config._d = new Date(NaN); return; } for (i = 0; i < config._f.length; i++) { currentScore = 0; tempConfig = copyConfig({}, config); if (config._useUTC != null) { tempConfig._useUTC = config._useUTC; } tempConfig._f = config._f[i]; configFromStringAndFormat(tempConfig); if (!isValid(tempConfig)) { continue; } // if there is any input that was not parsed add a penalty for that format currentScore += getParsingFlags(tempConfig).charsLeftOver; //or tokens currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; getParsingFlags(tempConfig).score = currentScore; if (scoreToBeat == null || currentScore < scoreToBeat) { scoreToBeat = currentScore; bestMoment = tempConfig; } } extend(config, bestMoment || tempConfig); } function configFromObject(config) { if (config._d) { return; } var i = normalizeObjectUnits(config._i); config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { return obj && parseInt(obj, 10); }); configFromArray(config); } function createFromConfig (config) { var res = new Moment(checkOverflow(prepareConfig(config))); if (res._nextDay) { // Adding is smart enough around DST res.add(1, 'd'); res._nextDay = undefined; } return res; } function prepareConfig (config) { var input = config._i, format = config._f; config._locale = config._locale || getLocale(config._l); if (input === null || (format === undefined && input === '')) { return createInvalid({nullInput: true}); } if (typeof input === 'string') { config._i = input = config._locale.preparse(input); } if (isMoment(input)) { return new Moment(checkOverflow(input)); } else if (isDate(input)) { config._d = input; } else if (isArray(format)) { configFromStringAndArray(config); } else if (format) { configFromStringAndFormat(config); } else { configFromInput(config); } if (!isValid(config)) { config._d = null; } return config; } function configFromInput(config) { var input = config._i; if (isUndefined(input)) { config._d = new Date(hooks.now()); } else if (isDate(input)) { config._d = new Date(input.valueOf()); } else if (typeof input === 'string') { configFromString(config); } else if (isArray(input)) { config._a = map(input.slice(0), function (obj) { return parseInt(obj, 10); }); configFromArray(config); } else if (isObject(input)) { configFromObject(config); } else if (isNumber(input)) { // from milliseconds config._d = new Date(input); } else { hooks.createFromInputFallback(config); } } function createLocalOrUTC (input, format, locale, strict, isUTC) { var c = {}; if (locale === true || locale === false) { strict = locale; locale = undefined; } if ((isObject(input) && isObjectEmpty(input)) || (isArray(input) && input.length === 0)) { input = undefined; } // object construction must be done this way. // https://github.com/moment/moment/issues/1423 c._isAMomentObject = true; c._useUTC = c._isUTC = isUTC; c._l = locale; c._i = input; c._f = format; c._strict = strict; return createFromConfig(c); } function createLocal (input, format, locale, strict) { return createLocalOrUTC(input, format, locale, strict, false); } var prototypeMin = deprecate( 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function () { var other = createLocal.apply(null, arguments); if (this.isValid() && other.isValid()) { return other < this ? this : other; } else { return createInvalid(); } } ); var prototypeMax = deprecate( 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function () { var other = createLocal.apply(null, arguments); if (this.isValid() && other.isValid()) { return other > this ? this : other; } else { return createInvalid(); } } ); // Pick a moment m from moments so that m[fn](other) is true for all // other. This relies on the function fn to be transitive. // // moments should either be an array of moment objects or an array, whose // first element is an array of moment objects. function pickBy(fn, moments) { var res, i; if (moments.length === 1 && isArray(moments[0])) { moments = moments[0]; } if (!moments.length) { return createLocal(); } res = moments[0]; for (i = 1; i < moments.length; ++i) { if (!moments[i].isValid() || moments[i][fn](res)) { res = moments[i]; } } return res; } // TODO: Use [].sort instead? function min () { var args = [].slice.call(arguments, 0); return pickBy('isBefore', args); } function max () { var args = [].slice.call(arguments, 0); return pickBy('isAfter', args); } var now = function () { return Date.now ? Date.now() : +(new Date()); }; var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; function isDurationValid(m) { for (var key in m) { if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) { return false; } } var unitHasDecimal = false; for (var i = 0; i < ordering.length; ++i) { if (m[ordering[i]]) { if (unitHasDecimal) { return false; // only allow non-integers for smallest unit } if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { unitHasDecimal = true; } } } return true; } function isValid$1() { return this._isValid; } function createInvalid$1() { return createDuration(NaN); } function Duration (duration) { var normalizedInput = normalizeObjectUnits(duration), years = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months = normalizedInput.month || 0, weeks = normalizedInput.week || 0, days = normalizedInput.day || 0, hours = normalizedInput.hour || 0, minutes = normalizedInput.minute || 0, seconds = normalizedInput.second || 0, milliseconds = normalizedInput.millisecond || 0; this._isValid = isDurationValid(normalizedInput); // representation for dateAddRemove this._milliseconds = +milliseconds + seconds * 1e3 + // 1000 minutes * 6e4 + // 1000 * 60 hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 // Because of dateAddRemove treats 24 hours as different from a // day when working around DST, we need to store them separately this._days = +days + weeks * 7; // It is impossible to translate months into days without knowing // which months you are are talking about, so we have to store // it separately. this._months = +months + quarters * 3 + years * 12; this._data = {}; this._locale = getLocale(); this._bubble(); } function isDuration (obj) { return obj instanceof Duration; } function absRound (number) { if (number < 0) { return Math.round(-1 * number) * -1; } else { return Math.round(number); } } // FORMATTING function offset (token, separator) { addFormatToken(token, 0, 0, function () { var offset = this.utcOffset(); var sign = '+'; if (offset < 0) { offset = -offset; sign = '-'; } return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); }); } offset('Z', ':'); offset('ZZ', ''); // PARSING addRegexToken('Z', matchShortOffset); addRegexToken('ZZ', matchShortOffset); addParseToken(['Z', 'ZZ'], function (input, array, config) { config._useUTC = true; config._tzm = offsetFromString(matchShortOffset, input); }); // HELPERS // timezone chunker // '+10:00' > ['10', '00'] // '-1530' > ['-15', '30'] var chunkOffset = /([\+\-]|\d\d)/gi; function offsetFromString(matcher, string) { var matches = (string || '').match(matcher); if (matches === null) { return null; } var chunk = matches[matches.length - 1] || []; var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; var minutes = +(parts[1] * 60) + toInt(parts[2]); return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; } // Return a moment from input, that is local/utc/zone equivalent to model. function cloneWithOffset(input, model) { var res, diff; if (model._isUTC) { res = model.clone(); diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); // Use low-level api, because this fn is low-level api. res._d.setTime(res._d.valueOf() + diff); hooks.updateOffset(res, false); return res; } else { return createLocal(input).local(); } } function getDateOffset (m) { // On Firefox.24 Date#getTimezoneOffset returns a floating point. // https://github.com/moment/moment/pull/1871 return -Math.round(m._d.getTimezoneOffset() / 15) * 15; } // HOOKS // This function will be called whenever a moment is mutated. // It is intended to keep the offset in sync with the timezone. hooks.updateOffset = function () {}; // MOMENTS // keepLocalTime = true means only change the timezone, without // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset // +0200, so we adjust the time as needed, to be valid. // // Keeping the time actually adds/subtracts (one hour) // from the actual represented time. That is why we call updateOffset // a second time. In case it wants us to change the offset again // _changeInProgress == true case, then we have to adjust, because // there is no such time in the given timezone. function getSetOffset (input, keepLocalTime, keepMinutes) { var offset = this._offset || 0, localAdjust; if (!this.isValid()) { return input != null ? this : NaN; } if (input != null) { if (typeof input === 'string') { input = offsetFromString(matchShortOffset, input); if (input === null) { return this; } } else if (Math.abs(input) < 16 && !keepMinutes) { input = input * 60; } if (!this._isUTC && keepLocalTime) { localAdjust = getDateOffset(this); } this._offset = input; this._isUTC = true; if (localAdjust != null) { this.add(localAdjust, 'm'); } if (offset !== input) { if (!keepLocalTime || this._changeInProgress) { addSubtract(this, createDuration(input - offset, 'm'), 1, false); } else if (!this._changeInProgress) { this._changeInProgress = true; hooks.updateOffset(this, true); this._changeInProgress = null; } } return this; } else { return this._isUTC ? offset : getDateOffset(this); } } function getSetZone (input, keepLocalTime) { if (input != null) { if (typeof input !== 'string') { input = -input; } this.utcOffset(input, keepLocalTime); return this; } else { return -this.utcOffset(); } } function setOffsetToUTC (keepLocalTime) { return this.utcOffset(0, keepLocalTime); } function setOffsetToLocal (keepLocalTime) { if (this._isUTC) { this.utcOffset(0, keepLocalTime); this._isUTC = false; if (keepLocalTime) { this.subtract(getDateOffset(this), 'm'); } } return this; } function setOffsetToParsedOffset () { if (this._tzm != null) { this.utcOffset(this._tzm, false, true); } else if (typeof this._i === 'string') { var tZone = offsetFromString(matchOffset, this._i); if (tZone != null) { this.utcOffset(tZone); } else { this.utcOffset(0, true); } } return this; } function hasAlignedHourOffset (input) { if (!this.isValid()) { return false; } input = input ? createLocal(input).utcOffset() : 0; return (this.utcOffset() - input) % 60 === 0; } function isDaylightSavingTime () { return ( this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset() ); } function isDaylightSavingTimeShifted () { if (!isUndefined(this._isDSTShifted)) { return this._isDSTShifted; } var c = {}; copyConfig(c, this); c = prepareConfig(c); if (c._a) { var other = c._isUTC ? createUTC(c._a) : createLocal(c._a); this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0; } else { this._isDSTShifted = false; } return this._isDSTShifted; } function isLocal () { return this.isValid() ? !this._isUTC : false; } function isUtcOffset () { return this.isValid() ? this._isUTC : false; } function isUtc () { return this.isValid() ? this._isUTC && this._offset === 0 : false; } // ASP.NET json date format regex var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere // and further modified to allow for strings containing both week and day var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; function createDuration (input, key) { var duration = input, // matching against regexp is expensive, do it on demand match = null, sign, ret, diffRes; if (isDuration(input)) { duration = { ms : input._milliseconds, d : input._days, M : input._months }; } else if (isNumber(input)) { duration = {}; if (key) { duration[key] = input; } else { duration.milliseconds = input; } } else if (!!(match = aspNetRegex.exec(input))) { sign = (match[1] === '-') ? -1 : 1; duration = { y : 0, d : toInt(match[DATE]) * sign, h : toInt(match[HOUR]) * sign, m : toInt(match[MINUTE]) * sign, s : toInt(match[SECOND]) * sign, ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match }; } else if (!!(match = isoRegex.exec(input))) { sign = (match[1] === '-') ? -1 : (match[1] === '+') ? 1 : 1; duration = { y : parseIso(match[2], sign), M : parseIso(match[3], sign), w : parseIso(match[4], sign), d : parseIso(match[5], sign), h : parseIso(match[6], sign), m : parseIso(match[7], sign), s : parseIso(match[8], sign) }; } else if (duration == null) {// checks for null or undefined duration = {}; } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); duration = {}; duration.ms = diffRes.milliseconds; duration.M = diffRes.months; } ret = new Duration(duration); if (isDuration(input) && hasOwnProp(input, '_locale')) { ret._locale = input._locale; } return ret; } createDuration.fn = Duration.prototype; createDuration.invalid = createInvalid$1; function parseIso (inp, sign) { // We'd normally use ~~inp for this, but unfortunately it also // converts floats to ints. // inp may be undefined, so careful calling replace on it. var res = inp && parseFloat(inp.replace(',', '.')); // apply sign while we're at it return (isNaN(res) ? 0 : res) * sign; } function positiveMomentsDifference(base, other) { var res = {milliseconds: 0, months: 0}; res.months = other.month() - base.month() + (other.year() - base.year()) * 12; if (base.clone().add(res.months, 'M').isAfter(other)) { --res.months; } res.milliseconds = +other - +(base.clone().add(res.months, 'M')); return res; } function momentsDifference(base, other) { var res; if (!(base.isValid() && other.isValid())) { return {milliseconds: 0, months: 0}; } other = cloneWithOffset(other, base); if (base.isBefore(other)) { res = positiveMomentsDifference(base, other); } else { res = positiveMomentsDifference(other, base); res.milliseconds = -res.milliseconds; res.months = -res.months; } return res; } // TODO: remove 'name' arg after deprecation is removed function createAdder(direction, name) { return function (val, period) { var dur, tmp; //invert the arguments, but complain about it if (period !== null && !isNaN(+period)) { deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); tmp = val; val = period; period = tmp; } val = typeof val === 'string' ? +val : val; dur = createDuration(val, period); addSubtract(this, dur, direction); return this; }; } function addSubtract (mom, duration, isAdding, updateOffset) { var milliseconds = duration._milliseconds, days = absRound(duration._days), months = absRound(duration._months); if (!mom.isValid()) { // No op return; } updateOffset = updateOffset == null ? true : updateOffset; if (months) { setMonth(mom, get(mom, 'Month') + months * isAdding); } if (days) { set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); } if (milliseconds) { mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); } if (updateOffset) { hooks.updateOffset(mom, days || months); } } var add = createAdder(1, 'add'); var subtract = createAdder(-1, 'subtract'); function getCalendarFormat(myMoment, now) { var diff = myMoment.diff(now, 'days', true); return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; } function calendar$1 (time, formats) { // We want to compare the start of today, vs this. // Getting start-of-today depends on whether we're local/utc/offset or not. var now = time || createLocal(), sod = cloneWithOffset(now, this).startOf('day'), format = hooks.calendarFormat(this, sod) || 'sameElse'; var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); return this.format(output || this.localeData().calendar(format, this, createLocal(now))); } function clone () { return new Moment(this); } function isAfter (input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); if (units === 'millisecond') { return this.valueOf() > localInput.valueOf(); } else { return localInput.valueOf() < this.clone().startOf(units).valueOf(); } } function isBefore (input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); if (units === 'millisecond') { return this.valueOf() < localInput.valueOf(); } else { return this.clone().endOf(units).valueOf() < localInput.valueOf(); } } function isBetween (from, to, units, inclusivity) { inclusivity = inclusivity || '()'; return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); } function isSame (input, units) { var localInput = isMoment(input) ? input : createLocal(input), inputMs; if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units || 'millisecond'); if (units === 'millisecond') { return this.valueOf() === localInput.valueOf(); } else { inputMs = localInput.valueOf(); return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); } } function isSameOrAfter (input, units) { return this.isSame(input, units) || this.isAfter(input,units); } function isSameOrBefore (input, units) { return this.isSame(input, units) || this.isBefore(input,units); } function diff (input, units, asFloat) { var that, zoneDelta, delta, output; if (!this.isValid()) { return NaN; } that = cloneWithOffset(input, this); if (!that.isValid()) { return NaN; } zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; units = normalizeUnits(units); switch (units) { case 'year': output = monthDiff(this, that) / 12; break; case 'month': output = monthDiff(this, that); break; case 'quarter': output = monthDiff(this, that) / 3; break; case 'second': output = (this - that) / 1e3; break; // 1000 case 'minute': output = (this - that) / 6e4; break; // 1000 * 60 case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60 case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst default: output = this - that; } return asFloat ? output : absFloor(output); } function monthDiff (a, b) { // difference in months var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), // b is in (anchor - 1 month, anchor + 1 month) anchor = a.clone().add(wholeMonthDiff, 'months'), anchor2, adjust; if (b - anchor < 0) { anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); // linear across the month adjust = (b - anchor) / (anchor - anchor2); } else { anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); // linear across the month adjust = (b - anchor) / (anchor2 - anchor); } //check for negative zero, return zero if negative zero return -(wholeMonthDiff + adjust) || 0; } hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; function toString () { return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); } function toISOString(keepOffset) { if (!this.isValid()) { return null; } var utc = keepOffset !== true; var m = utc ? this.clone().utc() : this; if (m.year() < 0 || m.year() > 9999) { return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'); } if (isFunction(Date.prototype.toISOString)) { // native implementation is ~50x faster, use it when we can if (utc) { return this.toDate().toISOString(); } else { return new Date(this._d.valueOf()).toISOString().replace('Z', formatMoment(m, 'Z')); } } return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'); } /** * Return a human readable representation of a moment that can * also be evaluated to get a new moment which is the same * * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects */ function inspect () { if (!this.isValid()) { return 'moment.invalid(/* ' + this._i + ' */)'; } var func = 'moment'; var zone = ''; if (!this.isLocal()) { func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; zone = 'Z'; } var prefix = '[' + func + '("]'; var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY'; var datetime = '-MM-DD[T]HH:mm:ss.SSS'; var suffix = zone + '[")]'; return this.format(prefix + year + datetime + suffix); } function format (inputString) { if (!inputString) { inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; } var output = formatMoment(this, inputString); return this.localeData().postformat(output); } function from (time, withoutSuffix) { if (this.isValid() && ((isMoment(time) && time.isValid()) || createLocal(time).isValid())) { return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } } function fromNow (withoutSuffix) { return this.from(createLocal(), withoutSuffix); } function to (time, withoutSuffix) { if (this.isValid() && ((isMoment(time) && time.isValid()) || createLocal(time).isValid())) { return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } } function toNow (withoutSuffix) { return this.to(createLocal(), withoutSuffix); } // If passed a locale key, it will set the locale for this // instance. Otherwise, it will return the locale configuration // variables for this instance. function locale (key) { var newLocaleData; if (key === undefined) { return this._locale._abbr; } else { newLocaleData = getLocale(key); if (newLocaleData != null) { this._locale = newLocaleData; } return this; } } var lang = deprecate( 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function (key) { if (key === undefined) { return this.localeData(); } else { return this.locale(key); } } ); function localeData () { return this._locale; } function startOf (units) { units = normalizeUnits(units); // the following switch intentionally omits break keywords // to utilize falling through the cases. switch (units) { case 'year': this.month(0); /* falls through */ case 'quarter': case 'month': this.date(1); /* falls through */ case 'week': case 'isoWeek': case 'day': case 'date': this.hours(0); /* falls through */ case 'hour': this.minutes(0); /* falls through */ case 'minute': this.seconds(0); /* falls through */ case 'second': this.milliseconds(0); } // weeks are a special case if (units === 'week') { this.weekday(0); } if (units === 'isoWeek') { this.isoWeekday(1); } // quarters are also special if (units === 'quarter') { this.month(Math.floor(this.month() / 3) * 3); } return this; } function endOf (units) { units = normalizeUnits(units); if (units === undefined || units === 'millisecond') { return this; } // 'date' is an alias for 'day', so it should be considered as such. if (units === 'date') { units = 'day'; } return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); } function valueOf () { return this._d.valueOf() - ((this._offset || 0) * 60000); } function unix () { return Math.floor(this.valueOf() / 1000); } function toDate () { return new Date(this.valueOf()); } function toArray () { var m = this; return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; } function toObject () { var m = this; return { years: m.year(), months: m.month(), date: m.date(), hours: m.hours(), minutes: m.minutes(), seconds: m.seconds(), milliseconds: m.milliseconds() }; } function toJSON () { // new Date(NaN).toJSON() === null return this.isValid() ? this.toISOString() : null; } function isValid$2 () { return isValid(this); } function parsingFlags () { return extend({}, getParsingFlags(this)); } function invalidAt () { return getParsingFlags(this).overflow; } function creationData() { return { input: this._i, format: this._f, locale: this._locale, isUTC: this._isUTC, strict: this._strict }; } // FORMATTING addFormatToken(0, ['gg', 2], 0, function () { return this.weekYear() % 100; }); addFormatToken(0, ['GG', 2], 0, function () { return this.isoWeekYear() % 100; }); function addWeekYearFormatToken (token, getter) { addFormatToken(0, [token, token.length], 0, getter); } addWeekYearFormatToken('gggg', 'weekYear'); addWeekYearFormatToken('ggggg', 'weekYear'); addWeekYearFormatToken('GGGG', 'isoWeekYear'); addWeekYearFormatToken('GGGGG', 'isoWeekYear'); // ALIASES addUnitAlias('weekYear', 'gg'); addUnitAlias('isoWeekYear', 'GG'); // PRIORITY addUnitPriority('weekYear', 1); addUnitPriority('isoWeekYear', 1); // PARSING addRegexToken('G', matchSigned); addRegexToken('g', matchSigned); addRegexToken('GG', match1to2, match2); addRegexToken('gg', match1to2, match2); addRegexToken('GGGG', match1to4, match4); addRegexToken('gggg', match1to4, match4); addRegexToken('GGGGG', match1to6, match6); addRegexToken('ggggg', match1to6, match6); addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { week[token.substr(0, 2)] = toInt(input); }); addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { week[token] = hooks.parseTwoDigitYear(input); }); // MOMENTS function getSetWeekYear (input) { return getSetWeekYearHelper.call(this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy); } function getSetISOWeekYear (input) { return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4); } function getISOWeeksInYear () { return weeksInYear(this.year(), 1, 4); } function getWeeksInYear () { var weekInfo = this.localeData()._week; return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); } function getSetWeekYearHelper(input, week, weekday, dow, doy) { var weeksTarget; if (input == null) { return weekOfYear(this, dow, doy).year; } else { weeksTarget = weeksInYear(input, dow, doy); if (week > weeksTarget) { week = weeksTarget; } return setWeekAll.call(this, input, week, weekday, dow, doy); } } function setWeekAll(weekYear, week, weekday, dow, doy) { var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); this.year(date.getUTCFullYear()); this.month(date.getUTCMonth()); this.date(date.getUTCDate()); return this; } // FORMATTING addFormatToken('Q', 0, 'Qo', 'quarter'); // ALIASES addUnitAlias('quarter', 'Q'); // PRIORITY addUnitPriority('quarter', 7); // PARSING addRegexToken('Q', match1); addParseToken('Q', function (input, array) { array[MONTH] = (toInt(input) - 1) * 3; }); // MOMENTS function getSetQuarter (input) { return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); } // FORMATTING addFormatToken('D', ['DD', 2], 'Do', 'date'); // ALIASES addUnitAlias('date', 'D'); // PRIOROITY addUnitPriority('date', 9); // PARSING addRegexToken('D', match1to2); addRegexToken('DD', match1to2, match2); addRegexToken('Do', function (isStrict, locale) { // TODO: Remove "ordinalParse" fallback in next major release. return isStrict ? (locale._dayOfMonthOrdinalParse || locale._ordinalParse) : locale._dayOfMonthOrdinalParseLenient; }); addParseToken(['D', 'DD'], DATE); addParseToken('Do', function (input, array) { array[DATE] = toInt(input.match(match1to2)[0]); }); // MOMENTS var getSetDayOfMonth = makeGetSet('Date', true); // FORMATTING addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); // ALIASES addUnitAlias('dayOfYear', 'DDD'); // PRIORITY addUnitPriority('dayOfYear', 4); // PARSING addRegexToken('DDD', match1to3); addRegexToken('DDDD', match3); addParseToken(['DDD', 'DDDD'], function (input, array, config) { config._dayOfYear = toInt(input); }); // HELPERS // MOMENTS function getSetDayOfYear (input) { var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); } // FORMATTING addFormatToken('m', ['mm', 2], 0, 'minute'); // ALIASES addUnitAlias('minute', 'm'); // PRIORITY addUnitPriority('minute', 14); // PARSING addRegexToken('m', match1to2); addRegexToken('mm', match1to2, match2); addParseToken(['m', 'mm'], MINUTE); // MOMENTS var getSetMinute = makeGetSet('Minutes', false); // FORMATTING addFormatToken('s', ['ss', 2], 0, 'second'); // ALIASES addUnitAlias('second', 's'); // PRIORITY addUnitPriority('second', 15); // PARSING addRegexToken('s', match1to2); addRegexToken('ss', match1to2, match2); addParseToken(['s', 'ss'], SECOND); // MOMENTS var getSetSecond = makeGetSet('Seconds', false); // FORMATTING addFormatToken('S', 0, 0, function () { return ~~(this.millisecond() / 100); }); addFormatToken(0, ['SS', 2], 0, function () { return ~~(this.millisecond() / 10); }); addFormatToken(0, ['SSS', 3], 0, 'millisecond'); addFormatToken(0, ['SSSS', 4], 0, function () { return this.millisecond() * 10; }); addFormatToken(0, ['SSSSS', 5], 0, function () { return this.millisecond() * 100; }); addFormatToken(0, ['SSSSSS', 6], 0, function () { return this.millisecond() * 1000; }); addFormatToken(0, ['SSSSSSS', 7], 0, function () { return this.millisecond() * 10000; }); addFormatToken(0, ['SSSSSSSS', 8], 0, function () { return this.millisecond() * 100000; }); addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { return this.millisecond() * 1000000; }); // ALIASES addUnitAlias('millisecond', 'ms'); // PRIORITY addUnitPriority('millisecond', 16); // PARSING addRegexToken('S', match1to3, match1); addRegexToken('SS', match1to3, match2); addRegexToken('SSS', match1to3, match3); var token; for (token = 'SSSS'; token.length <= 9; token += 'S') { addRegexToken(token, matchUnsigned); } function parseMs(input, array) { array[MILLISECOND] = toInt(('0.' + input) * 1000); } for (token = 'S'; token.length <= 9; token += 'S') { addParseToken(token, parseMs); } // MOMENTS var getSetMillisecond = makeGetSet('Milliseconds', false); // FORMATTING addFormatToken('z', 0, 0, 'zoneAbbr'); addFormatToken('zz', 0, 0, 'zoneName'); // MOMENTS function getZoneAbbr () { return this._isUTC ? 'UTC' : ''; } function getZoneName () { return this._isUTC ? 'Coordinated Universal Time' : ''; } var proto = Moment.prototype; proto.add = add; proto.calendar = calendar$1; proto.clone = clone; proto.diff = diff; proto.endOf = endOf; proto.format = format; proto.from = from; proto.fromNow = fromNow; proto.to = to; proto.toNow = toNow; proto.get = stringGet; proto.invalidAt = invalidAt; proto.isAfter = isAfter; proto.isBefore = isBefore; proto.isBetween = isBetween; proto.isSame = isSame; proto.isSameOrAfter = isSameOrAfter; proto.isSameOrBefore = isSameOrBefore; proto.isValid = isValid$2; proto.lang = lang; proto.locale = locale; proto.localeData = localeData; proto.max = prototypeMax; proto.min = prototypeMin; proto.parsingFlags = parsingFlags; proto.set = stringSet; proto.startOf = startOf; proto.subtract = subtract; proto.toArray = toArray; proto.toObject = toObject; proto.toDate = toDate; proto.toISOString = toISOString; proto.inspect = inspect; proto.toJSON = toJSON; proto.toString = toString; proto.unix = unix; proto.valueOf = valueOf; proto.creationData = creationData; // Year proto.year = getSetYear; proto.isLeapYear = getIsLeapYear; // Week Year proto.weekYear = getSetWeekYear; proto.isoWeekYear = getSetISOWeekYear; // Quarter proto.quarter = proto.quarters = getSetQuarter; // Month proto.month = getSetMonth; proto.daysInMonth = getDaysInMonth; // Week proto.week = proto.weeks = getSetWeek; proto.isoWeek = proto.isoWeeks = getSetISOWeek; proto.weeksInYear = getWeeksInYear; proto.isoWeeksInYear = getISOWeeksInYear; // Day proto.date = getSetDayOfMonth; proto.day = proto.days = getSetDayOfWeek; proto.weekday = getSetLocaleDayOfWeek; proto.isoWeekday = getSetISODayOfWeek; proto.dayOfYear = getSetDayOfYear; // Hour proto.hour = proto.hours = getSetHour; // Minute proto.minute = proto.minutes = getSetMinute; // Second proto.second = proto.seconds = getSetSecond; // Millisecond proto.millisecond = proto.milliseconds = getSetMillisecond; // Offset proto.utcOffset = getSetOffset; proto.utc = setOffsetToUTC; proto.local = setOffsetToLocal; proto.parseZone = setOffsetToParsedOffset; proto.hasAlignedHourOffset = hasAlignedHourOffset; proto.isDST = isDaylightSavingTime; proto.isLocal = isLocal; proto.isUtcOffset = isUtcOffset; proto.isUtc = isUtc; proto.isUTC = isUtc; // Timezone proto.zoneAbbr = getZoneAbbr; proto.zoneName = getZoneName; // Deprecations proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); function createUnix (input) { return createLocal(input * 1000); } function createInZone () { return createLocal.apply(null, arguments).parseZone(); } function preParsePostFormat (string) { return string; } var proto$1 = Locale.prototype; proto$1.calendar = calendar; proto$1.longDateFormat = longDateFormat; proto$1.invalidDate = invalidDate; proto$1.ordinal = ordinal; proto$1.preparse = preParsePostFormat; proto$1.postformat = preParsePostFormat; proto$1.relativeTime = relativeTime; proto$1.pastFuture = pastFuture; proto$1.set = set; // Month proto$1.months = localeMonths; proto$1.monthsShort = localeMonthsShort; proto$1.monthsParse = localeMonthsParse; proto$1.monthsRegex = monthsRegex; proto$1.monthsShortRegex = monthsShortRegex; // Week proto$1.week = localeWeek; proto$1.firstDayOfYear = localeFirstDayOfYear; proto$1.firstDayOfWeek = localeFirstDayOfWeek; // Day of Week proto$1.weekdays = localeWeekdays; proto$1.weekdaysMin = localeWeekdaysMin; proto$1.weekdaysShort = localeWeekdaysShort; proto$1.weekdaysParse = localeWeekdaysParse; proto$1.weekdaysRegex = weekdaysRegex; proto$1.weekdaysShortRegex = weekdaysShortRegex; proto$1.weekdaysMinRegex = weekdaysMinRegex; // Hours proto$1.isPM = localeIsPM; proto$1.meridiem = localeMeridiem; function get$1 (format, index, field, setter) { var locale = getLocale(); var utc = createUTC().set(setter, index); return locale[field](utc, format); } function listMonthsImpl (format, index, field) { if (isNumber(format)) { index = format; format = undefined; } format = format || ''; if (index != null) { return get$1(format, index, field, 'month'); } var i; var out = []; for (i = 0; i < 12; i++) { out[i] = get$1(format, i, field, 'month'); } return out; } // () // (5) // (fmt, 5) // (fmt) // (true) // (true, 5) // (true, fmt, 5) // (true, fmt) function listWeekdaysImpl (localeSorted, format, index, field) { if (typeof localeSorted === 'boolean') { if (isNumber(format)) { index = format; format = undefined; } format = format || ''; } else { format = localeSorted; index = format; localeSorted = false; if (isNumber(format)) { index = format; format = undefined; } format = format || ''; } var locale = getLocale(), shift = localeSorted ? locale._week.dow : 0; if (index != null) { return get$1(format, (index + shift) % 7, field, 'day'); } var i; var out = []; for (i = 0; i < 7; i++) { out[i] = get$1(format, (i + shift) % 7, field, 'day'); } return out; } function listMonths (format, index) { return listMonthsImpl(format, index, 'months'); } function listMonthsShort (format, index) { return listMonthsImpl(format, index, 'monthsShort'); } function listWeekdays (localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); } function listWeekdaysShort (localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); } function listWeekdaysMin (localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); } getSetGlobalLocale('en', { dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, ordinal : function (number) { var b = number % 10, output = (toInt(number % 100 / 10) === 1) ? 'th' : (b === 1) ? 'st' : (b === 2) ? 'nd' : (b === 3) ? 'rd' : 'th'; return number + output; } }); // Side effect imports hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale); hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale); var mathAbs = Math.abs; function abs () { var data = this._data; this._milliseconds = mathAbs(this._milliseconds); this._days = mathAbs(this._days); this._months = mathAbs(this._months); data.milliseconds = mathAbs(data.milliseconds); data.seconds = mathAbs(data.seconds); data.minutes = mathAbs(data.minutes); data.hours = mathAbs(data.hours); data.months = mathAbs(data.months); data.years = mathAbs(data.years); return this; } function addSubtract$1 (duration, input, value, direction) { var other = createDuration(input, value); duration._milliseconds += direction * other._milliseconds; duration._days += direction * other._days; duration._months += direction * other._months; return duration._bubble(); } // supports only 2.0-style add(1, 's') or add(duration) function add$1 (input, value) { return addSubtract$1(this, input, value, 1); } // supports only 2.0-style subtract(1, 's') or subtract(duration) function subtract$1 (input, value) { return addSubtract$1(this, input, value, -1); } function absCeil (number) { if (number < 0) { return Math.floor(number); } else { return Math.ceil(number); } } function bubble () { var milliseconds = this._milliseconds; var days = this._days; var months = this._months; var data = this._data; var seconds, minutes, hours, years, monthsFromDays; // if we have a mix of positive and negative values, bubble down first // check: https://github.com/moment/moment/issues/2166 if (!((milliseconds >= 0 && days >= 0 && months >= 0) || (milliseconds <= 0 && days <= 0 && months <= 0))) { milliseconds += absCeil(monthsToDays(months) + days) * 864e5; days = 0; months = 0; } // The following code bubbles up values, see the tests for // examples of what that means. data.milliseconds = milliseconds % 1000; seconds = absFloor(milliseconds / 1000); data.seconds = seconds % 60; minutes = absFloor(seconds / 60); data.minutes = minutes % 60; hours = absFloor(minutes / 60); data.hours = hours % 24; days += absFloor(hours / 24); // convert days to months monthsFromDays = absFloor(daysToMonths(days)); months += monthsFromDays; days -= absCeil(monthsToDays(monthsFromDays)); // 12 months -> 1 year years = absFloor(months / 12); months %= 12; data.days = days; data.months = months; data.years = years; return this; } function daysToMonths (days) { // 400 years have 146097 days (taking into account leap year rules) // 400 years have 12 months === 4800 return days * 4800 / 146097; } function monthsToDays (months) { // the reverse of daysToMonths return months * 146097 / 4800; } function as (units) { if (!this.isValid()) { return NaN; } var days; var months; var milliseconds = this._milliseconds; units = normalizeUnits(units); if (units === 'month' || units === 'year') { days = this._days + milliseconds / 864e5; months = this._months + daysToMonths(days); return units === 'month' ? months : months / 12; } else { // handle milliseconds separately because of floating point math errors (issue #1867) days = this._days + Math.round(monthsToDays(this._months)); switch (units) { case 'week' : return days / 7 + milliseconds / 6048e5; case 'day' : return days + milliseconds / 864e5; case 'hour' : return days * 24 + milliseconds / 36e5; case 'minute' : return days * 1440 + milliseconds / 6e4; case 'second' : return days * 86400 + milliseconds / 1000; // Math.floor prevents floating point math errors here case 'millisecond': return Math.floor(days * 864e5) + milliseconds; default: throw new Error('Unknown unit ' + units); } } } // TODO: Use this.as('ms')? function valueOf$1 () { if (!this.isValid()) { return NaN; } return ( this._milliseconds + this._days * 864e5 + (this._months % 12) * 2592e6 + toInt(this._months / 12) * 31536e6 ); } function makeAs (alias) { return function () { return this.as(alias); }; } var asMilliseconds = makeAs('ms'); var asSeconds = makeAs('s'); var asMinutes = makeAs('m'); var asHours = makeAs('h'); var asDays = makeAs('d'); var asWeeks = makeAs('w'); var asMonths = makeAs('M'); var asYears = makeAs('y'); function clone$1 () { return createDuration(this); } function get$2 (units) { units = normalizeUnits(units); return this.isValid() ? this[units + 's']() : NaN; } function makeGetter(name) { return function () { return this.isValid() ? this._data[name] : NaN; }; } var milliseconds = makeGetter('milliseconds'); var seconds = makeGetter('seconds'); var minutes = makeGetter('minutes'); var hours = makeGetter('hours'); var days = makeGetter('days'); var months = makeGetter('months'); var years = makeGetter('years'); function weeks () { return absFloor(this.days() / 7); } var round = Math.round; var thresholds = { ss: 44, // a few seconds to seconds s : 45, // seconds to minute m : 45, // minutes to hour h : 22, // hours to day d : 26, // days to month M : 11 // months to year }; // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); } function relativeTime$1 (posNegDuration, withoutSuffix, locale) { var duration = createDuration(posNegDuration).abs(); var seconds = round(duration.as('s')); var minutes = round(duration.as('m')); var hours = round(duration.as('h')); var days = round(duration.as('d')); var months = round(duration.as('M')); var years = round(duration.as('y')); var a = seconds <= thresholds.ss && ['s', seconds] || seconds < thresholds.s && ['ss', seconds] || minutes <= 1 && ['m'] || minutes < thresholds.m && ['mm', minutes] || hours <= 1 && ['h'] || hours < thresholds.h && ['hh', hours] || days <= 1 && ['d'] || days < thresholds.d && ['dd', days] || months <= 1 && ['M'] || months < thresholds.M && ['MM', months] || years <= 1 && ['y'] || ['yy', years]; a[2] = withoutSuffix; a[3] = +posNegDuration > 0; a[4] = locale; return substituteTimeAgo.apply(null, a); } // This function allows you to set the rounding function for relative time strings function getSetRelativeTimeRounding (roundingFunction) { if (roundingFunction === undefined) { return round; } if (typeof(roundingFunction) === 'function') { round = roundingFunction; return true; } return false; } // This function allows you to set a threshold for relative time strings function getSetRelativeTimeThreshold (threshold, limit) { if (thresholds[threshold] === undefined) { return false; } if (limit === undefined) { return thresholds[threshold]; } thresholds[threshold] = limit; if (threshold === 's') { thresholds.ss = limit - 1; } return true; } function humanize (withSuffix) { if (!this.isValid()) { return this.localeData().invalidDate(); } var locale = this.localeData(); var output = relativeTime$1(this, !withSuffix, locale); if (withSuffix) { output = locale.pastFuture(+this, output); } return locale.postformat(output); } var abs$1 = Math.abs; function sign(x) { return ((x > 0) - (x < 0)) || +x; } function toISOString$1() { // for ISO strings we do not use the normal bubbling rules: // * milliseconds bubble up until they become hours // * days do not bubble at all // * months bubble up until they become years // This is because there is no context-free conversion between hours and days // (think of clock changes) // and also not between days and months (28-31 days per month) if (!this.isValid()) { return this.localeData().invalidDate(); } var seconds = abs$1(this._milliseconds) / 1000; var days = abs$1(this._days); var months = abs$1(this._months); var minutes, hours, years; // 3600 seconds -> 60 minutes -> 1 hour minutes = absFloor(seconds / 60); hours = absFloor(minutes / 60); seconds %= 60; minutes %= 60; // 12 months -> 1 year years = absFloor(months / 12); months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js var Y = years; var M = months; var D = days; var h = hours; var m = minutes; var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; var total = this.asSeconds(); if (!total) { // this is the same as C#'s (Noda) and python (isodate)... // but not other JS (goog.date) return 'P0D'; } var totalSign = total < 0 ? '-' : ''; var ymSign = sign(this._months) !== sign(total) ? '-' : ''; var daysSign = sign(this._days) !== sign(total) ? '-' : ''; var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; return totalSign + 'P' + (Y ? ymSign + Y + 'Y' : '') + (M ? ymSign + M + 'M' : '') + (D ? daysSign + D + 'D' : '') + ((h || m || s) ? 'T' : '') + (h ? hmsSign + h + 'H' : '') + (m ? hmsSign + m + 'M' : '') + (s ? hmsSign + s + 'S' : ''); } var proto$2 = Duration.prototype; proto$2.isValid = isValid$1; proto$2.abs = abs; proto$2.add = add$1; proto$2.subtract = subtract$1; proto$2.as = as; proto$2.asMilliseconds = asMilliseconds; proto$2.asSeconds = asSeconds; proto$2.asMinutes = asMinutes; proto$2.asHours = asHours; proto$2.asDays = asDays; proto$2.asWeeks = asWeeks; proto$2.asMonths = asMonths; proto$2.asYears = asYears; proto$2.valueOf = valueOf$1; proto$2._bubble = bubble; proto$2.clone = clone$1; proto$2.get = get$2; proto$2.milliseconds = milliseconds; proto$2.seconds = seconds; proto$2.minutes = minutes; proto$2.hours = hours; proto$2.days = days; proto$2.weeks = weeks; proto$2.months = months; proto$2.years = years; proto$2.humanize = humanize; proto$2.toISOString = toISOString$1; proto$2.toString = toISOString$1; proto$2.toJSON = toISOString$1; proto$2.locale = locale; proto$2.localeData = localeData; // Deprecations proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1); proto$2.lang = lang; // Side effect imports // FORMATTING addFormatToken('X', 0, 0, 'unix'); addFormatToken('x', 0, 0, 'valueOf'); // PARSING addRegexToken('x', matchSigned); addRegexToken('X', matchTimestamp); addParseToken('X', function (input, array, config) { config._d = new Date(parseFloat(input, 10) * 1000); }); addParseToken('x', function (input, array, config) { config._d = new Date(toInt(input)); }); // Side effect imports hooks.version = '2.20.1'; setHookCallback(createLocal); hooks.fn = proto; hooks.min = min; hooks.max = max; hooks.now = now; hooks.utc = createUTC; hooks.unix = createUnix; hooks.months = listMonths; hooks.isDate = isDate; hooks.locale = getSetGlobalLocale; hooks.invalid = createInvalid; hooks.duration = createDuration; hooks.isMoment = isMoment; hooks.weekdays = listWeekdays; hooks.parseZone = createInZone; hooks.localeData = getLocale; hooks.isDuration = isDuration; hooks.monthsShort = listMonthsShort; hooks.weekdaysMin = listWeekdaysMin; hooks.defineLocale = defineLocale; hooks.updateLocale = updateLocale; hooks.locales = listLocales; hooks.weekdaysShort = listWeekdaysShort; hooks.normalizeUnits = normalizeUnits; hooks.relativeTimeRounding = getSetRelativeTimeRounding; hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; hooks.calendarFormat = getCalendarFormat; hooks.prototype = proto; // currently HTML5 input type only supports 24-hour formats hooks.HTML5_FMT = { DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // DATE: 'YYYY-MM-DD', // TIME: 'HH:mm', // TIME_SECONDS: 'HH:mm:ss', // TIME_MS: 'HH:mm:ss.SSS', // WEEK: 'YYYY-[W]WW', // MONTH: 'YYYY-MM' // }; return hooks; }))); /* Source: src/mt-includes/assets/angular-timer/angular-timer.min.js*/ /** * angular-timer - v1.3.4 - 2016-05-01 9:52 PM * https://github.com/siddii/angular-timer * * Copyright (c) 2016 Siddique Hameed * Licensed MIT */ var timerModule=angular.module("timer",[]).directive("timer",["$compile",function(a){return{restrict:"EA",replace:!1,scope:{interval:"=interval",startTimeAttr:"=startTime",endTimeAttr:"=endTime",countdownattr:"=countdown",finishCallback:"&finishCallback",autoStart:"&autoStart",language:"@?",fallback:"@?",maxTimeUnit:"=",seconds:"=?",minutes:"=?",hours:"=?",days:"=?",months:"=?",years:"=?",secondsS:"=?",minutesS:"=?",hoursS:"=?",daysS:"=?",monthsS:"=?",yearsS:"=?"},controller:["$scope","$element","$attrs","$timeout","I18nService","$interpolate","progressBarService",function(b,c,d,e,f,g,h){function i(){b.timeoutId&&clearTimeout(b.timeoutId)}function j(){var a={};void 0!==d.startTime&&(b.millis=moment().diff(moment(b.startTimeAttr))),a=k.getTimeUnits(b.millis),b.maxTimeUnit&&"day"!==b.maxTimeUnit?"second"===b.maxTimeUnit?(b.seconds=Math.floor(b.millis/1e3),b.minutes=0,b.hours=0,b.days=0,b.months=0,b.years=0):"minute"===b.maxTimeUnit?(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4),b.hours=0,b.days=0,b.months=0,b.years=0):"hour"===b.maxTimeUnit?(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4%60),b.hours=Math.floor(b.millis/36e5),b.days=0,b.months=0,b.years=0):"month"===b.maxTimeUnit?(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4%60),b.hours=Math.floor(b.millis/36e5%24),b.days=Math.floor(b.millis/36e5/24%30),b.months=Math.floor(b.millis/36e5/24/30),b.years=0):"year"===b.maxTimeUnit&&(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4%60),b.hours=Math.floor(b.millis/36e5%24),b.days=Math.floor(b.millis/36e5/24%30),b.months=Math.floor(b.millis/36e5/24/30%12),b.years=Math.floor(b.millis/36e5/24/365)):(b.seconds=Math.floor(b.millis/1e3%60),b.minutes=Math.floor(b.millis/6e4%60),b.hours=Math.floor(b.millis/36e5%24),b.days=Math.floor(b.millis/36e5/24),b.months=0,b.years=0),b.secondsS=1===b.seconds?"":"s",b.minutesS=1===b.minutes?"":"s",b.hoursS=1===b.hours?"":"s",b.daysS=1===b.days?"":"s",b.monthsS=1===b.months?"":"s",b.yearsS=1===b.years?"":"s",b.secondUnit=a.seconds,b.minuteUnit=a.minutes,b.hourUnit=a.hours,b.dayUnit=a.days,b.monthUnit=a.months,b.yearUnit=a.years,b.sseconds=b.seconds<10?"0"+b.seconds:b.seconds,b.mminutes=b.minutes<10?"0"+b.minutes:b.minutes,b.hhours=b.hours<10?"0"+b.hours:b.hours,b.ddays=b.days<10?"0"+b.days:b.days,b.mmonths=b.months<10?"0"+b.months:b.months,b.yyears=b.years<10?"0"+b.years:b.years}"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),b.autoStart=d.autoStart||d.autostart,b.language=b.language||"en",b.fallback=b.fallback||"en",b.$watch("language",function(a){void 0!==a&&k.init(a,b.fallback)});var k=new f;k.init(b.language,b.fallback),b.displayProgressBar=0,b.displayProgressActive="active",c.append(0===c.html().trim().length?a(""+g.startSymbol()+"millis"+g.endSymbol()+"")(b):a(c.contents())(b)),b.startTime=null,b.endTime=null,b.timeoutId=null,b.countdown=angular.isNumber(b.countdownattr)&&parseInt(b.countdownattr,10)>=0?parseInt(b.countdownattr,10):void 0,b.isRunning=!1,b.$on("timer-start",function(){b.start()}),b.$on("timer-resume",function(){b.resume()}),b.$on("timer-stop",function(){b.stop()}),b.$on("timer-clear",function(){b.clear()}),b.$on("timer-reset",function(){b.reset()}),b.$on("timer-set-countdown",function(a,c){b.countdown=c}),b.$watch("startTimeAttr",function(a,c){a!==c&&b.isRunning&&b.start()}),b.$watch("endTimeAttr",function(a,c){a!==c&&b.isRunning&&b.start()}),b.start=c[0].start=function(){b.startTime=b.startTimeAttr?moment(b.startTimeAttr):moment(),b.endTime=b.endTimeAttr?moment(b.endTimeAttr):null,angular.isNumber(b.countdown)||(b.countdown=angular.isNumber(b.countdownattr)&&parseInt(b.countdownattr,10)>0?parseInt(b.countdownattr,10):void 0),i(),l(),b.isRunning=!0},b.resume=c[0].resume=function(){i(),b.countdownattr&&(b.countdown+=1),b.startTime=moment().diff(moment(b.stoppedTime).diff(moment(b.startTime))),l(),b.isRunning=!0},b.stop=b.pause=c[0].stop=c[0].pause=function(){var a=b.timeoutId;b.clear(),b.$emit("timer-stopped",{timeoutId:a,millis:b.millis,seconds:b.seconds,minutes:b.minutes,hours:b.hours,days:b.days})},b.clear=c[0].clear=function(){b.stoppedTime=moment(),i(),b.timeoutId=null,b.isRunning=!1},b.reset=c[0].reset=function(){b.startTime=b.startTimeAttr?moment(b.startTimeAttr):moment(),b.endTime=b.endTimeAttr?moment(b.endTimeAttr):null,b.countdown=angular.isNumber(b.countdownattr)&&parseInt(b.countdownattr,10)>0?parseInt(b.countdownattr,10):void 0,i(),l(),b.isRunning=!1,b.clear()},c.bind("$destroy",function(){i(),b.isRunning=!1}),b.countdownattr?(b.millis=1e3*b.countdownattr,b.addCDSeconds=c[0].addCDSeconds=function(a){b.countdown+=a,b.$digest(),b.isRunning||b.start()},b.$on("timer-add-cd-seconds",function(a,c){e(function(){b.addCDSeconds(c)})}),b.$on("timer-set-countdown-seconds",function(a,c){b.isRunning||b.clear(),b.countdown=c,b.millis=1e3*c,j()})):b.millis=0,j();var l=function m(){var a=null;b.millis=moment().diff(b.startTime);var d=b.millis%1e3;return b.endTimeAttr&&(a=b.endTimeAttr,b.millis=moment(b.endTime).diff(moment()),d=b.interval-b.millis%1e3),b.countdownattr&&(a=b.countdownattr,b.millis=1e3*b.countdown),b.millis<0?(b.stop(),b.millis=0,j(),void(b.finishCallback&&b.$eval(b.finishCallback))):(j(),b.timeoutId=setTimeout(function(){m(),b.$digest()},b.interval-d),b.$emit("timer-tick",{timeoutId:b.timeoutId,millis:b.millis,timerElement:c[0]}),b.countdown>0?b.countdown--:b.countdown<=0&&(b.stop(),b.finishCallback&&b.$eval(b.finishCallback)),void(null!==a&&(b.progressBar=h.calculateProgressBar(b.startTime,b.millis,b.endTime,b.countdownattr),100===b.progressBar&&(b.displayProgressActive=""))))};(void 0===b.autoStart||b.autoStart===!0)&&b.start()}]}}]);"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports=timerModule);var app=angular.module("timer");app.factory("I18nService",function(){var a=function(){};return a.prototype.language="en",a.prototype.fallback="en",a.prototype.timeHumanizer={},a.prototype.init=function(a,b){var c=humanizeDuration.getSupportedLanguages();this.fallback=void 0!==b?b:"en",-1===c.indexOf(b)&&(this.fallback="en"),this.language=a,-1===c.indexOf(a)&&(this.language=this.fallback),moment.locale(this.language),this.timeHumanizer=humanizeDuration.humanizer({language:this.language,halfUnit:!1})},a.prototype.getTimeUnits=function(a){var b=1e3*Math.round(a/1e3),c={};return"undefined"!=typeof this.timeHumanizer?c={millis:this.timeHumanizer(b,{units:["milliseconds"]}),seconds:this.timeHumanizer(b,{units:["seconds"]}),minutes:this.timeHumanizer(b,{units:["minutes","seconds"]}),hours:this.timeHumanizer(b,{units:["hours","minutes","seconds"]}),days:this.timeHumanizer(b,{units:["days","hours","minutes","seconds"]}),months:this.timeHumanizer(b,{units:["months","days","hours","minutes","seconds"]}),years:this.timeHumanizer(b,{units:["years","months","days","hours","minutes","seconds"]})}:console.error('i18nService has not been initialized. You must call i18nService.init("en") for example'),c},a});var app=angular.module("timer");app.factory("progressBarService",function(){var a=function(){};return a.prototype.calculateProgressBar=function(a,b,c,d){var e,f,g=0;return b/=1e3,null!==c?(e=moment(c),f=e.diff(a,"seconds"),g=100*b/f):g=100*b/d,g=100-g,g=Math.round(10*g)/10,g>100&&(g=100),g},new a}); /* Source: src/mt-includes/assets/lazysizes/lazysizes.min.js*/ /*! lazysizes - v3.0.0 */ !function(a,b){var c=b(a,a.document);a.lazySizes=c,"object"==typeof module&&module.exports&&(module.exports=c)}(window,function(a,b){"use strict";if(b.getElementsByClassName){var c,d=b.documentElement,e=a.Date,f=a.HTMLPictureElement,g="addEventListener",h="getAttribute",i=a[g],j=a.setTimeout,k=a.requestAnimationFrame||j,l=a.requestIdleCallback,m=/^picture$/i,n=["load","error","lazyincluded","_lazyloaded"],o={},p=Array.prototype.forEach,q=function(a,b){return o[b]||(o[b]=new RegExp("(\\s|^)"+b+"(\\s|$)")),o[b].test(a[h]("class")||"")&&o[b]},r=function(a,b){q(a,b)||a.setAttribute("class",(a[h]("class")||"").trim()+" "+b)},s=function(a,b){var c;(c=q(a,b))&&a.setAttribute("class",(a[h]("class")||"").replace(c," "))},t=function(a,b,c){var d=c?g:"removeEventListener";c&&t(a,b),n.forEach(function(c){a[d](c,b)})},u=function(a,c,d,e,f){var g=b.createEvent("CustomEvent");return g.initCustomEvent(c,!e,!f,d||{}),a.dispatchEvent(g),g},v=function(b,d){var e;!f&&(e=a.picturefill||c.pf)?e({reevaluate:!0,elements:[b]}):d&&d.src&&(b.src=d.src)},w=function(a,b){return(getComputedStyle(a,null)||{})[b]},x=function(a,b,d){for(d=d||a.offsetWidth;df&&(f=0),a||9>f&&l?i():j(i,f))}},B=function(a){var b,c,d=99,f=function(){b=null,a()},g=function(){var a=e.now()-c;d>a?j(g,d-a):(l||f)(f)};return function(){c=e.now(),b||(b=j(g,d))}},C=function(){var f,k,l,n,o,x,C,E,F,G,H,I,J,K,L,M=/^img$/i,N=/^iframe$/i,O="onscroll"in a&&!/glebot/.test(navigator.userAgent),P=0,Q=0,R=0,S=-1,T=function(a){R--,a&&a.target&&t(a.target,T),(!a||0>R||!a.target)&&(R=0)},U=function(a,c){var e,f=a,g="hidden"==w(b.body,"visibility")||"hidden"!=w(a,"visibility");for(F-=c,I+=c,G-=c,H+=c;g&&(f=f.offsetParent)&&f!=b.body&&f!=d;)g=(w(f,"opacity")||1)>0,g&&"visible"!=w(f,"overflow")&&(e=f.getBoundingClientRect(),g=H>e.left&&Ge.top-1&&FR&&(a=f.length)){e=0,S++,null==K&&("expand"in c||(c.expand=d.clientHeight>500&&d.clientWidth>500?500:370),J=c.expand,K=J*c.expFactor),K>Q&&1>R&&S>2&&o>2&&!b.hidden?(Q=K,S=0):Q=o>1&&S>1&&6>R?J:P;for(;a>e;e++)if(f[e]&&!f[e]._lazyRace)if(O)if((p=f[e][h]("data-expand"))&&(m=1*p)||(m=Q),q!==m&&(C=innerWidth+m*L,E=innerHeight+m,n=-1*m,q=m),g=f[e].getBoundingClientRect(),(I=g.bottom)>=n&&(F=g.top)<=E&&(H=g.right)>=n*L&&(G=g.left)<=C&&(I||H||G||F)&&(l&&3>R&&!p&&(3>o||4>S)||U(f[e],m))){if(ba(f[e]),j=!0,R>9)break}else!j&&l&&!i&&4>R&&4>S&&o>2&&(k[0]||c.preloadAfterLoad)&&(k[0]||!p&&(I||H||G||F||"auto"!=f[e][h](c.sizesAttr)))&&(i=k[0]||f[e]);else ba(f[e]);i&&!j&&ba(i)}},W=A(V),X=function(a){r(a.target,c.loadedClass),s(a.target,c.loadingClass),t(a.target,Z)},Y=z(X),Z=function(a){Y({target:a.target})},$=function(a,b){try{a.contentWindow.location.replace(b)}catch(c){a.src=b}},_=function(a){var b,d,e=a[h](c.srcsetAttr);(b=c.customMedia[a[h]("data-media")||a[h]("media")])&&a.setAttribute("media",b),e&&a.setAttribute("srcset",e),b&&(d=a.parentNode,d.insertBefore(a.cloneNode(),a),d.removeChild(a))},aa=z(function(a,b,d,e,f){var g,i,k,l,o,q;(o=u(a,"lazybeforeunveil",b)).defaultPrevented||(e&&(d?r(a,c.autosizesClass):a.setAttribute("sizes",e)),i=a[h](c.srcsetAttr),g=a[h](c.srcAttr),f&&(k=a.parentNode,l=k&&m.test(k.nodeName||"")),q=b.firesLoad||"src"in a&&(i||g||l),o={target:a},q&&(t(a,T,!0),clearTimeout(n),n=j(T,2500),r(a,c.loadingClass),t(a,Z,!0)),l&&p.call(k.getElementsByTagName("source"),_),i?a.setAttribute("srcset",i):g&&!l&&(N.test(a.nodeName)?$(a,g):a.src=g),(i||l)&&v(a,{src:g})),a._lazyRace&&delete a._lazyRace,s(a,c.lazyClass),y(function(){(!q||a.complete&&a.naturalWidth>1)&&(q?T(o):R--,X(o))},!0)}),ba=function(a){var b,d=M.test(a.nodeName),e=d&&(a[h](c.sizesAttr)||a[h]("sizes")),f="auto"==e;(!f&&l||!d||!a.src&&!a.srcset||a.complete||q(a,c.errorClass))&&(b=u(a,"lazyunveilread").detail,f&&D.updateElem(a,!0,a.offsetWidth),a._lazyRace=!0,R++,aa(a,b,f,e,d))},ca=function(){if(!l){if(e.now()-x<999)return void j(ca,999);var a=B(function(){c.loadMode=3,W()});l=!0,c.loadMode=3,W(),i("scroll",function(){3==c.loadMode&&(c.loadMode=2),a()},!0)}};return{_:function(){x=e.now(),f=b.getElementsByClassName(c.lazyClass),k=b.getElementsByClassName(c.lazyClass+" "+c.preloadClass),L=c.hFac,i("scroll",W,!0),i("resize",W,!0),a.MutationObserver?new MutationObserver(W).observe(d,{childList:!0,subtree:!0,attributes:!0}):(d[g]("DOMNodeInserted",W,!0),d[g]("DOMAttrModified",W,!0),setInterval(W,999)),i("hashchange",W,!0),["focus","mouseover","click","load","transitionend","animationend","webkitAnimationEnd"].forEach(function(a){b[g](a,W,!0)}),/d$|^c/.test(b.readyState)?ca():(i("load",ca),b[g]("DOMContentLoaded",W),j(ca,2e4)),f.length?(V(),y._lsFlush()):W()},checkElems:W,unveil:ba}}(),D=function(){var a,d=z(function(a,b,c,d){var e,f,g;if(a._lazysizesWidth=d,d+="px",a.setAttribute("sizes",d),m.test(b.nodeName||""))for(e=b.getElementsByTagName("source"),f=0,g=e.length;g>f;f++)e[f].setAttribute("sizes",d);c.detail.dataAttr||v(a,c.detail)}),e=function(a,b,c){var e,f=a.parentNode;f&&(c=x(a,f,c),e=u(a,"lazybeforesizes",{width:c,dataAttr:!!b}),e.defaultPrevented||(c=e.detail.width,c&&c!==a._lazysizesWidth&&d(a,f,e,c)))},f=function(){var b,c=a.length;if(c)for(b=0;c>b;b++)e(a[b])},g=B(f);return{_:function(){a=b.getElementsByClassName(c.autosizesClass),i("resize",g)},checkElems:g,updateElem:e}}(),E=function(){E.i||(E.i=!0,D._(),C._())};return function(){var b,d={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2};c=a.lazySizesConfig||a.lazysizesConfig||{};for(b in d)b in c||(c[b]=d[b]);a.lazySizesConfig=c,j(function(){c.init&&E()})}(),{cfg:c,autoSizer:D,loader:C,init:E,uP:v,aC:r,rC:s,hC:q,fire:u,gW:x,rAF:y}}}); /* Source: src/mt-includes/assets/angular-storage/ngStorage.min.js*/ /*! ngstorage 0.3.10 | Copyright (c) 2016 Gias Kay Lee | MIT License */!function(a,b){"use strict";"function"==typeof define&&define.amd?define(["angular"],b):a.hasOwnProperty("angular")?b(a.angular):"object"==typeof exports&&(module.exports=b(require("angular")))}(this,function(a){"use strict";function b(a,b){var c;try{c=a[b]}catch(d){c=!1}if(c){var e="__"+Math.round(1e7*Math.random());try{a[b].setItem(e,e),a[b].removeItem(e,e)}catch(d){c=!1}}return c}function c(c){var d=b(window,c);return function(){var e="ngStorage-";this.setKeyPrefix=function(a){if("string"!=typeof a)throw new TypeError("[ngStorage] - "+c+"Provider.setKeyPrefix() expects a String.");e=a};var f=a.toJson,g=a.fromJson;this.setSerializer=function(a){if("function"!=typeof a)throw new TypeError("[ngStorage] - "+c+"Provider.setSerializer expects a function.");f=a},this.setDeserializer=function(a){if("function"!=typeof a)throw new TypeError("[ngStorage] - "+c+"Provider.setDeserializer expects a function.");g=a},this.supported=function(){return!!d},this.get=function(a){return d&&g(d.getItem(e+a))},this.set=function(a,b){return d&&d.setItem(e+a,f(b))},this.remove=function(a){d&&d.removeItem(e+a)},this.$get=["$rootScope","$window","$log","$timeout","$document",function(d,h,i,j,k){var l,m,n=e.length,o=b(h,c),p=o||(i.warn("This browser does not support Web Storage!"),{setItem:a.noop,getItem:a.noop,removeItem:a.noop}),q={$default:function(b){for(var c in b)a.isDefined(q[c])||(q[c]=a.copy(b[c]));return q.$sync(),q},$reset:function(a){for(var b in q)"$"===b[0]||delete q[b]&&p.removeItem(e+b);return q.$default(a)},$sync:function(){for(var a,b=0,c=p.length;c>b;b++)(a=p.key(b))&&e===a.slice(0,n)&&(q[a.slice(n)]=g(p.getItem(a)))},$apply:function(){var b;if(m=null,!a.equals(q,l)){b=a.copy(l),a.forEach(q,function(c,d){a.isDefined(c)&&"$"!==d[0]&&(p.setItem(e+d,f(c)),delete b[d])});for(var c in b)p.removeItem(e+c);l=a.copy(q)}},$supported:function(){return!!o}};return q.$sync(),l=a.copy(q),d.$watch(function(){m||(m=j(q.$apply,100,!1))}),h.addEventListener&&h.addEventListener("storage",function(b){if(b.key){var c=k[0];c.hasFocus&&c.hasFocus()||e!==b.key.slice(0,n)||(b.newValue?q[b.key.slice(n)]=g(b.newValue):delete q[b.key.slice(n)],l=a.copy(q),d.$apply())}}),h.addEventListener&&h.addEventListener("beforeunload",function(){q.$apply()}),q}]}}return a=a&&a.module?a:window.angular,a.module("ngStorage",[]).provider("$localStorage",c("localStorage")).provider("$sessionStorage",c("sessionStorage"))}); /* Source: src/mt-includes/assets/angular-cookie/angular-cookie.js*/ /* * Copyright 2013 Ivan Pusic * Contributors: * Matjaz Lipus */ angular.module('ivpusic.cookie', ['ipCookie']); angular.module('ipCookie', ['ng']). factory('ipCookie', ['$document', function ($document) { 'use strict'; return (function () { function cookieFun(key, value, options) { var cookies, list, i, cookie, pos, name, hasCookies, all, expiresFor; options = options || {}; if (value !== undefined) { // we are setting value value = typeof value === 'object' ? JSON.stringify(value) : String(value); if (typeof options.expires === 'number') { expiresFor = options.expires; options.expires = new Date(); // Trying to delete a cookie; set a date far in the past if (expiresFor === -1) { options.expires = new Date('Thu, 01 Jan 1970 00:00:00 GMT'); // A new } else if (options.expirationUnit !== undefined) { if (options.expirationUnit === 'hours') { options.expires.setHours(options.expires.getHours() + expiresFor); } else if (options.expirationUnit === 'minutes') { options.expires.setMinutes(options.expires.getMinutes() + expiresFor); } else if (options.expirationUnit === 'seconds') { options.expires.setSeconds(options.expires.getSeconds() + expiresFor); } else { options.expires.setDate(options.expires.getDate() + expiresFor); } } else { options.expires.setDate(options.expires.getDate() + expiresFor); } } return ($document[0].cookie = [ encodeURIComponent(key), '=', encodeURIComponent(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : '' ].join('')); } list = []; all = $document[0].cookie; if (all) { list = all.split('; '); } cookies = {}; hasCookies = false; for (i = 0; i < list.length; ++i) { if (list[i]) { cookie = list[i]; pos = cookie.indexOf('='); name = cookie.substring(0, pos); value = decodeURIComponent(cookie.substring(pos + 1)); if (key === undefined || key === name) { try { cookies[name] = JSON.parse(value); } catch (e) { cookies[name] = value; } if (key === name) { return cookies[name]; } hasCookies = true; } } } if (hasCookies && key === undefined) { return cookies; } } cookieFun.remove = function (key, options) { var hasCookie = cookieFun(key) !== undefined; if (hasCookie) { if (!options) { options = {}; } options.expires = -1; cookieFun(key, '', options); } return hasCookie; }; return cookieFun; }()); } ]); /* Source: src/mt-includes/assets/angular-recaptcha/angular-recaptcha.js*/ /** * @license angular-recaptcha build:2018-05-09 * https://github.com/vividcortex/angular-recaptcha * Copyright (c) 2018 VividCortex **/ /*global angular, Recaptcha */ (function (ng) { 'use strict'; ng.module('vcRecaptcha', []); }(angular)); /*global angular */ (function (ng) { 'use strict'; function throwNoKeyException() { throw new Error('You need to set the "key" attribute to your public reCaptcha key. If you don\'t have a key, please get one from https://www.google.com/recaptcha/admin/create'); } var app = ng.module('vcRecaptcha'); /** * An angular service to wrap the reCaptcha API */ app.provider('vcRecaptchaService', function(){ var provider = this; var config = {}; provider.onLoadFunctionName = 'vcRecaptchaApiLoaded'; /** * Sets the reCaptcha configuration values which will be used by default is not specified in a specific directive instance. * * @since 2.5.0 * @param defaults object which overrides the current defaults object. */ provider.setDefaults = function(defaults){ ng.copy(defaults, config); }; /** * Sets the reCaptcha key which will be used by default is not specified in a specific directive instance. * * @since 2.5.0 * @param siteKey the reCaptcha public key (refer to the README file if you don't know what this is). */ provider.setSiteKey = function(siteKey){ config.key = siteKey; }; /** * Sets the reCaptcha theme which will be used by default is not specified in a specific directive instance. * * @since 2.5.0 * @param theme The reCaptcha theme. */ provider.setTheme = function(theme){ config.theme = theme; }; /** * Sets the reCaptcha stoken which will be used by default is not specified in a specific directive instance. * * @since 2.5.0 * @param stoken The reCaptcha stoken. */ provider.setStoken = function(stoken){ config.stoken = stoken; }; /** * Sets the reCaptcha size which will be used by default is not specified in a specific directive instance. * * @since 2.5.0 * @param size The reCaptcha size. */ provider.setSize = function(size){ config.size = size; }; /** * Sets the reCaptcha type which will be used by default is not specified in a specific directive instance. * * @since 2.5.0 * @param type The reCaptcha type. */ provider.setType = function(type){ config.type = type; }; /** * Sets the reCaptcha language which will be used by default is not specified in a specific directive instance. * * @param lang The reCaptcha language. */ provider.setLang = function(lang){ config.lang = lang; }; /** * Sets the reCaptcha badge position which will be used by default if not specified in a specific directive instance. * * @param badge The reCaptcha badge position. */ provider.setBadge = function(badge){ config.badge = badge; }; /** * Sets the reCaptcha configuration values which will be used by default is not specified in a specific directive instance. * * @since 2.5.0 * @param onLoadFunctionName string name which overrides the name of the onload function. Should match what is in the recaptcha script querystring onload value. */ provider.setOnLoadFunctionName = function(onLoadFunctionName){ provider.onLoadFunctionName = onLoadFunctionName; }; provider.$get = ['$rootScope','$window', '$q', '$document', '$interval', function ($rootScope, $window, $q, $document, $interval) { var deferred = $q.defer(), promise = deferred.promise, instances = {}, recaptcha; $window.vcRecaptchaApiLoadedCallback = $window.vcRecaptchaApiLoadedCallback || []; var callback = function () { recaptcha = $window.grecaptcha; deferred.resolve(recaptcha); }; $window.vcRecaptchaApiLoadedCallback.push(callback); $window[provider.onLoadFunctionName] = function () { $window.vcRecaptchaApiLoadedCallback.forEach(function(callback) { callback(); }); }; function getRecaptcha() { if (!!recaptcha) { return $q.when(recaptcha); } return promise; } function validateRecaptchaInstance() { if (!recaptcha) { throw new Error('reCaptcha has not been loaded yet.'); } } function isRenderFunctionAvailable() { return ng.isFunction(($window.grecaptcha || {}).render); } // Check if grecaptcha.render is not defined already. if (isRenderFunctionAvailable()) { callback(); } else if ($window.document.querySelector('script[src^="https://www.google.com/recaptcha/api.js"]')) { // wait for script to be loaded. var intervalWait = $interval(function() { if (isRenderFunctionAvailable()) { $interval.cancel(intervalWait); callback(); } }, 25); } else { // Generate link on demand var script = $window.document.createElement('script'); script.async = true; script.defer = true; script.src = 'https://www.google.com/recaptcha/api.js?onload='+provider.onLoadFunctionName+'&render=explicit'; $document.find('body')[0].appendChild(script); } return { /** * Creates a new reCaptcha object * * @param elm the DOM element where to put the captcha * @param conf the captcha object configuration * @throws NoKeyException if no key is provided in the provider config or the directive instance (via attribute) */ create: function (elm, conf) { conf.sitekey = conf.key || config.key; conf.theme = conf.theme || config.theme; conf.stoken = conf.stoken || config.stoken; conf.size = conf.size || config.size; conf.type = conf.type || config.type; conf.hl = conf.lang || config.lang; conf.badge = conf.badge || config.badge; if (!conf.sitekey) { throwNoKeyException(); } return getRecaptcha().then(function (recaptcha) { var widgetId = recaptcha.render(elm, conf); instances[widgetId] = elm; return widgetId; }); }, /** * Reloads the reCaptcha */ reload: function (widgetId) { validateRecaptchaInstance(); recaptcha.reset(widgetId); // Let everyone know this widget has been reset. $rootScope.$broadcast('reCaptchaReset', widgetId); }, /** * Executes the reCaptcha */ execute: function (widgetId) { validateRecaptchaInstance(); recaptcha.execute(widgetId); }, /** * Get/Set reCaptcha language */ useLang: function (widgetId, lang) { var instance = instances[widgetId]; if (instance) { var iframe = instance.querySelector('iframe'); if (lang) { // Setter if (iframe && iframe.src) { var s = iframe.src; if (/[?&]hl=/.test(s)) { s = s.replace(/([?&]hl=)\w+/, '$1' + lang); } else { s += ((s.indexOf('?') === -1) ? '?' : '&') + 'hl=' + lang; } iframe.src = s; } } else { // Getter if (iframe && iframe.src && /[?&]hl=\w+/.test(iframe.src)) { return iframe.src.replace(/.+[?&]hl=(\w+)([^\w].+)?/, '$1'); } else { return null; } } } else { throw new Error('reCaptcha Widget ID not exists', widgetId); } }, /** * Gets the response from the reCaptcha widget. * * @see https://developers.google.com/recaptcha/docs/display#js_api * * @returns {String} */ getResponse: function (widgetId) { validateRecaptchaInstance(); return recaptcha.getResponse(widgetId); }, /** * Gets reCaptcha instance and configuration */ getInstance: function (widgetId) { return instances[widgetId]; }, /** * Destroy reCaptcha instance. */ destroy: function (widgetId) { delete instances[widgetId]; } }; }]; }); }(angular)); /*global angular, Recaptcha */ (function (ng) { 'use strict'; var app = ng.module('vcRecaptcha'); app.directive('vcRecaptcha', ['$document', '$timeout', 'vcRecaptchaService', function ($document, $timeout, vcRecaptcha) { return { restrict: 'A', require: "?^^form", scope: { response: '=?ngModel', key: '=?', stoken: '=?', theme: '=?', size: '=?', type: '=?', lang: '=?', badge: '=?', tabindex: '=?', required: '=?', onCreate: '&', onSuccess: '&', onExpire: '&' }, link: function (scope, elm, attrs, ctrl) { scope.widgetId = null; if(ctrl && ng.isDefined(attrs.required)){ scope.$watch('required', validate); } var removeCreationListener = scope.$watch('key', function (key) { var callback = function (gRecaptchaResponse) { // Safe $apply $timeout(function () { scope.response = gRecaptchaResponse; validate(); // Notify about the response availability scope.onSuccess({response: gRecaptchaResponse, widgetId: scope.widgetId}); }); }; vcRecaptcha.create(elm[0], { callback: callback, key: key, stoken: scope.stoken || attrs.stoken || null, theme: scope.theme || attrs.theme || null, type: scope.type || attrs.type || null, lang: scope.lang || attrs.lang || null, tabindex: scope.tabindex || attrs.tabindex || null, size: scope.size || attrs.size || null, badge: scope.badge || attrs.badge || null, 'expired-callback': expired }).then(function (widgetId) { // The widget has been created validate(); scope.widgetId = widgetId; scope.onCreate({widgetId: widgetId}); scope.$on('$destroy', destroy); scope.$on('reCaptchaReset', function(event, resetWidgetId){ if(ng.isUndefined(resetWidgetId) || widgetId === resetWidgetId){ scope.response = ""; validate(); } }) }); // Remove this listener to avoid creating the widget more than once. removeCreationListener(); }); function destroy() { if (ctrl) { // reset the validity of the form if we were removed ctrl.$setValidity('recaptcha', null); } cleanup(); } function expired(){ // Safe $apply $timeout(function () { scope.response = ""; validate(); // Notify about the response availability scope.onExpire({ widgetId: scope.widgetId }); }); } function validate(){ if(ctrl){ ctrl.$setValidity('recaptcha', scope.required === false ? null : Boolean(scope.response)); } } function cleanup(){ vcRecaptcha.destroy(scope.widgetId); // removes elements reCaptcha added. ng.element($document[0].querySelectorAll('.pls-container')).parent().remove(); } } }; }]); }(angular)); //# sourceMappingURL=website.assets.min.js.map