/* Minification failed. Returning unminified contents.
(13817,1697816-1697827): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: TransmitURL
(13817,1748908-1748918): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: moreThanWH
(13817,1743401-1743411): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: moreThanWH
 */
/*!
 * jQuery JavaScript Library v3.1.1
 * https://jquery.com/
 *
 * Includes Sizzle.js
 * https://sizzlejs.com/
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license
 * https://jquery.org/license
 *
 * Date: 2016-09-22T22:30Z
 */
( function( global, factory ) {

	"use strict";

	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 ) {

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

var arr = [];

var document = window.document;

var getProto = Object.getPrototypeOf;

var slice = arr.slice;

var concat = arr.concat;

var push = arr.push;

var indexOf = arr.indexOf;

var class2type = {};

var toString = class2type.toString;

var hasOwn = class2type.hasOwnProperty;

var fnToString = hasOwn.toString;

var ObjectFunctionString = fnToString.call( Object );

var support = {};



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

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

		script.text = code;
		doc.head.appendChild( script ).parentNode.removeChild( script );
	}
/* global Symbol */
// Defining this global in .eslintrc.json would create a danger of using the global
// unguarded in another place, it seems safer to define global only for this module



var
	version = "3.1.1",

	// 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.0 only
	// Make sure we trim BOM and NBSP
	rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,

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

	// 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,

	// 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 all the elements in a clean array
		if ( num == null ) {
			return slice.call( this );
		}

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

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

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

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

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

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

	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();
	},

	// 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 ) {

		// As of jQuery 3.0, isNumeric is limited to
		// strings and numbers (primitives or objects)
		// that can be coerced to finite numbers (gh-2662)
		var type = jQuery.type( obj );
		return ( type === "number" || type === "string" ) &&

			// parseFloat NaNs numeric-cast false positives ("")
			// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
			// subtraction forces infinities to NaN
			!isNaN( obj - parseFloat( obj ) );
	},

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

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

		proto = getProto( obj );

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

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

	isEmptyObject: function( obj ) {

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

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

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

		// Support: Android <=2.3 only (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 ) {
		DOMEval( code );
	},

	// Convert dashed to camelCase; used by the css and data modules
	// Support: IE <=9 - 11, Edge 12 - 13
	// 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();
	},

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

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

		return obj;
	},

	// Support: Android <=4.0 only
	trim: function( 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 );
	},

	// Support: Android <=4.0 only, PhantomJS 1 only
	// push.apply(_, arraylike) throws on ancient WebKit
	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 length, value,
			i = 0,
			ret = [];

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

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

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

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

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

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

	// 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
} );

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

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

function isArrayLike( obj ) {

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

	if ( type === "function" || jQuery.isWindow( obj ) ) {
		return false;
	}

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

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

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

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

	// Instance methods
	hasOwn = ({}).hasOwnProperty,
	arr = [],
	pop = arr.pop,
	push_native = arr.push,
	push = arr.push,
	slice = arr.slice,
	// Use a stripped-down indexOf as it's faster than native
	// https://jsperf.com/thor-indexof-vs-for/5
	indexOf = function( list, elem ) {
		var i = 0,
			len = list.length;
		for ( ; i < len; i++ ) {
			if ( list[i] === elem ) {
				return i;
			}
		}
		return -1;
	},

	booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",

	// Regular expressions

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

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

	// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
	attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
		// Operator (capture 2)
		"*([*^$|!~]?=)" + whitespace +
		// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
		"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
		"*\\]",

	pseudos = ":(" + identifier + ")(?:\\((" +
		// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
		// 1. quoted (capture 3; capture 4 or capture 5)
		"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
		// 2. simple (capture 6)
		"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
		// 3. anything else (capture 2)
		".*" +
		")\\)|)",

	// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
	rwhitespace = new RegExp( whitespace + "+", "g" ),
	rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),

	rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
	rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),

	rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),

	rpseudo = new RegExp( pseudos ),
	ridentifier = new RegExp( "^" + identifier + "$" ),

	matchExpr = {
		"ID": new RegExp( "^#(" + identifier + ")" ),
		"CLASS": new RegExp( "^\\.(" + identifier + ")" ),
		"TAG": new RegExp( "^(" + identifier + "|[*])" ),
		"ATTR": new RegExp( "^" + attributes ),
		"PSEUDO": new RegExp( "^" + pseudos ),
		"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
			"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
			"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
		"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
		// For use in libraries implementing .is()
		// We use this for POS matching in `select`
		"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
			whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
	},

	rinputs = /^(?:input|select|textarea|button)$/i,
	rheader = /^h\d$/i,

	rnative = /^[^{]+\{\s*\[native \w/,

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

	rsibling = /[+~]/,

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

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

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

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

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

	// Used for iframes
	// See setDocument()
	// Removing the function wrapper causes a "Permission Denied"
	// error in IE
	unloadHandler = function() {
		setDocument();
	},

	disabledAncestor = addCombinator(
		function( elem ) {
			return elem.disabled === true && ("form" in elem || "label" in elem);
		},
		{ dir: "parentNode", next: "legend" }
	);

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

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

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

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

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

	results = results || [];

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

		return results;
	}

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

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

		if ( documentIsHTML ) {

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

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

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

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

					// Element context
					} else {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return a ? 1 : -1;
}

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

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

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

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

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

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

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

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

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

			return elem.disabled === disabled;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

				if ( elem ) {

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

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

				return [];
			}
		};
	}

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

			// DocumentFragment nodes don't have gEBTN
			} else if ( support.qsa ) {
				return context.querySelectorAll( tag );
			}
		} :

		function( tag, context ) {
			var elem,
				tmp = [],
				i = 0,
				// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
				results = context.getElementsByTagName( tag );

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

				return tmp;
			}
			return results;
		};

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

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

	// QSA and matchesSelector support

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

			// Otherwise we know they are disconnected
			1;

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

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

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

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

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

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

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

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

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

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

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

	return document;
};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return results;
};

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

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

	return ret;
};

Expr = Sizzle.selectors = {

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

	createPseudo: markFunction,

	match: matchExpr,

	attrHandle: {},

	find: {},

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

	preFilter: {
		"ATTR": function( 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, uniqueCache, outerCache, node, nodeIndex, start,
						dir = simple !== forward ? "nextSibling" : "previousSibling",
						parent = elem.parentNode,
						name = ofType && elem.nodeName.toLowerCase(),
						useCache = !xml && !ofType,
						diff = false;

					if ( parent ) {

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

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

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

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

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

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

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

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

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

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

								// When found, cache indexes on `parent` and break
								if ( node.nodeType === 1 && ++diff && node === elem ) {
									uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
									break;
								}
							}

						} else {
							// Use previously-cached element index if available
							if ( useCache ) {
								// ...in a gzip-friendly way
								node = elem;
								outerCache = node[ expando ] || (node[ expando ] = {});

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

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

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

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

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

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

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

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

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

		"PSEUDO": function( pseudo, 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": createDisabledPseudo( false ),
		"disabled": createDisabledPseudo( 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,
		skip = combinator.next,
		key = skip || dir,
		checkNonElements = base && key === "parentNode",
		doneName = done++;

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

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

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

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

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

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

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

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

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

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

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

	return newUnmatched;
}

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

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

			// Prefilter to get matcher input, preserving a map for seed-results synchronization
			matcherIn = preFilter && ( seed || !selector ) ?
				condense( elems, preMap, preFilter, context, xml ) :
				elems,

			matcherOut = matcher ?
				// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
				postFinder || ( seed ? preFilter : preexisting || postFilter ) ?

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

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

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

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

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

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

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

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

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

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

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

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

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

	return elementMatcher( matchers );
}

function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
	var bySet = setMatchers.length > 0,
		byElement = elementMatchers.length > 0,
		superMatcher = function( seed, context, xml, results, outermost ) {
			var elem, j, matcher,
				matchedCount = 0,
				i = "0",
				unmatched = seed && [],
				setMatched = [],
				contextBackup = outermostContext,
				// We must always have either seed elements or outermost context
				elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
				// Use integer dirruns iff this is the outermost matcher
				dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
				len = elems.length;

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

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

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

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

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

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

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

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

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

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

					Sizzle.uniqueSort( results );
				}
			}

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

			return unmatched;
		};

	return bySet ?
		markFunction( superMatcher ) :
		superMatcher;
}

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

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

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

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

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

	results = results || [];

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

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

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

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

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

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

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

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

					break;
				}
			}
		}
	}

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

// One-time assignments

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

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

// Initialize against the default document
setDocument();

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

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

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

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

return Sizzle;

})( window );



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

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




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

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


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

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

	return matched;
};


var rneedsContext = jQuery.expr.match.needsContext;

var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );



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 ) {
			return !!qualifier.call( elem, i, elem ) !== not;
		} );
	}

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

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

	// Simple selector that can be filtered directly, removing non-Elements
	if ( risSimple.test( qualifier ) ) {
		return jQuery.filter( qualifier, elements, not );
	}

	// Complex selector, compare the two sets, removing non-Elements
	qualifier = jQuery.filter( qualifier, elements );
	return jQuery.grep( elements, function( elem ) {
		return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
	} );
}

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

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

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

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

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

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

		ret = this.pushStack( [] );

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

		return len > 1 ? jQuery.uniqueSort( ret ) : ret;
	},
	filter: function( 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 <tag> to avoid XSS via location.hash (#9521)
	// Strict HTML recognition (#11290: must start with <)
	// Shortcut simple #id case for speed
	rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,

	init = jQuery.fn.init = function( selector, context, root ) {
		var match, elem;

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

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

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

				// Assume that strings that start and end with <> are HTML and skip the regex check
				match = [ null, selector, null ];

			} else {
				match = rquickExpr.exec( selector );
			}

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

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

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

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

							// Properties of context are called as methods if possible
							if ( 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 ] );

					if ( elem ) {

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

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

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

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

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

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

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

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

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


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

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

jQuery.fn.extend( {
	has: function( 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 = [],
			targets = typeof selectors !== "string" && jQuery( selectors );

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

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

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

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

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

	// Determine the position of an element within the set
	index: function( 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.uniqueSort(
				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 dir( elem, "parentNode" );
	},
	parentsUntil: function( elem, i, until ) {
		return dir( elem, "parentNode", until );
	},
	next: function( elem ) {
		return sibling( elem, "nextSibling" );
	},
	prev: function( elem ) {
		return sibling( elem, "previousSibling" );
	},
	nextAll: function( elem ) {
		return dir( elem, "nextSibling" );
	},
	prevAll: function( elem ) {
		return dir( elem, "previousSibling" );
	},
	nextUntil: function( elem, i, until ) {
		return dir( elem, "nextSibling", until );
	},
	prevUntil: function( elem, i, until ) {
		return dir( elem, "previousSibling", until );
	},
	siblings: function( elem ) {
		return siblings( ( elem.parentNode || {} ).firstChild, elem );
	},
	children: function( elem ) {
		return siblings( 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.uniqueSort( matched );
			}

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

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



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

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

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

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

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

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

		// Flag to prevent firing
		locked,

		// Actual callback list
		list = [],

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

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

		// Fire callbacks
		fire = function() {

			// Enforce single-firing
			locked = options.once;

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

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

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

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

			firing = false;

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

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

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

		// Actual Callbacks object
		self = {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return self;
};


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

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

	try {

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

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

		// Other non-thenables
		} else {

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

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

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

jQuery.extend( {

	Deferred: function( func ) {
		var tuples = [

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

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

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

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

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

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

									returned = handler.apply( that, args );

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

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

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

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

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

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

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

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

									// Handle all other returned values
									} else {

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

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

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

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

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

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

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

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

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

					return jQuery.Deferred( function( newDefer ) {

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

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

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

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

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

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

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

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

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

					// progress_callbacks.lock
					tuples[ 0 ][ 2 ].lock
				);
			}

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

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

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

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

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

		// All done!
		return deferred;
	},

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

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

			// count of unprocessed arguments
			i = remaining,

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

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

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

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

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

				return master.then();
			}
		}

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

		return master.promise();
	}
} );


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

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

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




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




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

jQuery.fn.ready = function( fn ) {

	readyList
		.then( fn )

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

	return this;
};

jQuery.extend( {

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

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

	// 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 ] );
	}
} );

jQuery.ready.then = readyList.then;

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

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

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

} else {

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

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




// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
var access = function( 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 ) {
			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 ) )
				);
			}
		}
	}

	if ( chainable ) {
		return elems;
	}

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

	return len ? fn( elems[ 0 ], key ) : emptyGet;
};
var acceptData = function( owner ) {

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




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

Data.uid = 1;

Data.prototype = {

	cache: function( owner ) {

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

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

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

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

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

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

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

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

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

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

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

			return this.get( owner, key );
		}

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

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

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

		if ( key !== undefined ) {

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

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

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

			i = key.length;

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

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

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

var dataUser = new Data();



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

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

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

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

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

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

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

	return data;
}

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

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

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

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

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

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

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

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

	_removeData: function( elem, name ) {
		dataPriv.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 = dataUser.get( elem );

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

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

			return data;
		}

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

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

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

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

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

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

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

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

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


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

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

			// Speed up dequeue by getting out quickly if this is just a lookup
			if ( data ) {
				if ( !queue || jQuery.isArray( data ) ) {
					queue = dataPriv.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 dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
			empty: jQuery.Callbacks( "once memory" ).add( function() {
				dataPriv.remove( elem, [ type + "queue", key ] );
			} )
		} );
	}
} );

jQuery.fn.extend( {
	queue: function( 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 = dataPriv.get( elements[ i ], type + "queueHooks" );
			if ( tmp && tmp.empty ) {
				count++;
				tmp.empty.add( resolve );
			}
		}
		resolve();
		return defer.promise( obj );
	}
} );
var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;

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


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

var isHiddenWithinTree = function( elem, el ) {

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

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

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

			jQuery.css( elem, "display" ) === "none";
	};

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

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

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

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

	return ret;
};




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

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

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

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

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

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

		do {

			// If previous iteration zeroed out, double until we get *something*.
			// Use string for doubling so we don't accidentally see scale as unchanged below
			scale = scale || ".5";

			// Adjust and apply
			initialInUnit = initialInUnit / scale;
			jQuery.style( elem, prop, initialInUnit + unit );

		// Update scale, tolerating zero or NaN from tween.cur()
		// Break the loop if scale is unchanged or perfect, or if we've just had enough.
		} while (
			scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
		);
	}

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

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


var defaultDisplayMap = {};

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

	if ( display ) {
		return display;
	}

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

	temp.parentNode.removeChild( temp );

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

	return display;
}

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

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

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

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

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

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

	return elements;
}

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

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

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

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



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

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

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

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

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

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


function getAll( context, tag ) {

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

	if ( typeof context.getElementsByTagName !== "undefined" ) {
		ret = context.getElementsByTagName( tag || "*" );

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

	} else {
		ret = [];
	}

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

	return ret;
}


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

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


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

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

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

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

			// Add nodes directly
			if ( jQuery.type( elem ) === "object" ) {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return fragment;
}


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

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

	div.appendChild( input );

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

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



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

function returnTrue() {
	return true;
}

function returnFalse() {
	return false;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

	global: {},

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	},

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

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

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

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

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

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

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

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

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

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

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

				delete events[ type ];
			}
		}

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

	dispatch: function( nativeEvent ) {

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

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

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

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

		event.delegateTarget = this;

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

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

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

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

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

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

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

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

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

		return event.result;
	},

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

		// Find delegate handlers
		if ( delegateCount &&

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

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

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

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

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

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

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

		return handlerQueue;
	},

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

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

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

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

	special: {
		load: {

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

			// Fire native event if possible so blur/focus sequence is correct
			trigger: function() {
				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;
				}
			}
		}
	}
};

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

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

jQuery.Event = function( src, props ) {

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

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

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

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

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

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

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

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

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

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

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

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

		this.isDefaultPrevented = returnTrue;

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

		this.isPropagationStopped = returnTrue;

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

		this.isImmediatePropagationStopped = returnTrue;

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

		this.stopPropagation();
	}
};

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

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

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

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

			if ( button & 2 ) {
				return 3;
			}

			if ( button & 4 ) {
				return 2;
			}

			return 0;
		}

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

// Create mouseenter/leave events using mouseover/out and event-time checks
// so that event delegation works in jQuery.
// Do the same for pointerenter/pointerleave and pointerover/pointerout
//
// Support: Safari 7 only
// Safari sends mouseenter too often; see:
// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
// for the description of the bug (it existed in older Chrome versions as well).
jQuery.each( {
	mouseenter: "mouseover",
	mouseleave: "mouseout",
	pointerenter: "pointerover",
	pointerleave: "pointerout"
}, function( orig, fix ) {
	jQuery.event.special[ orig ] = {
		delegateType: fix,
		bindType: fix,

		handle: function( event ) {
			var ret,
				target = this,
				related = event.relatedTarget,
				handleObj = event.handleObj;

			// For mouseenter/leave call the handler if related is outside the target.
			// NB: No relatedTarget if the mouse left/entered the browser window
			if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
				event.type = handleObj.origType;
				ret = handleObj.handler.apply( this, arguments );
				event.type = fix;
			}
			return ret;
		}
	};
} );

jQuery.fn.extend( {

	on: function( types, selector, data, fn ) {
		return on( this, types, selector, data, fn );
	},
	one: function( types, selector, data, fn ) {
		return on( this, 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 );
		} );
	}
} );


var

	/* eslint-disable max-len */

	// See https://github.com/eslint/eslint/issues/3229
	rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,

	/* eslint-enable */

	// Support: IE <=10 - 11, Edge 12 - 13
	// In IE/Edge using regex groups here causes severe slowdowns.
	// See https://connect.microsoft.com/IE/feedback/details/1736512/
	rnoInnerhtml = /<script|<style|<link/i,

	// checked="checked" or checked
	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
	rscriptTypeMasked = /^true\/(.*)/,
	rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;

function manipulationTarget( elem, content ) {
	if ( jQuery.nodeName( elem, "table" ) &&
		jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {

		return elem.getElementsByTagName( "tbody" )[ 0 ] || elem;
	}

	return elem;
}

// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
	elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
	return elem;
}
function restoreScript( elem ) {
	var match = rscriptTypeMasked.exec( elem.type );

	if ( match ) {
		elem.type = match[ 1 ];
	} else {
		elem.removeAttribute( "type" );
	}

	return elem;
}

function cloneCopyEvent( src, dest ) {
	var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;

	if ( dest.nodeType !== 1 ) {
		return;
	}

	// 1. Copy private data: events, handlers, etc.
	if ( dataPriv.hasData( src ) ) {
		pdataOld = dataPriv.access( src );
		pdataCur = dataPriv.set( dest, pdataOld );
		events = pdataOld.events;

		if ( events ) {
			delete pdataCur.handle;
			pdataCur.events = {};

			for ( type in events ) {
				for ( i = 0, l = events[ type ].length; i < l; i++ ) {
					jQuery.event.add( dest, type, events[ type ][ i ] );
				}
			}
		}
	}

	// 2. Copy user data
	if ( dataUser.hasData( src ) ) {
		udataOld = dataUser.access( src );
		udataCur = jQuery.extend( {}, udataOld );

		dataUser.set( dest, udataCur );
	}
}

// Fix IE bugs, see support tests
function fixInput( src, dest ) {
	var nodeName = dest.nodeName.toLowerCase();

	// Fails to persist the checked state of a cloned checkbox or radio button.
	if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
		dest.checked = src.checked;

	// Fails to return the selected option to the default selected state when cloning options
	} else if ( nodeName === "input" || nodeName === "textarea" ) {
		dest.defaultValue = src.defaultValue;
	}
}

function domManip( collection, args, callback, ignored ) {

	// Flatten any nested arrays
	args = concat.apply( [], args );

	var fragment, first, scripts, hasScripts, node, doc,
		i = 0,
		l = collection.length,
		iNoClone = l - 1,
		value = args[ 0 ],
		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 collection.each( function( index ) {
			var self = collection.eq( index );
			if ( isFunction ) {
				args[ 0 ] = value.call( this, index, self.html() );
			}
			domManip( self, args, callback, ignored );
		} );
	}

	if ( l ) {
		fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
		first = fragment.firstChild;

		if ( fragment.childNodes.length === 1 ) {
			fragment = first;
		}

		// Require either new content or an interest in ignored elements to invoke the callback
		if ( first || ignored ) {
			scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
			hasScripts = scripts.length;

			// Use the original fragment for the last item
			// instead of the first because it can end up
			// being emptied incorrectly in certain situations (#8070).
			for ( ; i < l; i++ ) {
				node = fragment;

				if ( i !== iNoClone ) {
					node = jQuery.clone( node, true, true );

					// Keep references to cloned scripts for later restoration
					if ( hasScripts ) {

						// Support: Android <=4.0 only, PhantomJS 1 only
						// push.apply(_, arraylike) throws on ancient WebKit
						jQuery.merge( scripts, getAll( node, "script" ) );
					}
				}

				callback.call( collection[ i ], node, i );
			}

			if ( hasScripts ) {
				doc = scripts[ scripts.length - 1 ].ownerDocument;

				// Reenable scripts
				jQuery.map( scripts, restoreScript );

				// Evaluate executable scripts on first document insertion
				for ( i = 0; i < hasScripts; i++ ) {
					node = scripts[ i ];
					if ( rscriptType.test( node.type || "" ) &&
						!dataPriv.access( node, "globalEval" ) &&
						jQuery.contains( doc, node ) ) {

						if ( node.src ) {

							// Optional AJAX dependency, but won't run scripts if not present
							if ( jQuery._evalUrl ) {
								jQuery._evalUrl( node.src );
							}
						} else {
							DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
						}
					}
				}
			}
		}
	}

	return collection;
}

function remove( elem, selector, keepData ) {
	var node,
		nodes = selector ? jQuery.filter( selector, elem ) : elem,
		i = 0;

	for ( ; ( node = nodes[ i ] ) != null; i++ ) {
		if ( !keepData && node.nodeType === 1 ) {
			jQuery.cleanData( getAll( node ) );
		}

		if ( node.parentNode ) {
			if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
				setGlobalEval( getAll( node, "script" ) );
			}
			node.parentNode.removeChild( node );
		}
	}

	return elem;
}

jQuery.extend( {
	htmlPrefilter: function( html ) {
		return html.replace( rxhtmlTag, "<$1></$2>" );
	},

	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: https://jsperf.com/getall-vs-sizzle/2
			destElements = getAll( clone );
			srcElements = getAll( elem );

			for ( i = 0, l = srcElements.length; i < l; i++ ) {
				fixInput( srcElements[ i ], destElements[ i ] );
			}
		}

		// Copy the events from the original to the clone
		if ( dataAndEvents ) {
			if ( deepDataAndEvents ) {
				srcElements = srcElements || getAll( elem );
				destElements = destElements || getAll( clone );

				for ( i = 0, l = srcElements.length; i < l; i++ ) {
					cloneCopyEvent( srcElements[ i ], destElements[ i ] );
				}
			} else {
				cloneCopyEvent( elem, clone );
			}
		}

		// Preserve script evaluation history
		destElements = getAll( clone, "script" );
		if ( destElements.length > 0 ) {
			setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
		}

		// Return the cloned set
		return clone;
	},

	cleanData: function( elems ) {
		var data, elem, type,
			special = jQuery.event.special,
			i = 0;

		for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
			if ( acceptData( elem ) ) {
				if ( ( data = elem[ dataPriv.expando ] ) ) {
					if ( data.events ) {
						for ( type in data.events ) {
							if ( special[ type ] ) {
								jQuery.event.remove( elem, type );

							// This is a shortcut to avoid jQuery.event.remove's overhead
							} else {
								jQuery.removeEvent( elem, type, data.handle );
							}
						}
					}

					// Support: Chrome <=35 - 45+
					// Assign undefined instead of using delete, see Data#remove
					elem[ dataPriv.expando ] = undefined;
				}
				if ( elem[ dataUser.expando ] ) {

					// Support: Chrome <=35 - 45+
					// Assign undefined instead of using delete, see Data#remove
					elem[ dataUser.expando ] = undefined;
				}
			}
		}
	}
} );

jQuery.fn.extend( {
	detach: function( selector ) {
		return remove( this, selector, true );
	},

	remove: function( selector ) {
		return remove( this, selector );
	},

	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 domManip( this, arguments, function( elem ) {
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
				var target = manipulationTarget( this, elem );
				target.appendChild( elem );
			}
		} );
	},

	prepend: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
				var target = manipulationTarget( this, elem );
				target.insertBefore( elem, target.firstChild );
			}
		} );
	},

	before: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.parentNode ) {
				this.parentNode.insertBefore( elem, this );
			}
		} );
	},

	after: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.parentNode ) {
				this.parentNode.insertBefore( elem, this.nextSibling );
			}
		} );
	},

	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 = jQuery.htmlPrefilter( value );

				try {
					for ( ; i < l; i++ ) {
						elem = this[ i ] || {};

						// Remove element nodes and prevent memory leaks
						if ( elem.nodeType === 1 ) {
							jQuery.cleanData( getAll( elem, false ) );
							elem.innerHTML = value;
						}
					}

					elem = 0;

				// If using innerHTML throws an exception, use the fallback method
				} catch ( e ) {}
			}

			if ( elem ) {
				this.empty().append( value );
			}
		}, null, value, arguments.length );
	},

	replaceWith: function() {
		var ignored = [];

		// Make the changes, replacing each non-ignored context element with the new content
		return domManip( this, arguments, function( elem ) {
			var parent = this.parentNode;

			if ( jQuery.inArray( this, ignored ) < 0 ) {
				jQuery.cleanData( getAll( this ) );
				if ( parent ) {
					parent.replaceChild( elem, this );
				}
			}

		// Force callback invocation
		}, ignored );
	}
} );

jQuery.each( {
	appendTo: "append",
	prependTo: "prepend",
	insertBefore: "before",
	insertAfter: "after",
	replaceAll: "replaceWith"
}, function( name, original ) {
	jQuery.fn[ name ] = function( selector ) {
		var elems,
			ret = [],
			insert = jQuery( selector ),
			last = insert.length - 1,
			i = 0;

		for ( ; i <= last; i++ ) {
			elems = i === last ? this : this.clone( true );
			jQuery( insert[ i ] )[ original ]( elems );

			// Support: Android <=4.0 only, PhantomJS 1 only
			// .get() because push.apply(_, arraylike) throws on ancient WebKit
			push.apply( ret, elems.get() );
		}

		return this.pushStack( ret );
	};
} );
var rmargin = ( /^margin/ );

var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );

var getStyles = function( elem ) {

		// Support: IE <=11 only, Firefox <=30 (#15098, #14150)
		// IE throws on elements created in popups
		// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
		var view = elem.ownerDocument.defaultView;

		if ( !view || !view.opener ) {
			view = window;
		}

		return view.getComputedStyle( elem );
	};



( function() {

	// Executing both pixelPosition & boxSizingReliable tests require only one layout
	// so they're executed at the same time to save the second computation.
	function computeStyleTests() {

		// This is a singleton, we need to execute it only once
		if ( !div ) {
			return;
		}

		div.style.cssText =
			"box-sizing:border-box;" +
			"position:relative;display:block;" +
			"margin:auto;border:1px;padding:1px;" +
			"top:1%;width:50%";
		div.innerHTML = "";
		documentElement.appendChild( container );

		var divStyle = window.getComputedStyle( div );
		pixelPositionVal = divStyle.top !== "1%";

		// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
		reliableMarginLeftVal = divStyle.marginLeft === "2px";
		boxSizingReliableVal = divStyle.width === "4px";

		// Support: Android 4.0 - 4.3 only
		// Some styles come back with percentage values, even though they shouldn't
		div.style.marginRight = "50%";
		pixelMarginRightVal = divStyle.marginRight === "4px";

		documentElement.removeChild( container );

		// Nullify the div so it wouldn't be stored in the memory and
		// it will also be a sign that checks already performed
		div = null;
	}

	var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
		container = document.createElement( "div" ),
		div = document.createElement( "div" );

	// Finish early in limited (non-browser) environments
	if ( !div.style ) {
		return;
	}

	// Support: IE <=9 - 11 only
	// Style of cloned element affects source element cloned (#8908)
	div.style.backgroundClip = "content-box";
	div.cloneNode( true ).style.backgroundClip = "";
	support.clearCloneStyle = div.style.backgroundClip === "content-box";

	container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
		"padding:0;margin-top:1px;position:absolute";
	container.appendChild( div );

	jQuery.extend( support, {
		pixelPosition: function() {
			computeStyleTests();
			return pixelPositionVal;
		},
		boxSizingReliable: function() {
			computeStyleTests();
			return boxSizingReliableVal;
		},
		pixelMarginRight: function() {
			computeStyleTests();
			return pixelMarginRightVal;
		},
		reliableMarginLeft: function() {
			computeStyleTests();
			return reliableMarginLeftVal;
		}
	} );
} )();


function curCSS( elem, name, computed ) {
	var width, minWidth, maxWidth, ret,
		style = elem.style;

	computed = computed || getStyles( elem );

	// Support: IE <=9 only
	// getPropertyValue is only needed for .css('filter') (#12537)
	if ( computed ) {
		ret = computed.getPropertyValue( name ) || computed[ name ];

		if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
			ret = jQuery.style( elem, name );
		}

		// A tribute to the "awesome hack by Dean Edwards"
		// Android Browser returns percentage for some values,
		// but width seems to be reliably pixels.
		// This is against the CSSOM draft spec:
		// https://drafts.csswg.org/cssom/#resolved-values
		if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {

			// Remember the original values
			width = style.width;
			minWidth = style.minWidth;
			maxWidth = style.maxWidth;

			// Put in the new values to get a computed value out
			style.minWidth = style.maxWidth = style.width = ret;
			ret = computed.width;

			// Revert the changed values
			style.width = width;
			style.minWidth = minWidth;
			style.maxWidth = maxWidth;
		}
	}

	return ret !== undefined ?

		// Support: IE <=9 - 11 only
		// IE returns zIndex value as an integer.
		ret + "" :
		ret;
}


function addGetHookIf( conditionFn, hookFn ) {

	// Define the hook, we'll check on the first run if it's really needed.
	return {
		get: function() {
			if ( conditionFn() ) {

				// Hook not needed (or it's not possible to use it due
				// to missing dependency), remove it.
				delete this.get;
				return;
			}

			// Hook needed; redefine it so that the support test is not executed again.
			return ( this.get = hookFn ).apply( this, arguments );
		}
	};
}


var

	// Swappable if display is none or starts with table
	// except "table", "table-cell", or "table-caption"
	// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
	rdisplayswap = /^(none|table(?!-c[ea]).+)/,
	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
	cssNormalTransform = {
		letterSpacing: "0",
		fontWeight: "400"
	},

	cssPrefixes = [ "Webkit", "Moz", "ms" ],
	emptyStyle = document.createElement( "div" ).style;

// Return a css property mapped to a potentially vendor prefixed property
function vendorPropName( name ) {

	// Shortcut for names that are not vendor prefixed
	if ( name in emptyStyle ) {
		return name;
	}

	// Check for vendor prefixed names
	var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
		i = cssPrefixes.length;

	while ( i-- ) {
		name = cssPrefixes[ i ] + capName;
		if ( name in emptyStyle ) {
			return name;
		}
	}
}

function setPositiveNumber( elem, value, subtract ) {

	// Any relative (+/-) values have already been
	// normalized at this point
	var matches = rcssNum.exec( value );
	return matches ?

		// Guard against undefined "subtract", e.g., when used as in cssHooks
		Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
		value;
}

function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
	var i,
		val = 0;

	// If we already have the right measurement, avoid augmentation
	if ( extra === ( isBorderBox ? "border" : "content" ) ) {
		i = 4;

	// Otherwise initialize for horizontal or vertical properties
	} else {
		i = name === "width" ? 1 : 0;
	}

	for ( ; i < 4; i += 2 ) {

		// Both box models exclude margin, so add it if we want it
		if ( extra === "margin" ) {
			val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
		}

		if ( isBorderBox ) {

			// border-box includes padding, so remove it if we want content
			if ( extra === "content" ) {
				val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
			}

			// At this point, extra isn't border nor margin, so remove border
			if ( extra !== "margin" ) {
				val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
			}
		} else {

			// At this point, extra isn't content, so add padding
			val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );

			// At this point, extra isn't content nor padding, so add border
			if ( extra !== "padding" ) {
				val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
			}
		}
	}

	return val;
}

function getWidthOrHeight( elem, name, extra ) {

	// Start with offset property, which is equivalent to the border-box value
	var val,
		valueIsBorderBox = true,
		styles = getStyles( elem ),
		isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";

	// Support: IE <=11 only
	// Running getBoundingClientRect on a disconnected node
	// in IE throws an error.
	if ( elem.getClientRects().length ) {
		val = elem.getBoundingClientRect()[ name ];
	}

	// Some non-html elements return undefined for offsetWidth, so check for null/undefined
	// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
	// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
	if ( val <= 0 || val == null ) {

		// Fall back to computed then uncomputed css if necessary
		val = curCSS( elem, name, styles );
		if ( val < 0 || val == null ) {
			val = elem.style[ name ];
		}

		// Computed unit is not pixels. Stop here and return.
		if ( rnumnonpx.test( val ) ) {
			return val;
		}

		// Check for style in case a browser which returns unreliable values
		// for getComputedStyle silently falls back to the reliable elem.style
		valueIsBorderBox = isBorderBox &&
			( support.boxSizingReliable() || val === elem.style[ name ] );

		// Normalize "", auto, and prepare for extra
		val = parseFloat( val ) || 0;
	}

	// Use the active box-sizing model to add/subtract irrelevant styles
	return ( val +
		augmentWidthOrHeight(
			elem,
			name,
			extra || ( isBorderBox ? "border" : "content" ),
			valueIsBorderBox,
			styles
		)
	) + "px";
}

jQuery.extend( {

	// Add in style property hooks for overriding the default
	// behavior of getting and setting a style property
	cssHooks: {
		opacity: {
			get: function( elem, computed ) {
				if ( computed ) {

					// We should always get a number back from opacity
					var ret = curCSS( elem, "opacity" );
					return ret === "" ? "1" : ret;
				}
			}
		}
	},

	// Don't automatically add "px" to these possibly-unitless properties
	cssNumber: {
		"animationIterationCount": true,
		"columnCount": true,
		"fillOpacity": true,
		"flexGrow": true,
		"flexShrink": true,
		"fontWeight": true,
		"lineHeight": true,
		"opacity": true,
		"order": true,
		"orphans": true,
		"widows": true,
		"zIndex": true,
		"zoom": true
	},

	// Add in properties whose names you wish to fix before
	// setting or getting the value
	cssProps: {
		"float": "cssFloat"
	},

	// Get and set the style property on a DOM Node
	style: function( elem, name, value, extra ) {

		// Don't set styles on text and comment nodes
		if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
			return;
		}

		// Make sure that we're working with the right name
		var ret, type, hooks,
			origName = jQuery.camelCase( name ),
			style = elem.style;

		name = jQuery.cssProps[ origName ] ||
			( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );

		// Gets hook for the prefixed version, then unprefixed version
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];

		// Check if we're setting a value
		if ( value !== undefined ) {
			type = typeof value;

			// Convert "+=" or "-=" to relative numbers (#7345)
			if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
				value = adjustCSS( elem, name, ret );

				// Fixes bug #9237
				type = "number";
			}

			// Make sure that null and NaN values aren't set (#7116)
			if ( value == null || value !== value ) {
				return;
			}

			// If a number was passed in, add the unit (except for certain CSS properties)
			if ( type === "number" ) {
				value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
			}

			// background-* props affect original clone's values
			if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
				style[ name ] = "inherit";
			}

			// If a hook was provided, use that value, otherwise just set the specified value
			if ( !hooks || !( "set" in hooks ) ||
				( value = hooks.set( elem, value, extra ) ) !== undefined ) {

				style[ name ] = value;
			}

		} else {

			// If a hook was provided get the non-computed value from there
			if ( hooks && "get" in hooks &&
				( ret = hooks.get( elem, false, extra ) ) !== undefined ) {

				return ret;
			}

			// Otherwise just get the value from the style object
			return style[ name ];
		}
	},

	css: function( elem, name, extra, styles ) {
		var val, num, hooks,
			origName = jQuery.camelCase( name );

		// Make sure that we're working with the right name
		name = jQuery.cssProps[ origName ] ||
			( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );

		// Try prefixed name followed by the unprefixed name
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];

		// If a hook was provided get the computed value from there
		if ( hooks && "get" in hooks ) {
			val = hooks.get( elem, true, extra );
		}

		// Otherwise, if a way to get the computed value exists, use that
		if ( val === undefined ) {
			val = curCSS( elem, name, styles );
		}

		// Convert "normal" to computed value
		if ( val === "normal" && name in cssNormalTransform ) {
			val = cssNormalTransform[ name ];
		}

		// Make numeric if forced or a qualifier was provided and val looks numeric
		if ( extra === "" || extra ) {
			num = parseFloat( val );
			return extra === true || isFinite( num ) ? num || 0 : val;
		}
		return val;
	}
} );

jQuery.each( [ "height", "width" ], function( i, name ) {
	jQuery.cssHooks[ name ] = {
		get: function( elem, computed, extra ) {
			if ( computed ) {

				// Certain elements can have dimension info if we invisibly show them
				// but it must have a current display style that would benefit
				return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&

					// Support: Safari 8+
					// Table columns in Safari have non-zero offsetWidth & zero
					// getBoundingClientRect().width unless display is changed.
					// Support: IE <=11 only
					// Running getBoundingClientRect on a disconnected node
					// in IE throws an error.
					( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
						swap( elem, cssShow, function() {
							return getWidthOrHeight( elem, name, extra );
						} ) :
						getWidthOrHeight( elem, name, extra );
			}
		},

		set: function( elem, value, extra ) {
			var matches,
				styles = extra && getStyles( elem ),
				subtract = extra && augmentWidthOrHeight(
					elem,
					name,
					extra,
					jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
					styles
				);

			// Convert to pixels if value adjustment is needed
			if ( subtract && ( matches = rcssNum.exec( value ) ) &&
				( matches[ 3 ] || "px" ) !== "px" ) {

				elem.style[ name ] = value;
				value = jQuery.css( elem, name );
			}

			return setPositiveNumber( elem, value, subtract );
		}
	};
} );

jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
	function( elem, computed ) {
		if ( computed ) {
			return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
				elem.getBoundingClientRect().left -
					swap( elem, { marginLeft: 0 }, function() {
						return elem.getBoundingClientRect().left;
					} )
				) + "px";
		}
	}
);

// These hooks are used by animate to expand properties
jQuery.each( {
	margin: "",
	padding: "",
	border: "Width"
}, function( prefix, suffix ) {
	jQuery.cssHooks[ prefix + suffix ] = {
		expand: function( value ) {
			var i = 0,
				expanded = {},

				// Assumes a single number if not a string
				parts = typeof value === "string" ? value.split( " " ) : [ value ];

			for ( ; i < 4; i++ ) {
				expanded[ prefix + cssExpand[ i ] + suffix ] =
					parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
			}

			return expanded;
		}
	};

	if ( !rmargin.test( prefix ) ) {
		jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
	}
} );

jQuery.fn.extend( {
	css: function( name, value ) {
		return access( this, function( elem, name, value ) {
			var styles, len,
				map = {},
				i = 0;

			if ( jQuery.isArray( name ) ) {
				styles = getStyles( elem );
				len = name.length;

				for ( ; i < len; i++ ) {
					map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
				}

				return map;
			}

			return value !== undefined ?
				jQuery.style( elem, name, value ) :
				jQuery.css( elem, name );
		}, name, value, arguments.length > 1 );
	}
} );


function Tween( elem, options, prop, end, easing ) {
	return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;

Tween.prototype = {
	constructor: Tween,
	init: function( elem, options, prop, end, easing, unit ) {
		this.elem = elem;
		this.prop = prop;
		this.easing = easing || jQuery.easing._default;
		this.options = options;
		this.start = this.now = this.cur();
		this.end = end;
		this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
	},
	cur: function() {
		var hooks = Tween.propHooks[ this.prop ];

		return hooks && hooks.get ?
			hooks.get( this ) :
			Tween.propHooks._default.get( this );
	},
	run: function( percent ) {
		var eased,
			hooks = Tween.propHooks[ this.prop ];

		if ( this.options.duration ) {
			this.pos = eased = jQuery.easing[ this.easing ](
				percent, this.options.duration * percent, 0, 1, this.options.duration
			);
		} else {
			this.pos = eased = percent;
		}
		this.now = ( this.end - this.start ) * eased + this.start;

		if ( this.options.step ) {
			this.options.step.call( this.elem, this.now, this );
		}

		if ( hooks && hooks.set ) {
			hooks.set( this );
		} else {
			Tween.propHooks._default.set( this );
		}
		return this;
	}
};

Tween.prototype.init.prototype = Tween.prototype;

Tween.propHooks = {
	_default: {
		get: function( tween ) {
			var result;

			// Use a property on the element directly when it is not a DOM element,
			// or when there is no matching style property that exists.
			if ( tween.elem.nodeType !== 1 ||
				tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
				return tween.elem[ tween.prop ];
			}

			// Passing an empty string as a 3rd parameter to .css will automatically
			// attempt a parseFloat and fallback to a string if the parse fails.
			// Simple values such as "10px" are parsed to Float;
			// complex values such as "rotate(1rad)" are returned as-is.
			result = jQuery.css( tween.elem, tween.prop, "" );

			// Empty strings, null, undefined and "auto" are converted to 0.
			return !result || result === "auto" ? 0 : result;
		},
		set: function( tween ) {

			// Use step hook for back compat.
			// Use cssHook if its there.
			// Use .style if available and use plain properties where available.
			if ( jQuery.fx.step[ tween.prop ] ) {
				jQuery.fx.step[ tween.prop ]( tween );
			} else if ( tween.elem.nodeType === 1 &&
				( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
					jQuery.cssHooks[ tween.prop ] ) ) {
				jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
			} else {
				tween.elem[ tween.prop ] = tween.now;
			}
		}
	}
};

// Support: IE <=9 only
// Panic based approach to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
	set: function( tween ) {
		if ( tween.elem.nodeType && tween.elem.parentNode ) {
			tween.elem[ tween.prop ] = tween.now;
		}
	}
};

jQuery.easing = {
	linear: function( p ) {
		return p;
	},
	swing: function( p ) {
		return 0.5 - Math.cos( p * Math.PI ) / 2;
	},
	_default: "swing"
};

jQuery.fx = Tween.prototype.init;

// Back compat <1.8 extension point
jQuery.fx.step = {};




var
	fxNow, timerId,
	rfxtypes = /^(?:toggle|show|hide)$/,
	rrun = /queueHooks$/;

function raf() {
	if ( timerId ) {
		window.requestAnimationFrame( raf );
		jQuery.fx.tick();
	}
}

// Animations created synchronously will run synchronously
function createFxNow() {
	window.setTimeout( function() {
		fxNow = undefined;
	} );
	return ( fxNow = jQuery.now() );
}

// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
	var which,
		i = 0,
		attrs = { height: type };

	// If we include width, step value is 1 to do all cssExpand values,
	// otherwise step value is 2 to skip over Left and Right
	includeWidth = includeWidth ? 1 : 0;
	for ( ; i < 4; i += 2 - includeWidth ) {
		which = cssExpand[ i ];
		attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
	}

	if ( includeWidth ) {
		attrs.opacity = attrs.width = type;
	}

	return attrs;
}

function createTween( value, prop, animation ) {
	var tween,
		collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
		index = 0,
		length = collection.length;
	for ( ; index < length; index++ ) {
		if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {

			// We're done with this property
			return tween;
		}
	}
}

function defaultPrefilter( elem, props, opts ) {
	var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
		isBox = "width" in props || "height" in props,
		anim = this,
		orig = {},
		style = elem.style,
		hidden = elem.nodeType && isHiddenWithinTree( elem ),
		dataShow = dataPriv.get( elem, "fxshow" );

	// Queue-skipping animations hijack the fx hooks
	if ( !opts.queue ) {
		hooks = jQuery._queueHooks( elem, "fx" );
		if ( hooks.unqueued == null ) {
			hooks.unqueued = 0;
			oldfire = hooks.empty.fire;
			hooks.empty.fire = function() {
				if ( !hooks.unqueued ) {
					oldfire();
				}
			};
		}
		hooks.unqueued++;

		anim.always( function() {

			// Ensure the complete handler is called before this completes
			anim.always( function() {
				hooks.unqueued--;
				if ( !jQuery.queue( elem, "fx" ).length ) {
					hooks.empty.fire();
				}
			} );
		} );
	}

	// Detect show/hide animations
	for ( prop in props ) {
		value = props[ prop ];
		if ( rfxtypes.test( value ) ) {
			delete props[ prop ];
			toggle = toggle || value === "toggle";
			if ( value === ( hidden ? "hide" : "show" ) ) {

				// Pretend to be hidden if this is a "show" and
				// there is still data from a stopped show/hide
				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
					hidden = true;

				// Ignore all other no-op show/hide data
				} else {
					continue;
				}
			}
			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
		}
	}

	// Bail out if this is a no-op like .hide().hide()
	propTween = !jQuery.isEmptyObject( props );
	if ( !propTween && jQuery.isEmptyObject( orig ) ) {
		return;
	}

	// Restrict "overflow" and "display" styles during box animations
	if ( isBox && elem.nodeType === 1 ) {

		// Support: IE <=9 - 11, Edge 12 - 13
		// Record all 3 overflow attributes because IE does not infer the shorthand
		// from identically-valued overflowX and overflowY
		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];

		// Identify a display type, preferring old show/hide data over the CSS cascade
		restoreDisplay = dataShow && dataShow.display;
		if ( restoreDisplay == null ) {
			restoreDisplay = dataPriv.get( elem, "display" );
		}
		display = jQuery.css( elem, "display" );
		if ( display === "none" ) {
			if ( restoreDisplay ) {
				display = restoreDisplay;
			} else {

				// Get nonempty value(s) by temporarily forcing visibility
				showHide( [ elem ], true );
				restoreDisplay = elem.style.display || restoreDisplay;
				display = jQuery.css( elem, "display" );
				showHide( [ elem ] );
			}
		}

		// Animate inline elements as inline-block
		if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
			if ( jQuery.css( elem, "float" ) === "none" ) {

				// Restore the original display value at the end of pure show/hide animations
				if ( !propTween ) {
					anim.done( function() {
						style.display = restoreDisplay;
					} );
					if ( restoreDisplay == null ) {
						display = style.display;
						restoreDisplay = display === "none" ? "" : display;
					}
				}
				style.display = "inline-block";
			}
		}
	}

	if ( opts.overflow ) {
		style.overflow = "hidden";
		anim.always( function() {
			style.overflow = opts.overflow[ 0 ];
			style.overflowX = opts.overflow[ 1 ];
			style.overflowY = opts.overflow[ 2 ];
		} );
	}

	// Implement show/hide animations
	propTween = false;
	for ( prop in orig ) {

		// General show/hide setup for this element animation
		if ( !propTween ) {
			if ( dataShow ) {
				if ( "hidden" in dataShow ) {
					hidden = dataShow.hidden;
				}
			} else {
				dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
			}

			// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
			if ( toggle ) {
				dataShow.hidden = !hidden;
			}

			// Show elements before animating them
			if ( hidden ) {
				showHide( [ elem ], true );
			}

			/* eslint-disable no-loop-func */

			anim.done( function() {

			/* eslint-enable no-loop-func */

				// The final step of a "hide" animation is actually hiding the element
				if ( !hidden ) {
					showHide( [ elem ] );
				}
				dataPriv.remove( elem, "fxshow" );
				for ( prop in orig ) {
					jQuery.style( elem, prop, orig[ prop ] );
				}
			} );
		}

		// Per-property setup
		propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
		if ( !( prop in dataShow ) ) {
			dataShow[ prop ] = propTween.start;
			if ( hidden ) {
				propTween.end = propTween.start;
				propTween.start = 0;
			}
		}
	}
}

function propFilter( props, specialEasing ) {
	var index, name, easing, value, hooks;

	// camelCase, specialEasing and expand cssHook pass
	for ( index in props ) {
		name = jQuery.camelCase( index );
		easing = specialEasing[ name ];
		value = props[ index ];
		if ( jQuery.isArray( value ) ) {
			easing = value[ 1 ];
			value = props[ index ] = value[ 0 ];
		}

		if ( index !== name ) {
			props[ name ] = value;
			delete props[ index ];
		}

		hooks = jQuery.cssHooks[ name ];
		if ( hooks && "expand" in hooks ) {
			value = hooks.expand( value );
			delete props[ name ];

			// Not quite $.extend, this won't overwrite existing keys.
			// Reusing 'index' because we have the correct "name"
			for ( index in value ) {
				if ( !( index in props ) ) {
					props[ index ] = value[ index ];
					specialEasing[ index ] = easing;
				}
			}
		} else {
			specialEasing[ name ] = easing;
		}
	}
}

function Animation( elem, properties, options ) {
	var result,
		stopped,
		index = 0,
		length = Animation.prefilters.length,
		deferred = jQuery.Deferred().always( function() {

			// Don't match elem in the :animated selector
			delete tick.elem;
		} ),
		tick = function() {
			if ( stopped ) {
				return false;
			}
			var currentTime = fxNow || createFxNow(),
				remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),

				// Support: Android 2.3 only
				// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
				temp = remaining / animation.duration || 0,
				percent = 1 - temp,
				index = 0,
				length = animation.tweens.length;

			for ( ; index < length; index++ ) {
				animation.tweens[ index ].run( percent );
			}

			deferred.notifyWith( elem, [ animation, percent, remaining ] );

			if ( percent < 1 && length ) {
				return remaining;
			} else {
				deferred.resolveWith( elem, [ animation ] );
				return false;
			}
		},
		animation = deferred.promise( {
			elem: elem,
			props: jQuery.extend( {}, properties ),
			opts: jQuery.extend( true, {
				specialEasing: {},
				easing: jQuery.easing._default
			}, options ),
			originalProperties: properties,
			originalOptions: options,
			startTime: fxNow || createFxNow(),
			duration: options.duration,
			tweens: [],
			createTween: function( prop, end ) {
				var tween = jQuery.Tween( elem, animation.opts, prop, end,
						animation.opts.specialEasing[ prop ] || animation.opts.easing );
				animation.tweens.push( tween );
				return tween;
			},
			stop: function( gotoEnd ) {
				var index = 0,

					// If we are going to the end, we want to run all the tweens
					// otherwise we skip this part
					length = gotoEnd ? animation.tweens.length : 0;
				if ( stopped ) {
					return this;
				}
				stopped = true;
				for ( ; index < length; index++ ) {
					animation.tweens[ index ].run( 1 );
				}

				// Resolve when we played the last frame; otherwise, reject
				if ( gotoEnd ) {
					deferred.notifyWith( elem, [ animation, 1, 0 ] );
					deferred.resolveWith( elem, [ animation, gotoEnd ] );
				} else {
					deferred.rejectWith( elem, [ animation, gotoEnd ] );
				}
				return this;
			}
		} ),
		props = animation.props;

	propFilter( props, animation.opts.specialEasing );

	for ( ; index < length; index++ ) {
		result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
		if ( result ) {
			if ( jQuery.isFunction( result.stop ) ) {
				jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
					jQuery.proxy( result.stop, result );
			}
			return result;
		}
	}

	jQuery.map( props, createTween, animation );

	if ( jQuery.isFunction( animation.opts.start ) ) {
		animation.opts.start.call( elem, animation );
	}

	jQuery.fx.timer(
		jQuery.extend( tick, {
			elem: elem,
			anim: animation,
			queue: animation.opts.queue
		} )
	);

	// attach callbacks from options
	return animation.progress( animation.opts.progress )
		.done( animation.opts.done, animation.opts.complete )
		.fail( animation.opts.fail )
		.always( animation.opts.always );
}

jQuery.Animation = jQuery.extend( Animation, {

	tweeners: {
		"*": [ function( prop, value ) {
			var tween = this.createTween( prop, value );
			adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
			return tween;
		} ]
	},

	tweener: function( props, callback ) {
		if ( jQuery.isFunction( props ) ) {
			callback = props;
			props = [ "*" ];
		} else {
			props = props.match( rnothtmlwhite );
		}

		var prop,
			index = 0,
			length = props.length;

		for ( ; index < length; index++ ) {
			prop = props[ index ];
			Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
			Animation.tweeners[ prop ].unshift( callback );
		}
	},

	prefilters: [ defaultPrefilter ],

	prefilter: function( callback, prepend ) {
		if ( prepend ) {
			Animation.prefilters.unshift( callback );
		} else {
			Animation.prefilters.push( callback );
		}
	}
} );

jQuery.speed = function( speed, easing, fn ) {
	var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
		complete: fn || !fn && easing ||
			jQuery.isFunction( speed ) && speed,
		duration: speed,
		easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
	};

	// Go to the end state if fx are off or if document is hidden
	if ( jQuery.fx.off || document.hidden ) {
		opt.duration = 0;

	} else {
		if ( typeof opt.duration !== "number" ) {
			if ( opt.duration in jQuery.fx.speeds ) {
				opt.duration = jQuery.fx.speeds[ opt.duration ];

			} else {
				opt.duration = jQuery.fx.speeds._default;
			}
		}
	}

	// Normalize opt.queue - true/undefined/null -> "fx"
	if ( opt.queue == null || opt.queue === true ) {
		opt.queue = "fx";
	}

	// Queueing
	opt.old = opt.complete;

	opt.complete = function() {
		if ( jQuery.isFunction( opt.old ) ) {
			opt.old.call( this );
		}

		if ( opt.queue ) {
			jQuery.dequeue( this, opt.queue );
		}
	};

	return opt;
};

jQuery.fn.extend( {
	fadeTo: function( speed, to, easing, callback ) {

		// Show any hidden elements after setting opacity to 0
		return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()

			// Animate to the value specified
			.end().animate( { opacity: to }, speed, easing, callback );
	},
	animate: function( prop, speed, easing, callback ) {
		var empty = jQuery.isEmptyObject( prop ),
			optall = jQuery.speed( speed, easing, callback ),
			doAnimation = function() {

				// Operate on a copy of prop so per-property easing won't be lost
				var anim = Animation( this, jQuery.extend( {}, prop ), optall );

				// Empty animations, or finishing resolves immediately
				if ( empty || dataPriv.get( this, "finish" ) ) {
					anim.stop( true );
				}
			};
			doAnimation.finish = doAnimation;

		return empty || optall.queue === false ?
			this.each( doAnimation ) :
			this.queue( optall.queue, doAnimation );
	},
	stop: function( type, clearQueue, gotoEnd ) {
		var stopQueue = function( hooks ) {
			var stop = hooks.stop;
			delete hooks.stop;
			stop( gotoEnd );
		};

		if ( typeof type !== "string" ) {
			gotoEnd = clearQueue;
			clearQueue = type;
			type = undefined;
		}
		if ( clearQueue && type !== false ) {
			this.queue( type || "fx", [] );
		}

		return this.each( function() {
			var dequeue = true,
				index = type != null && type + "queueHooks",
				timers = jQuery.timers,
				data = dataPriv.get( this );

			if ( index ) {
				if ( data[ index ] && data[ index ].stop ) {
					stopQueue( data[ index ] );
				}
			} else {
				for ( index in data ) {
					if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
						stopQueue( data[ index ] );
					}
				}
			}

			for ( index = timers.length; index--; ) {
				if ( timers[ index ].elem === this &&
					( type == null || timers[ index ].queue === type ) ) {

					timers[ index ].anim.stop( gotoEnd );
					dequeue = false;
					timers.splice( index, 1 );
				}
			}

			// Start the next in the queue if the last step wasn't forced.
			// Timers currently will call their complete callbacks, which
			// will dequeue but only if they were gotoEnd.
			if ( dequeue || !gotoEnd ) {
				jQuery.dequeue( this, type );
			}
		} );
	},
	finish: function( type ) {
		if ( type !== false ) {
			type = type || "fx";
		}
		return this.each( function() {
			var index,
				data = dataPriv.get( this ),
				queue = data[ type + "queue" ],
				hooks = data[ type + "queueHooks" ],
				timers = jQuery.timers,
				length = queue ? queue.length : 0;

			// Enable finishing flag on private data
			data.finish = true;

			// Empty the queue first
			jQuery.queue( this, type, [] );

			if ( hooks && hooks.stop ) {
				hooks.stop.call( this, true );
			}

			// Look for any active animations, and finish them
			for ( index = timers.length; index--; ) {
				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
					timers[ index ].anim.stop( true );
					timers.splice( index, 1 );
				}
			}

			// Look for any animations in the old queue and finish them
			for ( index = 0; index < length; index++ ) {
				if ( queue[ index ] && queue[ index ].finish ) {
					queue[ index ].finish.call( this );
				}
			}

			// Turn off finishing flag
			delete data.finish;
		} );
	}
} );

jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
	var cssFn = jQuery.fn[ name ];
	jQuery.fn[ name ] = function( speed, easing, callback ) {
		return speed == null || typeof speed === "boolean" ?
			cssFn.apply( this, arguments ) :
			this.animate( genFx( name, true ), speed, easing, callback );
	};
} );

// Generate shortcuts for custom animations
jQuery.each( {
	slideDown: genFx( "show" ),
	slideUp: genFx( "hide" ),
	slideToggle: genFx( "toggle" ),
	fadeIn: { opacity: "show" },
	fadeOut: { opacity: "hide" },
	fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
	jQuery.fn[ name ] = function( speed, easing, callback ) {
		return this.animate( props, speed, easing, callback );
	};
} );

jQuery.timers = [];
jQuery.fx.tick = function() {
	var timer,
		i = 0,
		timers = jQuery.timers;

	fxNow = jQuery.now();

	for ( ; i < timers.length; i++ ) {
		timer = timers[ i ];

		// Checks the timer has not already been removed
		if ( !timer() && timers[ i ] === timer ) {
			timers.splice( i--, 1 );
		}
	}

	if ( !timers.length ) {
		jQuery.fx.stop();
	}
	fxNow = undefined;
};

jQuery.fx.timer = function( timer ) {
	jQuery.timers.push( timer );
	if ( timer() ) {
		jQuery.fx.start();
	} else {
		jQuery.timers.pop();
	}
};

jQuery.fx.interval = 13;
jQuery.fx.start = function() {
	if ( !timerId ) {
		timerId = window.requestAnimationFrame ?
			window.requestAnimationFrame( raf ) :
			window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
	}
};

jQuery.fx.stop = function() {
	if ( window.cancelAnimationFrame ) {
		window.cancelAnimationFrame( timerId );
	} else {
		window.clearInterval( timerId );
	}

	timerId = null;
};

jQuery.fx.speeds = {
	slow: 600,
	fast: 200,

	// Default speed
	_default: 400
};


// Based off of the plugin by Clint Helfers, with permission.
// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
jQuery.fn.delay = function( time, type ) {
	time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
	type = type || "fx";

	return this.queue( type, function( next, hooks ) {
		var timeout = window.setTimeout( next, time );
		hooks.stop = function() {
			window.clearTimeout( timeout );
		};
	} );
};


( function() {
	var input = document.createElement( "input" ),
		select = document.createElement( "select" ),
		opt = select.appendChild( document.createElement( "option" ) );

	input.type = "checkbox";

	// Support: Android <=4.3 only
	// Default value for a checkbox should be "on"
	support.checkOn = input.value !== "";

	// Support: IE <=11 only
	// Must access selectedIndex to make default options select
	support.optSelected = opt.selected;

	// Support: IE <=11 only
	// An input loses its value after becoming a radio
	input = document.createElement( "input" );
	input.value = "t";
	input.type = "radio";
	support.radioValue = input.value === "t";
} )();


var boolHook,
	attrHandle = jQuery.expr.attrHandle;

jQuery.fn.extend( {
	attr: function( name, value ) {
		return access( this, jQuery.attr, name, value, arguments.length > 1 );
	},

	removeAttr: function( name ) {
		return this.each( function() {
			jQuery.removeAttr( this, name );
		} );
	}
} );

jQuery.extend( {
	attr: function( elem, name, value ) {
		var ret, hooks,
			nType = elem.nodeType;

		// Don't get/set attributes on text, comment and attribute nodes
		if ( nType === 3 || nType === 8 || nType === 2 ) {
			return;
		}

		// Fallback to prop when attributes are not supported
		if ( typeof elem.getAttribute === "undefined" ) {
			return jQuery.prop( elem, name, value );
		}

		// Attribute hooks are determined by the lowercase version
		// Grab necessary hook if one is defined
		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
			hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
				( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
		}

		if ( value !== undefined ) {
			if ( value === null ) {
				jQuery.removeAttr( elem, name );
				return;
			}

			if ( hooks && "set" in hooks &&
				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
				return ret;
			}

			elem.setAttribute( name, value + "" );
			return value;
		}

		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
			return ret;
		}

		ret = jQuery.find.attr( elem, name );

		// Non-existent attributes return null, we normalize to undefined
		return ret == null ? undefined : ret;
	},

	attrHooks: {
		type: {
			set: function( elem, value ) {
				if ( !support.radioValue && value === "radio" &&
					jQuery.nodeName( elem, "input" ) ) {
					var val = elem.value;
					elem.setAttribute( "type", value );
					if ( val ) {
						elem.value = val;
					}
					return value;
				}
			}
		}
	},

	removeAttr: function( elem, value ) {
		var name,
			i = 0,

			// Attribute names can contain non-HTML whitespace characters
			// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
			attrNames = value && value.match( rnothtmlwhite );

		if ( attrNames && elem.nodeType === 1 ) {
			while ( ( name = attrNames[ i++ ] ) ) {
				elem.removeAttribute( name );
			}
		}
	}
} );

// Hooks for boolean attributes
boolHook = {
	set: function( elem, value, name ) {
		if ( value === false ) {

			// Remove boolean attributes when set to false
			jQuery.removeAttr( elem, name );
		} else {
			elem.setAttribute( name, name );
		}
		return name;
	}
};

jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
	var getter = attrHandle[ name ] || jQuery.find.attr;

	attrHandle[ name ] = function( elem, name, isXML ) {
		var ret, handle,
			lowercaseName = name.toLowerCase();

		if ( !isXML ) {

			// Avoid an infinite loop by temporarily removing this function from the getter
			handle = attrHandle[ lowercaseName ];
			attrHandle[ lowercaseName ] = ret;
			ret = getter( elem, name, isXML ) != null ?
				lowercaseName :
				null;
			attrHandle[ lowercaseName ] = handle;
		}
		return ret;
	};
} );




var rfocusable = /^(?:input|select|textarea|button)$/i,
	rclickable = /^(?:a|area)$/i;

jQuery.fn.extend( {
	prop: function( name, value ) {
		return access( this, jQuery.prop, name, value, arguments.length > 1 );
	},

	removeProp: function( name ) {
		return this.each( function() {
			delete this[ jQuery.propFix[ name ] || name ];
		} );
	}
} );

jQuery.extend( {
	prop: function( elem, name, value ) {
		var ret, hooks,
			nType = elem.nodeType;

		// Don't get/set properties on text, comment and attribute nodes
		if ( nType === 3 || nType === 8 || nType === 2 ) {
			return;
		}

		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {

			// Fix name and attach hooks
			name = jQuery.propFix[ name ] || name;
			hooks = jQuery.propHooks[ name ];
		}

		if ( value !== undefined ) {
			if ( hooks && "set" in hooks &&
				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
				return ret;
			}

			return ( elem[ name ] = value );
		}

		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
			return ret;
		}

		return elem[ name ];
	},

	propHooks: {
		tabIndex: {
			get: function( elem ) {

				// Support: IE <=9 - 11 only
				// elem.tabIndex doesn't always return the
				// correct value when it hasn't been explicitly set
				// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
				// Use proper attribute retrieval(#12072)
				var tabindex = jQuery.find.attr( elem, "tabindex" );

				if ( tabindex ) {
					return parseInt( tabindex, 10 );
				}

				if (
					rfocusable.test( elem.nodeName ) ||
					rclickable.test( elem.nodeName ) &&
					elem.href
				) {
					return 0;
				}

				return -1;
			}
		}
	},

	propFix: {
		"for": "htmlFor",
		"class": "className"
	}
} );

// Support: IE <=11 only
// Accessing the selectedIndex property
// forces the browser to respect setting selected
// on the option
// The getter ensures a default option is selected
// when in an optgroup
// eslint rule "no-unused-expressions" is disabled for this code
// since it considers such accessions noop
if ( !support.optSelected ) {
	jQuery.propHooks.selected = {
		get: function( elem ) {

			/* eslint no-unused-expressions: "off" */

			var parent = elem.parentNode;
			if ( parent && parent.parentNode ) {
				parent.parentNode.selectedIndex;
			}
			return null;
		},
		set: function( elem ) {

			/* eslint no-unused-expressions: "off" */

			var parent = elem.parentNode;
			if ( parent ) {
				parent.selectedIndex;

				if ( parent.parentNode ) {
					parent.parentNode.selectedIndex;
				}
			}
		}
	};
}

jQuery.each( [
	"tabIndex",
	"readOnly",
	"maxLength",
	"cellSpacing",
	"cellPadding",
	"rowSpan",
	"colSpan",
	"useMap",
	"frameBorder",
	"contentEditable"
], function() {
	jQuery.propFix[ this.toLowerCase() ] = this;
} );




	// Strip and collapse whitespace according to HTML spec
	// https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
	function stripAndCollapse( value ) {
		var tokens = value.match( rnothtmlwhite ) || [];
		return tokens.join( " " );
	}


function getClass( elem ) {
	return elem.getAttribute && elem.getAttribute( "class" ) || "";
}

jQuery.fn.extend( {
	addClass: function( value ) {
		var classes, elem, cur, curValue, clazz, j, finalValue,
			i = 0;

		if ( jQuery.isFunction( value ) ) {
			return this.each( function( j ) {
				jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
			} );
		}

		if ( typeof value === "string" && value ) {
			classes = value.match( rnothtmlwhite ) || [];

			while ( ( elem = this[ i++ ] ) ) {
				curValue = getClass( elem );
				cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );

				if ( cur ) {
					j = 0;
					while ( ( clazz = classes[ j++ ] ) ) {
						if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
							cur += clazz + " ";
						}
					}

					// Only assign if different to avoid unneeded rendering.
					finalValue = stripAndCollapse( cur );
					if ( curValue !== finalValue ) {
						elem.setAttribute( "class", finalValue );
					}
				}
			}
		}

		return this;
	},

	removeClass: function( value ) {
		var classes, elem, cur, curValue, clazz, j, finalValue,
			i = 0;

		if ( jQuery.isFunction( value ) ) {
			return this.each( function( j ) {
				jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
			} );
		}

		if ( !arguments.length ) {
			return this.attr( "class", "" );
		}

		if ( typeof value === "string" && value ) {
			classes = value.match( rnothtmlwhite ) || [];

			while ( ( elem = this[ i++ ] ) ) {
				curValue = getClass( elem );

				// This expression is here for better compressibility (see addClass)
				cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );

				if ( cur ) {
					j = 0;
					while ( ( clazz = classes[ j++ ] ) ) {

						// Remove *all* instances
						while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
							cur = cur.replace( " " + clazz + " ", " " );
						}
					}

					// Only assign if different to avoid unneeded rendering.
					finalValue = stripAndCollapse( cur );
					if ( curValue !== finalValue ) {
						elem.setAttribute( "class", finalValue );
					}
				}
			}
		}

		return this;
	},

	toggleClass: function( value, stateVal ) {
		var type = typeof value;

		if ( typeof stateVal === "boolean" && type === "string" ) {
			return stateVal ? this.addClass( value ) : this.removeClass( value );
		}

		if ( jQuery.isFunction( value ) ) {
			return this.each( function( i ) {
				jQuery( this ).toggleClass(
					value.call( this, i, getClass( this ), stateVal ),
					stateVal
				);
			} );
		}

		return this.each( function() {
			var className, i, self, classNames;

			if ( type === "string" ) {

				// Toggle individual class names
				i = 0;
				self = jQuery( this );
				classNames = value.match( rnothtmlwhite ) || [];

				while ( ( className = classNames[ i++ ] ) ) {

					// Check each className given, space separated list
					if ( self.hasClass( className ) ) {
						self.removeClass( className );
					} else {
						self.addClass( className );
					}
				}

			// Toggle whole class name
			} else if ( value === undefined || type === "boolean" ) {
				className = getClass( this );
				if ( className ) {

					// Store className if set
					dataPriv.set( this, "__className__", className );
				}

				// If the element has a class name or if we're passed `false`,
				// then remove the whole classname (if there was one, the above saved it).
				// Otherwise bring back whatever was previously saved (if anything),
				// falling back to the empty string if nothing was stored.
				if ( this.setAttribute ) {
					this.setAttribute( "class",
						className || value === false ?
						"" :
						dataPriv.get( this, "__className__" ) || ""
					);
				}
			}
		} );
	},

	hasClass: function( selector ) {
		var className, elem,
			i = 0;

		className = " " + selector + " ";
		while ( ( elem = this[ i++ ] ) ) {
			if ( elem.nodeType === 1 &&
				( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
					return true;
			}
		}

		return false;
	}
} );




var rreturn = /\r/g;

jQuery.fn.extend( {
	val: function( value ) {
		var hooks, ret, isFunction,
			elem = this[ 0 ];

		if ( !arguments.length ) {
			if ( elem ) {
				hooks = jQuery.valHooks[ elem.type ] ||
					jQuery.valHooks[ elem.nodeName.toLowerCase() ];

				if ( hooks &&
					"get" in hooks &&
					( ret = hooks.get( elem, "value" ) ) !== undefined
				) {
					return ret;
				}

				ret = elem.value;

				// Handle most common string cases
				if ( typeof ret === "string" ) {
					return ret.replace( rreturn, "" );
				}

				// Handle cases where value is null/undef or number
				return ret == null ? "" : ret;
			}

			return;
		}

		isFunction = jQuery.isFunction( value );

		return this.each( function( i ) {
			var val;

			if ( this.nodeType !== 1 ) {
				return;
			}

			if ( isFunction ) {
				val = value.call( this, i, jQuery( this ).val() );
			} else {
				val = value;
			}

			// Treat null/undefined as ""; convert numbers to string
			if ( val == null ) {
				val = "";

			} else if ( typeof val === "number" ) {
				val += "";

			} else if ( jQuery.isArray( val ) ) {
				val = jQuery.map( val, function( value ) {
					return value == null ? "" : value + "";
				} );
			}

			hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];

			// If set returns undefined, fall back to normal setting
			if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
				this.value = val;
			}
		} );
	}
} );

jQuery.extend( {
	valHooks: {
		option: {
			get: function( elem ) {

				var val = jQuery.find.attr( elem, "value" );
				return val != null ?
					val :

					// Support: IE <=10 - 11 only
					// option.text throws exceptions (#14686, #14858)
					// Strip and collapse whitespace
					// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
					stripAndCollapse( jQuery.text( elem ) );
			}
		},
		select: {
			get: function( elem ) {
				var value, option, i,
					options = elem.options,
					index = elem.selectedIndex,
					one = elem.type === "select-one",
					values = one ? null : [],
					max = one ? index + 1 : options.length;

				if ( index < 0 ) {
					i = max;

				} else {
					i = one ? index : 0;
				}

				// Loop through all the selected options
				for ( ; i < max; i++ ) {
					option = options[ i ];

					// Support: IE <=9 only
					// IE8-9 doesn't update selected after form reset (#2551)
					if ( ( option.selected || i === index ) &&

							// Don't return options that are disabled or in a disabled optgroup
							!option.disabled &&
							( !option.parentNode.disabled ||
								!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {

						// Get the specific value for the option
						value = jQuery( option ).val();

						// We don't need an array for one selects
						if ( one ) {
							return value;
						}

						// Multi-Selects return an array
						values.push( value );
					}
				}

				return values;
			},

			set: function( elem, value ) {
				var optionSet, option,
					options = elem.options,
					values = jQuery.makeArray( value ),
					i = options.length;

				while ( i-- ) {
					option = options[ i ];

					/* eslint-disable no-cond-assign */

					if ( option.selected =
						jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
					) {
						optionSet = true;
					}

					/* eslint-enable no-cond-assign */
				}

				// Force browsers to behave consistently when non-matching value is set
				if ( !optionSet ) {
					elem.selectedIndex = -1;
				}
				return values;
			}
		}
	}
} );

// Radios and checkboxes getter/setter
jQuery.each( [ "radio", "checkbox" ], function() {
	jQuery.valHooks[ this ] = {
		set: function( elem, value ) {
			if ( jQuery.isArray( value ) ) {
				return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
			}
		}
	};
	if ( !support.checkOn ) {
		jQuery.valHooks[ this ].get = function( elem ) {
			return elem.getAttribute( "value" ) === null ? "on" : elem.value;
		};
	}
} );




// Return jQuery for attributes-only inclusion


var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;

jQuery.extend( jQuery.event, {

	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( "." ) > -1 ) {

			// Namespaced trigger; create a regexp to match event type in handle()
			namespaces = type.split( "." );
			type = namespaces.shift();
			namespaces.sort();
		}
		ontype = type.indexOf( ":" ) < 0 && "on" + type;

		// Caller can pass in a jQuery.Event object, Object, or just an event type string
		event = event[ jQuery.expando ] ?
			event :
			new jQuery.Event( type, typeof event === "object" && event );

		// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
		event.isTrigger = onlyHandlers ? 2 : 3;
		event.namespace = namespaces.join( "." );
		event.rnamespace = event.namespace ?
			new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
			null;

		// Clean up the event in case it is being reused
		event.result = undefined;
		if ( !event.target ) {
			event.target = elem;
		}

		// Clone any incoming data and prepend the event, creating the handler arg list
		data = data == null ?
			[ event ] :
			jQuery.makeArray( data, [ event ] );

		// Allow special events to draw outside the lines
		special = jQuery.event.special[ type ] || {};
		if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
			return;
		}

		// Determine event propagation path in advance, per W3C events spec (#9951)
		// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
		if ( !onlyHandlers && !special.noBubble && !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 = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
				dataPriv.get( cur, "handle" );
			if ( handle ) {
				handle.apply( cur, data );
			}

			// Native handler
			handle = ontype && cur[ ontype ];
			if ( handle && handle.apply && acceptData( cur ) ) {
				event.result = handle.apply( cur, data );
				if ( event.result === false ) {
					event.preventDefault();
				}
			}
		}
		event.type = type;

		// If nobody prevented the default action, do it now
		if ( !onlyHandlers && !event.isDefaultPrevented() ) {

			if ( ( !special._default ||
				special._default.apply( eventPath.pop(), data ) === false ) &&
				acceptData( elem ) ) {

				// Call a native DOM method on the target with the same name as the event.
				// Don't do default actions on window, that's where global variables be (#6170)
				if ( ontype && 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;
	},

	// Piggyback on a donor event to simulate a different one
	// Used only for `focus(in | out)` events
	simulate: function( type, elem, event ) {
		var e = jQuery.extend(
			new jQuery.Event(),
			event,
			{
				type: type,
				isSimulated: true
			}
		);

		jQuery.event.trigger( e, null, elem );
	}

} );

jQuery.fn.extend( {

	trigger: function( 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 );
		}
	}
} );


jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
	"change select submit keydown keypress keyup contextmenu" ).split( " " ),
	function( i, name ) {

	// Handle event binding
	jQuery.fn[ name ] = function( data, fn ) {
		return arguments.length > 0 ?
			this.on( name, null, data, fn ) :
			this.trigger( name );
	};
} );

jQuery.fn.extend( {
	hover: function( fnOver, fnOut ) {
		return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
	}
} );




support.focusin = "onfocusin" in window;


// Support: Firefox <=44
// Firefox doesn't have focus(in | out) events
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
//
// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
// focus(in | out) events fire after focus & blur events,
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
if ( !support.focusin ) {
	jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {

		// Attach a single capturing handler on the document while someone wants focusin/focusout
		var handler = function( event ) {
			jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
		};

		jQuery.event.special[ fix ] = {
			setup: function() {
				var doc = this.ownerDocument || this,
					attaches = dataPriv.access( doc, fix );

				if ( !attaches ) {
					doc.addEventListener( orig, handler, true );
				}
				dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
			},
			teardown: function() {
				var doc = this.ownerDocument || this,
					attaches = dataPriv.access( doc, fix ) - 1;

				if ( !attaches ) {
					doc.removeEventListener( orig, handler, true );
					dataPriv.remove( doc, fix );

				} else {
					dataPriv.access( doc, fix, attaches );
				}
			}
		};
	} );
}
var location = window.location;

var nonce = jQuery.now();

var rquery = ( /\?/ );



// Cross-browser xml parsing
jQuery.parseXML = function( data ) {
	var xml;
	if ( !data || typeof data !== "string" ) {
		return null;
	}

	// Support: IE 9 - 11 only
	// IE throws on parseFromString with invalid input.
	try {
		xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
	} catch ( e ) {
		xml = undefined;
	}

	if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
		jQuery.error( "Invalid XML: " + data );
	}
	return xml;
};


var
	rbracket = /\[\]$/,
	rCRLF = /\r?\n/g,
	rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
	rsubmittable = /^(?:input|select|textarea|keygen)/i;

function buildParams( prefix, obj, traditional, add ) {
	var name;

	if ( jQuery.isArray( obj ) ) {

		// Serialize array item.
		jQuery.each( obj, function( i, v ) {
			if ( traditional || rbracket.test( prefix ) ) {

				// Treat each array item as a scalar.
				add( prefix, v );

			} else {

				// Item is non-scalar (array or object), encode its numeric index.
				buildParams(
					prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
					v,
					traditional,
					add
				);
			}
		} );

	} else if ( !traditional && jQuery.type( obj ) === "object" ) {

		// Serialize object item.
		for ( name in obj ) {
			buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
		}

	} else {

		// Serialize scalar item.
		add( prefix, obj );
	}
}

// Serialize an array of form elements or a set of
// key/values into a query string
jQuery.param = function( a, traditional ) {
	var prefix,
		s = [],
		add = function( key, valueOrFunction ) {

			// If value is a function, invoke it and use its return value
			var value = jQuery.isFunction( valueOrFunction ) ?
				valueOrFunction() :
				valueOrFunction;

			s[ s.length ] = encodeURIComponent( key ) + "=" +
				encodeURIComponent( value == null ? "" : value );
		};

	// If an array was passed in, assume that it is an array of form elements.
	if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {

		// Serialize the form elements
		jQuery.each( a, function() {
			add( this.name, this.value );
		} );

	} else {

		// If traditional, encode the "old" way (the way 1.3.2 or older
		// did it), otherwise encode params recursively.
		for ( prefix in a ) {
			buildParams( prefix, a[ prefix ], traditional, add );
		}
	}

	// Return the resulting serialization
	return s.join( "&" );
};

jQuery.fn.extend( {
	serialize: function() {
		return jQuery.param( this.serializeArray() );
	},
	serializeArray: function() {
		return this.map( function() {

			// Can add propHook for "elements" to filter or add form elements
			var elements = jQuery.prop( this, "elements" );
			return elements ? jQuery.makeArray( elements ) : this;
		} )
		.filter( function() {
			var type = this.type;

			// Use .is( ":disabled" ) so that fieldset[disabled] works
			return this.name && !jQuery( this ).is( ":disabled" ) &&
				rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
				( this.checked || !rcheckableType.test( type ) );
		} )
		.map( function( i, elem ) {
			var val = jQuery( this ).val();

			if ( val == null ) {
				return null;
			}

			if ( jQuery.isArray( val ) ) {
				return jQuery.map( val, function( val ) {
					return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
				} );
			}

			return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
		} ).get();
	}
} );


var
	r20 = /%20/g,
	rhash = /#.*$/,
	rantiCache = /([?&])_=[^&]*/,
	rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,

	// #7653, #8125, #8152: local protocol detection
	rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
	rnoContent = /^(?:GET|HEAD)$/,
	rprotocol = /^\/\//,

	/* Prefilters
	 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
	 * 2) These are called:
	 *    - BEFORE asking for a transport
	 *    - AFTER param serialization (s.data is a string if s.processData is true)
	 * 3) key is the dataType
	 * 4) the catchall symbol "*" can be used
	 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
	 */
	prefilters = {},

	/* Transports bindings
	 * 1) key is the dataType
	 * 2) the catchall symbol "*" can be used
	 * 3) selection will start with transport dataType and THEN go to "*" if needed
	 */
	transports = {},

	// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
	allTypes = "*/".concat( "*" ),

	// Anchor tag for parsing the document origin
	originAnchor = document.createElement( "a" );
	originAnchor.href = location.href;

// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {

	// dataTypeExpression is optional and defaults to "*"
	return function( dataTypeExpression, func ) {

		if ( typeof dataTypeExpression !== "string" ) {
			func = dataTypeExpression;
			dataTypeExpression = "*";
		}

		var dataType,
			i = 0,
			dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];

		if ( jQuery.isFunction( func ) ) {

			// For each dataType in the dataTypeExpression
			while ( ( dataType = dataTypes[ i++ ] ) ) {

				// Prepend if requested
				if ( dataType[ 0 ] === "+" ) {
					dataType = dataType.slice( 1 ) || "*";
					( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );

				// Otherwise append
				} else {
					( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
				}
			}
		}
	};
}

// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {

	var inspected = {},
		seekingTransport = ( structure === transports );

	function inspect( dataType ) {
		var selected;
		inspected[ dataType ] = true;
		jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
			var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
			if ( typeof dataTypeOrTransport === "string" &&
				!seekingTransport && !inspected[ dataTypeOrTransport ] ) {

				options.dataTypes.unshift( dataTypeOrTransport );
				inspect( dataTypeOrTransport );
				return false;
			} else if ( seekingTransport ) {
				return !( selected = dataTypeOrTransport );
			}
		} );
		return selected;
	}

	return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}

// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
	var key, deep,
		flatOptions = jQuery.ajaxSettings.flatOptions || {};

	for ( key in src ) {
		if ( src[ key ] !== undefined ) {
			( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
		}
	}
	if ( deep ) {
		jQuery.extend( true, target, deep );
	}

	return target;
}

/* Handles responses to an ajax request:
 * - finds the right dataType (mediates between content-type and expected dataType)
 * - returns the corresponding response
 */
function ajaxHandleResponses( s, jqXHR, responses ) {

	var ct, type, finalDataType, firstDataType,
		contents = s.contents,
		dataTypes = s.dataTypes;

	// Remove auto dataType and get content-type in the process
	while ( dataTypes[ 0 ] === "*" ) {
		dataTypes.shift();
		if ( ct === undefined ) {
			ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
		}
	}

	// Check if we're dealing with a known content-type
	if ( ct ) {
		for ( type in contents ) {
			if ( contents[ type ] && contents[ type ].test( ct ) ) {
				dataTypes.unshift( type );
				break;
			}
		}
	}

	// Check to see if we have a response for the expected dataType
	if ( dataTypes[ 0 ] in responses ) {
		finalDataType = dataTypes[ 0 ];
	} else {

		// Try convertible dataTypes
		for ( type in responses ) {
			if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
				finalDataType = type;
				break;
			}
			if ( !firstDataType ) {
				firstDataType = type;
			}
		}

		// Or just use first one
		finalDataType = finalDataType || firstDataType;
	}

	// If we found a dataType
	// We add the dataType to the list if needed
	// and return the corresponding response
	if ( finalDataType ) {
		if ( finalDataType !== dataTypes[ 0 ] ) {
			dataTypes.unshift( finalDataType );
		}
		return responses[ finalDataType ];
	}
}

/* Chain conversions given the request and the original response
 * Also sets the responseXXX fields on the jqXHR instance
 */
function ajaxConvert( s, response, jqXHR, isSuccess ) {
	var conv2, current, conv, tmp, prev,
		converters = {},

		// Work with a copy of dataTypes in case we need to modify it for conversion
		dataTypes = s.dataTypes.slice();

	// Create converters map with lowercased keys
	if ( dataTypes[ 1 ] ) {
		for ( conv in s.converters ) {
			converters[ conv.toLowerCase() ] = s.converters[ conv ];
		}
	}

	current = dataTypes.shift();

	// Convert to each sequential dataType
	while ( current ) {

		if ( s.responseFields[ current ] ) {
			jqXHR[ s.responseFields[ current ] ] = response;
		}

		// Apply the dataFilter if provided
		if ( !prev && isSuccess && s.dataFilter ) {
			response = s.dataFilter( response, s.dataType );
		}

		prev = current;
		current = dataTypes.shift();

		if ( current ) {

			// There's only work to do if current dataType is non-auto
			if ( current === "*" ) {

				current = prev;

			// Convert response if prev dataType is non-auto and differs from current
			} else if ( prev !== "*" && prev !== current ) {

				// Seek a direct converter
				conv = converters[ prev + " " + current ] || converters[ "* " + current ];

				// If none found, seek a pair
				if ( !conv ) {
					for ( conv2 in converters ) {

						// If conv2 outputs current
						tmp = conv2.split( " " );
						if ( tmp[ 1 ] === current ) {

							// If prev can be converted to accepted input
							conv = converters[ prev + " " + tmp[ 0 ] ] ||
								converters[ "* " + tmp[ 0 ] ];
							if ( conv ) {

								// Condense equivalence converters
								if ( conv === true ) {
									conv = converters[ conv2 ];

								// Otherwise, insert the intermediate dataType
								} else if ( converters[ conv2 ] !== true ) {
									current = tmp[ 0 ];
									dataTypes.unshift( tmp[ 1 ] );
								}
								break;
							}
						}
					}
				}

				// Apply converter (if not an equivalence)
				if ( conv !== true ) {

					// Unless errors are allowed to bubble, catch and return them
					if ( conv && s.throws ) {
						response = conv( response );
					} else {
						try {
							response = conv( response );
						} catch ( e ) {
							return {
								state: "parsererror",
								error: conv ? e : "No conversion from " + prev + " to " + current
							};
						}
					}
				}
			}
		}
	}

	return { state: "success", data: response };
}

jQuery.extend( {

	// Counter for holding the number of active queries
	active: 0,

	// Last-Modified header cache for next request
	lastModified: {},
	etag: {},

	ajaxSettings: {
		url: location.href,
		type: "GET",
		isLocal: rlocalProtocol.test( location.protocol ),
		global: true,
		processData: true,
		async: true,
		contentType: "application/x-www-form-urlencoded; charset=UTF-8",

		/*
		timeout: 0,
		data: null,
		dataType: null,
		username: null,
		password: null,
		cache: null,
		throws: false,
		traditional: false,
		headers: {},
		*/

		accepts: {
			"*": allTypes,
			text: "text/plain",
			html: "text/html",
			xml: "application/xml, text/xml",
			json: "application/json, text/javascript"
		},

		contents: {
			xml: /\bxml\b/,
			html: /\bhtml/,
			json: /\bjson\b/
		},

		responseFields: {
			xml: "responseXML",
			text: "responseText",
			json: "responseJSON"
		},

		// Data converters
		// Keys separate source (or catchall "*") and destination types with a single space
		converters: {

			// Convert anything to text
			"* text": String,

			// Text to html (true = no transformation)
			"text html": true,

			// Evaluate text as a json expression
			"text json": JSON.parse,

			// Parse text as xml
			"text xml": jQuery.parseXML
		},

		// For options that shouldn't be deep extended:
		// you can add your own custom options here if
		// and when you create one that shouldn't be
		// deep extended (see ajaxExtend)
		flatOptions: {
			url: true,
			context: true
		}
	},

	// Creates a full fledged settings object into target
	// with both ajaxSettings and settings fields.
	// If target is omitted, writes into ajaxSettings.
	ajaxSetup: function( target, settings ) {
		return settings ?

			// Building a settings object
			ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :

			// Extending ajaxSettings
			ajaxExtend( jQuery.ajaxSettings, target );
	},

	ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
	ajaxTransport: addToPrefiltersOrTransports( transports ),

	// Main method
	ajax: function( url, options ) {

		// If url is an object, simulate pre-1.5 signature
		if ( typeof url === "object" ) {
			options = url;
			url = undefined;
		}

		// Force options to be an object
		options = options || {};

		var transport,

			// URL without anti-cache param
			cacheURL,

			// Response headers
			responseHeadersString,
			responseHeaders,

			// timeout handle
			timeoutTimer,

			// Url cleanup var
			urlAnchor,

			// Request state (becomes false upon send and true upon completion)
			completed,

			// To know if global events are to be dispatched
			fireGlobals,

			// Loop variable
			i,

			// uncached part of the url
			uncached,

			// Create the final options object
			s = jQuery.ajaxSetup( {}, options ),

			// Callbacks context
			callbackContext = s.context || s,

			// Context for global events is callbackContext if it is a DOM node or jQuery collection
			globalEventContext = s.context &&
				( callbackContext.nodeType || callbackContext.jquery ) ?
					jQuery( callbackContext ) :
					jQuery.event,

			// Deferreds
			deferred = jQuery.Deferred(),
			completeDeferred = jQuery.Callbacks( "once memory" ),

			// Status-dependent callbacks
			statusCode = s.statusCode || {},

			// Headers (they are sent all at once)
			requestHeaders = {},
			requestHeadersNames = {},

			// Default abort message
			strAbort = "canceled",

			// Fake xhr
			jqXHR = {
				readyState: 0,

				// Builds headers hashtable if needed
				getResponseHeader: function( key ) {
					var match;
					if ( completed ) {
						if ( !responseHeaders ) {
							responseHeaders = {};
							while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
								responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
							}
						}
						match = responseHeaders[ key.toLowerCase() ];
					}
					return match == null ? null : match;
				},

				// Raw string
				getAllResponseHeaders: function() {
					return completed ? responseHeadersString : null;
				},

				// Caches the header
				setRequestHeader: function( name, value ) {
					if ( completed == null ) {
						name = requestHeadersNames[ name.toLowerCase() ] =
							requestHeadersNames[ name.toLowerCase() ] || name;
						requestHeaders[ name ] = value;
					}
					return this;
				},

				// Overrides response content-type header
				overrideMimeType: function( type ) {
					if ( completed == null ) {
						s.mimeType = type;
					}
					return this;
				},

				// Status-dependent callbacks
				statusCode: function( map ) {
					var code;
					if ( map ) {
						if ( completed ) {

							// Execute the appropriate callbacks
							jqXHR.always( map[ jqXHR.status ] );
						} else {

							// Lazy-add the new callbacks in a way that preserves old ones
							for ( code in map ) {
								statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
							}
						}
					}
					return this;
				},

				// Cancel the request
				abort: function( statusText ) {
					var finalText = statusText || strAbort;
					if ( transport ) {
						transport.abort( finalText );
					}
					done( 0, finalText );
					return this;
				}
			};

		// Attach deferreds
		deferred.promise( jqXHR );

		// Add protocol if not provided (prefilters might expect it)
		// Handle falsy url in the settings object (#10093: consistency with old signature)
		// We also use the url parameter if available
		s.url = ( ( url || s.url || location.href ) + "" )
			.replace( rprotocol, location.protocol + "//" );

		// Alias method option to type as per ticket #12004
		s.type = options.method || options.type || s.method || s.type;

		// Extract dataTypes list
		s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];

		// A cross-domain request is in order when the origin doesn't match the current origin.
		if ( s.crossDomain == null ) {
			urlAnchor = document.createElement( "a" );

			// Support: IE <=8 - 11, Edge 12 - 13
			// IE throws exception on accessing the href property if url is malformed,
			// e.g. http://example.com:80x/
			try {
				urlAnchor.href = s.url;

				// Support: IE <=8 - 11 only
				// Anchor's host property isn't correctly set when s.url is relative
				urlAnchor.href = urlAnchor.href;
				s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
					urlAnchor.protocol + "//" + urlAnchor.host;
			} catch ( e ) {

				// If there is an error parsing the URL, assume it is crossDomain,
				// it can be rejected by the transport if it is invalid
				s.crossDomain = true;
			}
		}

		// Convert data if not already a string
		if ( s.data && s.processData && typeof s.data !== "string" ) {
			s.data = jQuery.param( s.data, s.traditional );
		}

		// Apply prefilters
		inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );

		// If request was aborted inside a prefilter, stop there
		if ( completed ) {
			return jqXHR;
		}

		// We can fire global events as of now if asked to
		// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
		fireGlobals = jQuery.event && s.global;

		// Watch for a new set of requests
		if ( fireGlobals && jQuery.active++ === 0 ) {
			jQuery.event.trigger( "ajaxStart" );
		}

		// Uppercase the type
		s.type = s.type.toUpperCase();

		// Determine if request has content
		s.hasContent = !rnoContent.test( s.type );

		// Save the URL in case we're toying with the If-Modified-Since
		// and/or If-None-Match header later on
		// Remove hash to simplify url manipulation
		cacheURL = s.url.replace( rhash, "" );

		// More options handling for requests with no content
		if ( !s.hasContent ) {

			// Remember the hash so we can put it back
			uncached = s.url.slice( cacheURL.length );

			// If data is available, append data to url
			if ( s.data ) {
				cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;

				// #9682: remove data so that it's not used in an eventual retry
				delete s.data;
			}

			// Add or update anti-cache param if needed
			if ( s.cache === false ) {
				cacheURL = cacheURL.replace( rantiCache, "$1" );
				uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
			}

			// Put hash and anti-cache on the URL that will be requested (gh-1732)
			s.url = cacheURL + uncached;

		// Change '%20' to '+' if this is encoded form body content (gh-2658)
		} else if ( s.data && s.processData &&
			( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
			s.data = s.data.replace( r20, "+" );
		}

		// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
		if ( s.ifModified ) {
			if ( jQuery.lastModified[ cacheURL ] ) {
				jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
			}
			if ( jQuery.etag[ cacheURL ] ) {
				jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
			}
		}

		// Set the correct header, if data is being sent
		if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
			jqXHR.setRequestHeader( "Content-Type", s.contentType );
		}

		// Set the Accepts header for the server, depending on the dataType
		jqXHR.setRequestHeader(
			"Accept",
			s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
				s.accepts[ s.dataTypes[ 0 ] ] +
					( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
				s.accepts[ "*" ]
		);

		// Check for headers option
		for ( i in s.headers ) {
			jqXHR.setRequestHeader( i, s.headers[ i ] );
		}

		// Allow custom headers/mimetypes and early abort
		if ( s.beforeSend &&
			( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {

			// Abort if not done already and return
			return jqXHR.abort();
		}

		// Aborting is no longer a cancellation
		strAbort = "abort";

		// Install callbacks on deferreds
		completeDeferred.add( s.complete );
		jqXHR.done( s.success );
		jqXHR.fail( s.error );

		// Get transport
		transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );

		// If no transport, we auto-abort
		if ( !transport ) {
			done( -1, "No Transport" );
		} else {
			jqXHR.readyState = 1;

			// Send global event
			if ( fireGlobals ) {
				globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
			}

			// If request was aborted inside ajaxSend, stop there
			if ( completed ) {
				return jqXHR;
			}

			// Timeout
			if ( s.async && s.timeout > 0 ) {
				timeoutTimer = window.setTimeout( function() {
					jqXHR.abort( "timeout" );
				}, s.timeout );
			}

			try {
				completed = false;
				transport.send( requestHeaders, done );
			} catch ( e ) {

				// Rethrow post-completion exceptions
				if ( completed ) {
					throw e;
				}

				// Propagate others as results
				done( -1, e );
			}
		}

		// Callback for when everything is done
		function done( status, nativeStatusText, responses, headers ) {
			var isSuccess, success, error, response, modified,
				statusText = nativeStatusText;

			// Ignore repeat invocations
			if ( completed ) {
				return;
			}

			completed = true;

			// Clear timeout if it exists
			if ( timeoutTimer ) {
				window.clearTimeout( timeoutTimer );
			}

			// Dereference transport for early garbage collection
			// (no matter how long the jqXHR object will be used)
			transport = undefined;

			// Cache response headers
			responseHeadersString = headers || "";

			// Set readyState
			jqXHR.readyState = status > 0 ? 4 : 0;

			// Determine if successful
			isSuccess = status >= 200 && status < 300 || status === 304;

			// Get response data
			if ( responses ) {
				response = ajaxHandleResponses( s, jqXHR, responses );
			}

			// Convert no matter what (that way responseXXX fields are always set)
			response = ajaxConvert( s, response, jqXHR, isSuccess );

			// If successful, handle type chaining
			if ( isSuccess ) {

				// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
				if ( s.ifModified ) {
					modified = jqXHR.getResponseHeader( "Last-Modified" );
					if ( modified ) {
						jQuery.lastModified[ cacheURL ] = modified;
					}
					modified = jqXHR.getResponseHeader( "etag" );
					if ( modified ) {
						jQuery.etag[ cacheURL ] = modified;
					}
				}

				// if no content
				if ( status === 204 || s.type === "HEAD" ) {
					statusText = "nocontent";

				// if not modified
				} else if ( status === 304 ) {
					statusText = "notmodified";

				// If we have data, let's convert it
				} else {
					statusText = response.state;
					success = response.data;
					error = response.error;
					isSuccess = !error;
				}
			} else {

				// Extract error from statusText and normalize for non-aborts
				error = statusText;
				if ( status || !statusText ) {
					statusText = "error";
					if ( status < 0 ) {
						status = 0;
					}
				}
			}

			// Set data for the fake xhr object
			jqXHR.status = status;
			jqXHR.statusText = ( nativeStatusText || statusText ) + "";

			// Success/Error
			if ( isSuccess ) {
				deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
			} else {
				deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
			}

			// Status-dependent callbacks
			jqXHR.statusCode( statusCode );
			statusCode = undefined;

			if ( fireGlobals ) {
				globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
					[ jqXHR, s, isSuccess ? success : error ] );
			}

			// Complete
			completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );

			if ( fireGlobals ) {
				globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );

				// Handle the global AJAX counter
				if ( !( --jQuery.active ) ) {
					jQuery.event.trigger( "ajaxStop" );
				}
			}
		}

		return jqXHR;
	},

	getJSON: function( url, data, callback ) {
		return jQuery.get( url, data, callback, "json" );
	},

	getScript: function( url, callback ) {
		return jQuery.get( url, undefined, callback, "script" );
	}
} );

jQuery.each( [ "get", "post" ], function( i, method ) {
	jQuery[ method ] = function( url, data, callback, type ) {

		// Shift arguments if data argument was omitted
		if ( jQuery.isFunction( data ) ) {
			type = type || callback;
			callback = data;
			data = undefined;
		}

		// The url can be an options object (which then must have .url)
		return jQuery.ajax( jQuery.extend( {
			url: url,
			type: method,
			dataType: type,
			data: data,
			success: callback
		}, jQuery.isPlainObject( url ) && url ) );
	};
} );


jQuery._evalUrl = function( url ) {
	return jQuery.ajax( {
		url: url,

		// Make this explicit, since user can override this through ajaxSetup (#11264)
		type: "GET",
		dataType: "script",
		cache: true,
		async: false,
		global: false,
		"throws": true
	} );
};


jQuery.fn.extend( {
	wrapAll: function( html ) {
		var wrap;

		if ( this[ 0 ] ) {
			if ( jQuery.isFunction( html ) ) {
				html = html.call( this[ 0 ] );
			}

			// The elements to wrap the target around
			wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );

			if ( this[ 0 ].parentNode ) {
				wrap.insertBefore( this[ 0 ] );
			}

			wrap.map( function() {
				var elem = this;

				while ( elem.firstElementChild ) {
					elem = elem.firstElementChild;
				}

				return elem;
			} ).append( this );
		}

		return this;
	},

	wrapInner: function( html ) {
		if ( jQuery.isFunction( html ) ) {
			return this.each( function( i ) {
				jQuery( this ).wrapInner( html.call( this, i ) );
			} );
		}

		return this.each( function() {
			var self = jQuery( this ),
				contents = self.contents();

			if ( contents.length ) {
				contents.wrapAll( html );

			} else {
				self.append( html );
			}
		} );
	},

	wrap: function( html ) {
		var isFunction = jQuery.isFunction( html );

		return this.each( function( i ) {
			jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
		} );
	},

	unwrap: function( selector ) {
		this.parent( selector ).not( "body" ).each( function() {
			jQuery( this ).replaceWith( this.childNodes );
		} );
		return this;
	}
} );


jQuery.expr.pseudos.hidden = function( elem ) {
	return !jQuery.expr.pseudos.visible( elem );
};
jQuery.expr.pseudos.visible = function( elem ) {
	return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
};




jQuery.ajaxSettings.xhr = function() {
	try {
		return new window.XMLHttpRequest();
	} catch ( e ) {}
};

var xhrSuccessStatus = {

		// File protocol always yields status code 0, assume 200
		0: 200,

		// Support: IE <=9 only
		// #1450: sometimes IE returns 1223 when it should be 204
		1223: 204
	},
	xhrSupported = jQuery.ajaxSettings.xhr();

support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
support.ajax = xhrSupported = !!xhrSupported;

jQuery.ajaxTransport( function( options ) {
	var callback, errorCallback;

	// Cross domain only allowed if supported through XMLHttpRequest
	if ( support.cors || xhrSupported && !options.crossDomain ) {
		return {
			send: function( headers, complete ) {
				var i,
					xhr = options.xhr();

				xhr.open(
					options.type,
					options.url,
					options.async,
					options.username,
					options.password
				);

				// Apply custom fields if provided
				if ( options.xhrFields ) {
					for ( i in options.xhrFields ) {
						xhr[ i ] = options.xhrFields[ i ];
					}
				}

				// Override mime type if needed
				if ( options.mimeType && xhr.overrideMimeType ) {
					xhr.overrideMimeType( options.mimeType );
				}

				// X-Requested-With header
				// For cross-domain requests, seeing as conditions for a preflight are
				// akin to a jigsaw puzzle, we simply never set it to be sure.
				// (it can always be set on a per-request basis or even using ajaxSetup)
				// For same-domain requests, won't change header if already provided.
				if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
					headers[ "X-Requested-With" ] = "XMLHttpRequest";
				}

				// Set headers
				for ( i in headers ) {
					xhr.setRequestHeader( i, headers[ i ] );
				}

				// Callback
				callback = function( type ) {
					return function() {
						if ( callback ) {
							callback = errorCallback = xhr.onload =
								xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;

							if ( type === "abort" ) {
								xhr.abort();
							} else if ( type === "error" ) {

								// Support: IE <=9 only
								// On a manual native abort, IE9 throws
								// errors on any property access that is not readyState
								if ( typeof xhr.status !== "number" ) {
									complete( 0, "error" );
								} else {
									complete(

										// File: protocol always yields status 0; see #8605, #14207
										xhr.status,
										xhr.statusText
									);
								}
							} else {
								complete(
									xhrSuccessStatus[ xhr.status ] || xhr.status,
									xhr.statusText,

									// Support: IE <=9 only
									// IE9 has no XHR2 but throws on binary (trac-11426)
									// For XHR2 non-text, let the caller handle it (gh-2498)
									( xhr.responseType || "text" ) !== "text"  ||
									typeof xhr.responseText !== "string" ?
										{ binary: xhr.response } :
										{ text: xhr.responseText },
									xhr.getAllResponseHeaders()
								);
							}
						}
					};
				};

				// Listen to events
				xhr.onload = callback();
				errorCallback = xhr.onerror = callback( "error" );

				// Support: IE 9 only
				// Use onreadystatechange to replace onabort
				// to handle uncaught aborts
				if ( xhr.onabort !== undefined ) {
					xhr.onabort = errorCallback;
				} else {
					xhr.onreadystatechange = function() {

						// Check readyState before timeout as it changes
						if ( xhr.readyState === 4 ) {

							// Allow onerror to be called first,
							// but that will not handle a native abort
							// Also, save errorCallback to a variable
							// as xhr.onerror cannot be accessed
							window.setTimeout( function() {
								if ( callback ) {
									errorCallback();
								}
							} );
						}
					};
				}

				// Create the abort callback
				callback = callback( "abort" );

				try {

					// Do send the request (this may raise an exception)
					xhr.send( options.hasContent && options.data || null );
				} catch ( e ) {

					// #14683: Only rethrow if this hasn't been notified as an error yet
					if ( callback ) {
						throw e;
					}
				}
			},

			abort: function() {
				if ( callback ) {
					callback();
				}
			}
		};
	}
} );




// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
jQuery.ajaxPrefilter( function( s ) {
	if ( s.crossDomain ) {
		s.contents.script = false;
	}
} );

// Install script dataType
jQuery.ajaxSetup( {
	accepts: {
		script: "text/javascript, application/javascript, " +
			"application/ecmascript, application/x-ecmascript"
	},
	contents: {
		script: /\b(?:java|ecma)script\b/
	},
	converters: {
		"text script": function( text ) {
			jQuery.globalEval( text );
			return text;
		}
	}
} );

// Handle cache's special case and crossDomain
jQuery.ajaxPrefilter( "script", function( s ) {
	if ( s.cache === undefined ) {
		s.cache = false;
	}
	if ( s.crossDomain ) {
		s.type = "GET";
	}
} );

// Bind script tag hack transport
jQuery.ajaxTransport( "script", function( s ) {

	// This transport only deals with cross domain requests
	if ( s.crossDomain ) {
		var script, callback;
		return {
			send: function( _, complete ) {
				script = jQuery( "<script>" ).prop( {
					charset: s.scriptCharset,
					src: s.url
				} ).on(
					"load error",
					callback = function( evt ) {
						script.remove();
						callback = null;
						if ( evt ) {
							complete( evt.type === "error" ? 404 : 200, evt.type );
						}
					}
				);

				// Use native DOM manipulation to avoid our domManip AJAX trickery
				document.head.appendChild( script[ 0 ] );
			},
			abort: function() {
				if ( callback ) {
					callback();
				}
			}
		};
	}
} );




var oldCallbacks = [],
	rjsonp = /(=)\?(?=&|$)|\?\?/;

// Default jsonp settings
jQuery.ajaxSetup( {
	jsonp: "callback",
	jsonpCallback: function() {
		var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
		this[ callback ] = true;
		return callback;
	}
} );

// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {

	var callbackName, overwritten, responseContainer,
		jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
			"url" :
			typeof s.data === "string" &&
				( s.contentType || "" )
					.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
				rjsonp.test( s.data ) && "data"
		);

	// Handle iff the expected data type is "jsonp" or we have a parameter to set
	if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {

		// Get callback name, remembering preexisting value associated with it
		callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
			s.jsonpCallback() :
			s.jsonpCallback;

		// Insert callback into url or form data
		if ( jsonProp ) {
			s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
		} else if ( s.jsonp !== false ) {
			s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
		}

		// Use data converter to retrieve json after script execution
		s.converters[ "script json" ] = function() {
			if ( !responseContainer ) {
				jQuery.error( callbackName + " was not called" );
			}
			return responseContainer[ 0 ];
		};

		// Force json dataType
		s.dataTypes[ 0 ] = "json";

		// Install callback
		overwritten = window[ callbackName ];
		window[ callbackName ] = function() {
			responseContainer = arguments;
		};

		// Clean-up function (fires after converters)
		jqXHR.always( function() {

			// If previous value didn't exist - remove it
			if ( overwritten === undefined ) {
				jQuery( window ).removeProp( callbackName );

			// Otherwise restore preexisting value
			} else {
				window[ callbackName ] = overwritten;
			}

			// Save back as free
			if ( s[ callbackName ] ) {

				// Make sure that re-using the options doesn't screw things around
				s.jsonpCallback = originalSettings.jsonpCallback;

				// Save the callback name for future use
				oldCallbacks.push( callbackName );
			}

			// Call if it was a function and we have a response
			if ( responseContainer && jQuery.isFunction( overwritten ) ) {
				overwritten( responseContainer[ 0 ] );
			}

			responseContainer = overwritten = undefined;
		} );

		// Delegate to script
		return "script";
	}
} );




// Support: Safari 8 only
// In Safari 8 documents created via document.implementation.createHTMLDocument
// collapse sibling forms: the second one becomes a child of the first one.
// Because of that, this security measure has to be disabled in Safari 8.
// https://bugs.webkit.org/show_bug.cgi?id=137337
support.createHTMLDocument = ( function() {
	var body = document.implementation.createHTMLDocument( "" ).body;
	body.innerHTML = "<form></form><form></form>";
	return body.childNodes.length === 2;
} )();


// Argument "data" should be string of html
// context (optional): If specified, the fragment will be created in this context,
// defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) {
	if ( typeof data !== "string" ) {
		return [];
	}
	if ( typeof context === "boolean" ) {
		keepScripts = context;
		context = false;
	}

	var base, parsed, scripts;

	if ( !context ) {

		// Stop scripts or inline event handlers from being executed immediately
		// by using document.implementation
		if ( support.createHTMLDocument ) {
			context = document.implementation.createHTMLDocument( "" );

			// Set the base href for the created document
			// so any parsed elements with URLs
			// are based on the document's URL (gh-2965)
			base = context.createElement( "base" );
			base.href = document.location.href;
			context.head.appendChild( base );
		} else {
			context = document;
		}
	}

	parsed = rsingleTag.exec( data );
	scripts = !keepScripts && [];

	// Single tag
	if ( parsed ) {
		return [ context.createElement( parsed[ 1 ] ) ];
	}

	parsed = buildFragment( [ data ], context, scripts );

	if ( scripts && scripts.length ) {
		jQuery( scripts ).remove();
	}

	return jQuery.merge( [], parsed.childNodes );
};


/**
 * Load a url into a page
 */
jQuery.fn.load = function( url, params, callback ) {
	var selector, type, response,
		self = this,
		off = url.indexOf( " " );

	if ( off > -1 ) {
		selector = stripAndCollapse( url.slice( off ) );
		url = url.slice( 0, off );
	}

	// If it's a function
	if ( jQuery.isFunction( params ) ) {

		// We assume that it's the callback
		callback = params;
		params = undefined;

	// Otherwise, build a param string
	} else if ( params && typeof params === "object" ) {
		type = "POST";
	}

	// If we have elements to modify, make the request
	if ( self.length > 0 ) {
		jQuery.ajax( {
			url: url,

			// If "type" variable is undefined, then "GET" method will be used.
			// Make value of this field explicit since
			// user can override it through ajaxSetup method
			type: type || "GET",
			dataType: "html",
			data: params
		} ).done( function( responseText ) {

			// Save response for use in complete callback
			response = arguments;

			self.html( selector ?

				// If a selector was specified, locate the right elements in a dummy div
				// Exclude scripts to avoid IE 'Permission Denied' errors
				jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :

				// Otherwise use the full result
				responseText );

		// If the request succeeds, this function gets "data", "status", "jqXHR"
		// but they are ignored because response was set above.
		// If it fails, this function gets "jqXHR", "status", "error"
		} ).always( callback && function( jqXHR, status ) {
			self.each( function() {
				callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
			} );
		} );
	}

	return this;
};




// Attach a bunch of functions for handling common AJAX events
jQuery.each( [
	"ajaxStart",
	"ajaxStop",
	"ajaxComplete",
	"ajaxError",
	"ajaxSuccess",
	"ajaxSend"
], function( i, type ) {
	jQuery.fn[ type ] = function( fn ) {
		return this.on( type, fn );
	};
} );




jQuery.expr.pseudos.animated = function( elem ) {
	return jQuery.grep( jQuery.timers, function( fn ) {
		return elem === fn.elem;
	} ).length;
};




/**
 * Gets a window from an element
 */
function getWindow( elem ) {
	return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
}

jQuery.offset = {
	setOffset: function( elem, options, i ) {
		var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
			position = jQuery.css( elem, "position" ),
			curElem = jQuery( elem ),
			props = {};

		// Set position first, in-case top/left are set even on static elem
		if ( position === "static" ) {
			elem.style.position = "relative";
		}

		curOffset = curElem.offset();
		curCSSTop = jQuery.css( elem, "top" );
		curCSSLeft = jQuery.css( elem, "left" );
		calculatePosition = ( position === "absolute" || position === "fixed" ) &&
			( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;

		// Need to be able to calculate position if either
		// top or left is auto and position is either absolute or fixed
		if ( calculatePosition ) {
			curPosition = curElem.position();
			curTop = curPosition.top;
			curLeft = curPosition.left;

		} else {
			curTop = parseFloat( curCSSTop ) || 0;
			curLeft = parseFloat( curCSSLeft ) || 0;
		}

		if ( jQuery.isFunction( options ) ) {

			// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
			options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
		}

		if ( options.top != null ) {
			props.top = ( options.top - curOffset.top ) + curTop;
		}
		if ( options.left != null ) {
			props.left = ( options.left - curOffset.left ) + curLeft;
		}

		if ( "using" in options ) {
			options.using.call( elem, props );

		} else {
			curElem.css( props );
		}
	}
};

jQuery.fn.extend( {
	offset: function( options ) {

		// Preserve chaining for setter
		if ( arguments.length ) {
			return options === undefined ?
				this :
				this.each( function( i ) {
					jQuery.offset.setOffset( this, options, i );
				} );
		}

		var docElem, win, rect, doc,
			elem = this[ 0 ];

		if ( !elem ) {
			return;
		}

		// Support: IE <=11 only
		// Running getBoundingClientRect on a
		// disconnected node in IE throws an error
		if ( !elem.getClientRects().length ) {
			return { top: 0, left: 0 };
		}

		rect = elem.getBoundingClientRect();

		// Make sure element is not hidden (display: none)
		if ( rect.width || rect.height ) {
			doc = elem.ownerDocument;
			win = getWindow( doc );
			docElem = doc.documentElement;

			return {
				top: rect.top + win.pageYOffset - docElem.clientTop,
				left: rect.left + win.pageXOffset - docElem.clientLeft
			};
		}

		// Return zeros for disconnected and hidden elements (gh-2310)
		return rect;
	},

	position: function() {
		if ( !this[ 0 ] ) {
			return;
		}

		var offsetParent, offset,
			elem = this[ 0 ],
			parentOffset = { top: 0, left: 0 };

		// Fixed elements are offset from window (parentOffset = {top:0, left: 0},
		// because it is its only offset parent
		if ( jQuery.css( elem, "position" ) === "fixed" ) {

			// Assume getBoundingClientRect is there when computed position is fixed
			offset = elem.getBoundingClientRect();

		} else {

			// Get *real* offsetParent
			offsetParent = this.offsetParent();

			// Get correct offsets
			offset = this.offset();
			if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
				parentOffset = offsetParent.offset();
			}

			// Add offsetParent borders
			parentOffset = {
				top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
				left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
			};
		}

		// Subtract parent offsets and element margins
		return {
			top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
			left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
		};
	},

	// This method will return documentElement in the following cases:
	// 1) For the element inside the iframe without offsetParent, this method will return
	//    documentElement of the parent window
	// 2) For the hidden or detached element
	// 3) For body or html element, i.e. in case of the html node - it will return itself
	//
	// but those exceptions were never presented as a real life use-cases
	// and might be considered as more preferable results.
	//
	// This logic, however, is not guaranteed and can change at any point in the future
	offsetParent: function() {
		return this.map( function() {
			var offsetParent = this.offsetParent;

			while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
				offsetParent = offsetParent.offsetParent;
			}

			return offsetParent || documentElement;
		} );
	}
} );

// Create scrollLeft and scrollTop methods
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
	var top = "pageYOffset" === prop;

	jQuery.fn[ method ] = function( val ) {
		return access( this, function( elem, method, val ) {
			var win = getWindow( elem );

			if ( val === undefined ) {
				return win ? win[ prop ] : elem[ method ];
			}

			if ( win ) {
				win.scrollTo(
					!top ? val : win.pageXOffset,
					top ? val : win.pageYOffset
				);

			} else {
				elem[ method ] = val;
			}
		}, method, val, arguments.length );
	};
} );

// Support: Safari <=7 - 9.1, Chrome <=37 - 49
// Add the top/left cssHooks using jQuery.fn.position
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
// getComputedStyle returns percent when specified for top/left/bottom/right;
// rather than make the css module depend on the offset module, just check for it here
jQuery.each( [ "top", "left" ], function( i, prop ) {
	jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
		function( elem, computed ) {
			if ( computed ) {
				computed = curCSS( elem, prop );

				// If curCSS returns percentage, fallback to offset
				return rnumnonpx.test( computed ) ?
					jQuery( elem ).position()[ prop ] + "px" :
					computed;
			}
		}
	);
} );


// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
	jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
		function( defaultExtra, funcName ) {

		// Margin is only for outerHeight, outerWidth
		jQuery.fn[ funcName ] = function( margin, value ) {
			var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
				extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );

			return access( this, function( elem, type, value ) {
				var doc;

				if ( jQuery.isWindow( elem ) ) {

					// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
					return funcName.indexOf( "outer" ) === 0 ?
						elem[ "inner" + name ] :
						elem.document.documentElement[ "client" + name ];
				}

				// Get document width or height
				if ( elem.nodeType === 9 ) {
					doc = elem.documentElement;

					// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
					// whichever is greatest
					return Math.max(
						elem.body[ "scroll" + name ], doc[ "scroll" + name ],
						elem.body[ "offset" + name ], doc[ "offset" + name ],
						doc[ "client" + name ]
					);
				}

				return value === undefined ?

					// Get width or height on the element, requesting but not forcing parseFloat
					jQuery.css( elem, type, extra ) :

					// Set width or height on the element
					jQuery.style( elem, type, value, extra );
			}, type, chainable ? margin : undefined, chainable );
		};
	} );
} );


jQuery.fn.extend( {

	bind: function( types, data, fn ) {
		return this.on( types, null, data, fn );
	},
	unbind: function( types, fn ) {
		return this.off( types, null, fn );
	},

	delegate: function( selector, types, data, fn ) {
		return this.on( types, selector, data, fn );
	},
	undelegate: function( selector, types, fn ) {

		// ( namespace ) or ( selector, types [, fn] )
		return arguments.length === 1 ?
			this.off( selector, "**" ) :
			this.off( types, selector || "**", fn );
	}
} );

jQuery.parseJSON = JSON.parse;




// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via a proper concatenation script that
// understands anonymous AMD modules. A named AMD is safest and most robust
// way to register. Lowercase jquery is used because AMD module names are
// derived from file names, and jQuery is normally delivered in a lowercase
// file name. Do this after creating the global so that if an AMD module wants
// to call noConflict to hide this version of jQuery, it will work.

// Note that for maximum portability, libraries that are not jQuery should
// declare themselves as anonymous modules, and avoid setting a global if an
// AMD loader is present. jQuery is a special case. For more information, see
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon

if ( typeof define === "function" && define.amd ) {
	define( "jquery", [], function() {
		return jQuery;
	} );
}




var

	// Map over jQuery in case of overwrite
	_jQuery = window.jQuery,

	// Map over the $ in case of overwrite
	_$ = window.$;

jQuery.noConflict = function( deep ) {
	if ( window.$ === jQuery ) {
		window.$ = _$;
	}

	if ( deep && window.jQuery === jQuery ) {
		window.jQuery = _jQuery;
	}

	return jQuery;
};

// Expose jQuery and $ identifiers, even in AMD
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566)
if ( !noGlobal ) {
	window.jQuery = window.$ = jQuery;
}





return jQuery;
} );
;
(function () {
    'use strict';

    var isTouch;
    var deps = [];
    var isBanker = false;

    var divTouch = document.getElementById('divIsTouch');

    if (typeof (divTouch) != 'undefined' && divTouch != null) {
        isTouch = ((document.getElementById('divIsTouch').innerText || document.getElementById('divIsTouch').textContent) === 'True');
    }
    else // for mobile this div element is undefined
        isTouch = true;

    if (!isTouch) {

        var hddisBankerFromMaster = document.getElementById('isBankerFromMaster').value;
        if (typeof (hddisBankerFromMaster) != 'undefined' && hddisBankerFromMaster != null) {
            isBanker = document.getElementById('isBankerFromMaster').value;
        }

        if (isBanker == 'False') {
            deps = ['IdleTimeoutModule', 'GSSModule'];
        }
        else {
            deps = ['IdleTimeoutModule'];
        }
    }

    angular.module("CommonModule", deps)
        .config(['$compileProvider', '$logProvider', '$provide', function ($compileProvider, $logProvider, $provide) {
            /*--Fix for IE8 Trim--*/
            if (typeof String.prototype.trim !== 'function') {
                String.prototype.trim = function () {
                    return this.replace(/^\s+|\s+$/g, '');
                };
            }

            var pageModeValue;
            if (document.getElementById('hiddPageMode') != null)
                pageModeValue = document.getElementById('hiddPageMode').value;

            if (pageModeValue !== undefined) {

                //To Disable debug data on production mode - Angular 1.3 performance improvements
                //If wish to debug on Production mode add angular.reloadWithDebugInfo() on console window to enable debug mdoe
                if (pageModeValue.toLowerCase() === 'prod' || pageModeValue.toLowerCase() === 'uat' || pageModeValue.toLowerCase() === 'it') {
                    $compileProvider.debugInfoEnabled(false); // default is true
                    $logProvider.debugEnabled(false);
                    //Logging
                    $provide.decorator('$log', ['$delegate', function ($delegate) {
                        //Original methods
                        var origInfo = $delegate.info;
                        var origLog = $delegate.log;

                        //Override the default Info behavior
                        $delegate.info = function () {

                            if ($logProvider.debugEnabled())
                                origInfo.apply(null, arguments);
                        };

                        //Override the default log behavior    
                        $delegate.log = function () {

                            if ($logProvider.debugEnabled())
                                origLog.apply(null, arguments);
                        };

                        return $delegate;
                    }]);

                } else {
                    $compileProvider.debugInfoEnabled(true); // default is true
                    $logProvider.debugEnabled(true);

                    $provide.decorator('$log', ['$delegate', function ($delegate) {
                        var originals = {};
                        var methods = ['info', 'debug', 'warn', 'error'];

                        angular.forEach(methods, function (method) {
                            originals[method] = $delegate[method];
                            $delegate[method] = function () {
                                var timestamp = new Date().toString().substring(4, 24);

                                var args = [].slice.call(arguments);

                                if (method == 'error') {
                                    args[0] = [timestamp, ': ', 'Cleint Side Exception Occured,Details are below:', '\n'
                                        , args[0].stack].join('');
                                }
                                else {
                                    args[0] = [timestamp, ': ', args[0]].join('');
                                }

                                setTimeout(function () {
                                    originals[method].apply(null, args);
                                }, 500);
                            };
                        });

                        return $delegate;
                    }]);
                }

                //Exception Handling
                $provide.decorator("$exceptionHandler", ['$delegate', '$injector', function ($delegate, $injector) {
                    return function (exception, message) {
                        // vxchan3 - Prod Mode Logic temporarily commented out, Instead of logging Client exception 
                        //into Web server file system planning to log details into CCLogging.
                        if (pageModeValue.toLowerCase() === 'prod') {
                            //var $http = $injector.get("$http");

                            //var exceptionObject = {
                            //    "Exception": exception.message + "\n" + exception.stack,
                            //    "Message": message
                            //};

                            //var serviceUrl; var rootUrlLaunchRequest = ""; var aftokenValue = "";
                            //if (isTouch) {
                            //    if (document.getElementById('divRootOmniSiteUrlFromLayout') != null) {
                            //        rootUrlLaunchRequest = document.getElementById('divRootOmniSiteUrlFromLayout').innerText
                            //        || document.getElementById('divRootOmniSiteUrlFromLayout').textContent;
                            //    }
                            //    var mobileBaseUrl = document.getElementById('BaseUrlOmni').getAttribute("appbaseurl");
                            //    if (OmniDataUtil.getOmniData('MBLAfToken') != null) {
                            //        aftokenValue = "af(" + OmniDataUtil.getOmniData('MBLAfToken') + ")";
                            //    }
                            //    serviceUrl = mobileBaseUrl + rootUrlLaunchRequest + aftokenValue !== "" ? aftokenValue + "/" : '';
                            //}
                            //else {
                            //    serviceUrl = document.getElementById('divRootUrl').value;
                            //}

                            //serviceUrl = serviceUrl + "ClientException/ClientExceptionLog";
                            ////Fire and Forget Mechanism.
                            //$http({
                            //    method: 'POST',
                            //    url: serviceUrl,
                            //    data: exceptionObject
                            //});


                        }
                        else {
                            $delegate(exception, message);
                        }
                    };
                }]);
            };
            //$stateProvider.state("SystemDown", {
            //    url: "/SystemDown",
            //    templateUrl: function () {
            //        return 'systemDown/templates/systemDownPage.html';
            //    },
            //    controller: "SystemDownViewController",
            //    controllerAs: "vm"
            //});
        }])
        .run(['CommonService', '$http', '$templateCache', function (commonService, $http, $templateCache) {

            $templateCache.put('systemDown/templates/systemDownPage.html', [
                '<div class="col-sm-12 col-xs-12 txt-center"><div class="systemdown_bg margintb-30px" role="img" aria-label="map image"></div><p class="font-bold">There’s a problem on our end</p><p>It shouldn’t last long, so please try again shortly.</p><button class="svc-btn-secondary margintb-30px btn-back-err" ng-click="vm.goBack();alert(1);">Go Back</button></div>'
            ].join(''));
            var rootUrl;

            if (document.getElementById('divRootOmniSiteUrlFromLayout') != null)
                rootUrl = document.getElementById('divRootOmniSiteUrlFromLayout').innerText || document.getElementById('divRootOmniSiteUrlFromLayout').textContent;

            var appName;
            if (document.getElementById('hiddAppName') != null)
                appName = document.getElementById('hiddAppName').value;

            var deviceName;
            if (document.getElementById('hiddUXName') != null)
                deviceName = document.getElementById('hiddUXName').value;

            var pageMode;
            if (document.getElementById('hiddPageMode') != null)
                pageMode = document.getElementById('hiddPageMode').value;

            var isBankerValue;
            if (document.getElementById('isBankerFromMaster') != null)
                isBankerValue = document.getElementById('isBankerFromMaster').value.toLowerCase();

            commonService.setIsBankerFromMaster(isBankerValue);
            var prefix = "";
            if (appName != undefined) {
                if (appName.toLowerCase() == "mbl") {
                    prefix = "USBank_Mobile_" + deviceName + "_";
                    if (pageMode.toLowerCase() == "it" || pageMode.toLowerCase() == "uat") {
                        prefix = "Test_USBank_Mobile_" + deviceName + "_";
                    }
                } else if (appName.toLowerCase() == "fusion") {
                    prefix = "USBank_OLB_FUSION_";
                } else if (appName.toLowerCase() == "orion") {
                    prefix = "USBank_OLB_ORION_";
                } else if (appName.toLowerCase() == "olb") {
                    prefix = "USBank_OLB_";
                }
            }
            if (document.getElementById("hiddMboxPrefix") != null)
                document.getElementById("hiddMboxPrefix").value = prefix;

            if (commonService.getIsTouch() === "True") {
                if (document.getElementById('isMobilePacakging') != null) {
                    if (document.getElementById('isMobilePacakging').value.toLowerCase() === 'false') {
                        var rootUrlLaunchRequest = document.getElementById('divRootOmniSiteUrlFromLayout').innerText || document.getElementById('divRootOmniSiteUrlFromLayout').textContent;
                        var serviceUrl = rootUrlLaunchRequest + "LaunchRequest/GetLaunchRequest";
                        var data = {};
                        $http({
                            method: 'POST',
                            url: serviceUrl,
                            data: data
                        }).success(function (launchRequest) {
                            commonService.setMobileLaunchRequest(launchRequest);
                        }).error(function () {
                            //Include logic for error scenario
                        });
                    }
                }
            }

        }]);
})();
;
(function () {
    'use strict';

    angular
        .module('CommonModule')
        .config([
            '$httpProvider',
            function ($httpProvider) {
                var interceptor = ['dtxhrTracer',
                    function (dtxhrTracer) {
                        var service = {
                            'request': function (config) {
                                if (config && config.headers && config.headers['OmniKYCDeepLinkFunctionId'] &&
                                    (config.headers['OmniKYCDeepLinkFunctionId'] == "103" || config.headers['OmniKYCDeepLinkFunctionId'] == "104")) {
                                    return config;
                                }
                                dtxhrTracer.enterXhr(config.url);
                                return config;

                            },
                            'response': function (response) {
                                dtxhrTracer.leaveXhr(response.config.url);
                                return response;
                            },
                            'responseError': function (rejection) {
                                dtxhrTracer.leaveXhr(rejection.config.url);
                                return rejection;
                            }

                        };
                        return service;
                    }
                ];
                $httpProvider.interceptors.push(interceptor);
            }
        ]).factory('dtxhrTracer', function () {

            var xhrHistList = [];
            var stripTimeStamp = function (str) {
                return str.split("?_=")[0];
            };
            var enterXhrAct = function (url) {
                var xhrHist = {
                    xhrAction: {},
                    url: ""
                };
                try {

                    if (typeof window.dT_ != 'undefined') {
                        xhrHist.url = url;
                        xhrHist.xhrAction = dynaTrace.enterXhrAction(url);
                        xhrHistList.push(xhrHist);
                    }
                } catch (e) { console.log("enterXHR exception : " + e); }
            };
            var leaveXhrAct = function (url) {
                for (var i = 0; i < xhrHistList.length; i++) {
                    if (xhrHistList[i].url == stripTimeStamp(url)) {
                        try {
                            if (typeof window.dT_ != 'undefined') {
                                dynaTrace.leaveXhrAction(xhrHistList[i].xhrAction);
                            }
                        } catch (e) { console.log("leaveXHR exception : " + e); }

                        xhrHistList.splice(i, 1);
                        break;
                    }
                }
            };
            return {
                enterXhr: enterXhrAct,
                leaveXhr: leaveXhrAct
            };

        }).factory('CommonService', [
            '$http', '$modal', 'CommonConstants', '$window', '$injector', function ($http, $modal, commonConstants, $window, $injector) {
                var mobileLaunchRequest;
                var isTouchValue;
                var isBankerFromMaster;
                var cmsdirectiveurl;
                var Idle;
                var commonolmmrturl;
                var stepUpToken;
                var otpToken;
                var countrylist;
                var statelist;
                var idshield_image_details = {
                    categoryid: "",
                    categoryname: "",
                    imageid: "",
                    phrasetxt: "",
                    imageurl: ""
                };
                var idshield_security_questions = [];
                var relatedCustomer = {};
                var commonWebViewData = {};
                return {

                    getCommonWebViewData: function () {
                        return commonWebViewData;
                    },
                    setCommonWebViewData: function (value) {
                        commonWebViewData = value;
                    },
                    getIdShiledImageDetails: function () {
                        return idshield_image_details;
                    },

                    setIdShiledImageDetails: function (value) {
                        idshield_image_details.categoryid = value.categoryid;
                        idshield_image_details.imageid = value.imageid;
                        idshield_image_details.phrasetxt = value.phrasetxt;
                        idshield_image_details.imageurl = value.imageurl;
                        idshield_image_details.categoryname = value.categoryname;
                    },
                    getIdShieldSecurityQuestions: function () {
                        return idshield_security_questions;
                    },

                    resetIdShieldSecurityQuestions: function () {
                        idshield_security_questions = [];
                    },

                    setIdShieldSecurityQuestions: function (IdShieldvalues) {
                        angular.forEach(IdShieldvalues, function (value, index) {
                            var idshield_security_question = {
                                questionsId: value.questionsId,
                                questionstext: value.questionstext,
                                answertext: value.answertext,
                                answerformat: value.answerformat,
                                isselected: value.isselected,
                                isinvalid: value.isinvalid
                            };
                            idshield_security_questions.push(idshield_security_question);
                        });
                    },
                    resetIdShiledImageDetails: function () {
                        idshield_image_details.categoryid = "";
                        idshield_image_details.imageid = "";
                        idshield_image_details.phrasetxt = "";
                        idshield_image_details.imageurl = "";
                        idshield_image_details.categoryname = "";
                    },

                    getCountrylist: function () {
                        return countrylist;
                    },
                    setCountrylist: function (value) {
                        countrylist = value;
                    },
                    getStatelist: function () {
                        return countrylist;
                    },
                    setRelatedCustomer: function (data) {
                        relatedCustomer = data;
                    },
                    getRelatedCustomer: function () {
                        return relatedCustomer;
                    },
                    redirectToSelfServiceDashboard: function (constantValue) {
                        if (this.getIsTouch() === "True") {
                            OmniDataUtil.setOmniData("omniPageName", "");
                            this.destroyOmniScope();
                            window.location.href = constantValue;
                        } else {
                            window.location.href = window.location.origin + "/USB/" + window.location.pathname.split('/')[2] + "/SelfServiceDashboard/SelfServiceDashboardIndex";
                        }
                    },
                    formatHTMLEntityText: function (cardName) {
                        var htmlEntities = {
                            nbsp: ' ',
                            cent: 'Â¢',
                            pound: 'Â£',
                            yen: 'Â¥',
                            euro: 'â‚¬',
                            copy: 'Â©',
                            reg: 'Â®',
                            lt: '<',
                            gt: '>',
                            quot: '"',
                            amp: '&',
                            apos: '\''
                        };

                        function unescapeHTML(str) {
                            return str.replace(/\&([^;]+);/g, function (entity, entityCode) {
                                var match;

                                if (entityCode in htmlEntities) {
                                    return htmlEntities[entityCode];
                                    /*eslint no-cond-assign: 0*/
                                } else if (match = entityCode.match(/^#x([\da-fA-F]+)$/)) {
                                    return String.fromCharCode(parseInt(match[1], 16));
                                    /*eslint no-cond-assign: 0*/
                                } else if (match = entityCode.match(/^#(\d+)$/)) {
                                    return String.fromCharCode(~~match[1]);
                                } else {
                                    return entity;
                                }
                            });
                        };
                        var disPlayName = unescapeHTML(cardName);
                        return disPlayName;
                    },
                    //commonService.setStateslist(countryCode); to set data from any other file
                    //commonService.getStatelist(); to get data from any other file
                    setStateslist: function (value) {
                        statelist = [];
                        var States = countrylist.filter(function (country) {
                            if (country.CountryIsoCode == value) {
                                return country;
                            }
                        })[0];
                        $scope.StateList = [];
                        vm.CustomerSearchRequestVm.State = "";
                        vm.CustomerSearchRequestVm.Country = "";
                        if (States) {
                            $scope.hasStates = States.HasState;

                            angular.forEach(States.StateList, function (stat, index) {
                                var state = {};
                                state.StateName = stat.Value;
                                state.StateIsoCode = stat.Key;
                                state.Id = index;
                                statelist.push(state);
                            });


                        }
                    },
                    getCommonOlmmRootUrl: function () {
                        return commonolmmrturl;
                    },
                    setCommonOlmmRootUrl: function (value) {
                        commonolmmrturl = value;
                    },

                    setStepUpToken: function (value) {
                        stepUpToken = value;
                    },
                    setOTPToken: function (value) {
                        otpToken = value;
                    },

                    result: function (method, url, inputData, headerData) {
                        if ((this.getIsTouch() === "False")) {
                            if (Idle === undefined) {
                                Idle = $injector.get('Idle');
                            }
                            Idle.watch();
                        }
                        if (!angular.isDefined(headerData))
                            headerData = {};

                        if (stepUpToken)
                            headerData[commonConstants.STEPUP_HEADER] = stepUpToken;

                        if (otpToken)
                            headerData[commonConstants.OTP_HEADER] = otpToken;

                        headerData["X-Requested-With"] = "XMLHttpRequest";

                        return $http({
                            method: method,
                            url: url,
                            data: inputData,
                            headers: headerData
                        });
                    },
                    getcmsDirectiveUrl: function () {
                        return cmsdirectiveurl;
                    },
                    setcmsDirectiveUrl: function (value) {
                        if (typeof (value) != 'undefined' && value != null) {
                            cmsdirectiveurl = value;
                        }
                        else {
                            cmsdirectiveurl = this.getAppRootUrl();
                        }
                    },
                    getAppRootUrl: function () {
                        var rootUrl = document.querySelector(commonConstants.ROOT_URL_DIV_TEXT).textContent
                            || document.querySelector(commonConstants.ROOT_URL_DIV_TEXT).innerText;
                        return rootUrl;
                    },
                    routeToError: function () {
                        var rootUrl = document.getElementById('divRootUrl').value;
                        window.location = rootUrl + 'BaseError/ErrorPage';
                    },
                    popupControllerAs: function (animation, templateUrl, modalInstanceController, controllerAsName, modalObj, modalObjData, backdrop, keyboard, size) {
                        return $modal.open({
                            animation: animation,
                            templateUrl: templateUrl,
                            controllerAs: controllerAsName,
                            controller: modalInstanceController,
                            backdrop: backdrop,
                            keyboard: keyboard,
                            size: size,
                            resolve: {
                                feesdata: function () {
                                    return modalObjData;
                                },
                                items: function () {
                                    return modalObjData;
                                }
                            }
                        });
                    },
                    getIsTouch: function () {
                        var isTouch = '';
                        var divTouch = document.getElementById('divIsTouch');

                        if (typeof (divTouch) != 'undefined' && divTouch != null) {
                            isTouch = (document.getElementById('divIsTouch').innerText || document.getElementById('divIsTouch').textContent);
                        }

                        return isTouch;
                    },
                    setIsTouch: function (value) {
                        isTouchValue = value;
                    },

                    getMobileLaunchRequest: function () {
                        return mobileLaunchRequest;
                    },
                    setMobileLaunchRequest: function (value) {
                        mobileLaunchRequest = value;
                    },

                    getIsBankerFromMaster: function () {
                        return isBankerFromMaster;
                    },
                    setIsBankerFromMaster: function (value) {
                        isBankerFromMaster = value;
                    },
                    bankerSignOff: function () {
                        var url = "";
                        var rootUrl = document.querySelector(commonConstants.ROOT_URL_DIV_TEXT).textContent || document.querySelector(commonConstants.ROOT_URL_DIV_TEXT).innerText;
                        var method = commonConstants.METHOD_TYPE_POST;

                        if (document.getElementById('newKycSignOnCall') != null) {

                            var newKycSignOnFlag = document.getElementById('newKycSignOnCall').value;

                            if (newKycSignOnFlag == "newKycSignOn")
                                url = rootUrl + "NewKycTimeout/NewSignOff";
                        } else
                            url = rootUrl + commonConstants.VOYAGERSIGNOFFURL;

                        var headerData = commonConstants.HEADERDATA;
                        this.result(method, url, null, headerData)
                            .success(function (result) {
                                if (result) {
                                    //if (result && result.toLowerCase() === commonConstants.TRUE) {
                                    //    // no logic for now. can add logic in future.
                                    //} else {
                                    //    // no logic for now. can add logic in future.
                                    //}
                                }
                            }).error(function () {

                            });
                        if (rootUrl && rootUrl.length > 2 && rootUrl.slice(1, 3) == "CM") {
                            url = rootUrl + 'BankerLogout/Index';
                            window.location = url;
                        }
                        else if (document.getElementById('hiddAppName') != undefined &&
                            document.getElementById('hiddAppName') != null &&
                            document.getElementById('hiddAppName').value.toLowerCase() === "omnitool") {
                            url = '/OLS/SharedAccessBanker/FindCustomer';
                            window.location = url;
                        }
                        else {
                            $window.open('', '_self', '');
                            $window.close();
                        }
                    },
                    RedirectToCCAPWEB: function (formAttrVal, functionName, params, openInNewWindow, isBrokerageCall, isTrustCall) {
                        var Loader = OmniDataUtil.getOmniData("Loader");
                        if (functionName !== "ReportLostStolen" && functionName !== "CardLockUnlock") {
                            event.stopPropagation();
                        }
                        $("#header_sendmoneyomni").hide();
                        if (Loader) {
                            Loader.showLoader();
                        }
                        $('.iframeholder').html('');
                        $('.iframeholder')
                            .append(
                                '<iframe id="cmsiframecontent" width="100%" height="100%" border="0" scrolling="yes" horizontalscrolling="no" verticalscrolling="yes" allowTransparency="true" style="background-color:white" sandbox="allow-top-navigation"> </iframe>');
                        var frmCCAPUrl = '';
                        for (var j = 0; j < formAttrVal.length; j++) { // fix me
                            if (formAttrVal[j].name == 'CCAPUrl') {
                                frmCCAPUrl = formAttrVal[j].value;
                                break;
                            }
                        }
                        $('.modaloverlay.iframe').removeClass('closer');
                        $('.iframe-down').hide();
                        $('#cmsiframecontent').attr('target', '_self');
                        $("#overlaycontent-cmscontentinscreen").css("display", "block");
                        $("#BaseUrlOmni").css("display", "none");
                        $(".close-icon .close-i").css("display", "none");
                        // Loader.showLoader();
                        var myForm = document.createElement('form');
                        myForm.method = "post";
                        myForm.name = "SSOFORM";
                        myForm.target = '_self';
                        myForm.id = 'SSOFORM';
                        myForm.action = frmCCAPUrl;
                        var myInput = '';

                        for (var f = 0; f < formAttrVal.length; f++) {
                            myInput = document.createElement('input');
                            myInput.setAttribute('type', 'hidden');
                            myInput.setAttribute('name', formAttrVal[f].name);
                            myInput.setAttribute('value', formAttrVal[f].value);
                            myForm.appendChild(myInput);
                        }

                        myForm.appendChild(myInput);
                        var iframeId = $('#cmsiframecontent').contents().find('body');
                        iframeId.html(myForm);
                        console.log('>>>>>>>' + iframeId.find('form#SSOFORM').length);
                        myForm.submit();
                        $("#cmsiframecontent").load(function () {
                            Loader.hideLoader();
                            var deviceHeight = $(window).height();
                            $('#cmsiframecontent').css("height", "auto");
                            var contentHeight = $('#cmsiframecontent').height();
                            if (contentHeight < deviceHeight)
                                contentHeight = deviceHeight;
                            $('#cmsiframecontent').css({
                                'min-height': contentHeight,
                                'backgroundColor': 'transparent'
                            });
                            var frmNameX = document.getElementById('cmsiframecontent');
                            var frmWin = frmNameX.contentWindow;
                            var frmWinObjY = frmWin.document;
                            var frmUrl = frmWinObjY.location.href;
                            if (frmUrl.match(/MyProfile/g) != null) {
                                OmniDataUtil.setOmniData("isMyProfile", "true");
                            }
                            $(".iframeholder").css({ "height": contentHeight, "background-color": "#0c2074" });
                            $("#overlaycontent-cmscontentinscreen").css("padding-top", 0);

                            /* Closing the iframe */
                            switch (functionName) {
                                case 'MyProfile':
                                    if (frmUrl.match(/return.asp/g) != null) {
                                        $("#BaseUrlOmni").css("display", "block");
                                        $("#overlaycontent-cmscontentinscreen").css("display", "none");
                                        OmniDataUtil.setOmniData("isFromMyProfile", "true");
                                        $("#header_sendmoneyomni").show();
                                        var flag = OmniDataUtil.getOmniData("isMyProfile");
                                        if (flag == "true") {
                                            OmniDataUtil.setOmniData("isMyProfile", "false");
                                            var isFromUpdateRegister = OmniDataUtil.getOmniData("selectedTransactionType");
                                            var $state = $injector.get('$state');

                                            if (isFromUpdateRegister == "updateregister")
                                                $state.go('UpdateRegister');
                                            else
                                                $state.go('EnrollToken');
                                        }
                                    }
                                    break;

                            }
                        });


                    },

                    RedirectToOLBCCAPWEB: function (ccapUrls, functionName, parameters, openInNewWindow) {
                        var form = document.createElement("form");
                        var functionToCall = functionName;
                        var ccaPurl = ccapUrls.ccapUrl;
                        var returnUrl = ccapUrls.returnUrl;
                        var keepAlive = ccapUrls.keepAliveUrl;
                        var logoutUrl = ccapUrls.logoutUrl;
                        var timeout = "450";
                        var selectedToken = parameters.selectedToken;

                        form.setAttribute("method", "Post");
                        form.setAttribute("action", ccaPurl);

                        var hdFunctionName = document.createElement("input");
                        hdFunctionName.setAttribute("type", "hidden");
                        hdFunctionName.setAttribute("name", "functionname");//TODO - Change to functionname once mobile testing is done
                        hdFunctionName.setAttribute("value", functionToCall);

                        var hdReturnurl = document.createElement("input");
                        hdReturnurl.setAttribute("type", "hidden");
                        hdReturnurl.setAttribute("name", "ReturnUrl");
                        hdReturnurl.setAttribute("value", returnUrl);

                        var hdKeepaliveurl = document.createElement("input");
                        hdKeepaliveurl.setAttribute("type", "hidden");
                        hdKeepaliveurl.setAttribute("name", "KeepAliveUrl");
                        hdKeepaliveurl.setAttribute("value", keepAlive);

                        var hdTimeout = document.createElement("input");
                        hdTimeout.setAttribute("type", "hidden");
                        hdTimeout.setAttribute("name", "Timeout");
                        hdTimeout.setAttribute("value", timeout);

                        var hdLogouturl = document.createElement("input");
                        hdLogouturl.setAttribute("type", "hidden");
                        hdLogouturl.setAttribute("name", "LogoutUrl");
                        hdLogouturl.setAttribute("value", logoutUrl);

                        var hdSelectedToken = document.createElement("input");
                        hdSelectedToken.setAttribute("type", "hidden");
                        hdSelectedToken.setAttribute("name", "SelectedToken");
                        hdSelectedToken.setAttribute("value", selectedToken);

                        form.appendChild(hdFunctionName);
                        form.appendChild(hdReturnurl);
                        form.appendChild(hdKeepaliveurl);
                        form.appendChild(hdTimeout);
                        form.appendChild(hdLogouturl);
                        form.appendChild(hdSelectedToken);

                        if (openInNewWindow != undefined && openInNewWindow === true)
                            form.target = "_blank";
                        document.body.appendChild(form);
                        form.submit();
                        document.body.removeChild(form);
                    },

                    navigateBackToMobileReturnUrl: function (returnUrl, elementId) {
                        if (!returnUrl)
                            returnUrl = document.getElementById(elementId).value;
                        var form = document.createElement("form");
                        form.setAttribute("action", returnUrl);
                        form.setAttribute("method", "Get");
                        document.body.appendChild(form);
                        form.submit();
                        document.body.removeChild(form);
                    },

                    //Destroy the angular scope when leaves from Omni Page
                    destroyOmniScope: function () {
                        OmniDataUtil.setOmniData("leaveOmni", "true");
                        OmniDataUtil.setOmniData("omniPageName", "");
                        if (OmniDataUtil.getOmniData('commonServiceObj') != null || OmniDataUtil.getOmniData('commonServiceObj') != undefined) {
                            OmniDataUtil.delOmniData('commonServiceObj');
                        }

                        var mainContentParent = document.getElementById('divOmniActivityContainer');
                        if (mainContentParent != null || mainContentParent != undefined) {
                            var mainContentChild = document.getElementById('divOmniActivitySection');

                            var $rootScope = $injector.get('$rootScope');

                            var scope = $rootScope.$$childHead;
                            while (scope) {
                                var nextScope = scope.$$nextSibling;
                                scope.$destroy();
                                scope = nextScope;
                            }

                            for (var prop in $rootScope) {
                                if (($rootScope[prop])
                                    && (prop.indexOf('$$') != 0)
                                    && (typeof ($rootScope[prop]) === 'object')
                                ) {
                                    $rootScope[prop] = null;
                                }
                            }
                            $rootScope.$destroy();
                            mainContentParent.removeChild(mainContentChild);
                        }
                    },
                    getTransmitUrl: function () {
                        var url = '';
                        if ((this.getIsTouch() === "False")) {
                            var divUrl = document.getElementById('divTransmitUrl');

                            if (typeof (divUrl) != 'undefined' && divUrl != null) {
                                url = (document.getElementById('divTransmitUrl').innerText || document.getElementById('divTransmitUrl').textContent);
                            }
                        }
                        return url;
                    },
                    getTransmitEasUrl: function () {
                        var url = '';
                        var divUrl = document.getElementById('divTransmitEasUrl');

                        if (typeof (divUrl) != 'undefined' && divUrl != null) {
                            url = (document.getElementById('divTransmitEasUrl').innerText || document.getElementById('divTransmitEasUrl').textContent);
                        }
                        return url;
                    },
                    getTransmitAppId: function () {
                        var appID = '';
                        var divAppID = document.getElementById('divTransmitApp');

                        if (typeof (divAppID) != 'undefined' && divAppID != null) {
                            appID = (document.getElementById('divTransmitApp').innerText || document.getElementById('divTransmitApp').textContent);
                        }
                        return appID;
                    },
                    getUserId: function () {
                        var userId = '';
                        var divUserId = document.getElementById('divUserId');

                        if (typeof (divUserId) != 'undefined' && divUserId != null) {
                            userId = (document.getElementById('divUserId').innerText || document.getElementById('divUserId').textContent);
                        }
                        return userId;
                    },
                    IsSharedAuthEnabled: function () {
                        var sharedAuthEnabled = false;
                        if ((this.getIsTouch() === "False")) {
                            var divSharedAuthEnabled = document.getElementById('divEnableSharedAuth');

                            if (typeof (divSharedAuthEnabled) != 'undefined' && divSharedAuthEnabled != null) {
                                sharedAuthEnabled = (document.getElementById('divEnableSharedAuth').innerText || document.getElementById('divUserId').textContent) === "True";
                            }
                        }
                        else if (typeof (OmniDataUtil) != 'undefined') {
                            sharedAuthEnabled = OmniDataUtil.getOmniData("EnableSharedAuth");
                        }
                        return sharedAuthEnabled;
                    },
                    showPlaceHolderStepup: function (policy, transactionid, successHandler, failureHandler) {

                        var userId = this.getUserId();
                        var appID = this.getTransmitAppId();

                        var params = {};
                        params.defaultauth = "idshield";
                        params.resumePlaceHolder = successHandler;
                        params.failed = failureHandler;
                        params.TransmitURL = this.getTransmitUrl();
                        params.username = userId;
                        params.TransmitAppID = appID;
                        params.TransmitPolicy = policy;
                        params.TransactionID = transactionid;
                        params.IDShieldBaseURL = this.getTransmitEasUrl();

                        angular.element(document.getElementById('sharedAuthID')).scope().showPlaceHolder(params);

                    },
                    showSharedAuthStepup: function (policy, transactionid, successHandler, failureHandler, additionalParams, cancelHandler) {
                        var transmitUtil = null;

                        if ((this.getIsTouch() === "True") && typeof (OmniDataUtil) != 'undefined') {
                            transmitUtil = OmniDataUtil.getOmniData("TransmitUtil");
                        }
                        //If TransmitUtil is supported
                        if (transmitUtil) {
                            transmitUtil.stepUPAuthentication(policy, transmitUtil.loginStatus.CHANGEAUTH_DEPOSITACCOUNT, successHandler, failureHandler, cancelHandler, additionalParams);
                        }
                        else {
                            var userId = this.getUserId();
                            var appID = this.getTransmitAppId();
                            var params = {};
                            params.success = successHandler;
                            params.failed = failureHandler;
                            params.TransmitURL = this.getTransmitUrl();
                            params.username = userId;
                            params.TransmitAppID = appID;
                            params.TransmitPolicy = policy;
                            params.TransactionID = transactionid;
                            params.IDShieldBaseURL = this.getTransmitEasUrl();
                            if (additionalParams) {
                                params.additionalParams = additionalParams;
                            }

                            angular.element(document.getElementById('sharedAuthID')).scope().showServiceModal(params);
                        }
                        return true;

                    },
                    //Redesign screen for IOS
                    setScreenSizeForIos: function () {
                        var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
                        var aspect = window.screen.width / window.screen.height;
                        if (iOS && aspect < 0.47) {
                            var body = document.getElementsByTagName("BODY")[0];
                            body.classList.add('usb_screenforios_overdriven');
                        }
                    },
                    //get the cookie from the name specified
                    getCookie: function (cname) {
                        var name = cname + "=";
                        var decodedCookie = decodeURIComponent(document.cookie);
                        var ca = decodedCookie.split(';');
                        for (var i = 0; i < ca.length; i++) {
                            var c = ca[i];
                            while (c.charAt(0) == ' ') {
                                c = c.substring(1);
                            }
                            if (c.indexOf(name) == 0) {
                                return c.substring(name.length, c.length);
                            }
                        }
                        return "";
                    },
                    //Bankruptcy Changes - Starts
                    killSwitchForBankruptcy: function () {
                        var isEnabled = "true"; //By default setting to true
                        if (this.getIsTouch() === "True") {
                            isEnabled = angular.isDefined(OmniDataUtil.getOmniData("KillSwitchForBankruptcyMobile")) ? OmniDataUtil.getOmniData("KillSwitchForBankruptcyMobile") : "true";
                        }
                        else {
                            isEnabled = angular.isDefined(this.getCookie("KillSwitchForBankruptcy")) ? this.getCookie("KillSwitchForBankruptcy") : "true";
                        }
                        return isEnabled;
                    },
                    bankruptcyModalDialogBox: function () {
                        var delegatedUser = "false";
                        var content = document.getElementById("divBankruptcyContent");
                        var headerContent = document.getElementById("divBankruptcyModalContentHeader");
                        var bodyContent = document.getElementById("divBankruptcyModalContentBody");
                        if (delegatedUser != "" && delegatedUser.toLowerCase() == "true") {
                            content.innerHTML = commonConstants.DELEGATED_USER_MESSAGE;
                            document.getElementById("btnBack").innerHTML = commonConstants.DELEGATED_USER_BUTTON_TEXT;
                        }
                        else {
                            content.innerHTML = commonConstants.DETAILED_USER_MESSAGE;
                            document.getElementById("btnBack").innerHTML = commonConstants.DETAILED_USER_BUTTON_TEXT;
                        }
                        headerContent.innerHTML = content.innerHTML.split(',')[0];
                        bodyContent.innerHTML = "<br />" + content.innerHTML.split(',')[1];
                        document.getElementById("divBankruptcyModalDialog").style.display = "block";
                        if (this.getIsTouch() === "True") {
                            $("#btnBack").removeClass("ui-btn ui-corner-all ui-shadow");
                        }
                    },
                    showBankruptcyPopup: function (cardDetails, screeName) {
                        if (cardDetails == null || cardDetails.length == 0) {
                            var detailedNonBankruptcyAccounts = this.getIsTouch() === "True" ? OmniDataUtil.getOmniData("DetailedUserHasNonBnkrptAccnts") : this.getCookie("DetailedUserHasNonBnkrptAccnts");
                            if (detailedNonBankruptcyAccounts != undefined && detailedNonBankruptcyAccounts != "" && detailedNonBankruptcyAccounts.toLowerCase() == "true")
                                return false;
                            else {
                                switch (screeName) {
                                    case "ActivateCard":
                                        $(".cardactivation").css("display", "none");
                                        break;
                                    case "AddAuthorize":
                                        $(".AddAUContainerClass").css("display", "none");
                                        break;
                                    case "RecurringBiller":
                                        $(".recurringBillerContainer").css("display", "none");
                                        break;
                                    case "DisputeTransaction":
                                        $(".disputeInitCard").css("display", "none");
                                        break;
                                    case "CardLockUnlock":
                                        $(".cardSelection").css("display", "none");
                                        break;
                                    case "CardLostStolen":
                                        $(".cardLostStolenSelector").css("display", "none");
                                        break;
                                    case "OrderNewCard":
                                        $(".cardReplacementCardSelector").css("display", "none");
                                        break;
                                    case "CreditLimitIncrease":
                                        $(".cardSelection").css("display", "none");
                                        break;
                                    case "TravelNotification":
                                        $(".travelNotificationContainer").css("display", "none");
                                        break;
                                    case "ManageMyEmployees":
                                        $(".ManageAEContainerClass").css("display", "none");
                                        break;
                                }
                                this.bankruptcyModalDialogBox();
                                return true;
                            }
                        }
                        return false;
                    },
                    closeBankruptcyPopup: function () {
                        document.getElementById("divBankruptcyModalDialog").style.display = "none";
                        var returnUrl = "";
                        if (this.getIsTouch() === "True") {
                            returnUrl = document.getElementById("BaseUrlOmni").getAttribute("appbaseurl") + "/TUX/public/index.html#/loginview/displaySubMenu";
                            window.location.href = returnUrl;
                        }
                        else {
                            // Start DCEU-11969 DIY - OLB UAT3- On Lock/unlock page- account unavailable -Ok - navigates to legacy dashboard
                            var isDiyPilotEnabled = $('#SSOHelper');
                            if (isDiyPilotEnabled != null && isDiyPilotEnabled.attr('isdiycdenabled').toLowerCase() == "true") {
                                returnUrl = window.location.origin + isDiyPilotEnabled.attr('enterpiloturl');
                            }
                            else {
                                returnUrl = document.getElementById("hidCustomerDashboardUrl") ? document.getElementById("hidCustomerDashboardUrl").value : '';
                            }
                            // End DCEU-11969 DIY - OLB UAT3- On Lock/unlock page- account unavailable -Ok - navigates to legacy dashboard
                            window.location = returnUrl;
                        }
                    },
                    //Bankruptcy Changes - Ends
                    //Sticky header for ios safari
                    stickyHeader_Safari: function (header) {

                        var initial_scroll_position = 0;
                        var ticking = false;

                        // scroll page header
                        function scrollHeader(scroll_pos) {

                            if (header) {
                                header.style.position = "absolute";
                                header.style.top = scroll_pos + "px";
                                console.log('stickyHeader_Safari scroller called with top position : ' + scroll_pos);
                            }
                        }

                        // Don't lower than 500ms, otherwise there will be animation-problems with the --Safari toolbar
                        setInterval(function () {
                            initial_scroll_position = window.scrollY;

                            if (!ticking) {
                                window.requestAnimationFrame(function () {
                                    scrollHeader(initial_scroll_position);
                                    ticking = false;
                                });
                                ticking = true;
                            }
                        }, 500);
                    },
                    DIYAccDashboardUrl: function () {
                        return window.location.origin + '/digital/servicing/account-dashboard';
                    },
                    DIYCustDashboardUrl: function () {
                        return window.location.origin + '/digital/servicing/customer-dashboard';
                    },
                    isDIYUser: function () {
                        var result = false;
                        try {
                            if ((window.sessionStorage.DIYPilot != undefined && window.sessionStorage.DIYPilot.toUpperCase() == "DIYCUSTHUB" &&
                                window.sessionStorage.AccessToken != undefined && window.sessionStorage.AccessToken != null) ||
                                (window.sessionStorage.pilotflags != undefined && window.sessionStorage.pilotflags.toUpperCase().indexOf("DIYCUSTHUB") !== -1 &&
                                    window.sessionStorage.AccessToken != undefined && window.sessionStorage.AccessToken != null))

                                result = true;

                        }
                        catch (ex) { console.log(ex); }
                        return result;
                    },
                    navBackToEntry: function (navUrl) {
                        try {
                            if (navUrl.indexOf('AccountDashboard') > -1) {
                                if (this.isDIYUser()) navUrl = this.DIYAccDashboardUrl();
                            }
                        }
                        catch (ex) { console.log(ex); }
                        return navUrl;
                    }
                };
            }
        ]).factory('OpenModalService', [
            '$modal', function ($modal) {
                return {
                    popup: function (modalInstanceController, modalObj, backdrop, keyboard) {
                        return $modal.open({
                            animation: false,
                            templateUrl: modalObj.templateUrl,
                            controller: modalInstanceController,
                            controllerAs: "vm",
                            backdrop: backdrop,
                            keyboard: keyboard == undefined ? true : keyboard,
                            windowClass: modalObj.css,
                            resolve: {
                                modalObj: function () {
                                    return modalObj;
                                }
                            }
                        });
                    }
                };

            }
        ]).factory('ThirdPartySpeedBumpService', ['$rootScope', '$templateCache', 'OpenModalService', '$window',
            function ($rootScope, $templateCache, openModalService, $window) {

                var ThridPartyShowPop = ['$scope', '$modalInstance', function ($scope, $modalInstance) {
                    $scope.cont = function () {
                        if ($rootScope.url != null || $rootScope.url != '')
                            $modalInstance.close();
                        // $scope.cancel();
                        $window.open($rootScope.url, '_blank')
                    };

                    $scope.cancel = function () {
                        $modalInstance.close();
                    };
                }];
                $templateCache.put('thirdparty.html',
                    '<div id="SpeedBump" class="usb-module__modal">' +
                    '<div class="modal-header usb-content-paragraph--large modal-headerdisplay">' +
                    '<span></span>' +
                    '<span class="modal-header-close usb-icons-close2 usb-icons-close3" ng-click="cancel()"></span></div>' +
                    '<div class="modal-hr1px--dark-gray modal-hr1px-display"></div>' +
                    '<div class="modal-body">' +
                    '<div class="usb-heading3">Leaving U.S. Bank Website</div>' +
                    '<div class="usb-content-paragraph modal-content-margin modal-paragraph">' +
                    '<p>By selecting &ldquo;Continue&rdquo; you will be transferred to a third party website. U.S. Bank does not own ' +
                    'or control the website. U.S. Bank is not responsible for the content of, or products and services provided by, the third ' +
                    'party website. U.S. Bank doesn&rsquo;t guarantee the system availability or accuracy of information contained on the third ' +
                    'party website. This third party website doesn&rsquo;t operate under the U.S. Bank privacy and information security ' +
                    'policies and practices. Please consult the privacy and information security policy on the third party website if you have ' +
                    'any concerns or questions about the website or its content.</p>' +
                    '<p>Your Online Banking session will remain active for 15 minutes. After this time your session will automatically ' +
                    'expire and log you out if there has been no activity.</p><p>If you would like to return to Online Banking ' +
                    'and not go to this destination, select &ldquo;Cancel&rdquo;.</p>' +
                    '</div>' +
                    '</div>' +
                    '<div class="modal-footer">' +
                    '<div class="modal-margin-between-btn">' +
                    '<button class="usb-button--secondary" ng-click="cont()">Continue</button> ' +
                    '</div>' +
                    '<button class="usb-button--secondary" ng-click="cancel()">Cancel</button>' +
                    '</div>' +
                    '</div>');

                var thirdpartyModalObj = {};
                thirdpartyModalObj.templateUrl = "thirdparty.html";
                thirdpartyModalObj.css = "thirdPartySpeedBump";
                var OpenThirdPartyPopup = function (url) {
                    $rootScope.url = url;
                    openModalService.popup(ThridPartyShowPop, thirdpartyModalObj, "static");
                };
                return {
                    ThirdPartySpeedBump: OpenThirdPartyPopup
                };
            }]).factory('SiteCatService', function () {

                var SiteCatSwitchCode = function (PageName, EventName, DynamicVars) {
                    // s code object from adobe not working on the Chrome browser. Just a temporary fix the script error was suppressed here.
                    try {
                        s.clearContext();
                        s.clearVars();
                        var enrollmentErrocode = null;
                        if (window.appType) {
                            if (window.mid) {
                                s.marketingCloudVisitorID = window.mid || ""; // localStorage.mid||"";
                            }
                            if (window.aid) {
                                s.analyticsVisitorID = window.aid || ""; // localStorage.aid || "";
                            }
                        }
                    }
                    catch (ex) { }
                   

                    if (DynamicVars != null) {
                        if (PageName == "StateFarmGeneralErrorPage") {
                            if (DynamicVars["code"]) {
                                enrollmentErrocode = DynamicVars["code"]
                                delete DynamicVars.code;
                            }
                           
                        }
                        for (var dynKey in DynamicVars) {
                            if (!DynamicVars.hasOwnProperty(dynKey)) {
                                //The current property is not a direct property of DynamicVars
                                continue;
                            }
                            if (PageName !== "ExpressConsentFailure" || PageName !== "ExpressConsentMaintenance") {
                                Omniture.constants[PageName][EventName][dynKey] = DynamicVars[dynKey];
                            }
                            switch (dynKey) {
                                case "eVar48":
                                    s.eVar48 = DynamicVars[dynKey];
                                    break;
                            }
                        }
                    }

                    //reading the page level values
                    var prefix = Omniture.constants["OmniSitePrefix"];
                    cd.siteSection = Omniture.constants[PageName]["siteSection"];
                    cd.subSiteSection = Omniture.constants[PageName]["subSiteSection"];
                    var appversion = document.getElementById("appVersionForSitecat") ? document.getElementById("appVersionForSitecat").value : "";
                    if (Omniture.constants[PageName]["loginFormat"])
                        cd.loginFormat = Omniture.constants[PageName]["loginFormat"] + appversion;
                    var clinetNameSiteCat = window.APPNAMEForSiteCat;
                    if (clinetNameSiteCat == "OLB") {
                        window.CLIENTNAMEForSiteCat = Omniture.constants[PageName]["clientNameForSiteCat"];
                    } else if (clinetNameSiteCat == "MBL") {
                        window.CLIENTNAMEForSiteCat = Omniture.constants[PageName]["clientNameForSiteCat_TUX"];
                    }

                    cd.platform = "omni"

                    //reading the page level values for Customer Dashboard
                    if (PageName == "Interstitial") {
                        s.prop1 = Omniture.constants["InterstitialsiteSection"];
                        s.prop2 = Omniture.constants["InterstitialsubSiteSection"];
                    }
                    ;
                    if (PageName == "zelleLanding") {
                        s.pageName = prefix + ":" + Omniture.constants[PageName]["siteSection"];
                    }

                    //check if its delegate and add customersegment and shared access type for all sitecat calls.
                    if (document.getElementById("customersegment") && document.getElementById("satype")) {
                        cd.customerSegment = "customer type " + document.getElementById("customersegment").value;
                        cd.sharedAccessType = document.getElementById("satype").value;
                    }

                    //reading the event level values
                    var SiteCatProperties = Omniture.constants[PageName][EventName];
                    for (var key in SiteCatProperties) {
                        if (!SiteCatProperties.hasOwnProperty(key)) {
                            //The current property is not a direct property of SiteCatProperties
                            continue;
                        }

                        switch (key) {
                            case "transactionStatus":
                                if (PageName == "ExpressConsentConfirmationStatus") {
                                    cd.currentPage = prefix + ":" + cd.siteSection + ":" + Omniture.constants[PageName]["pageMiddleSection"];
                                    cd.transactionStatus = SiteCatProperties[key];
                                }
                                break;
                            case "eventname":
                                if (PageName == "ExpressConsentMaintenance" || PageName == "ExpressConsentOptedAll" || PageName == "ExpressConsentConfirmation") {
                                    cd.currentPage = prefix + ":" + cd.siteSection + ":" + Omniture.constants[PageName]["pageMiddleSection"];
                                }
                                else if (PageName == "AutoInvestmentEmailTUX" || PageName == "AutoInvestmentEmailIPad" || PageName == "AutoInvestmentDOBPopupTUX" || PageName == "AutoInvestmentDOBPopupIPad") {
                                    cd.currentPage = SiteCatProperties[key];
                                }
                                else {
                                    cd.currentPage = prefix + ":" + Omniture.constants[PageName]["pageMiddleSection"] + ":" + SiteCatProperties[key];
                                    if (PageName === "LaResetPassword") {
                                        s.eVar67 = Omniture.constants[PageName]["loginFormat_EVAR"];
                                    }
                                }
                                break;
                            case "prop53":
                                if (PageName == "AutoInvestment" && EventName == "PauseVideo") {
                                    s.prop53 = prefix + ":" + Omniture.constants[PageName]["pageMiddleSection"] + ":" + SiteCatProperties[key]
                                        + Omniture.constants[PageName][EventName]["timestamp"];
                                } else if (PageName == "ExpressConsentConfirmation") {
                                    cd.currentPage = prefix + ":" + cd.siteSection + ":" + Omniture.constants[PageName]["pageMiddleSection"];
                                    s.prop53 = prefix + ":" + cd.siteSection + ":" + SiteCatProperties[key];
                                }
                                else {
                                    s.prop53 = prefix + ":" + Omniture.constants[PageName]["pageMiddleSection"] + ":" + SiteCatProperties[key];
                                }
                                break;
                            case "prop13":
                                s.prop13 = prefix + ":" + Omniture.constants[PageName]["pageMiddleSection"] + ":" + SiteCatProperties[key];
                                break;
                            case "eVar8":
                                s.eVar8 = SiteCatProperties[key];
                                break;
                            case "prop8":
                                s.prop8 = SiteCatProperties[key];
                                break;
                            case "pageName":
                                if (PageName == "SimpleLoan" && EventName == "OnLoad") {
                                    s.pageName = prefix + ":" + Omniture.constants[PageName]["pageMiddleSection"];
                                }
                                else if (PageName == "AutoInvestmentEmailTUX" || PageName == "AutoInvestmentEmailIPad" || PageName == "AutoInvestmentDOBPopupTUX" || PageName == "AutoInvestmentDOBPopupIPad") {
                                    s.pageName = SiteCatProperties[key];
                                }
                                else {
                                    s.pageName = prefix + ":" + Omniture.constants[PageName]["pageMiddleSection"] + ":" + SiteCatProperties[key];
                                }
                                break;
                            case "currentPage":
                                cd.currentPage = prefix + ":" + Omniture.constants[PageName]["pageMiddleSection"] + ":" + SiteCatProperties[key];
                                break;
                            case "prop1":
                                if (PageName == "zelleRequest") {
                                    s.prop1 = SiteCatProperties[key];
                                } else if (PageName == "AutoInvestment") {
                                    s.prop1 = SiteCatProperties[key];
                                }
                                else {
                                    s.prop1 = Omniture.constants[PageName]["siteSection"];
                                }
                                break;
                            case "prop2":
                                if (PageName == "enrollWithZelle") {
                                    s.prop2 = Omniture.constants[PageName]["subSiteSection"] + ":" + SiteCatProperties[key];
                                }
                                else if (PageName == "zelleRequest" || PageName == "zelleLanding") {
                                    s.prop2 = SiteCatProperties[key];
                                } else if (PageName == "AutoInvestment") {
                                    s.prop2 = SiteCatProperties[key];
                                }
                                else {
                                    s.prop2 = Omniture.constants[PageName]["subSiteSection"];
                                }
                                break;
                            case "events":
                                s.events = SiteCatProperties[key];
                                break;
                            case "eVar99":
                                s.eVar99 = Omniture.constants["projectIDPrefix"] + ":" + SiteCatProperties[key];
                                break;
                            case "prop67":
                                s.prop67 = SiteCatProperties[key];
                                break;
                            case "prop23":
                                s.prop23 = SiteCatProperties[key];
                                break;
                            case "prop43":
                                if (PageName == "zelleRequest") {
                                    s.prop43 = SiteCatProperties[key];
                                }
                                else {
                                    s.prop43 = prefix + ":" + SiteCatProperties[key];
                                }
                                break;
                            case "errorStatus":
                                if (PageName == "CardActivation" || PageName == "zelleRequest" || PageName == "zelleSplit" || PageName == "PendingRequestPopClose" || PageName == "PendingRequest" || PageName == "Missingprofiledetails") {
                                    cd.errorStatus = prefix + ":" + Omniture.constants[PageName]["pageMiddleSection"] + ":" + SiteCatProperties[key];
                                } else if (PageName == "ExpressConsentFailure" || PageName == "ExpressConsentMaintenance") {
                                    cd.currentPage = prefix + ":" + cd.siteSection + ":" + Omniture.constants[PageName]["pageMiddleSection"];
                                    cd.errorStatus = SiteCatProperties[key] + DynamicVars[dynKey];
                                }
                                else {
                                    s.errorStatus = SiteCatProperties[key];
                                    cd.errorStatus = SiteCatProperties[key];
                                }
                                break;
                            case "transactionError":
                                cd.transactionError = prefix + ":" + Omniture.constants[PageName]["pageMiddleSection"] + ":" + SiteCatProperties[key];
                                break;
                            case "errorMessage":
                                if (PageName == "StateFarmGeneralErrorPage") {
                                    var code = "";
                                    if (enrollmentErrocode) {
                                        code = enrollmentErrocode;
                                    }
                                    
                                    cd.errorMessage = SiteCatProperties[key] + code;
                                }
                                else {
                                    cd.errorMessage = prefix + ":" + Omniture.constants[PageName]["pageMiddleSection"] + ":" + SiteCatProperties[key];
                                }
                                break;
                            case "linkTrackVars":
                                if ((PageName == "AutoInvestment" && !s.linkTrackVars.includes(SiteCatProperties[key]))
                                    || PageName == "ManageExternalAccounts") {
                                    s.linkTrackVars = s.linkTrackVars + SiteCatProperties[key]
                                }
                                else if (PageName != "AutoInvestment") {
                                    s.linkTrackVars = SiteCatProperties[key];
                                }
                                break;
                            case "eVar63":
                                if (PageName == "zelleRequest") {
                                    s.eVar63 = SiteCatProperties[key];
                                }
                                else {
                                    cd["eVar63"] = SiteCatProperties[key];
                                }
                                break;
                            case "eVar5":
                                s.eVar5 = SiteCatProperties[key];
                                break;
                            case "error":
                                cd.errorStatus = prefix + ":" + Omniture.constants[PageName]["pageMiddleSection"] + ":" + SiteCatProperties[key];
                                break;
                            default:
                                cd[key] = SiteCatProperties[key];
                        }
                    }

                    if (PageName == "shared_access") {
                        cd.currentPage = cd.currentPage.replace("omni:", "");
                    }
                };
                var SiteCatT = function (PageName, EventName, DynamicVars) {

                    // s code object from adobe not working on the Chrome browser. Just a temporary fix the script error was suppressed here.
                    try {

                        SiteCatSwitchCode(PageName, EventName, DynamicVars);
                        s.t();
                        var reportingData = {
                            pageName: cd.currentPage,
                            lpId: s.eVar8
                        }
                        if (window.publisherFW) {
                            console.log("Debug :: calling window publisherFW :: module -> OLB :: pageName -> " + reportingData.pageName + " :: lpid -> " + reportingData.lpId);
                            window.publisherFW.publishEvent("pageView", reportingData); // call this function after the Data Layer Object $NBA
                        }
                    }
                    catch (ex) {
                    }
                };

                var SiteCatTL = function (PageName, EventName, DynamicVars) {

                    // s code object from adobe not working on the Chrome browser. Just a temporary fix the script error was suppressed here.
                    try {
                        SiteCatSwitchCode(PageName, EventName, DynamicVars);
                    }
                    catch (e) { }
                    // s code object from adobe not working on the Chrome browser. Just a temporary fix the script error was suppressed here.
                    try {
                        if (PageName == "Interstitial") {
                            if (s.prop53 != undefined) {
                                s.linkTrackVars = s.linkTrackVars + ',prop53,contextData.uxNameForSiteCat,contextData.appNameForSiteCat';
                                if (s.events != undefined) {
                                    s.linkTrackVars = s.linkTrackVars + ', events';
                                    s.linkTrackEvents = 'event406';
                                    s.events = 'event406';
                                }
                                s.tl(this, 'o', s.prop53, 'navigate');
                            }
                            return;
                        }
                        else if (PageName == "LoginAssistanceResend" || PageName == "AugmentedBalanceBonus" || PageName == "SingleAndRecurringTransfer" || PageName == "SingleAndRecurringConfirmation" || (PageName == "SingleAndRecurringRepeatingTransfer" && EventName != "InterstitialPageLoad")) {
                            s.linkTrackVars = s.linkTrackVars + ',prop53';
                            s.tl(this, 'o', s.prop53, null, 'navigate');
                            return;
                        }
                        else if (PageName == "CardActivation" || PageName == "zelleRequest" || PageName == "zelleActivity" || PageName == "zelleSplit" || PageName == "zelleSend" || PageName == "PendingRequestPopClose" || PageName == "PendingRequest" || PageName == "ZelleDemoLink" || PageName == "AutoInvestmentTandCPage") {
                            if (Omniture.constants[PageName][EventName]["linkTrackVars"] != undefined) {
                                s.linkTrackVars = s.linkTrackVars + Omniture.constants[PageName][EventName]["linkTrackVars"];
                            }
                            else {
                                s.linkTrackVars = s.linkTrackVars + ',prop53';
                            }
                            s.tl(this, 'o', s.prop53, null, 'navigate');
                            return;
                        }
                        else if (PageName == "tranfers" && EventName == "WithholdFederalTaxOptionChanged") {
                            s.linkTrackVars = s.linkTrackVars + ',prop53';
                            s.prop53 = 'omni:transfers:ira distribution tax withhold federal tax option' + Omniture.constants[PageName][EventName]["selectedOption"];
                        }
                        else if (PageName == "tranfers" && EventName == "WithholdStateTaxOptionChanged") {
                            s.linkTrackVars = s.linkTrackVars + ',prop53';
                            s.prop53 = 'omni:transfers:ira distribution tax withhold state tax option' + Omniture.constants[PageName][EventName]["selectedOption"];
                        }
                        else if (PageName == "tranfers" && EventName == "SelectedWithholdTaxOption") {
                            s.linkTrackVars = s.linkTrackVars + ',prop53';
                            s.prop53 = 'omni:transfers:ira distribution tax withhold ' + Omniture.constants[PageName][EventName]["isFedOrState"];
                        }
                        else if (PageName == "tranfers" && EventName == "ReviewAndSubmitEditClicked") {
                            s.linkTrackVars = s.linkTrackVars + ',prop53';
                            s.prop53 = 'omni:transfers:ira distribution review Edit link';
                            s.tl(this, 'o', s.prop53, null, 'navigate');
                        }
                        else if (PageName == "tranfers" && EventName == "ReviewAndSubmitCancelClicked") {
                            s.linkTrackVars = s.linkTrackVars + ',prop53';
                            s.prop53 = 'omni:transfers:ira distribution review cancel link';
                            s.tl(this, 'o', s.prop53, null, 'navigate');
                        }
                        else if (PageName == "zelleLanding") {
                            s.linkTrackVars = s.linkTrackVars + ',events,prop53';
                            s.tl(this, 'o', s.prop53, null, 'navigate');
                            return;
                        }
                        else if (PageName == "CreditLineIncrease") {
                            s.linkTrackVars = s.linkTrackVars + ',prop53';
                            s.tl(this, 'o', s.prop53, null, 'navigate');
                            return;
                        }
                        else if (PageName == "ExpressConsentConfirmation") {
                            s.linkTrackVars = s.linkTrackVars + ',prop53';
                            s.tl(this, 'o', s.prop53, null, 'navigate');
                            return;
                        }
                        else if (PageName == "MobileNumberCapture") {
                            s.linkTrackVars = s.linkTrackVars + ',prop53';
                            s.tl(this, 'o', s.prop53, null, 'navigate');
                            return;
                        }
                        else if (PageName == "KYC_REFRESH") {
                            s.linkTrackVars = s.linkTrackVars + ',prop53';
                            s.tl(this, 'o', s.prop53, null, 'navigate');
                            return;
                        }
                        else if (PageName == "LoanPaymentAsssistance") {
                            s.linkTrackVars = s.linkTrackVars + ',prop53';
                            s.tl(this, 'o', s.prop53, null, 'navigate');
                            return;
                        }
                        if (PageName == "AccountAggregationTandC") {
                            if (EventName == 'SplashPage') {
                                s.t();
                            }
                            else if (EventName == 'TandCCancel'
                                || EventName == 'TandCBack'
                                || EventName == 'GetStarted'
                                || EventName == 'PrivacyPledge'
                                || EventName == 'OnlinePrivacy'
                                || EventName == 'TermsAndCondition'
                                || EventName == 'frequentlyAskedQuestions') {
                                if (s.prop53 != undefined && s.linkTrackVars != undefined) {
                                    s.tl(this, 'o', s.prop53, null, 'navigate');
                                }
                            }
                            return;
                        }

                        if (PageName == "ManageExternalAccounts") {
                            if (EventName == 'DeleteConfirm') {

                                if (s.prop53 != undefined) {
                                    s.linkTrackVars = s.linkTrackVars + ',prop53,events';
                                    s.linkTrackEvents = 'event302';
                                    s.events = 'event302=' + DynamicVars;
                                    /*s.linkTrackVars='event204';
                                    s.event204='event204=5';*/
                                    s.tl(this, 'o', s.prop53, null, 'navigate');
                                }
                            }
                            else if (EventName == 'DisplayAccountClick'
                                || EventName == 'DeleteAccountClick'
                                || EventName == 'HelpDisplayIconClick'
                                || EventName == 'HelpDeleteIconClick') {
                                if (s.prop53 != undefined && s.linkTrackVars != undefined) {
                                    s.prop8 = "D=v8";
                                    s.eVar8 = " ";
                                    s.eVar9 = " ";
                                    s.eVar35 = "D=pageName";
                                    s.eVar40 = "online banking";
                                    s.tl(this, 'o', s.prop53, null, 'navigate');
                                }
                            }
                            return;
                        }

                        s.t();
                        var reportingSiteCatTLData = {
                            pageName: cd.currentPage,
                            lpId: s.eVar8
                        }
                        if (window.publisherFW) {
                            console.log("Debug :: calling window publisherFW SiteCatTL:: module -> OLB :: pageName -> " + reportingSiteCatTLData.pageName + " :: lpid -> " + reportingSiteCatTLData.lpId);
                            window.publisherFW.publishEvent("pageView", reportingSiteCatTLData); // call this function after the Data Layer Object $NBA
                        }
                    }
                    catch (e) { }
                };

                return {
                    SiteCatTCall: SiteCatT,
                    SiteCatTLCall: SiteCatTL
                };
            });
    angular
        .module("CommonModule")
        .service("CommonValidation", [commonValidation]);

    function commonValidation() {
        return {
            dollarFormat: function (dollarAmount) {
                if (dollarAmount != null && dollarAmount.length !== 0) {
                    var getAmount = dollarAmount.replace(/[&\/\\#,+()$~%"@":*?<>{}]/g, "");
                    var number = getAmount;
                    var decimalplaces = 0;
                    var decimalcharacter = ".";
                    var thousandseparater = ",";
                    number = parseFloat(number);
                    if (!isNaN(number)) {
                        var sign = "$";
                        var formatted = new String(number.toFixed(decimalplaces));
                        if (decimalcharacter.length && decimalcharacter !== ".") {
                            formatted = formatted.replace(/\./, decimalcharacter);
                        }
                        var integer = "";
                        var fraction = "";
                        var strnumber = new String(formatted);
                        var dotpos = decimalcharacter.length ? strnumber.indexOf(decimalcharacter) : -1;
                        if (dotpos > -1) {
                            if (dotpos) {
                                integer = strnumber.substr(0, dotpos);
                            }
                            fraction = strnumber.substr(dotpos + 1);
                        } else {
                            integer = strnumber;
                        }
                        if (integer) {
                            integer = String(Math.abs(integer));
                        }
                        while (fraction.length < decimalplaces) {
                            fraction += "0";
                        }
                        var temparray = new Array();
                        while (integer.length > 3) {
                            temparray.unshift(integer.substr(-3));
                            integer = integer.substr(0, integer.length - 3);
                        }
                        temparray.unshift(integer);
                        integer = temparray.join(thousandseparater);
                        return sign + integer;
                    } else {
                        return dollarAmount;
                    }
                }
                return dollarAmount;
            },
            isValidAmount: function (value) {
                if (value === "" || value == undefined) return true;
                var number = value.replace(/[&\/\\#,+()$~%"@":*?<>{}]/g, "");
                if (isNaN(parseFloat(number))) {
                    return false;
                } else {
                    return true;
                }
            },
            isEmpty: function (value) {
                return value === "" || value === null || value === undefined;
            },
            removeSpecialChar: function (dollarAmount) {
                return dollarAmount.replace("$", "").replace(/,/g, "");
            },
            validateRegex: function (value, regex) {
                return regex.test(value);
            },
            isAlphaNumeric: function (value) {
                var regex = /^[0-9a-zA-Z]+$/;
                return regex.test(value);
            },
            isChar: function (value) {
                var regex = /^[a-zA-Z]+$/;
                return regex.test(value);
            },
            isNumeric: function (value) {
                var regex = /^[0-9]+$/;
                return regex.test(value);
            },
            isMobileFormat: function (value) {
                var regex = /^[0-9]{3}[-\S\.][0-9]{3}[-\S\.][0-9]{4}$/;
                return regex.test(value);
            }
        }
    }

    angular.module('CommonModule')
        .directive('editlimits', ["CommonValidation", editLimits]);
    function editLimits(commonValidation) {
        var link = function (scope, element, attrs, ctrl) {
            ctrl.$parsers.unshift(function (inputValue) {
                if (inputValue == undefined) return '';
                var transformedInput = inputValue.replace(/[^0-9,$]/g, '');
                if (transformedInput != inputValue) {
                    ctrl.$setViewValue(transformedInput);
                    ctrl.$render();
                }
                return transformedInput;
            });
            element.on("focus", function () {
                element.data("oldData", element.val());
                element.val("");
            });
            element.on("blur", function () {
                var currentValue = element.val();
                if (currentValue === "") {
                    element.val(element.data("oldData"));
                } else {
                    element.val(commonValidation.dollarFormat(currentValue.toString()));
                }
            });
        };
        return {
            restrict: 'A',
            require: 'ngModel',
            link: link
        };

    }

    angular.module('CommonModule').directive('helpiconControl', helpiconControl);

    function helpiconControl() {
        var divFormHelp;

        function prepareHelpBubble() {
            var divFormHelp = $("<div>");
            $(divFormHelp).addClass("chat-bubble");
            $(divFormHelp).attr('id', 'divHelpBubble');
            $("body").append(divFormHelp);
            return divFormHelp;
        };

        function addHelpIconMouseEvents(event, msg) {
            $(divFormHelp).hide('fast');
            divFormHelp = prepareHelpBubble();

            if (event.target) {
                $(divFormHelp).removeClass("chat-bubble-MalInv");
                $(divFormHelp).addClass("chat-bubble-AvlBalDDA");
            }
            else {
                $(divFormHelp).removeClass("chat-bubble-AvlBalDDA");
                $(divFormHelp).removeClass("chat-bubble-MalInv");
            }
            showHelpIconBubble(msg.text, divFormHelp, event);
            $(document.body).click(function (event) { $(divFormHelp).hide('fast'); });
        }

        //Generic method to display the help bubble
        function showHelpIconBubble(text, divFormHelp, e) {
            //check if the help bubble is visible, if it is then do not do anything, otherwise display it.
            var vis = $(divFormHelp).is(":visible");
            if (!vis) {
                $(divFormHelp).html(text);
                if (!$(divFormHelp).hasClass('hasposition')) {
                    $(divFormHelp).addClass('hasposition');
                }
                $(divFormHelp).css({
                    position: "absolute",
                    marginLeft: 0, marginTop: 0,
                    top: e.pageY - $(divFormHelp).outerHeight() - 15, left: e.pageX - 40
                });
                var HelpBorder = $("<div>");
                $(HelpBorder).addClass("chat-bubble-arrow-border");

                var HelpArrow = $("<div>");
                $(HelpArrow).addClass("chat-bubble-arrow");

                $(divFormHelp).append(HelpArrow);
                $(divFormHelp).append(HelpBorder);

                $(divFormHelp).show('fast');
            }
        };

        return {
            restrict: 'E',
            scope: {
                click: '&'
            },
            template: '<span></span>',
            link: function (scope, element, attr) {
                element.on('click', function (event) {
                    event.stopPropagation();
                    scope.click();
                    scope.$apply(function () {
                        addHelpIconMouseEvents(event, attr);
                    });
                });
            }
        };
    };

})();
;
/*
 Custom Cobrowse UI with hard coded aria labels and html content.  Does not rely on content:before css to supply the content.
*/

(function () {


    // Detect ie
    var ie = document.documentMode && window.XDomainRequest,
        iever = ie ? document.documentMode : 0,
        ie9_10 = ie && (iever == 9 || iever == 10),
        ie8 = ie && iever <= 8;

    var screenshare, agentvideo, ssnbutton;

    // Presence integration
    function presenceFire(eventname, eventdata) {
        // Fire event on the agent side
        if (GLANCE.Presence && GLANCE.Presence.Visitor && GLANCE.Presence.Visitor.instance)
            GLANCE.Presence.Visitor.instance.fire(eventname, eventdata);
    }

    // DOM Element utility methods --------------------------------------------------------
    function getElement(sel) {
        var selem, elem = sel.match(/^#/) ? document.getElementById(sel.substr(1)) : ((selem = elem.querySelectorAll(sel)) ? selem[0] : null);
        if (!elem)
            return null;

        function GElement(elem) {
            this.elem = elem;
            this.show = function (b) {
                if (b === undefined) b = true;
                var oldclass = b ? "glance_hide" : "glance_show",
                    newclass = b ? "glance_show" : "glance_hide",
                    re = new RegExp(oldclass, "g");
                // In IE9 setting class triggers a dom mutation event even if it's a no-op
                if (elem.className.match(new RegExp(newclass, "g")))
                    return;
                if (!elem.className.match(re))
                    this.addClass(newclass);
                else
                    elem.className = elem.className.replace(re, newclass);
            }
            this.hide = function () {
                this.show(false);
            }
            this.setDimensions = function (width, height) {
                elem.style["width"] = width + "px";
                elem.style["height"] = height + "px";
            }
            this.getElement = function (selector) {
                return new GElement(elem.querySelectorAll(selector)[0]);
            }
            this.setClass = function (cls) {
                elem.className = cls;
            }
            this.addClass = function (cls) {
                if (typeof elem.className === "string" && // for SVG elements, className is type SVGAnimatedString
                    elem.className.match(new RegExp("\\b" + cls + "\\b", "g")))
                    return;
                elem.className += (" " + cls);
            }
            this.removeClass = function (cls) {
                if (elem.className === cls) {
                    elem.className = "";
                    return;
                }
                var re = new RegExp("\\b" + cls + "\\b", "g");
                elem.className = elem.className.replace(re, " ");
            }
            this.addEvent = function (evt, handler, stopprop) {
                elem.addEventListener(evt, function (e) {
                    handler(e);
                    if (stopprop !== false) { // true or undefined
                        e.preventDefault();
                        e.stopPropagation();
                    }
                });
            }

            this.getAttr = function (attrname) {
                return elem.getAttribute(attrname);
            }
            this.setAttr = function (attrname, attrval) {
                elem.setAttribute(attrname, attrval);
            }
            this.html = function (h) {
                if (h)
                    elem.innerHTML = h;
                return elem.innerHTML;
            }

            // Accessibility
            // Make a dialog box which handles tab to set focus, esc key to cancel
            this.makeDialog = function (closebutton, onclose) {
                var self = this;

                function closeDialog() {
                    onclose();
                    self.previousFocus.focus();
                }
                this.setAttr("role", "dialog");
                elem.tabIndex = 0; // so it is focusable
                this.handleKey(27 /* ESC */, "", closeDialog);
                getElement(closebutton).addEvent("click", closeDialog);

                // Once focus is in the dialog, trap it there by preventing tab away from first and last input
                // Also give each a and input a tabIndex so it can get focus
                var dialogelements = elem.querySelectorAll("a, input, button");
                if (dialogelements.length >= 1) {
                    (new GElement(dialogelements[0])).trapFocus(true);
                    for (var n = 0; n < dialogelements.length; n++)
                        dialogelements[n].tabIndex = 0;
                    (new GElement(dialogelements[n - 1])).trapFocus(false);
                }
            }
            this.ariaLabel = function () {
                // Create a hidden label for the eleemnt, and a aria-labelledby attribute
                // that points to it.
                var label = document.createElement("div");
                label.className = "glance_hide";
                label.id = elem.id + "_al";
                label.innerHTML = "Cobrowse information, shows content"; //PRJ28029 OLB BAU OLB-52 (Defect # 18828) Deferred - Bankerchat: Co-browse:  EXPAND ARROW BUTTON didnt read by Screen reader correctly 
                elem.appendChild(label);
                this.setAttr("aria-labelledby", label.id);
            }
            this.showDialog = function () {
                this.previousFocus = document.activeElement;
                this.show();
                this.focus();
            }
            this.focus = function () {
                elem.focus();
            }
            this.trapFocus = function (first) {
                this.handleKey(9 /* TAB */, first ? "shift" : "", function () { });
            }
            this.handleKey = function (keyCode, modifier, handler) {
                this.addEvent("keydown", function (e) {
                    var modified = e["shiftKey"] || e["ctrlKey"] || e["altKey"];
                    if (e.keyCode === keyCode && ((modifier && e[modifier + "Key"]) || (!modifier && !modified))) {
                        handler();
                        e.preventDefault(); // only if key matches
                        e.stopPropagation();
                    }
                }, false);
            }
        }

        return new GElement(elem);
    }

    function getDocument() {

        function GDocument() {
            var doc = document;

            this.onLoad = function (fn) {
                doc.readyState.match(/uninitialized|loading/) ? doc.addEventListener("DOMContentLoaded", fn) : fn();
            }
        }

        return new GDocument();
    }



    // UIState -------------------------------------------------------------

    var UIState = {

        EXPANDED: "expanded",
        BOXSTATE: "boxstate",
        RCENABLED: "rcenabled",

        set: function (prop, val) {
            if (GLANCE.Cobrowse.Visitor.inSession())
                GLANCE.Cobrowse.Visitor.setCookieValue(prop, val);
        },

        get: function (prop) {
            return GLANCE.Cobrowse.Visitor.inSession() ? GLANCE.Cobrowse.Visitor.getCookieValue(prop) : null;
        }
    }

    // Confirmation --------------------------------------------------------

    /**
     * @constructor
     */
    function Confirmation() {
        this.confirm = getElement('#glance_confirm');
        this.scrim = getElement('#glance_scrim');

        var self = this;
        getElement('#glance_yes').addEvent('click', function () {
            self.hide();
            self.onYes();
        });

        this.confirm.makeDialog("#glance_no", function () {
            self.hide();
            self.onNo();
        });
    }

    Confirmation.prototype.hide = function () {
        this.confirm.hide();
        this.scrim.hide();
        this.confirm.previousFocus.focus();
    }

    Confirmation.prototype.show = function (msgClass, onYes, onNo) {
        this.onYes = onYes;
        this.onNo = onNo ? onNo : function () { };

        var confmsg = getElement('#glance_confirm_msg');

        switch (msgClass) {
            case "glance_confirm_rc":
                confmsg.elem.innerHTML = "Allow the agent to take control?";
                break;
            default:

        }
        confmsg.setClass(msgClass);

        // Must show the confirmation message in order to see effects of setting className (at least on safari)
        this.confirm.showDialog();

        var msgtext = getComputedStyle(confmsg.elem, ":before").getPropertyValue("content");

        this.scrim.show();
    }

    // Screenshare ---------------------------------------------------------

    /**
     * @constructor
     */
    function Screenshare() {
        this.view = getElement('#glance_ssview');
        this.scrim = getElement('#glance_scrim');
    }

    Screenshare.prototype.show = function (show) {
        var b = (show.state !== "ended" && !show.paused);
        this.view.show(b);
        this.scrim.show(b);
    }

    Screenshare.prototype.viewerinfo = function (v) { }

    Screenshare.prototype.pause = function () {
        this.show({
            state: "continued",
            paused: true
        });
    }

    Screenshare.prototype.resume = function () {
        this.show({
            state: "continued",
            paused: false
        });
    }

    // AgentVideo ---------------------------------------------------------

    /**
     * @constructor
     */
    function AgentVideo() {
        this.iframe = getElement("#glance_agentvideo");
    }

    AgentVideo.prototype.setDims = function () {
        // Adjust iframe width to match width of parent's content box, and adjust height according to video aspect ratio
        var iframeparent = this.iframe.elem.parentElement;
        var parentstyle = getComputedStyle(iframeparent);
        var framewidth = iframeparent.scrollWidth - (parseInt(parentstyle.paddingLeft) + parseInt(parentstyle.paddingRight)); // iframe.getBoundingClientRect()
        var aspectratio = (this.params.width || 320) / (this.params.height || 240);
        var frameheight = Math.ceil(framewidth / aspectratio);
        this.iframe.setDimensions(framewidth, frameheight);
    }

    AgentVideo.prototype.show = function (ss) {

        this.params = ss.params;

        if (ss.paused)
            return;

        if (ss.state !== "ended")
            this.videoOn(ss.state === "new");
        else
            this.videoOff();
    }

    AgentVideo.prototype.videoOn = function (expand) {
        // Set video visibility first so iframe has a non-zero width
        ssnbutton.setBoxState(SessionButton.BOXSTATE_VIDEO);
        if (expand)
            ssnbutton.setExpanded(true);
        this.setDims();
    }

    AgentVideo.prototype.videoOff = function () {
        ssnbutton.setBoxState(SessionButton.BOXSTATE_JOINED);
        ssnbutton.setExpanded(false);
    }

    AgentVideo.prototype.viewerinfo = function (v) {
        (false && window.console && window.console.log && window.console.log("UI:", "Viewer info:" + JSON.stringify(v)));
    }

    AgentVideo.prototype.pause = function () {
        this.videoOff();
    }

    AgentVideo.prototype.resume = function () {
        this.videoOn(true);
    }

    // SessionButon --------------------------------------------------------

    var IN_SESSION = 1,
        NOT_IN_SESSION = 2,
        SESSION_STARTING = 3,
        SESSION_BLURRED = 4,
        IN_SESSION_DISCON = 5;
    var buttonStateClasses = ["", "in_session", "not_in_session", "session_starting", "in_session_blurred", "in_session discon"];

    /**
     * @constructor
     */
    function SessionButton() {

        if (!document.body)
            return;

        var buttonhtml;
        this.button = document.createElement("div");
        this.button.id = "glance_cobrowse_btn";
        //this.button.tabIndex = 0; // make focusable
        //this.button.setAttribute("role", "");
        //this.button.setAttribute("aria-label", "Start cobrowsing");

        buttonhtml = SessionButton.buttonHTML;

        this.button.innerHTML = SessionButton.buttonHTML;

        document.body.appendChild(this.button);

        this.button = getElement("#glance_cobrowse_btn");
        this.button.setClass("glance_ui_36");
        this.setState(NOT_IN_SESSION);

        //#ifndef _GLANCE_CUSTOMUI
        //    // If background color of glance_start_label has been customized (ie it is not #0d475d) and the background
        //    // of the start/stop buttons has not been customized yet, make the start/stop buttons transparent
        //    if (window.getComputedStyle(getElement("#glance_show_btn").elem).backgroundColor === "#2f6975" &&
        //        window.getComputedStyle(getElement("#glance_start_label").elem).backgroundColor !== "#0d475d") {
        //        getElement("#glance_show_btn").elem.style.backgroundColor = "transparent";
        //        getElement("#glance_stop_btn").elem.style.backgroundColor = "transparent";
        //    }
        //#endif

        this.terms = getElement("#glance_terms");
        this.startlabel = getElement("#glance_start_label");
        this.scrim = getElement('#glance_scrim');
        this.msgbox = getElement("#glance_msg_box");
        this.border = getElement("#glance_border");

        this.addEventListeners();

        this.confirmation = new Confirmation();
    }

    SessionButton.buttonHTML =
       "<div id='glance_scrim' class='glance_dim glance_hide'></div>" +
        "<div id='glance_ssview' class='glance_hide' glance_cobrowse_suppress='1'><iframe scrolling='no' id='glance_screenshare' data-no-cobrowse-content='1' glance_cobrowse_suppress='1'></iframe></div> " +
        "<div id='glance_start_label' class='glance_ui glance_ui_titlebar'>" +
        "<div id='glance_show_btn' tabIndex='0' role='button'>Cobrowse</div>" +
        "<div id='glance_in_session'>" +
        "<div id='glance_stop_btn' class='glance_ishow' tabIndex='0' role='button'>Stop cobrowsing</div>" +
		"<div class='separaterClass'></div>" +
        "<div id='glance_expand' style='margin-top: 7px;' class='glance_closed' tabIndex='0' role='button' aria-expanded='false' aria-label='Co-browse'>" +
		"</div>" +
        "</div>" +
        "</div>" +
        "<div id='glance_ssnkey_box' class='glance_hide glance_ui'>" +
        "<iframe id='glance_agentvideo' data-no-cobrowse-content='1'></iframe>" +
        "<div style='font-size: 18px;' id='glance_ssn_starting'>Establishing cobrowse session...</div>" +
        "<div id='glance_keyless_prompt'>Please wait for the agent to connect</div>" +
        "<div style='font-size: 18px;' id='glance_key_prompt'>Give your banker the code below to begin cobrowsing.</div>" +
        "<div id='glance_ssn_key'></div>" +
        "<div id='glance_ssn_info'></div>" +
        "<a href='https://answers.usbank.com/GSSChat/CoBrowseAgreement'><div id='glance_tagline'><a class='tandcunderline' id='glance_terms_link'>Terms and conditions</a></div></a>" +
		"<button id='glance_yes'></button><button id='glance_no'></button></div>" +
        "</div>" +
        "<div id='glance_msg_box' class='glance_hide glance_ui'><p id='glance_msg'></p><button id='glance_msg_ok'></button></div>" +
        "<div id='glance_confirm' class='glance_hide glance_ui'><p id='glance_confirm_msg'></p></div>" +
        "<div id='glance_terms'class='glance_hide glance_ui'>" +
        "<h2 role='heading' aria-level='2' id='glance_terms_title'>Start cobrowsing</h2><p id='glance_terms_text'>Would you like to share your browser with your banker?</p>" +
        "<button id='glance_accept'>Accept</button>" +
		"<button id='glance_decline'>Decline</button><br/>" +
        "<a id='glance_terms_link2' onclick='glanceCbrUtility.openTerms();'>Terms and conditions</a>" +
        "</div>" +
        "<div id='glance_border' " + (ie9_10 ? "class='ie9'" : "") + "></div>";

    SessionButton.prototype.showTerms = function (show, startparams) {
        this.startparams = startparams;
        this.scrim.show(show);

        // Terms and conditions must be displayed even when button is "not_in_session"
        this.terms.elem.style.display = (show ? "block" : "none");
        this.scrim.elem.style.display = (show ? "block" : "");
        if (show)
            this.terms.showDialog();
        else
            this.terms.hide();
    },

        SessionButton.prototype.focus = function () {
            this.button.focus();
        },

        SessionButton.prototype.showDisconnected = function (discon) {
            if (discon)
                this.setState(IN_SESSION_DISCON);
            else if (this.state === IN_SESSION_DISCON)
                this.setState(IN_SESSION);
        },

        SessionButton.prototype.addEventListeners = function () {
            var self = this,
                n;

            getElement("#glance_show_btn").addEvent("click", function (event) {
                GLANCE.Cobrowse.Visitor.startSession();
            });

            getElement("#glance_stop_btn").addEvent("click", function (event) {
                GLANCE.Cobrowse.Visitor.stopSession();
            });

            getElement("#glance_expand").addEvent("click", function (event) {
                self.setExpanded(!UIState.get(UIState.EXPANDED));
            });
            getElement("#glance_expand").ariaLabel();

            getElement("#glance_accept").addEvent("click", function (event) {
                presenceFire("terms", {
                    "status": "accepted"
                });
                self.showTerms(false);
                GLANCE.Cobrowse.Visitor.startSession(ssnbutton.startparams);
            });

            var termslink = getElement("#glance_terms_link");
            termslink.addEvent("click", function () {
                var termsdata = self.terms.getElement("#glance_terms .data");
                var termsUrl = "https://answers.usbank.com/GSSChat/CoBrowseAgreement";
                window.open(termsUrl, "_blank", "width=800,height=800,top=10,left=10,scrollbars=1");
            });

            this.terms.makeDialog("#glance_decline", function () {
                self.showTerms(false);
                presenceFire("terms", {
                    "status": "declined"
                });
            });
            this.msgbox.makeDialog("#glance_msg_ok", function () {
                self.hideMessage();
            });
        }
    SessionButton.prototype.setState = function (s) {
        this.state = s;
        for (var n = buttonStateClasses.length - 1; n >= 0; n--) // remove the two-word classes first
            this.button.removeClass(buttonStateClasses[n]);
        this.button.addClass(buttonStateClasses[s]);
    };

    SessionButton.prototype.showStarting = function () {
        (false && window.console && window.console.log && window.console.log("UI:", "SessionButton.showStarting"));
        this.hideMessage(); // hide any message left over from previous start attempt
        this.showTerms(false); // in case terms are open
        this.setState(SESSION_STARTING);
        this.setBoxState(SessionButton.BOXSTATE_STARTING);
        this.setExpanded(true);
    }

    SessionButton.prototype.showInSession = function () {
        this.setState(IN_SESSION);

        // Get rcenabled from the cookie instead of waiting for server to send it so border can be displayed
        // with correct color from the start
        if (UIState.get(UIState.RCENABLED))
            this.border.addClass("glance_rcenabled");
        getElement("#glance_ssn_key").html(GLANCE.Cobrowse.Visitor.getKey());

        this.setBoxState(UIState.get(UIState.BOXSTATE));
        this.setExpanded(UIState.get(UIState.EXPANDED));
    };

    SessionButton.BoxStates = ["starting", "integrated", "keyed", "joined", "video"];
    SessionButton.BOXSTATE_STARTING = 0;
    SessionButton.BOXSTATE_INTEGRATED = 1;
    SessionButton.BOXSTATE_KEYED = 2;
    SessionButton.BOXSTATE_JOINED = 3;
    SessionButton.BOXSTATE_VIDEO = 4;

    SessionButton.prototype.setBoxState = function (s) {
        var ssnkeybox = getElement("#glance_ssnkey_box");
        SessionButton.BoxStates.forEach(function (c) {
            ssnkeybox.removeClass(c);
        });
        ssnkeybox.addClass(SessionButton.BoxStates[s]);
        UIState.set(UIState.BOXSTATE, s);

        if (s == SessionButton.BOXSTATE_JOINED)
            getElement("#glance_ssn_info").elem.innerHTML = "You're sharing your browser.";
    }

    SessionButton.prototype.showJoinPrompt = function () {
        // Choose prompt depending on whether session key is an integrated visitorid
        this.setBoxState(GLANCE.Cobrowse.Visitor.isRandomKey() ? SessionButton.BOXSTATE_KEYED : SessionButton.BOXSTATE_INTEGRATED);
        this.setExpanded(true);
    }

    SessionButton.prototype.showSessionStopped = function () {
        this.setExpanded(false);
        this.setState(NOT_IN_SESSION);
    };

    SessionButton.prototype.showMessage = function (msg) {
        this.scrim.show();
        this.msgbox.showDialog();
        this.msgbox.getElement("#glance_msg").html(msg);
    }

    SessionButton.prototype.hideMessage = function () {
        this.msgbox.hide();
        this.msgbox.html("");
        this.scrim.hide();
    }

    SessionButton.prototype.setExpanded = function (exp) {
        (exp ? this.button.addClass : this.button.removeClass).call(this.button, "expanded");
        getElement("#glance_expand").setAttr("aria-expanded", exp);
        UIState.set(UIState.EXPANDED, exp);
    }

    SessionButton.prototype.show = function (show) {
        this.startlabel.elem.style.display = (show ? "block" : "");
    }

    SessionButton.prototype.toggle = function () {
        this.show(this.startlabel.elem.style.display === "");
    }

    function initUI() {


        if (getElement("#glance_cobrowse_btn"))
            return;
        ssnbutton = new SessionButton();

        GLANCE.Cobrowse.Visitor.addEventListener("agents", function (agentinfo) {
            // first agent has joined, hide session key message box
            if (UIState.get(UIState.BOXSTATE) < SessionButton.BOXSTATE_JOINED) {
                ssnbutton.setBoxState(SessionButton.BOXSTATE_JOINED);
                ssnbutton.setExpanded(false);
            }
        });

        GLANCE.Cobrowse.Visitor.addEventListener("reverseconfirm", function (ss) {
            ssnbutton.confirmation.show("glance_confirm_show", function () {
                ss.accept();
            }, function () {
                ss.decline();
            });
        });

        GLANCE.Cobrowse.Visitor.addEventListener("reverseended", function () {
            // Hide the reverse screenshare confirmation message box if it is still being displayed
            if (getElement('#glance_confirm_msg').elem.className.includes("glance_confirm_show"))
                ssnbutton.confirmation.hide();
        });

        function getScreenshare(screenshareView) {
            switch (screenshareView) {
                case "glance_screenshare":
                    return screenshare || (screenshare = new Screenshare());
                case "glance_agentvideo":
                    return agentvideo || (agentvideo = new AgentVideo());
            }
        }

        GLANCE.Cobrowse.Visitor.addEventListener("sessionstarting", function () {
            ssnbutton.showStarting();
            return true;
        });

        GLANCE.Cobrowse.Visitor.addEventListener("sessionstart", function () {
            ssnbutton.focus(); // for screen reader
            ssnbutton.hideMessage();
            ssnbutton.showJoinPrompt();
        });

        GLANCE.Cobrowse.Visitor.addEventListener("sessioncontinue", function () {
            ssnbutton.showInSession();
        });

        GLANCE.Cobrowse.Visitor.addEventListener("statereceived", function () {
        });

        GLANCE.Cobrowse.Visitor.addEventListener("sessionend", function () {
            ssnbutton.showSessionStopped();
        });

        GLANCE.Cobrowse.Visitor.addEventListener("error", function (err) {
            if (console && console.log) console.log("Error:", err.msg, err.params);
            var msg = err.msg; // default message
            switch (err.code) {
                case "conndrop":
                    // Failed to connect or lost connection to the session server
                    msg = "Could not connect to server <em>" + err.params.server + "</em>";
                    break;
                case "service":
                    // Failed to provision or lookup the session
                    msg = "Unable to connect to Glance";
                    break;
            }
            ssnbutton.showMessage(msg);
        });

        GLANCE.Cobrowse.Visitor.addEventListener("screenshare", function (ss) {
            getScreenshare(ss.screenshareView).show(ss);
        });

        GLANCE.Cobrowse.Visitor.addEventListener("screensharepaused", function (ss) {
            getScreenshare(ss.screenshareView).pause(ss);
        });

        GLANCE.Cobrowse.Visitor.addEventListener("screenshareresumed", function (ss) {
            getScreenshare(ss.screenshareView).resume(ss);
        });

        GLANCE.Cobrowse.Visitor.addEventListener("viewerinfo", function (v) {
            getScreenshare(v.screenshareView).viewerinfo(v);
        });

        GLANCE.Cobrowse.Visitor.addEventListener("blur", function () {
            ssnbutton.setState(SESSION_BLURRED);
            ssnbutton.show(false); // in case button was "shown"
            ssnbutton.border.hide();
        });

        GLANCE.Cobrowse.Visitor.addEventListener("focus", function () {
            ssnbutton.showInSession();
            ssnbutton.border.show();
        });

        GLANCE.Cobrowse.Visitor.addEventListener("rcrequested", function (rc) {
            function enableRC(enable) {
                return function () {
                    enable ? rc.accept() : rc.decline();
                }
            }

            ssnbutton.confirmation.show("glance_confirm_rc", enableRC(true), enableRC(false));
        });

        GLANCE.Cobrowse.Visitor.addEventListener("confirm", function (params) {
            ssnbutton.confirmation.show("glance_confirm_" + params["confirm"], params.accept);
        });

        GLANCE.Cobrowse.Visitor.addEventListener("rc", function (e) {
            (e.enabled ? ssnbutton.border.addClass : ssnbutton.border.removeClass).call(ssnbutton.border, "glance_rcenabled");

            // Cache rc enabled state in the cookie for quick access on next page
            UIState.set(UIState.RCENABLED, e.enabled);
        });

        GLANCE.Cobrowse.Visitor.addEventListener("connection", function (e) {
            ssnbutton.showDisconnected(e.status === "reconnecting");
        });

        GLANCE.Cobrowse.Visitor.addEventListener("urlstartwarning", function (w) {
            ssnbutton.confirmation.show("glance_confirm_xd", w.accept, w.decline);
        });

        // EXPORTS
        window.GLANCE.Cobrowse.VisitorUI.showTerms = function () { ssnbutton.showTerms(true); }
    }

    if (!ie8) {
        getDocument().onLoad(function () {
            // Call initUI once loader or visitor script is loaded
            if (window.GLANCE && GLANCE.Cobrowse && GLANCE.Cobrowse.Visitor)
                initUI();
            else
            {
                if (getElement("#cobrowsescript")) {//PRJ23878 - check introduced while flow coming from APPLY -> applyMM in IE11.
                    getElement("#cobrowsescript").addEvent("load", initUI);
                }
            }
        });
    }
})();


var glanceCbrUtility = (function () {
    var openTermsImpl = function () {
        var termsUrl = "https://answers.usbank.com/GSSChat/CoBrowseAgreement";
        window.open(termsUrl, "_blank", "width=800,height=800,top=10,left=10,scrollbars=1");
    }
    return {
        openTerms: openTermsImpl
    };
})();
;
(function () {
    angular
        .module('CommonModule').constant('CommonConstants', {
            METHOD_TYPE_POST: 'POST',
            METHOD_TYPE_GET: 'GET',
            METHOD_TYPE_PUT:'PUT',
            ERROR_MESSAGE: 'Unexpected Error',
            UNKNOWN_ERROR: 'The system is temporarily unavailable. Please try again later',
            STATUSCODE_SUCCESS: 0,
            TRUE: 'true',
            FALSE: 'false',
            EMPTY: '',
            HEADERDATA: { "X-Requested-With": "XMLHttpRequest" },
            ROOT_URL_DIV_TEXT: '#divRootOmniSiteUrlFromLayout',
            ROOT_SLASH: '/',
            CONTROLLERAS: 'vm',
            VOYAGERSIGNOFFURL: 'VoyagerSignoff/VoyagerSignoff',
            FORGOTANSWERTYPE: 'TemporaryAccessCode',
            STEPUP_REQUIRED: 'Please Enter an Answer',
            O_CONFIRMPRINT: 'EnrollmentConfirmPrint',
            O_CONFIRMPRINTBANKER: 'EnrollmentConfirmPrintBanker',
            SWITCH_TO_CONDUCTOR_REFACTORED_CODE: true,
            KYCVERSION18KILLSWITCH: false,
            MULTISELECT: "MultiSelect",
            SINGLESELECT: "SingleSelect",
            TEXTBOX: "TextBox",
            RADIOBUTTON: "RadioButton",
            NOSELECTION: "No Selection",
            NONE: "NONE",
            NOTEQUAL: "NotEqual",
            OTP_HEADER: 'otp',
            STEPUP_HEADER: 'stepup',
            COMMON_TRANSACTION: "commontransaction",
            GSS_CONST: {
                CCAP_Timeout: 450,
                CCAP_hdWarningTimeout: 30,
                CCAP_hdLogouturl: "/Auth/LogoutConfirmation",
                CCAP_hdKeepaliveurl: "/USB/PingImage.ashx",
                AFTOKEN: "[[AFTOKEN]]",
                EMAILUS: "EmailUs",
                ACTIVATEYOURCHECKCARD: "ActivateYourCheckCard",
                FINDPASTCHECKORDEPOSITSLIPIMAGES: "FindPastCheckorDepositSlipImages",
                DISPUTECHARGE:"DisputeACharge",
                POSTMESSGE_KMIURL: "kmiurl",
                POSTMESSGE_SEESIONENDED: "ended",
                POSTMESSGE_SEESIONSTRTED: "started",
                POSTMESSAGE_gssWindow: "gssWindow",
                POSTMESSAGE_close: "close",
                GSS_IFRAME: "IframeGSS",
                GSS_G_on: "G_on",
                GSS_T: "T",
                GSS_G_sess: "G_sess",
                GSS_G_sess_Started:"s",
                GSS_Session_Ended: "e",
                GSS_G_elg:"G_elg",
                GSS_GSSChaturl: "GSSChaturl",
                GSS_riblpid: "riblpid",
                CookieName_Window_Status: "G_stat",
                CookieName_GssChatBoxAligned: "G_alg",
                GSS_Window_Status_Maximise: "Max",
                GSS_Window_Status_Miminize: "Min",
                GSS_AUTO:"auto",
                URL_CCAP_FindPastCheckOrDepositSlipImages: "/CCAP/[[AFTOKEN]]/FindPastCheckOrDepositSlipImages",
                URL_CCAP_LandingPage: "/CCAP/LandingPage.aspx",
                URL_CCAP_ActivateCheckCard: "/CCAP/[[AFTOKEN]]/ActivateCheckCard",
                URL_CCAP_EMAILUS: "/CCAP/[[AFTOKEN]]/EmailUs",
                URL_CCAP_DisputeCharge:"/CCAP/[[AFTOKEN]]/DisputeCharge",
                URL_HelpCenter_aspx: "/HelpCenter.aspx",
                URL_USB_BASEPATH: "/USB/",
                HTML_gssUIWrapper: "gssUIWrapper",
                HTML_dummyContainer: "dummyContainer",
                HTML_chat_help: "chat_help",
                HTML_btnGSSClose: "btnGSSClose",
                HTML_helpDiv: "btnGSSLaunch"
            },
            TRANSMIT_AUTH_HEADER_EXISTS: 'transmit-token-exists',
            Gss_StaticDeepLinks: {
                GSS_REWARDCENTER: "/USB/{{AFTOKEN}}/RewardsCenterDashboard/RewardsCenterDashboard.aspx",
                GSS_PASTCHECK: "/CCAP/{{AFTOKEN}}/FindPastCheckOrDepositSlipImages",
                GSS_INTERNALPAYMENT: "/MM/{{AFTOKEN}}/PaymentsDesktop/PaymentIndex",
                GSS_TRANSFERINDEX: "/OLMM/{{AFTOKEN}}/Transfers/Index#/InternalTransfers/SingleAndRecurring/",
                GSS_BILLPAYINDEX: "/MM/{{AFTOKEN}}/BillPayment/BillPayIndex",
                GSS_SENTMONEYTOPER: "/OLMM/{{AFTOKEN}}/SendMoney/SendMoneyIndex",
                GSS_STATMENTS: "/USB/{{AFTOKEN}}/EDocsDashboard/LoadEDocsDashboard/OLS",
                GSS_PROFUPDATE: "/USB/{{AFTOKEN}}/MyProfileDashboard/MyProfileDashboardIndex",
                GSS_ACTIVATECHECKCARD: "/CCAP/{{AFTOKEN}}/ActivateCheckCard",
                GSS_EMAILUS: "/CCAP/{{AFTOKEN}}/EmailUs"
            },
            CEI_CreateProspectCustomer: "http://event/?EventName=CreateProspectCustomer&param1=",
            CEI_OpenProspectProfile: "http://event/?EventName=OpenProspectProfile&param1=",
            STEPUP_HEADER: 'stepup',
            PROFILE_API_URL: "/api/customer/v1/profiles/",
            USER_EVENT_TRACKING_URL_TOGETACTION: '/usb_usereventtrackings?$top=1&$orderby=createdon desc&$select=usb_action,usb_sessioncount,usb_isviewandedit&$filter=usb_bankerid eq ',
            USER_GUID: 'GUID',
            CRM_URL: 'CRM_URL',
            ERROR_SI_INVALID_MSG: "Please make sure that your ID Shield image phrase is between 3 and 50 characters and contains only numbers and letters. Do not use special characters, such as & or !",
            ERROR_SI_EMPTY_IMAGE_MSG: "Please select an ID Shield image or image with sound.",
            ERROR_SI_EMPTY_PHRASE: "Please enter an ID Shield image phrase.",
            DETAILED_USER_MESSAGE: "This account is currently unavailable.,Please call 855-837-1614 for help.",
            DETAILED_USER_BUTTON_TEXT: "OK",
            DELEGATED_USER_MESSAGE: "No accounts available.,We don&apos;t have accounts associated with this login.",
            DELEGATED_USER_BUTTON_TEXT: "Done",
        });
            
})();;
(function () {
    'use strict';
    angular
        .module('CommonModule')
        .factory('CommonHelper', [commonHelper]);

    function commonHelper() {
        return {
            machineAttributes: function () {
                var colorDepth = window.screen.colorDepth,
                    width = window.screen.width,
                    height = window.screen.height,
                    availWidth = window.screen.availWidth,
                    availHeight = window.screen.availHeight,
                    platform = navigator.platform,
                    userAgent = navigator.userAgent,
                    clientParms,
                    java = "No";

                if (navigator.javaEnabled() == 1)
                    java = "Yes";

                clientParms = "colorDepth=" + colorDepth +
                    "|width=" + width +
                    "|height=" + height +
                    "|availWidth=" + availWidth +
                    "|availHeight=" + availHeight +
                    "|platform=" + platform +
                    "|javaEnabled=" + java +
                    "|userAgent=" + userAgent;

                return clientParms;
            },

            Stringformat: function () {
                var formatString = arguments[0];
                for (var i = 1; i < arguments.length; i++) {
                    // "gm" = RegEx options for Global search (more than one instance) and for Multiline search
                    var regEx = new RegExp("\\{" + (i - 1) + "\\}", "gm");
                    formatString = formatString.replace(regEx, arguments[i]);
                }
                return formatString;
            },

            trimAccountName: function (transactions) {
                angular.forEach(transactions, function (transaction) {
                    var accountName = transaction.AccountDetail.AccountDisplayName;
                    var noOfCharsToTrim = 11;
                    var windowWidth = window.innerWidth;

                    if (windowWidth >= 1500) {
                        transaction.AccountDetail.AccountShortName = accountName;
                        return;
                    } else if (windowWidth >= 1100 && windowWidth < 1500) {
                        noOfCharsToTrim = 8;
                    }

                    var tailEnd = accountName.substring(accountName.indexOf('...'), accountName.length);
                    var trimmedAccountName = accountName.substring(0, accountName.indexOf('...'));
                    if (trimmedAccountName.length > noOfCharsToTrim) {
                        trimmedAccountName = trimmedAccountName.substring(0, trimmedAccountName.length - noOfCharsToTrim);
                    }
                    trimmedAccountName += tailEnd;
                    transaction.AccountDetail.AccountShortName = trimmedAccountName;
                });
            },
            nagativeAmount: function (amounts) {
                angular.forEach(amounts, function (amount) {
                    var newAmount;
                    if (amount.Amount.indexOf('(') > '-1')
                        newAmount = amount.Amount.replace('(', '-').replace(')', '');
                    else
                        newAmount = amount.Amount;
                    amount.Amount = newAmount;
                });
            },
            IsDatePresent: function (date) {
                if (date && date != '' && date != null)
                    return true;
                else
                    return false;
            },

            getAge: function (dateOfBirthString) {
                var dateOfBirth = new Date(dateOfBirthString);
                var currentDate = new Date();

                var age = currentDate.getFullYear() - dateOfBirth.getFullYear();
                dateOfBirth.setFullYear(dateOfBirth.getFullYear() + age);
                age = currentDate < dateOfBirth ? age - 1 : age;
                return age;
            },

            IsDateValid: function (date) {
                //pattern is mm/dd/yyyy where yyyy starts from 19 or 20
                var pattern = /^([1-9]|0[1-9]|1[0-2])\/([1-9]|0[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$/;
                if (Date.parse(date) && pattern.test(date)) {
                    return true;
                }
                return false;
            },

            IsDateGreaterThanCurrentDate: function (date) {
                var inputDate = new Date(date).setHours(0, 0, 0, 0);
                var currentDate = new Date().setHours(0, 0, 0, 0);
                if (currentDate > inputDate) {
                    return true;
                }
                return false;
            },
            toFloat: function (value) {
                var pattern = /\$|,|/g;

                if (value.replace)
                    return parseFloat(value.replace(pattern, "")).toFixed(2);
                else
                    return value;
            },
            browserDetection: function (isTouch, isMobileWeb) {
                //check input date compatibility.
                var browserNameArray = navigator.userAgent.split(" ");
                var browserName, browserVersion;
                var browserNameObj = {};
                for (var nameIndex in browserNameArray) {
                    if (browserNameArray[nameIndex].match(/chrome/i)) {
                        browserName = "chrome";
                        browserVersion = parseFloat(browserNameArray[nameIndex].split("/")[1]);
                        break;
                    }
                    else if (browserNameArray[nameIndex].match(/firefox/i)) {
                        browserName = "firefox";
                        browserVersion = parseFloat(browserNameArray[nameIndex].split("/")[1]);
                        break;
                    }
                    else if (browserNameArray[nameIndex].match(/rv/i)) {
                        browserName = "ie";
                       // vm.iebrowser = true;
                        browserVersion = parseFloat(browserNameArray[nameIndex].split(":")[1]);
                    }
                    else if (browserNameArray[nameIndex].match(/version/i)) {
                        browserName = "safari"
                        browserVersion = parseFloat(browserNameArray[nameIndex].split("/")[1]);
                        break;
                    }
                    else if (browserNameArray[nameIndex].match(/edge/i)) {
                        browserName = "edge";
                        break;
                    }
                    else if (browserNameArray[nameIndex].match(/iPhone|iPod|iPad|android/i)
                        && isTouch && !isMobileWeb) {
                        browserName = "DMA";
                        break;
                    }
                }
                browserNameObj = {
                    "browserName": browserName,
                    "nameIndex": nameIndex,
                    "browserVersion": browserVersion
                }
                return browserNameObj;
            }


        }

    }
})();;

(function (window, angular, undefined) {
    'use strict';

    angular.module('ngBusy.interceptor', [])
        .provider('busyInterceptor', function () {

            this.$get = ['$rootScope', '$q', function ($rootScope, $q) {
                var _total = 0, _completed = 0;

                function complete() {
                    _total = _completed = 0;
                }

                function handleResponse(r) {
                    if (r.config.notBusy) return;

                    $rootScope.$broadcast('busy.end', { url: r.config.url, name: r.config.name, remaining: _total - ++_completed });
                    if (_completed >= _total) complete();
                }

                return {
                    outstanding: function () {
                        return _total - _completed;
                    },
                    'request': function (config) {
                        if (!config.notBusy) {
                            $rootScope.$broadcast('busy.begin', { url: config.url, name: config.name });
                            _total++;
                        }
                        return config || $q.when(config);
                    },
                    'response': function (response) {
                        handleResponse(response);
                        return response;
                    },
                    'responseError': function (rejection) {
                        handleResponse(rejection);
                        return $q.reject(rejection);
                    }
                };
            }];
        })
        .config(['$httpProvider', function ($httpProvider) {
            $httpProvider.interceptors.push('busyInterceptor');
        }]);

    // minimal: <button busy="Loading..." />
    // complete: <button busy="Loading..." busy-when-url="string" busy-when-name="string" busy-add-classes="string" busy-remove-classes="string" busy-disabled="bool" not-busy-when-url="string" not-busy-when-name="string" not-busy-add-classes="string" not-busy-remove-classes="string" not-busy-disabled="bool" />

    angular.module('ngBusy.busy', [])
        .directive('busy', ['$parse', '$timeout', function ($parse, $timeout) {
            return {
                restrict: 'A',
                tranclude: true,
                scope: {},
                controller: ['$scope', function ($scope) {
                    this.setBusyMessageElement = function (element) {
                        $scope.busyMessageElement = element;
                    }
                }],
                link: function (scope, element, attrs) {
                    var cookieSpinnerstatus;
                    attrs.$observe('busy', function (val) {
                        scope.busyMessage = val;
                    });

                    attrs.$observe('busyWhenUrl', function (val) {
                        scope.busyWhenUrl = val;
                    });
                    attrs.$observe('busyWhenName', function (val) {
                        scope.busyWhenName = val;
                    });
                    attrs.$observe('busyAddClasses', function (val) {
                        scope.busyAddClasses = val;
                    });
                    attrs.$observe('busyRemoveClasses', function (val) {
                        scope.busyRemoveClasses = val;
                    });
                    attrs.$observe('busyDisabled', function (val) {
                        var parsed = $parse(val)(scope);
                        scope.busyDisabled = angular.isDefined(parsed) ? parsed : true;
                    });

                    attrs.$observe('notBusyWhenUrl', function (val) {
                        scope.notBusyWhenUrl = val;
                    });
                    attrs.$observe('notBusyWhenName', function (val) {
                        scope.notBusyWhenName = val;
                    });
                    attrs.$observe('notBusyAddClasses', function (val) {
                        scope.notBusyAddClasses = val;
                    });
                    attrs.$observe('notBusyRemoveClasses', function (val) {
                        scope.notBusyRemoveClasses = val;
                    });
                    attrs.$observe('notBusyDisabled', function (val) {
                        var parsed = $parse(val)(scope);
                        scope.notBusyDisabled = angular.isDefined(parsed) ? parsed : false;
                    });

                    var setCookie = function (cname, cvalue) {
                        var d = new Date();
                        d.setTime(d.getTime() + (24 * 60 * 60 * 1000));
                        var expires = "expires=" + d.toUTCString();
                        document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
                    };

                    var getCookie = function (name) {
                        var value = "; " + document.cookie;
                        var parts = value.split("; " + name + "=");
                        if (parts.length == 2) return parts.pop().split(";").shift();
                    };

                    var getSupressSpinnerStatus = function () {
                        try {
                            cookieSpinnerstatus = getCookie('SuppressSpinner');
                        } catch (e) {
                            setCookie("SuppressSpinner", 'false');
                            //console.log("timeoutExtender exception : " + e);
                        }
                        return cookieSpinnerstatus;
                    };

                    scope.isBusyFor = function (config, begin) {
                        var key;
                        if (scope[(key = begin ? 'busyWhenName' : 'notBusyWhenName')]) return !!config.name && !!config.name.match(scope[key]);
                        else if (scope[(key = begin ? 'busyWhenUrl' : 'notBusyWhenUrl')]) return !!config.url && !!config.url.match(scope[key]);
                        else return begin === true || config.remaining <= 0;
                    };

                    scope.$on('busy.begin', function (evt, config) {
                        if (!scope.busy && scope.isBusyFor(config, true)) {
                            scope.originalContent = element.html();
                            if (scope.busyDisabled) $timeout(function () { element.attr('disabled', true); });
                            var msgElement = scope.busyMessageElement ? scope.busyMessageElement.clone() : null;
                            if (msgElement || scope.busyMessage) element.html('').append(msgElement || scope.busyMessage);


                            var shouldNotSpin = getSupressSpinnerStatus();
                            if (shouldNotSpin === undefined || shouldNotSpin === null
                              || shouldNotSpin == "" || shouldNotSpin == 'false') {
                                element.removeClass(scope.busyRemoveClasses).addClass(scope.busyAddClasses);
                                var loadSpinner = document.getElementById('spinnerLoader');
                                if (loadSpinner) {
                                    loadSpinner.setAttribute('tabindex', '0');
                                    loadSpinner.focus();
                                }
                            }

                            scope.busy = true;
                        }
                    });

                    scope.$on('busy.end', function (evt, config) {
                        if (scope.busy && scope.isBusyFor(config)) {
                            if (scope.originalContent) element.html(scope.originalContent);
                            element.attr('disabled', scope.notBusyDisabled === true);
                            var shouldNotSpin = getSupressSpinnerStatus();
                            if (shouldNotSpin === undefined || shouldNotSpin === null
                              || shouldNotSpin == "" || shouldNotSpin == 'false') {

                                element.removeClass(scope.notBusyRemoveClasses).addClass(scope.notBusyAddClasses);
                            }
                            else {
                                try {
                                    setCookie("SuppressSpinner", 'false');
                                } catch (e) {                                   
                                    //console.log("timeoutExtender exception : " + e);
                                }
                            }

                            scope.busy = false;
                        }
                    });
                }
            }
        }])
         .directive('busyMessage', function () {
             return {
                 restrict: 'AE',
                 transclude: true,
                 require: '^busy',
                 template: '',
                 replace: true,
                 compile: function (element, attr, transclude) {
                     // we're basically going to transclude the content, strip it, and set the busy message as the resulting transcluded HTML via the controller setBusyMessageElement function
                     return function link(scope, element, attr, busyCtrl) {
                         busyCtrl.setBusyMessageElement(transclude(scope, function () { }));
                     }
                 }
             }
         });

    angular.module('ngBusy', ['ngBusy.interceptor', 'ngBusy.busy']);
})(window, window.angular);;
/**
 * @license AngularJS v1.4.0
 * (c) 2010-2015 Google, Inc. http://angularjs.org
 * License: MIT
 */
(function (window, angular, undefined) {
    'use strict';

    /**
     * @ngdoc module
     * @name ngTouch
     * @description
     *
     * # ngTouch
     *
     * The `ngTouch` module provides touch events and other helpers for touch-enabled devices.
     * The implementation is based on jQuery Mobile touch event handling
     * ([jquerymobile.com](http://jquerymobile.com/)).
     *
     *
     * See {@link ngTouch.$swipe `$swipe`} for usage.
     *
     * <div doc-module-components="ngTouch"></div>
     *
     */

    // define ngTouch module
    /* global -ngTouch */
    var ngTouch = angular.module('ngTouch', []);

    function nodeName_(element) {
        return angular.lowercase(element.nodeName || (element[0] && element[0].nodeName));
    }

    /* global ngTouch: false */

    /**
     * @ngdoc service
     * @name $swipe
     *
     * @description
     * The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe
     * behavior, to make implementing swipe-related directives more convenient.
     *
     * Requires the {@link ngTouch `ngTouch`} module to be installed.
     *
     * `$swipe` is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngTouch`, and by
     * `ngCarousel` in a separate component.
     *
     * # Usage
     * The `$swipe` service is an object with a single method: `bind`. `bind` takes an element
     * which is to be watched for swipes, and an object with four handler functions. See the
     * documentation for `bind` below.
     */

    ngTouch.factory('$swipe', [function () {
        // The total distance in any direction before we make the call on swipe vs. scroll.
        var MOVE_BUFFER_RADIUS = 10;

        var POINTER_EVENTS = {
            'mouse': {
                start: 'mousedown',
                move: 'mousemove',
                end: 'mouseup'
            },
            'touch': {
                start: 'touchstart',
                move: 'touchmove',
                end: 'touchend',
                cancel: 'touchcancel'
            }
        };

        function getCoordinates(event) {
            var originalEvent = event.originalEvent || event;
            var touches = originalEvent.touches && originalEvent.touches.length ? originalEvent.touches : [originalEvent];
            var e = (originalEvent.changedTouches && originalEvent.changedTouches[0]) || touches[0];

            return {
                x: e.clientX,
                y: e.clientY
            };
        }

        function getEvents(pointerTypes, eventType) {
            var res = [];
            angular.forEach(pointerTypes, function (pointerType) {
                var eventName = POINTER_EVENTS[pointerType][eventType];
                if (eventName) {
                    res.push(eventName);
                }
            });
            return res.join(' ');
        }

        return {
            /**
             * @ngdoc method
             * @name $swipe#bind
             *
             * @description
             * The main method of `$swipe`. It takes an element to be watched for swipe motions, and an
             * object containing event handlers.
             * The pointer types that should be used can be specified via the optional
             * third argument, which is an array of strings `'mouse'` and `'touch'`. By default,
             * `$swipe` will listen for `mouse` and `touch` events.
             *
             * The four events are `start`, `move`, `end`, and `cancel`. `start`, `move`, and `end`
             * receive as a parameter a coordinates object of the form `{ x: 150, y: 310 }`.
             *
             * `start` is called on either `mousedown` or `touchstart`. After this event, `$swipe` is
             * watching for `touchmove` or `mousemove` events. These events are ignored until the total
             * distance moved in either dimension exceeds a small threshold.
             *
             * Once this threshold is exceeded, either the horizontal or vertical delta is greater.
             * - If the horizontal distance is greater, this is a swipe and `move` and `end` events follow.
             * - If the vertical distance is greater, this is a scroll, and we let the browser take over.
             *   A `cancel` event is sent.
             *
             * `move` is called on `mousemove` and `touchmove` after the above logic has determined that
             * a swipe is in progress.
             *
             * `end` is called when a swipe is successfully completed with a `touchend` or `mouseup`.
             *
             * `cancel` is called either on a `touchcancel` from the browser, or when we begin scrolling
             * as described above.
             *
             */
            bind: function (element, eventHandlers, pointerTypes) {
                // Absolute total movement, used to control swipe vs. scroll.
                var totalX, totalY;
                // Coordinates of the start position.
                var startCoords;
                // Last event's position.
                var lastPos;
                // Whether a swipe is active.
                var active = false;

                pointerTypes = pointerTypes || ['mouse', 'touch'];
                element.on(getEvents(pointerTypes, 'start'), function (event) {
                    startCoords = getCoordinates(event);
                    active = true;
                    totalX = 0;
                    totalY = 0;
                    lastPos = startCoords;
                    eventHandlers['start'] && eventHandlers['start'](startCoords, event);
                });
                var events = getEvents(pointerTypes, 'cancel');
                if (events) {
                    element.on(events, function (event) {
                        active = false;
                        eventHandlers['cancel'] && eventHandlers['cancel'](event);
                    });
                }

                element.on(getEvents(pointerTypes, 'move'), function (event) {
                    if (!active) return;

                    // Android will send a touchcancel if it thinks we're starting to scroll.
                    // So when the total distance (+ or - or both) exceeds 10px in either direction,
                    // we either:
                    // - On totalX > totalY, we send preventDefault() and treat this as a swipe.
                    // - On totalY > totalX, we let the browser handle it as a scroll.

                    if (!startCoords) return;
                    var coords = getCoordinates(event);

                    totalX += Math.abs(coords.x - lastPos.x);
                    totalY += Math.abs(coords.y - lastPos.y);

                    lastPos = coords;

                    if (totalX < MOVE_BUFFER_RADIUS && totalY < MOVE_BUFFER_RADIUS) {
                        return;
                    }

                    // One of totalX or totalY has exceeded the buffer, so decide on swipe vs. scroll.
                    if (totalY > totalX) {
                        // Allow native scrolling to take over.
                        active = false;
                        eventHandlers['cancel'] && eventHandlers['cancel'](event);
                        return;
                    } else {
                        // Prevent the browser from scrolling.
                        event.preventDefault();
                        eventHandlers['move'] && eventHandlers['move'](coords, event);
                    }
                });

                element.on(getEvents(pointerTypes, 'end'), function (event) {
                    if (!active) return;
                    active = false;
                    eventHandlers['end'] && eventHandlers['end'](getCoordinates(event), event);
                });
            }
        };
    }]);

    /* global ngTouch: false,
      nodeName_: false
    */

    /**
     * @ngdoc directive
     * @name ngClick
     *
     * @description
     * A more powerful replacement for the default ngClick designed to be used on touchscreen
     * devices. Most mobile browsers wait about 300ms after a tap-and-release before sending
     * the click event. This version handles them immediately, and then prevents the
     * following click event from propagating.
     *
     * Requires the {@link ngTouch `ngTouch`} module to be installed.
     *
     * This directive can fall back to using an ordinary click event, and so works on desktop
     * browsers as well as mobile.
     *
     * This directive also sets the CSS class `ng-click-active` while the element is being held
     * down (by a mouse click or touch) so you can restyle the depressed element if you wish.
     *
     * @element ANY
     * @param {expression} ngClick {@link guide/expression Expression} to evaluate
     * upon tap. (Event object is available as `$event`)
     *
     * @example
        <example module="ngClickExample" deps="angular-touch.js">
          <file name="index.html">
            <button ng-click="count = count + 1" ng-init="count=0">
              Increment
            </button>
            count: {{ count }}
          </file>
          <file name="script.js">
            angular.module('ngClickExample', ['ngTouch']);
          </file>
        </example>
     */

    ngTouch.config(['$provide', function ($provide) {
        $provide.decorator('ngClickDirective', ['$delegate', function ($delegate) {
            // drop the default ngClick directive
            $delegate.shift();
            return $delegate;
        }]);
    }]);

    ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
        function ($parse, $timeout, $rootElement) {
            var TAP_DURATION = 750; // Shorter than 750ms is a tap, longer is a taphold or drag.
            var MOVE_TOLERANCE = 12; // 12px seems to work in most mobile browsers.
            var PREVENT_DURATION = 2500; // 2.5 seconds maximum from preventGhostClick call to click
            var CLICKBUSTER_THRESHOLD = 25; // 25 pixels in any dimension is the limit for busting clicks.

            var ACTIVE_CLASS_NAME = 'ng-click-active';
            var lastPreventedTime;
            var touchCoordinates;
            var lastLabelClickCoordinates;


            // TAP EVENTS AND GHOST CLICKS
            //
            // Why tap events?
            // Mobile browsers detect a tap, then wait a moment (usually ~300ms) to see if you're
            // double-tapping, and then fire a click event.
            //
            // This delay sucks and makes mobile apps feel unresponsive.
            // So we detect touchstart, touchcancel and touchend ourselves and determine when
            // the user has tapped on something.
            //
            // What happens when the browser then generates a click event?
            // The browser, of course, also detects the tap and fires a click after a delay. This results in
            // tapping/clicking twice. We do "clickbusting" to prevent it.
            //
            // How does it work?
            // We attach global touchstart and click handlers, that run during the capture (early) phase.
            // So the sequence for a tap is:
            // - global touchstart: Sets an "allowable region" at the point touched.
            // - element's touchstart: Starts a touch
            // (- touchcancel ends the touch, no click follows)
            // - element's touchend: Determines if the tap is valid (didn't move too far away, didn't hold
            //   too long) and fires the user's tap handler. The touchend also calls preventGhostClick().
            // - preventGhostClick() removes the allowable region the global touchstart created.
            // - The browser generates a click event.
            // - The global click handler catches the click, and checks whether it was in an allowable region.
            //     - If preventGhostClick was called, the region will have been removed, the click is busted.
            //     - If the region is still there, the click proceeds normally. Therefore clicks on links and
            //       other elements without ngTap on them work normally.
            //
            // This is an ugly, terrible hack!
            // Yeah, tell me about it. The alternatives are using the slow click events, or making our users
            // deal with the ghost clicks, so I consider this the least of evils. Fortunately Angular
            // encapsulates this ugly logic away from the user.
            //
            // Why not just put click handlers on the element?
            // We do that too, just to be sure. If the tap event caused the DOM to change,
            // it is possible another element is now in that position. To take account for these possibly
            // distinct elements, the handlers are global and care only about coordinates.

            // Checks if the coordinates are close enough to be within the region.
            function hit(x1, y1, x2, y2) {
                return Math.abs(x1 - x2) < CLICKBUSTER_THRESHOLD && Math.abs(y1 - y2) < CLICKBUSTER_THRESHOLD;
            }

            // Checks a list of allowable regions against a click location.
            // Returns true if the click should be allowed.
            // Splices out the allowable region from the list after it has been used.
            function checkAllowableRegions(touchCoordinates, x, y) {
                for (var i = 0; i < touchCoordinates.length; i += 2) {
                    if (hit(touchCoordinates[i], touchCoordinates[i + 1], x, y)) {
                        touchCoordinates.splice(i, i + 2);
                        return true; // allowable region
                    }
                }
                return false; // No allowable region; bust it.
            }

            // Global click handler that prevents the click if it's in a bustable zone and preventGhostClick
            // was called recently.
            function onClick(event) {
                if (Date.now() - lastPreventedTime > PREVENT_DURATION) {
                    return; // Too old.
                }

                var touches = event.touches && event.touches.length ? event.touches : [event];
                var x = touches[0].clientX;
                var y = touches[0].clientY;
                // Work around desktop Webkit quirk where clicking a label will fire two clicks (on the label
                // and on the input element). Depending on the exact browser, this second click we don't want
                // to bust has either (0,0), negative coordinates, or coordinates equal to triggering label
                // click event
                if (x < 1 && y < 1) {
                    return; // offscreen
                }
                if (lastLabelClickCoordinates &&
                    lastLabelClickCoordinates[0] === x && lastLabelClickCoordinates[1] === y) {
                    return; // input click triggered by label click
                }
                // reset label click coordinates on first subsequent click
                if (lastLabelClickCoordinates) {
                    lastLabelClickCoordinates = null;
                }
                // remember label click coordinates to prevent click busting of trigger click event on input
                if (nodeName_(event.target) === 'label') {
                    lastLabelClickCoordinates = [x, y];
                }

                // Look for an allowable region containing this click.
                // If we find one, that means it was created by touchstart and not removed by
                // preventGhostClick, so we don't bust it.
                if (checkAllowableRegions(touchCoordinates, x, y)) {
                    return;
                }

                // If we didn't find an allowable region, bust the click.
                event.stopPropagation();
                event.preventDefault();

                // Blur focused form elements
                event.target && event.target.blur && event.target.blur();
            }


            // Global touchstart handler that creates an allowable region for a click event.
            // This allowable region can be removed by preventGhostClick if we want to bust it.
            function onTouchStart(event) {
                var touches = event.touches && event.touches.length ? event.touches : [event];
                var x = touches[0].clientX;
                var y = touches[0].clientY;
                touchCoordinates.push(x, y);

                $timeout(function () {
                    // Remove the allowable region.
                    for (var i = 0; i < touchCoordinates.length; i += 2) {
                        if (touchCoordinates[i] == x && touchCoordinates[i + 1] == y) {
                            touchCoordinates.splice(i, i + 2);
                            return;
                        }
                    }
                }, PREVENT_DURATION, false);
            }

            // On the first call, attaches some event handlers. Then whenever it gets called, it creates a
            // zone around the touchstart where clicks will get busted.
            function preventGhostClick(x, y) {
                if (!touchCoordinates) {
                    $rootElement[0].addEventListener('click', onClick, true);
                    $rootElement[0].addEventListener('touchstart', onTouchStart, true);
                    touchCoordinates = [];
                }

                lastPreventedTime = Date.now();

                checkAllowableRegions(touchCoordinates, x, y);
            }

            // Actual linking function.
            return function (scope, element, attr) {
                var clickHandler = $parse(attr.ngClick),
                    tapping = false,
                    tapElement,  // Used to blur the element after a tap.
                    startTime,   // Used to check if the tap was held too long.
                    touchStartX,
                    touchStartY;

                function resetState() {
                    tapping = false;
                    element.removeClass(ACTIVE_CLASS_NAME);
                }

                element.on('touchstart', function (event) {
                    tapping = true;
                    tapElement = event.target ? event.target : event.srcElement; // IE uses srcElement.
                    // Hack for Safari, which can target text nodes instead of containers.
                    if (tapElement.nodeType == 3) {
                        tapElement = tapElement.parentNode;
                    }

                    element.addClass(ACTIVE_CLASS_NAME);

                    startTime = Date.now();

                    // Use jQuery originalEvent
                    var originalEvent = event.originalEvent || event;
                    var touches = originalEvent.touches && originalEvent.touches.length ? originalEvent.touches : [originalEvent];
                    var e = touches[0];
                    touchStartX = e.clientX;
                    touchStartY = e.clientY;
                });

                element.on('touchcancel', function (event) {
                    resetState();
                });

                element.on('touchend', function (event) {
                    var diff = Date.now() - startTime;

                    // Use jQuery originalEvent
                    var originalEvent = event.originalEvent || event;
                    var touches = (originalEvent.changedTouches && originalEvent.changedTouches.length) ?
                        originalEvent.changedTouches :
                        ((originalEvent.touches && originalEvent.touches.length) ? originalEvent.touches : [originalEvent]);
                    var e = touches[0];
                    var x = e.clientX;
                    var y = e.clientY;
                    var dist = Math.sqrt(Math.pow(x - touchStartX, 2) + Math.pow(y - touchStartY, 2));

                    if (tapping && diff < TAP_DURATION && dist < MOVE_TOLERANCE) {
                        // Call preventGhostClick so the clickbuster will catch the corresponding click.
                        preventGhostClick(x, y);

                        // Blur the focused element (the button, probably) before firing the callback.
                        // This doesn't work perfectly on Android Chrome, but seems to work elsewhere.
                        // I couldn't get anything to work reliably on Android Chrome.
                        if (tapElement) {
                            tapElement.blur();
                        }

                        if (!angular.isDefined(attr.disabled) || attr.disabled === false) {
                            element.triggerHandler('click', [event]);
                        }
                    }

                    resetState();
                });

                // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click
                // something else nearby.
                element.onclick = function (event) { };

                // Actual click handler.
                // There are three different kinds of clicks, only two of which reach this point.
                // - On desktop browsers without touch events, their clicks will always come here.
                // - On mobile browsers, the simulated "fast" click will call this.
                // - But the browser's follow-up slow click will be "busted" before it reaches this handler.
                // Therefore it's safe to use this directive on both mobile and desktop.
                element.on('click', function (event, touchend) {
                    scope.$apply(function () {
                        clickHandler(scope, { $event: (touchend || event) });
                    });
                });

                element.on('mousedown', function (event) {
                    element.addClass(ACTIVE_CLASS_NAME);
                });

                element.on('mousemove mouseup', function (event) {
                    element.removeClass(ACTIVE_CLASS_NAME);
                });

            };
        }]);

    /* global ngTouch: false */

    /**
     * @ngdoc directive
     * @name ngSwipeLeft
     *
     * @description
     * Specify custom behavior when an element is swiped to the left on a touchscreen device.
     * A leftward swipe is a quick, right-to-left slide of the finger.
     * Though ngSwipeLeft is designed for touch-based devices, it will work with a mouse click and drag
     * too.
     *
     * To disable the mouse click and drag functionality, add `ng-swipe-disable-mouse` to
     * the `ng-swipe-left` or `ng-swipe-right` DOM Element.
     *
     * Requires the {@link ngTouch `ngTouch`} module to be installed.
     *
     * @element ANY
     * @param {expression} ngSwipeLeft {@link guide/expression Expression} to evaluate
     * upon left swipe. (Event object is available as `$event`)
     *
     * @example
        <example module="ngSwipeLeftExample" deps="angular-touch.js">
          <file name="index.html">
            <div ng-show="!showActions" ng-swipe-left="showActions = true">
              Some list content, like an email in the inbox
            </div>
            <div ng-show="showActions" ng-swipe-right="showActions = false">
              <button ng-click="reply()">Reply</button>
              <button ng-click="delete()">Delete</button>
            </div>
          </file>
          <file name="script.js">
            angular.module('ngSwipeLeftExample', ['ngTouch']);
          </file>
        </example>
     */

    /**
     * @ngdoc directive
     * @name ngSwipeRight
     *
     * @description
     * Specify custom behavior when an element is swiped to the right on a touchscreen device.
     * A rightward swipe is a quick, left-to-right slide of the finger.
     * Though ngSwipeRight is designed for touch-based devices, it will work with a mouse click and drag
     * too.
     *
     * Requires the {@link ngTouch `ngTouch`} module to be installed.
     *
     * @element ANY
     * @param {expression} ngSwipeRight {@link guide/expression Expression} to evaluate
     * upon right swipe. (Event object is available as `$event`)
     *
     * @example
        <example module="ngSwipeRightExample" deps="angular-touch.js">
          <file name="index.html">
            <div ng-show="!showActions" ng-swipe-left="showActions = true">
              Some list content, like an email in the inbox
            </div>
            <div ng-show="showActions" ng-swipe-right="showActions = false">
              <button ng-click="reply()">Reply</button>
              <button ng-click="delete()">Delete</button>
            </div>
          </file>
          <file name="script.js">
            angular.module('ngSwipeRightExample', ['ngTouch']);
          </file>
        </example>
     */

    function makeSwipeDirective(directiveName, direction, eventName) {
        ngTouch.directive(directiveName, ['$parse', '$swipe', function ($parse, $swipe) {
            // The maximum vertical delta for a swipe should be less than 75px.
            var MAX_VERTICAL_DISTANCE = 75;
            // Vertical distance should not be more than a fraction of the horizontal distance.
            var MAX_VERTICAL_RATIO = 0.3;
            // At least a 30px lateral motion is necessary for a swipe.
            var MIN_HORIZONTAL_DISTANCE = 30;

            return function (scope, element, attr) {
                var swipeHandler = $parse(attr[directiveName]);

                var startCoords, valid;

                function validSwipe(coords) {
                    // Check that it's within the coordinates.
                    // Absolute vertical distance must be within tolerances.
                    // Horizontal distance, we take the current X - the starting X.
                    // This is negative for leftward swipes and positive for rightward swipes.
                    // After multiplying by the direction (-1 for left, +1 for right), legal swipes
                    // (ie. same direction as the directive wants) will have a positive delta and
                    // illegal ones a negative delta.
                    // Therefore this delta must be positive, and larger than the minimum.
                    if (!startCoords) return false;
                    var deltaY = Math.abs(coords.y - startCoords.y);
                    var deltaX = (coords.x - startCoords.x) * direction;
                    return valid && // Short circuit for already-invalidated swipes.
                        deltaY < MAX_VERTICAL_DISTANCE &&
                        deltaX > 0 &&
                        deltaX > MIN_HORIZONTAL_DISTANCE &&
                        deltaY / deltaX < MAX_VERTICAL_RATIO;
                }

                var pointerTypes = ['touch'];
                if (!angular.isDefined(attr['ngSwipeDisableMouse'])) {
                    pointerTypes.push('mouse');
                }
                $swipe.bind(element, {
                    'start': function (coords, event) {
                        startCoords = coords;
                        valid = true;
                    },
                    'cancel': function (event) {
                        valid = false;
                    },
                    'end': function (coords, event) {
                        if (validSwipe(coords)) {
                            scope.$apply(function () {
                                element.triggerHandler(eventName);
                                swipeHandler(scope, { $event: event });
                            });
                        }
                    }
                }, pointerTypes);
            };
        }]);
    }

    // Left is negative X-coordinate, right is positive.
    makeSwipeDirective('ngSwipeLeft', -1, 'swipeleft');
    makeSwipeDirective('ngSwipeRight', 1, 'swiperight');



})(window, window.angular);
;
!function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.__tarsusInterfaceName="InputResponseType",e}();e.InputResponseType=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.__tarsusInterfaceName="AuthenticationActionParameter",e}();e.AuthenticationActionParameter=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={}));var __extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getAuthenticatorInput=function(){return this._authenticatorInput},n.prototype.setAuthenticatorInput=function(e){this._authenticatorInput=e},n.prototype.getSelectedTargets=function(){return this._selectedTargets},n.prototype.setSelectedTargets=function(e){this._selectedTargets=e},n.createAuthenticatorInput=function(t){return e.ts.mobile.sdk.impl.TargetBasedAuthenticatorInputImpl.createAuthenticatorInput(t)},n.createTargetSelectionRequest=function(t){return e.ts.mobile.sdk.impl.TargetBasedAuthenticatorInputImpl.createTargetSelectionRequest(t)},n.createTargetsSelectionRequest=function(t){return e.ts.mobile.sdk.impl.TargetBasedAuthenticatorInputImpl.createTargetsSelectionRequest(t)},n.__tarsusInterfaceName="TargetBasedAuthenticatorInput",n}(t.InputResponseType);t.TargetBasedAuthenticatorInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="OtpInput",t}(e.InputResponseType);e.OtpInput=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSuccessResponse=function(t){return e.ts.mobile.sdk.impl.PlaceholderInputResponseImpl.createSuccessResponse(t)},n.createdFailedResponse=function(t,n){return e.ts.mobile.sdk.impl.PlaceholderInputResponseImpl.createdFailedResponse(t,n)},n.createFailedResponseWithServerProvidedStatus=function(t){return e.ts.mobile.sdk.impl.PlaceholderInputResponseImpl.createFailedResponseWithServerProvidedStatus(t)},n.__tarsusInterfaceName="PlaceholderInputResponse",n}(t.InputResponseType);t.PlaceholderInputResponse=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.__tarsusInterfaceName="PushRequestPayload",e}();e.PushRequestPayload=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSuccessResponse=function(t){return e.ts.mobile.sdk.impl.FidoInputResponseImpl.createSuccessResponse(t)},n.createdFailedResponse=function(t,n){return e.ts.mobile.sdk.impl.FidoInputResponseImpl.createdFailedResponse(t,n)},n.__tarsusInterfaceName="FidoInputResponse",n}(t.InputResponseType);t.FidoInputResponse=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createWithUserId=function(t){return e.ts.mobile.sdk.impl.MobileApprovePushRequestPayloadImpl.createWithUserId(t)},n.createWithUserTicket=function(t){return e.ts.mobile.sdk.impl.MobileApprovePushRequestPayloadImpl.createWithUserTicket(t)},n.createWithJsonPayload=function(t){return e.ts.mobile.sdk.impl.MobileApprovePushRequestPayloadImpl.createWithJsonPayload(t)},n.__tarsusInterfaceName="MobileApprovePushRequestPayload",n}(t.PushRequestPayload);t.MobileApprovePushRequestPayload=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSecurityQuestionAnswersInputResponse=function(t){return e.ts.mobile.sdk.impl.SecurityQuestionInputResponseImpl.createSecurityQuestionAnswersInputResponse(t)},n.__tarsusInterfaceName="SecurityQuestionInputResponse",n}(t.InputResponseType);t.SecurityQuestionInputResponse=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getAnswerText=function(){return this._answerText},t.createWithText=function(t){return e.ts.mobile.sdk.impl.SecurityQuestionAnswerImpl.createWithText(t)},t.__tarsusInterfaceName="SecurityQuestionAnswer",t}();t.SecurityQuestionAnswer=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getQuestion=function(){return this._question},t.prototype.getAnswer=function(){return this._answer},t.createAnswerToQuestion=function(t,n){return e.ts.mobile.sdk.impl.SecurityQuestionAndAnswerImpl.createAnswerToQuestion(t,n)},t.__tarsusInterfaceName="SecurityQuestionAndAnswer",t}();t.SecurityQuestionAndAnswer=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getAssertionData=function(){return this._assertionData},e.prototype.setAssertionData=function(e){this._assertionData=e},e.prototype.getStoredData=function(){return this._storedData},e.prototype.setStoredData=function(e){this._storedData=e},e.__tarsusInterfaceName="TotpProvisionOutput",e}();e.TotpProvisionOutput=t}(e.tarsusplugin||(e.tarsusplugin={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t){this._stepTag=e,this._passphraseText=t}return e.prototype.getStepTag=function(){return this._stepTag},e.prototype.getAcquisitionChallenges=function(){return[]},e.prototype.getPassphraseText=function(){return this._passphraseText},e.__tarsusInterfaceName="AudioAcquisitionStepDescription",e}();e.AudioAcquisitionStepDescriptionImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getTarget=function(){return this._target},n.create=function(t){return e.ts.mobile.sdk.impl.AuthenticationActionParameterTargetSelectionImpl.create(t)},n.__tarsusInterfaceName="AuthenticationActionParameterTargetSelection",n}(t.AuthenticationActionParameter);t.AuthenticationActionParameterTargetSelection=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(t){var n=e.call(this)||this;return n._target=t,n}return __extends(t,e),t.create=function(e){return new t(e)},t.__tarsusInterfaceName="AuthenticationActionParameterTargetSelection",t}(e.AuthenticationActionParameterTargetSelection),t.AuthenticationActionParameterTargetSelectionImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getErrorCode=function(){return this._errorCode},t.prototype.getMessage=function(){return this._message},t.prototype.getData=function(){return this._data},t.createApplicationGeneratedGeneralError=function(t,n){return e.ts.mobile.sdk.impl.AuthenticationErrorImpl.createApplicationGeneratedGeneralError(t,n)},t.createApplicationGeneratedCommunicationError=function(t,n){return e.ts.mobile.sdk.impl.AuthenticationErrorImpl.createApplicationGeneratedCommunicationError(t,n)},t.__tarsusInterfaceName="AuthenticationError",t}();t.AuthenticationError=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={}));var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};!function(e){!function(e){!function(e){var t,n,r;t=e.sdk||(e.sdk={}),n=t.impl||(t.impl={}),r=function(r){function i(e,t,n){var i=r.call(this)||this;return i._errorCode=e,i._message=t,i._data=__assign({},n||{},{public_properties:{}}),i}return __extends(i,r),i.errorForServerResponse=function(e){var n={server_error_code:e.error_code,server_error_message:e.error_message,server_error_data:e.data},r=e.error_message||"Internal error",o=t.AuthenticationErrorCode.Internal;switch(e.error_code){case 2009:o=t.AuthenticationErrorCode.DeviceNotFound;break;case 28:var a=new i(t.AuthenticationErrorCode.InvalidIdToken,r);return a.setPublicProperty(t.AuthenticationErrorProperty.InvalidIdTokenErrorReason,t.AuthenticationErrorPropertySymbol.InvalidIdTokenErrorReasonBadToken),a;case 29:return(a=new i(t.AuthenticationErrorCode.InvalidIdToken,r)).setPublicProperty(t.AuthenticationErrorProperty.InvalidIdTokenErrorReason,t.AuthenticationErrorPropertySymbol.InvalidIdTokenErrorReasonExpiredToken),a;case 3001:case 3002:o=t.AuthenticationErrorCode.InvalidDeviceBinding;break;case 4e3:case 4002:o=t.AuthenticationErrorCode.ControlFlowExpired;break;case 4005:case 4006:o=t.AuthenticationErrorCode.SessionRequired;break;case 6001:case 6002:o=t.AuthenticationErrorCode.ApprovalWrongState}return new i(o,r,n)},i.createApplicationGeneratedGeneralError=function(e,n){return new i(t.AuthenticationErrorCode.Internal,e,n)},i.createApplicationGeneratedCommunicationError=function(e,n){return new i(t.AuthenticationErrorCode.Communication,e,n)},i.errorForSessionRejectionFailureData=function(e){var n=t.AuthenticationErrorCode.PolicyRejection,r="Session rejected by server.",o={failure_data:e};if(e&&e.source)switch(e.reason&&e.reason.type){case t.core.Protocol.FailureReasonType.ApprovalExpired:n=t.AuthenticationErrorCode.ApprovalWrongState,r="Approval expired.",o.approval_state="expired"}return new i(n,r,o)},i.errorForHostInternalBiometricErrorData=function(r,i){var o;switch(r[e.sdkhost.ErrorDataInternalError]){case e.sdkhost.InternalErrorBiometricInvalidated:o=new n.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorInvalidated,i+" registration invalidated.");break;case e.sdkhost.InternalErrorWrongBiometric:o=new n.AuthenticationErrorImpl(t.AuthenticationErrorCode.InvalidInput,"Invalid "+i+" was input.");break;case e.sdkhost.InternalErrorBiometricNotConfigured:(o=new n.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorExternalConfigError,i+" not configured on this device.")).setPublicProperty(t.AuthenticationErrorProperty.AuthenticatorExternalConfigErrorReason,t.AuthenticationErrorPropertySymbol.AuthenticatorExternalConfigErrorReasonBiometricsNotEnrolled);break;case e.sdkhost.InternalErrorBiometricOsLockTemporary:(o=new n.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorExternalConfigError,i+" authentication is temporarily locked by the OS.")).setPublicProperty(t.AuthenticationErrorProperty.AuthenticatorExternalConfigErrorReason,t.AuthenticationErrorPropertySymbol.AuthenticatorExternalConfigErrorReasonBiometricsOsLockTemporary);break;case e.sdkhost.InternalErrorBiometricOsLockPermanent:(o=new n.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorExternalConfigError,i+" authentication is permanently locked by the OS.")).setPublicProperty(t.AuthenticationErrorProperty.AuthenticatorExternalConfigErrorReason,t.AuthenticationErrorPropertySymbol.AuthenticatorExternalConfigErrorReasonBiometricsOsLockPermanent);break;default:o=null}return o},i.prototype.setPublicProperty=function(e,n){this._data.public_properties[t.AuthenticationErrorProperty[e]]=n},i.prototype.getPublicProperty=function(e){return this._data.public_properties[t.AuthenticationErrorProperty[e]]},i.prototype.getPublicBooleanProperty=function(e){var n=this.getPublicProperty(e);if(n&&"boolean"!=typeof n)throw new i(t.AuthenticationErrorCode.AppImplementation,"type of property "+t.AuthenticationErrorProperty[e]+" is not 'boolean'");return n},i.prototype.getPublicNumberProperty=function(e){var n=this.getPublicProperty(e);if(n&&"number"!=typeof n)throw new i(t.AuthenticationErrorCode.AppImplementation,"type of property "+t.AuthenticationErrorProperty[e]+" is not 'number'");return n},i.prototype.getPublicStringProperty=function(e){var n=this.getPublicProperty(e);if(n&&"string"!=typeof n)throw new i(t.AuthenticationErrorCode.AppImplementation,"type of property "+t.AuthenticationErrorProperty[e]+" is not 'string'");return n},i.prototype.getPublicSymbolicProperty=function(e){var n=this.getPublicProperty(e);if(n&&!t.AuthenticationErrorProperty[e])throw new i(t.AuthenticationErrorCode.AppImplementation,"type of property "+t.AuthenticationErrorProperty[e]+" is not 'AuthenticationErrorPropertySymbol'");return n},i.prototype.toString=function(){return"AuthenticationError<"+t.AuthenticationErrorCode[this._errorCode]+", "+this._message+", "+JSON.stringify(this._data)+">"},i.errorForAssertionResponse=function(e){var n;switch(e.assertion_error_code){case t.core.Protocol.AssertionErrorCode.FailedAssertion:n=t.AuthenticationErrorCode.InvalidInput;break;case t.core.Protocol.AssertionErrorCode.MethodLocked:n=t.AuthenticationErrorCode.AuthenticatorLocked;break;case t.core.Protocol.AssertionErrorCode.HistoryRepeat:n=t.AuthenticationErrorCode.RegisteredSecretAlreadyInHistory;break;default:n=t.AuthenticationErrorCode.Internal}var r={assertion_error_code:e.assertion_error_code,additional_data:e.data};return new i(n,e.assertion_error_message||"Assertion error code "+e.assertion_error_code,r)},i.appImplementationError=function(e){return new i(t.AuthenticationErrorCode.AppImplementation,e)},i.errorForTransportResponse=function(e){return new i(t.AuthenticationErrorCode.Communication,"HTTP response error",{status:e.getStatus(),body:e.getBodyJson()})},i.ensureAuthenticationError=function(e){if(i.dynamicCast(e))return e;var n={js_error_message:e.toString()};return e.stack&&(n.js_error_stack=e.stack),new i(t.AuthenticationErrorCode.Internal,"Internal error occurred ("+e.toString()+")",n)},i.augmentErrorData=function(e,t){var n,r={},o=e.getData();if(o)for(n in o)r[n]=o[n];for(n in t)r[n]=t[n];return new i(e.getErrorCode(),e.getMessage(),r)},i.dynamicCast=function(e){return void 0!==e.getErrorCode&&void 0!==e.getMessage&&void 0!==e.getData},i}(t.AuthenticationError),n.AuthenticationErrorImpl=r}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t){this._authenticator=e,this._suggestedParams=t}return e.prototype.getAuthenticator=function(){return this._authenticator},e.prototype.getSuggestedParameters=function(){return this._suggestedParams},e}();e.AuthenticationOptionImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t,n,r){this._appData=n||null,this._token=e||null,this._internalData=r||null,this._deviceId=t||null}return e.prototype.getToken=function(){return this._token||""},e.prototype.getDeviceId=function(){return this._deviceId||""},e.prototype.getData=function(){return this._appData||{}},e.prototype.getInternalData=function(){return this._internalData},e.fromCflowServerResponse=function(t,n){return new e(t.token,n,t.application_data,t.data)},e}();e.AuthenticationResultImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getResultType=function(){return this._resultType},t.prototype.setResultType=function(e){this._resultType=e},t.prototype.getSelectedAuthenticator=function(){return this._selectedAuthenticator},t.prototype.setSelectedAuthenticator=function(e){this._selectedAuthenticator=e},t.prototype.getSelectedAuthenticationParameters=function(){return this._selectedAuthenticationParameters},t.prototype.setSelectedAuthenticationParameters=function(e){this._selectedAuthenticationParameters=e},t.createAbortRequest=function(){return e.ts.mobile.sdk.impl.AuthenticatorSelectionResultImpl.createAbortRequest()},t.createSelectionRequest=function(t){return e.ts.mobile.sdk.impl.AuthenticatorSelectionResultImpl.createSelectionRequest(t)},t.createParameterizedSelectionRequest=function(t,n){return e.ts.mobile.sdk.impl.AuthenticatorSelectionResultImpl.createParameterizedSelectionRequest(t,n)},t.__tarsusInterfaceName="AuthenticatorSelectionResult",t}();t.AuthenticatorSelectionResult=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createAbortRequest=function(){var t=new n;return t.setResultType(e.AuthenticatorSelectionResultType.Abort),t},n.createSelectionRequest=function(t){var r=new n;return r.setResultType(e.AuthenticatorSelectionResultType.SelectAuthenticator),r.setSelectedAuthenticator(t),r},n}(e.AuthenticatorSelectionResult),t.AuthenticatorSelectionResultImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e){this._acquisitionChallenges=e}return e.prototype.getStepTag=function(){return"imageAcquisition"},e.prototype.getAcquisitionChallenges=function(){return this._acquisitionChallenges},e.__tarsusInterfaceName="CameraAcquisitionStepDescription",e}();e.CameraAcquisitionStepDescriptionImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getLocalEnrollmentKeySizeInBytes=function(){return this._localEnrollmentKeySizeInBytes},t.prototype.getLocalEnrollmentKeyIterationCount=function(){return this._localEnrollmentKeyIterationCount},t.prototype.setLocalEnrollmentKeyIterationCount=function(e){this._localEnrollmentKeyIterationCount=e},t.create=function(t){return e.ts.mobile.sdk.impl.ClientCryptoSettingsImpl.create(t)},t.__tarsusInterfaceName="ClientCryptoSettings",t}();t.ClientCryptoSettings=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setLocalEnrollmentKeyIterationCount(e),n._localEnrollmentKeySizeInBytes=32,n},t}(e.ClientCryptoSettings),t.ClientCryptoSettingsImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(){function t(e,t){this._description=e,this._menuItemOptions=t||{}}return t.prototype.getDescription=function(){return this._description},t.prototype.getAvailableActions=function(){var t=this,n=[];switch(this._description.getRegistrationStatus()){case e.AuthenticatorRegistrationStatus.Registered:n=[e.AuthenticatorConfigurationAction.Reregister,e.AuthenticatorConfigurationAction.Unregister];break;case e.AuthenticatorRegistrationStatus.Unregistered:case e.AuthenticatorRegistrationStatus.LocallyInvalid:n=[e.AuthenticatorConfigurationAction.Register]}return n.filter(function(n){return n==e.AuthenticatorConfigurationAction.Reregister&&!t._menuItemOptions.hide_reregister||n==e.AuthenticatorConfigurationAction.Register&&!t._menuItemOptions.hide_register||n==e.AuthenticatorConfigurationAction.Unregister&&!t._menuItemOptions.hide_unregister})},t}(),t.ConfigurableAuthenticatorImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getUserChoice=function(){return this._userChoice},t.prototype.setUserChoice=function(e){this._userChoice=e},t.create=function(t){return e.ts.mobile.sdk.impl.ConfirmationInputImpl.create(t)},t.__tarsusInterfaceName="ConfirmationInput",t}();t.ConfirmationInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setUserChoice(e),n},t}(e.ConfirmationInput),t.ConfirmationInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getRequestType=function(){return this._requestType},t.prototype.setRequestType=function(e){this._requestType=e},t.create=function(t){return e.ts.mobile.sdk.impl.ControlRequestImpl.create(t)},t.__tarsusInterfaceName="ControlRequest",t}();t.ControlRequest=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setRequestType(e),n},t}(e.ControlRequest),t.ControlRequestImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t){this._id=e,this._name=t}return e.prototype.getId=function(){return this._id},e.prototype.getName=function(){return this._name},e}();e.DeviceGroupImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(){function n(e){this.updateFromServer(e)}return n.prototype.getDeviceHwId=function(){return this._id},n.prototype.getDeviceId=function(){return this._logicalId},n.prototype.getName=function(){return this._name?this._name:this._model+" "+this._osType+" "+this._osVersion},n.prototype.getStatus=function(){return this._status},n.prototype.getLastAccess=function(){return this._lastAccess},n.prototype.getLastAccessLocation=function(){return this._lastAccessLocation},n.prototype.getLastAccessLocationAttributes=function(){return this._lastAccessLocationAttributes},n.prototype.getLastBind=function(){return this._lastBind},n.prototype.getRegistered=function(){return this._registered},n.prototype.getModel=function(){return this._model},n.prototype.getOsType=function(){return this._osType},n.prototype.getOsVersion=function(){return this._osVersion},n.prototype.getUseCount=function(){return this._useCount},n.prototype.getPushSupported=function(){return this._pushSupported},n.prototype.getIsCurrent=function(){return this._isCurrent},n.prototype.getDeviecId=function(){return this._id},n.prototype.getGroups=function(){return this._groups},n.prototype.setStatus=function(e){this._status=e},n.prototype.setName=function(e){this._name=e},n.prototype.forceCurrent=function(){this._isCurrent=!0},n.prototype.updateFromServer=function(n){switch(this._model=e.util.getDeviceModel(n.device_model,n.os_type),this._name=n.name,this._lastBind=Date.parse(n.last_bind_date),this._lastAccess=Date.parse(n.last_access),this._registered=Date.parse(n.registered),this._osType=e.util.getOsName(n.os_type),this._osVersion=n.os_version,this._useCount=n.use_count,this._pushSupported=n.supports_push,this._isCurrent=n.cur_device,this._id=n.device_id,this._logicalId=n.logical_device_id,n.status){case e.core.Protocol.DeviceStatusServerFormat.Disabled:this._status=e.DeviceStatus.Disabled;break;case e.core.Protocol.DeviceStatusServerFormat.LongInactivity:this._status=e.DeviceStatus.LongInactivity;break;case e.core.Protocol.DeviceStatusServerFormat.NoRecentActivity:this._status=e.DeviceStatus.NoRecentActivity;break;case e.core.Protocol.DeviceStatusServerFormat.RecentlyUsed:this._status=e.DeviceStatus.RecentlyUsed;break;case e.core.Protocol.DeviceStatusServerFormat.Removed:this._status=e.DeviceStatus.Removed;break;default:throw new t.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unknown device status "+n.status)}if(n.last_access_location){var r=new e.GeoLocation;r.longitude=n.last_access_location.lng,r.latitude=n.last_access_location.lat,this._lastAccessLocation=r,this._lastAccessLocationAttributes=new t.LocationAttributesImpl(n.last_access_location)}n.groups&&(this._groups=n.groups.map(function(e){return new t.DeviceGroupImpl(e.id,e.name)}))},n}(),t.DeviceInfoImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getOsName=function(e){var t=e;switch(e){case"iPhone":case"iPad":t="iOS"}return t},e.prototype.getDeviceModel=function(e,t){var n=e;if("iPhone"==t)switch(e){case"i386":case"x86_64":n="Simulator";break;case"iPod1,1":case"iPod2,1":case"iPod3,1":case"iPod4,1":case"iPod7,1":n="iPod Touch";break;case"iPhone1,1":case"iPhone1,2":case"iPhone2,1":n="iPhone";break;case"iPad1,1":n="iPad";break;case"iPad2,1":n="iPad 2";break;case"iPad3,1":n="iPad";break;case"iPhone3,1":case"iPhone3,3":n="iPhone 4";break;case"iPhone4,1":n="iPhone 4S";break;case"iPhone5,1":case"iPhone5,2":n="iPhone 5";break;case"iPad3,4":n="iPad";break;case"iPad2,5":n="iPad Mini";break;case"iPhone5,3":case"iPhone5,4":n="iPhone 5c";break;case"iPhone6,1":case"iPhone6,2":n="iPhone 5s";break;case"iPhone7,1":n="iPhone 6 Plus";break;case"iPhone7,2":n="iPhone 6";break;case"iPhone8,1":n="iPhone 6S";break;case"iPhone8,2":n="iPhone 6S Plus";break;case"iPhone8,4":n="iPhone SE";break;case"iPhone9,1":case"iPhone9,3":n="iPhone 7";break;case"iPhone9,2":case"iPhone9,4":n="iPhone 7 Plus";break;case"iPhone10,1":case"iPhone10,4":n="iPhone 8";break;case"iPhone10,2":case"iPhone10,5":n="iPhone 8 Plus";break;case"iPhone10,3":case"iPhone10,6":n="iPhone X";break;case"iPad4,1":case"iPad4,2":n="iPad Air";break;case"iPad4,4":case"iPad4,5":case"iPad4,7":n="iPad Mini";break;case"iPad6,7":case"iPad6,8":n='iPad Pro (12.9")';break;case"iPad6,3":case"iPad6,4":n='iPad Pro (9.7")';break;case"iPhone11,2":n="iPhone XS";break;case"iPhone11,6":case"iPhone11,4":n="iPhone XS Max";break;case"iPhone11,8":n="iPhone XR";break;case"iPad6,7":case"iPad6,8":n='iPad Pro (12.9")';break;case"iPad6,11":case"iPad6,12":n="iPad (2017)";break;case"iPad7,1":case"iPad7,2":n="iPad Pro 2nd Gen";break;case"iPad7,3":case"iPad7,4":n='iPad Pro (10.5")';break;case"iPad7,5":case"iPad7,6":n="iPad";break;case"iPad8,1":case"iPad8,2":case"iPad8,3":case"iPad8,4":n='iPad Pro (11")';break;case"iPad8,5":case"iPad8,6":case"iPad8,7":case"iPad8,8":n='iPad Pro (12.9")'}return n},e}();e.DeviceModelConverter=t}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getPrompt=function(){return this._prompt},n.prototype.setPrompt=function(e){this._prompt=e},n.create=function(t){return e.ts.mobile.sdk.impl.DeviceStrongAuthenticatorInputImpl.create(t)},n.__tarsusInterfaceName="DeviceStrongAuthenticatorInput",n}(t.InputResponseType);t.DeviceStrongAuthenticatorInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return e&&n.setPrompt(e),n},t}(e.DeviceStrongAuthenticatorInput),t.DeviceStrongAuthenticatorInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSuccessResponse=function(t){return e.ts.mobile.sdk.impl.Fido2InputResponseImpl.createSuccessResponse(t)},n.createdFailedResponse=function(t){return e.ts.mobile.sdk.impl.Fido2InputResponseImpl.createdFailedResponse(t)},n.__tarsusInterfaceName="Fido2InputResponse",n}(t.InputResponseType);t.Fido2InputResponse=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSuccessResponse=function(t){var n=new e.Fido2AuthenticatorSuccessResponse;return n.setFido2Response(t),n},n.createdFailedResponse=function(t){var n=new e.Fido2AuthenticationFailedResponse;return n.setFailureError(t),n},n}(e.Fido2InputResponse),t.Fido2InputResponseImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSuccessResponse=function(t){var n=new e.FidoAuthSuccessResponse;return n.setFidoResponse(t),n},n.createdFailedResponse=function(t,n){var r=new e.FidoAuthFailureResponse;return r.setFailureError(n),r.setExpired(t.getExpired()),r.setLocked(t.getLocked()),r.setRegistered(t.getRegistered()),r.setRegistrationStatus(t.getRegistrationStatus()),r},n}(e.PlaceholderInputResponse),t.FidoInputResponseImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getPrompt=function(){return this._prompt},n.prototype.setPrompt=function(e){this._prompt=e},n.prototype.getFallbackButtonTitle=function(){return this._fallbackButtonTitle},n.prototype.setFallbackButtonTitle=function(e){this._fallbackButtonTitle=e},n.prototype.getFallbackControlRequestType=function(){return this._fallbackControlRequestType},n.prototype.setFallbackControlRequestType=function(e){this._fallbackControlRequestType=e},n.create=function(t){return e.ts.mobile.sdk.impl.FingerprintInputImpl.create(t)},n.createFallbackEnabledPrompt=function(t,n,r){return e.ts.mobile.sdk.impl.FingerprintInputImpl.createFallbackEnabledPrompt(t,n,r)},n.__tarsusInterfaceName="FingerprintInput",n}(t.InputResponseType);t.FingerprintInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.create=function(e){var t=new n;return e&&t.setPrompt(e),t},n.createFallbackEnabledPrompt=function(t,r,i){var o=new n;return t&&o.setPrompt(t),r&&o.setFallbackButtonTitle(r),i?o.setFallbackControlRequestType(i):o.setFallbackControlRequestType(e.ControlRequestType.SelectMethod),o},n}(e.FingerprintInput),t.FingerprintInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getJsonData=function(){return this._jsonData},t.prototype.setJsonData=function(e){this._jsonData=e},t.prototype.getControlRequest=function(){return this._controlRequest},t.prototype.setControlRequest=function(e){this._controlRequest=e},t.createFormInputSubmissionRequest=function(t){return e.ts.mobile.sdk.impl.FormInputImpl.createFormInputSubmissionRequest(t)},t.createFormCancellationRequest=function(){return e.ts.mobile.sdk.impl.FormInputImpl.createFormCancellationRequest()},t.__tarsusInterfaceName="FormInput",t}();t.FormInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createFormInputSubmissionRequest=function(t){var r=new n;return r.setJsonData(t),r.setControlRequest(e.FormControlRequest.Submit),r},n.createFormCancellationRequest=function(){var t=new n;return t.setControlRequest(e.FormControlRequest.Abort),t},n}(e.FormInput),t.FormInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){return function(){}}();e.GeoLocation=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="IdentifyDevicePushRequestPayload",t}(e.PushRequestPayload);e.IdentifyDevicePushRequestPayload=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.userId=function(){return this._userId},t.prototype.title=function(){return this._title},t.createWithJsonPayload=function(e){var n=e,r=new t;return r._userId=n.user_id,r._title=n.body,r},t}(e.IdentifyDevicePushRequestPayload),t.IdentifyDevicePushRequestPayloadImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getResponse=function(){return this._response},t.prototype.setResponse=function(e){this._response=e},t.prototype.getControlRequest=function(){return this._controlRequest},t.prototype.setControlRequest=function(e){this._controlRequest=e},t.createControlResponse=function(t){return e.ts.mobile.sdk.impl.InputOrControlResponseImpl.createControlResponse(t)},t.createInputResponse=function(t){return e.ts.mobile.sdk.impl.InputOrControlResponseImpl.createInputResponse(t)},t.__tarsusInterfaceName="InputOrControlResponse",t}();t.InputOrControlResponse=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createControlResponse=function(e){var n=new t;return n.setControlRequest(e),n},t.createInputResponse=function(e){var n=new t;return n.setResponse(e),n},t.prototype.isControlRequest=function(){return!!this._controlRequest},t}(e.InputOrControlResponse),t.InputOrControlResponseImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getContinueProcessing=function(){return this._continueProcessing},t.prototype.setContinueProcessing=function(e){this._continueProcessing=e},t.create=function(t){return e.ts.mobile.sdk.impl.JsonDataProcessingResultImpl.create(t)},t.__tarsusInterfaceName="JsonDataProcessingResult",t}();t.JsonDataProcessingResult=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setContinueProcessing(e),n},t}(e.JsonDataProcessingResult),t.JsonDataProcessingResultImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e){this.city=e.city,this.state=e.state,this.country=e.country}return e.prototype.getCity=function(){return this.city},e.prototype.getCountry=function(){return this.country},e.prototype.getState=function(){return this.state},e}();e.LocationAttributesImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(){function n(e){this._deviceInfo=new t.DeviceInfoImpl(e)}return n.prototype.getInfo=function(){return this._deviceInfo},n.prototype.getAvailableActions=function(){if(this._deviceInfo.getStatus()==e.DeviceStatus.Removed)return[];var t=[e.DeviceManagementAction.Rename];return this._deviceInfo.getIsCurrent()||t.push(e.DeviceManagementAction.Remove),this._deviceInfo.getPushSupported()&&t.push(e.DeviceManagementAction.Identify),t},n}(),t.ManagedDeviceImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(){function n(n){switch(this._approval=new t.MobileApprovalImpl(n),this._approval.getStatus()){case e.MobileApprovalStatus.Pending:this._availableActions=[e.MobileApprovalAction.Approve,e.MobileApprovalAction.Deny];break;default:this._availableActions=[]}}return n.prototype.getApproval=function(){return this._approval},n.prototype.getAvailableActions=function(){return this._availableActions},n}(),t.ManagedMobileApprovalImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(){function n(n){switch(this._approvalId=n.approval_id,this._source=n.source,this._title=n.title,this._details=n.details,this._creationTime=n.create,this._finishTime=n.finish,this._expiresAt=n.create+1e3*n.expiry_in,n.status){case e.core.Protocol.ServerResponseDataApprovalsApprovalStatus.Approved:this._status=e.MobileApprovalStatus.Approved;break;case e.core.Protocol.ServerResponseDataApprovalsApprovalStatus.Denied:this._status=e.MobileApprovalStatus.Denied;break;case e.core.Protocol.ServerResponseDataApprovalsApprovalStatus.Expired:this._status=e.MobileApprovalStatus.Expired;break;case e.core.Protocol.ServerResponseDataApprovalsApprovalStatus.Pending:this._status=e.MobileApprovalStatus.Pending;break;default:throw new t.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unknown approval status "+n.status)}}return n.prototype.getApprovalId=function(){return this._approvalId},n.prototype.getSource=function(){return this._source},n.prototype.getTitle=function(){return this._title},n.prototype.getDetails=function(){return this._details},n.prototype.getCreationTime=function(){return this._creationTime},n.prototype.getFinishTime=function(){return this._finishTime},n.prototype.getExpiresAt=function(){return this._expiresAt},n.prototype.getStatus=function(){return this._status},n.prototype.isExpired=function(){return this._status==e.MobileApprovalStatus.Expired},n.prototype.updateStatus=function(e){this._status=e},n}(),t.MobileApprovalImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="MobileApproveInput",t}(e.InputResponseType);e.MobileApproveInput=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createRequestPollingInput=function(){return e.ts.mobile.sdk.impl.MobileApproveInputRequestPollingImpl.createRequestPollingInput()},n.__tarsusInterfaceName="MobileApproveInputRequestPolling",n}(t.MobileApproveInput);t.MobileApproveInputRequestPolling=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createRequestPollingInput=function(){return new t},t}(e.MobileApproveInputRequestPolling),t.MobileApproveInputRequestPollingImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t){this.value=e,this.format=t}return e.prototype.getValue=function(){return this.value},e.prototype.getFormat=function(){return this.format},e.create=function(t,n){return new e(t,n)},e}();e.MobileApproveOtpImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.userId=function(){return this._userId},t.prototype.title=function(){return this._title},t.prototype.body=function(){return this._body},t.prototype.source=function(){return this._source},t.prototype.ticket=function(){return this._ticket},t.createWithUserId=function(e){var n=new t;return n._userId=e,n},t.createWithUserTicket=function(e){var n=new t;return n._userId=e,n},t.createWithJsonPayload=function(e){var n=e,r=new t;return r._userId=n.user_id,r._title=n.body,r._body=n.details,r._source=n.source,r},t}(e.MobileApprovePushRequestPayload),t.MobileApprovePushRequestPayloadImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getPrompt=function(){return this._prompt},n.prototype.setPrompt=function(e){this._prompt=e},n.prototype.getFallbackButtonTitle=function(){return this._fallbackButtonTitle},n.prototype.setFallbackButtonTitle=function(e){this._fallbackButtonTitle=e},n.prototype.getFallbackControlRequestType=function(){return this._fallbackControlRequestType},n.prototype.setFallbackControlRequestType=function(e){this._fallbackControlRequestType=e},n.create=function(t){return e.ts.mobile.sdk.impl.NativeFaceInputImpl.create(t)},n.createFallbackEnabledPrompt=function(t,n,r){return e.ts.mobile.sdk.impl.NativeFaceInputImpl.createFallbackEnabledPrompt(t,n,r)},n.__tarsusInterfaceName="NativeFaceInput",n}(t.InputResponseType);t.NativeFaceInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.create=function(e){var t=new n;return e&&t.setPrompt(e),t},n.createFallbackEnabledPrompt=function(t,r,i){var o=new n;return t&&o.setPrompt(t),r&&o.setFallbackButtonTitle(r),i?o.setFallbackControlRequestType(i):o.setFallbackControlRequestType(e.ControlRequestType.SelectMethod),o},n}(e.NativeFaceInput),t.NativeFaceInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Password=0]="Password",e[e.Fingerprint=1]="Fingerprint",e[e.Pincode=2]="Pincode",e[e.Pattern=3]="Pattern",e[e.Otp=4]="Otp",e[e.Face=5]="Face",e[e.Voice=6]="Voice",e[e.Eye=7]="Eye",e[e.Emoji=8]="Emoji",e[e.Questions=9]="Questions",e[e.FaceID=10]="FaceID",e[e.Generic=11]="Generic",e[e.MobileApprove=12]="MobileApprove",e[e.Totp=13]="Totp",e[e.DeviceStrongAuthenticator=14]="DeviceStrongAuthenticator"}(e.AuthenticatorType||(e.AuthenticatorType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.RedirectTypeBind=0]="RedirectTypeBind",e[e.RedirectTypeAuthenticate=1]="RedirectTypeAuthenticate",e[e.RedirectTypeBindOrAuthenticate=2]="RedirectTypeBindOrAuthenticate",e[e.RedirectTypeInvokePolicy=3]="RedirectTypeInvokePolicy"}(e.RedirectType||(e.RedirectType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n,r;t.AuthTypeData={password:{authTypeEnum:e.AuthenticatorType.Password,authTypeName:"Password"},fingerprint:{authTypeEnum:e.AuthenticatorType.Fingerprint,authTypeName:"Fingerprint"},pin:{authTypeEnum:e.AuthenticatorType.Pincode,authTypeName:"PIN"},pin_centralized:{authTypeEnum:e.AuthenticatorType.Pincode,authTypeName:"PIN"},pattern:{authTypeEnum:e.AuthenticatorType.Pattern,authTypeName:"Pattern"},pattern_centralized:{authTypeEnum:e.AuthenticatorType.Pattern,authTypeName:"Pattern"},otp:{authTypeEnum:e.AuthenticatorType.Otp,authTypeName:"OTP"},face:{authTypeEnum:e.AuthenticatorType.Face,authTypeName:"Face"},face_server:{authTypeEnum:e.AuthenticatorType.Face,authTypeName:"Face"},voice_server:{authTypeEnum:e.AuthenticatorType.Voice,authTypeName:"Voice"},eye:{authTypeEnum:e.AuthenticatorType.Eye,authTypeName:"Eye"},emoji:{authTypeEnum:e.AuthenticatorType.Emoji,authTypeName:"Emoji"},question:{authTypeEnum:e.AuthenticatorType.Questions,authTypeName:"Questions"},face_id:{authTypeEnum:e.AuthenticatorType.FaceID,authTypeName:"FaceID"},mobile_approve:{authTypeEnum:e.AuthenticatorType.MobileApprove,authTypeName:"MobileApprove"},totp:{authTypeEnum:e.AuthenticatorType.Totp,authTypeName:"Totp"},device_biometrics:{authTypeEnum:e.AuthenticatorType.DeviceStrongAuthenticator,authTypeName:"DeviceStrongAuthenticator"},fido2:{authTypeEnum:e.AuthenticatorType.Generic,authTypeName:"FIDO2Authenticator"}},(t.SessionStateChangeState||(t.SessionStateChangeState={})).Closed="closed",function(e){e.Pending="pending",e.Completed="completed",e.Rejected="rejected"}(t.AuthSessionState||(t.AuthSessionState={})),function(e){e.LOGINS="frequency_logins",e.DAYS="frequency_days"}(t.PromotionStrategyFrequency||(t.PromotionStrategyFrequency={})),function(e){e.Numeric="numeric",e.Alphanumeric="alphanumeric",e.Binary="binary"}(t.QrCodeFormatType||(t.QrCodeFormatType={})),function(e){e.Alphanumeric="alphanumeric",e.QrCode="qrcode"}(t.TicketIdFormatType||(t.TicketIdFormatType={})),(t.FailureSourceTransactionType||(t.FailureSourceTransactionType={})).ApprovalApprove="approval_approve",function(e){e.AutoExecute="auto_execute",e.AssertionRejected="assertion_rejected",e.Policy="policy",e.Locked="locked",e.ApprovalExpired="approval_expired"}(t.FailureReasonType||(t.FailureReasonType={})),function(e){e.DefaultAuthenticator="default",e.AuthenticatorMenu="menu",e.FirstAuthenticator="first"}(t.AuthMenuPresentationMode||(t.AuthMenuPresentationMode={})),function(e){e.Registered="registered",e.Registering="registering",e.Unregistered="unregistered"}(t.AuthenticationMethodStatus||(t.AuthenticationMethodStatus={})),function(e){e.Validate="validate",e.Generate="generate"}(t.AuthenticationMethodOtpState||(t.AuthenticationMethodOtpState={})),function(e){e.None="none",e.Sms="sms",e.Email="email",e.Voice="voice",e.Push="push_notification"}(t.AuthenticationMethodOtpChannelType||(t.AuthenticationMethodOtpChannelType={})),function(e){e.Numeric="numeric",e.QrCode="qrcode",e.External="external",e.Unknown=""}(t.OtpFormatType||(t.OtpFormatType={})),function(e){e.WaitForApproval="wait_for_approval",e.WaitForAuthenticate="wait_for_authenticate"}(t.AuthenticationMethodMobileApproveState||(t.AuthenticationMethodMobileApproveState={})),function(e){e.AlphaNumeric="alpha_numeric",e.Numeric="numeric",e.QrCode="qrcode"}(t.TotpChallengeFormatType||(t.TotpChallengeFormatType={})),function(e){e.SelectTargets="select_targets",e.Validate="validate",e.Generate="generate"}(t.AuthenticationMethodTotpState||(t.AuthenticationMethodTotpState={})),function(e){e.RedirectTypeNameBind="bind",e.RedirectTypeNameAuthenticate="auth",e.RedirectTypeNameBindOrAuthenticate="bind_or_auth",e.RedirectTypeNameInvokePolicy="invoke"}(r=t.RedirectTypeName||(t.RedirectTypeName={})),t.RedirectTypeMap=((n={})[r.RedirectTypeNameBind]=e.RedirectType.RedirectTypeBind,n[r.RedirectTypeNameAuthenticate]=e.RedirectType.RedirectTypeAuthenticate,n[r.RedirectTypeNameBindOrAuthenticate]=e.RedirectType.RedirectTypeBindOrAuthenticate,n[r.RedirectTypeNameInvokePolicy]=e.RedirectType.RedirectTypeInvokePolicy,n),function(e){e[e.NotRegistered=1]="NotRegistered",e[e.InvalidAction=2]="InvalidAction",e[e.BadConfig=3]="BadConfig",e[e.BadFch=4]="BadFch",e[e.FailedAssertion=5]="FailedAssertion",e[e.MethodLocked=6]="MethodLocked",e[e.DataMissing=7]="DataMissing",e[e.HistoryRepeat=11]="HistoryRepeat",e[e.MustRegister=14]="MustRegister",e[e.NotFinished=16]="NotFinished",e[e.MissingQuestions=17]="MissingQuestions",e[e.RepeatCurrentStep=18]="RepeatCurrentStep",e[e.FailOver=19]="FailOver",e[e.AssertionContainerNotComplete=20]="AssertionContainerNotComplete"}(t.AssertionErrorCode||(t.AssertionErrorCode={})),function(e){e.Pending="pending",e.Approved="approved",e.Denied="declined",e.Expired="expired"}(t.ServerResponseDataApprovalsApprovalStatus||(t.ServerResponseDataApprovalsApprovalStatus={})),function(e){e.RecentlyUsed="recently_used",e.NoRecentActivity="no_recent_activity",e.LongInactivity="long_inactivity",e.Disabled="disabled",e.Removed="removed"}(t.DeviceStatusServerFormat||(t.DeviceStatusServerFormat={})),function(e){e.Active="active",e.Disabled="disabled"}(t.CollectorState||(t.CollectorState={}))})((t=e.core||(e.core={})).Protocol||(t.Protocol={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function t(){}return t.fromAssertionFormat=function(t){switch(t.type){case e.core.Protocol.OtpFormatType.Numeric:return new n(t.length);case e.core.Protocol.OtpFormatType.QrCode:return new r;case e.core.Protocol.OtpFormatType.External:return new o(t.data);default:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid format type encountered: "+t.type)}},t}();e.OtpFormatImpl=t;var n=function(){function e(e){this._length=e}return e.prototype.getOtpLength=function(){return this._length},e.prototype.getType=function(){return i.Numeric},e.__tarsusInterfaceName="OtpFormatNumeric",e}();e.OtpFormatNumericImpl=n;var r=function(){function e(){}return e.prototype.getType=function(){return i.QrCode},e.__tarsusInterfaceName="OtpFormatQr",e}();e.OtpFormatQrImpl=r;var i,o=function(){function e(e){this._data=e}return e.prototype.getData=function(){return this._data},e.prototype.getType=function(){return i.External},e.__tarsusInterfaceName="OtpFormatExternal",e}();e.OtpFormatExternalImpl=o,function(e){e[e.Numeric=0]="Numeric",e[e.QrCode=1]="QrCode",e[e.External=2]="External"}(i=e.OtpFormatType||(e.OtpFormatType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getOtp=function(){return this._otp},n.prototype.setOtp=function(e){this._otp=e},n.createOtpSubmission=function(t){return e.ts.mobile.sdk.impl.OtpInputOtpSubmissionImpl.createOtpSubmission(t)},n.__tarsusInterfaceName="OtpInputOtpSubmission",n}(t.OtpInput);t.OtpInputOtpSubmission=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createOtpSubmission=function(e){var n=new t;return n.setOtp(e),n},t}(e.OtpInputOtpSubmission),t.OtpInputOtpSubmissionImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createOtpResendRequest=function(){return e.ts.mobile.sdk.impl.OtpInputRequestResendImpl.createOtpResendRequest()},n.__tarsusInterfaceName="OtpInputRequestResend",n}(t.OtpInput);t.OtpInputRequestResend=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createOtpResendRequest=function(){return new t},t}(e.OtpInputRequestResend),t.OtpInputRequestResendImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="OtpPushRequestPayload",t}(e.PushRequestPayload);e.OtpPushRequestPayload=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.userId=function(){return this._userId},t.prototype.title=function(){return this._title},t.prototype.body=function(){return this._body},t.createWithJsonPayload=function(e){var n=e,r=new t;return r._userId=n.user_id,r._title=n.title,r._body=n.body,r},t}(e.OtpPushRequestPayload),t.OtpPushRequestPayloadImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getPassword=function(){return this._password},n.prototype.setPassword=function(e){this._password=e},n.create=function(t){return e.ts.mobile.sdk.impl.PasswordInputImpl.create(t)},n.__tarsusInterfaceName="PasswordInput",n}(t.InputResponseType);t.PasswordInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setPassword(e),n},t}(e.PasswordInput),t.PasswordInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getPatternDescription=function(){return this._patternDescription},n.prototype.setPatternDescription=function(e){this._patternDescription=e},n.create=function(t){return e.ts.mobile.sdk.impl.PatternInputImpl.create(t)},n.__tarsusInterfaceName="PatternInput",n}(t.InputResponseType);t.PatternInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return __extends(r,n),r.create=function(e){var t=new r;return t.setPatternDescription(e),t},r.validateFormat=function(e){return null!=e.getPatternDescription().match(/^(r:[0-9]+,c:[0-9]+)+$/)},r.getPatternLength=function(n){if(r.validateFormat(n))return n.getPatternDescription().match(/r/g).length;throw new t.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern input.")},r}(e.PatternInput),t.PatternInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getPin=function(){return this._pin},n.prototype.setPin=function(e){this._pin=e},n.create=function(t){return e.ts.mobile.sdk.impl.PinInputImpl.create(t)},n.__tarsusInterfaceName="PinInput",n}(t.InputResponseType);t.PinInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setPin(e),n},t}(e.PinInput),t.PinInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSuccessResponse=function(t){var n=new e.PlaceholderAuthSuccessResponse;return n.setPlaceholderToken(t),n},n.createdFailedResponse=function(t,n){var r=new e.PlaceholderAuthFailureResponse;return r.setFailureError(n),r.setExpired(t.getExpired()),r.setLocked(t.getLocked()),r.setRegistered(t.getRegistered()),r.setRegistrationStatus(t.getRegistrationStatus()),r},n.createFailedResponseWithServerProvidedStatus=function(t){var n=new e.PlaceholderAuthFailureWithServerProvidedStatusResponse;return n.setFailureError(t),n},n}(e.PlaceholderInputResponse),t.PlaceholderInputResponseImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e){this._actionType=e.type}return e.prototype.getActionType=function(){return this._actionType},e.prototype.getAltLabel=function(){return""},e}();e.PolicyActionImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getControlRequest=function(){return this._controlRequest},t.prototype.setControlRequest=function(e){this._controlRequest=e},t.createControlResponse=function(t){return e.ts.mobile.sdk.impl.PromotionInputImpl.createControlResponse(t)},t.prototype.getSelectedAuthenticator=function(){return this._selectedAuthenticator},t.prototype.setSelectedAuthenticator=function(e){this._selectedAuthenticator=e},t.createAuthenticatorDescription=function(t){return e.ts.mobile.sdk.impl.PromotionInputImpl.createAuthenticatorDescription(t)},t.__tarsusInterfaceName="PromotionInput",t}();t.PromotionInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.isControlRequest=function(){return!(void 0===this._controlRequest||null===this._controlRequest)},t.createControlResponse=function(e){var n=new t;return n.setControlRequest(e),n},t.createAuthenticatorDescription=function(e){var n=new t;return n.setSelectedAuthenticator(e),n},t}(e.PromotionInput),t.PromotionInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function t(){}return t.fromAssertionFormat=function(t){switch(t){case e.core.Protocol.QrCodeFormatType.Numeric:return e.QrCodeFormat.Numeric;case e.core.Protocol.QrCodeFormatType.Alphanumeric:return e.QrCodeFormat.Alphanumeric;case e.core.Protocol.QrCodeFormatType.Binary:return e.QrCodeFormat.Binary;default:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid qr code format type encountered: "+t.type)}},t}();e.QrCodeFormatImpl=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getQrCode=function(){return this._qrCode},t.prototype.getQrCodeFormat=function(){return this._qrCodeFormat},t.createQrCodeResult=function(t,n){return e.ts.mobile.sdk.impl.QrCodeResultImpl.createQrCodeResult(t,n)},t.__tarsusInterfaceName="QrCodeResult",t}();t.QrCodeResult=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createQrCodeResult=function(e,n){var r=new t;return r._qrCode=e,r._qrCodeFormat=n,r},t}(e.QrCodeResult),t.QrCodeResultImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getRedirectResponse=function(){return this._redirectResponse},t.prototype.setRedirectResponse=function(e){this._redirectResponse=e},t.create=function(t){return e.ts.mobile.sdk.impl.RedirectInputImpl.create(t)},t.__tarsusInterfaceName="RedirectInput",t}();t.RedirectInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setRedirectResponse(e),n},t}(e.RedirectInput),t.RedirectInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getServerAddress=function(){return this._serverAddress},t.prototype.setServerAddress=function(e){this._serverAddress=e},t.prototype.getRealm=function(){return this._realm},t.prototype.setRealm=function(e){this._realm=e},t.prototype.getAppId=function(){return this._appId},t.prototype.setAppId=function(e){this._appId=e},t.prototype.getTokenName=function(){return this._tokenName},t.prototype.setTokenName=function(e){this._tokenName=e},t.prototype.getToken=function(){return this._token},t.prototype.setToken=function(e){this._token=e},t.prototype.getCryptoMode=function(){return this._cryptoMode},t.prototype.setCryptoMode=function(e){this._cryptoMode=e},t.create=function(t,n,r,i){return e.ts.mobile.sdk.impl.SDKConnectionSettingsImpl.create(t,n,r,i)},t.createWithCryptoMode=function(t,n,r,i,o){return e.ts.mobile.sdk.impl.SDKConnectionSettingsImpl.createWithCryptoMode(t,n,r,i,o)},t.__tarsusInterfaceName="SDKConnectionSettings",t}();t.SDKConnectionSettings=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.create=function(t,n,r,i){return this.createWithCryptoMode(t,n,r,i,e.ConnectionCryptoMode.None)},n.createWithCryptoMode=function(e,t,r,i,o){var a=new n;return a.setServerAddress(e),a.setAppId(t),a.setTokenName(r),a.setToken(i),a.setCryptoMode(o),a},n}(e.SDKConnectionSettings),t.SDKConnectionSettingsImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getQrCodeResult=function(){return this._qrCodeResult},n.prototype.setQrCodeResult=function(e){this._qrCodeResult=e},n.createScanQrCodeInput=function(t){return e.ts.mobile.sdk.impl.ScanQrCodeInputImpl.createScanQrCodeInput(t)},n.__tarsusInterfaceName="ScanQrCodeInput",n}(t.InputResponseType);t.ScanQrCodeInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createScanQrCodeInput=function(e){var n=new t;return n.setQrCodeResult(e),n},t}(e.ScanQrCodeInput),t.ScanQrCodeInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createAnswerToQuestion=function(e,n){var r=new t;return r._question=e,r._answer=n,r},t}(e.SecurityQuestionAndAnswer),t.SecurityQuestionAndAnswerImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createWithText=function(e){var n=new t;return n._answerText=e,n},t}(e.SecurityQuestionAnswer),t.SecurityQuestionAnswerImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t,n){this._id=e,this._text=t,this._registered=n}return e.prototype.getSecurityQuestionId=function(){return this._id},e.prototype.getSecurityQuestionText=function(){return this._text},e.__tarsusInterfaceName="SecurityQuestion",e}();e.SecurityQuestionImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSecurityQuestionAnswersInputResponse=function(t){var n=new e.SecurityQuestionAnswersInputResponse;return n._answers=t,n},n}(e.SecurityQuestionInputResponse),t.SecurityQuestionInputResponseImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getStepTag=function(){return"question"},e.prototype.getSecurityQuestions=function(){return this._securityQuestions},e.prototype.getMinAnswersNeeded=function(){return this._minAnswers},e.createForAuthQuestion=function(t){var n=new e;return n._minAnswers=1,n._securityQuestions=[t],n},e.createForRegistrationQuestions=function(t,n){var r=new e;return r._minAnswers=n,r._securityQuestions=t,r},e.__tarsusInterfaceName="SecurityQuestionStepDescription",e}();e.SecurityQuestionStepDescriptionImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t="undefined"!=typeof window?window:t;t.com=e}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(t,n){var r=e.call(this)||this;return n&&(r._selectedTargets=n),t&&(r._authenticatorInput=t),r}return __extends(t,e),t.createAuthenticatorInput=function(e){return new t(e,null)},t.createTargetSelectionRequest=function(e){return new t(null,[e])},t.createTargetsSelectionRequest=function(e){return new t(null,e)},t}(e.TargetBasedAuthenticatorInput),t.TargetBasedAuthenticatorInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function t(t,n,r,i,o,a,s){this._deviceId=t,this._model=e.util.getDeviceModel(n,o),this._isCurrentDevice=i,this._osType=e.util.getOsName(o),this._osVersion=a,this._lastAccessed=r,this._alias=s}return t.prototype.getDeviceId=function(){return this._deviceId},t.prototype.getModel=function(){return this._model},t.prototype.getLastAccessed=function(){return this._lastAccessed},t.prototype.getIsCurrent=function(){return this._isCurrentDevice},t.prototype.getOsType=function(){return this._osType},t.prototype.getOsVersion=function(){return this._osVersion},t.prototype.getAlias=function(){return this._alias},t.prototype.describe=function(){var e=new Date(this._lastAccessed).toLocaleDateString();return(this._alias?this._alias+" : ":"")+this._model+" last accessed on "+e},t.fromServerFormat=function(e){return new t(e.device_id,e.model,e.last_access,e.current_device,e.os_type,e.os_version,e.alias||null)},t}();e.TargetDeviceDetailsImpl=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createPollRequest=function(){return e.ts.mobile.sdk.impl.TicketWaitInputImpl.createPollRequest()},n.__tarsusInterfaceName="TicketWaitInput",n}(t.InputResponseType);t.TicketWaitInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="TicketWaitInputPollRequest",t}(e.TicketWaitInput);e.TicketWaitInputPollRequest=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(t){var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createPollRequest=function(){return new r},t}(e.TicketWaitInput);t.TicketWaitInputImpl=n;var r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="TicketWaitInputPollRequest",t}(e.TicketWaitInputPollRequest);t.TicketWaitInputPollRequestImpl=r}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Qr=0]="Qr",e[e.Alphanumeric=1]="Alphanumeric"}(e.TicketIdFormat||(e.TicketIdFormat={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(t){var n=function(){function t(e){this._ticketId=e}return t.prototype.getFormat=function(){switch(this._ticketId.format){case e.core.Protocol.TicketIdFormatType.Alphanumeric:return e.TicketIdFormat.Alphanumeric;case e.core.Protocol.TicketIdFormatType.QrCode:default:return e.TicketIdFormat.Qr}},t.prototype.getValue=function(){return this._ticketId.value},t}();t.TicketIdImpl=n;var r=function(){function e(e){this._title=e.title,this._text=e.text,this._ticketId=new n(e.ticket_id)}return e.prototype.getTitle=function(){return this._title},e.prototype.getText=function(){return this._text},e.prototype.getTicketId=function(){return this._ticketId},e}();t.TicketWaitingInformationImpl=r}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function t(){}return t.fromAssertionFormat=function(t){switch(t.type){case e.core.Protocol.TotpChallengeFormatType.Numeric:return new r;case e.core.Protocol.TotpChallengeFormatType.QrCode:return new o;case e.core.Protocol.TotpChallengeFormatType.AlphaNumeric:return new n;default:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid format type encountered: "+t.type)}},t}();e.TotpChallengeFormatImpl=t;var n=function(){function e(){}return e.prototype.getType=function(){return i.AlphaNumeric},e.__tarsusInterfaceName="TotpChallengeFormatAlphaNumeric",e}();e.TotpChallengeFormatAlphaNumericImpl=n;var r=function(){function e(){}return e.prototype.getType=function(){return i.Numeric},e.__tarsusInterfaceName="TotpChallengeFormatNumeric",e}();e.TotpChallengeFormatNumericImpl=r;var i,o=function(){function e(){}return e.prototype.getType=function(){return i.QrCode},e.__tarsusInterfaceName="TotpChallengeFormatQr",e}();e.TotpChallengeFormatQrImpl=o,function(e){e[e.AlphaNumeric=0]="AlphaNumeric",e[e.Numeric=1]="Numeric",e[e.QrCode=2]="QrCode"}(i=e.TotpChallengeFormatType||(e.TotpChallengeFormatType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getChallenge=function(){return this._challenge},n.prototype.setChallenge=function(e){this._challenge=e},n.create=function(t){return e.ts.mobile.sdk.impl.TotpChallengeInputImpl.create(t)},n.__tarsusInterfaceName="TotpChallengeInput",n}(t.InputResponseType);t.TotpChallengeInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setChallenge(e),n},t}(e.TotpChallengeInput),t.TotpChallengeInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.createTotpGenerationRequest=function(t,n,r){var i=new e;return i.setUserId(t.userHandle),i.setChallenge(n),i.setGeneratorName(r),i},e.prototype.getChallenge=function(){return this._challenge},e.prototype.getGeneratorName=function(){return this._generatorName},e.prototype.setGeneratorName=function(e){this._generatorName=e},e.prototype.setChallenge=function(e){this._challenge=e},e.prototype.setUserId=function(e){this._userId=e},e.prototype.getUserId=function(){return this._userId},e.prototype.setUserHandleType=function(e){this._userHandleType=e},e.prototype.getUserHandleType=function(){return this._userHandleType},e}();e.TotpGenerationRequestImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="TotpInput",t}(e.InputResponseType);e.TotpInput=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getCode=function(){return this._code},n.prototype.setCode=function(e){this._code=e},n.createTotpCodeSubmission=function(t){return e.ts.mobile.sdk.impl.TotpInputCodeSubmissionImpl.createTotpCodeSubmission(t)},n.__tarsusInterfaceName="TotpInputCodeSubmission",n}(t.TotpInput);t.TotpInputCodeSubmission=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createTotpCodeSubmission=function(e){var n=new t;return n.setCode(e),n},t}(e.TotpInputCodeSubmission),t.TotpInputCodeSubmissionImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){var n=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._components=e}return e.prototype.toString=function(){return this._components.map(function(e){return e.replace(/([\\.])/g,function(e){return"\\"+("."==e?"p":e)})}).join(".")},e.fromString=function(t){return new(e.bind.apply(e,[void 0].concat(t.split("."))))},e.prototype.concat=function(t){return new(e.bind.apply(e,[void 0].concat(this._components.concat(t._components))))},e}();t.TarsusKeyPath=n;var r=function(){function t(e){this._host=e}return t.prototype.readStorageKey=function(e){return this._host.readStorageKey(e.toString())},t.prototype.writeStorageKey=function(e,t){this._host.writeStorageKey(e.toString(),t)},t.prototype.deleteStorageKey=function(e){this._host.deleteStorageKey(e.toString())},t.prototype.readSessionStorageKey=function(e){return this._host.readSessionStorageKey(e.toString())},t.prototype.writeSessionStorageKey=function(e,t){this._host.writeSessionStorageKey(e.toString(),t)},t.prototype.deleteSessionStorageKey=function(e){this._host.deleteSessionStorageKey(e.toString())},t.prototype.generateKeyPair=function(e,t,n,r){return this._host.generateKeyPair(e.toString(),t,n,r)},t.prototype.generateKeyPairExternalRepresentation=function(e){return this._host.generateKeyPairExternalRepresentation(e)},t.prototype.generateHexSeededKeyPairExternalRepresentation=function(e,t){return this._host.generateHexSeededKeyPairExternalRepresentation(e,t)},t.prototype.getKeyPair=function(e,t,n){return this._host.getKeyPair(e.toString(),t,n)},t.prototype.deleteKeyPair=function(e){this._host.deleteKeyPair(e.toString())},t.prototype.importVolatileSymmetricKey=function(e,t){return this._host.importVolatileSymmetricKey(e,t)},t.prototype.importVolatileKeyPair=function(e,t){return this._host.importVolatileKeyPair(e,t)},t.prototype.importVolatileKeyPairFromPublicKeyHex=function(e,t){return this._host.importVolatileKeyPairFromPublicKeyHex(e,t)},t.prototype.generatePbkdf2HmacSha1HexString=function(e,t,n,r){return this._host.generatePbkdf2HmacSha1HexString(e,t,n,r)},t.prototype.calcHexStringEncodedSha256Hash=function(e){return this._host.calcHexStringEncodedSha256Hash(e)},t.prototype.calcHexStringEncodedSha512Hash=function(e){return this._host.calcHexStringEncodedSha512Hash(e)},t.prototype.generateRandomHexString=function(e){return this._host.generateRandomHexString(e)},t.prototype.queryHostInfo=function(e){return this._host.queryHostInfo(e)},t.prototype.calcHexStringEncodedHmacSha1HashWithHexEncodedKey=function(e,t){return this._host.calcHexStringEncodedHmacSha1HashWithHexEncodedKey(e,t)},t.prototype.getCurrentTime=function(){return this._host.getCurrentTime()},t.prototype.createDelayedPromise=function(e){return this._host.createDelayedPromise(e)},t.prototype.fidoClientXact=function(e,t,n,r){return this._host.fidoClientXact(e,t,n,r)},t.prototype.fido2CredentialsOp=function(e,t,n,r,i){return this._host.fido2CredentialsOp(e,t,n,r,i)},t.prototype.dyadicEnroll=function(e,t){return this._host.dyadicEnroll(e,t)},t.prototype.dyadicSign=function(e){return this._host.dyadicSign(e)},t.prototype.dyadicDelete=function(){return this._host.dyadicDelete()},t.prototype.dyadicRefreshToken=function(e){return this._host.dyadicRefreshToken(e)},t.prototype.transformApiPath=function(e){return this._host.transformApiPath(e)},t.prototype.log=function(e,t,n){return this._host.log(e,t,n)},t.prototype.loadPlugin=function(e){return this._host.loadPlugin(e)},t.prototype.deviceSupportsCryptoBind=function(){return"true"==this.queryHostInfo(e.sdkhost.HostInformationKey.PersistentKeysSupported)},t}();t.TarsusHostServices=r})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(t){var n=new t.core.TarsusKeyPath("currentSession"),r=function(){function r(){this.mandatoryCollectors=[t.CollectorType.DeviceDetails,t.CollectorType.ExternalSDKDetails,t.CollectorType.HWAuthenticators,t.CollectorType.LocalEnrollments,t.CollectorType.Capabilities]}return r.prototype.pushRequestPayloadFromJSON=function(e){var n=e.push_type;switch(n){case"otp_notification":return t.impl.OtpPushRequestPayloadImpl.createWithJsonPayload(e);case"device_notification":return t.impl.IdentifyDevicePushRequestPayloadImpl.createWithJsonPayload(e);case"approval":return t.impl.MobileApprovePushRequestPayloadImpl.createWithJsonPayload(e)}throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Payload with type "+n+" isn't recognized")},r.prototype.setTarsusHost=function(e){this._nativeHost=e,this.host=new t.core.TarsusHostServices(e),this.pluginManager=new t.core.TarsusPluginManager(this),this.enabledCollectors=[t.CollectorType.Accounts,t.CollectorType.DeviceDetails,t.CollectorType.Contacts,t.CollectorType.Owner,t.CollectorType.Software,t.CollectorType.Location,t.CollectorType.Bluetooth,t.CollectorType.ExternalSDKDetails,t.CollectorType.HWAuthenticators,t.CollectorType.FidoAuthenticators,t.CollectorType.Capabilities,t.CollectorType.LargeData,t.CollectorType.LocalEnrollments],this.currentPersistUserData=!0},r.prototype.setConnectionSettings=function(e){this.connectionSettings=e},r.prototype.setClientCryptoSettings=function(e){this.cryptoSettings=e},r.prototype.setEnabledCollectors=function(e){this.enabledCollectors=e,this.addMandatoryCollectorsIfNeeded()},r.prototype.setLogLevel=function(e){this._nativeHost.setLogLevel(e)},r.prototype.setExternalLogger=function(e){this._nativeHost.setExternalLogger(e)},r.prototype.setTransportProvider=function(e){this.transportProvider=e},r.prototype.setUiHandler=function(e){this.currentUiHandler=e},r.prototype.setPushToken=function(e){this._lastReceivedPushToken=e},r.prototype.setPersistUserData=function(e){this.currentPersistUserData=e},Object.defineProperty(r.prototype,"currentSession",{get:function(){return this._currentSession},enumerable:!0,configurable:!0}),r.prototype.installPlugin=function(e,t){this.pluginManager.installPlugin(e,t)},r.prototype.initialize=function(){var e=this;return new Promise(function(r,i){if(!e.host)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to initialize SDK without host.");if(!e.connectionSettings)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to initialize SDK without connection settings.");if(!e.transportProvider)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to initialize SDK without transport provider.");e.cryptoSettings||(e.cryptoSettings=t.ClientCryptoSettings.create(1e4)),e.fidoClient=new t.core.fidoclient.TarsusFidoClient(e),e._nativeHost.initialize(e.enabledCollectors).then(function(r){return e.pluginManager.initializePlugins().then(function(){var r=e.host.readSessionStorageKey(n);if(r){e.log(t.LogLevel.Info,"Loading existing session from session store");try{e._currentSession=t.core.Session.fromJson(e,r),e.log(t.LogLevel.Debug,"Loaded existing session for user "+(e._currentSession.user&&e._currentSession.user.displayName))}catch(r){e.log(t.LogLevel.Warning,"Failed to load existing session from session store. Discarding existing session "+r+".")}}return!0})}).then(r,i)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.getUsersInfo=function(){var e=[];return t.core.User.iterateUsers(this,function(n){e.push(t.impl.UserInfoImpl.createWithUser(n))}),e},r.prototype.isBoundForUser=function(e){var n=t.core.User.findUser(this,e);return!(!n||!n.deviceBound)},r.prototype.getBoundUserIds=function(){var e=[];return t.core.User.iterateUsers(this,function(t){t.userId&&t.deviceBound&&e.push(t.userId)}),e},r.prototype.getKnownUserIds=function(){var e=[];return t.core.User.iterateUsers(this,function(t){t.userId&&(t.hasLoggedIn||t.deviceBound)&&e.push(t.userId)}),e},r.prototype.logout=function(){var e=this;return new Promise(function(n,r){if(e._currentSession)if(e._currentSession.canTerminate()){var i,o=e._currentSession.createLogoutRequest(),a=e._currentSession;e._currentSession=null,e.saveCurrentSession(),a.invalidated?(e.log(t.LogLevel.Info,"Logging out with an invalidated session; not issuing server request."),i=Promise.resolve(!0)):i=a.performSessionExchange(o).then(function(e){return Promise.resolve(!0)}),i.then(function(e){return t.core.Session.notifySessionObserversOnMainSessionLogout(a),e}).then(n,r)}else r(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to logout with a locked session."));else r(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"No logged in user."))}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.isTotpProvisionedForUser=function(e,n){var r=t.core.User.findUser(this,e);if(!r)return this.log(t.LogLevel.Error,"Can not find user record for <"+e+">"),!1;var i=new t.core.LocalSession(this,r);return t.core.totp.TotpPropertiesProcessor.createWithUserWithoutUIInteraction(r,this,i).isTotpProvisionedForGenerator(n||t.core.totp.TotpPropertiesProcessor.BACKWARD_COMPATIBILITY_DEFAULT_GENERATOR)},r.prototype.getVersionInfo=function(){return this._versionInfo||(this._versionInfo=new t.impl.VersionInfoImpl(this.host.queryHostInfo(e.sdkhost.HostInformationKey.Platform),this.host.queryHostInfo(e.sdkhost.HostInformationKey.Version))),this._versionInfo},r.prototype.resolveUserForBind=function(e,n){var r=t.core.User.findUser(this,e);if(r&&r.deviceBound)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to bind an already bound user on this device.",{user:e});return r||(this.log(t.LogLevel.Debug,"bind: Creating new user "+e),r=t.core.User.createUser(this,e,n?t.UserHandleType.IdToken:t.UserHandleType.UserId)),r},r.prototype.internalBind=function(n,r,i){var o=this,a=!1;return new Promise(function(s,c){if(o.log(t.LogLevel.Debug,"Bind for user "+(n.userId||n.idToken)),o.ensureConfigured(),o._currentSession)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to start a session (bind) with a current primary active session.");var u=new t.core.Session(o,n);a=!0,o._currentSession=u,o.log(t.LogLevel.Debug,"bind: Generating new device keys for "+(n.userId||n.idToken));var l=o.host.generateKeyPair(n.deviceSigningKeyTag,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.None,!0),d=o.host.generateKeyPair(n.deviceEncryptionKeyTag,e.sdkhost.KeyClass.StdEncryptionKey,e.sdkhost.KeyBiometricProtectionMode.None,!0),h=t.util.wrapPromiseWithActivityIndicator(o.currentUiHandler,null,i,Promise.all([l,d])).then(function(e){var n=e[0],i=e[1];return o.log(t.LogLevel.Debug,"bind: key generation done"),o.promiseCollectionResult().then(function(e){return o.log(t.LogLevel.Debug,"bind: Collection result completed, Initiating request promise"),u.createBindRequest(e,o._lastReceivedPushToken,n,i,r)})}),p=!1,f=function(e){if(p)return e;p=!0;var n=u.deviceId();return n&&(o.log(t.LogLevel.Debug,"bind: binding device to user after succesful completion"),u.user.bindDeviceToUser(n)),t.core.Session.notifySessionObserversOnMainSessionLogin(u),e};o.log(t.LogLevel.Debug,"bind: Sending request"),u.startControlFlow(h,null,i,f).then(function(e){return f(e),o.saveCurrentSession(),u.persistUserData&&t.core.User.save(o,u.user),e}).then(s,c)}).catch(function(e){return a&&(o.log(t.LogLevel.Debug,"bind: Clearing session after error"),o._currentSession=null),Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.bindWithIdToken=function(e,n,r){try{var i=this.resolveUserForBind(e,!0);return this.internalBind(i,n,r)}catch(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},r.prototype.bind=function(e,n,r){try{var i=this.resolveUserForBind(e,!1);return this.internalBind(i,n,r)}catch(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},r.prototype.resolveUserForAuthenticate=function(e,n){var r;return this.host.deviceSupportsCryptoBind()?r=this.lookupBoundUser(e):(r=t.core.User.findUser(this,e))||(this.log(t.LogLevel.Debug,"authenticate: Creating new user "+e),r=t.core.User.createUser(this,e,n?t.UserHandleType.IdToken:t.UserHandleType.UserId)),r},r.prototype.internalAuthenticate=function(e,n,r,i){var o=this,a=!1;return new Promise(function(s,c){if(o.log(t.LogLevel.Debug,"Authenticate for user "+(e.userId||e.idToken)+" with policy "+n),o.ensureConfigured(),o._currentSession)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to start a session (authenticate) with a current primary active session.");var u=new t.core.Session(o,e);a=!0,o._currentSession=u,o.log(t.LogLevel.Debug,"authenticate: Initiating message setup");var l=t.util.wrapPromiseWithActivityIndicator(o.currentUiHandler,null,i,o.promiseCollectionResult()).then(function(e){return o.log(t.LogLevel.Debug,"authenticate: Collection done; setting up request"),u.createLoginRequest(e,o._lastReceivedPushToken,n,r)});o.log(t.LogLevel.Debug,"authenticate: Sending request"),o._currentSession.startControlFlow(l,null,i).then(function(e){return o.saveCurrentSession(),o.log(t.LogLevel.Debug,"authenticate: marking user has logged in after succesful completion"),u.user.markLoggedIn(),u.persistUserData&&t.core.User.save(o,u.user),t.core.Session.notifySessionObserversOnMainSessionLogin(u),e}).then(s,c)}).catch(function(e){return a&&(o.log(t.LogLevel.Debug,"authenticate: Clearing session after error"),o._currentSession=null),Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.authenticate=function(e,n,r,i){try{var o=this.resolveUserForAuthenticate(e,!1);return this.internalAuthenticate(o,n,r,i)}catch(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},r.prototype.authenticateWithIdToken=function(e,n,r,i){try{var o=this.resolveUserForAuthenticate(e,!0);return this.internalAuthenticate(o,n,r,i)}catch(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},r.prototype.invokePolicy=function(e,n,r){var i=this;return this.log(t.LogLevel.Debug,"Invoke policy "+e+" for current session."),new Promise(function(o,a){i.ensureConfigured(),i.runWithCurrentSession(function(o){i.log(t.LogLevel.Debug,"invokePolicy: Initiating request creation");var a=i.promiseCollectionResult().then(function(r){return i.log(t.LogLevel.Debug,"invokePolicy: Collection done; setting up request"),o.createLoginRequest(r,i._lastReceivedPushToken,e,n)});return i.log(t.LogLevel.Debug,"invokePolicy: Initiating control flow"),o.startControlFlow(a,null,r)}).then(o,a)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.startTotpSessionForUser=function(e,n,r,i){var o=this;return r=r||t.core.totp.TotpPropertiesProcessor.BACKWARD_COMPATIBILITY_DEFAULT_GENERATOR,this.log(t.LogLevel.Debug,"Start TOTP session for user "+e+", generator "+r),new Promise(function(a,s){o.ensureConfigured(),o.log(t.LogLevel.Debug,"Get TOTP data for <"+e+", "+r+">");var c=t.core.User.findUser(o,e);if(!c)throw o.log(t.LogLevel.Error,"Can not find user record for <"+e+">"),new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Can not find user <"+e+">");var u=new t.core.LocalSession(o,c);t.core.totp.TotpPropertiesProcessor.createWithUserHandle(e,o,u,i).runCodeGenerationSession(r,n,i,o.currentUiHandler).then(a,s)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.totpGenerationRequestForUserFromCanonicalString=function(e,n){this.ensureConfigured(),this.log(t.LogLevel.Debug,"Get TOTP request for <"+e+">");var r=t.core.User.findUser(this,e);if(!r)throw this.log(t.LogLevel.Error,"Can not find user record for <"+e+">"),new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Can not find user <"+e+">");var i=new t.core.LocalSession(this,r);return t.core.totp.TotpPropertiesProcessor.createWithUserWithoutUIInteraction(r,this,i).totpRequestFromCanonicalString(n)},r.prototype.startTotpSessionWithRequest=function(e,n){var r=this;return new Promise(function(i,o){r.ensureConfigured(),r.log(t.LogLevel.Debug,"Start TOTP session for user "+e.getUserId()+", generator "+e.getGeneratorName());var a=t.core.User.findUser(r,e.getUserId());if(!a)throw r.log(t.LogLevel.Error,"Can not find user record for <"+e.getUserId()+">"),new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Can not find user <"+e.getUserId()+">");var s=new t.core.LocalSession(r,a);t.core.totp.TotpPropertiesProcessor.createWithUserHandle(e.getUserId(),r,s,n).runCodeGenerationSessionWithRequest(e,n,r.currentUiHandler).then(i,o)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.startDeviceManagementSession=function(e){var n=this;return new Promise(function(r,i){n.ensureConfigured(),n.runWithCurrentSession(function(r){return n.log(t.LogLevel.Debug,"User in current session: "+r.user.displayName),new t.core.DeviceManagementSessionProcessor(n,r,e).run()}).then(function(e){switch(e){case t.core.DeviceManagementSessionProcessorReturnReason.CurrentDeviceDeleted:var r=n._currentSession&&n._currentSession.user;return n.log(t.LogLevel.Debug,"Invalidating current session after deletion of current device."),n._currentSession=null,n.saveCurrentSession(),r?(n.log(t.LogLevel.Debug,"Clearing data for current user ("+r.displayName+") after deletion of current device."),n.clearDataForUser(r.userHandle)):n.log(t.LogLevel.Warning,"No current user after deletion of current device; not clearing sesison."),!0;case t.core.DeviceManagementSessionProcessorReturnReason.FinishSession:return!0}}).then(r,i)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.startAuthenticationConfiguration=function(e){var n=this;return this.log(t.LogLevel.Debug,"Start authentication configuration for current session"),new Promise(function(r,i){n.ensureConfigured(),n.runWithCurrentSession(function(r){return n.log(t.LogLevel.Debug,"User in current session: "+r.user.displayName),new t.core.AuthenticationConfigurationSessionProcessor(n,r,e).run()}).then(r,i)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.startAuthenticationConfigurationWithToken=function(e,n){var r=this;return this.log(t.LogLevel.Debug,"Start approval for provided session token"),new Promise(function(i,o){r.ensureConfigured(),r.runWithCurrentSession(function(i){return r.log(t.LogLevel.Debug,"User in current session: "+i.user.displayName),new t.core.AuthenticationConfigurationSessionProcessor(r,i,n,e).run()}).then(i,o)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.startApprovalsSessionForCurrentSession=function(e){var n=this;return this.log(t.LogLevel.Debug,"Start approval for current session"),new Promise(function(r,i){n.ensureConfigured(),n.runWithCurrentSession(function(r){return n.log(t.LogLevel.Debug,"User in current session: "+r.user.displayName),new t.core.ApprovalSessionProcessor(n,r,e).run()}).then(r,i)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.startApprovalsSessionForPushedRequest=function(e,n){var r=this;return this.log(t.LogLevel.Debug,"Start approval for push request"),new Promise(function(i,o){if(r.ensureConfigured(),!e.userId())return e.ticket()?void o(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Mobile approval push by ticket not yet implemented.")):void o(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Unknown mobile approval push request."));r.log(t.LogLevel.Debug,"startApprovalsSessionForPushedRequest with userid "+e.userId());var a=r.lookupBoundUser(e.userId()),s=new t.core.Session(r,a);new t.core.ApprovalSessionProcessor(r,s,n).run().then(i,o)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.invokeAnonymousPolicy=function(e,n,r){var i=this;return this.log(t.LogLevel.Debug,"Start anonymous policy "+e),new Promise(function(o,a){i.log(t.LogLevel.Debug,"authenticate: Initiating message setup");var s,c=i.promiseCollectionResult();s=t.core.Session.createAnonymousSession(i);var u=c.then(function(r){return i.log(t.LogLevel.Debug,"invokeAnonymusPolicy: Collection done; setting up request"),s.createAnonPolicyRequest(r,i._lastReceivedPushToken,e,n)});i.log(t.LogLevel.Debug,"authenticate: Sending request"),s.startControlFlow(u,null,r).then(function(e){return e},function(e){throw i.log(t.LogLevel.Debug,"authenticate: Clearing session after error"),e}).then(o,a)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.cancelCurrentRunningControlFlow=function(){this.log(t.LogLevel.Debug,"Cancel current running control flow requested."),this._currentSession?this._currentSession.cancelCurrentControlFlow():this.log(t.LogLevel.Error,"No current session")},r.prototype.ensureConfigured=function(){if(!this.currentUiHandler)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to start authentication without a registered UIHandler.")},r.prototype.saveCurrentSession=function(){this._currentSession?this.host.writeSessionStorageKey(n,this._currentSession.toJson()):this.host.deleteSessionStorageKey(n)},r.prototype.runWithCurrentSession=function(e){var n=this;if(!this._currentSession)return Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.SessionRequired,"Operation requires an active session."));var r=this._currentSession;return r.lock(),e(r).finally(function(){r.unlock(),n.saveCurrentSession()})},r.prototype.log=function(e,t){this._nativeHost.log(e,"TransmitSDK/Tarsus",t)},r.prototype.promiseCollectionResult=function(){var e=this;return this._nativeHost.promiseCollectionResult().then(function(t){return e.addTarsusCollectedData(t)})},r.prototype.getClientFeatureSet=function(){var n,r=this.host.queryHostInfo(e.sdkhost.HostInformationKey.HostProvidedFeatures);return n=r&&r.length?r.split(",").map(function(e){return parseInt(e)}):[],t.core.STATIC_FEATURE_SET.concat(n)},r.prototype.clearDataForUser=function(e){try{if(this.log(t.LogLevel.Debug,"Delete data for user "+e+"."),this._currentSession)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to call clearDataForUser with an active primary ongoing session.");var n=t.core.User.findUser(this,e);if(!n)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to call clearDataForUser with a non existing user.");try{this.host.deleteKeyPair(n.deviceSigningKeyTag)}catch(e){this.log(t.LogLevel.Warning,"Can't delete device signing key.")}try{this.host.deleteKeyPair(n.deviceEncryptionKeyTag)}catch(e){this.log(t.LogLevel.Warning,"Can't delete device encryption key.")}try{t.core.LocalEnrollment.deleteEnrollmentsForUser(n,this)}catch(e){this.log(t.LogLevel.Warning,"Can't delete enrollments for user.")}var r=new t.core.LocalSession(this,n);try{t.core.totp.TotpPropertiesProcessor.createWithUserWithoutUIInteraction(n,this,r).deleteAllProvisions()}catch(e){this.log(t.LogLevel.Warning,"Can't delete enrollments for user.")}t.core.User.deleteUser(n,this)}catch(n){throw this.log(t.LogLevel.Warning,"Can't delete data for user "+e+": "+n),n}},r.prototype.clearAllData=function(){var e=this;if(this._currentSession)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to call clearAllData with an active primary ongoing session.");this.log(t.LogLevel.Debug,"Delete all data: collecting users");var n=[];t.core.User.iterateUsers(this,function(e){n.push(e.userHandle)}),this.log(t.LogLevel.Debug,"Delete all data: deleting users"),n.forEach(function(n){try{e.clearDataForUser(n)}catch(r){e.log(t.LogLevel.Warning,"Error when deleting user "+n+": "+r)}})},r.prototype.lookupBoundUser=function(e){var n=t.core.User.findUser(this,e);if(!n)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to authenticate with an unknown user on this device.",{user:e});if(!n.deviceBound)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to authenticate with an unbound user on this device.",{user:e});return n},r.prototype.addTarsusCollectedData=function(e){var n=this;return new Promise(function(r,o){var a=new Array,s=new Array;Object.keys(t.core.collectors.TarsusCollectors).forEach(function(e){var r=new t.core.collectors.TarsusCollectors[e].createCollector(n.enabledCollectors);r.isEnabled()&&(s.push(e),a.push(r.provide(n)))}),Promise.all(a.map(function(e){return e.catch(function(e){return new Error(e)})})).then(function(o){var a=e.toJson();for(var c in o)o[c]instanceof Error?n.log(t.LogLevel.Error,"caught collection error "+o[c]):(n.log(t.LogLevel.Debug,"Tarsus collected from: "+s[c]+" "+JSON.stringify(o[c])),a.content[s[c]]=n.mergeCollectedData(o[c],a.content[s[c]]));r(new i(a))}).catch(function(e){o(e)})})},r.prototype.mergeCollectedData=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},r.prototype.addMandatoryCollectorsIfNeeded=function(){var e=this;this.mandatoryCollectors.forEach(function(n){e.enabledCollectors.indexOf(n)<0&&(e.enabledCollectors.push(n),e.log(t.LogLevel.Warning,t.CollectorType[n]+" collector is mandatory, and will remain enabled."))})},r.__tarsusInterfaceName="TransmitSDKXm",r}();t.TransmitSDKXmImpl=r;var i=function(){function e(e){this.theResult=e}return e.prototype.toJson=function(){return this.theResult},e}();t.CollectionResultImpl=i,t.createSdk=function(){return new r}}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getUserChoice=function(){return this._userChoice},t.prototype.setUserChoice=function(e){this._userChoice=e},t.create=function(t){return e.ts.mobile.sdk.impl.UnregistrationInputImpl.create(t)},t.__tarsusInterfaceName="UnregistrationInput",t}();t.UnregistrationInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setUserChoice(e),n},t}(e.UnregistrationInput),t.UnregistrationInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getUserHandle=function(){return this._user.userHandle},e.prototype.getUserHandleType=function(){return this._user.userHandleType},e.prototype.getDisplayName=function(){return this._user.displayName},e.prototype.getDeviceBound=function(){return this._user.deviceBound},e.prototype.getHasLoggedIn=function(){return this._user.hasLoggedIn},e.createWithUser=function(t){var n=new e;return n._user=t,n},e}();e.UserInfoImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(){function t(e,t){this._sdkVersion=t,this._platformName=e}return t.prototype.getSdkVersion=function(){return this._sdkVersion},t.prototype.getTarsusVersion=function(){return e.core.TARSUS_VERSION},t.prototype.getPlatformName=function(){return this._platformName},t.prototype.getApiLevel=function(){return e.core.API_LEVEL},t}(),t.VersionInfoImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){function t(e){return parseInt(e)===e}function n(e){if(!t(e.length))return!1;for(var n=0;n<e.length;n++)if(!t(e[n])||e[n]<0||e[n]>255)return!1;return!0}function r(e,r){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return r&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!n(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(t(e.length)&&n(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function i(e){return new Uint8Array(e)}function o(e,t,n,r,i){null==r&&null==i||(e=e.slice?e.slice(r,i):Array.prototype.slice.call(e,r,i)),t.set(e,n)}function a(e){for(var t=[],n=0;n<e.length;n+=4)t.push(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]);return t}var s=function(){return{toBytes:function(e){var t=[],n=0;for(e=encodeURI(e);n<e.length;){var i=e.charCodeAt(n++);37===i?(t.push(parseInt(e.substr(n,2),16)),n+=2):t.push(i)}return r(t)},fromBytes:function(e){for(var t=[],n=0;n<e.length;){var r=e[n];r<128?(t.push(String.fromCharCode(r)),n++):r>191&&r<224?(t.push(String.fromCharCode((31&r)<<6|63&e[n+1])),n+=2):(t.push(String.fromCharCode((15&r)<<12|(63&e[n+1])<<6|63&e[n+2])),n+=3)}return t.join("")}}}(),c=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},fromBytes:function(t){for(var n=[],r=0;r<t.length;r++){var i=t[r];n.push(e[(240&i)>>4]+e[15&i])}return n.join("")}}}(),u={16:10,24:12,32:14},l=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],d=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],h=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],p=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],f=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],m=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],g=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],v=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],y=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],b=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],A=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],_=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],S=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],I=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],w=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925],k=function(e){if(!(this instanceof k))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:r(e,!0)}),this._prepare()};k.prototype._prepare=function(){var e=u[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var n,r=4*(e+1),i=this.key.length/4,o=a(this.key);for(t=0;t<i;t++)n=t>>2,this._Ke[n][t%4]=o[t],this._Kd[e-n][t%4]=o[t];for(var s,c=0,h=i;h<r;){if(s=o[i-1],o[0]^=d[s>>16&255]<<24^d[s>>8&255]<<16^d[255&s]<<8^d[s>>24&255]^l[c]<<24,c+=1,8!=i)for(t=1;t<i;t++)o[t]^=o[t-1];else{for(t=1;t<i/2;t++)o[t]^=o[t-1];s=o[i/2-1],o[i/2]^=d[255&s]^d[s>>8&255]<<8^d[s>>16&255]<<16^d[s>>24&255]<<24;for(t=i/2+1;t<i;t++)o[t]^=o[t-1]}for(t=0;t<i&&h<r;)p=h>>2,f=h%4,this._Ke[p][f]=o[t],this._Kd[e-p][f]=o[t++],h++}for(var p=1;p<e;p++)for(var f=0;f<4;f++)s=this._Kd[p][f],this._Kd[p][f]=_[s>>24&255]^S[s>>16&255]^I[s>>8&255]^w[255&s]},k.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,n=[0,0,0,0],r=a(e),o=0;o<4;o++)r[o]^=this._Ke[0][o];for(var s=1;s<t;s++){for(o=0;o<4;o++)n[o]=p[r[o]>>24&255]^f[r[(o+1)%4]>>16&255]^m[r[(o+2)%4]>>8&255]^g[255&r[(o+3)%4]]^this._Ke[s][o];r=n.slice()}var c,u=i(16);for(o=0;o<4;o++)c=this._Ke[t][o],u[4*o]=255&(d[r[o]>>24&255]^c>>24),u[4*o+1]=255&(d[r[(o+1)%4]>>16&255]^c>>16),u[4*o+2]=255&(d[r[(o+2)%4]>>8&255]^c>>8),u[4*o+3]=255&(d[255&r[(o+3)%4]]^c);return u},k.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,n=[0,0,0,0],r=a(e),o=0;o<4;o++)r[o]^=this._Kd[0][o];for(var s=1;s<t;s++){for(o=0;o<4;o++)n[o]=v[r[o]>>24&255]^y[r[(o+3)%4]>>16&255]^b[r[(o+2)%4]>>8&255]^A[255&r[(o+1)%4]]^this._Kd[s][o];r=n.slice()}var c,u=i(16);for(o=0;o<4;o++)c=this._Kd[t][o],u[4*o]=255&(h[r[o]>>24&255]^c>>24),u[4*o+1]=255&(h[r[(o+3)%4]>>16&255]^c>>16),u[4*o+2]=255&(h[r[(o+2)%4]>>8&255]^c>>8),u[4*o+3]=255&(h[255&r[(o+1)%4]]^c);return u};var C=function(e){if(!(this instanceof C))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new k(e)};C.prototype.encrypt=function(e){if((e=r(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=i(e.length),n=i(16),a=0;a<e.length;a+=16)o(e,n,0,a,a+16),o(n=this._aes.encrypt(n),t,a);return t},C.prototype.decrypt=function(e){if((e=r(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=i(e.length),n=i(16),a=0;a<e.length;a+=16)o(e,n,0,a,a+16),o(n=this._aes.decrypt(n),t,a);return t};var E=function(e,t){if(!(this instanceof E))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=i(16);this._lastCipherblock=r(t,!0),this._aes=new k(e)};E.prototype.encrypt=function(e){if((e=r(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=i(e.length),n=i(16),a=0;a<e.length;a+=16){o(e,n,0,a,a+16);for(var s=0;s<16;s++)n[s]^=this._lastCipherblock[s];this._lastCipherblock=this._aes.encrypt(n),o(this._lastCipherblock,t,a)}return t},E.prototype.decrypt=function(e){if((e=r(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=i(e.length),n=i(16),a=0;a<e.length;a+=16){o(e,n,0,a,a+16),n=this._aes.decrypt(n);for(var s=0;s<16;s++)t[a+s]=n[s]^this._lastCipherblock[s];o(e,this._lastCipherblock,0,a,a+16)}return t};var P=function(e,t,n){if(!(this instanceof P))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 size)")}else t=i(16);n||(n=1),this.segmentSize=n,this._shiftRegister=r(t,!0),this._aes=new k(e)};P.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t,n=r(e,!0),i=0;i<n.length;i+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var a=0;a<this.segmentSize;a++)n[i+a]^=t[a];o(this._shiftRegister,this._shiftRegister,0,this.segmentSize),o(n,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return n},P.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t,n=r(e,!0),i=0;i<n.length;i+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var a=0;a<this.segmentSize;a++)n[i+a]^=t[a];o(this._shiftRegister,this._shiftRegister,0,this.segmentSize),o(e,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return n};var T=function(e,t){if(!(this instanceof T))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=i(16);this._lastPrecipher=r(t,!0),this._lastPrecipherIndex=16,this._aes=new k(e)};T.prototype.encrypt=function(e){for(var t=r(e,!0),n=0;n<t.length;n++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[n]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},T.prototype.decrypt=T.prototype.encrypt;var R=function(e){if(!(this instanceof R))throw Error("Counter must be instanitated with `new`");0===e||e||(e=1),"number"==typeof e?(this._counter=i(16),this.setValue(e)):this.setBytes(e)};R.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");if(e>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},R.prototype.setBytes=function(e){if(16!=(e=r(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},R.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var D=function(e,t){if(!(this instanceof D))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof R||(t=new R(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new k(e)};D.prototype.encrypt=function(e){for(var t=r(e,!0),n=0;n<t.length;n++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[n]^=this._remainingCounter[this._remainingCounterIndex++];return t},D.prototype.decrypt=D.prototype.encrypt;var x={AES:k,Counter:R,ModeOfOperation:{ecb:C,cbc:E,cfb:P,ofb:T,ctr:D},utils:{hex:c,utf8:s},padding:{pkcs7:{pad:function(e){var t=16-(e=r(e,!0)).length%16,n=i(e.length+t);o(e,n);for(var a=e.length;a<n.length;a++)n[a]=t;return n},strip:function(e){if((e=r(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(t>16)throw new Error("PKCS#7 padding byte out of range");for(var n=e.length-t,a=0;a<t;a++)if(e[n+a]!==t)throw new Error("PKCS#7 invalid padding byte");var s=i(n);return o(e,s,0,0,n),s}}},_arrayTest:{coerceArray:r,createArray:i,copyArray:o}};e.aesjs&&(x._aesjs=e.aesjs),e.aesjs=x}("undefined"!=typeof window?window:global),function(e){("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).elliptic=function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){return i(t[a][1][e]||e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";var r=n;r.version=e("../package.json").version,r.utils=e("./elliptic/utils"),r.rand=e("brorand"),r.curve=e("./elliptic/curve"),r.curves=e("./elliptic/curves"),r.ec=e("./elliptic/ec"),r.eddsa=e("./elliptic/eddsa")},{"../package.json":30,"./elliptic/curve":4,"./elliptic/curves":7,"./elliptic/ec":8,"./elliptic/eddsa":11,"./elliptic/utils":15,brorand:17}],2:[function(e,t,n){"use strict";function r(e,t){this.type=e,this.p=new o(t.p,16),this.red=t.prime?o.red(t.prime):o.mont(this.p),this.zero=new o(0).toRed(this.red),this.one=new o(1).toRed(this.red),this.two=new o(2).toRed(this.red),this.n=t.n&&new o(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function i(e,t){this.curve=e,this.type=t,this.precomputed=null}var o=e("bn.js"),a=e("../../elliptic").utils,s=a.getNAF,c=a.getJSF,u=a.assert;t.exports=r,r.prototype.point=function(){throw new Error("Not implemented")},r.prototype.validate=function(){throw new Error("Not implemented")},r.prototype._fixedNafMul=function(e,t){u(e.precomputed);var n=e._getDoubles(),r=s(t,1),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;for(var o=[],a=0;a<r.length;a+=n.step){var c=0;for(t=a+n.step-1;t>=a;t--)c=(c<<1)+r[t];o.push(c)}for(var l=this.jpoint(null,null,null),d=this.jpoint(null,null,null),h=i;h>0;h--){for(a=0;a<o.length;a++)(c=o[a])===h?d=d.mixedAdd(n.points[a]):c===-h&&(d=d.mixedAdd(n.points[a].neg()));l=l.add(d)}return l.toP()},r.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=s(t,n),a=this.jpoint(null,null,null),c=o.length-1;c>=0;c--){for(t=0;c>=0&&0===o[c];c--)t++;if(c>=0&&t++,a=a.dblp(t),c<0)break;var l=o[c];u(0!==l),a="affine"===e.type?l>0?a.mixedAdd(i[l-1>>1]):a.mixedAdd(i[-l-1>>1].neg()):l>0?a.add(i[l-1>>1]):a.add(i[-l-1>>1].neg())}return"affine"===e.type?a.toP():a},r.prototype._wnafMulAdd=function(e,t,n,r,i){for(var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d=0;d<r;d++){var h=(k=t[d])._getNAFPoints(e);o[d]=h.wnd,a[d]=h.points}for(d=r-1;d>=1;d-=2){var p=d-1,f=d;if(1===o[p]&&1===o[f]){var m=[t[p],null,null,t[f]];0===t[p].y.cmp(t[f].y)?(m[1]=t[p].add(t[f]),m[2]=t[p].toJ().mixedAdd(t[f].neg())):0===t[p].y.cmp(t[f].y.redNeg())?(m[1]=t[p].toJ().mixedAdd(t[f]),m[2]=t[p].add(t[f].neg())):(m[1]=t[p].toJ().mixedAdd(t[f]),m[2]=t[p].toJ().mixedAdd(t[f].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=c(n[p],n[f]);l=Math.max(v[0].length,l),u[p]=new Array(l),u[f]=new Array(l);for(var y=0;y<l;y++){var b=0|v[0][y],A=0|v[1][y];u[p][y]=g[3*(b+1)+(A+1)],u[f][y]=0,a[p]=m}}else u[p]=s(n[p],o[p]),u[f]=s(n[f],o[f]),l=Math.max(u[p].length,l),l=Math.max(u[f].length,l)}var _=this.jpoint(null,null,null),S=this._wnafT4;for(d=l;d>=0;d--){for(var I=0;d>=0;){var w=!0;for(y=0;y<r;y++)S[y]=0|u[y][d],0!==S[y]&&(w=!1);if(!w)break;I++,d--}if(d>=0&&I++,_=_.dblp(I),d<0)break;for(y=0;y<r;y++){var k,C=S[y];0!==C&&(C>0?k=a[y][C-1>>1]:C<0&&(k=a[y][-C-1>>1].neg()),_="affine"===k.type?_.mixedAdd(k):_.add(k))}}for(d=0;d<r;d++)a[d]=null;return i?_:_.toP()},r.BasePoint=i,i.prototype.eq=function(){throw new Error("Not implemented")},i.prototype.validate=function(){return this.curve.validate(this)},r.prototype.decodePoint=function(e,t){e=a.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?u(e[e.length-1]%2==0):7===e[0]&&u(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},i.prototype.encodeCompressed=function(e){return this.encode(e,!0)},i.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},i.prototype.encode=function(e,t){return a.encode(this._encode(t),e)},i.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},i.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},i.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)r=r.dbl();n.push(r)}return{step:e,points:n}},i.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},i.prototype._getBeta=function(){return null},i.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}},{"../../elliptic":1,"bn.js":16}],3:[function(e,t,n){"use strict";function r(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,u.call(this,"edwards",e),this.a=new s(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new s(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new s(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),l(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function i(e,t,n,r,i){u.BasePoint.call(this,e,"projective"),null===t&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new s(t,16),this.y=new s(n,16),this.z=r?new s(r,16):this.curve.one,this.t=i&&new s(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}var o=e("../curve"),a=e("../../elliptic"),s=e("bn.js"),c=e("inherits"),u=o.base,l=a.utils.assert;c(r,u),t.exports=r,r.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},r.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},r.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},r.prototype.pointFromX=function(e,t){(e=new s(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var c=a.fromRed().isOdd();return(t&&!c||!t&&c)&&(a=a.redNeg()),this.point(e,a)},r.prototype.pointFromY=function(e,t){(e=new s(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=n.redSub(this.one),i=n.redMul(this.d).redAdd(this.one),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},r.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return 0===r.cmp(i)},c(i,u.BasePoint),r.prototype.pointFromJSON=function(e){return i.fromJSON(this,e)},r.prototype.point=function(e,t,n,r){return new i(this,e,t,n,r)},i.fromJSON=function(e,t){return new i(e,t[0],t[1],t[2])},i.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},i.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},i.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),a=o.redSub(n),s=r.redSub(t),c=i.redMul(a),u=o.redMul(s),l=i.redMul(s),d=a.redMul(o);return this.curve.point(c,u,d,l)},i.prototype._projDbl=function(){var e,t,n,r=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=(u=this.curve._mulA(i)).redAdd(o);if(this.zOne)e=r.redSub(i).redSub(o).redMul(a.redSub(this.curve.two)),t=a.redMul(u.redSub(o)),n=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),c=a.redSub(s).redISub(s);e=r.redSub(i).redISub(o).redMul(c),t=a.redMul(u.redSub(o)),n=a.redMul(c)}}else{var u=i.redAdd(o);s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),c=u.redSub(s).redSub(s),e=this.curve._mulC(r.redISub(u)).redMul(c),t=this.curve._mulC(u).redMul(i.redISub(o)),n=u.redMul(c)}return this.curve.point(e,t,n)},i.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},i.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),a=i.redSub(r),s=i.redAdd(r),c=n.redAdd(t),u=o.redMul(a),l=s.redMul(c),d=o.redMul(c),h=a.redMul(s);return this.curve.point(u,l,h,d)},i.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),c=i.redSub(s),u=i.redAdd(s),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),d=r.redMul(c).redMul(l);return this.curve.twisted?(t=r.redMul(u).redMul(a.redSub(this.curve._mulA(o))),n=c.redMul(u)):(t=r.redMul(u).redMul(a.redSub(o)),n=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,n)},i.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},i.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},i.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},i.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},i.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},i.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},i.prototype.getY=function(){return this.normalize(),this.y.fromRed()},i.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},i.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}return!1},i.prototype.toP=i.prototype.normalize,i.prototype.mixedAdd=i.prototype.add},{"../../elliptic":1,"../curve":4,"bn.js":16,inherits:27}],4:[function(e,t,n){"use strict";var r=n;r.base=e("./base"),r.short=e("./short"),r.mont=e("./mont"),r.edwards=e("./edwards")},{"./base":2,"./edwards":3,"./mont":5,"./short":6}],5:[function(e,t,n){"use strict";function r(e){c.call(this,"mont",e),this.a=new a(e.a,16).toRed(this.red),this.b=new a(e.b,16).toRed(this.red),this.i4=new a(4).toRed(this.red).redInvm(),this.two=new a(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function i(e,t,n){c.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new a(t,16),this.z=new a(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var o=e("../curve"),a=e("bn.js"),s=e("inherits"),c=o.base,u=e("../../elliptic").utils;s(r,c),t.exports=r,r.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},s(i,c.BasePoint),r.prototype.decodePoint=function(e,t){return this.point(u.toArray(e,t),1)},r.prototype.point=function(e,t){return new i(this,e,t)},r.prototype.pointFromJSON=function(e){return i.fromJSON(this,e)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(e,t){return new i(e,t[0],t[1]||e.one)},i.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},i.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},i.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),a=i.redMul(r),s=t.z.redMul(o.redAdd(a).redSqr()),c=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,c)},i.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":1,"../curve":4,"bn.js":16,inherits:27}],6:[function(e,t,n){"use strict";function r(e){l.call(this,"short",e),this.a=new c(e.a,16).toRed(this.red),this.b=new c(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function i(e,t,n,r){l.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new c(t,16),this.y=new c(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function o(e,t,n,r){l.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new c(0)):(this.x=new c(t,16),this.y=new c(n,16),this.z=new c(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var a=e("../curve"),s=e("../../elliptic"),c=e("bn.js"),u=e("inherits"),l=a.base,d=s.utils.assert;u(r,l),t.exports=r,r.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new c(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new c(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],d(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map(function(e){return{a:new c(e.a,16),b:new c(e.b,16)}}):this._getEndoBasis(n)}}},r.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:c.mont(e),n=new c(2).toRed(t).redInvm(),r=n.redNeg(),i=new c(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},r.prototype._getEndoBasis=function(e){for(var t,n,r,i,o,a,s,u,l,d=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,p=this.n.clone(),f=new c(1),m=new c(0),g=new c(0),v=new c(1),y=0;0!==h.cmpn(0);){var b=p.div(h);u=p.sub(b.mul(h)),l=g.sub(b.mul(f));var A=v.sub(b.mul(m));if(!r&&u.cmp(d)<0)t=s.neg(),n=f,r=u.neg(),i=l;else if(r&&2==++y)break;s=u,p=h,h=u,g=f,f=l,v=m,m=A}o=u.neg(),a=l;var _=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(_)>=0&&(o=t,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},r.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),c=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},r.prototype.pointFromX=function(e,t){(e=new c(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},r.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},r.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(t[o]),s=e[o],c=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),c=c.neg(!0)),r[2*o]=s,r[2*o+1]=c,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var u=this._wnafMulAdd(1,r,i,2*o,n),l=0;l<2*o;l++)r[l]=null,i[l]=null;return u},u(i,l.BasePoint),r.prototype.point=function(e,t,n){return new i(this,e,t,n)},r.prototype.pointFromJSON=function(e,t){return i.fromJSON(this,e,t)},i.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},i.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},i.fromJSON=function(e,t,n){function r(t){return e.point(t[0],t[1],n)}"string"==typeof t&&(t=JSON.parse(t));var i=e.point(t[0],t[1],n);if(!t[2])return i;var o=t[2];return i.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[i].concat(o.doubles.points.map(r))},naf:o.naf&&{wnd:o.naf.wnd,points:[i].concat(o.naf.points.map(r))}},i},i.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},i.prototype.isInfinity=function(){return this.inf},i.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},i.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},i.prototype.getX=function(){return this.x.fromRed()},i.prototype.getY=function(){return this.y.fromRed()},i.prototype.mul=function(e){return e=new c(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},i.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},i.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},i.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},i.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},i.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},u(o,l.BasePoint),r.prototype.jpoint=function(e,t,n){return new o(this,e,t,n)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),d=r.redMul(u),h=c.redSqr().redIAdd(l).redISub(d).redISub(d),p=c.redMul(d.redISub(h)).redISub(o.redMul(l)),f=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(h,p,f)},o.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=n.redMul(c),d=s.redSqr().redIAdd(u).redISub(l).redISub(l),h=s.redMul(l.redISub(d)).redISub(i.redMul(u)),p=this.z.redMul(a);return this.curve.jpoint(d,h,p)},o.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,c=s.redSqr().redSqr(),u=a.redAdd(a);for(n=0;n<e;n++){var l=o.redSqr(),d=u.redSqr(),h=d.redSqr(),p=l.redAdd(l).redIAdd(l).redIAdd(r.redMul(c)),f=o.redMul(d),m=p.redSqr().redISub(f.redAdd(f)),g=f.redISub(m),v=p.redMul(g);v=v.redIAdd(v).redISub(h);var y=u.redMul(s);n+1<e&&(c=c.redMul(h)),o=m,s=y,u=v}return this.curve.jpoint(o,u.redMul(i),s)},o.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},o.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),c=s.redSqr().redISub(a).redISub(a),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=s.redMul(a.redISub(c)).redISub(u),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),p=this.x.redAdd(d).redSqr().redISub(l).redISub(h);p=p.redIAdd(p);var f=l.redAdd(l).redIAdd(l),m=f.redSqr(),g=h.redIAdd(h);g=(g=g.redIAdd(g)).redIAdd(g),e=m.redISub(p).redISub(p),t=f.redMul(p.redISub(e)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(e,t,n)},o.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),c=s.redSqr().redISub(a).redISub(a);e=c;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=s.redMul(a.redISub(c)).redISub(u),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),p=this.x.redSub(l).redMul(this.x.redAdd(l));p=p.redAdd(p).redIAdd(p);var f=h.redIAdd(h),m=(f=f.redIAdd(f)).redAdd(f);e=p.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var g=d.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=p.redMul(f.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,n)},o.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=t.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(a),l=s.redSqr().redISub(u.redAdd(u)),d=u.redISub(l),h=a.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var p=s.redMul(d).redISub(h),f=n.redAdd(n).redMul(r);return this.curve.jpoint(l,p,f)},o.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),c=r.redIAdd(r);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(s).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var h=this.y.redMul(u.redMul(c.redISub(u)).redISub(a.redMul(s)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var p=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(d,h,p)},o.prototype.mul=function(e,t){return e=new c(e,t),this.curve._wnafMul(this,e)},o.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(0!==this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0))return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)},o.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(n))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}return!1},o.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},o.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":1,"../curve":4,"bn.js":16,inherits:27}],7:[function(e,t,n){"use strict";function r(e){"short"===e.type?this.curve=new c.curve.short(e):"edwards"===e.type?this.curve=new c.curve.edwards(e):this.curve=new c.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,u(this.g.validate(),"Invalid curve"),u(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function i(e,t){Object.defineProperty(a,e,{configurable:!0,enumerable:!0,get:function(){var n=new r(t);return Object.defineProperty(a,e,{configurable:!0,enumerable:!0,value:n}),n}})}var o,a=n,s=e("hash.js"),c=e("../elliptic"),u=c.utils.assert;a.PresetCurve=r,i("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:s.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),i("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:s.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),i("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:s.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),i("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:s.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),i("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:s.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),i("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["9"]}),i("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{o=e("./precomputed/secp256k1")}catch(e){o=void 0}i("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:s.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})},{"../elliptic":1,"./precomputed/secp256k1":14,"hash.js":19}],8:[function(e,t,n){"use strict";function r(e){return this instanceof r?("string"==typeof e&&(s(a.curves.hasOwnProperty(e),"Unknown curve "+e),e=a.curves[e]),e instanceof a.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),void(this.hash=e.hash||e.curve.hash)):new r(e)}var i=e("bn.js"),o=e("hmac-drbg"),a=e("../../elliptic"),s=a.utils.assert,c=e("./key"),u=e("./signature");t.exports=r,r.prototype.keyPair=function(e){return new c(this,e)},r.prototype.keyFromPrivate=function(e,t){return c.fromPrivate(this,e,t)},r.prototype.keyFromPublic=function(e,t){return c.fromPublic(this,e,t)},r.prototype.genKeyPair=function(e){e||(e={});for(var t=new o({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new i(2));;){var s=new i(t.generate(n));if(!(s.cmp(r)>0))return s.iaddn(1),this.keyFromPrivate(s)}},r.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},r.prototype.sign=function(e,t,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new i(e,16));for(var a=this.n.byteLength(),s=t.getPrivate().toArray("be",a),c=e.toArray("be",a),l=new o({hash:this.hash,entropy:s,nonce:c,pers:r.pers,persEnc:r.persEnc||"utf8"}),d=this.n.sub(new i(1)),h=0;;h++){var p=r.k?r.k(h):new i(l.generate(this.n.byteLength()));if(!((p=this._truncateToN(p,!0)).cmpn(1)<=0||p.cmp(d)>=0)){var f=this.g.mul(p);if(!f.isInfinity()){var m=f.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var v=p.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));if(0!==(v=v.umod(this.n)).cmpn(0)){var y=(f.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return r.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),y^=1),new u({r:g,s:v,recoveryParam:y})}}}}}},r.prototype.verify=function(e,t,n,r){e=this._truncateToN(new i(e,16)),n=this.keyFromPublic(n,r);var o=(t=new u(t,"hex")).r,a=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,c=a.invm(this.n),l=c.mul(e).umod(this.n),d=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(l,n.getPublic(),d)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(l,n.getPublic(),d)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},r.prototype.recoverPubKey=function(e,t,n,r){s((3&n)===n,"The recovery param is more than two bits"),t=new u(t,r);var o=this.n,a=new i(e),c=t.r,l=t.s,d=1&n,h=n>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");c=h?this.curve.pointFromX(c.add(this.curve.n),d):this.curve.pointFromX(c,d);var p=t.r.invm(o),f=o.sub(a).mul(p).umod(o),m=l.mul(p).umod(o);return this.g.mulAdd(f,c,m)},r.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new u(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":1,"./key":9,"./signature":10,"bn.js":16,"hmac-drbg":25}],9:[function(e,t,n){"use strict";function r(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var i=e("bn.js"),o=e("../../elliptic").utils.assert;t.exports=r,r.fromPublic=function(e,t,n){return t instanceof r?t:new r(e,{pub:t,pubEnc:n})},r.fromPrivate=function(e,t,n){return t instanceof r?t:new r(e,{priv:t,privEnc:n})},r.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},r.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},r.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},r.prototype._importPrivate=function(e,t){this.priv=new i(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},r.prototype._importPublic=function(e,t){return e.x||e.y?("mont"===this.ec.curve.type?o(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||o(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y))):void(this.pub=this.ec.curve.decodePoint(e,t))},r.prototype.derive=function(e){return e.mul(this.priv).getX()},r.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},r.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},r.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},{"../../elliptic":1,"bn.js":16}],10:[function(e,t,n){"use strict";function r(e,t){return e instanceof r?e:void(this._importDER(e,t)||(u(e.r&&e.s,"Signature without r or s"),this.r=new s(e.r,16),this.s=new s(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam))}function i(e,t){var n=e[t.place++];if(!(128&n))return n;for(var r=15&n,i=0,o=0,a=t.place;o<r;o++,a++)i<<=8,i|=e[a];return t.place=a,i}function o(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t<n;)t++;return 0===t?e:e.slice(t)}function a(e,t){if(t<128)e.push(t);else{var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}var s=e("bn.js"),c=e("../../elliptic").utils,u=c.assert;t.exports=r,r.prototype._importDER=function(e,t){e=c.toArray(e,t);var n=new function(){this.place=0};if(48!==e[n.place++])return!1;if(i(e,n)+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var r=i(e,n),o=e.slice(n.place,r+n.place);if(n.place+=r,2!==e[n.place++])return!1;var a=i(e,n);if(e.length!==a+n.place)return!1;var u=e.slice(n.place,a+n.place);return 0===o[0]&&128&o[1]&&(o=o.slice(1)),0===u[0]&&128&u[1]&&(u=u.slice(1)),this.r=new s(o),this.s=new s(u),this.recoveryParam=null,!0},r.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=o(t),n=o(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];a(r,t.length),(r=r.concat(t)).push(2),a(r,n.length);var i=r.concat(n),s=[48];return a(s,i.length),s=s.concat(i),c.encode(s,e)}},{"../../elliptic":1,"bn.js":16}],11:[function(e,t,n){"use strict";function r(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof r))return new r(e);e=o.curves[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=i.sha512}var i=e("hash.js"),o=e("../../elliptic"),a=o.utils,s=a.assert,c=a.parseBytes,u=e("./key"),l=e("./signature");t.exports=r,r.prototype.sign=function(e,t){e=c(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),s=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},r.prototype.verify=function(e,t,n){e=c(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},r.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return a.intFromLE(e.digest()).umod(this.curve.n)},r.prototype.keyFromPublic=function(e){return u.fromPublic(this,e)},r.prototype.keyFromSecret=function(e){return u.fromSecret(this,e)},r.prototype.makeSignature=function(e){return e instanceof l?e:new l(this,e)},r.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},r.prototype.decodePoint=function(e){var t=(e=a.parseBytes(e)).length-1,n=e.slice(0,t).concat(-129&e[t]),r=0!=(128&e[t]),i=a.intFromLE(n);return this.curve.pointFromY(i,r)},r.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},r.prototype.decodeInt=function(e){return a.intFromLE(e)},r.prototype.isPoint=function(e){return e instanceof this.pointClass}},{"../../elliptic":1,"./key":12,"./signature":13,"hash.js":19}],12:[function(e,t,n){"use strict";function r(e,t){this.eddsa=e,this._secret=a(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=a(t.pub)}var i=e("../../elliptic").utils,o=i.assert,a=i.parseBytes,s=i.cachedProperty;r.fromPublic=function(e,t){return t instanceof r?t:new r(e,{pub:t})},r.fromSecret=function(e,t){return t instanceof r?t:new r(e,{secret:t})},r.prototype.secret=function(){return this._secret},s(r,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),s(r,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),s(r,"privBytes",function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),s(r,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),s(r,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),s(r,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),r.prototype.sign=function(e){return o(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},r.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},r.prototype.getSecret=function(e){return o(this._secret,"KeyPair is public only"),i.encode(this.secret(),e)},r.prototype.getPublic=function(e){return i.encode(this.pubBytes(),e)},t.exports=r},{"../../elliptic":1}],13:[function(e,t,n){"use strict";function r(e,t){this.eddsa=e,"object"!=typeof t&&(t=c(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),a(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof i&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}var i=e("bn.js"),o=e("../../elliptic").utils,a=o.assert,s=o.cachedProperty,c=o.parseBytes;s(r,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),s(r,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),s(r,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),s(r,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),r.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},r.prototype.toHex=function(){return o.encode(this.toBytes(),"hex").toUpperCase()},t.exports=r},{"../../elliptic":1,"bn.js":16}],14:[function(e,t,n){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},{}],15:[function(e,t,n){"use strict";var r=n,i=e("bn.js"),o=e("minimalistic-assert"),a=e("minimalistic-crypto-utils");r.assert=o,r.toArray=a.toArray,r.zero2=a.zero2,r.toHex=a.toHex,r.encode=a.encode,r.getNAF=function(e,t){for(var n=[],r=1<<t+1,i=e.clone();i.cmpn(1)>=0;){var o;if(i.isOdd()){var a=i.andln(r-1);o=a>(r>>1)-1?(r>>1)-a:a,i.isubn(o)}else o=0;n.push(o);for(var s=0!==i.cmpn(0)&&0===i.andln(r-1)?t+1:1,c=1;c<s;c++)n.push(0);i.iushrn(s)}return n},r.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r=0,i=0;e.cmpn(-r)>0||t.cmpn(-i)>0;){var o,a,s,c=e.andln(3)+r&3,u=t.andln(3)+i&3;3===c&&(c=-1),3===u&&(u=-1),o=0==(1&c)?0:3!=(s=e.andln(7)+r&7)&&5!==s||2!==u?c:-c,n[0].push(o),a=0==(1&u)?0:3!=(s=t.andln(7)+i&7)&&5!==s||2!==c?u:-u,n[1].push(a),2*r===o+1&&(r=1-r),2*i===a+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return n},r.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new i(e,"hex","le")}},{"bn.js":16,"minimalistic-assert":28,"minimalistic-crypto-utils":29}],16:[function(e,t,n){!function(t,n){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){return o.isBN(e)?e:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))))}function a(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o<i;o++){var a=e.charCodeAt(o)-48;r<<=4,r|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return r}function s(e,t,n,r){for(var i=0,o=Math.min(e.length,n),a=t;a<o;a++){var s=e.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}function c(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,c=a/67108864|0;n.words[0]=s;for(var u=1;u<r;u++){for(var l=c>>>26,d=67108863&c,h=Math.min(u,t.length-1),p=Math.max(0,u-e.length+1);p<=h;p++){var f=u-p|0;l+=(a=(i=0|e.words[f])*(o=0|t.words[p])+d)/67108864|0,d=67108863&a}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n.strip()}function u(e,t,n){return(new l).mulp(e,t,n)}function l(e,t){this.x=e,this.y=t}function d(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function f(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function g(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function v(e){g.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var y;"object"==typeof t?t.exports=o:n.BN=o,o.BN=o,o.wordSize=26;try{y=e("buffer").Buffer}catch(e){}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,o=0;for(n=e.length-6,r=0;n>=t;n-=6)i=a(e,n,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==t&&(i=a(e,t,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,c=Math.min(o,o-a)+n,u=0,l=n;l<c;l+=r)u=s(e,l,l+r,t),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=s(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var b=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],A=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var n;if(e=e||10,t=0|t||1,16===e||"hex"===e){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<i|o)).toString(16);n=0!=(o=s>>>24-i&16777215)||a!==this.length-1?b[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=A[e],l=_[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var h=d.modn(l).toString(e);n=(d=d.idivn(l)).isZero()?h+n:b[u-h.length]+h+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r(void 0!==y),this.toArrayLike(y,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(o),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<o;s++)u[s]=0}else{for(s=0;s<o-i;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[o-s-1]=a}return u},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var S=function(e,t,n){var r,i,o,a=e.words,s=t.words,c=n.words,u=0,l=0|a[0],d=8191&l,h=l>>>13,p=0|a[1],f=8191&p,m=p>>>13,g=0|a[2],v=8191&g,y=g>>>13,b=0|a[3],A=8191&b,_=b>>>13,S=0|a[4],I=8191&S,w=S>>>13,k=0|a[5],C=8191&k,E=k>>>13,P=0|a[6],T=8191&P,R=P>>>13,D=0|a[7],x=8191&D,L=D>>>13,M=0|a[8],F=8191&M,O=M>>>13,N=0|a[9],H=8191&N,B=N>>>13,U=0|s[0],q=8191&U,K=U>>>13,$=0|s[1],j=8191&$,V=$>>>13,W=0|s[2],G=8191&W,z=W>>>13,Q=0|s[3],X=8191&Q,J=Q>>>13,Y=0|s[4],Z=8191&Y,ee=Y>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,he=le>>>13,pe=0|s[9],fe=8191&pe,me=pe>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(u+(r=Math.imul(d,q))|0)+((8191&(i=(i=Math.imul(d,K))+Math.imul(h,q)|0))<<13)|0;u=((o=Math.imul(h,K))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(f,q),i=(i=Math.imul(f,K))+Math.imul(m,q)|0,o=Math.imul(m,K);var ve=(u+(r=r+Math.imul(d,j)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(h,j)|0))<<13)|0;u=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,q),i=(i=Math.imul(v,K))+Math.imul(y,q)|0,o=Math.imul(y,K),r=r+Math.imul(f,j)|0,i=(i=i+Math.imul(f,V)|0)+Math.imul(m,j)|0,o=o+Math.imul(m,V)|0;var ye=(u+(r=r+Math.imul(d,G)|0)|0)+((8191&(i=(i=i+Math.imul(d,z)|0)+Math.imul(h,G)|0))<<13)|0;u=((o=o+Math.imul(h,z)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(A,q),i=(i=Math.imul(A,K))+Math.imul(_,q)|0,o=Math.imul(_,K),r=r+Math.imul(v,j)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(y,j)|0,o=o+Math.imul(y,V)|0,r=r+Math.imul(f,G)|0,i=(i=i+Math.imul(f,z)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,z)|0;var be=(u+(r=r+Math.imul(d,X)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(h,X)|0))<<13)|0;u=((o=o+Math.imul(h,J)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(I,q),i=(i=Math.imul(I,K))+Math.imul(w,q)|0,o=Math.imul(w,K),r=r+Math.imul(A,j)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(_,j)|0,o=o+Math.imul(_,V)|0,r=r+Math.imul(v,G)|0,i=(i=i+Math.imul(v,z)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,z)|0,r=r+Math.imul(f,X)|0,i=(i=i+Math.imul(f,J)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,J)|0;var Ae=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(h,Z)|0))<<13)|0;u=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(C,q),i=(i=Math.imul(C,K))+Math.imul(E,q)|0,o=Math.imul(E,K),r=r+Math.imul(I,j)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(w,j)|0,o=o+Math.imul(w,V)|0,r=r+Math.imul(A,G)|0,i=(i=i+Math.imul(A,z)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,z)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(f,Z)|0,i=(i=i+Math.imul(f,ee)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,ee)|0;var _e=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(h,ne)|0))<<13)|0;u=((o=o+Math.imul(h,re)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(T,q),i=(i=Math.imul(T,K))+Math.imul(R,q)|0,o=Math.imul(R,K),r=r+Math.imul(C,j)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(E,j)|0,o=o+Math.imul(E,V)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,z)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,z)|0,r=r+Math.imul(A,X)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,J)|0,r=r+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(f,ne)|0,i=(i=i+Math.imul(f,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(h,oe)|0))<<13)|0;u=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(x,q),i=(i=Math.imul(x,K))+Math.imul(L,q)|0,o=Math.imul(L,K),r=r+Math.imul(T,j)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(R,j)|0,o=o+Math.imul(R,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,z)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,z)|0,r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,J)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(f,oe)|0,i=(i=i+Math.imul(f,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var Ie=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(h,ce)|0))<<13)|0;u=((o=o+Math.imul(h,ue)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(F,q),i=(i=Math.imul(F,K))+Math.imul(O,q)|0,o=Math.imul(O,K),r=r+Math.imul(x,j)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(L,j)|0,o=o+Math.imul(L,V)|0,r=r+Math.imul(T,G)|0,i=(i=i+Math.imul(T,z)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,z)|0,r=r+Math.imul(C,X)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(_,ne)|0,o=o+Math.imul(_,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,r=r+Math.imul(f,ce)|0,i=(i=i+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0;var we=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,he)|0)+Math.imul(h,de)|0))<<13)|0;u=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(H,q),i=(i=Math.imul(H,K))+Math.imul(B,q)|0,o=Math.imul(B,K),r=r+Math.imul(F,j)|0,i=(i=i+Math.imul(F,V)|0)+Math.imul(O,j)|0,o=o+Math.imul(O,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,z)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,z)|0,r=r+Math.imul(T,X)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(w,ne)|0,o=o+Math.imul(w,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,r=r+Math.imul(v,ce)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(f,de)|0,i=(i=i+Math.imul(f,he)|0)+Math.imul(m,de)|0,o=o+Math.imul(m,he)|0;var ke=(u+(r=r+Math.imul(d,fe)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(h,fe)|0))<<13)|0;u=((o=o+Math.imul(h,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(H,j),i=(i=Math.imul(H,V))+Math.imul(B,j)|0,o=Math.imul(B,V),r=r+Math.imul(F,G)|0,i=(i=i+Math.imul(F,z)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,z)|0,r=r+Math.imul(x,X)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,ae)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(_,ce)|0,o=o+Math.imul(_,ue)|0,r=r+Math.imul(v,de)|0,i=(i=i+Math.imul(v,he)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,he)|0;var Ce=(u+(r=r+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(H,G),i=(i=Math.imul(H,z))+Math.imul(B,G)|0,o=Math.imul(B,z),r=r+Math.imul(F,X)|0,i=(i=i+Math.imul(F,J)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,J)|0,r=r+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,ae)|0,r=r+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(w,ce)|0,o=o+Math.imul(w,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,he)|0)+Math.imul(_,de)|0,o=o+Math.imul(_,he)|0;var Ee=(u+(r=r+Math.imul(v,fe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,fe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(H,X),i=(i=Math.imul(H,J))+Math.imul(B,X)|0,o=Math.imul(B,J),r=r+Math.imul(F,Z)|0,i=(i=i+Math.imul(F,ee)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(x,ne)|0,i=(i=i+Math.imul(x,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,ae)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(I,de)|0,i=(i=i+Math.imul(I,he)|0)+Math.imul(w,de)|0,o=o+Math.imul(w,he)|0;var Pe=(u+(r=r+Math.imul(A,fe)|0)|0)+((8191&(i=(i=i+Math.imul(A,me)|0)+Math.imul(_,fe)|0))<<13)|0;u=((o=o+Math.imul(_,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(H,Z),i=(i=Math.imul(H,ee))+Math.imul(B,Z)|0,o=Math.imul(B,ee),r=r+Math.imul(F,ne)|0,i=(i=i+Math.imul(F,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,ae)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,he)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,he)|0;var Te=(u+(r=r+Math.imul(I,fe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(w,fe)|0))<<13)|0;u=((o=o+Math.imul(w,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(H,ne),i=(i=Math.imul(H,re))+Math.imul(B,ne)|0,o=Math.imul(B,re),r=r+Math.imul(F,oe)|0,i=(i=i+Math.imul(F,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,r=r+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,he)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,he)|0;var Re=(u+(r=r+Math.imul(C,fe)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(E,fe)|0))<<13)|0;u=((o=o+Math.imul(E,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(H,oe),i=(i=Math.imul(H,ae))+Math.imul(B,oe)|0,o=Math.imul(B,ae),r=r+Math.imul(F,ce)|0,i=(i=i+Math.imul(F,ue)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,ue)|0,r=r+Math.imul(x,de)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,he)|0;var De=(u+(r=r+Math.imul(T,fe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((o=o+Math.imul(R,me)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863,r=Math.imul(H,ce),i=(i=Math.imul(H,ue))+Math.imul(B,ce)|0,o=Math.imul(B,ue),r=r+Math.imul(F,de)|0,i=(i=i+Math.imul(F,he)|0)+Math.imul(O,de)|0,o=o+Math.imul(O,he)|0;var xe=(u+(r=r+Math.imul(x,fe)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(L,fe)|0))<<13)|0;u=((o=o+Math.imul(L,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(H,de),i=(i=Math.imul(H,he))+Math.imul(B,de)|0,o=Math.imul(B,he);var Le=(u+(r=r+Math.imul(F,fe)|0)|0)+((8191&(i=(i=i+Math.imul(F,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Me=(u+(r=Math.imul(H,fe))|0)+((8191&(i=(i=Math.imul(H,me))+Math.imul(B,fe)|0))<<13)|0;return u=((o=Math.imul(B,me))+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,c[0]=ge,c[1]=ve,c[2]=ye,c[3]=be,c[4]=Ae,c[5]=_e,c[6]=Se,c[7]=Ie,c[8]=we,c[9]=ke,c[10]=Ce,c[11]=Ee,c[12]=Pe,c[13]=Te,c[14]=Re,c[15]=De,c[16]=xe,c[17]=Le,c[18]=Me,0!==u&&(c[19]=u,n.length++),n};Math.imul||(S=c),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?S(this,e,t):n<63?c(this,e,t):n<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,c=Math.min(o,t.length-1),u=Math.max(0,o-e.length+1);u<=c;u++){var l=o-u,d=(0|e.words[l])*(0|t.words[u]),h=67108863&d;s=67108863&(h=h+s|0),i+=(a=(a=a+(d/67108864|0)|0)+(h>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):u(this,e,t)},l.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},l.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},l.prototype.permute=function(e,t,n,r,i,o){for(var a=0;a<o;a++)r[a]=t[e[a]],i[a]=n[e[a]]},l.prototype.transform=function(e,t,n,r,i,o){this.permute(o,e,t,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var d=c,h=u,p=0;p<a;p++){var f=n[l+p],m=r[l+p],g=n[l+p+a],v=r[l+p+a],y=d*g-h*v;v=d*v+h*g,g=y,n[l+p]=f+g,r[l+p]=m+v,n[l+p+a]=f-g,r[l+p+a]=m-v,p!==s&&(y=c*d-u*h,h=c*h+u*d,d=y)}},l.prototype.guessLen13b=function(e,t){var n=1|Math.max(t,e),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},l.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},l.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=8192*Math.round(e[2*r+1]/t)+Math.round(e[2*r]/t)+n;e[r]=67108863&i,n=i<67108864?0:i/67108864|0}return e},l.prototype.convert13b=function(e,t,n,i){for(var o=0,a=0;a<t;a++)o+=0|e[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},l.prototype.stub=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=0;return t},l.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),c=new Array(r),u=new Array(r),l=new Array(r),d=new Array(r),h=n.words;h.length=r,this.convert13b(e.words,e.length,a,r),this.convert13b(t.words,t.length,u,r),this.transform(a,o,s,c,r,i),this.transform(u,o,l,d,r,i);for(var p=0;p<r;p++){var f=s[p]*l[p]-c[p]*d[p];c[p]=s[p]*d[p]+c[p]*l[p],s[p]=f}return this.conjugate(s,c,r),this.transform(s,c,h,o,r,i),this.conjugate(h,o,r),this.normalize13b(h,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),u(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,c=(0|this.words[t])-s<<n;this.words[t]=c|a,a=s>>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,c=n;if(i-=a,i=Math.max(0,i),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n||!(this.words[n]&i))},o.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,n){var i,o=e.length+n;this._expand(o);var a,s=0;for(i=0;i<e.length;i++){a=(0|this.words[i+n])+s;var c=(0|e.words[i])*t;s=((a-=67108863&c)>>26)-(c/67108864|0),this.words[i+n]=67108863&a}for(;i<this.length-n;i++)s=(a=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&a;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(a=-(0|this.words[i])+s)>>26,this.words[i]=67108863&a;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,a=0|i.words[i.length-1];0!=(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,c=r.length-i.length;if("mod"!==t){(s=new o(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=r.clone()._ishlnsubmul(i,1,c);0===l.negative&&(r=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var h=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(h=Math.min(h/a|0,67108863),r._ishlnsubmul(i,h,d);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=h)}return s&&s.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var h=0,p=1;0==(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;0==(n.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(n.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(s),a.isub(c)):(n.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,i=e.clone();n=0!==n.negative?n.umod(e):n.clone();for(var a=new o(1),s=new o(0),c=i.clone();n.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(n.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(n.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,h=1;0==(i.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(i.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);n.cmp(i)>=0?(n.isub(i),a.isub(s)):(i.isub(n),s.isub(a))}return(t=0===n.cmpn(1)?a:s).cmpn(0)<0&&t.iadd(e),t},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new g(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var I={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},d.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n.strip(),n},d.prototype.split=function(e,t){e.iushrn(this.n,0,t)},d.prototype.imulK=function(e){return e.imul(this.k)},i(h,d),h.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},h.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(p,d),i(f,d),i(m,d),m.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(I[e])return I[e];var t;if("k256"===e)t=new h;else if("p224"===e)t=new p;else if("p192"===e)t=new f;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new m}return I[e]=t,t},g.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},g.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},g.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},g.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},g.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},g.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},g.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},g.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},g.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},g.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},g.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},g.prototype.isqr=function(e){return this.imul(e,e.clone())},g.prototype.sqr=function(e){return this.mul(e,e)},g.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),h=this.pow(e,i.addn(1).iushrn(1)),p=this.pow(e,i),f=a;0!==p.cmp(s);){for(var m=p,g=0;0!==m.cmp(s);g++)m=m.redSqr();r(g<f);var v=this.pow(d,new o(1).iushln(f-g-1));h=h.redMul(v),d=v.redSqr(),p=p.redMul(d),f=g}return h},g.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},g.prototype.pow=function(e,t){if(t.isZero())return new o(1);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),r=t.length-1;r>=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}c=26}return i},g.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},g.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new v(e)},i(v,g),v.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},v.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},v.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},v.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},v.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{}],17:[function(e,t,n){function r(e){this.rand=e}var i;if(t.exports=function(e){return i||(i=new r(null)),i.generate(e)},t.exports.Rand=r,r.prototype.generate=function(e){return this._rand(e)},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?r.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?r.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:r.prototype._rand=function(){throw new Error("Not implemented yet")};else try{var o=e("crypto");r.prototype._rand=function(e){return o.randomBytes(e)}}catch(e){r.prototype._rand=function(e){for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t}}},{crypto:18}],18:[function(e,t,n){},{}],19:[function(e,t,n){var r=n;r.utils=e("./hash/utils"),r.common=e("./hash/common"),r.sha=e("./hash/sha"),r.ripemd=e("./hash/ripemd"),r.hmac=e("./hash/hmac"),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},{"./hash/common":20,"./hash/hmac":21,"./hash/ripemd":22,"./hash/sha":23,"./hash/utils":24}],20:[function(e,t,n){function r(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var i=e("../hash").utils,o=i.assert;n.BlockHash=r,r.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},r.prototype.digest=function(e){return this.update(this._pad()),o(null===this.pending),this._digest(e)},r.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=e>>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r}},{"../hash":19}],21:[function(e,t,n){function r(e,t,n){return this instanceof r?(this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,void this._init(i.toArray(t,n))):new r(e,t,n)}var i=e("../hash").utils,o=i.assert;t.exports=r,r.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),o(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},r.prototype.update=function(e,t){return this.inner.update(e,t),this},r.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},{"../hash":19}],22:[function(e,t,n){function r(){return this instanceof r?(p.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],void(this.endian="little")):new r}function i(e,t,n,r){return e<=15?t^n^r:e<=31?t&n|~t&r:e<=47?(t|~n)^r:e<=63?t&r|n&~r:t^(n|~r)}function o(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function a(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var s=e("../hash"),c=s.utils,u=c.rotl32,l=c.sum32,d=c.sum32_3,h=c.sum32_4,p=s.common.BlockHash;c.inherits(r,p),n.ripemd160=r,r.blockSize=512,r.outSize=160,r.hmacStrength=192,r.padLength=64,r.prototype._update=function(e,t){for(var n=this.h[0],r=this.h[1],s=this.h[2],c=this.h[3],p=this.h[4],y=n,b=r,A=s,_=c,S=p,I=0;I<80;I++){var w=l(u(h(n,i(I,r,s,c),e[f[I]+t],o(I)),g[I]),p);n=p,p=c,c=u(s,10),s=r,r=w,w=l(u(h(y,i(79-I,b,A,_),e[m[I]+t],a(I)),v[I]),S),y=S,S=_,_=u(A,10),A=b,b=w}w=d(this.h[1],s,_),this.h[1]=d(this.h[2],c,S),this.h[2]=d(this.h[3],p,y),this.h[3]=d(this.h[4],n,b),this.h[4]=d(this.h[0],r,A),this.h[0]=w},r.prototype._digest=function(e){return"hex"===e?c.toHex32(this.h,"little"):c.split32(this.h,"little")};var f=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],m=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],v=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"../hash":19}],23:[function(e,t,n){function r(){return this instanceof r?(W.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=G,void(this.W=new Array(64))):new r}function i(){return this instanceof i?(r.call(this),void(this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])):new i}function o(){return this instanceof o?(W.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=z,void(this.W=new Array(160))):new o}function a(){return this instanceof a?(o.call(this),void(this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428])):new a}function s(){return this instanceof s?(W.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],void(this.W=new Array(80))):new s}function c(e,t,n){return e&t^~e&n}function u(e,t,n){return e&t^e&n^t&n}function l(e){return R(e,2)^R(e,13)^R(e,22)}function d(e){return R(e,6)^R(e,11)^R(e,25)}function h(e){return R(e,7)^R(e,18)^e>>>3}function p(e){return R(e,17)^R(e,19)^e>>>10}function f(e,t,n,r){return 0===e?c(t,n,r):1===e||3===e?function(e,t,n){return e^t^n}(t,n,r):2===e?u(t,n,r):void 0}function m(e,t,n,r,i,o){var a=e&n^~e&i;return a<0&&(a+=4294967296),a}function g(e,t,n,r,i,o){var a=t&r^~t&o;return a<0&&(a+=4294967296),a}function v(e,t,n,r,i,o){var a=e&n^e&i^n&i;return a<0&&(a+=4294967296),a}function y(e,t,n,r,i,o){var a=t&r^t&o^r&o;return a<0&&(a+=4294967296),a}function b(e,t){var n=F(e,t,28)^F(t,e,2)^F(t,e,7);return n<0&&(n+=4294967296),n}function A(e,t){var n=O(e,t,28)^O(t,e,2)^O(t,e,7);return n<0&&(n+=4294967296),n}function _(e,t){var n=F(e,t,14)^F(e,t,18)^F(t,e,9);return n<0&&(n+=4294967296),n}function S(e,t){var n=O(e,t,14)^O(e,t,18)^O(t,e,9);return n<0&&(n+=4294967296),n}function I(e,t){var n=F(e,t,1)^F(e,t,8)^N(e,t,7);return n<0&&(n+=4294967296),n}function w(e,t){var n=O(e,t,1)^O(e,t,8)^H(e,t,7);return n<0&&(n+=4294967296),n}function k(e,t){var n=F(e,t,19)^F(t,e,29)^N(e,t,6);return n<0&&(n+=4294967296),n}function C(e,t){var n=O(e,t,19)^O(t,e,29)^H(e,t,6);return n<0&&(n+=4294967296),n}var E=e("../hash"),P=E.utils,T=P.assert,R=P.rotr32,D=P.rotl32,x=P.sum32,L=P.sum32_4,M=P.sum32_5,F=P.rotr64_hi,O=P.rotr64_lo,N=P.shr64_hi,H=P.shr64_lo,B=P.sum64,U=P.sum64_hi,q=P.sum64_lo,K=P.sum64_4_hi,$=P.sum64_4_lo,j=P.sum64_5_hi,V=P.sum64_5_lo,W=E.common.BlockHash,G=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],z=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Q=[1518500249,1859775393,2400959708,3395469782];P.inherits(r,W),n.sha256=r,r.blockSize=512,r.outSize=256,r.hmacStrength=192,r.padLength=64,r.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=L(p(n[r-2]),n[r-7],h(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],f=this.h[4],m=this.h[5],g=this.h[6],v=this.h[7];for(T(this.k.length===n.length),r=0;r<n.length;r++){var y=M(v,d(f),c(f,m,g),this.k[r],n[r]),b=x(l(i),u(i,o,a));v=g,g=m,m=f,f=x(s,y),s=a,a=o,o=i,i=x(y,b)}this.h[0]=x(this.h[0],i),this.h[1]=x(this.h[1],o),this.h[2]=x(this.h[2],a),this.h[3]=x(this.h[3],s),this.h[4]=x(this.h[4],f),this.h[5]=x(this.h[5],m),this.h[6]=x(this.h[6],g),this.h[7]=x(this.h[7],v)},r.prototype._digest=function(e){return"hex"===e?P.toHex32(this.h,"big"):P.split32(this.h,"big")},P.inherits(i,r),n.sha224=i,i.blockSize=512,i.outSize=224,i.hmacStrength=192,i.padLength=64,i.prototype._digest=function(e){return"hex"===e?P.toHex32(this.h.slice(0,7),"big"):P.split32(this.h.slice(0,7),"big")},P.inherits(o,W),n.sha512=o,o.blockSize=1024,o.outSize=512,o.hmacStrength=192,o.padLength=128,o.prototype._prepareBlock=function(e,t){for(var n=this.W,r=0;r<32;r++)n[r]=e[t+r];for(;r<n.length;r+=2){var i=k(n[r-4],n[r-3]),o=C(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],c=I(n[r-30],n[r-29]),u=w(n[r-30],n[r-29]),l=n[r-32],d=n[r-31];n[r]=K(i,o,a,s,c,u,l,d),n[r+1]=$(i,o,a,s,c,u,l,d)}},o.prototype._update=function(e,t){this._prepareBlock(e,t);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],c=this.h[5],u=this.h[6],l=this.h[7],d=this.h[8],h=this.h[9],p=this.h[10],f=this.h[11],I=this.h[12],w=this.h[13],k=this.h[14],C=this.h[15];T(this.k.length===n.length);for(var E=0;E<n.length;E+=2){var P=k,R=C,D=_(d,h),x=S(d,h),L=m(d,0,p,0,I),M=g(0,h,0,f,0,w),F=this.k[E],O=this.k[E+1],N=n[E],H=n[E+1],K=j(P,R,D,x,L,M,F,O,N,H),$=V(P,R,D,x,L,M,F,O,N,H),W=(P=b(r,i),R=A(r,i),D=v(r,0,o,0,s),x=y(0,i,0,a,0,c),U(P,R,D,x)),G=q(P,R,D,x);k=I,C=w,I=p,w=f,p=d,f=h,d=U(u,l,K,$),h=q(l,l,K,$),u=s,l=c,s=o,c=a,o=r,a=i,r=U(K,$,W,G),i=q(K,$,W,G)}B(this.h,0,r,i),B(this.h,2,o,a),B(this.h,4,s,c),B(this.h,6,u,l),B(this.h,8,d,h),B(this.h,10,p,f),B(this.h,12,I,w),B(this.h,14,k,C)},o.prototype._digest=function(e){return"hex"===e?P.toHex32(this.h,"big"):P.split32(this.h,"big")},P.inherits(a,o),n.sha384=a,a.blockSize=1024,a.outSize=384,a.hmacStrength=192,a.padLength=128,a.prototype._digest=function(e){return"hex"===e?P.toHex32(this.h.slice(0,12),"big"):P.split32(this.h.slice(0,12),"big")},P.inherits(s,W),n.sha1=s,s.blockSize=512,s.outSize=160,s.hmacStrength=80,s.padLength=64,s.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=D(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],c=this.h[4];for(r=0;r<n.length;r++){var u=~~(r/20),l=M(D(i,5),f(u,o,a,s),c,n[r],Q[u]);c=s,s=a,a=D(o,30),o=i,i=l}this.h[0]=x(this.h[0],i),this.h[1]=x(this.h[1],o),this.h[2]=x(this.h[2],a),this.h[3]=x(this.h[3],s),this.h[4]=x(this.h[4],c)},s.prototype._digest=function(e){return"hex"===e?P.toHex32(this.h,"big"):P.split32(this.h,"big")}},{"../hash":19}],24:[function(e,t,n){function r(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function i(e){return 1===e.length?"0"+e:e}function o(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}function a(e,t){if(!e)throw new Error(t||"Assertion failed")}var s=n,c=e("inherits");s.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(var r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}}else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}else for(r=0;r<e.length;r++)n[r]=0|e[r];return n},s.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=i(e[n].toString(16));return t},s.htonl=r,s.toHex32=function(e,t){for(var n="",i=0;i<e.length;i++){var a=e[i];"little"===t&&(a=r(a)),n+=o(a.toString(16))}return n},s.zero2=i,s.zero8=o,s.join32=function(e,t,n,r){var i=n-t;a(i%4==0);for(var o=new Array(i/4),s=0,c=t;s<o.length;s++,c+=4){var u;u="big"===r?e[c]<<24|e[c+1]<<16|e[c+2]<<8|e[c+3]:e[c+3]<<24|e[c+2]<<16|e[c+1]<<8|e[c],o[s]=u>>>0}return o},s.split32=function(e,t){for(var n=new Array(4*e.length),r=0,i=0;r<e.length;r++,i+=4){var o=e[r];"big"===t?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},s.rotr32=function(e,t){return e>>>t|e<<32-t},s.rotl32=function(e,t){return e<<t|e>>>32-t},s.sum32=function(e,t){return e+t>>>0},s.sum32_3=function(e,t,n){return e+t+n>>>0},s.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},s.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},s.assert=a,s.inherits=c,n.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0,a=(o<r?1:0)+n+i;e[t]=a>>>0,e[t+1]=o},n.sum64_hi=function(e,t,n,r){return(t+r>>>0<t?1:0)+e+n>>>0},n.sum64_lo=function(e,t,n,r){return t+r>>>0},n.sum64_4_hi=function(e,t,n,r,i,o,a,s){var c=0,u=t;return c+=(u=u+r>>>0)<t?1:0,c+=(u=u+o>>>0)<o?1:0,e+n+i+a+(c+=(u=u+s>>>0)<s?1:0)>>>0},n.sum64_4_lo=function(e,t,n,r,i,o,a,s){return t+r+o+s>>>0},n.sum64_5_hi=function(e,t,n,r,i,o,a,s,c,u){var l=0,d=t;return l+=(d=d+r>>>0)<t?1:0,l+=(d=d+o>>>0)<o?1:0,l+=(d=d+s>>>0)<s?1:0,e+n+i+a+c+(l+=(d=d+u>>>0)<u?1:0)>>>0},n.sum64_5_lo=function(e,t,n,r,i,o,a,s,c,u){return t+r+o+s+u>>>0},n.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},n.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},n.shr64_hi=function(e,t,n){return e>>>n},n.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},{inherits:27}],25:[function(e,t,n){"use strict";function r(e){if(!(this instanceof r))return new r(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this.reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=o.toArray(e.entropy,e.entropyEnc||"hex"),n=o.toArray(e.nonce,e.nonceEnc||"hex"),i=o.toArray(e.pers,e.persEnc||"hex");a(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,i)}var i=e("hash.js"),o=e("minimalistic-crypto-utils"),a=e("minimalistic-assert");t.exports=r,r.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this.reseed=1,this.reseedInterval=281474976710656},r.prototype._hmac=function(){return new i.hmac(this.hash,this.K)},r.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},r.prototype.reseed=function(e,t,n,r){"string"!=typeof t&&(r=n,n=t,t=null),e=o.toArray(e,t),n=o.toArray(n,r),a(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this.reseed=1},r.prototype.generate=function(e,t,n,r){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=o.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var a=i.slice(0,e);return this._update(n),this.reseed++,o.encode(a,t)}},{"hash.js":19,"minimalistic-assert":28,"minimalistic-crypto-utils":26}],26:[function(e,t,n){"use strict";function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}var o=n;o.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16));else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},o.zero2=r,o.toHex=i,o.encode=function(e,t){return"hex"===t?i(e):e}},{}],27:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],28:[function(e,t,n){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}t.exports=r,r.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},{}],29:[function(e,t,n){"use strict";function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}var o=n;o.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},o.zero2=r,o.toHex=i,o.encode=function(e,t){return"hex"===t?i(e):e}},{}],30:[function(e,t,n){t.exports={name:"elliptic",version:"6.4.0",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"}}},{}]},{},[1])(1)}(),function(e){"use strict";function t(e,t){t?(l[0]=l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0,this.blocks=l):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}function n(e,n,o){var a,s=typeof e;if("string"===s){var c,u=[],l=e.length,d=0;for(a=0;a<l;++a)(c=e.charCodeAt(a))<128?u[d++]=c:c<2048?(u[d++]=192|c>>6,u[d++]=128|63&c):c<55296||c>=57344?(u[d++]=224|c>>12,u[d++]=128|c>>6&63,u[d++]=128|63&c):(c=65536+((1023&c)<<10|1023&e.charCodeAt(++a)),u[d++]=240|c>>18,u[d++]=128|c>>12&63,u[d++]=128|c>>6&63,u[d++]=128|63&c);e=u}else{if("object"!==s)throw new Error(r);if(null===e)throw new Error(r);if(i&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||i&&ArrayBuffer.isView(e)))throw new Error(r)}e.length>64&&(e=new t(n,!0).update(e).array());var h=[],p=[];for(a=0;a<64;++a){var f=e[a]||0;h[a]=92^f,p[a]=54^f}t.call(this,n,o),this.update(p),this.oKeyPad=h,this.inner=!0,this.sharedMemory=o}var r="input is invalid type",i=!e.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,o="0123456789abcdef".split(""),a=[-2147483648,8388608,32768,128],s=[24,16,8,0],c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],u=["hex","array","digest","arrayBuffer"],l=[];!e.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!i||!e.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var d=function(e,n){return function(r){return new t(n,!0).update(r)[e]()}},h=function(e){var n=d("hex",e);n.create=function(){return new t(e)},n.update=function(e){return n.create().update(e)};for(var r=0;r<u.length;++r){var i=u[r];n[i]=d(i,e)}return n},p=function(e,t){return function(r,i){return new n(r,t,!0).update(i)[e]()}},f=function(e){var t=p("hex",e);t.create=function(t){return new n(t,e)},t.update=function(e,n){return t.create(e).update(n)};for(var r=0;r<u.length;++r){var i=u[r];t[i]=p(i,e)}return t};t.prototype.update=function(e){if(!this.finalized){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(r);if(null===e)throw new Error(r);if(i&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||i&&ArrayBuffer.isView(e)))throw new Error(r);t=!0}for(var o,a,c=0,u=e.length,l=this.blocks;c<u;){if(this.hashed&&(this.hashed=!1,l[0]=this.block,l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0),t)for(a=this.start;c<u&&a<64;++c)l[a>>2]|=e[c]<<s[3&a++];else for(a=this.start;c<u&&a<64;++c)(o=e.charCodeAt(c))<128?l[a>>2]|=o<<s[3&a++]:o<2048?(l[a>>2]|=(192|o>>6)<<s[3&a++],l[a>>2]|=(128|63&o)<<s[3&a++]):o<55296||o>=57344?(l[a>>2]|=(224|o>>12)<<s[3&a++],l[a>>2]|=(128|o>>6&63)<<s[3&a++],l[a>>2]|=(128|63&o)<<s[3&a++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++c)),l[a>>2]|=(240|o>>18)<<s[3&a++],l[a>>2]|=(128|o>>12&63)<<s[3&a++],l[a>>2]|=(128|o>>6&63)<<s[3&a++],l[a>>2]|=(128|63&o)<<s[3&a++]);this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.block=l[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=a[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},t.prototype.hash=function(){var e,t,n,r,i,o,a,s,u,l=this.h0,d=this.h1,h=this.h2,p=this.h3,f=this.h4,m=this.h5,g=this.h6,v=this.h7,y=this.blocks;for(e=16;e<64;++e)t=((i=y[e-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,n=((i=y[e-2])>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,y[e]=y[e-16]+t+y[e-7]+n<<0;for(u=d&h,e=0;e<64;e+=4)this.first?(this.is224?(o=300032,v=(i=y[0]-1413257819)-150054599<<0,p=i+24177077<<0):(o=704751109,v=(i=y[0]-210244248)-1521486534<<0,p=i+143694565<<0),this.first=!1):(t=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),r=(o=l&d)^l&h^u,v=p+(i=v+(n=(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&m^~f&g)+c[e]+y[e])<<0,p=i+(t+r)<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),r=(a=p&l)^p&d^o,g=h+(i=g+(n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&f^~v&m)+c[e+1]+y[e+1])<<0,t=((h=i+(t+r)<<0)>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),r=(s=h&p)^h&l^a,m=d+(i=m+(n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&v^~g&f)+c[e+2]+y[e+2])<<0,t=((d=i+(t+r)<<0)>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),r=(u=d&h)^d&p^s,f=l+(i=f+(n=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(m&g^~m&v)+c[e+3]+y[e+3])<<0,l=i+(t+r)<<0;this.h0=this.h0+l<<0,this.h1=this.h1+d<<0,this.h2=this.h2+h<<0,this.h3=this.h3+p<<0,this.h4=this.h4+f<<0,this.h5=this.h5+m<<0,this.h6=this.h6+g<<0,this.h7=this.h7+v<<0},t.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,c=this.h7,u=o[e>>28&15]+o[e>>24&15]+o[e>>20&15]+o[e>>16&15]+o[e>>12&15]+o[e>>8&15]+o[e>>4&15]+o[15&e]+o[t>>28&15]+o[t>>24&15]+o[t>>20&15]+o[t>>16&15]+o[t>>12&15]+o[t>>8&15]+o[t>>4&15]+o[15&t]+o[n>>28&15]+o[n>>24&15]+o[n>>20&15]+o[n>>16&15]+o[n>>12&15]+o[n>>8&15]+o[n>>4&15]+o[15&n]+o[r>>28&15]+o[r>>24&15]+o[r>>20&15]+o[r>>16&15]+o[r>>12&15]+o[r>>8&15]+o[r>>4&15]+o[15&r]+o[i>>28&15]+o[i>>24&15]+o[i>>20&15]+o[i>>16&15]+o[i>>12&15]+o[i>>8&15]+o[i>>4&15]+o[15&i]+o[a>>28&15]+o[a>>24&15]+o[a>>20&15]+o[a>>16&15]+o[a>>12&15]+o[a>>8&15]+o[a>>4&15]+o[15&a]+o[s>>28&15]+o[s>>24&15]+o[s>>20&15]+o[s>>16&15]+o[s>>12&15]+o[s>>8&15]+o[s>>4&15]+o[15&s];return this.is224||(u+=o[c>>28&15]+o[c>>24&15]+o[c>>20&15]+o[c>>16&15]+o[c>>12&15]+o[c>>8&15]+o[c>>4&15]+o[15&c]),u},t.prototype.toString=t.prototype.hex,t.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,o=this.h5,a=this.h6,s=this.h7,c=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,r>>24&255,r>>16&255,r>>8&255,255&r,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a];return this.is224||c.push(s>>24&255,s>>16&255,s>>8&255,255&s),c},t.prototype.array=t.prototype.digest,t.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e},n.prototype=new t,n.prototype.finalize=function(){if(t.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();t.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(e),t.prototype.finalize.call(this)}};var m=h();m.sha256=m,m.sha224=h(!0),m.sha256.hmac=f(),m.sha224.hmac=f(!0),e.sha256=m.sha256,e.sha224=m.sha224}("undefined"!=typeof window?window:global),function(e){"use strict";function t(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function n(e){var t=e.length%4;if(t>0)for(var n=4-t;n>0;)e+="=",n--;return e}function r(e){return a[e>>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}function i(e,t,n){for(var i,o=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(r(i));return o.join("")}var o={byteLength:function(e){var r=t(n(e)),i=r[0],o=r[1];return 3*(i+o)/4-o},toByteArray:function(e){for(var r,i=t(n(e)),o=i[0],a=i[1],u=new c(function(e,t,n){return 3*(t+n)/4-n}(0,o,a)),l=0,d=a>0?o-4:o,h=0;h<d;h+=4)r=s[e.charCodeAt(h)]<<18|s[e.charCodeAt(h+1)]<<12|s[e.charCodeAt(h+2)]<<6|s[e.charCodeAt(h+3)],u[l++]=r>>16&255,u[l++]=r>>8&255,u[l++]=255&r;return 2===a&&(r=s[e.charCodeAt(h)]<<2|s[e.charCodeAt(h+1)]>>4,u[l++]=255&r),1===a&&(r=s[e.charCodeAt(h)]<<10|s[e.charCodeAt(h+1)]<<4|s[e.charCodeAt(h+2)]>>2,u[l++]=r>>8&255,u[l++]=255&r),u},fromByteArray:function(e){for(var t,n=e.length,r=n%3,o=[],s=16383,c=0,u=n-r;c<u;c+=s)o.push(i(e,c,c+s>u?u:c+s));return 1===r?(t=e[n-1],o.push(a[t>>2]+a[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"=")),o.join("")}};e.base64js=o;for(var a=[],s=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,d=u.length;l<d;++l)a[l]=u[l],s[u.charCodeAt(l)]=l;s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63}("undefined"!=typeof window?window:global),function(e){!function(e){!function(e){!function(e){var t,n;t=e.core||(e.core={}),n=function(){function t(e,t,n){this._session=t,this._sdk=e,this._clientContext=n,this._uiHandler=e.currentUiHandler}return t.prototype.run=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"approvals: Starting session"),this.queryApprovalsFromServer().then(function(e){return new Promise(function(n,r){t._completeFn=n,t._rejectFn=r,t.kickStartSession(e)})})},t.prototype.approve=function(t,n){return this.changeApprovalStatus(t,e.MobileApprovalStatus.Approved,n)},t.prototype.deny=function(t){return this.changeApprovalStatus(t,e.MobileApprovalStatus.Denied).then(function(e){return!0})},t.prototype.requestRefreshApprovals=function(){var t=this;return this.queryApprovalsFromServer().then(function(e){return t.updateManagedApprovals(e),!0},function(t){throw e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t)})},t.prototype.finishSession=function(){if(!this._appSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to finish a non started approval session.");this._appSession.endSession(),this._appSession=null,this._completeFn(!0)},t.prototype.kickStartSession=function(t){this._appSession=this._sdk.currentUiHandler.createApprovalsSession(this._session.user.displayName),this._appSession?(this.updateManagedApprovals(t),this._appSession.startSession(this,null,this._clientContext)):this._rejectFn(e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createTicketWaitSession."))},t.prototype.updateManagedApprovals=function(t){if(this._managedApprovals=t,!this._appSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to update approvals on a non started approval session.");this._appSession.setSessionApprovalsList(t)},t.prototype.queryApprovalsFromServer=function(){var t=this;this._sdk.log(e.LogLevel.Debug,"approvals: Initiating collection");var n=this._sdk.promiseCollectionResult();return e.util.wrapPromiseWithActivityIndicator(this._uiHandler,null,this._clientContext,n.then(function(n){t._sdk.log(e.LogLevel.Debug,"approvals: Collection done; setting up request to query approvals");var r=t._session.createApprovalsFetchRequest(n);return t._sdk.log(e.LogLevel.Debug,"approvals: Sending request to query approvals"),t._session.performSessionExchange(r).then(function(t){return t.data.approvals.map(function(t){return new e.impl.ManagedMobileApprovalImpl(t)})})}))},t.prototype.changeApprovalStatus=function(t,n,r){var i=this;this._sdk.log(e.LogLevel.Debug,"approval: change status of approval "+t.getApproval().getApprovalId()+" to "+n),this._sdk.log(e.LogLevel.Debug,"approval: Initiating request promise");var o=this._sdk.promiseCollectionResult().then(function(r){return i._sdk.log(e.LogLevel.Debug,"approval: Collection done; setting up request"),i._session.createApprovalReplyRequest(r,t.getApproval().getApprovalId(),n)});return this._sdk.log(e.LogLevel.Debug,"approval: Initiating control flow"),this._session.startControlFlow(o,t.getApproval(),r||this._clientContext).then(function(e){return t.getApproval().updateStatus(n),i.updateManagedApprovals(i._managedApprovals),e},function(t){var n=e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t);throw i._sdk.log(e.LogLevel.Debug,"approval: Got server error "+n),n.getErrorCode()==e.AuthenticationErrorCode.Internal&&n.getData()&&6001==n.getData().server_error_code?(i._sdk.log(e.LogLevel.Debug,"approval: Converting server error"),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.ApprovalWrongState,n.getMessage())):n})},t}(),t.ApprovalSessionProcessor=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n;!function(r){var i;!function(e){e[e.Builtin=0]="Builtin",e[e.Placeholder=1]="Placeholder",e[e.Fido=2]="Fido"}(i=r.AuthenticatorPrototype||(r.AuthenticatorPrototype={}));var o=function(){function o(e,t,n,r){this._session=e,this._authenticatorId=t;var o=t.match(/^placeholder_(.*)$/);if(o){this._authenticatorPrototype=i.Placeholder,this._placeholderId=o[1];var a=n;this._authetnicationMethodTypeName=a.placeholder_type}else if(t.match(/^fido_(.*)$/)){this._authenticatorPrototype=i.Fido;var s=n;this._authetnicationMethodTypeName=s.authenticator_type}else this._authenticatorPrototype=i.Builtin,this._authetnicationMethodTypeName=this._authenticatorId;this._authenticatorMethodConfig=n,this._serverReportedRegistrationStatus=r.status,this._expired=r.expired||!1,this._locked=r.locked||!1}return Object.defineProperty(o.prototype,"authenticationDriverDescriptor",{get:function(){var t=this.internalAuthenticationDriverDescriptor();if(!t)throw new e.ts.mobile.sdk.impl.AuthenticationErrorImpl(e.ts.mobile.sdk.AuthenticationErrorCode.Internal,"Unhandled authenticator: "+this.getAuthenticatorId());return t},enumerable:!0,configurable:!0}),o.prototype.internalAuthenticationDriverDescriptor=function(){switch(this._authenticatorPrototype){case i.Placeholder:return r.AuthenticatorDrivers.__placeholder;case i.Fido:return new r.AuthenticationDriverDescriptorFido(this._authenticatorMethodConfig.fido_policy);case i.Builtin:default:return r.AuthenticatorDrivers[this.getAuthenticatorId()]}},o.prototype.getAuthenticatorId=function(){return this._authenticatorId},o.prototype.getType=function(){var e=n.Protocol.AuthTypeData[this._authetnicationMethodTypeName];return e&&"authTypeEnum"in e?e.authTypeEnum:t.AuthenticatorType.Generic},o.prototype.getName=function(){var e=n.Protocol.AuthTypeData[this._authetnicationMethodTypeName];return e&&e.authTypeName||"Generic"},o.prototype.getExpired=function(){return this._expired},o.prototype.getRegistered=function(){return this.getRegistrationStatus()==t.AuthenticatorRegistrationStatus.Registered},o.prototype.getRegistrationStatus=function(){return this._serverReportedRegistrationStatus!=n.Protocol.AuthenticationMethodStatus.Registered?t.AuthenticatorRegistrationStatus.Unregistered:this.authenticationDriverDescriptor.evaluateLocalRegistrationStatus(this._session)},o.prototype.getLocked=function(){return this._locked},o.prototype.getDefaultAuthenticator=function(){return this._session.user.defaultAuthId==this.getAuthenticatorId()},o.prototype.getSupportedOnDevice=function(){return this.internalAuthenticationDriverDescriptor()&&this.authenticationDriverDescriptor.isSupportedOnDevice(this._session)},o.prototype.getPlaceholderId=function(){return this._placeholderId},o.prototype.updateWithAuthenticatorState=function(e){this._expired=e.expired||!1,this._locked=e.locked||!1,this._serverReportedRegistrationStatus=e.status},o}();r.AuthenticatorDescriptionImpl=o}((n=t.core||(t.core={})).authenticationdrivers||(n.authenticationdrivers={}))}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getEnabled=function(){return this.getSupportedOnDevice()},t}(t.authenticationdrivers.AuthenticatorDescriptionImpl),r=function(){function r(e,t,n,r){this._sdk=e,this._session=t,this._token=r||null,this._clientContext=n,this._uiHandler=this._sdk.currentUiHandler}return r.prototype.run=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"configuration: Starting session"),this.queryConfigMenuFromServerAndFilter().then(function(e){return new Promise(function(n,r){t.kickStartSession(e),t._completeFn=n,t._rejectFn=r})})},r.prototype.registerAuthenticator=function(e,t){return this.requestAuthenticatorRegistrationChange(e,!0,t)},r.prototype.reregisterAuthenticator=function(e,t){return this.requestAuthenticatorRegistrationChange(e,!0,t)},r.prototype.setDefaultAuthenticator=function(n){var r=this;return this._sdk.log(e.LogLevel.Info,"Coniguration: Updating user default authenticator."),new Promise(function(e,i){if(!r._session.anonymous){var o=r._session.user;o.updateDefaultAuthId(n.getDescription().getAuthenticatorId()),r._session.persistUserData&&t.User.save(r._sdk,o)}e(!0),r.updateManagedAuthenticators(r._authenticators)})},r.prototype.unregisterAuthenticator=function(e,t){return this.requestAuthenticatorRegistrationChange(e,!1,t).then(function(e){return!0})},r.prototype.requestRefreshAuthenticators=function(){var t=this;return this.queryConfigMenuFromServerAndFilter().then(function(e){return t.updateManagedAuthenticators(e),!0},function(t){throw e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t)})},r.prototype.finishSession=function(){if(!this._appSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to finish a non started config session.");this._appSession.endSession(),this._appSession=null,this._completeFn(!0)},r.prototype.kickStartSession=function(t){this._appSession=this._uiHandler.createAuthenticationConfigurationSession(this._session.user.displayName),this._appSession?(this._appSession.startSession(this,null,this._clientContext),this.updateManagedAuthenticators(t)):this._rejectFn(e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createAuthenticationConfigurationSession."))},r.prototype.updateManagedAuthenticators=function(t){if(!this._appSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to work with a non started config session.");var n={};t.forEach(function(e){n[e.getDescription().getAuthenticatorId()]=e}),this._authenticators=t,this._authenticatorsByName=n,this._appSession.setAuthenticatorsList(t)},r.prototype.queryConfigMenuFromServerAndFilter=function(){var t=this;this._sdk.log(e.LogLevel.Debug,"configuration: Initiating collection");var r=this._sdk.promiseCollectionResult();return e.util.wrapPromiseWithActivityIndicator(this._uiHandler,null,this._clientContext,r.then(function(r){t._sdk.log(e.LogLevel.Debug,"configuration: Collection done; setting up request to query for config menu");var i=t._session.createConfigMenuFetchRequest(r,t._token);return t._sdk.log(e.LogLevel.Debug,"configuration: Sending request to query approvals"),t._session.performSessionExchange(i).then(function(r){var i=r.data&&"configuration"==r.data.type&&r.data;if(!i)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid configuration screen structure encountered.");return i.methods.map(function(r){var i=new n(t._session,r.type,r,r);return new e.impl.ConfigurableAuthenticatorImpl(i,r.options)}).filter(function(e){return e.getDescription().getSupportedOnDevice()})})}))},r.prototype.requestAuthenticatorRegistrationChange=function(n,r,i){var o=this;this._sdk.log(e.LogLevel.Debug,"configuration: Authenticator "+n.getDescription().getName()+" request (un)registration "+r),this._sdk.log(e.LogLevel.Debug,"configuration: Initiating registration request promise");var a=this._sdk.promiseCollectionResult().then(function(t){return o._sdk.log(e.LogLevel.Debug,"configuration: Collection done; setting up request"),o._session.createAuthRegistrationRequest(t,n.getDescription().getAuthenticatorId(),r,o._token)});return this._sdk.log(e.LogLevel.Debug,"configuration: Initiating control flow"),this._session.startControlFlow(a,null,i||this._clientContext).then(function(i){var a=i.getInternalData(),s=!1;if(a&&a.methods&&a.methods.length&&(o._sdk.log(e.LogLevel.Debug,"configuration: Processing updates."),a.methods.forEach(function(e){var t=o._authenticatorsByName[e.type];t&&(t.getDescription().updateWithAuthenticatorState(e),s=!0)})),s){if(!r&&n.getDescription().getDefaultAuthenticator&&!o._session.anonymous){var c=o._session.user;c.updateDefaultAuthId(""),o._session.persistUserData&&t.User.save(o._sdk,c)}o.updateManagedAuthenticators(o._authenticators)}return i},function(t){throw e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t)})},r}(),t.AuthenticationConfigurationSessionProcessor=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t){this._sdk=e,this._user=t}return Object.defineProperty(e.prototype,"user",{get:function(){return this._user},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sdk",{get:function(){return this._sdk},enumerable:!0,configurable:!0}),e}();e.BaseSession=t;var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(t);e.LocalSession=n}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.core||(e.core={}),n=function(){function n(e,t,n){this._sdk=e,this._session=t,this._cancelled=!1,this._uiHandler=e.currentUiHandler,this._clientContext=n}return Object.defineProperty(n.prototype,"initiatingRequest",{get:function(){return this._initiatingRequest},enumerable:!0,configurable:!0}),n.prototype.cancelFlow=function(){this._cancelled=!0,this._currentActionDriver&&this._currentActionDriver.cancelRun(),this._uiHandler.controlFlowCancelled(this._clientContext)},n.prototype.startControlFlow=function(t,n){var r=this;return this._cancelled?this.createExternalCancellationRejectionPromise():e.util.wrapPromiseWithActivityIndicator(this._uiHandler,null,this._clientContext,this._session.performSessionExchange(t)).then(function(e){return r._initiatingRequest=t,r._approval=n||null,r._uiHandler.controlFlowStarting(r._clientContext),r.promiseControlFlowCompletion(e).then(function(e){return r._uiHandler.controlFlowEnded(null,r._clientContext),e},function(e){throw r._uiHandler.controlFlowEnded(e,r._clientContext),e})})},Object.defineProperty(n.prototype,"challenge",{get:function(){return this._initialCflowResponse&&this._initialCflowResponse.challenge||null},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"approval",{get:function(){return this._approval||null},enumerable:!0,configurable:!0}),n.prototype.promiseControlFlowCompletion=function(e){return this._initialCflowResponse=e.data,this.processSingleStepExchange(this._initialCflowResponse)},n.prototype.processSingleStepExchange=function(n){var r,i=this;return n.control_flow&&(this._controlFlow=n.control_flow,this._currentControlFlowStep=0,this._sdk.log(e.LogLevel.Debug,"Got ControlFlow with "+this._controlFlow.length+" steps.")),n.data&&n.data.json_data?(this._sdk.log(e.LogLevel.Debug,"Got a JSON data attachment on control flow response. Processing."),r=t.actiondrivers.ActionDriverJsonData.handleJsonDataByUiHandler(this._uiHandler,n,n.data.json_data,null,this._clientContext)):r=Promise.resolve(n),r.then(function(r){switch(n.state){case t.Protocol.AuthSessionState.Pending:return i._sdk.log(e.LogLevel.Debug,"Execute step "+i._currentControlFlowStep+"."),(o=i._controlFlow[i._currentControlFlowStep])?i._cancelled?i.createExternalCancellationRejectionPromise():i.promiseCancellableSingleActionProcessing(o).then(function(e){return i._currentControlFlowStep++,i.processSingleStepExchange(e)}):(i._sdk.log(e.LogLevel.Error,"Step "+i._currentControlFlowStep+" nonexisting."),Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Session state is pending but no control flow.")));case t.Protocol.AuthSessionState.Rejected:i._sdk.log(e.LogLevel.Debug,"Handle control flow rejection.");var o=i._controlFlow&&i._controlFlow[i._currentControlFlowStep]||null;return i._uiHandler.handlePolicyRejection(n.rejection_data&&n.rejection_data.title||null,n.rejection_data&&n.rejection_data.text||null,n.rejection_data&&n.rejection_data.button_text||null,n.failure_data,o?new e.impl.PolicyActionImpl(o):null,i._clientContext).then(function(t){if(-1!=t.getUserChoice())throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"ConfirmationInput.getUserChoice must be set to -1.");throw e.impl.AuthenticationErrorImpl.errorForSessionRejectionFailureData(n.failure_data)});case t.Protocol.AuthSessionState.Completed:return i._sdk.log(e.LogLevel.Debug,"Handle control flow completion."),Promise.resolve(e.impl.AuthenticationResultImpl.fromCflowServerResponse(n,i._session.deviceId()))}})},n.prototype.promiseCancellableSingleActionProcessing=function(n){var r=this,i=t.actiondrivers.ActionDrivers[n.type];if(!i)return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Don't know how to handle action.",{actionType:n.type}));var o=new i(this,n);return this._currentActionDriver=o,this._uiHandler.controlFlowActionStarting(o.policyAction(),this._clientContext),o.run().then(function(e){return r._uiHandler.controlFlowActionEnded(null,o.policyAction(),r._clientContext),e},function(e){throw r._uiHandler.controlFlowActionEnded(e,o.policyAction(),r._clientContext),e}).finally(function(){r._currentActionDriver=null})},n.prototype.createAssertionRequest=function(n,r,i,o){if(!this.challenge)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to create an assertion request without an initial control flow request.");var a={action:n.type,assert:r||"action",assertion_id:n.assertion_id,fch:this.challenge};if(i&&(a.data=i),o){var s=a;for(var c in o)s[c]=o[c]}return new t.SessionExchangeRequest("POST","auth/assert",a)},n.prototype.createExternalCancellationRejectionPromise=function(){return Promise.reject(this.createExternalCancellationError())},n.prototype.createExternalCancellationError=function(){return new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Operation cancelled by user.",{control_flow_external_cancellation:!0})},n}(),t.ControlFlowProcessor=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.core||(e.core={}),n=function(){function t(t,n){if(this.sdk=t,this.ec=new elliptic.ec("secp256k1"),n&&(this.sessionId=n.session_id,this.aesKey=this.base64ToJsArray(n.key),!this.isReady()))throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Can't deserialize crypto session")}return t.prototype.getExchangeRequestHeader=function(){if(!this.kp){var e={entropy:this.sdk.host.generateRandomHexString(192),entropyEnc:"hex"};this.kp=this.ec.genKeyPair(e)}return{type:"key_exchange",scheme:2,y:this.jsArrayToBase64(this.kp.getPublic().encode())}},t.prototype.processExchangeResponseHeader=function(e){if(2!=e.scheme)throw"Unsupported crypto scheme "+e.scheme;this.sessionId=e.crypto_session_id;var t=this.kp.derive(this.ec.keyFromPublic(atob(e.y)).getPublic()),n=sha256.create();n.update(t.toArray("be",32)),this.aesKey=n.digest()},t.prototype.isReady=function(){return!(!this.aesKey||!this.sessionId)},t.prototype.decryptResponse=function(e){var t=null;if(e.headers.forEach(function(e){"encryption"==e.type&&(t=e)}),t){var n=this.base64ToJsArray(t.iv),r=new aesjs.ModeOfOperation.cbc(this.aesKey,n),i=this.base64ToJsArray(e.data),o=r.decrypt(i),a=aesjs.utils.utf8.fromBytes(o);a=this.pkcs7Unpad(a),e.data=JSON.parse(a)}return e},t.prototype.encryptRequest=function(t){var n=this,r=this.sdk.host.generateRandomHexString(32),i=aesjs.utils.hex.toBytes(r),o={type:"encryption",iv:e.util.hexToBase64(r),crypto_session_id:this.sessionId},a=t.headers.map(function(e){return n.encryptStringToBase64(JSON.stringify(e),i)}),s=JSON.stringify(t.data),c=this.encryptStringToBase64(s,i);t.headers=[o],t.enc_headers=a,t.data=c},t.prototype.encryptStringToBase64=function(e,t){var n=new aesjs.ModeOfOperation.cbc(this.aesKey,t),r=aesjs.utils.utf8.toBytes(e),i=this.pkcs7Pad(r),o=n.encrypt(i);return this.jsArrayToBase64(o)},t.prototype.toJson=function(){return{scheme:2,session_id:this.sessionId,key:this.jsArrayToBase64(this.aesKey)}},t.fromJson=function(e,n){return new t(e,n)},t.prototype.jsArrayToBase64=function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)},t.prototype.base64ToJsArray=function(e){for(var t=atob(e),n=[],r=0;r<t.length;r++)n.push(t.charCodeAt(r));return n},t.prototype.pkcs7Pad=function(e){var t=16-e.length%16,n=new Uint8Array(e.length+t);n.set(e,0);for(var r=0;r<t;r++)n[e.length+r]=t;return n},t.prototype.pkcs7Unpad=function(e){var t=e.charCodeAt(e.length-1);return e.slice(0,-t)},t}(),t.Scheme2CryptoSession=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(t){var n;!function(e){e[e.FinishSession=0]="FinishSession",e[e.CurrentDeviceDeleted=1]="CurrentDeviceDeleted"}(n=t.DeviceManagementSessionProcessorReturnReason||(t.DeviceManagementSessionProcessorReturnReason={}));var r=function(){function t(e,t,n,r){this._sdk=e,this._session=t,this._clientContext=n,this._token=r||null,this._uiHandler=this._sdk.currentUiHandler}return t.prototype.run=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"device management: Starting session"),this.queryDevicesFromServer().then(function(e){return new Promise(function(n,r){t._completeFn=n,t._rejectFn=r,t.kickStartSession(e)})})},t.prototype.removeDevice=function(t,n){var r=this;return new Promise(function(n,i){if(t.getInfo().getIsCurrent())throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Illegal attempt to delete the current device using 'DeviceManagementSessionServices.removeDevice'. The current device must only be deleted using DeviceManagementSessionServices.removeCurrentDeviceAndFinishSession.");var o=r.ensureValidDevice(t);r.performDeviceAction(o,e.DeviceManagementAction.Remove,null).then(function(t){return r._sdk.log(e.LogLevel.Debug,"device management: Updating device state locally"),o.getInfo().setStatus(e.DeviceStatus.Removed),r.updateManagedDevices(r._managedDevices.filter(function(e){return e!=o})),!0}).then(n,i)})},t.prototype.removeCurrentDeviceAndFinishSession=function(t){var r,i=this;return this._appSession?(r=this._appSession,new Promise(function(t,o){i._sdk.log(e.LogLevel.Debug,"device management: Start removing current device");var a=i._managedDevices.filter(function(e){return e.getInfo().getIsCurrent()});if(1!=a.length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Couldn't locate current device in device list.");var s=a[0];i.performDeviceAction(s,e.DeviceManagementAction.Remove,null).then(function(t){return i._sdk.log(e.LogLevel.Debug,"device management: Updating device state locally"),s.getInfo().setStatus(e.DeviceStatus.Removed),!0}).then(function(){t(!0),r.endSession(),i._appSession=null,i._completeFn(n.CurrentDeviceDeleted)}).catch(o)})):Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to finish a non started device management session."))},t.prototype.identifyDevice=function(t,n){var r=this;return new Promise(function(n,i){var o=r.ensureValidDevice(t);return r.performDeviceAction(o,e.DeviceManagementAction.Identify,null).then(function(e){return!0}).then(n,i)})},t.prototype.renameDevice=function(t,n,r){var i=this;return new Promise(function(r,o){var a=i.ensureValidDevice(t),s={name:n};return i.performDeviceAction(a,e.DeviceManagementAction.Rename,s).then(function(t){return i._sdk.log(e.LogLevel.Debug,"device management: Updating device state locally"),a.getInfo().setName(n),i.updateManagedDevices(i._managedDevices),!0}).then(r,o)})},t.prototype.requestRefreshDevices=function(){var t=this;return this.queryDevicesFromServer().then(function(e){return t.updateManagedDevices(e),!0},function(t){throw e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t)})},t.prototype.finishSession=function(){if(!this._appSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to finish a non started device management session.");this._appSession.endSession(),this._appSession=null,this._completeFn(n.FinishSession)},t.prototype.kickStartSession=function(t){this._appSession=this._sdk.currentUiHandler.createDeviceManagementSession(this._session.user.displayName),this._appSession?(this.updateManagedDevices(t),this._appSession.startSession(this,null,this._clientContext)):this._rejectFn(e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createDeviceManagementSession."))},t.prototype.updateManagedDevices=function(t){if(!this._appSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to update device list for a non started device management session.");this._managedDevices=t,this._appSession.setSessionDevicesList(t)},t.prototype.querySingleDeviceFromServer=function(t){var n=this;this._sdk.log(e.LogLevel.Debug,"device management: Initiating collection");var r=this._sdk.promiseCollectionResult();return e.util.wrapPromiseWithActivityIndicator(this._uiHandler,null,this._clientContext,r.then(function(r){n._sdk.log(e.LogLevel.Debug,"device management: Collection done; setting up request to query single device");var i=n._session.createSingleDeviceFetchRequest(r,n._token,t);return n._sdk.log(e.LogLevel.Debug,"device management: Sending request to query devices"),n._session.performSessionExchange(i).then(function(e){return e.data})}))},t.prototype.queryDevicesFromServer=function(){var t=this;this._sdk.log(e.LogLevel.Debug,"device management: Initiating collection");var n=this._sdk.promiseCollectionResult();return e.util.wrapPromiseWithActivityIndicator(this._uiHandler,null,this._clientContext,n.then(function(n){t._sdk.log(e.LogLevel.Debug,"device management: Collection done; setting up request to query devices");var r=t._session.createDevicesFetchRequest(n,t._token);return t._sdk.log(e.LogLevel.Debug,"device management: Sending request to query devices"),t._session.performSessionExchange(r).then(function(n){return t._uiHandler.endActivityIndicator(null,t._clientContext),n.data.map(function(n){var r=new e.impl.ManagedDeviceImpl(n);return r.getInfo().getDeviecId()==t._session.user.deviceId&&r.getInfo().forceCurrent(),r})})}))},t.prototype.performDeviceAction=function(t,n,r){var i,o=this;switch(n){case e.DeviceManagementAction.Identify:i="notify";break;case e.DeviceManagementAction.Remove:i="remove";break;case e.DeviceManagementAction.Rename:i="name";break;default:return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid device action specified "+n))}this._sdk.log(e.LogLevel.Debug,"devices: action "+i+" on "+t.getInfo().getDeviecId()),this._sdk.log(e.LogLevel.Debug,"devices: Initiating collection");var a=this._sdk.promiseCollectionResult();return e.util.wrapPromiseWithActivityIndicator(this._uiHandler,null,this._clientContext,a.then(function(n){o._sdk.log(e.LogLevel.Debug,"devices: Collection done; setting up request");var a=o._session.createDeviceActionRequest(n,o._token,t.getInfo().getDeviecId(),i,r);return o._sdk.log(e.LogLevel.Debug,"devices: Sending request"),o._session.performSessionExchange(a).then(function(e){return e})}).catch(function(t){throw e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t)}))},t.prototype.ensureValidDevice=function(t){var n=this._managedDevices.indexOf(t);if(n<0)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Attempt to perform a device action on a device not originally included in device management session.");return this._managedDevices[n]},t}();t.DeviceManagementSessionProcessor=r}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.core||(e.core={}),n=function(){function t(e){this._name=e,this._extensions=[],t._extensionPoints[e]=this}return t.prototype.extend=function(e){this._extensions.push(e)},t.prototype.forEach=function(e){this._extensions.forEach(e)},t.prototype.firstNonNull=function(e){var t=null;return this._extensions.forEach(function(n){t||(t=e(n))}),t},t.byName=function(t){var n=this._extensionPoints[t];if(!n)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid extension point requested: "+t);return n},t._extensionPoints={},t}(),t.ExtensionPoint=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.core||(e.core={}),n=function(){function t(){}return t.installOnSdk=function(e){e.setExternalLogger(new t)},t.prototype.log=function(t,n,r){var i="["+n+"] "+r;switch(t){case e.LogLevel.Debug:console.log(i);break;case e.LogLevel.Info:console.info(i);break;case e.LogLevel.Warning:console.warn(i);break;case e.LogLevel.Error:case e.LogLevel.Critical:console.error(i)}},t}(),t.JsConsoleLogger=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(t){var n,r;!function(e){e.Registering="registering",e.Registered="registered",e.Unregistered="unregistered"}(n=t.LocalEnrollmentStatus||(t.LocalEnrollmentStatus={})),function(e){e.None="none",e.Validated="validated",e.Invalidated="invalidated"}(r=t.LocalEnrollmentValidationStatus||(t.LocalEnrollmentValidationStatus={}));var i=function(){function i(){}return Object.defineProperty(i.prototype,"salt",{get:function(){return this._record.salt},set:function(e){this._record.salt=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"status",{get:function(){return this._record.status||n.Unregistered},set:function(e){this._record.status=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"version",{get:function(){return this._record.version},set:function(e){this._record.version=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"authenticatorId",{get:function(){return this._record.authenticatorId},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"validationStatus",{get:function(){return this._record.validationStatus},set:function(e){this._record.validationStatus=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"publicKeyHash",{get:function(){return this._record.publicKeyHash},set:function(e){this._record.publicKeyHash=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cryptoSettings",{get:function(){return this._record.cryptoSettings?e.ClientCryptoSettings.create(this._record.cryptoSettings.pbkdf_iterations_count):null},set:function(e){this._record.cryptoSettings=e?{pbkdf_iterations_count:e.getLocalEnrollmentKeyIterationCount(),pbkdf_key_size:e.getLocalEnrollmentKeySizeInBytes()}:null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"keyMaterial",{get:function(){return this._record.keyMeterial},set:function(e){this._record.keyMeterial=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"authenticatorConfig",{get:function(){return this._record.authenticatorConfig},set:function(e){this._record.authenticatorConfig=e},enumerable:!0,configurable:!0}),i.prototype.setFingerprintDbSnapshot=function(e){this._record.fingerprintDbSsnapshot=e},i.enrollmentWithRecord=function(e){var t=new i;return t._record=e,t},i.enrollmentsForUser=function(t,n){var r={},o=n.host.readStorageKey(this.storageKeyForEnrollmentsForUser(t.guid));for(var a in n.log(e.LogLevel.Debug,"Got db "+JSON.stringify(o)),o)n.log(e.LogLevel.Debug,"Got db wEnrollmentKey"+a),r[a]=i.enrollmentWithRecord(o[a]);return r},i.deleteEnrollmentsForUser=function(e,t){t.host.deleteStorageKey(this.storageKeyForEnrollmentsForUser(e.guid))},i.createNew=function(e,t,o,a,s){var c={salt:o,status:n.Unregistered,version:t,authenticatorId:e,cryptoSettings:null,validationStatus:r.None,publicKeyHash:s},u=new i;return u._record=c,u},i.updateEnrollmentsForUser=function(e,t,n){var r={};for(var i in t)r[i]=t[i]._record;n.host.writeStorageKey(this.storageKeyForEnrollmentsForUser(e.guid),r)},i.invalidateLocalRegistrationStatusAndNotifyUIHandler=function(t,n){return new Promise(function(i,o){if(!t)throw"No user interaction session provider!";t._sdk.log(e.LogLevel.Info,"Marking authenticator as invalidated and invoking UI Handler");var a=t._session.user.localEnrollments[n.getAuthenticatorId()];a.validationStatus=r.Invalidated,t._session.user.updateEnrollmentRecord(a),t._uiHandler.localAuthenticatorInvalidated(n,t._clientContext).then(function(e){i(e)})})},i.storageKeyForEnrollmentsForUser=function(e){return new t.TarsusKeyPath("per_user",e.toString(),"local_enrollments")},i.listInvalidatedLocalEnrollments=function(e){var t,n=new Array;for(var i in e.user.localEnrollments)(t=e.user.localEnrollments[i]).validationStatus==r.Invalidated&&n.push(t);return n},i}();t.LocalEnrollment=i}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){e.TARSUS_EXTENSION_POINT_NAME_MESSAGE_FILTERS="com.ts.mobile.sdk.core.messageFilters",e.TARSUS_EXTENSION_POINT_NAME_SESSION_OBSERVERS="com.ts.mobile.sdk.core.sessionObservers",e.TARSUS_EXTENSION_POINT_NAME_PLACEHOLDER_EXTENSION="com.ts.mobile.sdk.core.placeholderExtension"}(e.tarsusplugin||(e.tarsusplugin={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){var n;!function(r){var i=function(i){function s(t,n){var r=i.call(this,t,n)||this;r._lockCount=0,r._invalidated=!1,r._persistUserData=t.currentPersistUserData;var o=t.host.deviceSupportsCryptoBind()?n&&n.deviceBound:n&&n.hasLoggedIn,a="web"==t.host.queryHostInfo(e.ts.mobile.sdkhost.HostInformationKey.Platform);return r._deviceId=o&&!a?n.deviceId:null,r}return __extends(s,i),Object.defineProperty(s.prototype,"anonymous",{get:function(){return this._anonymous},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"invalidated",{get:function(){return this._invalidated},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"persistUserData",{get:function(){return this._persistUserData},enumerable:!0,configurable:!0}),s.createAnonymousSession=function(e){var t=new s(e,r.User.createEphemeralUser(e));return t._anonymous=!0,t},s.prototype.createBindRequest=function(e,t,n,i,o){var a={collection_result:e.toJson(),public_key:n.publicKeyToJson(),encryption_public_key:i.publicKeyToJson(),push_token:t};return o&&(a.params=o),new r.SessionExchangeRequest("POST","auth/bind",a)},s.prototype.createLoginRequest=function(e,t,n,i){var o={collection_result:e.toJson(),push_token:t};return n&&(o.policy_request_id=n),i&&(o.params=i),new r.SessionExchangeRequest("POST","auth/login",o)},s.prototype.createAnonPolicyRequest=function(e,t,n,i){var o={collection_result:e.toJson(),push_token:t};return n&&(o.policy_request_id=n),i&&(o.params=i),new r.SessionExchangeRequest("POST","auth/anonymous_invoke",o)},s.prototype.createLogoutRequest=function(){return new r.SessionExchangeRequest("POST","auth/logout",{})},s.prototype.createApprovalsFetchRequest=function(e){var t={collection_result:e.toJson()};return new r.SessionExchangeRequest("POST","approvals/actions/fetch",t)},s.prototype.createApprovalReplyRequest=function(e,t,i){var o={collection_result:e.toJson(),status:i==n.MobileApprovalStatus.Approved?r.Protocol.ServerResponseDataApprovalsApprovalStatus.Approved:r.Protocol.ServerResponseDataApprovalsApprovalStatus.Denied};return new r.SessionExchangeRequest("POST","auth/approve?apid="+t,o)},s.prototype.createSingleDeviceFetchRequest=function(e,t,n){var i={collection_result:e.toJson(),device_id:n};return t&&(i.token=t),new r.SessionExchangeRequest("POST","mobile/device",i)},s.prototype.createDevicesFetchRequest=function(e,t){var n={collection_result:e.toJson()};return t&&(n.token=t),new r.SessionExchangeRequest("POST","mobile/devices",n)},s.prototype.createDeviceActionRequest=function(e,t,n,i,o){var a={collection_result:e.toJson(),device_id:n};return t&&(a.token=t),o&&Object.keys(o).forEach(function(e){a[e]=o[e]}),new r.SessionExchangeRequest("POST","mobile/device/action?action="+i,a)},s.prototype.createConfigMenuFetchRequest=function(e,t){var n={collection_result:e.toJson()};return t&&(n.token=t),new r.SessionExchangeRequest("POST","auth/authenticator/config_menu",n)},s.prototype.createAuthRegistrationRequest=function(e,t,n,i){var o={collection_result:e.toJson(),type:t};i&&(o.token=i);var a=n?"register":"unregister";return new r.SessionExchangeRequest("POST","auth/authenticator/"+a,o)},s.prototype.startControlFlow=function(e,t,i,o){var a=this;if(void 0===o&&(o=function(e){return e}),this._currentControlFlowProcessor){var s="Attempt to start a control flow while an existing control flow ("+this._currentControlFlowProcessor.challenge+") is running.";return this._sdk.log(n.LogLevel.Error,s),Promise.reject(new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.AppImplementation,s))}var c=new r.ControlFlowProcessor(this._sdk,this,i);return this._currentControlFlowProcessor=c,e.then(function(e){return a._sdk.log(n.LogLevel.Debug,"Start control flow"),new Promise(function(i,o){r.authenticationdrivers.SimpleAuthenticationDriverDescriptor.refreshInvalidatedAuthenticatorsEnrollments(a).catch(function(e){a._sdk.log(n.LogLevel.Warning,"Could not refresh invalidated authenticators enrollments: "+e)}).finally(function(){i(c.startControlFlow(e,t))})})}).then(function(e){return o(e)}).finally(function(){a._sdk.log(n.LogLevel.Debug,"Retire control flow "+c.challenge),a._currentControlFlowProcessor=null}).then(function(e){var t=e.getInternalData();if(t&&t.redirect){var o=t.redirect,s=o.policy_id||null,u=o.target.user_id||o.target.token;return c._uiHandler.handlePolicyRedirect(r.Protocol.RedirectTypeMap[o.redirect_type],s,u,o.params,i).then(function(e){switch(e.getRedirectResponse()){case n.RedirectResponseType.RedirectToPolicy:return a.processRedirectRequest(o,i);case n.RedirectResponseType.CancelRedirect:return Promise.reject(new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.UserCanceled,"Redirection to next policy canceled."))}})}return e})},s.prototype.getCurrentControlFlowProcessor=function(){return this._currentControlFlowProcessor},s.prototype.generateInvalidatedAuthenticatorsHeadersIfNeeded=function(){for(var e,t=new Array,i=0,o=r.LocalEnrollment.listInvalidatedLocalEnrollments(this);i<o.length;i++)if(e=o[i],this._sdk.log(n.LogLevel.Debug,"Found invalidated authenticator: "+e.authenticatorId),e.publicKeyHash){var a={type:"public_key_hash",hash:e.publicKeyHash},s={type:"registration_invalidated",method:e.authenticatorId,registration_id:a};t.push(s)}return t},s.prototype.processRedirectRequest=function(e,t){try{var i=e.policy_id||null,o=e.params;if("current"==e.target.type);else if("user_id"==e.target.type){var a=e.target.user_id||this._user.userId;if(!a)throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Internal,"failed to resolve user id for redirect request <"+e.redirect_type+", "+e.target.type+">");a!=this._user.userId&&(this._sdk.log(n.LogLevel.Debug,"User id in request is different than that of the current user <"+a+", "+this._user.userId+">"),this._user=r.User.findUser(this._sdk,a)||r.User.createUser(this._sdk,a,n.UserHandleType.UserId))}else{if("uid_token"!=e.target.type)throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Internal,"Unhandled redirect target type '"+e.target.type+"'");var s=e.target.token||this._user.idToken;if(!s)throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Internal,"failed to resolve id token for redirect request <"+e.redirect_type+", "+e.target.type+">");s!=this._user.idToken&&(this._sdk.log(n.LogLevel.Debug,"Id token in request is different than that of the current user <"+s+", "+this._user.idToken+">"),this._user=r.User.findUser(this._sdk,s)||r.User.createUser(this._sdk,s,n.UserHandleType.IdToken))}switch(this._sdk.log(n.LogLevel.Info,"control flow || type:"+e.redirect_type+" policy: "+i),e.redirect_type){case r.Protocol.RedirectTypeName.RedirectTypeNameAuthenticate:return this._sdk.internalAuthenticate(this._user,i,o,t);case r.Protocol.RedirectTypeName.RedirectTypeNameBind:return this._sdk.internalBind(this._user,o,t);case r.Protocol.RedirectTypeName.RedirectTypeNameInvokePolicy:return this._sdk.invokePolicy(i,o,t);case r.Protocol.RedirectTypeName.RedirectTypeNameBindOrAuthenticate:return this._user.deviceBound?this._sdk.internalAuthenticate(this._user,i,o,t):this._sdk.internalBind(this._user,o,t);default:throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Internal,"Unhandled redirect type '"+e.redirect_type+"'")}}catch(e){return Promise.reject(n.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},Object.defineProperty(s.prototype,"deviceSigningKeyPair",{get:function(){if(!this._deviceKeyPair&&!this._anonymous&&this._sdk.host.deviceSupportsCryptoBind()&&(this._deviceKeyPair=this._sdk.host.getKeyPair(this._user.deviceSigningKeyTag,t.sdkhost.KeyClass.StdSigningKey,t.sdkhost.KeyBiometricProtectionMode.None),!this._deviceKeyPair))throw this._sdk.log(n.LogLevel.Error,"Could not load device signing key pair for this device."),new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.InvalidDeviceBinding,"Invalid device signature - could not load device signing key pair.");return this._deviceKeyPair},enumerable:!0,configurable:!0}),s.prototype.performSessionExchange=function(e){return this.performSessionExchangeInternal(e,!0,!0)},s.prototype.performSessionExchangeInternal=function(e,t,i){var o=this;return this._invalidated?(this._sdk.log(n.LogLevel.Error,"Attempt to execute a session exchange from invalidated session."),Promise.reject(new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.SessionRequired,"Session was invalidated by server."))):this.connectionSettings().getCryptoMode()==n.ConnectionCryptoMode.Full&&!this._currentCryptoSession&&i?this.performSessionExchangeInternal(new r.SessionExchangeRequest("POST","auth/key_exchange",{r:"Hello Encrypted World"}),t).then(function(t){return o.performSessionExchangeInternal(e)}):(this._sdk.log(n.LogLevel.Debug,"Preprocess request "+JSON.stringify(e)),this.preprocessSessionExchangeRequest(e).then(function(i){return o.promisePossiblyEncryptedTransportRequest(i).then(function(i){return o.preprocessTransportRequest(i).then(function(i){return o._sdk.log(n.LogLevel.Debug,"Will send request "+JSON.stringify(i)),o._sdk.transportProvider.sendRequest(i).then(function(i){o._sdk.log(n.LogLevel.Debug,"Got response "+JSON.stringify(i));try{var a=JSON.parse(i.getBodyJson())}catch(e){throw n.impl.AuthenticationErrorImpl.errorForTransportResponse(i)}o.postprocessResponse(a);var s=(a=o.possiblyDecryptResponse(a)).data&&a.data.state==r.Protocol.AuthSessionState.Rejected;if(200==i.getStatus()&&!a.error_code||401==i.getStatus()&&s)return a;if(200==i.getStatus()||a.error_code){if(23==a.error_code&&t)return o._currentCryptoSession=null,o.performSessionExchangeInternal(e,!1,!0);throw n.impl.AuthenticationErrorImpl.errorForServerResponse(a)}throw n.impl.AuthenticationErrorImpl.errorForTransportResponse(i)})})})}))},s.prototype.cancelCurrentControlFlow=function(){this._currentControlFlowProcessor?this._currentControlFlowProcessor.cancelFlow():this._sdk.log(n.LogLevel.Error,"No current control flow.")},s.prototype.deviceId=function(){return this._deviceId},s.prototype.preprocessTransportRequest=function(e){var t=this,r={aid:this.connectionSettings().getAppId()};this._deviceId&&(r.did=this._deviceId),this._sessionId&&(r.sid=this._sessionId),e.setUrl(this.urlWithConcatenatedQuery(e.getUrl(),r));var i=e.getHeaders()||[],o=new n.TransportHeader;o.setName("X-TS-Client-Version"),o.setValue(this.clientVersionHeader),i.push(o);var a=new n.TransportHeader;a.setName("Authorization"),a.setValue("TSToken "+this.connectionSettings().getToken()+"; tid="+this.connectionSettings().getTokenName()),i.push(a);try{if(this._deviceId&&this.deviceSigningKeyPair)return this.generateSignatureForRequest(e).then(function(r){var o=new n.TransportHeader;return o.setName("Content-Signature"),o.setValue("data:"+r+";key-id:"+t._deviceId+";scheme:3"),i.push(o),e.setHeaders(i),e})}catch(e){return Promise.reject(e)}return e.setHeaders(i),Promise.resolve(e)},s.prototype.postprocessResponse=function(e){var t=this;e.headers&&e.headers.forEach(function(e){s.headerProcessors[e.type].call(t,e)})},s.prototype.encryptEnvelopedMessageIfNeeded=function(e){var t=this.generateKeyExchangeHeaderIfNeeded();this._currentCryptoSession&&this._currentCryptoSession.isReady()&&this._currentCryptoSession.encryptRequest(e),t&&e.headers.push(t)},s.prototype.promisePossiblyEncryptedTransportRequest=function(e){var t=this;return new Promise(function(r,i){var o={headers:e.envelopeHeaders,data:e.body};t.encryptEnvelopedMessageIfNeeded(o);var a=new n.TransportRequest,s=t._sdk.host.transformApiPath(e.serverRelativeUrl);a.setMethod(e.method);var c=t._sdk.connectionSettings.getRealm()||"",u=c.length?"/"+c:"";a.setUrl(""+t._sdk.connectionSettings.getServerAddress()+u+"/api/v2/"+s),a.setBodyJson(JSON.stringify(o)),r(a)})},s.prototype.possiblyDecryptResponse=function(e){return this._currentCryptoSession&&this._currentCryptoSession.isReady()&&(e=this._currentCryptoSession.decryptResponse(e)),e},s.prototype.generateKeyExchangeHeaderIfNeeded=function(){return this.connectionSettings().getCryptoMode()==n.ConnectionCryptoMode.None||this._currentCryptoSession?null:(this._currentCryptoSession=new r.Scheme2CryptoSession(this._sdk),this._currentCryptoSession.getExchangeRequestHeader())},s.prototype.preprocessSessionExchangeRequest=function(e){var t=this;return new Promise(function(r,i){var o=t.generateUserIDHeaderIfNeeded();o&&e.addEnvelopeHeader(o);var c=t.generateInvalidatedAuthenticatorsHeadersIfNeeded();if(c)for(var u=0,l=c;u<l.length;u++){var d=l[u];e.addEnvelopeHeader(d)}var h=Promise.resolve(!0),p=new a(e);s.messageFilteringExtensionPoint.forEach(function(e){h=h.then(function(r){return e.filterMessage(t.createPluginSessionInfo(),p).catch(function(e){return t.sdk.log(n.LogLevel.Warning,"Error during message filtering: "+e),!0})})}),h.then(function(t){return r(e)},i)})},s.prototype.generateUserIDHeaderIfNeeded=function(){if(this._anonymous){if(this._user.ephemeralUserId)return{type:"uid",uid:this._user.ephemeralUserId}}else{if(this._user.userId)return{type:"uid",uid:this._user.userId};if(this._user.idToken)return{type:"uid_token",token:this._user.idToken}}return null},s.prototype.processKeyExchangeResponseHeader=function(e){this._currentCryptoSession&&this._currentCryptoSession.processExchangeResponseHeader(e)},s.prototype.generateSignatureForRequest=function(e){var t=e.getUrl(),r=t.indexOf("?");if(r>0){var i=e.getUrl().substring(r+1);t=e.getUrl().substring(0,r)+"?"+i.split("&").sort().join("&")}var o=/%%/g,a=t.substr(this.connectionSettings().getServerAddress().length).replace(o,"\\%")+"%%"+this.clientVersionHeader.replace(o,"\\%")+"%%"+e.getBodyJson().replace(o,"\\%"),s=n.util.asciiToHex(a);return this.deviceSigningKeyPair.signHex(s).then(function(e){return n.util.hexToBase64(e)})},s.prototype.connectionSettings=function(){return this._sdk.connectionSettings},s.prototype.processSessionIdHeader=function(e){this._sdk.log(n.LogLevel.Debug,"Processing session ID header "+e),this._sessionId=e.session_id},s.prototype.processDeviceIdHeader=function(e){this._sdk.log(n.LogLevel.Debug,"Processing Device ID header "+e),this._deviceId?this._deviceId!=e.device_id&&this._sdk.log(n.LogLevel.Warning,"Received device ID "+e.device_id+" in a session with an existing device id "+this._deviceId):(this._user.setProvisionalDeviceId(e.device_id),this._deviceId=e.device_id)},s.prototype.processSessionStateChangeHeader=function(e){switch(this._sdk.log(n.LogLevel.Debug,"Processing session state change header "+e+" to state "+e.state),e.state){case r.Protocol.SessionStateChangeState.Closed:this._sdk.log(n.LogLevel.Debug,"Invalidating session."),this._invalidated=!0;break;default:throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Communication,"Invalid session state change encountered in header.")}},s.prototype.processSessionEphemeralUserHeader=function(e){this._sdk.log(n.LogLevel.Debug,"Processing ephemeral user Id header "+e),this._user.updateEphemeralUserId(e.uid)},s.prototype.noHeaderProcessing=function(e){},s.prototype.processEncryptedSharedSecretHeader=function(e){},s.prototype.processDisplayNameHeader=function(e){this._sdk.log(n.LogLevel.Debug,"Processing display name header '"+e.display_name+"'"),r.User.updateUserDisplayName(e.display_name,this._user,this._sdk)},s.prototype.processUidTokenHeader=function(e){this._sdk.log(n.LogLevel.Debug,"Processing uid_token header '"+e.token+"'"),r.User.updateUserIdToken(e.token,this._user,this._sdk)},s.prototype.urlWithConcatenatedQuery=function(e,t){var n="";return e.indexOf("?")<0?n="?":"&"!=e[e.length-1]&&(n="&"),e+n+Object.keys(t).map(function(e){return e+"="+encodeURIComponent(t[e])}).join("&")},Object.defineProperty(s.prototype,"clientVersionHeader",{get:function(){if(!this._cachedClientVersionHeader){var e=this._sdk.getClientFeatureSet().join(",");this._cachedClientVersionHeader=this._sdk.getVersionInfo().getSdkVersion()+";["+e+"]"}return this._cachedClientVersionHeader},enumerable:!0,configurable:!0}),s.prototype.createPluginSessionInfo=function(){return new o(this)},s.prototype.lock=function(){this._sdk.log(n.LogLevel.Debug,"Locking session "+this._sessionId),this._lockCount++},s.prototype.unlock=function(){if(this._sdk.log(n.LogLevel.Debug,"Unlocking session "+this._sessionId),--this._lockCount<0)throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Internal,"Unbalanced session locking: Attempt to unlock an already unlocked sessoin.")},s.prototype.canTerminate=function(){return!this._lockCount},s.prototype.toJson=function(){var e={session_id:this._sessionId,user_name:this._user.displayName,device_id:this._deviceId,invalidated:this._invalidated,user:r.User.toUserRecord(this._user),persistUserData:this._persistUserData};return this._currentCryptoSession&&this._currentCryptoSession.isReady()&&(e.c_session=this._currentCryptoSession.toJson()),e},s.fromJson=function(e,t){var i=t,o=r.User.fromUserRecord(i.user,e);if(o||r.User.findUser(e,i.user_name),!o)throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Internal,"Can't deserialize session -- user "+i.user_name+" not found.");var a=new s(e,o);return a._sessionId=i.session_id,a._deviceId=i.device_id,a._invalidated=i.invalidated||!1,a._persistUserData=i.persistUserData||!0,i.c_session&&(a._currentCryptoSession=r.Scheme2CryptoSession.fromJson(e,i.c_session)),a},s.notifySessionObserversOnMainSessionLogin=function(e){var t=e.createPluginSessionInfo();this.sessionObservationExtensionPoint.forEach(function(e){e.mainSessionStarted(t)})},s.notifySessionObserversOnMainSessionLogout=function(e){var t=e.createPluginSessionInfo();this.sessionObservationExtensionPoint.forEach(function(e){e.mainSessionEnded(t)})},s.headerProcessors={session_id:s.prototype.processSessionIdHeader,device_id:s.prototype.processDeviceIdHeader,encrypted_shared_secret:s.prototype.processEncryptedSharedSecretHeader,session_state:s.prototype.processSessionStateChangeHeader,ephemeral_uid:s.prototype.processSessionEphemeralUserHeader,key_exchange:s.prototype.processKeyExchangeResponseHeader,encryption:s.prototype.noHeaderProcessing,display_name:s.prototype.processDisplayNameHeader,uid_token:s.prototype.processUidTokenHeader},s.messageFilteringExtensionPoint=new r.ExtensionPoint(t.tarsusplugin.TARSUS_EXTENSION_POINT_NAME_MESSAGE_FILTERS),s.sessionObservationExtensionPoint=new r.ExtensionPoint(t.tarsusplugin.TARSUS_EXTENSION_POINT_NAME_SESSION_OBSERVERS),s}(r.BaseSession);r.Session=i;var o=function(){function e(e){this._underlying=e}return e.prototype.getUsername=function(){return this._underlying.user.displayName},e}(),a=function(){function e(e){this._underlying=e}return e.prototype.getMethod=function(){return this._underlying.method},e.prototype.getBody=function(){return this._underlying.body},e.prototype.getHeaders=function(){return this._underlying.envelopeHeaders},e.prototype.addHeader=function(e){this._underlying.addEnvelopeHeader(e)},e}()}((n=t.sdk||(t.sdk={})).core||(n.core={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t,n,r){this._requestMethod=e,this._requestServerRelativeUrl=t,this._requestBody=n,this._envelopeHeaders=r||[]}return e.prototype.addEnvelopeHeader=function(e){this._envelopeHeaders.push(e)},Object.defineProperty(e.prototype,"method",{get:function(){return this._requestMethod},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"serverRelativeUrl",{get:function(){return this._requestServerRelativeUrl},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return this._requestBody},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"envelopeHeaders",{get:function(){return this._envelopeHeaders},enumerable:!0,configurable:!0}),e}();e.SessionExchangeRequest=t}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(n){var r=function(){function e(e){this._sdk=e}return e.prototype.extend=function(e,t){n.ExtensionPoint.byName(e).extend(t)},e.prototype.getSdk=function(){return this._sdk},e.prototype.generateRandomHexString=function(e){return this._sdk.host.generateRandomHexString(e)},e}();n.TarsusPluginHostImpl=r;var i=function(){function n(e){this._installedPluginsAndConfigs={},this._initializedPlugins=[],this._sdk=e,this._pluginHost=new r(this._sdk)}return n.prototype.getInitializedPlugins=function(){return this._initializedPlugins.concat([])},n.prototype.installPlugin=function(e,n){if(this._installedPluginsAndConfigs[e])throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to install plugin "+e+" twice.");this._installedPluginsAndConfigs[e]=n},n.prototype.initializePlugins=function(){var n=this;this._sdk.log(t.LogLevel.Debug,"Starting plugin initialization...");var r=Object.keys(this._installedPluginsAndConfigs).map(function(r){return n._sdk.log(t.LogLevel.Debug,"Loading plugin "+r+"..."),n._sdk.host.loadPlugin(r).then(function(i){var o=i.getPluginInfo(),a=e.tarsusplugin.impl.PluginInfoImpl.toString(o);if(i.getPluginInfo().getPluginName()!=r)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Plugin "+r+": getPluginInfo() reported mismatched name -- "+a+".");return n._sdk.log(t.LogLevel.Info,"Initializing plugin "+a+"..."),i.initialize(n._pluginHost,n._installedPluginsAndConfigs[r]).then(function(){n._initializedPlugins.push(i)}).catch(function(e){n._sdk.log(t.LogLevel.Error,"Couldn't initialize plugin "+a+": "+e)})})});return Promise.all(r).then(function(){n._sdk.log(t.LogLevel.Debug,"Plugin initialization completed sucessfuly")})},n}();n.TarsusPluginManager=i})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(t){var n=function(){function e(){}return e.prototype.toString=function(){return this._guidStr},e.prototype.equalString=function(e){return this._guidStr==e},e.prototype.equalsUserGuid=function(e){return this.toString()==e.toString()},e.createWithLength=function(t,n){var r=new e;return r._guidStr=n.host.generateRandomHexString(t),r},e.createFromString=function(t){var n=new e;return n._guidStr=t,n},e}();t.UserGuid=n;var r=function(){function r(){}return Object.defineProperty(r.prototype,"guid",{get:function(){return this._guid},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"userId",{get:function(){return this._userId},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"displayName",{get:function(){return this._displayName||this._userId},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"idToken",{get:function(){return this._idToken},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"deviceId",{get:function(){return this._deviceId},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"phoneNumber",{get:function(){return this._phoneNumber},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"defaultAuthId",{get:function(){return this._defaultAuthId},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"deviceBound",{get:function(){return this._deviceBound},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"hasLoggedIn",{get:function(){return this._hasLoggedIn},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"deviceSigningKeyTag",{get:function(){return new t.TarsusKeyPath("per_user",this._guid.toString(),"device_key")},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"deviceEncryptionKeyTag",{get:function(){return new t.TarsusKeyPath("per_user",this._guid.toString(),"enc_enabled")},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"ephemeralUserId",{get:function(){return this._ephemeralUserId},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"userHandle",{get:function(){return this._userId||this._idToken},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"userHandleType",{get:function(){return this._userId?e.UserHandleType.UserId:e.UserHandleType.IdToken},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"localEnrollments",{get:function(){return this._localEnrollments||(this._localEnrollments=t.LocalEnrollment.enrollmentsForUser(this,this._sdk)),this._localEnrollments},enumerable:!0,configurable:!0}),r.prototype.updateDefaultAuthId=function(e){this._defaultAuthId=e},r.prototype.updateEphemeralUserId=function(t){if(!this._ephemeral)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid ephemeral user name update reaquest header, user is not ephemeral.");if(this._ephemeralUserId)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to set an ephemeral userId after it has already been updated once.");this._ephemeralUserId=t},r.updateUserDisplayName=function(e,t,n){t._displayName=e,n.currentSession&&n.currentSession.persistUserData&&r.save(n,t)},r.updateUserIdToken=function(e,t,n){t._idToken=e,delete t._userId,n.currentSession&&n.currentSession.persistUserData&&r.save(n,t)},r.prototype.setProvisionalDeviceId=function(t){if(this.deviceBound)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to record a provisional device ID for an already bound user record.",{});this._deviceId=t},r.prototype.bindDeviceToUser=function(t){if(this.deviceBound)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to record a device for an already bound user record.",{});if(this._deviceId!=t)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to bind user to a device ID different than provisional device ID.",{});this._deviceBound=!0},r.prototype.markLoggedIn=function(){this._hasLoggedIn=!0},r.iterateUsers=function(e,t){for(var n=e.host.readStorageKey(r.storageKey),i=0;i<n.length;i++){var o=t(r.fromUserRecord(n[i],e));if(null!=o)return o}return e.currentSession?t(e.currentSession.user):null},r.findUser=function(e,t){return r.iterateUsers(e,function(e){return e.userHandle.toLowerCase()==t.toLowerCase()?e:null})},r.createUser=function(t,i,o){if(!i)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"userHandle must not be empty");var a=new r;return o==e.UserHandleType.UserId?a._userId=i:a._idToken=i,a._guid=n.createWithLength(32,t),a._deviceBound=!1,a._hasLoggedIn=!1,a._phoneNumber="",a._sdk=t,a._ephemeral=!1,a},r.createEphemeralUser=function(e){var t=new r;return t._guid=n.createWithLength(32,e),t._deviceBound=!1,t._hasLoggedIn=!1,t._phoneNumber="",t._sdk=e,t._ephemeral=!0,t._ephemeralUserId=null,t},r.deleteUser=function(t,n){var i=n.host.readStorageKey(r.storageKey);n.log(e.LogLevel.Warning,"=== CURRENTL LEN    "+i.length);for(var o=0;o<i.length;o++){var a=r.fromUserRecord(i[o],n);if(t.guid.equalsUserGuid(a.guid))break}if(o<i.length){for(;o<i.length-1;)i[o]=i[o+1],o++;var s=i.length-1;delete i[i.length-1],n.log(e.LogLevel.Warning,"=== CURRENTL LEN2    "+i.length),i.length=s,n.log(e.LogLevel.Warning,"=== CURRENTL LEN3    "+i.length),n.host.writeStorageKey(r.storageKey,i)}else n.log(e.LogLevel.Warning,"Attempt to delete nonexisting user "+t.userHandle)},r.prototype.createEnrollmentRecord=function(e,n,r,i,o){var a=t.LocalEnrollment.createNew(e,n,r,this._sdk,o);return a.status=i,a},r.prototype.updateEnrollmentRecord=function(n){if(this._ephemeral)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to update enrollment record for ephemeral user.",{});var r={};for(var i in this.localEnrollments)r[i]=this.localEnrollments[i];r[n.authenticatorId]=n,t.LocalEnrollment.updateEnrollmentsForUser(this,r,this._sdk),this._localEnrollments=r},r.toUserRecord=function(e){return{default_auth_id:e._defaultAuthId,device_bound:e._deviceBound,has_logged_in:e._hasLoggedIn,device_id:e._deviceId,last_auth:"<null>",guid:e._guid.toString(),user_id:e.userId,display_name:e._displayName,id_token:e._idToken,user_number:e._phoneNumber,schemeVersion:"v0"}},r.save=function(t,n){if(n._ephemeral)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to save ephemeral user record to persistent store.",{});var i=t.host.readStorageKey(r.storageKey);i.length=i.length||0;for(var o=0;o<i.length&&!r.fromUserRecord(i[o],t).guid.equalsUserGuid(n.guid);o++);i[o]=r.toUserRecord(n),i.length<o+1&&(i.length=o+1),t.host.writeStorageKey(r.storageKey,i)},r.fromUserRecord=function(e,t){var i=new r;return i._sdk=t,i._defaultAuthId=e.default_auth_id,i._deviceBound=e.device_bound,i._hasLoggedIn=e.has_logged_in,i._deviceId=e.device_id,i._phoneNumber=e.user_number,i._userId=e.user_id,i._idToken=e.id_token,"v0"===e.schemeVersion?(i._guid=n.createFromString(e.guid),i._displayName=e.display_name):(i._guid=n.createFromString(e.user_id),i._displayName=e.user_id),i},r.storageKey=new t.TarsusKeyPath("users"),r}();t.User=r}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){e.InternalErrorWrongBiometric=1e3,e.InternalErrorBiometricInvalidated=1001,e.InternalErrorBiometricKeyStoreError=1002,e.InternalErrorBiometricNotConfigured=1003,e.InternalErrorBiometricOsLockTemporary=1004,e.InternalErrorBiometricOsLockPermanent=1005,e.InternalErrorBiometricFallbackPressed=1006,e.ErrorDataInternalError="internal_error",e.ErrorDataNumFailures="num_failures",e.ErrorDataServerErrorCode="server_error_code",e.ErrorDataServerErrorMessage="server_error_message",e.ErrorDataServerErrorData="server_error_data",e.ErrorDataRetriesLeft="retries",e.ErrorDataCommunicationError="communication_error",e.ErrorDataCommunicationSSL="ssl",e.FeatureCodeServerHeaders=1,e.FeatureCodeAuthFailover=2,e.FeatureCodeUnifiedRegFlow=3,e.FeatureCodePromotionAction=6,e.FeatureCodeSilentFingerprintRegistration=7,e.FeatureCodeMultiMethodRegistrationAction=8,e.FeatureCodeOtpCodeInvalidated=10,e.FeatureCodeEnvelopedClientRequest=11,e.FeatureCodeUnregistrationFlow=12,e.FeatureCodeFaceIdAuthentication=13,e.FeatureCodeDynamicPolicySupport=14,e.FeatureCodeAutoRequestForSignContent=19}(e.sdkhost||(e.sdkhost={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){t.TARSUS_VERSION="4.2.0",t.API_LEVEL=8,t.STATIC_FEATURE_SET=[e.sdkhost.FeatureCodeServerHeaders,e.sdkhost.FeatureCodeAuthFailover,e.sdkhost.FeatureCodeUnifiedRegFlow,e.sdkhost.FeatureCodePromotionAction,e.sdkhost.FeatureCodeSilentFingerprintRegistration,e.sdkhost.FeatureCodeMultiMethodRegistrationAction,e.sdkhost.FeatureCodeOtpCodeInvalidated,e.sdkhost.FeatureCodeEnvelopedClientRequest,e.sdkhost.FeatureCodeUnregistrationFlow,e.sdkhost.FeatureCodeDynamicPolicySupport]})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(){function t(e,t){this._controlFlowProcessor=e,this._action=t,this._sdk=this._controlFlowProcessor._sdk,this._uiHandler=this._controlFlowProcessor._uiHandler,this._clientContext=this._controlFlowProcessor._clientContext}return t.prototype.cancelRun=function(){},t.prototype.policyAction=function(){return this._policyAction||(this._policyAction=new e.impl.PolicyActionImpl(this._action)),this._policyAction},t.prototype.sendAssertionRequest=function(t,n,r){var i=this._controlFlowProcessor.createAssertionRequest(this._action,t,n,r);return e.util.wrapPromiseWithActivityIndicator(this._uiHandler,this.policyAction(),this._clientContext,this._controlFlowProcessor._session.performSessionExchange(i).then(function(t){if(!t.data)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Communication,"Invalid response to assertion.",{responseBody:JSON.stringify(t)});return t.data}))},t}();t.ActionDriver=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(n,r){var i=t.call(this,n,r)||this;return i._clientContext=i._controlFlowProcessor._clientContext,i._cancellationHolder=new e.util.CancelablePromiseHolder,i}return __extends(n,t),n.prototype.run=function(){var t=this;return this._cancellationHolder.resolveWith(function(e,n){t.doRunAction().then(e,n)}),this._cancellationHolder.cancellablePromise.catch(function(n){if(n==e.util.CancelablePromiseHolder.CancelRequest)return t._controlFlowProcessor.createExternalCancellationRejectionPromise();throw n})},n.prototype.cancelRun=function(){this._cancellationHolder.cancel()},n}(t.ActionDriver);t.SimpleCancellationActionDriver=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(n){var r=function(e){function t(t,n,r,i,o,a,s,c){var u=e.call(this,s._controlFlowProcessor._session,t,n,r)||this;return u._assertionId=i,u._retriesLeft=o,u._actionDriver=s,u._fallback=a,u._registration=c,u}return __extends(t,e),Object.defineProperty(t.prototype,"authDriver",{get:function(){return this._authDriver||(this._authDriver=this.authenticationDriverDescriptor.createAuthenticationDriver(this._actionDriver,this._authenticatorMethodConfig,this)),this._authDriver},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"suggestedParameters",{get:function(){return this.getEnabled()?this.authenticationDriverDescriptor.suggestParameters(this._authenticatorMethodConfig,this):[]},enumerable:!0,configurable:!0}),t.prototype.getEnabled=function(){return(this._registration||this.getRegistered()&&!this.getLocked())&&this.getSupportedOnDevice()},Object.defineProperty(t.prototype,"fallback",{get:function(){return this._fallback},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"assertionId",{get:function(){return this._assertionId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"retriesLeft",{get:function(){return this._retriesLeft},enumerable:!0,configurable:!0}),t.prototype.updateWithAssertionResult=function(e){e.retries_left&&(this._retriesLeft=e.retries_left),e.locked&&(this._locked=e.locked)},t.fromUnregistrationAction=function(e,n){return new t(e.method,e,e,e.assertion_id,null,null,n,!1)},t.fromPromotionAction=function(e,n){return new t(e.method,e,e,e.assertion_id,e.retries_left,e.fallback||null,n,!0)},t.fromAuthenticationActionMenuOption=function(e,n){return new t(e.type,e,e,e.assertion_id,e.retries_left,e.fallback||null,n,!1)},t.fromRegistrationAction=function(e,n){return new t(e.method,e,e,e.assertion_id,null,null,n,!0)},t}(t.authenticationdrivers.AuthenticatorDescriptionImpl);n.AuthenticationMenuAuthenticator=r;var i=function(t){function n(e,n){var r=t.call(this,e,n)||this;return r._externallyCancelled=!1,r}return __extends(n,t),n.prototype.doRunAction=function(){var e=this;return new Promise(function(t,n){e._completionFunction=t,e._rejectionFunction=n,e.runActionWithCompletionFunctions()})},Object.defineProperty(n.prototype,"availableAuthenticatorsForSwitching",{get:function(){return this.availableAuthenticators},enumerable:!0,configurable:!0}),n.prototype.sendAuthenticatorAssertionRequest=function(t,n,r,i){this._sdk.log(e.LogLevel.Debug,"Sending authenticator asserion request for "+t.getAuthenticatorId()+": assert="+n);var o={assertion_id:t.assertionId,method:t.getAuthenticatorId()};if(i)for(var a in i)o[a]=i[a];return this.sendAssertionRequest(n,r,o)},n.prototype.completeAuthenticationWithAssertionResult=function(e){this._completionFunction(e)},n.prototype.completeAuthenticationWithError=function(e){this._rejectionFunction(e)},n.prototype.prepareForRunningAuthenticationDriver=function(e){return this._externallyCancelled?(this.completeAuthenticationWithError(this._controlFlowProcessor.createExternalCancellationError()),!1):(this._runningAuthenticatorDriver=e,!0)},n.prototype.cancelRun=function(){this._externallyCancelled=!0,this._runningAuthenticatorDriver&&this._runningAuthenticatorDriver.onCancelRun(),t.prototype.cancelRun.call(this)},n}(n.SimpleCancellationActionDriver);n.ActionDriverAuthenticatorOp=i})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.actiondrivers||(t.actiondrivers={}),r=function(r){function i(e,t){return r.call(this,e,t)||this}return __extends(i,r),i.prototype.runActionWithCompletionFunctions=function(){var n=this._action;this._sdk.log(e.LogLevel.Debug,"Loading authenticator descriptions"),this.loadAuthenticatorDescriptionsFromAction(n),this._shouldUpdateDefaultAuth=n.options&&n.options.update_default,this._sdk.log(e.LogLevel.Debug,"Starting auth presentation"),this.runWithPresentationMode(n.options&&n.options.start_with||t.Protocol.AuthMenuPresentationMode.DefaultAuthenticator)},Object.defineProperty(i.prototype,"availableAuthenticators",{get:function(){return this.updateAvailableAuthenticatorsList(),this._availableAuthenticators.concat([])},enumerable:!0,configurable:!0}),i.prototype.runWithPresentationMode=function(n,r){var i=this;this.updateAvailableAuthenticatorsList();var o=n==t.Protocol.AuthMenuPresentationMode.AuthenticatorMenu&&this._uiHandler.shouldIncludeDisabledAuthenticatorsInMenu(this.policyAction(),this._clientContext)?this._allAuthenticators:this._availableAuthenticators;if(r&&(o=o.filter(function(e){return r.filter(function(t){return t.getAuthenticatorId()==e.getAuthenticatorId()}).length>0})),o.length)switch(n){case t.Protocol.AuthMenuPresentationMode.AuthenticatorMenu:var a=o.map(function(t){return new e.impl.AuthenticationOptionImpl(t,t.suggestedParameters)});this._uiHandler.selectAuthenticator(a,this.policyAction(),this._clientContext).then(function(t){switch(t.getResultType()){case e.AuthenticatorSelectionResultType.Abort:i.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Cancel during authenticator selection."));break;case e.AuthenticatorSelectionResultType.SelectAuthenticator:if(!(a.filter(function(e){return e.getAuthenticator()==t.getSelectedAuthenticator()}).length>0)){i.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"selectAuthenticator returned an authenticator not within options."));break}if(!t.getSelectedAuthenticator().getEnabled()){i.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"selectAuthenticator returned a non-enabled authenticator."));break}i.runAuthenticator(t.getSelectedAuthenticator(),t.getSelectedAuthenticationParameters())}});break;case t.Protocol.AuthMenuPresentationMode.DefaultAuthenticator:this._defaultAuthenticator&&this._availableAuthenticators.indexOf(this._defaultAuthenticator)>=0?this.runAuthenticator(this._defaultAuthenticator,[]):(this._sdk.log(e.LogLevel.Warning,"Default authenticator for user not found. Falling back to first authenticator in list."),this.runAuthenticator(this._availableAuthenticators[0],[]));break;case t.Protocol.AuthMenuPresentationMode.FirstAuthenticator:this.runAuthenticator(this._availableAuthenticators[0],[])}else this._allAuthenticators.filter(function(e){return e.getLocked()}).length>0?this.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AllAuthenticatorsLocked,"All authenticators locked.")):this.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.NoRegisteredAuthenticator,"No registered authenticator available."))},i.prototype.loadAuthenticatorDescriptionsFromAction=function(e){var t=this;this._allAuthenticators=e.methods.map(function(e){return n.AuthenticationMenuAuthenticator.fromAuthenticationActionMenuOption(e,t)})},i.prototype.updateAvailableAuthenticatorsList=function(){var t=this;this._defaultAuthenticator=null,this._availableAuthenticators=[],this._allAuthenticators.forEach(function(e){e.getEnabled()&&t._availableAuthenticators.push(e),e.getDefaultAuthenticator()&&(t._defaultAuthenticator=e)}),this._defaultAuthenticator||(this._defaultAuthenticator=this._availableAuthenticators[0]),this._sdk.log(e.LogLevel.Debug,"Updated available authenticators list; "+this._availableAuthenticators.length+" available authenticators")},i.prototype.runAuthenticator=function(n,r){var i=this,o=n.authDriver;this.prepareForRunningAuthenticationDriver(o)&&o.runAuthentication(r).then(function(r){if(r instanceof t.authenticationdrivers.AuthenticationDriverSessionResultSwitchAuthenticator)r.requiredAuthenticator?i.runAuthenticator(r.requiredAuthenticator,[]):i.runWithPresentationMode(t.Protocol.AuthMenuPresentationMode.AuthenticatorMenu,r.allowedAuthenticators);else if(r instanceof t.authenticationdrivers.AuthenticationDriverSessionResultAuthenticationCompleted){if(i._shouldUpdateDefaultAuth&&(i._sdk.log(e.LogLevel.Info,"Updating user default authenticator."),!i._controlFlowProcessor._session.anonymous)){var o=i._controlFlowProcessor._session.user;o.updateDefaultAuthId(n.getAuthenticatorId()),i._controlFlowProcessor._session.persistUserData&&t.User.save(i._sdk,o)}i.completeAuthenticationWithAssertionResult(r.assertionResult)}else i.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unknown authentication driver result type encountered."))},function(t){i._sdk.log(e.LogLevel.Debug,"Received authentication driver error "+t),i.completeAuthenticationWithError(t)})},i}(n.ActionDriverAuthenticatorOp),n.ActionDriverAuthentication=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(e,t){return n.call(this,e,t)||this}return __extends(r,n),r.prototype.doRunAction=function(){var n=this;this._sdk.log(e.LogLevel.Debug,"Executing confirmation action.");var r=this._action;return this._uiHandler.getConfirmationInput(r.title,r.text,r.continue_button_text,r.cancel_button_text,this.policyAction(),this._clientContext).then(function(i){var o={user_cancelled:1==i.getUserChoice()},a=Promise.resolve(o);if(r.require_sign_content){var s={params:{title:r.title,text:r.text,continue_button_text:r.continue_button_text,cancel_button_text:r.cancel_button_text,parameters:r.parameters,image:r.image},user_input:o.user_cancelled?r.cancel_button_text:r.continue_button_text};a=a.then(function(e){return t.ActionDriverSignContent.augmentAssertionDataWithSignedContent(e,s,n._controlFlowProcessor._session.deviceSigningKeyPair,n._sdk)})}return a.then(function(t){return n._sdk.log(e.LogLevel.Debug,"Asserting confirmation: "+t),n.sendAssertionRequest(null,t).then(function(e){return e})})})},r}(t.SimpleCancellationActionDriver);t.ActionDriverConfirmation=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.actiondrivers||(t.actiondrivers={}),r=function(n){function r(e,t){return n.call(this,e,t)||this}return __extends(r,n),r.prototype.doRunAction=function(){var n=this;this._sdk.log(e.LogLevel.Debug,"Executing disable TOTP action...");var r=this._action,i=t.totp.TotpPropertiesProcessor.createWithUser(this._controlFlowProcessor._session.user,this._sdk,this._clientContext,this._controlFlowProcessor._session);return this._sdk.log(e.LogLevel.Debug,"Obtained TOTP processor."),r.config_ids.forEach(function(t){n._sdk.log(e.LogLevel.Debug,"Deleting TOTP processor "+t+"."),i.deleteProvisionForGenerator(t),n._sdk.log(e.LogLevel.Debug,"TOTP processor "+t+" deleted.")}),this.sendAssertionRequest()},r}(n.SimpleCancellationActionDriver),n.ActionDriverDisableTotp=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.actiondrivers||(t.actiondrivers={}),r=function(n){function r(t,r){var i=n.call(this,t,r)||this;return i.onPromiseResult=function(t){switch(t.getControlRequest()){case e.FormControlRequest.Submit:var n={input:t.getJsonData()};i.request(n);break;case e.FormControlRequest.Abort:i.session.endSession(),i.rejectionFunction(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"User cancelled a form action."))}},i}return __extends(r,n),r.prototype.doRunAction=function(){var t=this,n=this._action,i=r.formExtensionPoint.firstNonNull(function(e){return e.createFormSession(n.form_id,n.app_data)});return i?(this._sdk.log(e.LogLevel.Debug,'Using extension of type "com.ts.mobile.plugins.form.settings" for formId '+n.form_id),this.session=i):this.session=this._uiHandler.createFormSession(n.form_id,n.app_data),this.session?new Promise(function(r,i){t.completionFunction=r,t.rejectionFunction=i,t.session.startSession(t._clientContext,new e.impl.PolicyActionImpl(n)),t.session.promiseFormInput().then(t.onPromiseResult)}):Promise.reject(e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createFormSession."))},r.prototype.request=function(e){var n=this;this.sendAssertionRequest(null,null,e).then(function(e){var r=e.data;switch(e.assertion_error_code){case t.Protocol.AssertionErrorCode.NotFinished:n.session.onContinue(r),n.session.promiseFormInput().then(n.onPromiseResult);break;case t.Protocol.AssertionErrorCode.RepeatCurrentStep:n.session.onError(r),n.session.promiseFormInput().then(n.onPromiseResult);break;default:n.session.endSession(),n.completionFunction(e)}}).catch(function(e){n.session.endSession(),n.rejectionFunction(e)})},r.formExtensionPoint=new t.ExtensionPoint("com.ts.mobile.plugins.form.settings"),r}(n.SimpleCancellationActionDriver),n.ActionDriverForm=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n){return t.call(this,e,n)||this}return __extends(n,t),n.prototype.doRunAction=function(){var t=this;this._sdk.log(e.LogLevel.Debug,"Executing information action.");var n=this._action;return this._uiHandler.getInformationResponse(n.title,n.text,n.button_text,this.policyAction(),this._clientContext).then(function(n){if(t._sdk.log(e.LogLevel.Debug,"Asserting information"),-1!=n.getUserChoice())throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"ConfirmationInput.getUserChoice must be set to -1.");return t.sendAssertionRequest()})},n}(t.SimpleCancellationActionDriver);t.ActionDriverInformation=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n){return t.call(this,e,n)||this}return __extends(n,t),n.prototype.run=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"Executing JSON data action."),this.sendAssertionRequest().then(function(r){return t._sdk.log(e.LogLevel.Debug,"Executing JSON data action: "+r),n.handleJsonDataByUiHandler(t._uiHandler,r,r.data.json_data,t._policyAction,t._clientContext)})},n.handleJsonDataByUiHandler=function(t,n,r,i,o){return t.processJsonData(r,i,o).then(function(t){if(t.getContinueProcessing())return n;throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"User cancelled a JSON action.")})},n}(t.ActionDriver);t.ActionDriverJsonData=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(n){var r=function(){};n.Stragety=r;var i=function(r){function i(e,t){var n=r.call(this,e,t)||this;return n.isAssertionContainerNotComplete=!1,n}return __extends(i,r),i.prototype.runActionWithCompletionFunctions=function(){var t=this;if(this._sdk.log(e.LogLevel.Debug,"ActionDriverPromotion#runActionWithCompletionFunctions() started"),this._action=this._action,this._action.assertions.length<1)return this._sdk.log(e.LogLevel.Info,"runActionWithCompletionFunctions() Promotion has no assertions, finishing action."),void this.completeWithDeclineAssertion();if(!this.shouldDisplayPromotion())return this._sdk.log(e.LogLevel.Info,"runActionWithCompletionFunctions() Promotion stragety stop, finishing action."),void this.completeWithDeclineAssertion();if(this._session=this._uiHandler.createRegistrationPromotionSession(this._controlFlowProcessor._session.user.displayName,this._policyAction),this._session){this._session.startSession(this._clientContext,new e.impl.PolicyActionImpl(this._action));var r=this._action.options;this._session.promptIntroduction(r.title,r.text,r.ok_button,r.decline_button).then(function(e){if(t.handlePromotionInputControlRequest(e)){for(var r=t._action.assertions,i=new Array,o=0;o<r.length;o++){var a=n.AuthenticationMenuAuthenticator.fromPromotionAction(r[o],t);a.getSupportedOnDevice()&&i.push(a)}t._authenticatorList=i,t.suggestAuthenticators()}})}else this._rejectionFunction(e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createRegistrationPromotionSession."))},i.prototype.sendAssertionRequest=function(e,n,i){var o=this;return this.isAssertionContainerNotComplete=!1,r.prototype.sendAssertionRequest.call(this,e,n,i).then(function(e){return e.assertion_error_code==t.Protocol.AssertionErrorCode.AssertionContainerNotComplete&&(e.assertion_error_code=void 0,o.isAssertionContainerNotComplete=!0),e})},i.prototype.suggestAuthenticators=function(n){var r=this;if(void 0===n&&(n=this._authenticatorList),this._currentAuthentictorSelected){var i=n.indexOf(this._currentAuthentictorSelected);i>-1&&n.splice(i,1)}this._session.setPromotedAuthenticators(n).then(function(n){if(r.handlePromotionInputControlRequest(n)){var i=n.getSelectedAuthenticator();r._currentAuthentictorSelected=i;var o=i.authDriver;r.prepareForRunningAuthenticationDriver(o)&&i.authDriver.runRegistration().then(function(n){if(n instanceof t.authenticationdrivers.AuthenticationDriverSessionResultAuthenticationCompleted)r.isAssertionContainerNotComplete?(r._sdk.log(e.LogLevel.Debug,"suggestAuthenticators() callback result: promotion not completed. showing list again."),r.suggestAuthenticators()):(r._sdk.log(e.LogLevel.Debug,"suggestAuthenticators() callback result: promotion completed. finishing"),r.completeAuthenticationWithAssertionResult(n.assertionResult));else if(n instanceof t.authenticationdrivers.AuthenticationDriverSessionResultSwitchAuthenticator)if(n.allowedAuthenticators){r._sdk.log(e.LogLevel.Debug,"suggestAuthenticators() callback result: switch authentciator with allowed authenticators called");var i=n.allowedAuthenticators;r._currentAuthentictorSelected=null,r.suggestAuthenticators(i)}else r._sdk.log(e.LogLevel.Debug,"suggestAuthenticators() callback result: switch authentciator called"),r._currentAuthentictorSelected=null,r.suggestAuthenticators();else r._sdk.log(e.LogLevel.Error,"suggestAuthenticators() unexpected callback result: stopping with error.'"),r.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unknown authentication driver result type encountered during registration."))},function(t){r._sdk.log(e.LogLevel.Error,"suggestAuthenticators() error callback result: stopping with error. error: '"+t._data+"'"),r.completeAuthenticationWithError(t)})}else r._sdk.log(e.LogLevel.Debug,"suggestAuthenticators() stopped by ControlRequest of type "+n.getControlRequest())})},i.prototype.handlePromotionInputControlRequest=function(t){if(!t.isControlRequest())return!0;switch(t.getControlRequest()){case e.PromotionControlRequest.Continue:return!0;case e.PromotionControlRequest.Skip:return this.completeWithDeclineAssertion(),!1;case e.PromotionControlRequest.Abort:return this.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"User aborted/canceled")),!1;default:return this._sdk.log(e.LogLevel.Warning,"handlePromotionInputControlRequest() received invalid PromotionInput, unsupported ControlRequest"),!1}},i.prototype.sendDeclineAssertion=function(){return this.sendAssertionRequest(i.ASSERT_DECLINE)},i.prototype.completeWithDeclineAssertion=function(){var e=this;this.sendDeclineAssertion().then(function(t){e.completeAuthenticationWithAssertionResult(t)}).catch(function(t){e.completeAuthenticationWithError(t)})},i.prototype.completeAuthenticationWithAssertionResult=function(e){this._session&&this._session.endSession(),r.prototype.completeAuthenticationWithAssertionResult.call(this,e)},i.prototype.completeAuthenticationWithError=function(e){this._session.endSession(),r.prototype.completeAuthenticationWithError.call(this,e)},Object.defineProperty(i.prototype,"availableAuthenticatorsForSwitching",{get:function(){return this.availableAuthenticators},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"availableAuthenticators",{get:function(){return this._authenticatorList.concat([])},enumerable:!0,configurable:!0}),i.prototype.shouldDisplayPromotion=function(){var n=this._sdk.host,r=new t.TarsusKeyPath("stragety"),i=n.readStorageKey(r);if(null==i.days||null==i.logins)return this._sdk.log(e.LogLevel.Debug,"shouldDisplayPromotion() first promotion. Stored data was empty."),this.updateStrategy(r,1),!0;for(var o=!0,a=0,s=this._action.options.strategies;a<s.length;a++){var c=s[a];if(0==this.checkStrategy(c,i,r)){this._sdk.log(e.LogLevel.Debug,"shouldDisplayPromotion() strategy stopped promotion. strategy type: "+c.type),o=!1;break}}var u=i.logins+1;return this.updateStrategy(r,u),o},i.prototype.updateStrategy=function(e,t){var n={days:(new Date).getTime(),logins:t};this._sdk.host.writeStorageKey(e,n)},i.prototype.checkStrategy=function(e,n,r){if(this._sdk.host,e.type==t.Protocol.PromotionStrategyFrequency.LOGINS)return n.logins%e.value==0;if(e.type==t.Protocol.PromotionStrategyFrequency.DAYS){var i=new Date,o=new Date;return o.setTime(n.days),i.getDate()+e.value>=o.getDate()}return!1},i.ASSERT_DECLINE="decline",i.ACTION_REGISTRATION="registration",i.ACTION_PROMOTION="registration_promotion",i}(n.ActionDriverAuthenticatorOp);n.ActionDriverPromotion=i})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.actiondrivers||(t.actiondrivers={}),r=function(n){function r(e,t){return n.call(this,e,t)||this}return __extends(r,n),r.prototype.doRunAction=function(){var n=this;this._sdk.log(e.LogLevel.Debug,"Executing provision TOTP action."),this._cfmAction=this._action;var r=t.totp.TotpPropertiesProcessor.createWithUser(this._controlFlowProcessor._session.user,this._sdk,this._clientContext,this._controlFlowProcessor._session),i=r.createTotpDriver(this._cfmAction.generator,this._cfmAction.otp_type);return i?(r.deleteProvisionForGenerator(this._cfmAction.generator),i.promiseProvisionOutput(this._cfmAction,this.policyAction(),this._clientContext,this._uiHandler).then(function(e){return n.sendAssertionRequest(null,e.getAssertionData()).then(function(t){return e.finalize(t),r.updateWithProvisionedGenerator(n._cfmAction,e),t})})):(this._sdk.log(e.LogLevel.Error,"failed to create TOTP driver"),Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"failed to create TOTP driver")))},r}(n.SimpleCancellationActionDriver),n.ActionDriverProvisionTotp=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.actiondrivers||(t.actiondrivers={}),r=function(r){function i(e,t){return r.call(this,e,t)||this}return __extends(i,r),i.prototype.runActionWithCompletionFunctions=function(){var r=this,i=this._action;this._sdk.log(e.LogLevel.Debug,"Loading and validating authenticator description");for(var o=0;o<i.assertions.length;o++){var a=n.AuthenticationMenuAuthenticator.fromRegistrationAction(i.assertions[o],this);if(a.getSupportedOnDevice()){this._registeredAuthenticator=a,this._silentRegistration=!!i.assertions[o].silent;break}}if(this._registeredAuthenticator){var s=this._registeredAuthenticator.authDriver;this.prepareForRunningAuthenticationDriver(s)&&(this._sdk.log(e.LogLevel.Debug,"Starting auth registeration"),s.runRegistration().then(function(n){n instanceof t.authenticationdrivers.AuthenticationDriverSessionResultAuthenticationCompleted?r.completeAuthenticationWithAssertionResult(n.assertionResult):r.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unknown authentication driver result type encountered during registration."))},function(t){r._sdk.log(e.LogLevel.Debug,"Received authentication driver error "+t),r.completeAuthenticationWithError(t)}))}else this.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"No supported authenticator listed in registeration request."))},Object.defineProperty(i.prototype,"availableAuthenticatorsForSwitching",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"availableAuthenticators",{get:function(){return[this._registeredAuthenticator]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isSilentRegistration",{get:function(){return this._silentRegistration},enumerable:!0,configurable:!0}),i}(n.ActionDriverAuthenticatorOp),n.ActionDriverRegistration=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n){return t.call(this,e,n)||this}return __extends(n,t),n.prototype.run=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"Executing scan qr action."),new Promise(function(n,r){var i=t._action,o=e.QrCodeFormat.Alphanumeric;if(i.qr_code_format_type&&(o=e.QrCodeFormatImpl.fromAssertionFormat(i.qr_code_format_type)),t._session=t._uiHandler.createScanQrSession(t._policyAction,t._clientContext),!t._session)throw e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createScanQrSession.");t._session.startSession(t._clientContext,new e.impl.PolicyActionImpl(t._action)),t._session.getScanQrResponse(i.instructions,o).then(function(i){if(i.isControlRequest())return t.processControlRequest(i.getControlRequest()).then(function(){});var o={qr_content:i.getResponse().getQrCodeResult().getQrCode()};t._sdk.log(e.LogLevel.Debug,"Asserting scan qr: "+o.qr_content),t.sendAssertionRequest(null,o).then(function(e){n(e)}).catch(function(n){t._sdk.log(e.LogLevel.Error,"Scan qr sendAssertionRequest error: "+n),t._session.endSession(),r(n)})}).finally(function(){t._session.endSession()}).catch(function(n){t._sdk.log(e.LogLevel.Error,"Scan qr action error: "+n),r(n)})})},n.prototype.processControlRequest=function(t){var n=this;return new Promise(function(r,i){switch(n._sdk.log(e.LogLevel.Debug,"Processing control request "+t.getRequestType()),t.getRequestType()){case e.ControlRequestType.CancelAuthenticator:i(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Scan qr code action canceled by user."));break;default:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Unsupported control request: "+t.getRequestType()+" for scan qr action.")}})},n}(t.ActionDriver);t.ActionDriverScanQr=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n){return t.call(this,e,n)||this}return __extends(n,t),n.augmentAssertionDataWithSignedContent=function(t,n,r,i){var o=JSON.stringify(n);i.log(e.LogLevel.Debug,"Signing consent payload: "+o);var a=e.util.asciiToHex(o);return r.signHex(a).then(function(n){var r=e.util.hexToBase64(n),i={payload:o,signed_payload:r};return t.sign_content_data=i,t})},n.prototype.run=function(){var t=this;this._sdk.log(e.LogLevel.Debug,"Executing consent action.");var r={params:this._controlFlowProcessor.initiatingRequest.body.params||{}},i=this._controlFlowProcessor.approval;return i&&(r.approval={approval_id:i.getApprovalId(),message:{title:i.getTitle(),details:i.getDetails()}}),n.augmentAssertionDataWithSignedContent({},r,this._controlFlowProcessor._session.deviceSigningKeyPair,this._sdk).then(function(e){return t.sendAssertionRequest(null,e)})},n}(t.ActionDriver);t.ActionDriverSignContent=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n){return t.call(this,e,n)||this}return __extends(n,t),n.prototype.doRunAction=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"Executing ticket wait action."),new Promise(function(n,r){var i=t._action;if(t._session=t._uiHandler.createTicketWaitSession(t._policyAction,t._clientContext),!t._session)throw e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createTicketWaitSession.");t._session.setWaitingTicket(new e.impl.TicketWaitingInformationImpl(i)),t._session.startSession(new e.impl.PolicyActionImpl(t._action),t._clientContext),t.pollServer().then(function(e){n(e)}).finally(function(){t._session.endSession()}).catch(function(n){t._sdk.log(e.LogLevel.Error,"Wait for ticket action error: "+n),r(n)})})},n.prototype.pollServer=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"Asserting ticket wait poll"),this.sendAssertionRequest(null,{}).then(function(e){return 13==e.assertion_error_code?t.inputLoop(e):e})},n.prototype.inputLoop=function(t){var n=this;return this._session.promiseInput().then(function(r){if(r.isControlRequest())return n.processControlRequest(r.getControlRequest()).then(function(){return t});var i=r.getResponse();if(i instanceof e.TicketWaitInputPollRequest)return n.pollServer();throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Expected polling request input response but got: "+i)})},n.prototype.processControlRequest=function(t){var n=this;return new Promise(function(r,i){switch(n._sdk.log(e.LogLevel.Debug,"Processing control request "+t.getRequestType()),t.getRequestType()){case e.ControlRequestType.CancelAuthenticator:case e.ControlRequestType.AbortAuthentication:i(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Wait for ticket action canceled by user."));break;default:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Unsupported control request: "+t.getRequestType()+" for ticket wait action.")}})},n}(t.SimpleCancellationActionDriver);t.ActionDriverTicketWait=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(e,t){return n.call(this,e,t)||this}return __extends(r,n),r.prototype.runActionWithCompletionFunctions=function(){this._action=this._action,this._sdk.log(e.LogLevel.Debug,"Started unregister action!"),t.AuthenticationMenuAuthenticator.fromUnregistrationAction(this._action,this).authDriver.runUnregistration().then(this._completionFunction,this._rejectionFunction)},Object.defineProperty(r.prototype,"availableAuthenticators",{get:function(){return this._availableAuthenticators.concat([])},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isSilentRegistration",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isPlaceholder",{get:function(){return 0==this._action.method.indexOf("placeholder")},enumerable:!0,configurable:!0}),r.prototype.sendUnregisterAssertion=function(){return this.sendAssertionRequest()},r}(t.ActionDriverAuthenticatorOp);t.ActionDriverUnregistration=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r,i;r=n.dyadic||(n.dyadic={}),i=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return __extends(r,n),r.prototype.run=function(){var n=this;return"false"==this._sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.DyadicPresent)?Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Dyadic capability is not present (is Dyadic SDK integrated?)")):this.issueDyadicRequest().then(function(e){return n.sendAssertionRequest(null,n.buildAssertionData(e)).then(function(r){var i=n.dyadicServerResponseFromAssertionResponse(r);return i?e.finalize(i).then(function(e){return r}):Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Dyadic data missing from server response"))})})},r.prototype.dyadicServerResponseFromAssertionResponse=function(e){var t=e.data&&e.data.dyadic;return t&&t.server_response},r.prototype.buildAssertionData=function(e){var t={requestData:"request_data",requestPayload:"request_payload",proxyPayload:"proxy_payload"},n=e.getServerRequest();Object.keys(t).forEach(function(e){var r=t[e];n[r]=n[e],delete n[e];var i=n[r];i&&(i.original_data=i.originalData,delete i.originalData)});var r={dyadic:n};return r.dyadic.token_uid=e.getTokenId()||this._controlFlowProcessor._session.deviceId(),r},r}(n.ActionDriver),r.ActionDriverDyadic=i}((n=t.core||(t.core={})).actiondrivers||(n.actiondrivers={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.issueDyadicRequest=function(){var e=this._action,t=this._controlFlowProcessor._session.user.guid.toString();return this._sdk.host.dyadicEnroll(t,e.server_info)},t}(e.ActionDriverDyadic);e.ActionDriverDyadicEnroll=t}(e.dyadic||(e.dyadic={}))}(e.actiondrivers||(e.actiondrivers={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(){function e(){}return e.prototype.getServerRequest=function(){return this._serverRequest},e.prototype.getTokenId=function(){return this._signHandle.getTokenId()},e.prototype.finalize=function(e){var t=this,n=e,r=this._signHandle.finalize(n.server_response);return n.otp_token_refresh&&Object.keys(n.otp_token_refresh).forEach(function(e){r=r.then(function(r){return t._refreshTokenHandles[e].finalize(n.otp_token_refresh[e])})}),r},e.create=function(t,n,r){var i=new e;return i._refreshTokenHandles=t,i._signHandle=n,i._serverRequest=r,i},e}(),r=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return __extends(r,t),r.prototype.issueDyadicRequest=function(){var t=this,r=this._action,i=e.util.asciiToHex(r.assertion_id+this._controlFlowProcessor.challenge);return this._sdk.host.dyadicSign(i).then(function(e){var i={},o=e.getServerRequest(),a=Promise.resolve(!0);return r.otp_token_uids&&0<r.otp_token_uids.length&&(o.otp_token_refresh={},r.otp_token_uids.forEach(function(e){a=a.then(function(n){return t._sdk.host.dyadicRefreshToken(e).then(function(t){return i[e]=t,o.otp_token_refresh[e]=t.getServerRequest(),!0})})})),a.then(function(t){return n.create(i,e,o)})})},r.prototype.dyadicServerResponseFromAssertionResponse=function(e){return e.data&&e.data.dyadic},r}(t.ActionDriverDyadic);t.ActionDriverDyadicSign=r}(t.dyadic||(t.dyadic={}))})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.issueDyadicRequest=function(){return this._sdk.host.dyadicDelete()},t}(e.ActionDriverDyadic);e.ActionDriverDyadicDelete=t}(e.dyadic||(e.dyadic={}))}(e.actiondrivers||(e.actiondrivers={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.ActionDrivers={confirmation:e.ActionDriverConfirmation,information:e.ActionDriverInformation,json_data:e.ActionDriverJsonData,authentication:e.ActionDriverAuthentication,registration:e.ActionDriverRegistration,unregistration:e.ActionDriverUnregistration,provision_totp:e.ActionDriverProvisionTotp,disable_totp:e.ActionDriverDisableTotp,sign_content:e.ActionDriverSignContent,form:e.ActionDriverForm,registration_promotion:e.ActionDriverPromotion,scan_qr:e.ActionDriverScanQr,wait_for_ticket:e.ActionDriverTicketWait,dyadic_enroll:e.dyadic.ActionDriverDyadicEnroll,dyadic_sign:e.dyadic.ActionDriverDyadicSign,dyadic_un_enroll:e.dyadic.ActionDriverDyadicDelete}}(e.actiondrivers||(e.actiondrivers={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i=function(){function i(e,t,n){this._externalCancelled=!1,this._actionDriver=e,this._authenticatorConfig=t,this._authenticatorDescription=n,this._sdk=e._sdk,this._uiHandler=e._uiHandler,this._clientContext=e._clientContext}return i.prototype.runAuthentication=function(e){return this._authenticationParameters=e,this.runMode(t.AuthenticatorSessionMode.Authentication)},i.prototype.runRegistration=function(){return this._actionDriver.isSilentRegistration?r.instanceOfAuthenticationDriverSilentRegistrationSupport(this)?(this._sdk.log(t.LogLevel.Debug,"Invoking silent registration for "+this._authenticatorDescription.getAuthenticatorId()),this.runSilentRegistration()):Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorError,"Silent registration not supported for this authenticator")):this.runMode(t.AuthenticatorSessionMode.Registration)},i.prototype.runUnregistration=function(){var e=this,n=this._actionDriver;return this._sdk.currentUiHandler.handleAuthenticatorUnregistration(this._authenticatorDescription,n.isPlaceholder,n.policyAction(),this._clientContext).then(function(r){if(e._sdk.log(t.LogLevel.Debug,"handleAuthenticatorUnregistration() result: "+r),0==r.getUserChoice())return n.sendUnregisterAssertion().then(function(t){return e.handleUnregistrationAssertionResult(t),t});var i=new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Unregistration failed due to app implementation rejecting unregistertion.");return Promise.reject(i)})},i.prototype.onCancelRun=function(){this._externalCancelled=!0},Object.defineProperty(i.prototype,"user",{get:function(){return this._actionDriver._controlFlowProcessor._session.user},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"operationMode",{get:function(){return this._operationMode},enumerable:!0,configurable:!0}),i.prototype.completeAuthenticatorSessionWithResult=function(e){this._inputSession&&this._inputSession.endSession(),this._completionFunction(e)},i.prototype.completeAuthenticatorSessionWithError=function(e){if(this._inputSession)try{this._inputSession.endSession()}catch(e){this._sdk.log(t.LogLevel.Warning,"Can't dismiss authenticator session during error reporting.")}this._rejectionFunction(e)},i.prototype.handleInputOrControlResponse=function(e){try{e.isControlRequest()?this.processControlRequest(e.getControlRequest()):this._operationMode==t.AuthenticatorSessionMode.Authentication?this.handleAuthenticationInputResponse(e.getResponse()):this.handleRegistrationInputResponse(e.getResponse())}catch(e){this.performErrorRecoveryForError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},i.prototype.processRegisterAssertion=function(e,n){var i=this;this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"register",e,n).then(function(e){i.handleRegisterAssertionResult(e)||(i._sdk.log(t.LogLevel.Info,"Registration session done."),i.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultAuthenticationCompleted(e)))}).catch(function(e){i._sdk.log(t.LogLevel.Error,"Perform error recovery with server error "+e),i.performErrorRecoveryForError(e)})},i.prototype.processAuthenticateAssertion=function(e,n){var i=this;this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"authenticate",e,n).then(function(e){i.handleAuthenticateAssertionResult(e)||(i._sdk.log(t.LogLevel.Info,"Authenticator session done."),i.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultAuthenticationCompleted(e)))}).catch(function(e){i._sdk.log(t.LogLevel.Error,"Perform error recovery with server error "+e),i.performErrorRecoveryForError(e)})},i.prototype.runMode=function(e){var n=this;return new Promise(function(r,i){if(n._completionFunction=r,n._rejectionFunction=i,n._operationMode=e,n._inputSession=n.createAuthenticatorSession(),!n._inputSession)throw t.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from authenticator session creation call.");n._inputSession.startSession(n._authenticatorDescription,n._operationMode,n._actionDriver.policyAction(),n._clientContext),n.authOrRegInStartedSession(!1)}).catch(function(e){throw t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e)})},i.prototype.handleGeneralAssertionResult=function(e){return this._sdk.log(t.LogLevel.Debug,"Authenticator assertion response "+JSON.stringify(e)),e.data&&(this._sdk.log(t.LogLevel.Debug,"Processing authenticator assertion response: updating assertion authenticator description"),this._authenticatorDescription.updateWithAssertionResult(e.data)),e.state!=n.Protocol.AuthSessionState.Pending&&(this._sdk.log(t.LogLevel.Info,"Authenticator session complete; status "+e.state),this.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultAuthenticationCompleted(e)),!0)},i.prototype.handleUnregistrationAssertionResult=function(e){},i.prototype.handleRegisterAssertionResult=function(e){return!!this.handleGeneralAssertionResult(e)||!!e.assertion_error_code&&(this._sdk.log(t.LogLevel.Error,"handleRegisterAssertionResult() Assertion error encoutered. Starting error recovery."),this.performErrorRecoveryForError(t.impl.AuthenticationErrorImpl.errorForAssertionResponse(e)),!0)},i.prototype.handleAuthenticateAssertionResult=function(e){if(this.handleGeneralAssertionResult(e))return!0;if(e.assertion_error_code)switch(e.assertion_error_code){case n.Protocol.AssertionErrorCode.MustRegister:return this._sdk.log(t.LogLevel.Info,"handleAuthenticateAssertionResult() Authenticator expired; must register"),this.handleRegistrationDueToExpiration(),!0;case n.Protocol.AssertionErrorCode.FailOver:return this._sdk.log(t.LogLevel.Info,"handleAuthenticateAssertionResult() Failover signalled"),this.handleFallback(),!0;default:return this._sdk.log(t.LogLevel.Error,"handleAuthenticateAssertionResult() Assertion error encoutered. Starting error recovery. 2"),this.performErrorRecoveryForError(t.impl.AuthenticationErrorImpl.errorForAssertionResponse(e)),!0}else if(this._authenticatorDescription.getExpired())return this._sdk.log(t.LogLevel.Info,"Authenticator expired; must register"),this.handleRegistrationDueToExpiration(),!0;return!1},i.prototype.processAuthFailureAssertionAndHandleError=function(e,r){var i=this,o={num_of_failures:r};this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"auth_failure",o).then(function(r){if(!i.handleGeneralAssertionResult(r)){if(r.assertion_error_code)switch(r.assertion_error_code){case n.Protocol.AssertionErrorCode.FailOver:return i._sdk.log(t.LogLevel.Info,"Failover signalled during local failure report"),i.handleFallback(),!0}if(r.data){var o={};for(var a in e.getData())o[a]=e.getData()[a];for(var a in r.data)o[a]=r.data[a];e=new t.impl.AuthenticationErrorImpl(e.getErrorCode(),e.getMessage(),o)}i.performErrorRecoveryForError(e)}},function(e){var n=t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e);i._sdk.log(t.LogLevel.Error,"Error ${authError} signalled during local failure report"),i.performErrorRecoveryForError(n,!0)})},i.prototype.handleRegistrationDueToExpiration=function(){this._inputSession.changeSessionModeToRegistrationAfterExpiration(),this._operationMode=t.AuthenticatorSessionMode.Registration,this.registerInStartedSession(!1)},i.prototype.authOrRegInStartedSession=function(e){this._operationMode==t.AuthenticatorSessionMode.Authentication?this.authenticateInStartedSession(e):this.registerInStartedSession(e)},i.prototype.processControlRequest=function(e){switch(this._sdk.log(t.LogLevel.Debug,"Processing control request "+e.getRequestType()),e.getRequestType()){case t.ControlRequestType.AbortAuthentication:this.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.UserCanceled,"Authentication cancelled due to abort control request."));break;case t.ControlRequestType.ChangeMethod:this.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultSwitchAuthenticator(null,this.getAuthenticationActionOtherAuthenticators()));break;case t.ControlRequestType.SelectMethod:this.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultSwitchAuthenticator);break;case t.ControlRequestType.CancelAuthenticator:this.invokeUiHandlerCancellation();break;case t.ControlRequestType.RetryAuthenticator:this.authOrRegInStartedSession(!0);break;default:this.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Invalid ControlRequestType value during authentication session."))}},i.prototype.invokeUiHandlerCancellation=function(){var e=this;if(this._externalCancelled)this.processControlRequest(t.ControlRequest.create(t.ControlRequestType.AbortAuthentication));else{var n=[t.ControlRequestType.RetryAuthenticator,t.ControlRequestType.AbortAuthentication];this.getAuthenticationActionOtherAuthenticators().length>0&&n.push(t.ControlRequestType.ChangeMethod),this._actionDriver.availableAuthenticatorsForSwitching.length>0&&n.push(t.ControlRequestType.SelectMethod),this._uiHandler.controlOptionForCancellationRequestInSession(n,this._inputSession).then(function(r){return r.getRequestType()==t.ControlRequestType.CancelAuthenticator?void e.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"controlOptionForCancellationRequestInSession returned CancelAuthenticator which is an invalid option.")):n.indexOf(r.getRequestType())<0?void e.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"controlOptionForCancellationRequestInSession returned an invalid option.")):void e.processControlRequest(r)})}},i.prototype.getAuthenticationActionOtherAuthenticators=function(){var e=this;return this._actionDriver.availableAuthenticatorsForSwitching.filter(function(t){return t!=e._authenticatorDescription})},i.prototype.handleFallback=function(){var e=this;if(this._authenticatorDescription.fallback){var n=[t.AuthenticatorFallbackAction.Retry,t.AuthenticatorFallbackAction.Cancel],i=null,o=this._authenticatorDescription.fallback.method;o?(i=this._actionDriver.availableAuthenticators.filter(function(e){return e.getAuthenticatorId()==o})[0])&&n.push(t.AuthenticatorFallbackAction.Fallback):this.getAuthenticationActionOtherAuthenticators().length>0&&n.push(t.AuthenticatorFallbackAction.AuthMenu),this._uiHandler.selectAuthenticatorFallbackAction(n,i,this._inputSession,this._actionDriver.policyAction(),this._clientContext).then(function(o){switch(e._sdk.log(t.LogLevel.Debug,"Fallback action selected "+o),n.indexOf(o)<0&&(e._sdk.log(t.LogLevel.Error,"Invalid fallback action selected: "+o+" not in "+n),e.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Invalid fallback action selected by callback."))),o){case t.AuthenticatorFallbackAction.Fallback:case t.AuthenticatorFallbackAction.AuthMenu:e.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultSwitchAuthenticator(i));break;case t.AuthenticatorFallbackAction.Retry:e.authOrRegInStartedSession(!0);break;case t.AuthenticatorFallbackAction.Cancel:e.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.UserCanceled,"User cancel in response to fallback action."))}})}else this.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Cannot handle a fallback error without fallback specification in action."))},i.prototype.recoveryOptionsForError=function(e,n){var r=[t.AuthenticationErrorRecovery.Fail];return[t.AuthenticationErrorCode.AllAuthenticatorsLocked,t.AuthenticationErrorCode.AppImplementation,t.AuthenticationErrorCode.ControlFlowExpired,t.AuthenticationErrorCode.SessionRequired,t.AuthenticationErrorCode.InvalidDeviceBinding,t.AuthenticationErrorCode.UserCanceled].indexOf(e.getErrorCode())>=0?r:(n||!this._authenticatorDescription.getEnabled()||this._operationMode==t.AuthenticatorSessionMode.Authentication&&e.getErrorCode()==t.AuthenticationErrorCode.AuthenticatorExternalConfigError||r.push(t.AuthenticationErrorRecovery.RetryAuthenticator),this.getAuthenticationActionOtherAuthenticators().length>0&&r.push(t.AuthenticationErrorRecovery.ChangeAuthenticator),this._actionDriver.availableAuthenticatorsForSwitching.length>0&&r.push(t.AuthenticationErrorRecovery.SelectAuthenticator),r)},i.prototype.performErrorRecoveryForError=function(n,r){var i=this,o={};o[e.sdkhost.ErrorDataRetriesLeft]=this._authenticatorDescription.retriesLeft;var a=(t.impl.AuthenticationErrorImpl.augmentErrorData(n,o),this.recoveryOptionsForError(n,r)),s=this.defaultRecoveryForError(n);a.indexOf(s)<0&&(s=a.indexOf(t.AuthenticationErrorRecovery.SelectAuthenticator)>=0?t.AuthenticationErrorRecovery.SelectAuthenticator:t.AuthenticationErrorRecovery.Fail),this._inputSession.promiseRecoveryForError(n,a,s).then(function(e){i._sdk.log(t.LogLevel.Debug,"Error recovery selected "+e),i._sdk.log(t.LogLevel.Debug,"recover from error: "+n.getErrorCode()),a.indexOf(e)<0&&(i._sdk.log(t.LogLevel.Error,"Invalid error recovery option from callback: "+e+" not in "+a),i.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Invalid error recovery action selected by callback."))),i.handleErrorRecoveryAction(e,n)})},i.prototype.handleErrorRecoveryAction=function(e,n){switch(e){case t.AuthenticationErrorRecovery.RetryAuthenticator:this.authOrRegInStartedSession(!0);break;case t.AuthenticationErrorRecovery.ChangeAuthenticator:this.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultSwitchAuthenticator(null,this.getAuthenticationActionOtherAuthenticators()));break;case t.AuthenticationErrorRecovery.SelectAuthenticator:this.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultSwitchAuthenticator);break;case t.AuthenticationErrorRecovery.Fail:default:this.completeAuthenticatorSessionWithError(n)}},i.prototype.defaultRecoveryForError=function(e){return this._operationMode==t.AuthenticatorSessionMode.Authentication?!this._authenticatorDescription.getLocked()&&this._authenticatorDescription.getRegistered()&&this._authenticatorDescription.getEnabled()&&e.getErrorCode()!=t.AuthenticationErrorCode.AuthenticatorLocked&&e.getErrorCode()!=t.AuthenticationErrorCode.AllAuthenticatorsLocked?t.AuthenticationErrorRecovery.RetryAuthenticator:e.getErrorCode()!=t.AuthenticationErrorCode.AllAuthenticatorsLocked?t.AuthenticationErrorRecovery.ChangeAuthenticator:t.AuthenticationErrorRecovery.Fail:t.AuthenticationErrorRecovery.RetryAuthenticator},i}(),r.AuthenticationDriver=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),n.prototype.authenticateInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.prototype.registerInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.prototype.handleAuthenticationInputResponse=function(t){var n;try{n=this.generateAssertionDataForInputResponse(t)}catch(t){return void this.performErrorRecoveryForError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))}this.processAuthenticateAssertion(n)},n.prototype.handleRegistrationInputResponse=function(t){try{var n=this.generateAssertionDataForInputResponse(t)}catch(t){return void this.performErrorRecoveryForError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))}this.processRegisterAssertion(n)},n.prototype.generateAssertionDataForInputResponse=function(e){return{secret:this.generateSecretToSignForInputResponse(e)}},n}(t.AuthenticationDriver);t.AuthenticationDriverCentralizedSecretInputBased=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(){function n(e){this._authenticationDriverCtor=e}return n.prototype.createAuthenticationDriver=function(e,t,n){return new this._authenticationDriverCtor(e,t,n)},n.prototype.evaluateLocalRegistrationStatus=function(t){return e.AuthenticatorRegistrationStatus.Registered},n.prototype.isSupportedOnDevice=function(e){return!0},n.prototype.suggestParameters=function(e,t){return[]},n.refreshInvalidatedAuthenticatorsEnrollments=function(e){return new Promise(function(n,r){var i,o=new Array;for(var a in e.user.localEnrollments){i=e.user.localEnrollments[a];var s=t.AuthenticatorDrivers[i.authenticatorId];o.push(s.checkAuthenticatorInvalidatedAndNotifyUIHandler(e))}Promise.all(o).then(function(e){n(e)}).catch(function(e){r(e)})})},n.prototype.checkAuthenticatorInvalidatedAndNotifyUIHandler=function(e){return Promise.resolve(!0)},n}();t.SimpleAuthenticationDriverDescriptor=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r,i;t=e.core||(e.core={}),n=t.authenticationdrivers||(t.authenticationdrivers={}),r=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return __extends(n,e),n.prototype.getEnabled=function(){return this.getSupportedOnDevice()},n.getDescription=function(e,r){return new n(e,r,{},{status:t.Protocol.AuthenticationMethodStatus.Unregistered})},n}(n.AuthenticatorDescriptionImpl),i=function(i){function o(e,t){var n=i.call(this,e)||this;return n._authenticatorType=t,n}return __extends(o,i),o.prototype.evaluateLocalRegistrationStatus=function(n){var r=n.user.localEnrollments[this._authenticatorType];return r?r.validationStatus==t.LocalEnrollmentValidationStatus.Invalidated?e.AuthenticatorRegistrationStatus.LocallyInvalid:e.AuthenticatorRegistrationStatus.Registered:e.AuthenticatorRegistrationStatus.LocallyInvalid},o.prototype.checkAuthenticatorInvalidatedAndNotifyUIHandler=function(i){var o=this;return new Promise(function(a,s){i.sdk.log(e.LogLevel.Info,"Checking if authenticator "+o._authenticatorType+" has become invalidated.");var c=i.user.localEnrollments[o._authenticatorType];if(c.status==t.LocalEnrollmentStatus.Registered&&c.validationStatus!=t.LocalEnrollmentValidationStatus.Invalidated)if(n.AuthenticatorDrivers[o._authenticatorType].evaluateLocalRegistrationStatus(i)==e.AuthenticatorRegistrationStatus.LocallyInvalid){i.sdk.log(e.LogLevel.Info,"Authenticator "+o._authenticatorType+" already became invalidated. Invalidating enrollment record and notifying ui handler.");var u=r.getDescription(i,c.authenticatorId);t.LocalEnrollment.invalidateLocalRegistrationStatusAndNotifyUIHandler(i.getCurrentControlFlowProcessor(),u).then(function(e){a(e)}).catch(function(e){s(e)})}else a(!1);else a(!1)})},o}(n.SimpleAuthenticationDriverDescriptor),n.AuthenticationDriverDescriptorLocal=i}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r=function(r){function i(){return r.call(this,n.AuthenticationDriverDeviceStrongAuthentication,i.authenticatorName)||this}return __extends(i,r),i.prototype.evaluateLocalRegistrationStatus=function(e){return t.AuthenticatorRegistrationStatus.Registered},i.prototype.isSupportedOnDevice=function(t){var n=t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.DeviceStrongAuthenticationSupported);return!!n&&"false"!=n},i.authenticatorName="native_biometrics",i}(n.AuthenticationDriverDescriptorLocal);n.AuthenticationDriverDescriptorDeviceStrongAuthentication=r}((n=t.core||(t.core={})).authenticationdrivers||(n.authenticationdrivers={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(n){function r(){return n.call(this,t.AuthenticationDriverFace)||this}return __extends(r,n),r.prototype.isSupportedOnDevice=function(t){return"true"==t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.ImageAcquitisionSupported)},r}(t.SimpleAuthenticationDriverDescriptor);t.AuthenticationDriverDescriptorFace=n}(t.authenticationdrivers||(t.authenticationdrivers={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(e){var r=n.call(this,t.AuthenticationDriverFido)||this;return r._fidoPolicy=e,r}return __extends(r,n),r.prototype.isSupportedOnDevice=function(n){n.sdk.log(e.LogLevel.Debug,"Check FIDO authenticator support for "+JSON.stringify(this._fidoPolicy));var r=t.AuthenticationDriverFido.hasEligibleClientProvidersForPolicy(n.sdk,this._fidoPolicy);return r||n.sdk.log(e.LogLevel.Info,"Encountered non-supported FIDO request."),r},r.prototype.evaluateLocalRegistrationStatus=function(t){return e.AuthenticatorRegistrationStatus.Registered},r}(t.SimpleAuthenticationDriverDescriptor);t.AuthenticationDriverDescriptorFido=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.isSupportedOnDevice=function(t){return"true"===t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.Fido2ClientPresent)},n}(t.SimpleAuthenticationDriverDescriptor);t.AuthenticationDriverDescriptorFido2=n}(t.authenticationdrivers||(t.authenticationdrivers={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r=function(r){function i(){return r.call(this,n.AuthenticationDriverFingerprint,i.authenticatorName)||this}return __extends(i,r),i.prototype.evaluateLocalRegistrationStatus=function(o){var a=r.prototype.evaluateLocalRegistrationStatus.call(this,o);if(a!=t.AuthenticatorRegistrationStatus.Registered)return a;var s=o.user.localEnrollments[i.authenticatorName],c=n.AuthenticationDriverFingerprint.authenticatorKeyTagForUser(o.user,s.version,s.salt),u=o.sdk.host.getKeyPair(c,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);return u?(u.closeKeyPair(),t.AuthenticatorRegistrationStatus.Registered):t.AuthenticatorRegistrationStatus.LocallyInvalid},i.prototype.isSupportedOnDevice=function(t){return"true"==t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.FingerprintSupported)},i.authenticatorName="fingerprint",i}(n.AuthenticationDriverDescriptorLocal);n.AuthenticationDriverDescriptorFingerprint=r}((n=t.core||(t.core={})).authenticationdrivers||(n.authenticationdrivers={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(){function e(e,t){this._targetIdentifier=e,this._description=t.describe(),this._deviceDetails=t}return e.prototype.getDescription=function(){return this._description},e.prototype.getDeviceIdentifier=function(){return this._targetIdentifier},e.prototype.getDeviceDetails=function(){return this._deviceDetails},e.__tarsusInterfaceName="MobileApproveTarget",e}();t.MobileApproveTargetImpl=n;var r=function(){function r(){}return r.prototype.evaluateLocalRegistrationStatus=function(t){return e.AuthenticatorRegistrationStatus.Registered},r.prototype.isSupportedOnDevice=function(e){return!0},r.prototype.suggestParameters=function(t,n){return r.createTargetsFromConfig(t).map(function(t){return e.AuthenticationActionParameterTargetSelection.create(t)})},r.prototype.createAuthenticationDriver=function(e,n,r){return new t.AuthenticationDriverMobileApprove(e,n,r)},r.createTargetsFromConfig=function(t){return t.selectable_devices.map(function(t,r){var i=e.TargetDeviceDetailsImpl.fromServerFormat(t);return new n(t.device_id,i)})},r.prototype.checkAuthenticatorInvalidatedAndNotifyUIHandler=function(e){return Promise.resolve(!0)},r}();t.AuthenticationDriverDescriptorMobileApprove=r})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r=function(r){function i(){return r.call(this,n.AuthenticationDriverNativeFace,i.authenticatorName)||this}return __extends(i,r),i.prototype.evaluateLocalRegistrationStatus=function(o){var a=r.prototype.evaluateLocalRegistrationStatus.call(this,o);if(a!=t.AuthenticatorRegistrationStatus.Registered)return a;var s=o.user.localEnrollments[i.authenticatorName],c=n.AuthenticationDriverNativeFace.authenticatorKeyTagForUser(o.user,s.version,s.salt),u=o.sdk.host.getKeyPair(c,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);return u?(u.closeKeyPair(),t.AuthenticatorRegistrationStatus.Registered):t.AuthenticatorRegistrationStatus.LocallyInvalid},i.prototype.isSupportedOnDevice=function(t){return"true"==t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.FaceIdKeyBioProtectionSupported)},i.authenticatorName="face_id",i}(n.AuthenticationDriverDescriptorLocal);n.AuthenticationDriverDescriptorNativeFace=r}((n=t.core||(t.core={})).authenticationdrivers||(n.authenticationdrivers={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(n){var r=function(){function e(e,t,n,r,i,o){this._channelIndex=e,this._channelAssertionId=t,this._targetIdentifier=n,this._description=r,this._channel=i,this._deviceDetails=o}return e.prototype.getDescription=function(){return this._description},e.prototype.getChannel=function(){return this._channel},e.prototype.getTargetIdentifier=function(){return this._targetIdentifier},e.prototype.getChannelAssertionId=function(){return this._channelAssertionId},e.prototype.getChannelIndex=function(){return this._channelIndex},e.prototype.getDeviceDetails=function(){return this._deviceDetails},e.__tarsusInterfaceName="OtpTarget",e}();n.OtpTargetImpl=r;var i=function(){function i(){}return i.prototype.evaluateLocalRegistrationStatus=function(t){return e.AuthenticatorRegistrationStatus.Registered},i.prototype.isSupportedOnDevice=function(e){return!0},i.prototype.suggestParameters=function(t,n){return this.createTargetsFromConfig(t).map(function(t){return e.AuthenticationActionParameterTargetSelection.create(t)})},i.prototype.createAuthenticationDriver=function(e,t,r){var i=this.createTargetsFromConfig(t);return new n.AuthenticationDriverOtp(e,t,i,r)},i.prototype.createTargetsFromConfig=function(n){return n.channels.map(function(n){var i;switch(n.type){case t.Protocol.AuthenticationMethodOtpChannelType.Email:i=e.OtpChannel.Email;break;case t.Protocol.AuthenticationMethodOtpChannelType.Sms:i=e.OtpChannel.Sms;break;case t.Protocol.AuthenticationMethodOtpChannelType.Voice:i=e.OtpChannel.VoiceCall;break;case t.Protocol.AuthenticationMethodOtpChannelType.Push:i=e.OtpChannel.PushNotification;break;default:i=e.OtpChannel.Unknown}return!n.targets&&n.target&&(n.targets={},n.targets[0]=n.target),n.targets||(n.targets={}),Object.keys(n.targets).map(function(t,o){var a=n.targets[t];switch(i){case e.OtpChannel.PushNotification:var s=a,c=e.TargetDeviceDetailsImpl.fromServerFormat(s);return new r(o,n.assertion_id,t,c.describe(),i,c);default:var u=a;return new r(o,n.assertion_id,t,u,i,null)}})}).reduce(function(e,t){return e.concat(t)},[])},i.prototype.checkAuthenticatorInvalidatedAndNotifyUIHandler=function(e){return Promise.resolve(!0)},i}();n.AuthenticationDriverDescriptorOtp=i})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(){function e(e,t){this._targetIdentifier=e,this._description=t.describe(),this._deviceDetails=t}return e.prototype.getDescription=function(){return this._description},e.prototype.getDeviceIdentifier=function(){return this._targetIdentifier},e.prototype.getDeviceDetails=function(){return this._deviceDetails},e.__tarsusInterfaceName="TotpTarget",e}();t.TotpTargetImpl=n;var r=function(){function r(){}return r.prototype.evaluateLocalRegistrationStatus=function(t){return e.AuthenticatorRegistrationStatus.Registered},r.prototype.isSupportedOnDevice=function(e){return!0},r.prototype.suggestParameters=function(t,n){return r.createTargetsFromConfig(t).map(function(t){return e.AuthenticationActionParameterTargetSelection.create(t)})},r.prototype.createAuthenticationDriver=function(e,n,r){return new t.AuthenticationDriverTotp(e,n,r)},r.createTargetsFromConfig=function(t){var r=t;return r.selectable_devices?r.selectable_devices.map(function(t,r){var i=e.TargetDeviceDetailsImpl.fromServerFormat(t);return new n(t.device_id,i)}):[]},r.prototype.checkAuthenticatorInvalidatedAndNotifyUIHandler=function(e){return Promise.resolve(!0)},r}();t.AuthenticationDriverDescriptorTotp=r})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(n){function r(){return n.call(this,t.AuthenticationDriverVoice)||this}return __extends(r,n),r.prototype.isSupportedOnDevice=function(t){return"true"==t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.AudioAcquitisionSupported)},r}(t.SimpleAuthenticationDriverDescriptor);t.AuthenticationDriverDescriptorVoice=n}(t.authenticationdrivers||(t.authenticationdrivers={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.authenticationdrivers||(t.authenticationdrivers={}),r=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),Object.defineProperty(i.prototype,"lastObtainedKeyPair",{get:function(){return this._lastObtainedKeyPair},set:function(e){this._lastObtainedKeyPair&&this._lastObtainedKeyPair!=e&&this._lastObtainedKeyPair.closeKeyPair(),this._lastObtainedKeyPair=e},enumerable:!0,configurable:!0}),i.prototype.completeAuthenticatorSessionWithResult=function(i){this.operationMode===e.AuthenticatorSessionMode.Registration&&i instanceof n.AuthenticationDriverSessionResultAuthenticationCompleted&&(!i.assertionResult.assertion_error_code||i.assertionResult.assertion_error_code===t.Protocol.AssertionErrorCode.AssertionContainerNotComplete)&&(this._enrollmentRecordToCommit?(this._sdk.log(e.LogLevel.Debug,"Updating local enrollment record on registration"),this.user.updateEnrollmentRecord(this._enrollmentRecordToCommit)):this._sdk.log(e.LogLevel.Warning,"No enrollment record to update.")),this._enrollmentRecordToCommit=null,this.lastObtainedKeyPair=null,r.prototype.completeAuthenticatorSessionWithResult.call(this,i)},i.prototype.completeAuthenticatorSessionWithError=function(e){this.lastObtainedKeyPair=null,r.prototype.completeAuthenticatorSessionWithError.call(this,e)},i.prototype.registerInStartedSession=function(e){this._enrollmentRecordToCommit=null},i.prototype.calculateAssertionFieldsWithAuthenticatorKey=function(t){var n=this;return new Promise(function(r,i){var o=e.util.asciiToHex(n.localAuthenticatorChallenge());t.signHex(o).then(function(t){return{fch:e.util.hexToBase64(t)}}).then(r,i)})},i.prototype.handleAuthenticationInputResponse=function(n){var r=this,i=this.user.localEnrollments[this.authenticatorType];i||this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.NoRegisteredAuthenticator,"Missing key for "+this.authenticatorType+" authenticator")),this.getKeyForEnrollmentDataAndInput(i,n).then(function(n){return r._sdk.log(e.LogLevel.Debug,"Local authenticator key obtained; signing challenge"),r._externalCancelled?Promise.reject(r._actionDriver._controlFlowProcessor.createExternalCancellationError()):(r.lastObtainedKeyPair=n.key,r.calculateAssertionFieldsWithAuthenticatorKey(r.lastObtainedKeyPair).then(function(o){var a={};if(n.rolloverKeyData){r._sdk.log(e.LogLevel.Info,"Local authenticator rollover requested");var s={};n.rolloverKeyData.key&&(s.key=n.rolloverKeyData.key.publicKeyToJson(),s.version=n.rolloverKeyData.schemeVersion),n.rolloverReason&&(s.reason=n.rolloverReason),a.rollover=s,i.status=t.LocalEnrollmentStatus.Registered,i.validationStatus=t.LocalEnrollmentValidationStatus.Validated,i.salt=n.rolloverKeyData.salt,i.version=n.rolloverKeyData.schemeVersion,i.keyMaterial=n.rolloverKeyData.keyMeterial,i.cryptoSettings=r._sdk.cryptoSettings,i.authenticatorConfig=n.rolloverKeyData.authenticatorConfig,r._enrollmentRecordToCommit=i}r.processAuthenticateAssertion(a,o)},function(e){return Promise.reject(e)}))}).catch(function(t){r.processLocalAuthenticatorError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},i.prototype.getNewOrUpdatedEnrollmentRecord=function(n){this._sdk.log(e.LogLevel.Debug,"Register "+this.authenticatorType+": fetching local enrollment record");var r=this.user.localEnrollments[this.authenticatorType],i=n.key.publicKeyToJson().key,o=this._sdk.host.calcHexStringEncodedSha256Hash(e.util.base64ToHex(i));return r||(this._sdk.log(e.LogLevel.Debug,"Register "+this.authenticatorType+": Generating new local enrollment record"),r=this.user.createEnrollmentRecord(this.authenticatorType,n.schemeVersion,n.salt,t.LocalEnrollmentStatus.Unregistered,o)),r.status=t.LocalEnrollmentStatus.Registered,r.validationStatus=t.LocalEnrollmentValidationStatus.Validated,r.salt=n.salt,r.version=n.schemeVersion,r.cryptoSettings=this._sdk.cryptoSettings,r.publicKeyHash=o,r.keyMaterial=n.keyMeterial,r.authenticatorConfig=n.authenticatorConfig,r},i.prototype.handleRegistrationInputResponse=function(t){var n=this;this._sdk.log(e.LogLevel.Debug,"Register "+this.authenticatorType+": Generating pending enrollment data"),this.generatePendingEnrollment(t).then(function(t){n._sdk.log(e.LogLevel.Debug,"Register "+n.authenticatorType+": Signing registration assertion");var r=n.getNewOrUpdatedEnrollmentRecord(t);return n._enrollmentRecordToCommit=r,e.util.asciiToHex(n.localAuthenticatorChallenge()),n._externalCancelled?Promise.reject(n._actionDriver._controlFlowProcessor.createExternalCancellationError()):(n.lastObtainedKeyPair=t.key,n.calculateAssertionFieldsWithAuthenticatorKey(n.lastObtainedKeyPair).then(function(r){n._sdk.log(e.LogLevel.Debug,"Register "+n.authenticatorType+": Preparing registration assertion");try{var i=__assign({public_key:t.key.publicKeyToJson(),version:t.schemeVersion},r);n.processRegisterAssertion(null,i)}finally{n.lastObtainedKeyPair=null}},function(e){return n.lastObtainedKeyPair=null,Promise.reject(e)}))}).catch(function(t){n.processLocalAuthenticatorError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},i.prototype.handleRegisterAssertionResult=function(e){return e.data&&e.data.update_vaults&&t.vault.MultiCredsVault.updateVaultsProtectingCreds(this.user,e.data.update_vaults,this._uiHandler,this._sdk),r.prototype.handleRegisterAssertionResult.call(this,e)},i.prototype.handleUnregistrationAssertionResult=function(e){var n=this.user.localEnrollments[this.authenticatorType];n.status=t.LocalEnrollmentStatus.Unregistered,this.user.updateEnrollmentRecord(n),e.data&&e.data.update_vaults&&t.vault.MultiCredsVault.updateVaultsProtectingCreds(this.user,e.data.update_vaults,this._uiHandler,this._sdk),r.prototype.handleUnregistrationAssertionResult.call(this,e)},i.prototype.handleAuthenticateAssertionResult=function(t){return this._enrollmentRecordToCommit&&!t.assertion_error_code&&(this._sdk.log(e.LogLevel.Debug,"Pending commit for enrollment; checking rollover status."),t.data&&t.data.rollover&&0==t.data.rollover.code?(this._sdk.log(e.LogLevel.Info,"Updating local enrollment record on authentication result"),this.user.updateEnrollmentRecord(this._enrollmentRecordToCommit)):this._sdk.log(e.LogLevel.Error,"Received a rollover failure response from the server; aboting rollover.")),this._enrollmentRecordToCommit=null,r.prototype.handleAuthenticateAssertionResult.call(this,t)},i.prototype.processLocalAuthenticatorError=function(e){this.performErrorRecoveryForError(e)},i.prototype.localAuthenticatorChallenge=function(){return this._actionDriver._controlFlowProcessor.challenge+this._authenticatorDescription.assertionId},i.prototype.getAuthenticatorEnrollmentConfig=function(){return null},i.prototype.onCancelRun=function(){r.prototype.onCancelRun.call(this),this.lastObtainedKeyPair&&(this.lastObtainedKeyPair=null)},i.prototype.shouldAllowBiometricFallbackButton=function(n){var r=this;if(!n)return!1;var i=this._actionDriver.availableAuthenticatorsForSwitching.filter(function(e){return e!=r._authenticatorDescription});if(this._actionDriver instanceof t.actiondrivers.ActionDriverRegistration||this._actionDriver instanceof t.actiondrivers.ActionDriverAuthentication&&0==i.length)return!1;var o=n,a=o.getFallbackButtonTitle();if(!(a&&a.length>0))return!1;var s=o.getFallbackControlRequestType();switch(null==s&&(s=e.ControlRequestType.SelectMethod),s){case e.ControlRequestType.ChangeMethod:case e.ControlRequestType.SelectMethod:return this._actionDriver.availableAuthenticators.length>1;default:return!0}},i}(n.AuthenticationDriver),n.AuthenticationDriverLocal=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.instanceOfAuthenticationDriverSilentRegistrationSupport=function(e){return e.runSilentRegistration}}(e.authenticationdrivers||(e.authenticationdrivers={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i=function(i){function o(e,t,n){return i.call(this,e,t,n)||this}return __extends(o,i),o.authenticatorKeyTagForUser=function(e,t,i){return new n.TarsusKeyPath("per_user",e.guid.toString(),"local_auth_keys",r.AuthenticationDriverDescriptorDeviceStrongAuthentication.authenticatorName,t,i)},o.prototype.runSilentRegistration=function(){var e=this;return this.generateAuthenticatorKey().then(function(n){var i=e.getNewOrUpdatedEnrollmentRecord(n),o={public_key:n.key.publicKeyToJson(),encrypted_challenge_mode:!0,version:n.schemeVersion};return e._actionDriver.sendAuthenticatorAssertionRequest(e._authenticatorDescription,"register",null,o).then(function(n){if(n.assertion_error_code)throw t.impl.AuthenticationErrorImpl.errorForAssertionResponse(n);return e.user.updateEnrollmentRecord(i),new r.AuthenticationDriverSessionResultAuthenticationCompleted(n)})})},o.prototype.createAuthenticatorSession=function(){return this._sdk.log(t.LogLevel.Debug,"Create DSA session."),this._uiHandler.createDeviceStrongAuthenticatorAuthSession(r.AuthenticationDriverDescriptorDeviceStrongAuthentication.authenticatorName,this.user.displayName)},o.prototype.authenticateInStartedSession=function(e){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},o.prototype.registerInStartedSession=function(e){var n=this;this._sdk.log(t.LogLevel.Debug,"Register DSA in started session."),i.prototype.registerInStartedSession.call(this,e),this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},Object.defineProperty(o.prototype,"authenticatorType",{get:function(){return r.AuthenticationDriverDescriptorDeviceStrongAuthentication.authenticatorName},enumerable:!0,configurable:!0}),o.prototype.processLocalAuthenticatorError=function(r){var i=this,o=r,a=0,s=Promise.resolve();if(o.getErrorCode()==t.AuthenticationErrorCode.Internal&&o.getData()){var c=o.getData();a=c[e.sdkhost.ErrorDataNumFailures]||0,o=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(c,"Biometrics")||o,(c[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricInvalidated||c[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricNotConfigured&&this._authenticatorDescription.getRegistered())&&(this._sdk.log(t.LogLevel.Debug,"Biometric invalidated "+c[e.sdkhost.ErrorDataInternalError]),s=n.LocalEnrollment.invalidateLocalRegistrationStatusAndNotifyUIHandler(this._actionDriver._controlFlowProcessor,this._authenticatorDescription))}s.catch(function(e){i._sdk.log(t.LogLevel.Error,e)}),s.finally(function(){if(o.getData(),o.getErrorCode()==t.AuthenticationErrorCode.UserCanceled)return i._sdk.log(t.LogLevel.Debug,"Device strong authenticator captured user cancel error code."),void i.invokeUiHandlerCancellation();a&&i._operationMode==t.AuthenticatorSessionMode.Authentication?i.processAuthFailureAssertionAndHandleError(o,a):i.performErrorRecoveryForError(o)})},o.prototype.getKeyForEnrollmentDataAndInput=function(n,r){var i=this;return new Promise(function(o,a){var s=r,c=i.authenticatorKeyTagForScheme(n.version,n.salt),u=i._sdk.host.getKeyPair(c,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);if(!u){var l={};throw l[e.sdkhost.ErrorDataInternalError]=e.sdkhost.InternalErrorBiometricInvalidated,new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to authenticate with invalidated  biometrics.",l)}u.setBiometricPromptInfo(s.getPrompt(),null,i._uiHandler,i._inputSession),o({key:u})})},o.prototype.generatePendingEnrollment=function(e){var t=this;return this.generateAuthenticatorKey().then(function(n){var r=e;return n.key.setBiometricPromptInfo(r?r.getPrompt():null,null,t._uiHandler,t._inputSession),n})},o.prototype.generateAuthenticatorKey=function(){var n;n=this._sdk.host.generateRandomHexString(24);var r=(e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,this.authenticatorKeyTagForScheme("v1",n));return t.util.wrapPromiseWithActivityIndicator(this._uiHandler,this._actionDriver.policyAction(),this._clientContext,this._sdk.host.generateKeyPair(r,e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb,!0).then(function(e){return{key:e,salt:n,schemeVersion:"v1"}},function(e){if(e.getErrorCode()==t.AuthenticationErrorCode.Internal&&e.getData()){var n=e.getData(),r=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(n,"Biometrics");if(r)throw r}throw e}))},o.prototype.calculateAssertionFieldsWithAuthenticatorKey=function(e){var n=this._authenticatorConfig;if(this.operationMode==t.AuthenticatorSessionMode.Registration)return Promise.resolve({data:{encrypted_challenge_mode:!0}});var r=n&&n.encrypted_challenge;return r?new Promise(function(n,i){var o=t.util.base64ToHex(r);e.decrypt(o).then(function(e){return{fch:t.util.hexToBase64(e)}}).then(n,i)}):Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Invalid server response for decrypt-mode authenticator. Missing encrypted challenge."))},o.prototype.authenticatorKeyTagForScheme=function(e,t){return o.authenticatorKeyTagForUser(this.user,e,t)},o}(r.AuthenticationDriverLocal),r.AuthenticationDriverDeviceStrongAuthentication=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.authenticationdrivers||(t.authenticationdrivers={}),r=function(n){function r(e,t,r){return n.call(this,e,t,r)||this}return __extends(r,n),r.prototype.getMaxStep=function(){return-1},r.prototype.authenticateInStartedSession=function(e){e||this.initializeFirstStep(),this.pumpStep()},r.prototype.registerInStartedSession=function(e){e||this.initializeFirstStep(),this.pumpStep()},r.prototype.pumpStep=function(){var t=this,n=this._inputSession;n.setInputStep(this._currentStepIndex,this.getMaxStep(),this._currentStep),n.promiseInput().then(function(e){return t.handleInputOrControlResponse(e)},function(n){return t.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(n))})},r.prototype.handleAuthenticateAssertionResult=function(e){return!!this.handleStepManagementAssertionResult(e)||n.prototype.handleAuthenticateAssertionResult.call(this,e)},r.prototype.handleRegisterAssertionResult=function(e){return!!this.handleStepManagementAssertionResult(e)||n.prototype.handleRegisterAssertionResult.call(this,e)},r.prototype.handleStepManagementAssertionResult=function(e){if(e.assertion_error_code==t.Protocol.AssertionErrorCode.NotFinished)return(n=this.prepareNextAuthenticationStep(e))!=this._currentStep&&(this._currentStep=n,this._currentStepIndex++),this.pumpStep(),!0;if(e.assertion_error_code==t.Protocol.AssertionErrorCode.RepeatCurrentStep){var n=this.updateCurrentAuthenticationStep(e,this._currentStep);return this.pumpStep(),!0}return!1},r.prototype.initializeFirstStep=function(){this._currentStep=this.createInitialInputStep(),this._currentStepIndex=0},r}(n.AuthenticationDriver),n.AuthenticationDriverMultiStep=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),n.prototype.createAuthenticatorSession=function(){return this._uiHandler.createFaceAuthSession("face",this.user.displayName)},n.prototype.createInitialInputStep=function(){var t=this._authenticatorConfig;return new e.impl.CameraAcquisitionStepDescriptionImpl(t.acquisition_challenges)},n.prototype.prepareNextAuthenticationStep=function(e){return this.createInitialInputStep()},n.prototype.updateCurrentAuthenticationStep=function(e,t){return t},n.prototype.handleAuthenticationInputResponse=function(e){var t=e;this.processAuthenticateAssertion(t.getAcquisitionResponse())},n.prototype.handleRegistrationInputResponse=function(e){var t=e;this.processRegisterAssertion(t.getAcquisitionResponse())},n}(t.AuthenticationDriverMultiStep);t.AuthenticationDriverFace=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(r){var i=function(){function e(e,t,n,r,i,o){this._uiHandler=n,this._clientContext=r,this._actionContext=i,this._fidoRequest=o,this._user=t,this._sdk=e}return e.prototype.startSession=function(e,t,n,r){this._authDescription=e},e.prototype.changeSessionModeToRegistrationAfterExpiration=function(){throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Can't change FIDO asession mode from authentication to registration.")},e.prototype.promiseRecoveryForError=function(e,n,r){return Promise.resolve(t.AuthenticationErrorRecovery.Fail)},e.prototype.promiseInput=function(){var e=this;return this.fidoClientXact().then(function(e){return t.InputOrControlResponse.createInputResponse(t.FidoInputResponse.createSuccessResponse(e))},function(n){var r=t.impl.AuthenticationErrorImpl.ensureAuthenticationError(n);return e._sdk.log(t.LogLevel.Debug,"Received FIDO error response from client: "+r),r.getErrorCode()==t.AuthenticationErrorCode.UserCanceled?t.InputOrControlResponse.createControlResponse(t.impl.ControlRequestImpl.create(t.ControlRequestType.CancelAuthenticator)):t.InputOrControlResponse.createInputResponse(t.FidoInputResponse.createdFailedResponse(e._authDescription,r))})},e.prototype.completeSuccessfulAuthenticatorSession=function(){return this.fidoClientSendCompletion({},1200)},e.prototype.endSession=function(){},e}(),o=function(e){function t(t,n,r,i,o,a){return e.call(this,t,n,r,i,o,a)||this}return __extends(t,e),t.prototype.fidoClientXact=function(){return this._sdk.host.fidoClientXact(this._uiHandler,this._clientContext,this._actionContext,this._fidoRequest)},t.prototype.fidoClientSendCompletion=function(e,t){var n={__completion:{responseCode:t,message:e}};return this._sdk.host.fidoClientXact(this._uiHandler,this._clientContext,this._actionContext,n).then(function(e){return!0})},t}(i),a=function(){function r(){}return r.prototype.createSession=function(e,t,n,r,i,a){return new o(e,t,n,r,i,a)},r.prototype.canHandlePolicy=function(e,t){return!n.fidoclient.TarsusFidoClient.isPolicyTransmitFidoClientExclusive(t)&&!!this.checkPlatformClientIsPresent(e)},r.prototype.getAvailableAuthenticatorsIds=function(e){var n=this;return new Promise(function(r,i){if(!n.checkPlatformClientIsPresent(e))return e.log(t.LogLevel.Debug,"No platform FIDO client, therefore no available platform FIDO authenticators"),r();var o=null;if(e.currentSession){var a=e.currentSession.getCurrentControlFlowProcessor();a&&(o=a._clientContext)}n.requestFidoClientDiscovery(e,e.currentUiHandler,o,n.getPolicyAction()).then(function(e){for(var t=e.availableAuthenticators,n=new Array,i=0,o=t;i<o.length;i++){var a=o[i];n.push(a.aaid)}r(n)},function(n){e.log(t.LogLevel.Debug,"Received FIDO discovery error response from client: "+n),i(n)})})},r.prototype.checkPlatformClientIsPresent=function(n){return null==this._hasPlatformClient&&(this._hasPlatformClient="true"===n.host.queryHostInfo(e.sdkhost.HostInformationKey.FidoClientPresent),this._hasPlatformClient||n.log(t.LogLevel.Info,"No platform FIDO client.")),this._hasPlatformClient},r.prototype.getPolicyAction=function(){var e=new Object;return e.type="",e.assertion_id="",new t.impl.PolicyActionImpl(e)},r.prototype.requestFidoClientDiscovery=function(e,t,n,r){return e.host.fidoClientXact(t,n,r,{discovery:!0})},r}(),s=function(e){function t(t,n,r,i,o,a){return e.call(this,t,n,r,i,o,a)||this}return __extends(t,e),t.prototype.fidoClientXact=function(){return this._sdk.fidoClient.fidoClientXact(this._authDescription,this._uiHandler,this._user,this._clientContext,this._actionContext,this._fidoRequest)},t.prototype.fidoClientSendCompletion=function(e,t){return Promise.resolve(!0)},t}(i),c=function(){function e(){}return e.prototype.createSession=function(e,t,n,r,i,o){return new s(e,t,n,r,i,o)},e.prototype.canHandlePolicy=function(e,t){return e.fidoClient.canHandlePolicy(t)},e.prototype.getAvailableAuthenticatorsIds=function(e){return new Promise(function(e,t){var r=new Array;Object.keys(n.fidoclient.FidoAuthenticators).forEach(function(e){r.push(e)}),e(r)})},e}();r._fidoClientProviders=[new c,new a];var u=function(e){function i(t,n,r){return e.call(this,t,n,r)||this}return __extends(i,e),i.getEligibleClientProvidersForPolicy=function(e,t){return r._fidoClientProviders.filter(function(n){return n.canHandlePolicy(e,t)})},i.hasEligibleClientProvidersForPolicy=function(e,t){return this.getEligibleClientProvidersForPolicy(e,t).length>0},i.prototype.runUnregistration=function(){var n=this;return e.prototype.runUnregistration.call(this).finally(function(){var e=n._authenticatorConfig;new Promise(function(r,o){var a=e.fido_policy;if(a.rejected||!a.accepted||1!=a.accepted.length)throw"Invalid fido policy (class 1)";if(1!=a.accepted[0].length||1!=Object.keys(a.accepted[0][0]).length||!a.accepted[0][0].aaid||1!=a.accepted[0][0].aaid.length)throw"Invalid fido policy (class 2)";var s=a.accepted[0][0].aaid[0];n._sdk.log(t.LogLevel.Debug,"Will unregister AAID "+s+".");var c=i.getEligibleClientProvidersForPolicy(n._sdk,e.fido_policy);if(0==c.length)n._sdk.log(t.LogLevel.Warning,"Can't find FIDO client for unregister op: "+JSON.stringify(e.fido_policy)+"."),r();else{var u=e.fido_request;u.header.appID=e.fido_appid;var l=c[0].createSession(n._sdk,n.user,n._uiHandler,n._clientContext,n._actionDriver.policyAction(),u);l.startSession(n._authenticatorDescription,t.AuthenticatorSessionMode.Registration,n._actionDriver.policyAction(),n._clientContext),l.promiseInput().then(function(e){if(e.isControlRequest())throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorError,"Unexpected control response from FIDO client during unregistration.");var n=e.getResponse();if(n instanceof t.FidoAuthFailureResponse)throw n.getFailureError();return e}).finally(function(){l.endSession()}).then(r,o)}}).then(function(){n._sdk.log(t.LogLevel.Info,"FIDO authenticator unregistered: "+JSON.stringify(e.fido_policy)+".")},function(e){var r=t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e);n._sdk.log(t.LogLevel.Error,"Error during FIDO unregistration: "+r+".")})})},i.prototype.completeAuthenticatorSessionWithResult=function(n){var i=this;n instanceof r.AuthenticationDriverSessionResultAuthenticationCompleted?this._inputSession.completeSuccessfulAuthenticatorSession().then(function(t){e.prototype.completeAuthenticatorSessionWithResult.call(i,n)},function(n){e.prototype.completeAuthenticatorSessionWithError.call(i,t.impl.AuthenticationErrorImpl.ensureAuthenticationError(n))}):e.prototype.completeAuthenticatorSessionWithResult.call(this,n)},i.prototype.createAuthenticatorSession=function(){var e=this._authenticatorConfig,n=i.getEligibleClientProvidersForPolicy(this._sdk,e.fido_policy);if(e.fido_request.header.appID=e.fido_appid,n.length>0)return n[0].createSession(this._sdk,this.user,this._uiHandler,this._clientContext,this._actionDriver.policyAction(),e.fido_request);throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorExternalConfigError,"Can't find FIDO client to handle FIDO request.",{fidoRequest:e.fido_request})},i.prototype.authenticateInStartedSession=function(e){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},i.prototype.registerInStartedSession=function(e){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},i.prototype.handleAuthenticationInputResponse=function(e){e instanceof t.FidoAuthSuccessResponse?this.handleFidoSuccessAuthResponse(e):this.handleFidoError(e)},i.prototype.handleFidoSuccessAuthResponse=function(e){this.processAuthenticateAssertion({fido_response:e.getFidoResponse()})},i.prototype.handleFidoError=function(e){e instanceof t.FidoAuthFailureResponse?(this._sdk.log(t.LogLevel.Debug,"FIDO session received FidoAuthFailureResponse."),this.handleFidoFailureResponse(e)):(this._sdk.log(t.LogLevel.Error,"FIDO session received unknkown response type."),this.performErrorRecoveryForError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"FIDO session received unknkown response type.")))},i.prototype.handleFidoFailureResponse=function(e){var r={status:e.getRegistrationStatus()==t.AuthenticatorRegistrationStatus.Registered?n.Protocol.AuthenticationMethodStatus.Registered:n.Protocol.AuthenticationMethodStatus.Unregistered,expired:e.getExpired(),locked:e.getLocked(),last_used:0};this._authenticatorDescription.updateWithAuthenticatorState(r),this.performErrorRecoveryForError(e.getFailureError())},i.prototype.handleFidoSuccessRegResponse=function(e){this.processRegisterAssertion({fido_response:e.getFidoResponse()})},i.prototype.handleRegistrationInputResponse=function(e){e instanceof t.FidoAuthSuccessResponse?this.handleFidoSuccessRegResponse(e):this.handleFidoError(e)},i.prototype.defaultRecoveryForError=function(e){return this._operationMode==t.AuthenticatorSessionMode.Authentication?t.AuthenticationErrorRecovery.ChangeAuthenticator:t.AuthenticationErrorRecovery.Fail},i}(r.AuthenticationDriver);r.AuthenticationDriverFido=u}((n=t.core||(t.core={})).authenticationdrivers||(n.authenticationdrivers={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){var n,r;n=t.sdk||(t.sdk={}),function(r){var i=function(){function r(e,t,n,r,i,o){this.cancellationDOMErrorNames=["NotAllowedError","AbortError"],this.sdk=e,this.username=t,this.uiHandler=n,this.clientContext=r,this.actionContext=i,this.config=o}return r.prototype.startSession=function(e,t,n,r){this.description=e,this.mode=t,this.actionContext=n,this.clientContext=r},r.prototype.changeSessionModeToRegistrationAfterExpiration=function(){this.mode=e.ts.mobile.sdk.AuthenticatorSessionMode.Registration},r.prototype.promiseRecoveryForError=function(e,t,r){return Promise.resolve(n.AuthenticationErrorRecovery.Fail)},r.prototype.promiseInput=function(){var r,i,o=this;return this.mode===e.ts.mobile.sdk.AuthenticatorSessionMode.Authentication?(r=this.config.credentialRequestOptions,i=t.sdkhost.Fido2CredentialsOpType.Get):(r=this.config.credentialCreationOptions,i=t.sdkhost.Fido2CredentialsOpType.Create),this.sdk.host.fido2CredentialsOp(this.uiHandler,this.clientContext,this.actionContext,i,r).then(function(e){return n.InputOrControlResponse.createInputResponse(n.Fido2InputResponse.createSuccessResponse(e))}).catch(function(t){var r=e.ts.mobile.sdk.impl.AuthenticationErrorImpl.ensureAuthenticationError(t);return r.getErrorCode()===n.AuthenticationErrorCode.UserCanceled?(o.sdk.log(n.LogLevel.Debug,"Received FIDO2 cancellation request."),n.InputOrControlResponse.createControlResponse(n.ControlRequest.create(n.ControlRequestType.CancelAuthenticator))):(o.sdk.log(n.LogLevel.Debug,"Received FIDO2 error response from client: "+r),n.InputOrControlResponse.createInputResponse(n.Fido2InputResponse.createdFailedResponse(r)))})},r.prototype.endSession=function(){},r}();r.Fido2AuthenticatorSession=i;var o=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return __extends(r,e),r.prototype.createAuthenticatorSession=function(){if("true"===this._sdk.host.queryHostInfo(t.sdkhost.HostInformationKey.Fido2ClientPresent))return new i(this._sdk,this.user.displayName,this._uiHandler,this._clientContext,this._actionDriver.policyAction(),this._authenticatorConfig);throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.AuthenticatorExternalConfigError,"Can't find FIDO2 client to handle FIDO2 authentication.")},r.prototype.authenticateInStartedSession=function(e){var t=this;this._inputSession.promiseInput().then(function(e){return t.handleInputOrControlResponse(e)},function(e){return t.completeAuthenticatorSessionWithError(n.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.handleAuthenticationInputResponse=function(e){if(e instanceof n.Fido2AuthenticatorSuccessResponse){this._sdk.log(n.LogLevel.Debug,"Fido2 received Fido2AuthenticatorSuccessResponse.");var t=e.getFido2Response();this.processAuthenticateAssertion({assertion_credential:{id:t.id,rawId:t.rawId,response:{authenticatorData:t.response.authenticatorData,clientDataJSON:t.response.clientDataJSON,signature:t.response.signature,userHandle:t.response.userHandle},type:t.type}})}else e instanceof n.Fido2AuthenticationFailedResponse?(this._sdk.log(n.LogLevel.Debug,"Fido2 received Fido2AuthenticationFailedResponse."),this.handleFido2FailureResponse(e)):(this._sdk.log(n.LogLevel.Error,"Fido2 received unknkown response type."),this.performErrorRecoveryForError(new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.AppImplementation,"Fido2 received unknkown response type.")))},r.prototype.registerInStartedSession=function(e){var t=this;this._inputSession.promiseInput().then(function(e){return t.handleInputOrControlResponse(e)},function(e){return t.completeAuthenticatorSessionWithError(n.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.handleRegistrationInputResponse=function(e){if(e instanceof n.Fido2AuthenticatorSuccessResponse){this._sdk.log(n.LogLevel.Debug,"Fido2 received Fido2AuthenticatorSuccessResponse.");var t=e.getFido2Response();this.processRegisterAssertion({attestation_credential:{id:t.id,rawId:t.rawId,response:{attestationObject:t.response.attestationObject,clientDataJSON:t.response.clientDataJSON},type:t.type}})}else e instanceof n.Fido2AuthenticationFailedResponse?(this._sdk.log(n.LogLevel.Debug,"Fido2 received Fido2AuthenticationFailedResponse."),this.handleFido2FailureResponse(e)):(this._sdk.log(n.LogLevel.Error,"Fido2 received unknkown response type."),this.performErrorRecoveryForError(new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.AppImplementation,"Fido2 received unknkown response type.")))},r.prototype.handleFido2FailureResponse=function(e){this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"auth_failure",{num_of_failures:1}),this.performErrorRecoveryForError(e.getFailureError())},r}(r.AuthenticationDriver);r.AuthenticationDriverFido2=o}((r=n.core||(n.core={})).authenticationdrivers||(r.authenticationdrivers={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i,o;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i="v3",o=function(o){function a(e,t,n){return o.call(this,e,t,n)||this}return __extends(a,o),a.prototype.getBiometricPromptFallbackControlType=function(){return null!=this._biometricPromptFallbackControlType?this._biometricPromptFallbackControlType:t.ControlRequestType.SelectMethod},a.authenticatorKeyTagForUser=function(e,t,i){return new n.TarsusKeyPath("per_user",e.guid.toString(),"local_auth_keys",r.AuthenticationDriverDescriptorFingerprint.authenticatorName,t,i)},a.prototype.shouldAllowBiometricFallbackButton=function(e){var r=this;if(!e)return!1;var i=this._actionDriver.availableAuthenticatorsForSwitching.filter(function(e){return e!=r._authenticatorDescription});if(this._actionDriver instanceof n.actiondrivers.ActionDriverRegistration||this._actionDriver instanceof n.actiondrivers.ActionDriverAuthentication&&0==i.length)return!1;var o=e,a=o.getFallbackButtonTitle();if(!(a&&a.length>0))return!1;var s=o.getFallbackControlRequestType();switch(null==s&&(s=t.ControlRequestType.SelectMethod),s){case t.ControlRequestType.ChangeMethod:return this._actionDriver.availableAuthenticatorsForSwitching.filter(function(e){return e!=r._authenticatorDescription}).length>0;case t.ControlRequestType.SelectMethod:return this._actionDriver.availableAuthenticatorsForSwitching.length>0;default:return!0}},a.prototype.runSilentRegistration=function(){var e=this;return this.generateAuthenticatorKey().then(function(n){var i=e.getNewOrUpdatedEnrollmentRecord(n),o={public_key:n.key.publicKeyToJson(),version:n.schemeVersion};return e._actionDriver.sendAuthenticatorAssertionRequest(e._authenticatorDescription,"register",null,o).then(function(n){if(n.assertion_error_code)throw t.impl.AuthenticationErrorImpl.errorForAssertionResponse(n);return e.user.updateEnrollmentRecord(i),new r.AuthenticationDriverSessionResultAuthenticationCompleted(n)})})},a.prototype.createAuthenticatorSession=function(){return this._uiHandler.createFingerprintAuthSession(r.AuthenticationDriverDescriptorFingerprint.authenticatorName,this.user.displayName)},a.prototype.authenticateInStartedSession=function(e){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},a.prototype.registerInStartedSession=function(e){var n=this;o.prototype.registerInStartedSession.call(this,e),this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},Object.defineProperty(a.prototype,"authenticatorType",{get:function(){return r.AuthenticationDriverDescriptorFingerprint.authenticatorName},enumerable:!0,configurable:!0}),a.prototype.processLocalAuthenticatorError=function(r){var i=this,o=r,a=0,s=Promise.resolve();if(o.getErrorCode()==t.AuthenticationErrorCode.Internal&&o.getData()){var c=o.getData();a=c[e.sdkhost.ErrorDataNumFailures]||a,o=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(c,"Fingerprint")||o,(c[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricNotConfigured&&this._authenticatorDescription.getRegistered()||c[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricInvalidated)&&(s=n.LocalEnrollment.invalidateLocalRegistrationStatusAndNotifyUIHandler(this._actionDriver._controlFlowProcessor,this._authenticatorDescription))}s.catch(function(e){i._sdk.log(t.LogLevel.Error,e)}),s.finally(function(){var n=o.getData();return a&&i._operationMode==t.AuthenticatorSessionMode.Authentication?void i.processAuthFailureAssertionAndHandleError(o,a):n[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricFallbackPressed?(i._sdk.log(t.LogLevel.Debug,"Biometric prompt fallback button pressed"),void i.processControlRequest(t.ControlRequest.create(i.getBiometricPromptFallbackControlType()))):o.getErrorCode()==t.AuthenticationErrorCode.UserCanceled?(i._sdk.log(t.LogLevel.Debug,"Fingerprint authenticator captured user cancel error code."),void i.invokeUiHandlerCancellation()):void i.performErrorRecoveryForError(o)})},a.prototype.getKeyForEnrollmentDataAndInput=function(n,r){var o=this;return new Promise(function(a,s){var c=r,u=o.shouldAllowBiometricFallbackButton(c);u&&(o._biometricPromptFallbackControlType=c.getFallbackControlRequestType());var l=o.authenticatorKeyTagForScheme(n.version,n.salt),d=o._sdk.host.getKeyPair(l,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);if(!d){var h={};throw h[e.sdkhost.ErrorDataInternalError]=e.sdkhost.InternalErrorBiometricInvalidated,new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to authenticate with invalidated Fingerprint.",h)}d.setBiometricPromptInfo(c.getPrompt(),u?c.getFallbackButtonTitle():null,o._uiHandler,o._inputSession);var p={key:d};"v0"==n.version||"v1"==n.version||"v2"==n.version&&"true"!=o._sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.StdSigningKeyIsHardwareProtectedSignAndEncryptKey)?(o._sdk.log(t.LogLevel.Info,"Fingerprint: Key rollover from "+n.version+" to "+i),o.generateAuthenticatorKey().then(function(e){return p.rolloverKeyData=e,p.rolloverReason="Upgrading fingerprint authenticator scheme from "+n.version+" to "+i,p}).then(a,s)):a(p)})},a.prototype.generatePendingEnrollment=function(e){var t=this;return this.generateAuthenticatorKey().then(function(n){var r=e,i=t.shouldAllowBiometricFallbackButton(r);return i&&(t._biometricPromptFallbackControlType=r.getFallbackControlRequestType()),n.key.setBiometricPromptInfo(r?r.getPrompt():null,i?r.getFallbackButtonTitle():null,t._uiHandler,t._inputSession),n})},a.prototype.generateAuthenticatorKey=function(){var n;n=this._sdk.host.generateRandomHexString(24);var r=(e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,this.authenticatorKeyTagForScheme(i,n));return t.util.wrapPromiseWithActivityIndicator(this._uiHandler,this._actionDriver.policyAction(),this._clientContext,this._sdk.host.generateKeyPair(r,e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb,!0).then(function(e){return{key:e,salt:n,schemeVersion:i}},function(e){if(e.getErrorCode()==t.AuthenticationErrorCode.Internal&&e.getData()){var n=e.getData(),r=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(n,"Fingerprint");if(r)throw r}throw e}))},a.prototype.authenticatorKeyTagForScheme=function(e,t){return a.authenticatorKeyTagForUser(this.user,e,t)},a}(r.AuthenticationDriverLocal),r.AuthenticationDriverFingerprint=o}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){function t(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}function n(e){var t,n="";for(t=0;t<e.length;t++){var r=e[t];if(r<128)n+=String.fromCharCode(r);else if(r>191&&r<224)n+=String.fromCharCode((31&r)<<6|63&e[t+1]),t+=1;else if(r>223&&r<240)n+=String.fromCharCode((15&r)<<12|(63&e[t+1])<<6|63&e[t+2]),t+=2;else{var i=((7&r)<<18|(63&e[t+1])<<12|(63&e[t+2])<<6|63&e[t+3])-65536;n+=String.fromCharCode(i>>10|55296,1023&i|56320),t+=3}}return n}function r(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n).toString(16);r.length<2&&(r="0"+r),t+=r}return t}e.numberToHex=function(e,t){var n=e.toString(16);if(n.length>t/4)throw"Number out of range for bitcount.";for(;n.length<t/4;)n="0"+n;return n},e.toUTF8Array=t,e.fromUTF8Array=n,e.hexToAscii=function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(parseInt(e.substr(r,2),16));return n(t)},e.asciiToHex=function(e){return t(e).map(function(e){var t=e.toString(16);return t.length<2&&(t="0"+t),t}).join("")},e.base64ToHex=function(e){return r(atob(e))},e.bytesToHex=r,e.hexToBase64=function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,r=0,i="",o=0;o<e.length;o++)n=(n<<4)+parseInt(e[o],16),(r+=4)>=6&&(i+=t[n>>r-6],n&=255>>8-(r-=6));for(r&&(i+=t[n<<6-r]);i.length%4;)i+="=";return i},e.isHexString=function(e){return new RegExp("^([0-9A-Fa-f]{2})+$").test(e)},e.nameof=function(e){return e},e.wrapPromiseWithActivityIndicator=function(e,t,n,r){return e.startActivityIndicator(t,n),r.then(function(r){return e.endActivityIndicator(t,n),r},function(r){return e.endActivityIndicator(t,n),Promise.reject(r)})},e.getOsName=function(e){var t=e;switch(e){case"iPhone":case"iPad":t="iOS"}return t},e.getDeviceModel=function(e,t){var n=e;if("iPhone"==t)switch(e){case"i386":case"x86_64":n="Simulator";break;case"iPod1,1":case"iPod2,1":case"iPod3,1":case"iPod4,1":case"iPod7,1":n="iPod Touch";break;case"iPhone1,1":case"iPhone1,2":case"iPhone2,1":n="iPhone";break;case"iPad1,1":n="iPad";break;case"iPad2,1":n="iPad 2";break;case"iPad3,1":n="iPad";break;case"iPhone3,1":case"iPhone3,3":n="iPhone 4";break;case"iPhone4,1":n="iPhone 4S";break;case"iPhone5,1":case"iPhone5,2":n="iPhone 5";break;case"iPad3,4":n="iPad";break;case"iPad2,5":n="iPad Mini";break;case"iPhone5,3":case"iPhone5,4":n="iPhone 5c";break;case"iPhone6,1":case"iPhone6,2":n="iPhone 5s";break;case"iPhone7,1":n="iPhone 6 Plus";break;case"iPhone7,2":n="iPhone 6";break;case"iPhone8,1":n="iPhone 6S";break;case"iPhone8,2":n="iPhone 6S Plus";break;case"iPhone8,4":n="iPhone SE";break;case"iPhone9,1":case"iPhone9,3":n="iPhone 7";break;case"iPhone9,2":case"iPhone9,4":n="iPhone 7 Plus";break;case"iPhone10,1":case"iPhone10,4":n="iPhone 8";break;case"iPhone10,2":case"iPhone10,5":n="iPhone 8 Plus";break;case"iPhone10,3":case"iPhone10,6":n="iPhone X";break;case"iPad4,1":case"iPad4,2":n="iPad Air";break;case"iPad4,4":case"iPad4,5":case"iPad4,7":n="iPad Mini";break;case"iPad6,7":case"iPad6,8":n='iPad Pro (12.9")';break;case"iPad6,3":case"iPad6,4":n='iPad Pro (9.7")';break;case"iPhone11,2":n="iPhone XS";break;case"iPhone11,6":case"iPhone11,4":n="iPhone XS Max";break;case"iPhone11,8":n="iPhone XR";break;case"iPad6,7":case"iPad6,8":n='iPad Pro (12.9")';break;case"iPad6,11":case"iPad6,12":n="iPad (2017)";break;case"iPad7,1":case"iPad7,2":n="iPad Pro 2nd Gen";break;case"iPad7,3":case"iPad7,4":n='iPad Pro (10.5")';break;case"iPad7,5":case"iPad7,6":n="iPad";break;case"iPad8,1":case"iPad8,2":case"iPad8,3":case"iPad8,4":n='iPad Pro (11")';break;case"iPad8,5":case"iPad8,6":case"iPad8,7":case"iPad8,8":n='iPad Pro (12.9")'}return n};var i=function(){function e(){var t=this;this._cancelPromise=new Promise(function(n,r){t._cancelFn=function(){r(e.CancelRequest)},t._cancelled&&r(e.CancelRequest)})}return Object.defineProperty(e.prototype,"cancellablePromise",{get:function(){return this._cancellablePromise},enumerable:!0,configurable:!0}),e.prototype.resolveWith=function(e){this._cancelled?this._cancellablePromise=this._cancelPromise:(this._underlyingPromise=new Promise(e),this._cancellablePromise=Promise.race([this._cancelPromise,this._underlyingPromise]))},e.prototype.cancel=function(){this._cancelled=!0,this._cancelFn&&this._cancelFn()},e.CancelRequest={},e}();e.CancelablePromiseHolder=i}(e.util||(e.util={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),i.prototype.processLocalAuthenticatorError=function(e){var n=e;e.getErrorCode()==t.AuthenticationErrorCode.InvalidInput&&this._operationMode==t.AuthenticatorSessionMode.Authentication?this.processAuthFailureAssertionAndHandleError(n,1):this.performErrorRecoveryForError(n)},i.prototype.getKeyForEnrollmentDataAndInput=function(e,n){var r=this;return new Promise(function(t,i){"v2"==e.version?r.getKeyForEnrollmentDataAndInputV2(e,n).then(t,i):r.getKeyForEnrollmentDataAndInputPreV2(e,n).then(t,i)}).then(function(i){if(!i)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.InvalidInput,"Invalid input provided to authenticator.");var o={key:i};return"v0"==e.version||"v1"==e.version?(r._sdk.log(t.LogLevel.Info,r.authenticatorType+": Key rollover from "+e.version+" to v2"),r.generatePendingEnrollment(n).then(function(e){return o.rolloverKeyData=e,o.rolloverReason="Upgrading "+r.authenticatorType+" authenticator scheme",o})):o})},i.prototype.generatePendingEnrollment=function(r){var i=this;return new Promise(function(o,a){var s=i._sdk.host.generateRandomHexString(32),c=i._sdk.host.generateRandomHexString(64),u=i.extractPbkdfInputFromInputResponse(r);return t.util.wrapPromiseWithActivityIndicator(i._uiHandler,i._actionDriver.policyAction(),i._clientContext,i._sdk.host.generateHexSeededKeyPairExternalRepresentation(e.sdkhost.KeyClass.FidoECCSigningKey,c).then(function(t){return n.vault.pbkdfStretchHexSecretIntoAESKey(s,u,i._sdk.cryptoSettings.getLocalEnrollmentKeySizeInBytes(),i._sdk.cryptoSettings.getLocalEnrollmentKeyIterationCount(),!0,i._sdk).then(function(n){return n.encrypt(c).then(function(n){return{key:i._sdk.host.importVolatileKeyPair(e.sdkhost.KeyClass.FidoECCSigningKey,t),salt:s,schemeVersion:"v2",keyMeterial:n}})})})).then(o,a)})},i.prototype.getKeyForEnrollmentDataAndInputV2=function(t,r){var i=this,o=this.extractPbkdfInputFromInputResponse(r);return n.vault.pbkdfStretchHexSecretIntoAESKey(t.salt,o,t.cryptoSettings.getLocalEnrollmentKeySizeInBytes(),t.cryptoSettings.getLocalEnrollmentKeyIterationCount(),!0,this._sdk).then(function(n){return n.decrypt(t.keyMaterial,null).then(function(t){return i._sdk.host.generateHexSeededKeyPairExternalRepresentation(e.sdkhost.KeyClass.FidoECCSigningKey,t).then(function(t){return i._sdk.host.importVolatileKeyPair(e.sdkhost.KeyClass.FidoECCSigningKey,t)})})})},i.prototype.getKeyForEnrollmentDataAndInputPreV2=function(t,n){var r=this;return this.authenticatorKeyTagForScheme(t.version,t.salt,t.cryptoSettings,n).then(function(t){return r._sdk.host.getKeyPair(t,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.None)})},i.prototype.authenticatorKeyTagForScheme=function(e,r,i,o){var a=this;return new Promise(function(s,c){var u=a.extractPbkdfInputFromInputResponse(o);if("v0"==e&&(a._sdk.log(t.LogLevel.Debug,"Using SDK CryptoSettings for migrated enrollment."),i=a._sdk.cryptoSettings),!i)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Missing crypt settings for local enrollment.");a._sdk.host.generatePbkdf2HmacSha1HexString(r,u,i.getLocalEnrollmentKeySizeInBytes(),i.getLocalEnrollmentKeyIterationCount()).then(function(r){var i=t.util.hexToBase64(r);return new n.TarsusKeyPath("per_user",a.user.guid.toString(),"local_auth_keys",a.authenticatorType,e,i)}).then(s,c)})},i}(r.AuthenticationDriverLocal),r.AuthenticationDriverLocalSecretInputBased=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),Object.defineProperty(n.prototype,"authenticatorType",{get:function(){return n.authenticatorName},enumerable:!0,configurable:!0}),n.prototype.handleAuthenticationInputResponse=function(n){var r=n;e.impl.PatternInputImpl.validateFormat(r)?t.prototype.handleAuthenticationInputResponse.call(this,n):this.processLocalAuthenticatorError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern description format."))},n.prototype.handleRegistrationInputResponse=function(n){var r=this._authenticatorConfig,i=n;return e.impl.PatternInputImpl.validateFormat(i)?r.min_length&&e.impl.PatternInputImpl.getPatternLength(i)<r.min_length?void this.processLocalAuthenticatorError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern length.")):void t.prototype.handleRegistrationInputResponse.call(this,n):void this.processLocalAuthenticatorError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern description format."))},n.prototype.extractPbkdfInputFromInputResponse=function(t){var n=t;return e.util.asciiToHex(n.getPatternDescription())},n.prototype.createAuthenticatorSession=function(){return this._uiHandler.createPatternAuthSession(n.authenticatorName,this.user.displayName,3,4)},n.prototype.authenticateInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.prototype.registerInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.authenticatorName="pattern",n}(t.AuthenticationDriverLocalSecretInputBased);t.AuthenticationDriverLocalPattern=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),Object.defineProperty(n.prototype,"authenticatorType",{get:function(){return n.authenticatorName},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"pinLength",{get:function(){return this._authenticatorConfig.length},enumerable:!0,configurable:!0}),n.prototype.handleRegistrationInputResponse=function(n){n.getPin().length!=this.pinLength?this.processLocalAuthenticatorError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,"Expecting an entry of length "+this.pinLength+".")):t.prototype.handleRegistrationInputResponse.call(this,n)},n.prototype.generatePendingEnrollment=function(e){var n=this;return t.prototype.generatePendingEnrollment.call(this,e).then(function(e){var t={length:n.pinLength};return e.authenticatorConfig=t,e})},n.prototype.extractPbkdfInputFromInputResponse=function(t){var n=t;return e.util.asciiToHex(n.getPin())},n.prototype.createAuthenticatorSession=function(){return this._uiHandler.createPinAuthSession(n.authenticatorName,this.user.displayName,this.pinLength)},n.prototype.authenticateInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.prototype.registerInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.authenticatorName="pin",n}(t.AuthenticationDriverLocalSecretInputBased);t.AuthenticationDriverLocalPinCode=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(e,t,r){return n.call(this,e,t,r)||this}return __extends(r,n),r.prototype.poll=function(){var n=this;this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"authenticate",this.pollingAssertionData(),{}).then(function(r){n.filterAssertionResult(r)&&n.shouldContinuePolling(r)?n.pumpInput():n.handleAuthenticateAssertionResult(r)||(n._sdk.log(e.LogLevel.Info,"Authenticator session done."),n.completeAuthenticatorSessionWithResult(new t.AuthenticationDriverSessionResultAuthenticationCompleted(r)))}).catch(function(t){n.performErrorRecoveryForError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},r}(t.AuthenticationDriver);t.AuthenticationDriverPolling=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n,r,i;n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i=function(i){function o(e,t,n){var r=i.call(this,e,t,n)||this;return r.methodName="mobileApprove",r.setupDataModel(t,n),r}return __extends(o,i),o.prototype.createAuthenticatorSession=function(){var r=this._uiHandler.createMobileApproveAuthSession("mobile_approve",this.user.displayName,this._instructions);if(!r)throw t.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createMobileApproveAuthSession");if(r.setAvailableTargets(this._selectableDevices),this._state==n.Protocol.AuthenticationMethodMobileApproveState.WaitForAuthenticate){this._selectedDevices=this._selectableDevices.map(function(e){return e});var i=null;if(this._otp){var o=t.OtpFormatImpl.fromAssertionFormat(this._otp.format);i=e.ts.mobile.sdk.impl.MobileApproveOtpImpl.create(this._otp.value,o)}r.setCreatedApprovalInfo(this._selectedDevices,i)}if(this._authenticationParameters){var a=this._authenticationParameters.filter(function(e){t.AuthenticationActionParameterTargetSelection});if(0!=a.length){this._sdk.log(t.LogLevel.Debug,"Target based driver found target selection parameters.");var s=this._selectableDevices.reduce(function(e,t){return e[t.getDeviceIdentifier()]=t,e},{});this._pendingTargetSelection=a.map(function(e){var n=e.getTarget(),r=s[n.getDeviceIdentifier()];if(!r)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Authentication parameter tried to select a device not presented as a selectable target");return r},{}),this._sdk.log(t.LogLevel.Debug,"Target based driver will select targets "+this._pendingTargetSelection+" based on selection parameter.")}}return r},o.prototype.authenticateInStartedSession=function(e){this._autoExecuted?this._autoExecuted=!1:this.reset(),this.pumpInput()},o.prototype.pumpInput=function(){if(this._state===n.Protocol.AuthenticationMethodMobileApproveState.WaitForApproval)this.createApproval();else{if(this._state!==n.Protocol.AuthenticationMethodMobileApproveState.WaitForAuthenticate)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Illegal authenticator state encountered: "+this._state);this.requestInputAndHandle()}},o.prototype.registerInStartedSession=function(e){throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Cannot register Mobile Approve authenticator.")},o.prototype.createApproval=function(){if(this._approvalId=null,this._pendingTargetSelection&&Object.keys(this._pendingTargetSelection).length){this._sdk.log(t.LogLevel.Debug,"Performing pending target selection "+this._pendingTargetSelection);var e=t.TargetBasedAuthenticatorInput.createTargetsSelectionRequest(this._pendingTargetSelection);this._pendingTargetSelection=null,this.handleAuthenticationInputResponse(e)}else this._strategy.user_selection&&this._selectableDevices&&this._selectableDevices.length?this.requestInputAndHandle():this.handleAuthenticationInputResponse(t.TargetBasedAuthenticatorInput.createTargetsSelectionRequest([]))},o.prototype.requestInputAndHandle=function(){var e=this;this._inputSession.promiseInput().then(function(t){e.handleInputOrControlResponse(t)})},o.prototype.handleAuthenticationInputResponse=function(e){switch(this._state){case n.Protocol.AuthenticationMethodMobileApproveState.WaitForApproval:var r=e.getSelectedTargets();if(r){this.handleTargetSelectionInput(r);break}throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Expected target selection input response but got: "+e);case n.Protocol.AuthenticationMethodMobileApproveState.WaitForAuthenticate:if(e.getAuthenticatorInput()instanceof t.MobileApproveInputRequestPolling){this.poll();break}throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Expected polling request input response but got: "+e);default:throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Illegal state for authenticator: "+this._state)}},o.prototype.handleTargetSelectionInput=function(e){var n=this;this._selectedDevices=e.map(function(e){var r=e;if(n._selectableDevices.indexOf(r)<0)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to select a Mobile Approve target not originally listed in the session.");return r}),this.createForSelectedTargets()},o.prototype.createForSelectedTargets=function(){var n,r=this;n=this._selectedDevices&&this._selectedDevices.length?{device_ids:this._selectedDevices.map(function(e){return e.getDeviceIdentifier()})}:{},this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"approval",n,{}).then(function(n){if(!r.handleGeneralAssertionResult(n))if(n.assertion_error_code)r._sdk.log(t.LogLevel.Error,"Assertion error encoutered. Starting error recovery."),r.performErrorRecoveryForError(t.impl.AuthenticationErrorImpl.errorForAssertionResponse(n));else{var i=null,o=n.data;if(o.otp){var a=t.OtpFormatImpl.fromAssertionFormat(o.otp.format);i=e.ts.mobile.sdk.impl.MobileApproveOtpImpl.create(o.otp.value,a)}r._approvalId=o.approval_id||null,r._state=o.state,r._inputSession.setCreatedApprovalInfo(r._selectedDevices,i),r._sdk.log(t.LogLevel.Debug,"Restarting auth or reg."),r.pumpInput()}}).catch(function(e){r.completeAuthenticatorSessionWithError(e)})},o.prototype.handleRegistrationInputResponse=function(e){throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Cannot register Mobile Approve authenticator.")},o.prototype.processControlRequest=function(e){e.getRequestType()===t.ControlRequestType.RetryAuthenticator&&this.reset(),i.prototype.processControlRequest.call(this,e)},o.prototype.filterAssertionResult=function(e){if(5==e.assertion_error_code)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.ApprovalDenied,"Approval was denied");if(21==e.assertion_error_code)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.ApprovalExpired,"Approval has expired");return!0},o.prototype.shouldContinuePolling=function(e){return 13==e.assertion_error_code},o.prototype.pollingAssertionData=function(){return{approval_id:this._approvalId}},o.prototype.reset=function(){this._state=n.Protocol.AuthenticationMethodMobileApproveState.WaitForApproval,this._approvalId=null,this._selectedDevices=null,this._inputSession.setCreatedApprovalInfo(null,null)},o.prototype.setupDataModel=function(e,t){this._state=e.state,this._otp=e.otp||null,this._strategy=e.strategy,this._selectableDevices=r.AuthenticationDriverDescriptorMobileApprove.createTargetsFromConfig(e),this._instructions=e.instructions,this._approvalId=e.approval_id||null,this._approvalId&&(this._autoExecuted=!0)},o}(r.AuthenticationDriverPolling),r.AuthenticationDriverMobileApprove=i}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i=function(i){function o(e,t,n){return i.call(this,e,t,n)||this}return __extends(o,i),o.prototype.getBiometricPromptFallbackControlType=function(){return null!=this._biometricPromptFallbackControlType?this._biometricPromptFallbackControlType:t.ControlRequestType.SelectMethod},o.authenticatorKeyTagForUser=function(e,t,r){return new n.TarsusKeyPath("per_user",e.guid.toString(),"local_auth_keys","native_face",t,r)},o.prototype.shouldAllowBiometricFallbackButton=function(e){var r=this;if(!e)return!1;var i=this._actionDriver.availableAuthenticatorsForSwitching.filter(function(e){return e!=r._authenticatorDescription});if(this._actionDriver instanceof n.actiondrivers.ActionDriverRegistration||this._actionDriver instanceof n.actiondrivers.ActionDriverAuthentication&&0==i.length)return!1;var o=e,a=o.getFallbackButtonTitle();if(!(a&&a.length>0))return!1;var s=o.getFallbackControlRequestType();switch(null==s&&(s=t.ControlRequestType.SelectMethod),s){case t.ControlRequestType.ChangeMethod:return this._actionDriver.availableAuthenticatorsForSwitching.filter(function(e){return e!=r._authenticatorDescription}).length>0;case t.ControlRequestType.SelectMethod:return this._actionDriver.availableAuthenticatorsForSwitching.length>0;default:return!0}},o.prototype.runSilentRegistration=function(){var e=this;return this.generateFaceNativeKeyForScheme("v2").then(function(n){var i=e.getNewOrUpdatedEnrollmentRecord(n),o={public_key:n.key.publicKeyToJson(),version:n.schemeVersion};return e._actionDriver.sendAuthenticatorAssertionRequest(e._authenticatorDescription,"register",null,o).then(function(n){if(n.assertion_error_code)throw t.impl.AuthenticationErrorImpl.errorForAssertionResponse(n);return e.user.updateEnrollmentRecord(i),new r.AuthenticationDriverSessionResultAuthenticationCompleted(n)})})},o.prototype.createAuthenticatorSession=function(){return this._uiHandler.createNativeFaceAuthSession(r.AuthenticationDriverDescriptorNativeFace.authenticatorName,this.user.displayName)},o.prototype.authenticateInStartedSession=function(e){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},o.prototype.registerInStartedSession=function(e){var n=this;i.prototype.registerInStartedSession.call(this,e),this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},Object.defineProperty(o.prototype,"authenticatorType",{get:function(){return r.AuthenticationDriverDescriptorNativeFace.authenticatorName},enumerable:!0,configurable:!0}),o.prototype.processLocalAuthenticatorError=function(r){var i=this,o=r,a=0,s=Promise.resolve();if(o.getErrorCode()==t.AuthenticationErrorCode.Internal&&o.getData()){var c=o.getData();a=c[e.sdkhost.ErrorDataNumFailures]||a,o=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(c,"Native Face")||o,(c[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricNotConfigured&&this._authenticatorDescription.getRegistered()||c[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricInvalidated)&&(s=n.LocalEnrollment.invalidateLocalRegistrationStatusAndNotifyUIHandler(this._actionDriver._controlFlowProcessor,this._authenticatorDescription))}s.catch(function(e){i._sdk.log(t.LogLevel.Error,e)}),s.finally(function(){var n=o.getData();return a&&i._operationMode==t.AuthenticatorSessionMode.Authentication?void i.processAuthFailureAssertionAndHandleError(o,a):n[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricFallbackPressed?(i._sdk.log(t.LogLevel.Debug,"Biometric prompt fallback button pressed"),void i.processControlRequest(t.ControlRequest.create(i.getBiometricPromptFallbackControlType()))):o.getErrorCode()==t.AuthenticationErrorCode.UserCanceled?(i._sdk.log(t.LogLevel.Debug,"Native face authenticator captured user cancel error code."),void i.invokeUiHandlerCancellation()):void i.performErrorRecoveryForError(o)})},o.prototype.getKeyForEnrollmentDataAndInput=function(n,r){var i=this;return new Promise(function(o,a){var s=r,c=i.shouldAllowBiometricFallbackButton(s);c&&(i._biometricPromptFallbackControlType=s.getFallbackControlRequestType());var u=i.authenticatorKeyTagForScheme(n.version,n.salt),l=i._sdk.host.getKeyPair(u,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);if(!l){var d={};throw d[e.sdkhost.ErrorDataInternalError]=e.sdkhost.InternalErrorBiometricInvalidated,new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to authenticate with invalidated FaceID.",d)}l.setBiometricPromptInfo(s?s.getPrompt():null,c?s.getFallbackButtonTitle():null,i._uiHandler,i._inputSession);var h={key:l};"v0"==n.version||"v1"==n.version?(i._sdk.log(t.LogLevel.Info,"Native face: Key rollover from "+n.version+" to v2"),i.generateKeyForScheme(r,"v2").then(function(e){return h.rolloverKeyData=e,h.rolloverReason="Upgrading native face authenticator scheme from "+n.version+" to v2",h}).then(o,a)):o(h)})},o.prototype.generatePendingEnrollment=function(e){var t=this,n=e,r=this.shouldAllowBiometricFallbackButton(n);return r&&(this._biometricPromptFallbackControlType=n.getFallbackControlRequestType()),this.generateKeyForScheme(e,"v2").then(function(e){return e.key.setBiometricPromptInfo(n.getPrompt(),r?n.getFallbackButtonTitle():null,t._uiHandler,t._inputSession),e})},o.prototype.generateKeyForScheme=function(e,t){return this.generateFaceNativeKeyForScheme(t)},o.prototype.generateFaceNativeKeyForScheme=function(n){var r;r="v1"==n||"v2"==n?this._sdk.host.generateRandomHexString(24):"";var i=this.authenticatorKeyTagForScheme(n,r);return t.util.wrapPromiseWithActivityIndicator(this._uiHandler,this._actionDriver.policyAction(),this._clientContext,this._sdk.host.generateKeyPair(i,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb,!0).then(function(e){return{key:e,salt:r,schemeVersion:n}},function(e){if(e.getErrorCode()==t.AuthenticationErrorCode.Internal&&e.getData()){var n=e.getData(),r=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(n,"Native Face");if(r)throw r}throw e}))},o.prototype.authenticatorKeyTagForScheme=function(e,t){return o.authenticatorKeyTagForUser(this.user,e,t)},o}(r.AuthenticationDriverLocal),r.AuthenticationDriverNativeFace=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.authenticationdrivers||(t.authenticationdrivers={}),r=function(n){function r(e,t,r,i){var o=n.call(this,e,t,i)||this;return o._possibleTargets=r,o.setupDataModel(t),o}return __extends(r,n),r.prototype.getPossibleTargets=function(){return this._possibleTargets},r.prototype.createAuthenticatorSession=function(){var n;if(this._otpInitialState==t.Protocol.AuthenticationMethodOtpState.Validate&&(this._lastSelectedTarget=this._possibleTargets[0]),0!=(n=this._authenticationParameters?this._authenticationParameters.filter(function(t){return t instanceof e.AuthenticationActionParameterTargetSelection}):[]).length){this._sdk.log(e.LogLevel.Debug,"Target based driver found target selection parameters.");var r=n[0].getTarget().getChannelAssertionId(),i=this._possibleTargets.filter(function(e){return e.getChannelAssertionId()==r});i.length?(this._pendingTargetSelection=i[0],this._sdk.log(e.LogLevel.Debug,"Target based driver will select target "+this._pendingTargetSelection+" based on selection parameter."),this._lastSelectedTarget=this._pendingTargetSelection):this._sdk.log(e.LogLevel.Warning,"Target selection parameter for target based auth driver specified invalid target assertiong id "+r+".")}var o=this._uiHandler.createOtpAuthSession("otp",this.user.displayName,this._possibleTargets,this._lastSelectedTarget);if(!o)throw e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createOtpAuthSession");return o.setAvailableTargets(this._possibleTargets),o},r.prototype.authenticateInStartedSession=function(t){var n=this;if(0==this._possibleTargets.length)return this._sdk.log(e.LogLevel.Warning,"No authentication target available for OTP. Doing error recovery."),void this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AuthenticatorExternalConfigError,"No targets available for OTP."),!0);if(this._sdk.log(e.LogLevel.Debug,"Notifying current session of generated OTP format and target"),this._inputSession.setGeneratedOtp(this._format,this._lastSelectedTarget),this._pendingTargetSelection){this._sdk.log(e.LogLevel.Debug,"Performing pending target selection "+this._pendingTargetSelection);var r=e.TargetBasedAuthenticatorInput.createTargetsSelectionRequest([this._pendingTargetSelection]);this._pendingTargetSelection=null,this.handleInputOrControlResponse(e.InputOrControlResponse.createInputResponse(r))}else this._inputSession.promiseInput().then(function(e){n.handleInputOrControlResponse(e)}).catch(function(t){n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},r.prototype.registerInStartedSession=function(t){throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Cannot register OTP authenticator.")},r.prototype.handleTargetBasedAuthenticatorConcreteInput=function(t){if(t instanceof e.OtpInputOtpSubmission)this.processAuthenticateAssertion({otp:t.getOtp()},{assertion_id:this._possibleTargets[0].getChannelAssertionId()});else{if(!(t instanceof e.OtpInputRequestResend))throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Unknown OTP response type received from application callback.");this.triggerForSelectedTarget()}},r.prototype.handleAuthenticateAssertionResult=function(t){return t.data&&t.data.additional_error_code&&1==t.data.additional_error_code&&(this._sdk.log(e.LogLevel.Debug,"Reached max number of attempts - invalidating current target."),this._lastSelectedTarget=null,this._format=null),n.prototype.handleAuthenticateAssertionResult.call(this,t)},r.prototype.handleAuthenticationInputResponse=function(t){if(t.getAuthenticatorInput())this.handleTargetBasedAuthenticatorConcreteInput(t.getAuthenticatorInput());else{if(!t.getSelectedTargets()[0])throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid target-based authetnicator response type received from application callback. Target-based authenticator inputs must be created by calling TargetBasedAuthenticatorInput.createAuthenticatorInput.");var n=t.getSelectedTargets();if(n.length>1)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Attempt to select multiple OTP targets while OTP supports only a single target.");var r=n[0];if(this._possibleTargets.indexOf(r)<0)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Attempt to select an OTP target not originally listed in the session.");this._lastSelectedTarget=r,this.triggerForSelectedTarget()}},r.prototype.triggerForSelectedTarget=function(){var n=this;if(!this._lastSelectedTarget)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to trigger OTP generation without a selected target.");var r={target_id:this._lastSelectedTarget.getTargetIdentifier(),channel_index:this._lastSelectedTarget.getChannelIndex()},i={assertion_id:this._lastSelectedTarget.getChannelAssertionId()};this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"otp",r,i).then(function(r){r.assertion_error_code&&r.assertion_error_code!=t.Protocol.AssertionErrorCode.FailOver&&(n._sdk.log(e.LogLevel.Error,"Assertion error encoutered. Clearing last selected target."),n._lastSelectedTarget=null),n.handleAuthenticateAssertionResult(r)||(r.data&&r.data.otp_format&&(n._sdk.log(e.LogLevel.Debug,"Received updated OTP and format."),n._format=e.OtpFormatImpl.fromAssertionFormat(r.data.otp_format)),n._sdk.log(e.LogLevel.Debug,"Restarting auth or reg."),n.authOrRegInStartedSession(!0))}).catch(function(e){n.completeAuthenticatorSessionWithError(e)})},r.prototype.handleRegistrationInputResponse=function(t){throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Cannot register OTP authenticator.")},r.prototype.setupDataModel=function(t){this._otpInitialState=t.state;var n=t.format||t.otp_format;this._format=n&&e.OtpFormatImpl.fromAssertionFormat(n)||null},r}(n.AuthenticationDriver),n.AuthenticationDriverOtp=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),n.prototype.createAuthenticatorSession=function(){return this._uiHandler.createPasswordAuthSession("password",this.user.displayName)},n.prototype.authenticateInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.prototype.registerInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.prototype.handleAuthenticationInputResponse=function(t){var n=t.getPassword();n&&n.length>0?this.processAuthenticateAssertion({password:n}):this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,"Password can't be empty"))},n.prototype.handleRegistrationInputResponse=function(t){var n=t.getPassword();n&&n.length>0?this.processRegisterAssertion({password:n}):this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,"Password can't be empty"))},n}(t.AuthenticationDriver);t.AuthenticationDriverPassword=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),n.prototype.createAuthenticatorSession=function(){return this._uiHandler.createPatternAuthSession("pattern_centralized",this.user.displayName,3,4)},n.prototype.handleAuthenticationInputResponse=function(n){var r=n;e.impl.PatternInputImpl.validateFormat(r)?t.prototype.handleAuthenticationInputResponse.call(this,n):this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern description format."))},n.prototype.handleRegistrationInputResponse=function(n){var r=n,i=this._authenticatorConfig;return e.impl.PatternInputImpl.validateFormat(r)?i.min_length&&e.impl.PatternInputImpl.getPatternLength(r)<i.min_length?void this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern length.")):void t.prototype.handleRegistrationInputResponse.call(this,n):void this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern description format."))},n.prototype.generateSecretToSignForInputResponse=function(e){return e.getPatternDescription()},n}(t.AuthenticationDriverCentralizedSecretInputBased);t.AuthenticationDriverPattern=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),Object.defineProperty(n.prototype,"pinLength",{get:function(){return this._authenticatorConfig.length},enumerable:!0,configurable:!0}),n.prototype.createAuthenticatorSession=function(){return this._uiHandler.createPinAuthSession("pin_centralized",this.user.displayName,this.pinLength)},n.prototype.handleRegistrationInputResponse=function(n){n.getPin().length==this.pinLength?t.prototype.handleRegistrationInputResponse.call(this,n):this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,"Invalid PIN length provided.",{expected_length:this.pinLength}))},n.prototype.generateSecretToSignForInputResponse=function(e){return e.getPin()},n}(t.AuthenticationDriverCentralizedSecretInputBased);t.AuthenticationDriverPinCode=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),i.prototype.createAuthenticatorSession=function(){var e=this,t=this.generatePlaceholderServerTokenGenerationPayload();return i.placeholderExtensionPoint.firstNonNull(function(n){return n.createPlaceholderAuthSession(e._authenticatorDescription.getPlaceholderId(),e._authenticatorConfig.placeholder_type||"",e._authenticatorDescription.getName()||"",e.user.displayName,e._authenticatorConfig.data||"",t)})||this._uiHandler.createPlaceholderAuthSession(this._authenticatorDescription.getPlaceholderId(),this._authenticatorConfig.placeholder_type||"",this._authenticatorDescription.getName()||"",this.user.displayName,this._authenticatorConfig.data||"",t)},i.prototype.authenticateOrRegisterInStratedSession=function(e){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},i.prototype.authenticateInStartedSession=function(e){this.authenticateOrRegisterInStratedSession(e)},i.prototype.registerInStartedSession=function(e){this.authenticateOrRegisterInStratedSession(e)},i.prototype.handleAuthenticationInputResponse=function(e){this.handleAuthenticationOrRegistrationInputResponse(e)},i.prototype.handleRegistrationInputResponse=function(e){this.handleAuthenticationOrRegistrationInputResponse(e)},i.prototype.handleAuthenticationOrRegistrationInputResponse=function(e){e instanceof t.PlaceholderAuthSuccessResponse?(this._sdk.log(t.LogLevel.Debug,"Placeholder received PlaceholderAuthSuccessResponse."),this.handlePlaceholderSuccessResponse(e)):e instanceof t.PlaceholderAuthFailureResponse?(this._sdk.log(t.LogLevel.Debug,"Placeholder received PlaceholderAuthFailureResponse."),this.handlePlaceholderFailureResponse(e)):e instanceof t.PlaceholderAuthFailureWithServerProvidedStatusResponse?(this._sdk.log(t.LogLevel.Debug,"Placehoder received PlaceholderAuthFailureWithServerProvidedStatusResponse"),this.processAuthFailureAssertionAndHandleError(e.getFailureError(),1)):(this._sdk.log(t.LogLevel.Error,"Placeholder received unknkown response type."),this.performErrorRecoveryForError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Placeholder received unknkown response type.")))},i.prototype.handlePlaceholderSuccessResponse=function(e){var n={token:e.getPlaceholderToken()};this._operationMode==t.AuthenticatorSessionMode.Authentication?this.processAuthenticateAssertion(n):this.processRegisterAssertion(n)},i.prototype.handlePlaceholderFailureResponse=function(e){this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"auth_failure",{num_of_failures:1});var r={status:e.getRegistrationStatus()==t.AuthenticatorRegistrationStatus.Registered?n.Protocol.AuthenticationMethodStatus.Registered:n.Protocol.AuthenticationMethodStatus.Unregistered,expired:e.getExpired(),locked:e.getLocked(),last_used:0};this._authenticatorDescription.updateWithAuthenticatorState(r),this.performErrorRecoveryForError(e.getFailureError())},i.prototype.generatePlaceholderServerTokenGenerationPayload=function(){var e=this.user.deviceId||this._actionDriver._controlFlowProcessor._session.deviceId(),t={assertion_id:this._authenticatorDescription.assertionId,challenge:this._actionDriver._controlFlowProcessor.challenge,device_id:e,auth_type:this._authenticatorDescription.getAuthenticatorId()};return btoa(JSON.stringify(t))},i.placeholderExtensionPoint=new n.ExtensionPoint(e.tarsusplugin.TARSUS_EXTENSION_POINT_NAME_PLACEHOLDER_EXTENSION),i}(r.AuthenticationDriver),r.AuthenticationDriverPlaceholder=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){var i=t.call(this,e,n,r)||this;return i._pendingRestartRequest=!1,i}return __extends(n,t),n.prototype.createAuthenticatorSession=function(){return this._pendingRestartRequest=!1,this._uiHandler.createSecurityQuestionAuthSession("question",this.user.displayName)},n.prototype.authenticateInStartedSession=function(n){var r=this,i=Promise.resolve(null);this._pendingRestartRequest&&(this._pendingRestartRequest=!1,i=this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"restart",{}).then(function(t){t.data&&t.data.question?r._currentStep=r.loadStepFromQuestionDict(t.data.question):r.completeAuthenticatorSessionWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unexpected response to question restart request."))})),i.then(function(e){t.prototype.authenticateInStartedSession.call(r,n)})},n.prototype.loadStepFromQuestionDict=function(t){var n=Object.keys(t);if(1!=n.length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Expecting a single authentication question.");return e.impl.SecurityQuestionStepDescriptionImpl.createForAuthQuestion(new e.impl.SecurityQuestionImpl(n[0],t[n[0]],!0))},n.prototype.createInitialInputStep=function(){var t=this._authenticatorConfig;switch(this._operationMode){case e.AuthenticatorSessionMode.Authentication:if(!t.question)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Expecting authentication question dictionary.");return this.loadStepFromQuestionDict(t.question);case e.AuthenticatorSessionMode.Registration:if(!t.questions||!t.reg_min_questions)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Expecting registration question dictionary.");var n=t.questions,r=Object.keys(n).map(function(t){return new e.impl.SecurityQuestionImpl(t,n[t].text,n[t].registered)});return e.impl.SecurityQuestionStepDescriptionImpl.createForRegistrationQuestions(r,t.reg_min_questions)}},n.prototype.prepareNextAuthenticationStep=function(e){return this.loadStepFromQuestionDict(e.data.question)},n.prototype.updateCurrentAuthenticationStep=function(e,t){return t},n.prototype.handleAuthenticationInputResponse=function(t){var n=t;if(this.verifyValidAnswers(n),1!=n.getAnswers().length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Expecting exactly one answer on secuirty question authentication.");var r=this.securityQuestionAnswersResposneToAnswerMap(n);this.processAuthenticateAssertion({answer:r})},n.prototype.handleRegistrationInputResponse=function(t){var n=t;if(this.verifyValidAnswers(n),this.currentSecurityQuestionsStep().getMinAnswersNeeded()>n.getAnswers().length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Not enough answers provided to security questions registration process.");var r=this.securityQuestionAnswersResposneToAnswerMap(n);this.processRegisterAssertion({answers:r})},n.prototype.handleErrorRecoveryAction=function(n,r){r.getErrorCode()==e.AuthenticationErrorCode.InvalidInput&&(this._pendingRestartRequest=!0),t.prototype.handleErrorRecoveryAction.call(this,n,r)},n.prototype.verifyValidAnswers=function(t){for(var n=0,r=t.getAnswers();n<r.length;n++){var i=r[n];if(i.getAnswer()&&(!i.getAnswer().getAnswerText()||0==i.getAnswer().getAnswerText().length))throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Empty answers are not allowed.")}},n.prototype.securityQuestionAnswersResposneToAnswerMap=function(t){var n=this,r={};return t.getAnswers().forEach(function(t){if(n.currentSecurityQuestionsStep().getSecurityQuestions().indexOf(t.getQuestion())<0)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Answer provided to a question not included in this step.");var i=n._sdk.host.calcHexStringEncodedSha256Hash(e.util.asciiToHex(t.getAnswer().getAnswerText().toLowerCase()));r[t.getQuestion().getSecurityQuestionId()]=i}),r},n.prototype.currentSecurityQuestionsStep=function(){return this._currentStep},n}(t.AuthenticationDriverMultiStep);t.AuthenticationDriverSecurityQuestions=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){return function(){}}();e.AuthenticationDriverSessionResult=t;var n=function(e){function t(t,n){var r=e.call(this)||this;return r.requiredAuthenticator=t||null,r.allowedAuthenticators=n||null,r}return __extends(t,e),t}(t);e.AuthenticationDriverSessionResultSwitchAuthenticator=n;var r=function(e){function t(t){var n=e.call(this)||this;return n.assertionResult=t,n}return __extends(t,e),t}(t);e.AuthenticationDriverSessionResultAuthenticationCompleted=r}(e.authenticationdrivers||(e.authenticationdrivers={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.authenticationdrivers||(t.authenticationdrivers={}),r=function(r){function i(e,t,n){var i=r.call(this,e,t,n)||this;return i._previousSelectedDevices=[],i.methodName="totp",i.setupDataModel(t,n),i}return __extends(i,r),i.prototype.setupDataModel=function(e,r){this._state=e.state,this._requiresChallengeGeneration=e.state!=t.Protocol.AuthenticationMethodTotpState.Validate,this._selectedDevices=null,this._state==t.Protocol.AuthenticationMethodTotpState.Validate&&e.challenge&&(this._challenge=this.createTotpChallenge(e.challenge)),e.selectable_devices?this._selectableDevices=n.AuthenticationDriverDescriptorTotp.createTargetsFromConfig(e):this._selectableDevices=null},i.prototype.createAuthenticatorSession=function(){if(this._authenticationParameters){var t=this._authenticationParameters.filter(function(t){e.AuthenticationActionParameterTargetSelection});if(this._selectableDevices&&0!=t.length){this._sdk.log(e.LogLevel.Debug,"Target based driver found target selection parameters.");var n=this._selectableDevices.reduce(function(e,t){return e[t.getDeviceIdentifier()]=t,e},{});this._pendingTargetSelection=t.map(function(t){var r=t.getTarget(),i=n[r.getDeviceIdentifier()];if(!i)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Authentication parameter tried to select a device not presented as a selectable target");return i},{}),this._sdk.log(e.LogLevel.Debug,"Target based driver will select targets "+this._pendingTargetSelection+" based on selection parameter.")}}var r=this._uiHandler.createTotpAuthSession("totp",this.user.displayName);if(!r)throw e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createTotpAuthSession");return r.setAvailableTargets(this._selectableDevices),r},i.prototype.handleRegistrationInputResponse=function(t){throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Cannot register TOTP authenticator.")},i.prototype.registerInStartedSession=function(t){throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Cannot register TOTP authenticator.")},i.prototype.authenticateInStartedSession=function(t){!this._selectedDevices&&this._pendingTargetSelection&&this._pendingTargetSelection.length&&(this._sdk.log(e.LogLevel.Debug,"TOTP authentication driver has "+this._pendingTargetSelection.length+" pending targets."),this._selectedDevices=this._pendingTargetSelection),this.requestInput()},i.prototype.requestInput=function(){var t=this;this._inputSession.setTargetDevices(this._selectedDevices),this._inputSession.setChallenge(this._challenge),this.pendingChallengeGeneration()?this.sendGenerateTotpAssertion():this._inputSession.promiseInput().then(function(e){t.handleInputOrControlResponse(e)}).catch(function(n){t.performErrorRecoveryForError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(n))})},i.prototype.handleAuthenticationInputResponse=function(t){var n=t.getAuthenticatorInput(),r=t.getSelectedTargets();if(n){this._sdk.log(e.LogLevel.Debug,"Handling OTP code Input.");var i={totp:n.getCode()};this._selectedDevices&&(i.device_ids=this._selectedDevices.map(function(e){return e.getDeviceIdentifier()})),this.processAuthenticateAssertion(i)}else{if(!r||!this._selectableDevices)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid target-based authenticator response type received from application callback. Target-based authenticator inputs must be created by calling TargetBasedAuthenticatorInput.createAuthenticatorInput.");var o=this._selectableDevices;if(this._sdk.log(e.LogLevel.Debug,"Handling target selection Input."),this._selectedDevices=r.map(function(t){var n=t;if(o.indexOf(n)<0)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Attempt to select a Totp target not originally listed in the session.");return n}),0===this._selectedDevices.length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,"No targets selected for TOTP.");this.requestInput()}},i.prototype.sendGenerateTotpAssertion=function(){var n=this,r={};this._selectedDevices&&(r.device_ids=this._selectedDevices.map(function(e){return e.getDeviceIdentifier()})),this._sdk.log(e.LogLevel.Debug,"Requesting TOTP generation"),this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"generate",r,{}).then(function(r){n._previousSelectedDevices=n._selectedDevices||[],r.assertion_error_code&&r.assertion_error_code!=t.Protocol.AssertionErrorCode.FailOver&&(n._sdk.log(e.LogLevel.Error,"Assertion error encountered."),n._selectedDevices=null),!n.handleAuthenticateAssertionResult(r)&&r.data&&(n._state=r.data.state,r.data.challenge&&(n._challenge=n.createTotpChallenge(r.data.challenge)),n.requestInput())}).catch(function(t){n.performErrorRecoveryForError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},i.prototype.pendingChallengeGeneration=function(){var e=this._selectedDevices&&(this._previousSelectedDevices.length!==this._selectedDevices.length||this._previousSelectedDevices.some(function(e,t){return e!==this._selectedDevices[t]},this)),n=!this._selectableDevices;return this._requiresChallengeGeneration&&(e||n&&this._state==t.Protocol.AuthenticationMethodTotpState.Generate)},i.prototype.createTotpChallenge=function(t){var n=new e.TotpChallenge;return n.setValue(t.value),n.setFormat(e.TotpChallengeFormatImpl.fromAssertionFormat(t.format)),n},i.prototype.handleAuthenticateAssertionResult=function(n){if(n.assertion_error_code&&n.assertion_error_code==t.Protocol.AssertionErrorCode.RepeatCurrentStep&&n.data&&"check_digit"==n.data.reason){this._sdk.log(e.LogLevel.Info,"handleAuthenticateAssertionResult() for Totp code with incorrect check digit");var i=new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,n.assertion_error_message||"Totp code with incorrect check digit");return i.setPublicProperty(e.AuthenticationErrorProperty.AuthenticatorInvalidInputErrorDescription,e.AuthenticationErrorPropertySymbol.AuthenticatorInvalidInputErrorDescriptionTotpIncorrectCheckDigit),this.performErrorRecoveryForError(i),!0}return r.prototype.handleAuthenticateAssertionResult.call(this,n)},i}(n.AuthenticationDriver),n.AuthenticationDriverTotp=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n;!function(e){e.LONG="tooLong",e.SHORT="tooShort",e.LOUD="tooLoud",e.SOFT="tooSoft",e.NOISY="tooNoisy",e.WRONG_PASSPHRASE="wrongPassphrase",e.VALID_PASSPHRASE="000"}(n||(n={}));var r=function(t){function r(e,n,r){return t.call(this,e,n,r)||this}return __extends(r,t),r.prototype.createAuthenticatorSession=function(){return this._uiHandler.createVoiceAuthSession("voice",this.user.displayName)},r.prototype.updatePassphraseFromAssertionResultIfNeeded=function(t){var n=t.data;if(n){var r=n.passphrase_text;r&&(this._sdk.log(e.LogLevel.Info,"handleAuthenticateAssertionResult() received updated passphrase"),this._authenticatorConfig.passphrase_text=r)}},r.prototype.handleRegisterAssertionResult=function(e){return this.updatePassphraseFromAssertionResultIfNeeded(e),t.prototype.handleRegisterAssertionResult.call(this,e)},r.prototype.handleAuthenticateAssertionResult=function(e){return this.updatePassphraseFromAssertionResultIfNeeded(e),t.prototype.handleAuthenticateAssertionResult.call(this,e)},r.prototype.createInitialInputStep=function(){var t=this._authenticatorConfig;return new e.impl.AudioAcquisitionStepDescriptionImpl(this.createStepTag(),t.passphrase_text)},r.prototype.prepareNextAuthenticationStep=function(t){var n=this._authenticatorConfig;return new e.impl.AudioAcquisitionStepDescriptionImpl(this.createStepTag(t.data&&t.data.additional_error_code),n.passphrase_text)},r.prototype.updateCurrentAuthenticationStep=function(e,t){return this.prepareNextAuthenticationStep(e)},r.prototype.handleAuthenticationInputResponse=function(e){var t=e;this.processAuthenticateAssertion(t.getAcquisitionResponse())},r.prototype.handleRegistrationInputResponse=function(e){var t=e;this.processRegisterAssertion(t.getAcquisitionResponse())},r.prototype.createStepTag=function(e){return"voice_"+(e?this.mapHintToVoiceError(e):n.VALID_PASSPHRASE)},r.prototype.mapHintToVoiceError=function(t){switch(t){case 101:return n.LONG;case 102:return n.SHORT;case 103:return n.LOUD;case 104:return n.SOFT;case 105:return n.NOISY;case 106:return n.WRONG_PASSPHRASE;default:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Voice error code "+t+" is unknown/unhandled")}},r}(t.AuthenticationDriverMultiStep);t.AuthenticationDriverVoice=r})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.AuthenticatorDrivers={password:new e.SimpleAuthenticationDriverDescriptor(e.AuthenticationDriverPassword),pin_centralized:new e.SimpleAuthenticationDriverDescriptor(e.AuthenticationDriverPinCode),pin:new e.AuthenticationDriverDescriptorLocal(e.AuthenticationDriverLocalPinCode,e.AuthenticationDriverLocalPinCode.authenticatorName),pattern:new e.AuthenticationDriverDescriptorLocal(e.AuthenticationDriverLocalPattern,e.AuthenticationDriverLocalPattern.authenticatorName),pattern_centralized:new e.SimpleAuthenticationDriverDescriptor(e.AuthenticationDriverPattern),fingerprint:new e.AuthenticationDriverDescriptorFingerprint,face_id:new e.AuthenticationDriverDescriptorNativeFace,otp:new e.AuthenticationDriverDescriptorOtp,face_server:new e.AuthenticationDriverDescriptorFace,voice_server:new e.AuthenticationDriverDescriptorVoice,mobile_approve:new e.AuthenticationDriverDescriptorMobileApprove,totp:new e.AuthenticationDriverDescriptorTotp,question:new e.SimpleAuthenticationDriverDescriptor(e.AuthenticationDriverSecurityQuestions),fido2:new e.AuthenticationDriverDescriptorFido2(e.AuthenticationDriverFido2),device_biometrics:new e.AuthenticationDriverDescriptorDeviceStrongAuthentication,__placeholder:new e.SimpleAuthenticationDriverDescriptor(e.AuthenticationDriverPlaceholder)}}(e.authenticationdrivers||(e.authenticationdrivers={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e){this.enabledCollectors=e}return e.prototype.isEnabled=function(){var e=this.getAssociatedCollectorType();return null==e||-1!=this.enabledCollectors.indexOf(e)},e}();e.Collector=t}(e.collectors||(e.collectors={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n){var r=t.call(this,e)||this;return r.cacheValidityPeriod=n,r}return __extends(n,t),n.prototype.provide=function(e){var t=this;return new Promise(function(n,r){var i=t.getCachedData(e);i?n(i):t.provideNewData(e).then(function(r){t.saveCollectionResultToLocalStorage(e,r),n(r)},r)})},n.prototype.saveCollectionResultToLocalStorage=function(e,t){var n=e.host,r=this.getSchemeVersionTarsusKeyPath(),i=new Object;i.timeStamp=Date.now(),i.collectionResult=t,n.writeStorageKey(r,i)},n.prototype.getCachedData=function(t){var n=t.host,r=this.getSchemeVersionTarsusKeyPath(),i=n.readStorageKey(r);if(!i.collectionResult||!i.timeStamp)return t.log(e.LogLevel.Debug,"No collected data found in cache."),null;var o=i.timeStamp;return Date.now()-o>this.cacheValidityPeriod?(t.log(e.LogLevel.Debug,"Cached collected data invalidated."),null):(t.log(e.LogLevel.Debug,"Loaded cached collector data: "+JSON.stringify(i.collectionResult)),i.collectionResult)},n}(t.Collector);t.CacheableCollector=n})((t=e.core||(e.core={})).collectors||(t.collectors={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return __extends(r,n),r.prototype.provide=function(t){var n=new Object,r=new Object;return r.audio_acquisition_supported="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.AudioAcquitisionSupported),r.finger_print_supported="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.FingerprintSupported),r.image_acquisition_supported="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.ImageAcquitisionSupported),r.persistent_keys_supported="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.PersistentKeysSupported),r.face_id_key_bio_protection_supported="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.FaceIdKeyBioProtectionSupported),r.fido_client_present="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.FidoClientPresent),r.dyadic_present="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.DyadicPresent),r.installed_plugins=t.pluginManager.getInitializedPlugins().map(function(t){return{plugin_name:t.getPluginInfo().getPluginName(),plugin_version:e.tarsusplugin.impl.PluginInfoImpl.versionToString(t.getPluginInfo())}}),""!=t.host.queryHostInfo(e.sdkhost.HostInformationKey.HostProvidedFeatures)&&(r.host_provided_features=t.host.queryHostInfo(e.sdkhost.HostInformationKey.HostProvidedFeatures)),n=r,Promise.resolve(n)},r.prototype.getAssociatedCollectorType=function(){return t.CollectorType.Capabilities},r}(n.Collector);n.CapabilitiesCollector=r}((n=t.core||(t.core={})).collectors||(n.collectors={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.collectors||(t.collectors={}),r=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return __extends(r,n),r.prototype.provide=function(n){var r=new Object;for(var i in e.CollectorType)r[i]=t.Protocol.CollectorState.Disabled;for(var o=0,a=this.enabledCollectors;o<a.length;o++)r[a[o]]=t.Protocol.CollectorState.Active;var s=new Object;for(var c in e.CollectorType)this.isNumeric(c)&&(s[e.CollectorType[c].toLowerCase()]=r[c]);return Promise.resolve(s)},r.prototype.getAssociatedCollectorType=function(){return null},r.prototype.isNumeric=function(e){return parseInt(e,10)>=0},r}(n.Collector),n.CollectorsStateCollector=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.collectors||(t.collectors={}),r=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return __extends(r,n),r.prototype.provide=function(e){var n=e.host.readStorageKey(t.User.storageKey);n.length=n.length||0;var r=new Object;return r.logged_users=n.length,Promise.resolve(r)},r.prototype.getAssociatedCollectorType=function(){return e.CollectorType.DeviceDetails},r}(n.Collector),n.DeviceDetailsCollector=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.collectors||(t.collectors={}),r=function(n){function r(e){return n.call(this,e,r.cacheValidityPeriod)||this}return __extends(r,n),r.prototype.provideNewData=function(n){var r=this;return new Promise(function(i,o){if(!n.currentSession)throw"No valid session.";var a=new Object;n.log(e.LogLevel.Debug,"Refreshing fido authenticators data");for(var s=new Array,c=0,u=t.authenticationdrivers._fidoClientProviders;c<u.length;c++){var l=u[c];s.push(l.getAvailableAuthenticatorsIds(n))}Promise.all(s.map(function(e){return e.catch(function(e){return new Error(e)})})).then(function(e){var t=r.getCollectedAaids(e,n);a.fido=t,i(a)}).catch(function(t){n.log(e.LogLevel.Error,"Error parsing fido authenticators collection results"+t),i({})})})},r.prototype.getAssociatedCollectorType=function(){return e.CollectorType.FidoAuthenticators},r.prototype.getSchemeVersionTarsusKeyPath=function(){return new t.TarsusKeyPath("fido_collection_result")},r.prototype.getCollectedAaids=function(t,n){for(var r=new Array,i=0,o=t;i<o.length;i++){var a=o[i];if(a instanceof Error)n.log(e.LogLevel.Error,"Error collecting fido authenticators details "+a);else if(a&&a.length>0)for(var s=0,c=a;s<c.length;s++){var u=c[s];if(u){var l=new Object;l.aaid=u,r.push(l)}}}return r},r.cacheValidityPeriod=6048e5,r}(n.CacheableCollector),n.FidoAuthenticatorsCollector=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.collectors||(t.collectors={}),r=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return __extends(r,n),r.prototype.provide=function(e){for(var t=new Object,n=0,i=r.authenticatorDriversLocal;n<i.length;n++){var o=i[n],a=this.provideLocalEnrollmentData(e,o);a&&(t[o]=a)}return Promise.resolve(t)},r.prototype.getAssociatedCollectorType=function(){return e.CollectorType.LocalEnrollments},r.prototype.provideLocalEnrollmentData=function(e,t){var n=null;if(e.currentSession){var r=e.currentSession.user.localEnrollments[t];r&&((n=new Object).registration_status=r.status,n.validation_status=r.validationStatus)}return n},r.authenticatorDriversLocal=[t.authenticationdrivers.AuthenticationDriverLocalPinCode.authenticatorName,t.authenticationdrivers.AuthenticationDriverLocalPattern.authenticatorName,t.authenticationdrivers.AuthenticationDriverDescriptorFingerprint.authenticatorName,t.authenticationdrivers.AuthenticationDriverDescriptorNativeFace.authenticatorName],r}(n.Collector),n.LocalEnrollmentsCollector=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.TarsusCollectors={capabilities:{createCollector:e.CapabilitiesCollector},collector_state:{createCollector:e.CollectorsStateCollector},device_details:{createCollector:e.DeviceDetailsCollector},hw_authenticators:{createCollector:e.FidoAuthenticatorsCollector},local_enrollments:{createCollector:e.LocalEnrollmentsCollector}}}(e.collectors||(e.collectors={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){return function(){}}();e.CredentialOperationResult=t;var n=function(e){function t(t){var n=e.call(this)||this;return n.signature=t,n}return __extends(t,e),t}(t);e.CredentialSignResult=n;var r=function(e){function t(t){var n=e.call(this)||this;return n.keyPair=t,n}return __extends(t,e),t}(t);e.CredentialUnwrapAsymmetricResult=r;var i=function(e){function t(t,n){var r=e.call(this)||this;return r.requiredAuthenticator=t||null,r.allowedAuthenticators=n||null,r}return __extends(t,e),t}(t);e.CredentialAuthOperationResultSwitchAuthenticator=i}(e.credential||(e.credential={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t,n){this._credentialId=e,this._host=t,this._userInteractionSessionProvider=n}return Object.defineProperty(e.prototype,"credentialId",{get:function(){return this._credentialId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"user",{get:function(){return this._userInteractionSessionProvider._session.user},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"host",{get:function(){return this._host},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sdk",{get:function(){return this._userInteractionSessionProvider._sdk},enumerable:!0,configurable:!0}),e.prototype.getClientContext=function(){return this._userInteractionSessionProvider._clientContext},e}();e.PKCredential=t}(e.credential||(e.credential={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(e,t,r){var i=n.call(this,e,t,r)||this;return i._externalCancelled=!1,i}return __extends(r,n),Object.defineProperty(r.prototype,"uiHandler",{get:function(){return this._userInteractionSessionProvider._uiHandler},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"authenticatorDescription",{get:function(){return this._authenticatorDescription},enumerable:!0,configurable:!0}),r.prototype.onCancelRun=function(){this._externalCancelled=!0},r.prototype.startCredentialSession=function(t){if(this._authenticatorConfig=this.host.getAuthenticatorConfig(this),this._inputSession=this.createAuthenticatorSession(),!this._inputSession)throw e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from authenticator session creation call.");this._authenticatorDescription=this.host.getAuthenticatorDescription(this),this._inputSession.startSession(this._authenticatorDescription,e.AuthenticatorSessionMode.Authentication,this.host.getPolicyAction(this),t)},r.prototype.endCredentialSession=function(){this._inputSession&&this._inputSession.endSession()},r.prototype.promiseRecoveryForError=function(t,n,r){var i=this;return n.indexOf(r)<0&&(r=n.indexOf(e.AuthenticationErrorRecovery.SelectAuthenticator)>=0?e.AuthenticationErrorRecovery.SelectAuthenticator:e.AuthenticationErrorRecovery.Fail),this._inputSession.promiseRecoveryForError(t,n,r).then(function(r){return i.sdk.log(e.LogLevel.Debug,"Error recovery selected "+r),i.sdk.log(e.LogLevel.Debug,"recover from error: "+t.getErrorCode()),n.indexOf(r)<0?(i.sdk.log(e.LogLevel.Error,"Invalid error recovery option from callback: "+r+" not in "+n),Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid error recovery action selected by callback."))):Promise.resolve(r)})},r.prototype.authenticateInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeCredentialOperationWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},r.prototype.processLocalAuthenticatorError=function(e){this.completeCredentialOperationWithError(e)},r.prototype.completeCredentialOperationWithResult=function(e){this._completionFunction(e)},r.prototype.completeCredentialOperationWithError=function(e){this._rejectionFunction(e)},r.prototype.handleInputOrControlResponse=function(t){try{t.isControlRequest()?this.processControlRequest(t.getControlRequest()):this.handleAuthenticationInputResponse(t.getResponse())}catch(t){this.completeCredentialOperationWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))}},r.prototype.processControlRequest=function(n){switch(this.sdk.log(e.LogLevel.Debug,"Processing control request "+n.getRequestType()),n.getRequestType()){case e.ControlRequestType.AbortAuthentication:this.completeCredentialOperationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Authentication cancelled due to abort control request."));break;case e.ControlRequestType.ChangeMethod:this.completeCredentialOperationWithResult(new t.CredentialAuthOperationResultSwitchAuthenticator(null,this.host.availableAuthenticatorsForSwitchMethod(this)));break;case e.ControlRequestType.SelectMethod:this.completeCredentialOperationWithResult(new t.CredentialAuthOperationResultSwitchAuthenticator);break;case e.ControlRequestType.CancelAuthenticator:this.invokeUiHandlerCancellation();break;case e.ControlRequestType.RetryAuthenticator:this.authenticateInStartedSession(!0);break;default:this.completeCredentialOperationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid ControlRequestType value during authentication session."))}},r.prototype.invokeUiHandlerCancellation=function(){var t=this;if(this._externalCancelled)this.processControlRequest(e.ControlRequest.create(e.ControlRequestType.AbortAuthentication));else{var n=[e.ControlRequestType.RetryAuthenticator,e.ControlRequestType.AbortAuthentication];this.getOtherAuthenticators().length>0&&n.push(e.ControlRequestType.ChangeMethod),this.host.availableAuthenticatorsForSwitchMethod(this).length>0&&n.push(e.ControlRequestType.SelectMethod),this.uiHandler.controlOptionForCancellationRequestInSession(n,this._inputSession).then(function(r){return r.getRequestType()==e.ControlRequestType.CancelAuthenticator?void t.completeCredentialOperationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"controlOptionForCancellationRequestInSession returned CancelAuthenticator which is an invalid option.")):n.indexOf(r.getRequestType())<0?void t.completeCredentialOperationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"controlOptionForCancellationRequestInSession returned an invalid option.")):void t.processControlRequest(r)})}},r.prototype.getOtherAuthenticators=function(){var e=this;return this.host.availableAuthenticatorsForSwitchMethod(this).filter(function(t){return t!=e._authenticatorDescription})},r}(t.PKCredential);t.PKCredentialAuth=n})((t=e.core||(e.core={})).credential||(t.credential={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.credential||(t.credential={}),r=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),i.prototype.evaluateLocalRegistrationStatus=function(){var n=this.user.localEnrollments[this.credentialId];return n?n.validationStatus==t.LocalEnrollmentValidationStatus.Invalidated?e.AuthenticatorRegistrationStatus.LocallyInvalid:n.status!=t.LocalEnrollmentStatus.Registered?e.AuthenticatorRegistrationStatus.Unregistered:e.AuthenticatorRegistrationStatus.Registered:e.AuthenticatorRegistrationStatus.LocallyInvalid},Object.defineProperty(i.prototype,"lastObtainedKeyPair",{get:function(){return this._lastObtainedKeyPair},set:function(e){this._lastObtainedKeyPair&&this._lastObtainedKeyPair!=e&&this._lastObtainedKeyPair.closeKeyPair(),this._lastObtainedKeyPair=e},enumerable:!0,configurable:!0}),i.prototype.endCredentialSession=function(){this.lastObtainedKeyPair&&(this.lastObtainedKeyPair=null),r.prototype.endCredentialSession.call(this)},i.prototype.onCancelRun=function(){r.prototype.onCancelRun.call(this),this.lastObtainedKeyPair&&(this.lastObtainedKeyPair=null)},i.prototype.handleAuthenticationInputResponse=function(t){var n=this,r=this.user.localEnrollments[this.credentialId];r?this.getKeyForEnrollmentDataAndInput(r,t).then(function(t){n.sdk.log(e.LogLevel.Debug,"Local authenticator key obtained; signing challenge"),n.completeCredentialOperationWithResult(t)}).catch(function(t){n.processLocalAuthenticatorError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))}):this.completeCredentialOperationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.NoRegisteredAuthenticator,"Missing key for fingerprint authenticator"))},i.prototype.signHex=function(t){var r=this;return new Promise(function(i,o){r._rejectionFunction=o,r._completionFunction=r.buildCompletionFunction(i,o,function(){r.lastObtainedKeyPair.signHex(t).then(function(e){return i(new n.CredentialSignResult(e))},function(t){return r.processLocalAuthenticatorError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})}),r.authenticateInStartedSession(!1)})},i.prototype.unwrapAsymmetricKeyPairFromPrivateHex=function(t,r){var i=this;return new Promise(function(o,a){i._rejectionFunction=a,i._completionFunction=i.buildCompletionFunction(o,a,function(){i.lastObtainedKeyPair.unwrapAsymmetricKeyPairFromPrivateKeyHex(t,r).then(function(e){return o(new n.CredentialUnwrapAsymmetricResult(e))},function(t){return i.processLocalAuthenticatorError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})}),i.authenticateInStartedSession(!1)})},i.prototype.buildCompletionFunction=function(t,r,i){var o=this;return function(a){if(a instanceof n.CredentialOperationResult)t(a);else{o.lastObtainedKeyPair=a;try{i()}catch(t){r(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))}}}},i}(n.PKCredentialAuth),n.PKCredentialAuthLocal=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.credential||(n.credential={}),i=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),i.prototype.getKeyForEnrollmentDataAndInput=function(e,n){var r=this;return new Promise(function(t,i){"v2"==e.version?r.getKeyForEnrollmentDataAndInputV2(e,n).then(t,i):r.getKeyForEnrollmentDataAndInputPreV2(e,n).then(t,i)}).then(function(e){if(!e)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.InvalidInput,"Invalid input provided to credential.");return e})},i.prototype.getKeyForEnrollmentDataAndInputV2=function(t,r){var i=this,o=this.extractPbkdfInputFromInputResponse(r);return n.vault.pbkdfStretchHexSecretIntoAESKey(t.salt,o,t.cryptoSettings.getLocalEnrollmentKeySizeInBytes(),t.cryptoSettings.getLocalEnrollmentKeyIterationCount(),!0,this.sdk).then(function(n){return n.decrypt(t.keyMaterial,null).then(function(t){return i.sdk.host.generateHexSeededKeyPairExternalRepresentation(e.sdkhost.KeyClass.FidoECCSigningKey,t).then(function(t){return i.sdk.host.importVolatileKeyPair(e.sdkhost.KeyClass.FidoECCSigningKey,t)})})})},i.prototype.getKeyForEnrollmentDataAndInputPreV2=function(t,n){var r=this;return this.authenticatorKeyTagForScheme(t.version,t.salt,t.cryptoSettings,n).then(function(t){return r.sdk.host.getKeyPair(t,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.None)})},i.prototype.authenticatorKeyTagForScheme=function(e,r,i,o){var a=this;return new Promise(function(s,c){var u=a.extractPbkdfInputFromInputResponse(o);if("v0"==e&&(a.sdk.log(t.LogLevel.Debug,"Using SDK CryptoSettings for migrated enrollment."),i=a.sdk.cryptoSettings),!i)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Missing crypto settings for local enrollment.");a.sdk.host.generatePbkdf2HmacSha1HexString(r,u,i.getLocalEnrollmentKeySizeInBytes(),i.getLocalEnrollmentKeyIterationCount()).then(function(r){var i=t.util.hexToBase64(r);return new n.TarsusKeyPath("per_user",a.user.guid.toString(),"local_auth_keys",a.credentialId,e,i)}).then(s,c)})},i}(r.PKCredentialAuthLocal),r.PKCredentialLocalSecretInputBased=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(){};t.CredentialAuthPinCodeConfig=n;var r=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),Object.defineProperty(n.prototype,"pinLength",{get:function(){return this._authenticatorConfig.length},enumerable:!0,configurable:!0}),n.prototype.extractPbkdfInputFromInputResponse=function(t){var n=t;return e.util.asciiToHex(n.getPin())},n.prototype.createAuthenticatorSession=function(){return this.uiHandler.createPinAuthSession(this.credentialId,this.user.displayName,this.pinLength)},n.create=function(e,t,r){return new n(e,t,r)},n}(t.PKCredentialLocalSecretInputBased);t.PKCredentialLocalPinCode=r})((t=e.core||(e.core={})).credential||(t.credential={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),n.prototype.handleAuthenticationInputResponse=function(n){var r=n;e.impl.PatternInputImpl.validateFormat(r)?t.prototype.handleAuthenticationInputResponse.call(this,n):this.processLocalAuthenticatorError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern description format."))},n.prototype.extractPbkdfInputFromInputResponse=function(t){var n=t;return e.util.asciiToHex(n.getPatternDescription())},n.prototype.createAuthenticatorSession=function(){return this.uiHandler.createPatternAuthSession(this.credentialId,this.user.displayName,3,4)},n.create=function(e,t,r){return new n(e,t,r)},n}(t.PKCredentialLocalSecretInputBased);t.PKCredentialLocalPattern=n})((t=e.core||(e.core={})).credential||(t.credential={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.credential||(n.credential={}),i=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),i.prototype.authenticatorKeyTagForUser=function(e,t,r){return new n.TarsusKeyPath("per_user",e.guid.toString(),"local_auth_keys",this.credentialId,t,r)},i.prototype.evaluateLocalRegistrationStatus=function(){var n=r.prototype.evaluateLocalRegistrationStatus.call(this);if(n!=t.AuthenticatorRegistrationStatus.Registered)return n;var i=this.user.localEnrollments[this.credentialId],o=this.authenticatorKeyTagForScheme(i.version,i.salt),a=this.sdk.host.getKeyPair(o,e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);return a?(a.closeKeyPair(),t.AuthenticatorRegistrationStatus.Registered):t.AuthenticatorRegistrationStatus.LocallyInvalid},i.prototype.createAuthenticatorSession=function(){return this.uiHandler.createFingerprintAuthSession(this.credentialId,this.user.displayName)},i.prototype.processLocalAuthenticatorError=function(r){var i=this,o=r,a=Promise.resolve();if(o.getErrorCode()==t.AuthenticationErrorCode.Internal&&o.getData()){var s=o.getData();o=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(s,"Fingerprint")||o,(s[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricNotConfigured&&this._authenticatorDescription.getRegistered()||s[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricInvalidated)&&(a=n.LocalEnrollment.invalidateLocalRegistrationStatusAndNotifyUIHandler(this._userInteractionSessionProvider,this._authenticatorDescription))}a.catch(function(e){i.sdk.log(t.LogLevel.Error,e)}),a.finally(function(){if(o.getErrorCode()==t.AuthenticationErrorCode.UserCanceled)return i.sdk.log(t.LogLevel.Debug,"Fingerprint authenticator captured user cancel error code."),void i.invokeUiHandlerCancellation();i.completeCredentialOperationWithError(o)})},i.prototype.getKeyForEnrollmentDataAndInput=function(n,r){var i=this;return new Promise(function(o,a){var s=r,c=i.authenticatorKeyTagForScheme(n.version,n.salt),u=i.sdk.host.getKeyPair(c,e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);if(!u){var l={};throw l[e.sdkhost.ErrorDataInternalError]=e.sdkhost.InternalErrorBiometricInvalidated,new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to authenticate with invalidated Fingerprint.",l)}u.setBiometricPromptInfo(s.getPrompt(),i.shouldAllowBiometricFallbackButton(s)?s.getFallbackButtonTitle():null,i.uiHandler,i._inputSession),o(u)})},i.prototype.shouldAllowBiometricFallbackButton=function(e){if(!e)return!1;var t=e.getFallbackButtonTitle();return!!(t&&t.length>0)},i.prototype.authenticatorKeyTagForScheme=function(e,t){return this.authenticatorKeyTagForUser(this.user,e,t)},i.create=function(e,t,n){return new i(e,t,n)},i}(r.PKCredentialAuthLocal),r.PKCredentialFingerprint=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.credential||(n.credential={}),i=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),i.prototype.authenticatorKeyTagForUser=function(e,t,r){return new n.TarsusKeyPath("per_user",e.guid.toString(),"local_auth_keys","native_face",t,r)},i.prototype.evaluateLocalRegistrationStatus=function(){var n=r.prototype.evaluateLocalRegistrationStatus.call(this);if(n!=t.AuthenticatorRegistrationStatus.Registered)return n;var i=this.user.localEnrollments[this.credentialId],o=this.authenticatorKeyTagForScheme(i.version,i.salt),a=this.sdk.host.getKeyPair(o,e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);return a?(a.closeKeyPair(),t.AuthenticatorRegistrationStatus.Registered):t.AuthenticatorRegistrationStatus.LocallyInvalid},i.prototype.createAuthenticatorSession=function(){return this.uiHandler.createNativeFaceAuthSession(this.credentialId,this.user.displayName)},i.prototype.processLocalAuthenticatorError=function(r){var i=this,o=r,a=Promise.resolve();if(o.getErrorCode()==t.AuthenticationErrorCode.Internal&&o.getData()){var s=o.getData();o=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(s,"Native Face")||o,(s[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricNotConfigured&&this._authenticatorDescription.getRegistered()||s[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricInvalidated)&&(a=n.LocalEnrollment.invalidateLocalRegistrationStatusAndNotifyUIHandler(this._userInteractionSessionProvider,this._authenticatorDescription))}a.catch(function(e){i.sdk.log(t.LogLevel.Error,e)}),a.finally(function(){if(o.getErrorCode()==t.AuthenticationErrorCode.UserCanceled)return i.sdk.log(t.LogLevel.Debug,"Native face authenticator captured user cancel error code."),void i.invokeUiHandlerCancellation();i.completeCredentialOperationWithError(o)})},i.prototype.getKeyForEnrollmentDataAndInput=function(n,r){var i=this;return new Promise(function(o,a){var s=r,c=i.authenticatorKeyTagForScheme(n.version,n.salt),u=i.sdk.host.getKeyPair(c,e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);if(!u){var l={};throw l[e.sdkhost.ErrorDataInternalError]=e.sdkhost.InternalErrorBiometricInvalidated,new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to authenticate with invalidated FaceID.",l)}u.setBiometricPromptInfo(s.getPrompt(),i.shouldAllowBiometricFallbackButton(s)?s.getFallbackButtonTitle():null,i.uiHandler,i._inputSession),o(u)})},i.prototype.shouldAllowBiometricFallbackButton=function(e){if(!e)return!1;var t=e.getFallbackButtonTitle();return!!(t&&t.length>0)},i.prototype.authenticatorKeyTagForScheme=function(e,t){return this.authenticatorKeyTagForUser(this.user,e,t)},i.create=function(e,t,n){return new i(e,t,n)},i}(r.PKCredentialAuthLocal),r.PKCredentialNativeFace=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.CredentialTypes={pin:e.PKCredentialLocalPinCode,pattern:e.PKCredentialLocalPattern,fingerprint:e.PKCredentialFingerprint,face_id:e.PKCredentialNativeFace}}(e.credential||(e.credential={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e){this._authCtor=e}return e.prototype.createFidoAuthenticator=function(e,t,n,r,i,o){return new this._authCtor(e,t,n,r,i,o)},e.prototype.isAuthenticatorSupportedOnDevice=function(e){return!0},e}();e.SimpleFidoAuthenticatorDescriptor=t}(e.fidoclient||(e.fidoclient={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(n){function r(){return n.call(this,t.FidoAuthenticatorFingerprint)||this}return __extends(r,n),r.prototype.isAuthenticatorSupportedOnDevice=function(t){return"true"==t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.FingerprintSupported)},r}(t.SimpleFidoAuthenticatorDescriptor);t.FidoAuthenticatorDescriptorFingerprint=n}(t.fidoclient||(t.fidoclient={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(n){function r(){return n.call(this,t.FidoAuthenticatorNativeFace)||this}return __extends(r,n),r.prototype.isAuthenticatorSupportedOnDevice=function(t){return"true"==t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.FaceIdKeyBioProtectionSupported)},r}(t.SimpleFidoAuthenticatorDescriptor);t.FidoAuthenticatorDescriptorNativeFace=n}(t.fidoclient||(t.fidoclient={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(){function n(e,t,n,r,i,o){this._client=t,this._sdk=t.sdk,this._uiHandler=r,this._user=n,this._clientContext=i,this._action=o,this._authenticationDescription=e}return n.prototype.signHexWithKeyPair=function(e,t){return e.signHex(t)},n.prototype.generateKeyIdHex=function(t,n){return this._sdk.host.calcHexStringEncodedSha256Hash(e.util.asciiToHex(n.guid.toString()+"."+t+"."+this.aaid))},n.prototype.fidoRegisterWithHexUaf1TlvResponse=function(n,r,i){var o=this;return new Promise(function(i,a){o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator start auth session"),o.startAuthenticationSession(e.AuthenticatorSessionMode.Registration),o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator Prepare FCHash and key ID");var s=o._sdk.host.calcHexStringEncodedSha256Hash(e.util.asciiToHex(r)),c=o.generateKeyIdHex(n,o._user);o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator generate key pair"),o.generateKeyPair(c,n,o._user).then(function(n){o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator prepare KRD");var r=e.util.base64ToHex(n.publicKeyToJson().key),i={TAG_AAID:o.aaid,TAG_ASSERTION_INFO:{AuthenticatorVersion:o.authenticatorVersion,AuthenticationMode:1,SignatureAlgAndEncoding:t.ALG_SIGN_SECP256R1_ECDSA_SHA256_RAW,PublicKeyAlgAndEncoding:t.ALG_KEY_ECC_X962_RAW},TAG_FINAL_CHALLENGE_HASH:s,TAG_KEYID:c,TAG_COUNTERS:{SignCounter:o.signCounter,RegCounter:o.regCounter},TAG_PUB_KEY:r},a=e.util.tlvEncodeHex(t.FidoTLVTags,{TAG_UAFV1_KRD:i});return o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator sign assertion"),o.signHexWithKeyPair(n,a).then(function(n){o._sdk.log(e.LogLevel.Debug,"FIDO KRD Surrogate Assertion signature "+n);var r={TAG_UAFV1_REG_ASSERTION:{TAG_UAFV1_KRD:i,TAG_ATTESTATION_BASIC_SURROGATE:{TAG_SIGNATURE:n}}},a=e.util.tlvEncodeHex(t.FidoTLVTags,r);return o._sdk.log(e.LogLevel.Debug,"FIDO reg assertion TLV hex: "+a),e.util.hexToBase64(a)}).finally(function(){return n.closeKeyPair()})}).finally(function(){o.finishAuthenticationSession()}).then(i,a)})},n.prototype.fidoDeregister=function(e){var t=this.generateKeyIdHex(e,this._user);return this.deleteKeyPair(t,e,this._user)},n.prototype.fidoAuthenticateWithHexUaf1TlvResponse=function(n,r,i){var o=this;return new Promise(function(i,a){o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator start auth session"),o.startAuthenticationSession(e.AuthenticatorSessionMode.Authentication),o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator Prepare FCHash and key ID");var s=o._sdk.host.calcHexStringEncodedSha256Hash(e.util.asciiToHex(r)),c=o.generateKeyIdHex(n,o._user);o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator prepare signed data block for FIDO auth assertion");var u={TAG_AAID:o.aaid,TAG_ASSERTION_INFO:{AuthenticatorVersion:o.authenticatorVersion,AuthenticationMode:1,SignatureAlgAndEncoding:t.ALG_SIGN_SECP256R1_ECDSA_SHA256_RAW},TAG_AUTHENTICATOR_NONCE:o._sdk.host.generateRandomHexString(16),TAG_FINAL_CHALLENGE_HASH:s,TAG_TRANSACTION_CONTENT_HASH:"",TAG_KEYID:c,TAG_COUNTERS:{SignCounter:o.signCounter}},l=e.util.tlvEncodeHex(t.FidoTLVTags,{TAG_UAFV1_SIGNED_DATA:u});o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator loading key"),o.loadKeyPair(c,n,o._user).then(function(n){return o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator signing auth assertion"),o.signHexWithKeyPair(n,l).then(function(n){o._sdk.log(e.LogLevel.Debug,"FIDO authentication assertion signature "+n);var r={TAG_UAFV1_AUTH_ASSERTION:{TAG_UAFV1_SIGNED_DATA:u,TAG_SIGNATURE:n}},i=e.util.tlvEncodeHex(t.FidoTLVTags,r);return o._sdk.log(e.LogLevel.Debug,"FIDO auth assertion TLV hex: "+i),e.util.hexToBase64(i)}).finally(function(){return n.closeKeyPair()})}).finally(function(){o.finishAuthenticationSession()}).then(i,a)})},n.prototype.startAuthenticationSession=function(e){this._authMode=e},n.prototype.finishAuthenticationSession=function(){},n}();t.SimpleFidoAuthenticator=n})((t=e.core||(e.core={})).fidoclient||(t.fidoclient={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.vault||(t.vault={}),r=function(){function r(e,t,n,r,i,o){this._user=e,this._vaultData=t,this._vaultId=n,this._vaultOwner=r,this._sdk=i,this._uiHandler=o}return Object.defineProperty(r,"noIntegrityElementKey",{get:function(){return"element"},enumerable:!0,configurable:!0}),r.prototype.isEmpty=function(){return null===this._vaultData||null===this._vaultData.data||""===this._vaultData.data},r.prototype.lock=function(){this._unlockedData=null,this.finalizeLock()},r.prototype.readVaultKey=function(t){if(!this._unlockedData)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to read from  a locked vault.");if(this.noIntegrity&&t!=r.noIntegrityElementKey)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unprotected vault may store only '"+r.noIntegrityElementKey+"' key");return this._unlockedData[t]},r.prototype.writeVaultKey=function(t,n){var i=this;if(!this._unlockedData)return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to write to a locked vault."));if(this.noIntegrity){if(t!=r.noIntegrityElementKey)return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unprotected vault may store only '"+r.noIntegrityElementKey+"' key"));if(!e.util.isHexString(n))return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Expecting hex string."))}this._unlockedData[t]=n;var o=this.hexStringFromJsonToEncrypt(this._unlockedData);return this.internalDataEncrypt(o).then(function(e){i._vaultData.data=e,r.updateVaultForUserWithId(i._user,i._vaultData,i._vaultId,i._sdk)})},r.getVaultForUserWithId=function(t,r,i,o,a){var s=this.vaultsForUser(t,o)[r.toString()];if(!s)throw o.log(e.LogLevel.Warning,"vault '"+r+"' for user '"+t.displayName+"' not found in '"+this.getStorageKeyForVaultsForUser(t.guid).toString()+"'"),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Vault not found.");var c=n.VaultTypes[s.type];if(!c)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"unhandled vault type: "+s.type);return new c(t,s,r,i,o,a)},r.deleteVaultForUserWithId=function(t,r,i){i.log(e.LogLevel.Debug,"Delete vault "+r+" for user "+t.displayName);var o=this.vaultsForUser(t,i),a=o[r.toString()];if(a){var s=n.VaultTypes[a.type];if(!s)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"unhandled vault type: "+a.type);i.log(e.LogLevel.Debug,"Vault descriptor found; deleting."),s.deletePrivateResources(t,a,i),delete o[r.toString()],i.log(e.LogLevel.Debug,"Updating storage after vault deletion."),i.host.writeStorageKey(this.getStorageKeyForVaultsForUser(t.guid),o)}else i.log(e.LogLevel.Warning,"vault '"+r+"' for user '"+t.displayName+"' not found in '"+this.getStorageKeyForVaultsForUser(t.guid).toString()+"'")},r.deleteAllVaultsForUser=function(e,t){t.host.deleteStorageKey(this.getStorageKeyForVaultsForUser(e.guid))},r.prototype.hexStringFromJsonToEncrypt=function(t){return this.noIntegrity?t[n.AuthenticatorVault.noIntegrityElementKey]:e.util.asciiToHex(JSON.stringify(t))},r.prototype.jsonFromDecryptedHexString=function(t){if(this.noIntegrity){var n={};return n[r.noIntegrityElementKey]=t,n}return JSON.parse(e.util.hexToAscii(t))},Object.defineProperty(r.prototype,"noIntegrity",{get:function(){return this._vaultData.noIntegrity},enumerable:!0,configurable:!0}),r.updateVaultForUserWithId=function(t,n,i,o){if(n.data.length>r.MAX_DATA_SIZE)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"vault size can not exceed "+r.MAX_DATA_SIZE);var a=this.vaultsForUser(t,o);a[i.toString()]=n,o.host.writeStorageKey(this.getStorageKeyForVaultsForUser(t.guid),a)},r.prototype.getValidErrorRecoveryOptions=function(t){var n=[e.AuthenticationErrorCode.AppImplementation,e.AuthenticationErrorCode.Internal,e.AuthenticationErrorCode.UserCanceled],r=[e.AuthenticationErrorCode.AuthenticatorExternalConfigError,e.AuthenticationErrorCode.AuthenticatorInvalidated,e.AuthenticationErrorCode.AuthenticatorLocked];if(n.indexOf(t.getErrorCode())>=0)return[e.AuthenticationErrorRecovery.Fail];var i=this._vaultOwner.getValidErrorRecoveryOptions(t);return r.indexOf(t.getErrorCode())>=0&&(i=i.filter(function(t){return t!=e.AuthenticationErrorRecovery.RetryAuthenticator})),i},r.getStorageKeyForVaultsForUser=function(e){return new t.TarsusKeyPath("per_user",e.toString(),"vaults")},r.migrateIncorrectlyStoredVaultsForUserIfExists=function(e,n){var r=new t.TarsusKeyPath("per_user","user","vaults"),i=n.host.readStorageKey(r);i&&0<Object.keys(i).length&&(n.host.writeStorageKey(e,i),n.host.deleteStorageKey(r))},r.vaultsForUser=function(e,t){var n=this.getStorageKeyForVaultsForUser(e.guid),r=t.host.readStorageKey(n);return(!r||0>=Object.keys(r).length)&&(this.migrateIncorrectlyStoredVaultsForUserIfExists(n,t),r=t.host.readStorageKey(n)),r||{}},r.MAX_DATA_SIZE=1e3,r}(),n.Vault=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(e,t,r,i,o,a){return n.call(this,e,t,r,i,o,a)||this}return __extends(r,n),r.prototype.unlock=function(n,r){var i=this;return new Promise(function(o,a){i._rejectFn=a,i._completeFn=o,i._policyAction=n,i._clientContext=r;var s=t.VaultTypes[i._vaultData.type];if(!t.isAuthenticatorVaultDescriptor(s))return i._sdk.log(e.LogLevel.Error,"failed to get descriptor for vault "+i._vaultId),void a(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"failed to create authenticator session"));if(i._sdk.log(e.LogLevel.Debug,"Creating vault unlock authenticator session"),i._inputSession=i.createAuthenticatorSession(),!i._inputSession)throw e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from vault unlock authenticator session creation.");i._sdk.log(e.LogLevel.Debug,"Invoking startSession on vault unlock authenticator session"),i._inputSession.startSession(s.getAuthenticatorDescription(i._sdk),e.AuthenticatorSessionMode.Authentication,n,r),i.unlockInStartedSession()})},r.prototype.unlockInStartedSession=function(){var t=this;this._sdk.log(e.LogLevel.Debug,"Getting vault unlock input"),this._inputSession.promiseInput().then(function(n){if(!n.isControlRequest())return t._sdk.log(e.LogLevel.Debug,"Vault got authenticator input. Trying to unlock."),t.prepareToUnlock(t._inputSession,n.getResponse(),t._vaultData.data,t._policyAction,t._clientContext).then(function(){return t._sdk.log(e.LogLevel.Debug,"Unlock preparation complete."),t.isEmpty()?(t._sdk.log(e.LogLevel.Info,"Unlockling empty vault."),t._unlockedData={},!0):(t._sdk.log(e.LogLevel.Debug,"Decrypting vault."),t.internalDataDecrypt(t._vaultData.data).then(function(n){return t._unlockedData=t.jsonFromDecryptedHexString(n),t._sdk.log(e.LogLevel.Info,"Vault unlocked."),!0}))}).then(function(e){t._inputSession.endSession(),t._completeFn(e)});t._sdk.log(e.LogLevel.Debug,"Vault unlock: received control request "+n.getControlRequest()),t.processControlRequest(n.getControlRequest())}).catch(function(n){var r=e.impl.AuthenticationErrorImpl.ensureAuthenticationError(n);t._sdk.log(e.LogLevel.Error,r.getMessage()),t.handleLocalDecryptError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(r))})},r.prototype.handleLocalDecryptError=function(t){var n=this,r=this.getValidErrorRecoveryOptions(t),i=r.indexOf(e.AuthenticationErrorRecovery.RetryAuthenticator)>=0?e.AuthenticationErrorRecovery.RetryAuthenticator:e.AuthenticationErrorRecovery.Fail;this._inputSession.promiseRecoveryForError(t,r,i).then(function(i){switch(i){case e.AuthenticationErrorRecovery.RetryAuthenticator:n.unlockInStartedSession();break;case e.AuthenticationErrorRecovery.Fail:n._inputSession.endSession(),n._rejectFn(t);break;case e.AuthenticationErrorRecovery.ChangeAuthenticator:if(r.indexOf(e.AuthenticationErrorRecovery.ChangeAuthenticator)>-1){n._inputSession.endSession(),n._completeFn(!1);break}default:n._inputSession.endSession(),n._rejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"recovery option choice was not offered"))}})},r.prototype.processControlRequest=function(t){switch(this._sdk.log(e.LogLevel.Debug,"Processing control request "+t.getRequestType()),t.getRequestType()){case e.ControlRequestType.AbortAuthentication:this._inputSession.endSession(),this._rejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Authentication cancelled due to abort control request."));case e.ControlRequestType.ChangeMethod:this._inputSession.endSession(),this._completeFn(!1);break;case e.ControlRequestType.CancelAuthenticator:this.invokeUiHandlerCancellation();break;case e.ControlRequestType.RetryAuthenticator:this.unlockInStartedSession();break;default:this._inputSession.endSession(),this._rejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid ControlRequestType value during authentication session."))}},r.prototype.invokeUiHandlerCancellation=function(){var t=this,n=this._vaultOwner.getValidCancelOptions();null==n?(this._inputSession.endSession(),this._rejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Authentication cancelled due to abort control request."))):this._uiHandler.controlOptionForCancellationRequestInSession(n,this._inputSession).then(function(n){n.getRequestType()==e.ControlRequestType.CancelAuthenticator?(t._inputSession.endSession(),t._rejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"controlOptionForCancellationRequestInSession returned CancelAuthenticator which is an invalid option."))):t.processControlRequest(n)})},r}(t.Vault);t.AuthenticatorVault=n;var r=function(){function t(e,t){this._type=e,this._name=t}return t.prototype.getAuthenticatorId=function(){return this._name},t.prototype.getName=function(){return this._name},t.prototype.getType=function(){return this._type},t.prototype.getSupportedOnDevice=function(){return!0},t.prototype.getRegistrationStatus=function(){return e.AuthenticatorRegistrationStatus.Registered},t.prototype.getDefaultAuthenticator=function(){return!1},t.prototype.getRegistered=function(){return!0},t.prototype.getExpired=function(){return!1},t.prototype.getLocked=function(){return!1},t.prototype.getEnabled=function(){return!0},t}();t.AuthenticatorVaultDescription=r})((t=e.core||(e.core={})).vault||(t.vault={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.fidoclient||(n.fidoclient={}),i=function(r){function i(e,t,n,i,o,a){return r.call(this,e,t,n,i,o,a)||this}return __extends(i,r),Object.defineProperty(i.prototype,"aaid",{get:function(){return"1206#0002"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"authenticatorVersion",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"signCounter",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"regCounter",{get:function(){return 0},enumerable:!0,configurable:!0}),i.prototype.keyTag=function(e,t){return new n.TarsusKeyPath("per_user",e.guid.toString(),"fido_authenticators",this.aaid,t)},i.prototype.startAuthenticationSession=function(e){if(r.prototype.startAuthenticationSession.call(this,e),this._fpSession=this._uiHandler.createFingerprintAuthSession(n.authenticationdrivers.AuthenticationDriverDescriptorFingerprint.authenticatorName,this._user.displayName),!this._fpSession)throw t.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createFingerprintAuthSession.");this._fpSession.startSession(this._authenticationDescription,e,this._action,this._clientContext)},i.prototype.finishAuthenticationSession=function(){this._fpSession&&(this._fpSession.endSession(),this._fpSession=null)},i.prototype.signHexWithKeyPair=function(n,r){var i=this;return n.signHex(r).catch(function(o){if(o.getData()[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorWrongBiometric||o.getData()[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricOsLockTemporary)return i._sdk.log(t.LogLevel.Debug,"FIDO signing received a wrong biometric error; retrying authentication."),i.signHexWithKeyPair(n,r);throw i._sdk.log(t.LogLevel.Debug,"FIDO signing received an error: "+o+". Propagating."),o})},i.prototype.prepareKeyPairBio=function(e){var n=this;try{return this._fpSession?this._fpSession.promiseInput().then(function(r){if(!r.isControlRequest()){var i=r.getResponse();return e.setBiometricPromptInfo(i.getPrompt(),"",n._uiHandler,n._fpSession),e}switch(r.getControlRequest().getRequestType()){case t.ControlRequestType.CancelAuthenticator:throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.UserCanceled,"User cancelled authentication");default:throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Unsupported control code when running fingerprint session within FIDO: "+r.getControlRequest().getRequestType())}}):Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to prepare key biometrics without an existing FP session"))}catch(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},i.prototype.generateKeyPair=function(t,n,r){var i=this;return this._sdk.host.generateKeyPair(this.keyTag(r,t),e.sdkhost.KeyClass.FidoECCSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb,!0).then(function(e){return i.prepareKeyPairBio(e)})},i.prototype.deleteKeyPair=function(e,t,n){var r=this;return new Promise(function(t,i){r._sdk.host.deleteKeyPair(r.keyTag(n,e))})},i.prototype.loadKeyPair=function(t,n,r){var i=this;return new Promise(function(n,o){var a=i._sdk.host.getKeyPair(i.keyTag(r,t),e.sdkhost.KeyClass.FidoECCSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);i.prepareKeyPairBio(a).then(n,o)})},i}(r.SimpleFidoAuthenticator),r.FidoAuthenticatorFingerprint=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.fidoclient||(n.fidoclient={}),i=function(r){function i(e,t,n,i,o,a){return r.call(this,e,t,n,i,o,a)||this}return __extends(i,r),Object.defineProperty(i.prototype,"aaid",{get:function(){return"1206#0003"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"authenticatorVersion",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"signCounter",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"regCounter",{get:function(){return 0},enumerable:!0,configurable:!0}),i.prototype.keyTag=function(e,t){return new n.TarsusKeyPath("per_user",e.guid.toString(),"fido_authenticators",this.aaid,t)},i.prototype.startAuthenticationSession=function(e){if(r.prototype.startAuthenticationSession.call(this,e),this._nfSession=this._uiHandler.createNativeFaceAuthSession(n.authenticationdrivers.AuthenticationDriverDescriptorNativeFace.authenticatorName,this._user.displayName),!this._nfSession)throw t.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createNativeFaceAuthSession.");this._nfSession.startSession(this._authenticationDescription,e,this._action,this._clientContext)},i.prototype.finishAuthenticationSession=function(){this._nfSession&&(this._nfSession.endSession(),this._nfSession=null)},i.prototype.signHexWithKeyPair=function(n,r){var i=this;return n.signHex(r).catch(function(o){if(o.getData()[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorWrongBiometric||o.getData()[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricOsLockTemporary)return i._sdk.log(t.LogLevel.Debug,"FIDO signing received a wrong biometric error; retrying authentication."),i.signHexWithKeyPair(n,r);throw i._sdk.log(t.LogLevel.Debug,"FIDO signing received an error: "+o+". Propagating."),o})},i.prototype.prepareKeyPairBio=function(e){var n=this;try{return this._nfSession?this._nfSession.promiseInput().then(function(r){if(!r.isControlRequest()){var i=r.getResponse();return e.setBiometricPromptInfo(i.getPrompt(),"",n._uiHandler,n._nfSession),e}switch(r.getControlRequest().getRequestType()){case t.ControlRequestType.CancelAuthenticator:throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.UserCanceled,"User cancelled authentication");default:throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Unsupported control code when running fingerprint session within FIDO: "+r.getControlRequest().getRequestType())}}):Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to prepare key biometrics without an existing NF session"))}catch(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},i.prototype.generateKeyPair=function(t,n,r){var i=this;return this._sdk.host.generateKeyPair(this.keyTag(r,t),e.sdkhost.KeyClass.FidoECCSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb,!0).then(function(e){return i.prepareKeyPairBio(e)})},i.prototype.deleteKeyPair=function(e,t,n){var r=this;return new Promise(function(t,i){r._sdk.host.deleteKeyPair(r.keyTag(n,e))})},i.prototype.loadKeyPair=function(t,n,r){var i=this;return new Promise(function(n,o){var a=i._sdk.host.getKeyPair(i.keyTag(r,t),e.sdkhost.KeyClass.FidoECCSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);i.prepareKeyPairBio(a).then(n,o)})},i}(r.SimpleFidoAuthenticator),r.FidoAuthenticatorNativeFace=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i,o;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.fidoclient||(n.fidoclient={}),i="fidoKey",o=function(r){function o(e,t,n,i,o,a){return r.call(this,e,t,n,i,o,a)||this}return __extends(o,r),Object.defineProperty(o.prototype,"signCounter",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"regCounter",{get:function(){return 0},enumerable:!0,configurable:!0}),o.prototype.getValidCancelOptions=function(){return null},o.prototype.getValidErrorRecoveryOptions=function(e){return[t.AuthenticationErrorRecovery.RetryAuthenticator,t.AuthenticationErrorRecovery.Fail]},o.prototype.deleteKeyPair=function(e,t,r){var i=this;return new Promise(function(t,r){n.vault.Vault.deleteVaultForUserWithId(i._user,i.vaultId(e),i._sdk),t()})},o.prototype.vaultId=function(e){return new n.TarsusKeyPath("fido_authenticators",this.aaid,e)},o.prototype.generateKeyPair=function(r,o,a){var s=this;return this._sdk.host.generateKeyPairExternalRepresentation(e.sdkhost.KeyClass.FidoECCSigningKey).then(function(o){var c=s.vaultId(r);s._sdk.log(t.LogLevel.Debug,"Deleting existing vault");try{n.vault.Vault.deleteVaultForUserWithId(a,c,s._sdk)}catch(e){}return s._sdk.log(t.LogLevel.Debug,"Creating new vault"),s.authenticatorVaultDescriptor().createNew(a,c,s,s._sdk,s._uiHandler).then(function(e){return e.unlock(s._action,s._clientContext).then(function(n){if(n)return s._sdk.log(t.LogLevel.Debug,"Updating key in vault"),e.writeVaultKey(i,o).then(function(){return e.lock()});throw s._sdk.log(t.LogLevel.Error,"Aborting vault-based FIDO registration due to unlockResult == false"),new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorError,"Could not unlock vault for registration")})}).then(function(){return s._sdk.host.importVolatileKeyPair(e.sdkhost.KeyClass.FidoECCSigningKey,o)})})},o.prototype.loadKeyPair=function(r,o,a){var s=this;return new Promise(function(o,c){s._sdk.log(t.LogLevel.Debug,"Tarsus FIDO authenticator load key material from vault");var u=n.vault.Vault.getVaultForUserWithId(a,s.vaultId(r),s,s._sdk,s._uiHandler);u.unlock(s._action,s._clientContext).then(function(e){if(!e)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorError,"Unable to unlock authenticator.");s._sdk.log(t.LogLevel.Debug,"Tarsus FIDO authenticator vault unlocked");var n=u.readVaultKey(i);return s._sdk.log(t.LogLevel.Debug,"Tarsus FIDO authenticator key material read"),u.lock(),s._sdk.log(t.LogLevel.Debug,"Tarsus FIDO authenticator vault locked"),n}).then(function(n){return s._sdk.log(t.LogLevel.Debug,"Tarsus FIDO authenticator key materialized"),s._sdk.host.importVolatileKeyPair(e.sdkhost.KeyClass.FidoECCSigningKey,n)}).then(o,c)})},o}(r.SimpleFidoAuthenticator),r.FidoAuthenticatorVaultBased=o}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t,n;t=e.fidoclient||(e.fidoclient={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),Object.defineProperty(n.prototype,"aaid",{get:function(){return"1206#0001"},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"authenticatorVersion",{get:function(){return 1},enumerable:!0,configurable:!0}),n.prototype.authenticatorVaultDescriptor=function(){return e.vault.VaultTypes.password},n}(t.FidoAuthenticatorVaultBased),t.FidoAuthenticatorPin=n}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.FidoAuthenticators={"1206#0001":new e.SimpleFidoAuthenticatorDescriptor(e.FidoAuthenticatorPin),"1206#0002":new e.FidoAuthenticatorDescriptorFingerprint,"1206#0003":new e.FidoAuthenticatorDescriptorNativeFace}}(e.fidoclient||(e.fidoclient={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){function t(e){return!!e.tlvSerializable}function n(n,r){var i=[];return Object.keys(r).forEach(function(o){var a=n[o];if(!a)throw"TLV encoding error: Unknown tag "+o;var s=r[o];s instanceof Array||(s=[s]),s.forEach(function(r){var s=r.__type||a.tagType||t(r)&&e.TlvTypes.Serializable;if(!s)throw"Unknown type for tag "+o;r.__type&&(r=r.__value);var c=s(r,n);i.push(e.TlvTypes.UInt16(a.id)),i.push(e.TlvTypes.UInt16(c.length/2)),i.push(c)})}),i.join("")}e.instanceOfTlvSerializable=t,e.TlvTypes={UInt8:function(t){return e.numberToHex(t,8)},UInt16:function(t){return e.numberToHex(t>>8&255|(255&t)<<8,16)},UInt32:function(t){return e.numberToHex((255&t)<<24|(t>>8&255)<<16|(t>>16&255)<<8|t>>24&255,32)},Object:function(e,t){return n(t,e)},Serializable:function(e,t){return e.tlvSerialize(t)},String:function(t,n){return e.asciiToHex(t)},HexBinary:function(e,t){return e},Struct:function(e){return function(t,n){var r=[];return Object.keys(e).forEach(function(i){if(i in t){var o=t[i],a=e[i];r.push(a(o,n))}}),r.join("")}}},e.tlvEncodeHex=n}(e.util||(e.util={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){t.ALG_SIGN_SECP256R1_ECDSA_SHA256_RAW=1,t.ALG_KEY_ECC_X962_RAW=256,t.FidoTLVTags={TAG_UAFV1_REG_ASSERTION:{id:15873,tagType:e.util.TlvTypes.Object},TAG_UAFV1_AUTH_ASSERTION:{id:15874,tagType:e.util.TlvTypes.Object},TAG_UAFV1_KRD:{id:15875,tagType:e.util.TlvTypes.Object},TAG_UAFV1_SIGNED_DATA:{id:15876,tagType:e.util.TlvTypes.Object},TAG_ATTESTATION_BASIC_SURROGATE:{id:15880,tagType:e.util.TlvTypes.Object},TAG_SIGNATURE:{id:11782,tagType:e.util.TlvTypes.HexBinary},TAG_KEYID:{id:11785,tagType:e.util.TlvTypes.HexBinary},TAG_FINAL_CHALLENGE_HASH:{id:11786,tagType:e.util.TlvTypes.HexBinary},TAG_AAID:{id:11787,tagType:e.util.TlvTypes.String},TAG_PUB_KEY:{id:11788,tagType:e.util.TlvTypes.HexBinary},TAG_COUNTERS:{id:11789,tagType:e.util.TlvTypes.Struct({SignCounter:e.util.TlvTypes.UInt32,RegCounter:e.util.TlvTypes.UInt32})},TAG_ASSERTION_INFO:{id:11790,tagType:e.util.TlvTypes.Struct({AuthenticatorVersion:e.util.TlvTypes.UInt16,AuthenticationMode:e.util.TlvTypes.UInt8,SignatureAlgAndEncoding:e.util.TlvTypes.UInt16,PublicKeyAlgAndEncoding:e.util.TlvTypes.UInt16})},TAG_AUTHENTICATOR_NONCE:{id:11791,tagType:e.util.TlvTypes.HexBinary},TAG_TRANSACTION_CONTENT_HASH:{id:11792,tagType:e.util.TlvTypes.HexBinary}}})((t=e.core||(e.core={})).fidoclient||(t.fidoclient={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n;!function(e){e[e.Reg=1]="Reg",e[e.Auth=2]="Auth",e[e.Dereg=3]="Dereg"}(n||(n={}));var r=function(e,t){this.aaid=e,this.keyId=t||null},i=function(){function e(e){var t=this;if(!e)throw"Missing policy.";if(e.rejected)throw"Unsupported policy 'rejected'";this._acceptedAuths=[],e.accepted.forEach(function(e){if(1==e.length){var n=null,i=null,o=!1,a=Object.keys(e[0]);for(var s in a)switch(a[s]){case"aaid":n=e[0].aaid;break;case"keyIDs":i=e[0].keyIDs;break;default:o=!0}if(o)return;if(!n)return;var c=i||[null];n.forEach(function(e){c.forEach(function(n){t._acceptedAuths.push(new r(e,n))})})}})}return Object.defineProperty(e.prototype,"acceptedAuths",{get:function(){return this._acceptedAuths},enumerable:!0,configurable:!0}),e}(),o=function(){function t(t){try{if(1!=t.header.upv.major||0!=t.header.upv.minor&&1!=t.header.upv.minor)throw"Invalid FIDO protocol version "+t.header.upv.major+"."+t.header.upv.minor;var r=t.header.op;if(this._operation=n[r],!this._operation)throw"Invalid FIDO protocol op "+t.header.op;if(this._appId=t.header.appID,!this._appId)throw"Missing appID";this._serverData=t.header.serverData,this._challenge=t.challenge,this._username=t.username;var o=t.policy;if(!o&&t.authenticators){var a=[];t.authenticators.forEach(function(e){a.push([{aaid:[e.aaid]}])}),o={accepted:a}}o&&(this._policy=new i(o)),this._header=t.header}catch(n){throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Cannot parse FIDO request ["+JSON.stringify(t)+"]: "+n,{fidoRequest:t,reason:n.toString()})}}return Object.defineProperty(t.prototype,"policy",{get:function(){return this._policy},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"challenge",{get:function(){return this._challenge},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"username",{get:function(){return this._username},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"operation",{get:function(){return this._operation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"header",{get:function(){return this._header},enumerable:!0,configurable:!0}),t.prototype.createFinalChallenge=function(){if(!this.challenge)throw"Missing challenge";var e={appID:this.appId,challenge:this.challenge,facetID:this.appId,channelBinding:{}};return btoa(JSON.stringify(e))},t}(),a=function(){function r(e){this._sdk=e}return Object.defineProperty(r.prototype,"sdk",{get:function(){return this._sdk},enumerable:!0,configurable:!0}),r.prototype.fidoResponseWithUaf1TlvAssertion=function(e,t,n){return{header:e.header,fcParams:t,assertions:[{assertion:n,assertionScheme:"UAFV1TLV"}]}},r.prototype.fidoClientXactReg=function(n,r){var i=this;return new Promise(function(o,a){if(!n.username)throw"Missing username in client registration request";if(!n.challenge)throw"Missing challenge";var s=n.createFinalChallenge();i._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client ready for registration action"),r.fidoRegisterWithHexUaf1TlvResponse(n.appId,s,t.FidoTLVTags.TAG_ATTESTATION_BASIC_SURROGATE.id).then(function(t){i._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator done succesfully"),o(i.fidoResponseWithUaf1TlvAssertion(n,s,t))},a)})},r.prototype.fidoClientXactDereg=function(t,n){var r=this;return new Promise(function(i,o){r._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client ready for deregistration action"),n.fidoDeregister(t.appId).then(function(){r._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator done succesfully"),i({})},o)})},r.prototype.fidoClientXactAuth=function(n,r){var i=this;return new Promise(function(o,a){if(!n.challenge)throw"Missing challenge";var s=n.createFinalChallenge();i._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client ready for authentication action"),r.fidoAuthenticateWithHexUaf1TlvResponse(n.appId,s,t.FidoTLVTags.TAG_ATTESTATION_BASIC_SURROGATE.id).then(function(t){i._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator done succesfully"),o(i.fidoResponseWithUaf1TlvAssertion(n,s,t))},a)})},r.prototype.fidoClientXact=function(r,i,a,s,c,u){var l=this;return new Promise(function(d,h){l._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client parsing FIDO request");var p=new o(u);if(p.username&&p.username.toLowerCase()!=a.userHandle.toLowerCase())throw l._sdk.log(e.LogLevel.Error,"Tarsus FIDO client encountered FIDO request with username not matching session username."),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Tarsus FIDO client encountered FIDO request with username not matching session username.");var f=p.policy.acceptedAuths.map(function(e){return t.FidoAuthenticators[e.aaid]}).filter(function(e){return!!e});if(!f.length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Couldn't find driver for Tarsus native FIDO client request.");l._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client loading authenticator");var m=f[0].createFidoAuthenticator(r,l,a,i,s,c);l._sdk.log(e.LogLevel.Info,"Tarsus FIDO client authenticator loaded: "+m.aaid);var g=null;switch(p.operation){case n.Reg:l._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client processing registration request."),g=l.fidoClientXactReg(p,m);break;case n.Auth:l._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client processing authentication request."),g=l.fidoClientXactAuth(p,m);break;case n.Dereg:l._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client processing deregistration request."),g=l.fidoClientXactDereg(p,m);break;default:throw l._sdk.log(e.LogLevel.Error,"Unsupported FIDO Op when dispatching request: "+n[p.operation]),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unsupported FIDO op "+n[p.operation])}g.then(d,h)})},r.prototype.canHandlePolicy=function(e){var n=this;return new i(e).acceptedAuths.filter(function(e){return t.FidoAuthenticators[e.aaid]&&t.FidoAuthenticators[e.aaid].isAuthenticatorSupportedOnDevice(n)}).length>0},r.isPolicyTransmitFidoClientExclusive=function(e){return 0==new i(e).acceptedAuths.filter(function(e){return!t.FidoAuthenticators[e.aaid]}).length},r}();t.TarsusFidoClient=a})((t=e.core||(e.core={})).fidoclient||(t.fidoclient={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r=function(){function e(e,t,n,r,i){this._countdownTask=new s(t,n,r,1e3,i)}return e.prototype.promiseCodeGeneration=function(e){return this._countdownTask.run(e)},e}();n.TotpCodeGeneratorTimeBased=r;var i=function(){function e(n,r){if(n<1)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"timeStamp must be positive: "+n);e.assertValidTime(r),this._timeStep=n,this._startTime=r}return e.assertValidTime=function(e){if(e<0)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Negative time: "+e)},Object.defineProperty(e.prototype,"timeStep",{get:function(){return this._timeStep},enumerable:!0,configurable:!0}),e.prototype.getValueAtTime=function(t){e.assertValidTime(t);var n=t-this._startTime;return n>=0?Math.floor(n/this._timeStep):Math.floor((n-(this._timeStep-1))/this._timeStep)},e.prototype.getValueStartTime=function(e){return this._startTime+e*this._timeStep},e}(),o=function(){function e(e,t){this._sdk=t,this._hexElement=e}return e.prototype.sign=function(e){return this._sdk.host.calcHexStringEncodedHmacSha1HashWithHexEncodedKey(this._hexElement,e)},e}(),a=function(){function e(n,r){if(r<0||r>e.MAX_PASSCODE_LENGTH)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"PassCodeLength must be between 1 and "+e.MAX_PASSCODE_LENGTH+" digits.");this._signer=n,this._codeLength=r}return e.prototype.generateResponseCode=function(e,t){var n=t&&t.length||0,r=new ArrayBuffer(8+n),i=new DataView(r);if(i.setUint32(0,4294967295&Math.floor(e/4294967296)),i.setUint32(4,4294967295&e),t)for(var o=0;o<n;o++)i.setUint8(o+8,t.charCodeAt(o));return this.generateResponseCodeForByteArray(i)},e.prototype.generateResponseCodeForByteArray=function(e){for(var t="",n=0;n<e.byteLength;n++){var r=e.getUint8(n).toString(16);r.length<2&&(r="0"+r),t+=r}var i=this._signer.sign(t),o=parseInt(i[i.length-1],16),a=i.substring(2*o,2*o+8),s=(2147483647&parseInt(a,16))%Math.pow(10,this._codeLength);return this.padOutput(s)},e.prototype.padOutput=function(e){for(var t=e.toString(),n=t.length;n<this._codeLength;n++)t="0"+t;return t},e.MAX_PASSCODE_LENGTH=9,e.PASS_CODE_LENGTH=6,e.ADJACENT_INTERVALS=1,e.DIGITS_POWER=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9],e}(),s=function(){function n(e,t,n,r,s){this._lastSeenCounterValue=0x8000000000000000,this._counter=new i(t,0),this._generator=new a(new o(n,s),e),this._remainingTimeNotificationPeriod=r,this._sdk=s}return n.prototype.run=function(n){this._sdk.log(t.LogLevel.Debug,"Genearting a TOTP code.");var r=this._sdk.host.getCurrentTime(),i=this.getCounterValue(r);this._lastSeenCounterValue!=i&&(this._lastSeenCounterValue=i,this.fireTotpCounterValueChanged(n)),this._sdk.log(t.LogLevel.Debug,"Notifying session of TOTP value and countdown"),r=this._sdk.host.getCurrentTime();var o=this.getCounterValueAge(r),a=this._remainingTimeNotificationPeriod-o%this._remainingTimeNotificationPeriod;return Promise.resolve(e.tarsusplugin.TotpCodeGenerationOutput.create(this._mCode,null,this._counter.timeStep,Math.floor(this.getTimeTillNextCounterValue(r)/1e3),a,!1,null))},n.prototype.fireTotpCounterValueChanged=function(e){var t=Math.floor(this._sdk.host.getCurrentTime()/1e3),n=this._counter.getValueAtTime(t);this._mCode=this._generator.generateResponseCode(n,e)},n.prototype.getTimeTillNextCounterValue=function(e){var t=this.getCounterValue(e)+1;return 1e3*this._counter.getValueStartTime(t)-e},n.prototype.getCounterValue=function(e){return this._counter.getValueAtTime(Math.floor(e/1e3))},n.prototype.getCounterValueAge=function(e){return e-1e3*this._counter.getValueStartTime(this.getCounterValue(e))},n}()}((n=t.core||(t.core={})).totp||(n.totp={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;!function(e){var n,r,i;n=e.core||(e.core={}),r=n.totp||(n.totp={}),i=function(){function r(e,t,r){this._generatorName=e,this._user=t,this._sdk=r,this._vaultId=new n.TarsusKeyPath("totp_properties",this._generatorName)}return r.prototype.promiseProvisionOutput=function(e,t,n,r){var i=this;return this._isProvisioning=!0,this.createProvisionOutput(e,t,n,r).then(function(o){return i.selectAndCreateVault(o.getSecretToLock(),e,t,n,r).then(function(){return o.getUnprotectedProvisionOutput()})})},r.prototype.promiseCodeGenerator=function(t,n,r,i){var o=this;return this._isProvisioning=!1,this.unlockOtpSecret(i,r).then(function(a){return o._sdk.log(e.LogLevel.Debug,"generating TOTP session"),o.createCodeGenerator(t,n,a,r,i)})},r.prototype.updateProtectedProperties=function(t){return"string"==typeof t&&this._unlockedVault?this._unlockedVault.writeVaultKey(this.elementVaultKey,t):Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"could not update protected properties for generator <"+this._generatorName+">"))},r.prototype.deprovision=function(){n.vault.Vault.deleteVaultForUserWithId(this._user,this._vaultId,this._sdk)},r.prototype.unlockOtpSecret=function(t,r){var i=this;return new Promise(function(r){i._sdk.log(e.LogLevel.Debug,"Getting TOTP vault"),r(n.vault.Vault.getVaultForUserWithId(i._user,i._vaultId,i,i._sdk,t))}).catch(function(t){return i._sdk.log(e.LogLevel.Error,"Error obtaining vault for TOTP <"+i._user.displayName+", "+i._generatorName+">: "+t),Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.TotpNotProvisioned,"Totp generator '"+i._generatorName+"' for user '"+i._user.displayName+"' isn't provisioned",{underlying_error:t.toString()}))}).then(function(t){return i._sdk.log(e.LogLevel.Info,"Unlocking vault for TOTP seed"),t.unlock(null,r).then(function(n){if(!n)throw i._sdk.log(e.LogLevel.Error,"Change authetnicator requested during vault unlock for TOTP"),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"change authenticator isn't possible here");i._sdk.log(e.LogLevel.Debug,"TOTP Vault unlocked");var r=t.readVaultKey(i.elementVaultKey);return i._unlockedVault=t,i._sdk.log(e.LogLevel.Debug,"TOTP Vault locked"),r})})},r.prototype.getValidErrorRecoveryOptions=function(t){var n=[e.AuthenticationErrorRecovery.Fail,e.AuthenticationErrorRecovery.RetryAuthenticator];return this._isProvisioning&&this._availableAuthenticators.length>1&&n.push(e.AuthenticationErrorRecovery.ChangeAuthenticator),n},r.prototype.getValidCancelOptions=function(){var t=[e.ControlRequestType.RetryAuthenticator,e.ControlRequestType.AbortAuthentication];return this._isProvisioning&&this._availableAuthenticators.length>1&&t.push(e.ControlRequestType.ChangeMethod),t},r.prototype.getAvailableAuthenticators=function(e){var r=this,i=new Array;return Object.keys(n.vault.VaultTypes).forEach(function(e){var o=n.vault.VaultTypes[e];if(n.vault.isAuthenticatorVaultDescriptor(o)){var a=o.getAuthenticatorDescription(r._sdk);a.getSupportedOnDevice()&&i.push(new t.impl.AuthenticationOptionImpl(a,[]))}}),i=i.filter(function(t){return-1!==e.indexOf(t.getAuthenticator().getName())})},r.prototype.selectAndCreateVault=function(t,n,r,i,o){var a,s=this;if(n.protection_method){var c=this.getAvailableAuthenticators(n.protection_method);this._availableAuthenticators=c,this._sdk.log(e.LogLevel.Debug,"Selecting authenticator vault"),a=1<this._availableAuthenticators.length?o.selectAuthenticator(this._availableAuthenticators,r,i).then(function(t){switch(t.getResultType()){case e.AuthenticatorSelectionResultType.Abort:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Cancel during authenticator selection.");case e.AuthenticatorSelectionResultType.SelectAuthenticator:if(t.getSelectedAuthenticationParameters().length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Authentication parameters not allowed in vault.");return t.getSelectedAuthenticator().getName()}}):Promise.resolve(this._availableAuthenticators[0].getAuthenticator().getName())}else{if(!n.vault)return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"failed to parse TOTP protection type"));var u=n.vault.vault_type;this._sdk.log(e.LogLevel.Debug,"Using '"+u+"' vault"),a=Promise.resolve(u)}return a.then(function(e){return s.createAndWriteToVault(e,t,n,o,r,i)})},r.prototype.createAndWriteToVault=function(t,r,i,o,a,s){var c=this,u=n.vault.VaultTypes[t];if(!u)return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unhandled protection method "+t));var l=u.supportsNoIntegrity()&&i.integrity_protection_disabled;return u.createNew(this._user,this._vaultId,this,this._sdk,o,l,i).then(function(e){return e.unlock(a,s).then(function(t){return t?e.writeVaultKey(c.elementVaultKey,r).then(function(){e.lock()}):c.selectAndCreateVault(r,i,a,s,o)})})},Object.defineProperty(r.prototype,"elementVaultKey",{get:function(){return n.vault.Vault.noIntegrityElementKey},enumerable:!0,configurable:!0}),r}(),r.TotpDriverVaultBased=i}(t=e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.createCodeGenerator=function(e,t,n,r,i){return Promise.resolve(new o(e,n,this._sdk))},n.prototype.createProvisionOutput=function(t,n,r,o){return Promise.resolve(e.tarsusplugin.VaultBasedTotpProvisionOutput.create(t.ec_private_key||"",new i))},n.create=function(e,t,r){return new n(e,t,r)},n}(n.TotpDriverVaultBased);n.TotpDriverEc=r;var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.finalize=function(e){},t}(e.tarsusplugin.TotpProvisionOutput),o=function(){function n(e,r,i){this._sdk=i,this._sdk.log(t.LogLevel.Debug,"Construct EC OTP Code generator"),this._codeLen=e,n._ec||(n._ec=new elliptic.ec("p256"),this._sdk.log(t.LogLevel.Debug,"EC Loaded"));var o=t.util.base64ToHex(r),a=o.substring(o.length-64,o.length);this._keypair=n._ec.keyFromPrivate(a),this._sdk.log(t.LogLevel.Debug,"Private key parsed")}return n.prototype.promiseCodeGeneration=function(r){if(this._sdk.log(t.LogLevel.Debug,"Start generate EC OTP Code"),!r)return Promise.reject(t.impl.AuthenticationErrorImpl.appImplementationError("EC OTP generation requries a challenge."));var i=n._ec.keyFromPublic(atob(r));this._sdk.log(t.LogLevel.Debug,"Challenge parsed");var o=this._keypair.derive(i.getPublic()).toArray("be");o.push(0,0,0,1),o.push.apply(o,atob(r).split("").map(function(e){return e.charCodeAt(0)}));var a=o.map(function(e){return t.util.numberToHex(e,8)}).join(""),s=this._sdk.host.calcHexStringEncodedSha512Hash(a),c=n._ec.keyFromPrivate(parseInt("1000000000000".substring(0,1+this._codeLen),10).toString(16)).getPrivate(),u=2*(15&parseInt(s.substring(s.length-1),16)),l=s.substring(u,u+16);l=(127&parseInt(l.substring(0,2),16)).toString(16)+l.substring(2);var d=n._ec.keyFromPrivate(l).getPrivate().mod(c).toString(10,this._codeLen);return Promise.resolve(e.tarsusplugin.TotpCodeGenerationOutput.create(d,null,-1,-1,-1,!1,null))},n}()}((n=t.core||(t.core={})).totp||(n.totp={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.totp||(n.totp={}),i=function(i){function o(){return null!==i&&i.apply(this,arguments)||this}return __extends(o,i),o.prototype.otpSecretToLock=function(r){var i=this;return new Promise(function(o,a){var s=n.User.findUser(i._sdk,i._user.userHandle);if(s){var c=i._sdk.host.getKeyPair(s.deviceEncryptionKeyTag,e.sdkhost.KeyClass.StdEncryptionKey,e.sdkhost.KeyBiometricProtectionMode.None);if(!c)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"failed to find device encryption key for <"+i._user.displayName+">");var u=t.util.base64ToHex(r.shared_key);o(c.decrypt(u))}else a(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"failed to find user record for <"+i._user.displayName+">"))})},o.prototype.createCodeGenerator=function(e,t,n,i,o){return Promise.resolve(new r.TotpCodeGeneratorTimeBased(this,e,t.ttl,n,this._sdk))},o.prototype.createProvisionOutput=function(t,n,i,o){var a={ttl:t.ttl};return this.otpSecretToLock(t).then(function(t){var n=r.TotpProvisionOutputTimeBased.create(null,a);return e.tarsusplugin.VaultBasedTotpProvisionOutput.create(t,n)})},o.create=function(e,t,n){return new o(e,t,n)},o.transformOldToNewDataForUser=function(e){return{ttl:e.ttl}},o}(r.TotpDriverVaultBased),r.TotpDriverTimeBased=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.totp||(e.totp={}),n={totp:{create:t.TotpDriverTimeBased.create},ecotp:{create:t.TotpDriverEc.create}},r=function(){function r(){}return r.driverForTypeName=function(e,r,i,o){var a,s;if(this._extensionPoint.forEach(function(t){a||e!=t.getTotpTypeName()||(a=t)}),a)return a.create(r,i.guid.toString());if(this._extensionPointForVaultBased.forEach(function(t){s||e!=t.getTotpTypeName()||(s=t)}),s){var c=s.create(r,i.guid.toString());return new t.VaultBasedTotpDriverProxy(c,r,i,o)}var u=n[e];return u&&u.create(r,i,o)},r._extensionPoint=new e.ExtensionPoint("com.ts.mobile.plugins.totp"),r._extensionPointForVaultBased=new e.ExtensionPoint("com.ts.mobile.plugins.totp.vault"),r}(),t.TotpDrivers=r}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.totp||(t.totp={}),r=function(){function r(r,i,o,a){if(this._user=r,this._shouldStopCodeGen=!0,this._sdk=i,this._uiHandler=i.currentUiHandler,this._clientContext=a,this._session=o,this._sdk.log(e.LogLevel.Debug,"Loading TOTP processors for user "+r.displayName),this._propertiesContainer=this._sdk.host.readStorageKey(this.totpPropertiesContainerStorageKey),"v0"!=this._propertiesContainer.version){this._sdk.log(e.LogLevel.Debug,"Creating TOTP records for user "+this._user.displayName),this._propertiesContainer.properties={};var s=new t.TarsusKeyPath("per_user",this._user.guid.toString(),"totp_properties","default"),c=this._sdk.host.readStorageKey(s);if(0<Object.keys(c).length){if(this._user.deviceBound){this._sdk.log(e.LogLevel.Debug,"Migrating TOTP records for default TOTP generator for user "+this._user.displayName);var u={type:"totp",length:c.length,provision_id:this.provisionIdForGenerator("default"),specific_data:n.TotpDriverTimeBased.transformOldToNewDataForUser(c)};this._propertiesContainer.properties.default=u,this._sdk.log(e.LogLevel.Debug,"Updating storage on migration"),this.updateStorage()}else this._sdk.log(e.LogLevel.Warning,"Migration of TOTP records for user "+this._user.displayName+" can not be perfomed (user not bound)");this._sdk.log(e.LogLevel.Debug,"Deleting old TOTP records storage key"),this._sdk.host.deleteStorageKey(s)}this._propertiesContainer.version="v0",this.updateStorage()}}return Object.defineProperty(r.prototype,"totpPropertiesContainerStorageKey",{get:function(){return new t.TarsusKeyPath("per_user",this._user.guid.toString(),"totp")},enumerable:!0,configurable:!0}),r.prototype.isTotpProvisionedForGenerator=function(e){return!!this._propertiesContainer.properties[e]},r.prototype.updateWithProvisionedGenerator=function(e,t){var n={type:e.otp_type,length:e.length,add_check_digit:e.add_check_digit,provision_id:this.provisionIdForGenerator(e.generator)};t.getStoredData()&&(n.specific_data=t.getStoredData()),this._propertiesContainer.properties[e.generator]=n,this.updateStorage()},r.prototype.deleteProvisionForGenerator=function(e){var t=this.getTotpDriver(e);t&&(delete this._propertiesContainer.properties[e],this.updateStorage(),t.deprovision())},r.prototype.deleteAllProvisions=function(){var t=this,n=new Array;Object.keys(this._propertiesContainer.properties).forEach(function(r){var i=t.getTotpDriver(r);i?n.push(i):t._sdk.log(e.LogLevel.Error,"Failed to delete TOTP provisioning for "+r)}),this._propertiesContainer.properties={},this._sdk.host.deleteStorageKey(this.totpPropertiesContainerStorageKey),n.forEach(function(n){try{n.deprovision()}catch(r){t._sdk.log(e.LogLevel.Error,"Failed to delete TOTP private resources for "+n)}})},r.prototype.createTotpDriver=function(t,r){return n.TotpDrivers.driverForTypeName(r,t,this._user,this._sdk)||(this._sdk.log(e.LogLevel.Error,"Unhandled TOTP type: "+r),null)},r.prototype.getTotpDriver=function(t){var r=this._propertiesContainer.properties[t];return r?n.TotpDrivers.driverForTypeName(r.type,t,this._user,this._sdk)||(this._sdk.log(e.LogLevel.Error,"Unhandled TOTP type: "+r.type),null):(this._sdk.log(e.LogLevel.Warning,"Failed to find TOTP provision properties for "+t),null)},r.prototype.totpRequestFromCanonicalString=function(t){var r=this,i=null,o=null;if(255==(t=atob(t)).charCodeAt(0)){var a=n.parsing.totpDataFromCanonical(t.slice(1));a&&0<a.challengesSpecs.length&&Object.keys(this._propertiesContainer.properties).some(function(e){return a.challengesSpecs.some(function(t){return 0==r._propertiesContainer.properties[e].provision_id.lastIndexOf(t.seedId,0)&&(i=t.challenge,o=e,!0)})})}else o="default",i=t;if(!i||!o)throw this._sdk.log(e.LogLevel.Warning,"Failed to find TOTP attributes in canonical string"),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Failed to find TOTP attributes in canonical string");return e.impl.TotpGenerationRequestImpl.createTotpGenerationRequest(this._user,i,o)},r.prototype.runCodeGenerationSession=function(t,n,r,i){var o=this;return new Promise(function(a,s){o._sdk.log(e.LogLevel.Info,"Run TOTP generation session");var c=o.getTotpDriver(t);if(!c)return o._sdk.log(e.LogLevel.Error,"TOTP data not found for <"+o._user.displayName+", "+t+">"),void s(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.TotpNotProvisioned,"Totp generator '"+t+"' for '"+o._user.displayName+"' isn't provisioned"));var u=o._propertiesContainer.properties[t];c.promiseCodeGenerator(u.length,u.specific_data,r,i).then(function(c){o._appCodeGenSession=i.createTotpGenerationSession(o._user.displayName,t),o._appCodeGenSession?(o._generatorName=t,o._codeGenerator=c,o._requireChallenge=n,o._codeGenCompleteFn=a,o._codeGenRejectFn=s,o._sdk.log(e.LogLevel.Debug,"Invoking TOTP client session startSession"),o._appCodeGenSession.startSession(o,null,r),o._sdk.log(e.LogLevel.Info,"TOTP client session running")):s(e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createTotpGenerationSession."))}).catch(s)})},r.prototype.runCodeGenerationSessionWithRequest=function(e,t,n){return this._codeGenDesignatedRequest=e,this.runCodeGenerationSession(e.getGeneratorName(),!1,t,n)},r.prototype.startCodeGeneration=function(){if(this._sdk.log(e.LogLevel.Debug,"Got request to start code generation."),!this._appCodeGenSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to start code generation on a finished TOTP session.");this._shouldStopCodeGen=!1,this._requireChallenge?this.startChallengeRequireCodeGeneration(this._appCodeGenSession):(this._sdk.log(e.LogLevel.Debug,"TOTP session starting code generation"),this.generateCode(this._codeGenDesignatedRequest&&this._codeGenDesignatedRequest.getChallenge()))},r.prototype.finishSession=function(){if(this._sdk.log(e.LogLevel.Debug,"TOTP session finishing"),this._shouldStopCodeGen=!0,!this._appCodeGenSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to finish a finished TOTP session.");this._appCodeGenSession.endSession(),this._appCodeGenSession=null,this._codeGenCompleteFn(!0)},r.prototype.updatedWithGeneratorSpecificProperties=function(e,t){var n=this._propertiesContainer.properties[e];return!!n&&(n.specific_data=t,this.updateStorage(),!0)},r.prototype.startChallengeRequireCodeGeneration=function(t){var n=this;this._sdk.log(e.LogLevel.Debug,"Starting TOTP challenge acquisition."),t.promiseChallengeInput().then(function(r){if(r.isControlRequest())switch(r.getControlRequest().getRequestType()){case e.ControlRequestType.AbortAuthentication:t.endSession(),n._codeGenRejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"User cancelled generation"));break;default:t.endSession(),n._codeGenRejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Unsupported control code when running TOTP challenge acquisition: "+r.getControlRequest().getRequestType()))}else n._sdk.log(e.LogLevel.Debug,"Challenge acquired successfully. Going to start generation of TOTP codes."),n.generateCode(r.getResponse().getChallenge())})},r.prototype.generateCode=function(t){var n=this;this._shouldStopCodeGen||this._codeGenerator.promiseCodeGeneration(t||null).then(function(r){var i;if(n._shouldStopCodeGen||(r.getMessage()&&n._appCodeGenSession.setMessage(r.getMessage()),i=n._propertiesContainer.properties[n._generatorName].add_check_digit?n.computeErrorControlledCode(r.getCode()):r.getCode(),n._appCodeGenSession.setTotpCode(i,r.getTimeStepSeconds(),r.getExpiresInSeconds()),0<r.getSecondsTillNextInvocation()&&n._sdk.host.createDelayedPromise(r.getSecondsTillNextInvocation()).then(function(e){n.generateCode(t)})),r.getShouldUpdateSpecificProperties()&&!n.updatedWithGeneratorSpecificProperties(n._generatorName,r.getGeneratorSpecificDataToStore()))throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"could not update generator properties <"+n._generatorName+">")}).catch(function(e){n._shouldStopCodeGen=!0,n._appCodeGenSession.endSession(),n._codeGenRejectFn(e)})},r.prototype.computeErrorControlledCode=function(e){for(var t=0,n=e.length-1;n>=0;n--){var r=Number(e[n]);(e.length-n)%2&&9<(r*=2)&&(r=r%10+1),t+=r}return e+9*t%10},r.prototype.updateStorage=function(){this._sdk.host.writeStorageKey(this.totpPropertiesContainerStorageKey,this._propertiesContainer)},r.prototype.provisionIdForGenerator=function(t){var n=e.util.asciiToHex(""+this._user.deviceId+t);return this._sdk.host.calcHexStringEncodedSha256Hash(n)},r.createWithUserHandle=function(n,i,o,a){var s=t.User.findUser(i,n);if(!s)throw i.log(e.LogLevel.Error,"Can not find user record for <"+n+">"),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Can not find user <"+n+">");return new r(s,i,o,a)},r.createWithUserHandleWithoutUIInteraction=function(n,i,o){var a=t.User.findUser(i,n);if(!a)throw i.log(e.LogLevel.Error,"Can not find user record for <"+n+">"),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Can not find user <"+n+">");return new r(a,i,o,new Object)},r.createWithUser=function(e,t,n,i){return new r(e,t,i,n)},r.createWithUserWithoutUIInteraction=function(e,t,n){return new r(e,t,n,new Object)},r.BACKWARD_COMPATIBILITY_DEFAULT_GENERATOR="default",r}(),n.TotpPropertiesProcessor=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.finalize=function(e){},t.create=function(e,n){var r=new t;return r.setAssertionData(e),r.setStoredData(n),r},t}(e.tarsusplugin.TotpProvisionOutput);t.TotpProvisionOutputTimeBased=n}(t.totp||(t.totp={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(e){function t(t,n,r,i){var o=e.call(this,n,r,i)||this;return o._underlyingDriver=t,o}return __extends(t,e),t.prototype.createCodeGenerator=function(e,t,n,r,i){return this._underlyingDriver.promiseCodeGenerator(e,n,t,r,i)},t.prototype.createProvisionOutput=function(e,t,n,r){return this._underlyingDriver.promiseProvisionOutput(e,t,n,r)},t}(e.TotpDriverVaultBased);e.VaultBasedTotpDriverProxy=t}(e.totp||(e.totp={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){!function(t){t.totpDataFromCanonical=function(t){try{var n={version:0,prefixes:[],challengesSpecs:[]},r=0;n.version=t.charCodeAt(r++);for(var i,o=t.charCodeAt(r++),a=0;a<o;a++)i=t.charCodeAt(r++),n.prefixes.push(t.slice(r,r+i)),r+=i;for(;r<t.length;){var s=t.charCodeAt(r++);i=4;var c=e.util.bytesToHex(t.slice(r,r+i));r+=i;var u=t.charCodeAt(r++);i=t.charCodeAt(r++);var l=""+n.prefixes[u]+t.slice(r,r+i);r+=i,n.challengesSpecs.push({version:s,seedId:c,challenge:l})}return n}catch(e){}return null}}(t.parsing||(t.parsing={}))})((t=e.core||(e.core={})).totp||(t.totp={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.vault||(n.vault={}),i=function(r){function i(){return null!==r&&r.apply(this,arguments)||this}return __extends(i,r),i.supportsNoIntegrity=function(){return!1},i.INCORRECT_KEY_TAG_TO_FALLBACK=function(e){return new n.TarsusKeyPath("per_user`, userId, `vault_keys",e.type,e.salt)},i.getVaultKeyTagForUser=function(e,t){return new n.TarsusKeyPath("per_user",e.toString(),"vault_keys",t.type,t.salt)},i.deletePrivateResources=function(e,n,r){r.log(t.LogLevel.Debug,"Biometric authenticator vault deleting private resources..."),r.host.deleteKeyPair(i.getVaultKeyTagForUser(e.guid,n))},i.prototype.translateBiometricInternalError=function(e){if(e.getErrorCode()==t.AuthenticationErrorCode.Internal&&e.getData()){var n=e.getData();return t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(n,this.biometricType)||e}return e},i.prototype.prepareToUnlock=function(n,r,o,a,s){var c=this;return new Promise(function(o,a){var s,u=i.getVaultKeyTagForUser(c._user.guid,c._vaultData);c.isEmpty()?(c._sdk.log(t.LogLevel.Debug,"Generating a new key for empty "+c.biometricType+" vault."),s=t.util.wrapPromiseWithActivityIndicator(c._uiHandler,c._policyAction,c._clientContext,c._sdk.host.generateKeyPair(u,e.sdkhost.KeyClass.StdEncryptionKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb,!0)).catch(function(e){throw c.translateBiometricInternalError(e)})):s=new Promise(function(n){var r=c._sdk.host.getKeyPair(u,e.sdkhost.KeyClass.StdEncryptionKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);if(!r&&!(r=c._sdk.host.getKeyPair(i.INCORRECT_KEY_TAG_TO_FALLBACK(c._vaultData),e.sdkhost.KeyClass.StdEncryptionKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb)))throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Your biometric settings on the device has been changed");n(r)}),s.then(function(e){c.updateKeyPairWithAuthenticationInput(e,n,r),c._encryptionKeyPair=e}).then(o,a)})},i.prototype.internalDataDecrypt=function(e){var t=this;return this._encryptionKeyPair.decrypt(e).then(function(e){return t._encryptionKeyPair.closeKeyPair(),e},function(e){throw t._encryptionKeyPair.closeKeyPair(),t.translateBiometricInternalError(e)})},i.prototype.internalDataEncrypt=function(e){return this._encryptionKeyPair.encrypt(e)},i.prototype.finalizeLock=function(){this._encryptionKeyPair=null},i.prototype.handleLocalDecryptError=function(e){e.getErrorCode()==t.AuthenticationErrorCode.UserCanceled?this.invokeUiHandlerCancellation():r.prototype.handleLocalDecryptError.call(this,e)},i}(r.AuthenticatorVault),r.AuthenticatorVaultBiometric=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(r){var i=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.biometricType="FaceId",t}return __extends(r,e),r.prototype.updateKeyPairWithAuthenticationInput=function(e,t,n){e.setBiometricPromptInfo(n.getPrompt(),"",this._uiHandler,t)},r.createNew=function(e,i,o,a,s,c,u){return new Promise(function(u,l){if(c)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"This vault type does not support disabling integrity protection");var d={type:n.authenticationdrivers.AuthenticationDriverDescriptorNativeFace.authenticatorName,salt:a.host.generateRandomHexString(24),data:""};u(new r(e,d,i,o,a,s))})},r.getAuthenticatorDescription=function(e){return new o(e)},r.prototype.createAuthenticatorSession=function(){return this._uiHandler.createNativeFaceAuthSession(n.authenticationdrivers.AuthenticationDriverDescriptorNativeFace.authenticatorName,this._user.displayName)},r}(r.AuthenticatorVaultBiometric);r.AuthenticatorVaultFaceId=i;var o=function(r){function i(e){var i=r.call(this,t.AuthenticatorType.FaceID,n.authenticationdrivers.AuthenticationDriverDescriptorNativeFace.authenticatorName)||this;return i._sdk=e,i}return __extends(i,r),i.prototype.getSupportedOnDevice=function(){return"true"===this._sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.FaceIdKeyBioProtectionSupported)},i}(r.AuthenticatorVaultDescription)}((n=t.core||(t.core={})).vault||(n.vault={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(r){var i=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.biometricType="Fingerprint",t}return __extends(r,e),r.prototype.updateKeyPairWithAuthenticationInput=function(e,t,n){e.setBiometricPromptInfo(n.getPrompt(),"",this._uiHandler,t)},r.createNew=function(e,i,o,a,s,c,u){return new Promise(function(u,l){if(c)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"This vault type does not support disabling integrity protection");var d={type:n.authenticationdrivers.AuthenticationDriverDescriptorFingerprint.authenticatorName,salt:a.host.generateRandomHexString(24),data:""};u(new r(e,d,i,o,a,s))})},r.getAuthenticatorDescription=function(e){return new o(e)},r.prototype.createAuthenticatorSession=function(){return this._uiHandler.createFingerprintAuthSession(n.authenticationdrivers.AuthenticationDriverDescriptorFingerprint.authenticatorName,this._user.displayName)},r}(r.AuthenticatorVaultBiometric);r.AuthenticatorVaultFingerprint=i;var o=function(r){function i(e){var i=r.call(this,t.AuthenticatorType.Fingerprint,n.authenticationdrivers.AuthenticationDriverDescriptorFingerprint.authenticatorName)||this;return i._sdk=e,i}return __extends(i,r),i.prototype.getSupportedOnDevice=function(){return"true"===this._sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.FingerprintSupported)},i}(r.AuthenticatorVaultDescription)}((n=t.core||(t.core={})).vault||(n.vault={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(t,r,i,o,a,s){var c=n.call(this,t,r,i,o,a,s)||this;if(!c._vaultData.cryptoSettings)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"vault data is missing cryptography settings");return c}return __extends(r,n),r.createNew=function(e,t,n,i,o,a,s){return new Promise(function(s){var c={type:r._authenticatorName,salt:i.host.generateRandomHexString(24),data:"",cryptoSettings:{pbkdf_iterations_count:i.cryptoSettings.getLocalEnrollmentKeyIterationCount(),pbkdf_key_size:i.cryptoSettings.getLocalEnrollmentKeySizeInBytes()},noIntegrity:a};s(new r(e,c,t,n,i,o))})},r.supportsNoIntegrity=function(){return!0},r.deletePrivateResources=function(e,t,n){},r.getAuthenticatorDescription=function(n){return new t.AuthenticatorVaultDescription(e.AuthenticatorType.Password,r._authenticatorName)},r.prototype.createAuthenticatorSession=function(){return this._uiHandler.createPasswordAuthSession(r._authenticatorName,this._user.displayName)},r.prototype.prepareToUnlock=function(n,r,i,o,a){var s=this,c=r;return this._vaultData.cryptoSettings?t.pbkdfStretchHexSecretIntoAESKey(this._vaultData.salt,e.util.asciiToHex(c.getPassword()),this._vaultData.cryptoSettings.pbkdf_key_size,this._vaultData.cryptoSettings.pbkdf_iterations_count,this.noIntegrity||!1,this._sdk).then(function(e){s._encryptionKey=e}):Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Missing crypt settings for password vault."))},r.prototype.internalDataDecrypt=function(t){var n=this;return this._encryptionKey.decrypt(t,null).catch(function(t){throw n.noIntegrity?t:new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,"Incorrect password input.")})},r.prototype.internalDataEncrypt=function(e){return this._encryptionKey.encrypt(e)},r.prototype.finalizeLock=function(){this._encryptionKey=null},r._authenticatorName="password",r}(t.AuthenticatorVault);t.AuthenticatorVaultPassword=n})((t=e.core||(e.core={})).vault||(t.vault={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),function(i){var o=function(o){function s(e,t,r,i,a,s){var c=o.call(this,e,t,r,i,a,s)||this;return c._selectedCredential=null,c._session=new n.LocalSession(c._sdk,c._user),c}return __extends(s,o),s.createNew=function(e,n,r,i,o,a,c){return new Promise(function(u,l){if(c&&c.vault){var d={type:"multi_credential_protection",data:"",noIntegrity:a,eskr_pub:{type:c.vault.eskr_pub.type,key:t.util.base64ToHex(c.vault.eskr_pub.key)},ephemeralW:"",protectingCreds:[]},h=new s(e,d,n,r,i,o);h.addOrUpdateProtectingCreds(c.vault),u(h)}else l(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"failt to parse provision data for vault "+n))})},s.updateVaultsProtectingCreds=function(e,o,a,s){s.log(t.LogLevel.Debug,"checking for updated credentials on multi creds vaults"),o.forEach(function(o){var c=r.Vault.getVaultForUserWithId(e,n.TarsusKeyPath.fromString(o.vault_id),new(function(){function e(){}return e.prototype.getValidCancelOptions=function(){return null},e.prototype.getValidErrorRecoveryOptions=function(e){return[t.AuthenticationErrorRecovery.Fail]},e}()),s,a);if(c instanceof r.MultiCredsVault){if(s.log(t.LogLevel.Debug,"checking for updated credentials on vault '"+o.vault_id+"'"),"add_credentials"==o.update_type)c.addOrUpdateProtectingCreds(o);else{if("remove_credentials"!=o.update_type)return void s.log(t.LogLevel.Warning,"Unhandled vault update type '"+o.update_type+"'");c.removeProtectingCreds(o)}i.Vault.updateVaultForUserWithId(e,c._vaultData,c._vaultId,s)}else s.log(t.LogLevel.Warning,"Unhandled vault type for '"+o.vault_id+"'")})},s.supportsNoIntegrity=function(){return!0},s.deletePrivateResources=function(e,t,n){},s.prototype.unlock=function(e,n){var r=this;return new Promise(function(i,o){if(r._policyAction=e,r._clientContext=n,r.isEmpty())return r._sdk.log(t.LogLevel.Info,"Unlocking empty vault '"+r._vaultId+"'"),r._unlockedData={},void i(!0);r.buildAuthenticationOptions(),(1<r._authenticationOptions.length?r._uiHandler.selectAuthenticator(r._authenticationOptions,e,n).then(function(e){switch(e.getResultType()){case t.AuthenticatorSelectionResultType.Abort:throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.UserCanceled,"Cancel during authenticator selection.");case t.AuthenticatorSelectionResultType.SelectAuthenticator:var n=e.getSelectedAuthenticator();if(!n.getRegistered())throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"unregistered authenticator selected "+n.getAuthenticatorId());return n}}):Promise.resolve(r._authenticationOptions[0].getAuthenticator())).then(function(e){r._selectedCredential=e.credential,r._selectedCredential.startCredentialSession(r._clientContext),r._sdk.log(t.LogLevel.Info,"Unlocking existing vault '"+r._vaultId+"', using credential '"+r._selectedCredential.credentialId+"'"),r.unlockInstartedSession().then(i,o)}).catch(o)})},s.prototype.finalizeLock=function(){this._selectedCredential=null},s.prototype.internalDataEncrypt=function(n){var r=this,o=this._sdk.host.generateRandomHexString(64);this._sdk.log(t.LogLevel.Debug,"Generated ephemeral key for vault '"+this._vaultId+"'");var a=this.noIntegrity?e.sdkhost.KeyClass.NoIntegrityAES:e.sdkhost.KeyClass.GeneralPurposeAES,s=this._sdk.host.importVolatileSymmetricKey(o,a);return s.encrypt(n).then(function(n){return r._sdk.log(t.LogLevel.Debug,"ecnrypted data using ephemeral key for vault '"+r._vaultId+"'"),r._sdk.host.importVolatileKeyPairFromPublicKeyHex(e.sdkhost.KeyClass.FidoECCSigningKey,r._vaultData.eskr_pub.key).wrapSymmetricKey(s).then(function(e){return r._sdk.log(t.LogLevel.Debug,"wrapped ephemeral key with eskr_pub for vault '"+r._vaultId+"'"),r._vaultData.ephemeralW=e,i.Vault.updateVaultForUserWithId(r._user,r._vaultData,r._vaultId,r._sdk),n})})},s.prototype.internalDataDecrypt=function(e){var t=this,n=this._ephemeral.decrypt(e,null);return n.finally(function(){return t._ephemeral=null}),n},s.prototype.getPolicyAction=function(e){return this._policyAction},s.prototype.availableAuthenticatorsForSwitchMethod=function(){return this._availableCredentials},s.prototype.getAuthenticatorConfig=function(e){return this._availableCredentials.filter(function(t){return t.getAuthenticatorId()==e.credentialId})[0].getAuthenticatorConfig()},s.prototype.getAuthenticatorDescription=function(e){return this._availableCredentials.filter(function(t){return t.getAuthenticatorId()==e.credentialId})[0]},s.prototype.getUIHandler=function(e){return this._uiHandler},s.prototype.unlockInstartedSession=function(){var r=this,i=this._selectedCredential.authenticatorDescription.getEskrPriW();return this._sdk.log(t.LogLevel.Debug,"unwrapping eskr_pri_w for vault '"+this._vaultId+"'"),this._selectedCredential.unwrapAsymmetricKeyPairFromPrivateHex(i,e.sdkhost.KeyClass.FidoECCSigningKey).then(function(i){if(i instanceof n.credential.CredentialUnwrapAsymmetricResult){r._sdk.log(t.LogLevel.Debug,"eskr_pri_w unwrapped successfully, unwrapping ephemeral for vault '"+r._vaultId+"'");var o=r._vaultData.noIntegrity?e.sdkhost.KeyClass.NoIntegrityAES:e.sdkhost.KeyClass.GeneralPurposeAES;return i.keyPair.unwrapSymmetricKeyHex(r._vaultData.ephemeralW,o).then(function(e){return r._sdk.log(t.LogLevel.Debug,"ephemeral unwrapped successfully, decrypting for vault '"+r._vaultId+"'"),r._ephemeral=e,r.internalDataDecrypt(r._vaultData.data).then(function(e){return r._sdk.log(t.LogLevel.Debug,"decrypted successfully for vault '"+r._vaultId+"'"),r._unlockedData=r.jsonFromDecryptedHexString(e),r._selectedCredential.endCredentialSession(),!0}).catch(function(e){throw r._sdk.log(t.LogLevel.Error,"decrypt failed for vault '"+r._vaultId+"': "+e),r.noIntegrity||e.getErrorCode()!=t.AuthenticationErrorCode.Internal||(e=new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.InvalidInput,"Authentication failed.")),e})}).catch(function(e){throw r._sdk.log(t.LogLevel.Error,"uwrap ephemeral failed: "+e),e})}if(i instanceof n.credential.CredentialAuthOperationResultSwitchAuthenticator)return r._selectedCredential.endCredentialSession(),r.unlock(r._policyAction,r._clientContext);throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Unhandled credential opreation result")}).catch(function(e){r._sdk.log(t.LogLevel.Error,"unwrap eskr_pri_w or nested operation failed for vault '"+r._vaultId+"': "+e);var n=r.getValidErrorRecoveryOptions(e),i=n.indexOf(t.AuthenticationErrorRecovery.RetryAuthenticator)>=0?t.AuthenticationErrorRecovery.RetryAuthenticator:t.AuthenticationErrorRecovery.Fail;return n.indexOf(t.AuthenticationErrorRecovery.ChangeAuthenticator)<0&&r._authenticationOptions.length>1&&n.push(t.AuthenticationErrorRecovery.ChangeAuthenticator),r._selectedCredential.promiseRecoveryForError(e,n,i).then(function(t){return r.handleErrorRecoveryAction(t,e)})})},s.prototype.handleErrorRecoveryAction=function(e,n){switch(e){case t.AuthenticationErrorRecovery.RetryAuthenticator:return this.unlockInstartedSession();case t.AuthenticationErrorRecovery.ChangeAuthenticator:case t.AuthenticationErrorRecovery.SelectAuthenticator:return this._selectedCredential.endCredentialSession(),this.unlock(this._policyAction,this._clientContext);case t.AuthenticationErrorRecovery.Fail:default:return this._selectedCredential.endCredentialSession(),Promise.reject(n)}},s.prototype.addOrUpdateProtectingCreds=function(e){var n=this;e.protecting_credentials.forEach(function(e){if(e.local_authenticator_id){var r=n._vaultData.protectingCreds.filter(function(t){return t.local_authenticator_id==e.local_authenticator_id}),i={local_authenticator_id:e.local_authenticator_id,eskr_pri_w:t.util.base64ToHex(e.eskr_pri_w),authenticatorConfig:e.attrs};if(r.length<1)n._sdk.log(t.LogLevel.Debug,"adding credential '"+i.local_authenticator_id+"' for vault '"+n._vaultId+"'"),n._vaultData.protectingCreds.push(i);else{n._sdk.log(t.LogLevel.Debug,"updating credential '"+i.local_authenticator_id+"' for vault '"+n._vaultId+"'");var o=n._vaultData.protectingCreds.indexOf(r[0]);n._vaultData.protectingCreds[o]=i}}else n._sdk.log(t.LogLevel.Warning,"Unhandled credential type")})},s.prototype.removeProtectingCreds=function(e){var n=this;e.protecting_credentials.forEach(function(e){if(e.local_authenticator_id){var r=n._vaultData.protectingCreds.filter(function(r){return r.local_authenticator_id!=e.local_authenticator_id||(n._sdk.log(t.LogLevel.Debug,"removing credential '"+e.local_authenticator_id+"' for vault '"+n._vaultId+"'"),!1)});n._vaultData.protectingCreds=r}else n._sdk.log(t.LogLevel.Warning,"Unhandled credential type")})},s.prototype.buildAuthenticationOptions=function(){var e=this;this._sdk.log(t.LogLevel.Debug,"building authentication options for vault '"+this._vaultId+"'");var r=n.User.findUser(this._sdk,this._user.userHandle);if(!r)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"failed to find storage record for user '"+this._user.displayName+"'");this._availableCredentials=[],this._authenticationOptions=[];var i=this._uiHandler.shouldIncludeDisabledAuthenticatorsInMenu(this._policyAction,this._clientContext);if(this._vaultData.protectingCreds.forEach(function(n){var o=n.local_authenticator_id;if(o)if(r.localEnrollments[o]){var s=new a(n,e,r,e._sdk,e._clientContext);i||s.getRegistered()?(e._sdk.log(t.LogLevel.Debug,"adding authentication option '"+s.getAuthenticatorId()+"' for vault '"+e._vaultId+"'"),e._availableCredentials.push(s),e._authenticationOptions.push(new t.impl.AuthenticationOptionImpl(s,[]))):e._sdk.log(t.LogLevel.Debug,"Not adding unregistered authentication option '"+s.getAuthenticatorId()+"' for vault '"+e._vaultId+"'")}else e._sdk.log(t.LogLevel.Warning,"enrollment record '"+o+"' for user '"+e._user.displayName+"' isn't found");else e._sdk.log(t.LogLevel.Warning,"Unhandled credential type")}),this._availableCredentials.length<=0)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.NoRegisteredAuthenticator,"No registered authenticator available.")},s}(i.Vault);i.MultiCredsVault=o;var a=function(){function e(e,t,n,r,i){this._credSpec=e,this._holder=t,this._user=n,this._sdk=r,this._clientContext=i}return Object.defineProperty(e.prototype,"credential",{get:function(){return this._credential||(this._credential=n.credential.CredentialTypes[this._credSpec.local_authenticator_id].create(this._credSpec.local_authenticator_id,this._holder,this._holder)),this._credential},enumerable:!0,configurable:!0}),e.prototype.getAuthenticatorId=function(){return this._credSpec.local_authenticator_id},e.prototype.getName=function(){return n.Protocol.AuthTypeData[this._credSpec.local_authenticator_id].authTypeName},e.prototype.getType=function(){return n.Protocol.AuthTypeData[this._credSpec.local_authenticator_id].authTypeEnum},e.prototype.getRegistered=function(){return this.getRegistrationStatus()===t.AuthenticatorRegistrationStatus.Registered},e.prototype.getDefaultAuthenticator=function(){return!1},e.prototype.getExpired=function(){return!1},e.prototype.getEnabled=function(){return!0},e.prototype.getLocked=function(){return!1},e.prototype.getSupportedOnDevice=function(){return!0},e.prototype.getRegistrationStatus=function(){return this.credential.evaluateLocalRegistrationStatus()},e.prototype.getEskrPriW=function(){return this._credSpec.eskr_pri_w},e.prototype.getAuthenticatorConfig=function(){return this._user.localEnrollments[this._credSpec.local_authenticator_id].authenticatorConfig||this._credSpec.authenticatorConfig},e}();i.MultiCredsVaultCredentialDescription=a}(r=n.vault||(n.vault={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){t.pbkdfStretchHexSecretIntoAESKey=function(t,n,r,i,o,a){return a.host.generatePbkdf2HmacSha1HexString(t,n,r,i).then(function(t){return a.host.importVolatileSymmetricKey(t,o?e.sdkhost.KeyClass.NoIntegrityAES:e.sdkhost.KeyClass.GeneralPurposeAES)})}}(t.vault||(t.vault={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.isAuthenticatorVaultDescriptor=function(e){return"getAuthenticatorDescription"in e},e.VaultTypes={multi_credential_protection:e.MultiCredsVault,password:e.AuthenticatorVaultPassword,fingerprint:e.AuthenticatorVaultFingerprint,face_id:e.AuthenticatorVaultFaceId}}(e.vault||(e.vault={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getAcquisitionResponse=function(){return this._acquisitionResponse},t.prototype.setAcquisitionResponse=function(e){this._acquisitionResponse=e},t.__tarsusInterfaceName="AudioInputResponse",t}(e.InputResponseType);e.AudioInputResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Internal=0]="Internal",e[e.InvalidInput=1]="InvalidInput",e[e.AuthenticatorLocked=2]="AuthenticatorLocked",e[e.AllAuthenticatorsLocked=3]="AllAuthenticatorsLocked",e[e.NoRegisteredAuthenticator=4]="NoRegisteredAuthenticator",e[e.RegisteredSecretAlreadyInHistory=5]="RegisteredSecretAlreadyInHistory",e[e.Communication=6]="Communication",e[e.UserCanceled=7]="UserCanceled",e[e.AppImplementation=8]="AppImplementation",e[e.PolicyRejection=9]="PolicyRejection",e[e.AuthenticatorInvalidated=10]="AuthenticatorInvalidated",e[e.ControlFlowExpired=11]="ControlFlowExpired",e[e.SessionRequired=12]="SessionRequired",e[e.AuthenticatorError=13]="AuthenticatorError",e[e.ApprovalWrongState=14]="ApprovalWrongState",e[e.TotpNotProvisioned=15]="TotpNotProvisioned",e[e.AuthenticatorExternalConfigError=16]="AuthenticatorExternalConfigError",e[e.InvalidDeviceBinding=17]="InvalidDeviceBinding",e[e.InvalidIdToken=18]="InvalidIdToken",e[e.DeviceNotFound=19]="DeviceNotFound",e[e.ApprovalDenied=20]="ApprovalDenied",e[e.ApprovalExpired=21]="ApprovalExpired",e[e.ApplicationGeneratedRecoverableError=22]="ApplicationGeneratedRecoverableError"}(e.AuthenticationErrorCode||(e.AuthenticationErrorCode={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.AuthenticatorExternalConfigErrorReason=0]="AuthenticatorExternalConfigErrorReason",e[e.AuthenticatorInvalidInputErrorDescription=1]="AuthenticatorInvalidInputErrorDescription",e[e.InvalidIdTokenErrorReason=2]="InvalidIdTokenErrorReason"}(e.AuthenticationErrorProperty||(e.AuthenticationErrorProperty={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.AuthenticatorExternalConfigErrorReasonBiometricsNotEnrolled=0]="AuthenticatorExternalConfigErrorReasonBiometricsNotEnrolled",e[e.AuthenticatorExternalConfigErrorReasonBiometricsOsLockTemporary=1]="AuthenticatorExternalConfigErrorReasonBiometricsOsLockTemporary",e[e.AuthenticatorExternalConfigErrorReasonBiometricsOsLockPermanent=2]="AuthenticatorExternalConfigErrorReasonBiometricsOsLockPermanent",e[e.AuthenticatorInvalidInputErrorDescriptionTotpIncorrectCheckDigit=3]="AuthenticatorInvalidInputErrorDescriptionTotpIncorrectCheckDigit",e[e.InvalidIdTokenErrorReasonExpiredToken=4]="InvalidIdTokenErrorReasonExpiredToken",e[e.InvalidIdTokenErrorReasonBadToken=5]="InvalidIdTokenErrorReasonBadToken"}(e.AuthenticationErrorPropertySymbol||(e.AuthenticationErrorPropertySymbol={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.RetryAuthenticator=0]="RetryAuthenticator",e[e.ChangeAuthenticator=1]="ChangeAuthenticator",e[e.SelectAuthenticator=2]="SelectAuthenticator",e[e.Fail=3]="Fail"}(e.AuthenticationErrorRecovery||(e.AuthenticationErrorRecovery={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Register=0]="Register",e[e.Unregister=1]="Unregister",e[e.Reregister=2]="Reregister"}(e.AuthenticatorConfigurationAction||(e.AuthenticatorConfigurationAction={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Fallback=0]="Fallback",e[e.AuthMenu=1]="AuthMenu",e[e.Retry=2]="Retry",e[e.Cancel=3]="Cancel"}(e.AuthenticatorFallbackAction||(e.AuthenticatorFallbackAction={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Registered=0]="Registered",e[e.Unregistered=1]="Unregistered",e[e.LocallyInvalid=2]="LocallyInvalid"}(e.AuthenticatorRegistrationStatus||(e.AuthenticatorRegistrationStatus={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.SelectAuthenticator=0]="SelectAuthenticator",e[e.Abort=1]="Abort"}(e.AuthenticatorSelectionResultType||(e.AuthenticatorSelectionResultType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Authentication=0]="Authentication",e[e.Registration=1]="Registration"}(e.AuthenticatorSessionMode||(e.AuthenticatorSessionMode={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getAcquisitionResponse=function(){return this._acquisitionResponse},t.prototype.setAcquisitionResponse=function(e){this._acquisitionResponse=e},t.__tarsusInterfaceName="CameraInputResponse",t}(e.InputResponseType);e.CameraInputResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Accounts=0]="Accounts",e[e.DeviceDetails=1]="DeviceDetails",e[e.Contacts=2]="Contacts",e[e.Owner=3]="Owner",e[e.Software=4]="Software",e[e.Location=5]="Location",e[e.Bluetooth=6]="Bluetooth",e[e.ExternalSDKDetails=7]="ExternalSDKDetails",e[e.HWAuthenticators=8]="HWAuthenticators",e[e.Capabilities=9]="Capabilities",e[e.FidoAuthenticators=10]="FidoAuthenticators",e[e.LargeData=11]="LargeData",e[e.LocalEnrollments=12]="LocalEnrollments"}(e.CollectorType||(e.CollectorType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.None=0]="None",e[e.Credentials=1]="Credentials",e[e.Full=2]="Full"}(e.ConnectionCryptoMode||(e.ConnectionCryptoMode={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.CancelAuthenticator=0]="CancelAuthenticator",e[e.RetryAuthenticator=1]="RetryAuthenticator",e[e.ChangeMethod=2]="ChangeMethod",e[e.SelectMethod=3]="SelectMethod",e[e.AbortAuthentication=4]="AbortAuthentication"}(e.ControlRequestType||(e.ControlRequestType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Remove=0]="Remove",e[e.Identify=1]="Identify",e[e.Rename=2]="Rename"}(e.DeviceManagementAction||(e.DeviceManagementAction={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.RecentlyUsed=0]="RecentlyUsed",e[e.NoRecentActivity=1]="NoRecentActivity",e[e.LongInactivity=2]="LongInactivity",e[e.Disabled=3]="Disabled",e[e.Removed=4]="Removed"}(e.DeviceStatus||(e.DeviceStatus={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getFailureError=function(){return this._failureError},t.prototype.setFailureError=function(e){this._failureError=e},t.__tarsusInterfaceName="Fido2AuthenticationFailedResponse",t}(e.Fido2InputResponse);e.Fido2AuthenticationFailedResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getFido2Response=function(){return this._fido2Response},t.prototype.setFido2Response=function(e){this._fido2Response=e},t.__tarsusInterfaceName="Fido2AuthenticatorSuccessResponse",t}(e.Fido2InputResponse);e.Fido2AuthenticatorSuccessResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getFailureError=function(){return this._failureError},t.prototype.setFailureError=function(e){this._failureError=e},t.prototype.getExpired=function(){return this._expired},t.prototype.setExpired=function(e){this._expired=e},t.prototype.getRegistered=function(){return this._registered},t.prototype.setRegistered=function(e){this._registered=e},t.prototype.getRegistrationStatus=function(){return this._registrationStatus},t.prototype.setRegistrationStatus=function(e){this._registrationStatus=e},t.prototype.getLocked=function(){return this._locked},t.prototype.setLocked=function(e){this._locked=e},t.__tarsusInterfaceName="FidoAuthFailureResponse",t}(e.FidoInputResponse);e.FidoAuthFailureResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getFidoResponse=function(){return this._fidoResponse},t.prototype.setFidoResponse=function(e){this._fidoResponse=e},t.__tarsusInterfaceName="FidoAuthSuccessResponse",t}(e.FidoInputResponse);e.FidoAuthSuccessResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Submit=0]="Submit",e[e.Abort=1]="Abort"}(e.FormControlRequest||(e.FormControlRequest={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Off=0]="Off",e[e.Critical=1]="Critical",e[e.Error=2]="Error",e[e.Warning=3]="Warning",e[e.Info=4]="Info",e[e.Debug=5]="Debug"}(e.LogLevel||(e.LogLevel={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Approve=0]="Approve",e[e.Deny=1]="Deny"}(e.MobileApprovalAction||(e.MobileApprovalAction={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Pending=0]="Pending",e[e.Approved=1]="Approved",e[e.Denied=2]="Denied",e[e.Expired=3]="Expired"}(e.MobileApprovalStatus||(e.MobileApprovalStatus={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Unknown=0]="Unknown",e[e.Sms=1]="Sms",e[e.Email=2]="Email",e[e.PushNotification=3]="PushNotification",e[e.VoiceCall=4]="VoiceCall"}(e.OtpChannel||(e.OtpChannel={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getFailureError=function(){return this._failureError},t.prototype.setFailureError=function(e){this._failureError=e},t.prototype.getExpired=function(){return this._expired},t.prototype.setExpired=function(e){this._expired=e},t.prototype.getRegistered=function(){return this._registered},t.prototype.setRegistered=function(e){this._registered=e},t.prototype.getRegistrationStatus=function(){return this._registrationStatus},t.prototype.setRegistrationStatus=function(e){this._registrationStatus=e},t.prototype.getLocked=function(){return this._locked},t.prototype.setLocked=function(e){this._locked=e},t.__tarsusInterfaceName="PlaceholderAuthFailureResponse",t}(e.PlaceholderInputResponse);e.PlaceholderAuthFailureResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getFailureError=function(){return this._failureError},t.prototype.setFailureError=function(e){this._failureError=e},t.__tarsusInterfaceName="PlaceholderAuthFailureWithServerProvidedStatusResponse",t}(e.PlaceholderInputResponse);e.PlaceholderAuthFailureWithServerProvidedStatusResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getPlaceholderToken=function(){return this._placeholderToken},t.prototype.setPlaceholderToken=function(e){this._placeholderToken=e},t.__tarsusInterfaceName="PlaceholderAuthSuccessResponse",t}(e.PlaceholderInputResponse);e.PlaceholderAuthSuccessResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Skip=0]="Skip",e[e.Abort=1]="Abort",e[e.Continue=2]="Continue"}(e.PromotionControlRequest||(e.PromotionControlRequest={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Numeric=0]="Numeric",e[e.Alphanumeric=1]="Alphanumeric",e[e.Binary=2]="Binary"}(e.QrCodeFormat||(e.QrCodeFormat={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.RedirectToPolicy=0]="RedirectToPolicy",e[e.CancelRedirect=1]="CancelRedirect"}(e.RedirectResponseType||(e.RedirectResponseType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getAnswers=function(){return this._answers},t.__tarsusInterfaceName="SecurityQuestionAnswersInputResponse",t}(e.SecurityQuestionInputResponse);e.SecurityQuestionAnswersInputResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getValue=function(){return this._value},e.prototype.setValue=function(e){this._value=e},e.prototype.getFormat=function(){return this._format},e.prototype.setFormat=function(e){this._format=e},e.__tarsusInterfaceName="TotpChallenge",e}();e.TotpChallenge=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getName=function(){return this._name},e.prototype.setName=function(e){this._name=e},e.prototype.getValue=function(){return this._value},e.prototype.setValue=function(e){this._value=e},e.__tarsusInterfaceName="TransportHeader",e}();e.TransportHeader=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getUrl=function(){return this._url},e.prototype.setUrl=function(e){this._url=e},e.prototype.getMethod=function(){return this._method},e.prototype.setMethod=function(e){this._method=e},e.prototype.getHeaders=function(){return this._headers},e.prototype.setHeaders=function(e){this._headers=e},e.prototype.getBodyJson=function(){return this._bodyJson},e.prototype.setBodyJson=function(e){this._bodyJson=e},e.__tarsusInterfaceName="TransportRequest",e}();e.TransportRequest=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getStatus=function(){return this._status},e.prototype.setStatus=function(e){this._status=e},e.prototype.getMethod=function(){return this._method},e.prototype.setMethod=function(e){this._method=e},e.prototype.getHeaders=function(){return this._headers},e.prototype.setHeaders=function(e){this._headers=e},e.prototype.getBodyJson=function(){return this._bodyJson},e.prototype.setBodyJson=function(e){this._bodyJson=e},e.__tarsusInterfaceName="TransportResponse",e}();e.TransportResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.UserId=0]="UserId",e[e.IdToken=1]="IdToken"}(e.UserHandleType||(e.UserHandleType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Create=0]="Create",e[e.Get=1]="Get"}(e.Fido2CredentialsOpType||(e.Fido2CredentialsOpType={}))}(e.sdkhost||(e.sdkhost={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Version=0]="Version",e[e.Platform=1]="Platform",e[e.FingerprintSupported=2]="FingerprintSupported",e[e.HostProvidedFeatures=3]="HostProvidedFeatures",e[e.FaceIdKeyBioProtectionSupported=4]="FaceIdKeyBioProtectionSupported",e[e.ImageAcquitisionSupported=5]="ImageAcquitisionSupported",e[e.AudioAcquitisionSupported=6]="AudioAcquitisionSupported",e[e.PersistentKeysSupported=7]="PersistentKeysSupported",e[e.FidoClientPresent=8]="FidoClientPresent",e[e.DyadicPresent=9]="DyadicPresent",e[e.StdSigningKeyIsHardwareProtectedSignAndEncryptKey=10]="StdSigningKeyIsHardwareProtectedSignAndEncryptKey",e[e.Fido2ClientPresent=11]="Fido2ClientPresent",e[e.DeviceStrongAuthenticationSupported=12]="DeviceStrongAuthenticationSupported"}(e.HostInformationKey||(e.HostInformationKey={}))}(e.sdkhost||(e.sdkhost={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.None=0]="None",e[e.NormalProtection=1]="NormalProtection",e[e.BindToEnrollmentDb=2]="BindToEnrollmentDb"}(e.KeyBiometricProtectionMode||(e.KeyBiometricProtectionMode={}))}(e.sdkhost||(e.sdkhost={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.StdSigningKey=0]="StdSigningKey",e[e.StdEncryptionKey=1]="StdEncryptionKey",e[e.GeneralPurposeAES=2]="GeneralPurposeAES",e[e.NoIntegrityAES=3]="NoIntegrityAES",e[e.FidoECCSigningKey=4]="FidoECCSigningKey",e[e.HardwareProtectedSignAndEncryptKey=5]="HardwareProtectedSignAndEncryptKey"}(e.KeyClass||(e.KeyClass={}))}(e.sdkhost||(e.sdkhost={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getPluginName=function(){return this._pluginName},t.prototype.setPluginName=function(e){this._pluginName=e},t.prototype.getVersionMajor=function(){return this._versionMajor},t.prototype.setVersionMajor=function(e){this._versionMajor=e},t.prototype.getVersionMinor=function(){return this._versionMinor},t.prototype.setVersionMinor=function(e){this._versionMinor=e},t.prototype.getVersionPatch=function(){return this._versionPatch},t.prototype.setVersionPatch=function(e){this._versionPatch=e},t.prototype.getRequiredPluginApiLevel=function(){return this._requiredPluginApiLevel},t.prototype.setRequiredPluginApiLevel=function(e){this._requiredPluginApiLevel=e},t.create=function(){return e.ts.mobile.tarsusplugin.impl.PluginInfoImpl.create()},t.__tarsusInterfaceName="PluginInfo",t}();t.PluginInfo=n}(t.tarsusplugin||(t.tarsusplugin={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getCode=function(){return this._code},t.prototype.getTimeStepSeconds=function(){return this._timeStepSeconds},t.prototype.getExpiresInSeconds=function(){return this._expiresInSeconds},t.prototype.getSecondsTillNextInvocation=function(){return this._secondsTillNextInvocation},t.prototype.getShouldUpdateSpecificProperties=function(){return this._shouldUpdateSpecificProperties},t.prototype.getGeneratorSpecificDataToStore=function(){return this._generatorSpecificDataToStore},t.prototype.getMessage=function(){return this._message},t.create=function(t,n,r,i,o,a,s){return e.ts.mobile.tarsusplugin.impl.TotpCodeGenerationOutputImpl.create(t,n,r,i,o,a,s)},t.__tarsusInterfaceName="TotpCodeGenerationOutput",t}();t.TotpCodeGenerationOutput=n}(t.tarsusplugin||(t.tarsusplugin={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getUnprotectedProvisionOutput=function(){return this._unprotectedProvisionOutput},t.prototype.getSecretToLock=function(){return this._secretToLock},t.create=function(t,n){return e.ts.mobile.tarsusplugin.impl.VaultBasedTotpProvisionOutputImpl.create(t,n)},t.__tarsusInterfaceName="VaultBasedTotpProvisionOutput",t}();t.VaultBasedTotpProvisionOutput=n}(t.tarsusplugin||(t.tarsusplugin={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n,r;n=t.impl||(t.impl={}),r=function(t){function n(){var e=t.call(this)||this;return e._versionMajor=0,e._versionMinor=0,e._versionPatch=0,e}return __extends(n,t),n.create=function(){return new e.ts.mobile.tarsusplugin.impl.PluginInfoImpl},n.versionToString=function(e){return e.getVersionMajor()+"."+e.getVersionMinor()+"."+e.getVersionPatch()},n.toString=function(e){return e.getPluginName()+" v"+this.versionToString(e)},n}(t.PluginInfo),n.PluginInfoImpl=r}(t.tarsusplugin||(t.tarsusplugin={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e,n,r,i,o,a,s){var c=new t;return c._code=e,n&&(c._message=n),c._timeStepSeconds=r,c._expiresInSeconds=i,c._secondsTillNextInvocation=o,c._shouldUpdateSpecificProperties=a,s&&(c._generatorSpecificDataToStore=s),c},t}(e.TotpCodeGenerationOutput),t.TotpCodeGenerationOutputImpl=n}(e.tarsusplugin||(e.tarsusplugin={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e,n){var r=new t;return r._secretToLock=e,r._unprotectedProvisionOutput=n,r},t}(e.VaultBasedTotpProvisionOutput),t.VaultBasedTotpProvisionOutputImpl=n}(e.tarsusplugin||(e.tarsusplugin={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("xmsdk",["exports"],t):t((e=e||self).xmsdk={})}(this,function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function o(e,t,n){var r;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(n=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var r=0,i={};r<arguments.length;r++){var o=arguments[r];for(var a in o)i[a]=o[a]}return i}({path:"/"},{},n)).expires){var i=new Date;i.setMilliseconds(i.getMilliseconds()+864e5*n.expires),n.expires=i}n.expires=n.expires?n.expires.toUTCString():"";try{r=JSON.stringify(t),/^[\{\[]/.test(r)&&(t=r)}catch(e){}t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=(e=(e=encodeURIComponent(String(e))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var o="";for(var a in n)n[a]&&(o+="; "+a,!0!==n[a]&&(o+="="+n[a]));return document.cookie=e+"="+t+o}e||(r={});for(var s=document.cookie?document.cookie.split("; "):[],c=/(%[0-9A-Z]{2})+/g,u=0;u<s.length;u++){var l=s[u].split("="),d=l.slice(1).join("=");'"'===d.charAt(0)&&(d=d.slice(1,-1));try{var h=l[0].replace(c,decodeURIComponent);if(d=d.replace(c,decodeURIComponent),e===h){r=d;break}e||(r[h]=d)}catch(e){}}return r}}function a(e,t){return e(t={exports:{}},t.exports),t.exports}function s(e,t){if(!(t instanceof Promise)){var n=t;t=new Promise(function(e,t){try{e(n())}catch(e){t(e)}})}return t.then(function(t){var n={};return null!=t&&(n[e]=t),n},function(t){var n={};return n[e]={__err__:t},n})}function c(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function u(e,t,n,r,i,o){return c((a=c(c(t,e),c(r,o)))<<(s=i)|a>>>32-s,n);var a,s}function l(e,t,n,r,i,o,a){return u(t&n|~t&r,e,t,i,o,a)}function d(e,t,n,r,i,o,a){return u(t&r|n&~r,e,t,i,o,a)}function h(e,t,n,r,i,o,a){return u(t^n^r,e,t,i,o,a)}function p(e,t,n,r,i,o,a){return u(n^(t|~r),e,t,i,o,a)}function f(e,t){var n,r,i,o,a;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var s=1732584193,u=-271733879,f=-1732584194,m=271733878;for(n=0;n<e.length;n+=16)r=s,i=u,o=f,a=m,s=p(s=h(s=h(s=h(s=h(s=d(s=d(s=d(s=d(s=l(s=l(s=l(s=l(s,u,f,m,e[n],7,-680876936),u=l(u,f=l(f,m=l(m,s,u,f,e[n+1],12,-389564586),s,u,e[n+2],17,606105819),m,s,e[n+3],22,-1044525330),f,m,e[n+4],7,-176418897),u=l(u,f=l(f,m=l(m,s,u,f,e[n+5],12,1200080426),s,u,e[n+6],17,-1473231341),m,s,e[n+7],22,-45705983),f,m,e[n+8],7,1770035416),u=l(u,f=l(f,m=l(m,s,u,f,e[n+9],12,-1958414417),s,u,e[n+10],17,-42063),m,s,e[n+11],22,-1990404162),f,m,e[n+12],7,1804603682),u=l(u,f=l(f,m=l(m,s,u,f,e[n+13],12,-40341101),s,u,e[n+14],17,-1502002290),m,s,e[n+15],22,1236535329),f,m,e[n+1],5,-165796510),u=d(u,f=d(f,m=d(m,s,u,f,e[n+6],9,-1069501632),s,u,e[n+11],14,643717713),m,s,e[n],20,-373897302),f,m,e[n+5],5,-701558691),u=d(u,f=d(f,m=d(m,s,u,f,e[n+10],9,38016083),s,u,e[n+15],14,-660478335),m,s,e[n+4],20,-405537848),f,m,e[n+9],5,568446438),u=d(u,f=d(f,m=d(m,s,u,f,e[n+14],9,-1019803690),s,u,e[n+3],14,-187363961),m,s,e[n+8],20,1163531501),f,m,e[n+13],5,-1444681467),u=d(u,f=d(f,m=d(m,s,u,f,e[n+2],9,-51403784),s,u,e[n+7],14,1735328473),m,s,e[n+12],20,-1926607734),f,m,e[n+5],4,-378558),u=h(u,f=h(f,m=h(m,s,u,f,e[n+8],11,-2022574463),s,u,e[n+11],16,1839030562),m,s,e[n+14],23,-35309556),f,m,e[n+1],4,-1530992060),u=h(u,f=h(f,m=h(m,s,u,f,e[n+4],11,1272893353),s,u,e[n+7],16,-155497632),m,s,e[n+10],23,-1094730640),f,m,e[n+13],4,681279174),u=h(u,f=h(f,m=h(m,s,u,f,e[n],11,-358537222),s,u,e[n+3],16,-722521979),m,s,e[n+6],23,76029189),f,m,e[n+9],4,-640364487),u=h(u,f=h(f,m=h(m,s,u,f,e[n+12],11,-421815835),s,u,e[n+15],16,530742520),m,s,e[n+2],23,-995338651),f,m,e[n],6,-198630844),u=p(u=p(u=p(u=p(u,f=p(f,m=p(m,s,u,f,e[n+7],10,1126891415),s,u,e[n+14],15,-1416354905),m,s,e[n+5],21,-57434055),f=p(f,m=p(m,s=p(s,u,f,m,e[n+12],6,1700485571),u,f,e[n+3],10,-1894986606),s,u,e[n+10],15,-1051523),m,s,e[n+1],21,-2054922799),f=p(f,m=p(m,s=p(s,u,f,m,e[n+8],6,1873313359),u,f,e[n+15],10,-30611744),s,u,e[n+6],15,-1560198380),m,s,e[n+13],21,1309151649),f=p(f,m=p(m,s=p(s,u,f,m,e[n+4],6,-145523070),u,f,e[n+11],10,-1120210379),s,u,e[n+2],15,718787259),m,s,e[n+9],21,-343485551),s=c(s,r),u=c(u,i),f=c(f,o),m=c(m,a);return[s,u,f,m]}function m(e){var t,n="",r=32*e.length;for(t=0;t<r;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function g(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function v(e){var t,n,r="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),r+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return r}function y(e){return unescape(encodeURIComponent(e))}function b(e){return function(e){return m(f(g(e),8*e.length))}(y(e))}function A(e,t){return function(e,t){var n,r,i=g(e),o=[],a=[];for(o[15]=a[15]=void 0,i.length>16&&(i=f(i,8*e.length)),n=0;n<16;n+=1)o[n]=909522486^i[n],a[n]=1549556828^i[n];return r=f(o.concat(g(t)),512+8*t.length),m(f(a.concat(r),640))}(y(e),y(t))}var _=function(){function e(t){n(this,e),this._host=t}return i(e,[{key:"extractHeaders",value:function(e){return e.trim().split(/[\r\n]+/).map(function(e){var t=e.split(": "),n=t.shift(),r=t.join(": "),i=new com.ts.mobile.sdk.TransportHeader;return i.setName(n),i.setValue(r),i})}},{key:"sendRequest",value:function(e){var t=this;return new Promise(function(n,r){var i=new XMLHttpRequest,o=function(){r(new com.ts.mobile.sdk.impl.AuthenticationErrorImpl(com.ts.mobile.sdk.AuthenticationErrorCode.Communication,i.responseText))};i.open(e.getMethod(),e.getUrl(),!0),i.withCredentials=!0,i.onreadystatechange=function(){if(4===i.readyState)try{if(0===i.status)return t._host.log(com.ts.mobile.sdk.LogLevel.Error,"transport","Destination server is invalid or the server does not support access-control-allow-origin."),r(new com.ts.mobile.sdk.impl.AuthenticationErrorImpl(com.ts.mobile.sdk.AuthenticationErrorCode.Communication,i.responseText));JSON.parse(i.responseText);var a=new com.ts.mobile.sdk.TransportResponse;a.setStatus(i.status),a.setMethod(e.getMethod()),a.setHeaders(t.extractHeaders(i.getAllResponseHeaders())),a.setBodyJson(i.responseText),n(a)}catch(e){o()}},i.onerror=function(){o()},e.getHeaders().forEach(function(e){i.setRequestHeader(e.getName(),e.getValue())}),i.setRequestHeader("Content-Type","application/json"),i.send(e.getBodyJson())})}}]),e}(),S=function(){function e(){n(this,e)}return i(e,[{key:"formatAsTwoDigits",value:function(e){return e.toLocaleString("EN",{minimumIntegerDigits:2,useGrouping:!1})}},{key:"logDateFormat",value:function(e){var t=e.getFullYear(),n=this.formatAsTwoDigits(e.getMonth()+1),r=this.formatAsTwoDigits(e.getDate()),i=this.formatAsTwoDigits(e.getHours()),o=this.formatAsTwoDigits(e.getMinutes()),a=this.formatAsTwoDigits(e.getSeconds()),s=e.getMilliseconds().toLocaleString("EN",{minimumIntegerDigits:3,useGrouping:!1});return"".concat(t,"-").concat(n,"-").concat(r," ").concat(i,":").concat(o,":").concat(a,".").concat(s)}},{key:"log",value:function(e,t,n){var r=com.ts.mobile.sdk.LogLevel[e].toUpperCase();console.log("".concat(this.logDateFormat(new Date),"\t").concat(r,"\t").concat(t,":\t").concat(n))}}]),e}(),I={set:o,get:function(e){return o.call(o,e)},remove:function(e){o(e,"",{expires:-1})}},w=function(){function e(t){n(this,e),this._persistent=t}return i(e,[{key:"setItem",value:function(e,t){var n=btoa(t);this._persistent?I.set(e,n,{expires:365}):I.set(e,n)}},{key:"removeItem",value:function(e){I.remove(e)}},{key:"getItem",value:function(e){var t=I.get(e);return t&&(t=atob(t)),t}}]),e}(),k=function(){function e(){n(this,e),this._memStore={}}return i(e,[{key:"setItem",value:function(e,t){this._memStore[e]=t}},{key:"removeItem",value:function(e){delete this._memStore[e]}},{key:"getItem",value:function(e){return this._memStore[e]}}]),e}(),C=function(){function e(t){if(n(this,e),"undefined"!=typeof window)try{this.currentStorage=window[t],this.currentStorage.setItem("ts:test","ok"),this.currentStorage.removeItem("ts:test")}catch(e){console.warn("Failed to use browser storage. Resorting to cookies."),this.currentStorage=new w("localStorage"==t)}else this.currentStorage=new k}return i(e,[{key:"setItem",value:function(e,t){this.currentStorage.setItem(e,t)}},{key:"getItem",value:function(e){return this.currentStorage.getItem(e)}},{key:"removeItem",value:function(e){this.currentStorage.removeItem(e)}}]),e}();C.localStorage=new C("localStorage"),C.sessionStorage=new C("sessionStorage");var E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},P=a(function(e){var t,n;t=E,n=function(){var e=function e(t){if(!(this instanceof e))return new e(t);this.options=this.extend(t,{swfContainerId:"fingerprintjs2",swfPath:"flash/compiled/FontList.swf",detectScreenOrientation:!0,sortPluginsFor:[/palemoon/i],userDefinedFonts:[]}),this.nativeForEach=Array.prototype.forEach,this.nativeMap=Array.prototype.map};return e.prototype={extend:function(e,t){if(null==e)return t;for(var n in e)null!=e[n]&&t[n]!==e[n]&&(t[n]=e[n]);return t},get:function(e){var t=this,n={data:[],push:function(e){var n=e.key,r=e.value;"function"==typeof t.options.preprocessor&&(r=t.options.preprocessor(n,r)),this.data.push({key:n,value:r})}};n=this.userAgentKey(n),n=this.languageKey(n),n=this.colorDepthKey(n),n=this.pixelRatioKey(n),n=this.hardwareConcurrencyKey(n),n=this.screenResolutionKey(n),n=this.availableScreenResolutionKey(n),n=this.timezoneOffsetKey(n),n=this.sessionStorageKey(n),n=this.localStorageKey(n),n=this.indexedDbKey(n),n=this.addBehaviorKey(n),n=this.openDatabaseKey(n),n=this.cpuClassKey(n),n=this.platformKey(n),n=this.doNotTrackKey(n),n=this.pluginsKey(n),n=this.canvasKey(n),n=this.webglKey(n),n=this.adBlockKey(n),n=this.hasLiedLanguagesKey(n),n=this.hasLiedResolutionKey(n),n=this.hasLiedOsKey(n),n=this.hasLiedBrowserKey(n),n=this.touchSupportKey(n),n=this.customEntropyFunction(n),this.fontsKey(n,function(n){var r=[];t.each(n.data,function(e){var t=e.value;void 0!==e.value.join&&(t=e.value.join(";")),r.push(t)});var i=t.x64hash128(r.join("~~~"),31);return e(i,n.data)})},customEntropyFunction:function(e){return"function"==typeof this.options.customFunction&&e.push({key:"custom",value:this.options.customFunction()}),e},userAgentKey:function(e){return this.options.excludeUserAgent||e.push({key:"user_agent",value:this.getUserAgent()}),e},getUserAgent:function(){return navigator.userAgent},languageKey:function(e){return this.options.excludeLanguage||e.push({key:"language",value:navigator.language||navigator.userLanguage||navigator.browserLanguage||navigator.systemLanguage||""}),e},colorDepthKey:function(e){return this.options.excludeColorDepth||e.push({key:"color_depth",value:screen.colorDepth||-1}),e},pixelRatioKey:function(e){return this.options.excludePixelRatio||e.push({key:"pixel_ratio",value:this.getPixelRatio()}),e},getPixelRatio:function(){return window.devicePixelRatio||""},screenResolutionKey:function(e){return this.options.excludeScreenResolution?e:this.getScreenResolution(e)},getScreenResolution:function(e){var t;return void 0!==(t=this.options.detectScreenOrientation&&screen.height>screen.width?[screen.height,screen.width]:[screen.width,screen.height])&&e.push({key:"resolution",value:t}),e},availableScreenResolutionKey:function(e){return this.options.excludeAvailableScreenResolution?e:this.getAvailableScreenResolution(e)},getAvailableScreenResolution:function(e){var t;return screen.availWidth&&screen.availHeight&&(t=this.options.detectScreenOrientation?screen.availHeight>screen.availWidth?[screen.availHeight,screen.availWidth]:[screen.availWidth,screen.availHeight]:[screen.availHeight,screen.availWidth]),void 0!==t&&e.push({key:"available_resolution",value:t}),e},timezoneOffsetKey:function(e){return this.options.excludeTimezoneOffset||e.push({key:"timezone_offset",value:(new Date).getTimezoneOffset()}),e},sessionStorageKey:function(e){return!this.options.excludeSessionStorage&&this.hasSessionStorage()&&e.push({key:"session_storage",value:1}),e},localStorageKey:function(e){return!this.options.excludeSessionStorage&&this.hasLocalStorage()&&e.push({key:"local_storage",value:1}),e},indexedDbKey:function(e){return!this.options.excludeIndexedDB&&this.hasIndexedDB()&&e.push({key:"indexed_db",value:1}),e},addBehaviorKey:function(e){return document.body&&!this.options.excludeAddBehavior&&document.body.addBehavior&&e.push({key:"add_behavior",value:1}),e},openDatabaseKey:function(e){return!this.options.excludeOpenDatabase&&window.openDatabase&&e.push({key:"open_database",value:1}),e},cpuClassKey:function(e){return this.options.excludeCpuClass||e.push({key:"cpu_class",value:this.getNavigatorCpuClass()}),e},platformKey:function(e){return this.options.excludePlatform||e.push({key:"navigator_platform",value:this.getNavigatorPlatform()}),e},doNotTrackKey:function(e){return this.options.excludeDoNotTrack||e.push({key:"do_not_track",value:this.getDoNotTrack()}),e},canvasKey:function(e){return!this.options.excludeCanvas&&this.isCanvasSupported()&&e.push({key:"canvas",value:this.getCanvasFp()}),e},webglKey:function(e){return this.options.excludeWebGL?e:this.isWebGlSupported()?(e.push({key:"webgl",value:this.getWebglFp()}),e):e},adBlockKey:function(e){return this.options.excludeAdBlock||e.push({key:"adblock",value:this.getAdBlock()}),e},hasLiedLanguagesKey:function(e){return this.options.excludeHasLiedLanguages||e.push({key:"has_lied_languages",value:this.getHasLiedLanguages()}),e},hasLiedResolutionKey:function(e){return this.options.excludeHasLiedResolution||e.push({key:"has_lied_resolution",value:this.getHasLiedResolution()}),e},hasLiedOsKey:function(e){return this.options.excludeHasLiedOs||e.push({key:"has_lied_os",value:this.getHasLiedOs()}),e},hasLiedBrowserKey:function(e){return this.options.excludeHasLiedBrowser||e.push({key:"has_lied_browser",value:this.getHasLiedBrowser()}),e},fontsKey:function(e,t){return this.options.excludeJsFonts?this.flashFontsKey(e,t):this.jsFontsKey(e,t)},flashFontsKey:function(e,t){return this.options.excludeFlashFonts?t(e):this.hasSwfObjectLoaded()&&this.hasMinFlashInstalled()?void 0===this.options.swfPath?t(e):void this.loadSwfAndDetectFonts(function(n){e.push({key:"swf_fonts",value:n.join(";")}),t(e)}):t(e)},jsFontsKey:function(e,t){var n=this;return setTimeout(function(){var r=["monospace","sans-serif","serif"],i=["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial MT","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Bitstream Vera Sans Mono","Book Antiqua","Bookman Old Style","Calibri","Cambria","Cambria Math","Century","Century Gothic","Century Schoolbook","Comic Sans","Comic Sans MS","Consolas","Courier","Courier New","Garamond","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax","LUCIDA GRANDE","Lucida Handwriting","Lucida Sans","Lucida Sans Typewriter","Lucida Sans Unicode","Microsoft Sans Serif","Monaco","Monotype Corsiva","MS Gothic","MS Outlook","MS PGothic","MS Reference Sans Serif","MS Sans Serif","MS Serif","MYRIAD","MYRIAD PRO","Palatino","Palatino Linotype","Segoe Print","Segoe Script","Segoe UI","Segoe UI Light","Segoe UI Semibold","Segoe UI Symbol","Tahoma","Times","Times New Roman","Times New Roman PS","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3"];n.options.extendedJsFonts&&(i=i.concat(["Abadi MT Condensed Light","Academy Engraved LET","ADOBE CASLON PRO","Adobe Garamond","ADOBE GARAMOND PRO","Agency FB","Aharoni","Albertus Extra Bold","Albertus Medium","Algerian","Amazone BT","American Typewriter","American Typewriter Condensed","AmerType Md BT","Andalus","Angsana New","AngsanaUPC","Antique Olive","Aparajita","Apple Chancery","Apple Color Emoji","Apple SD Gothic Neo","Arabic Typesetting","ARCHER","ARNO PRO","Arrus BT","Aurora Cn BT","AvantGarde Bk BT","AvantGarde Md BT","AVENIR","Ayuthaya","Bandy","Bangla Sangam MN","Bank Gothic","BankGothic Md BT","Baskerville","Baskerville Old Face","Batang","BatangChe","Bauer Bodoni","Bauhaus 93","Bazooka","Bell MT","Bembo","Benguiat Bk BT","Berlin Sans FB","Berlin Sans FB Demi","Bernard MT Condensed","BernhardFashion BT","BernhardMod BT","Big Caslon","BinnerD","Blackadder ITC","BlairMdITC TT","Bodoni 72","Bodoni 72 Oldstyle","Bodoni 72 Smallcaps","Bodoni MT","Bodoni MT Black","Bodoni MT Condensed","Bodoni MT Poster Compressed","Bookshelf Symbol 7","Boulder","Bradley Hand","Bradley Hand ITC","Bremen Bd BT","Britannic Bold","Broadway","Browallia New","BrowalliaUPC","Brush Script MT","Californian FB","Calisto MT","Calligrapher","Candara","CaslonOpnface BT","Castellar","Centaur","Cezanne","CG Omega","CG Times","Chalkboard","Chalkboard SE","Chalkduster","Charlesworth","Charter Bd BT","Charter BT","Chaucer","ChelthmITC Bk BT","Chiller","Clarendon","Clarendon Condensed","CloisterBlack BT","Cochin","Colonna MT","Constantia","Cooper Black","Copperplate","Copperplate Gothic","Copperplate Gothic Bold","Copperplate Gothic Light","CopperplGoth Bd BT","Corbel","Cordia New","CordiaUPC","Cornerstone","Coronet","Cuckoo","Curlz MT","DaunPenh","Dauphin","David","DB LCD Temp","DELICIOUS","Denmark","DFKai-SB","Didot","DilleniaUPC","DIN","DokChampa","Dotum","DotumChe","Ebrima","Edwardian Script ITC","Elephant","English 111 Vivace BT","Engravers MT","EngraversGothic BT","Eras Bold ITC","Eras Demi ITC","Eras Light ITC","Eras Medium ITC","EucrosiaUPC","Euphemia","Euphemia UCAS","EUROSTILE","Exotc350 Bd BT","FangSong","Felix Titling","Fixedsys","FONTIN","Footlight MT Light","Forte","FrankRuehl","Fransiscan","Freefrm721 Blk BT","FreesiaUPC","Freestyle Script","French Script MT","FrnkGothITC Bk BT","Fruitger","FRUTIGER","Futura","Futura Bk BT","Futura Lt BT","Futura Md BT","Futura ZBlk BT","FuturaBlack BT","Gabriola","Galliard BT","Gautami","Geeza Pro","Geometr231 BT","Geometr231 Hv BT","Geometr231 Lt BT","GeoSlab 703 Lt BT","GeoSlab 703 XBd BT","Gigi","Gill Sans","Gill Sans MT","Gill Sans MT Condensed","Gill Sans MT Ext Condensed Bold","Gill Sans Ultra Bold","Gill Sans Ultra Bold Condensed","Gisha","Gloucester MT Extra Condensed","GOTHAM","GOTHAM BOLD","Goudy Old Style","Goudy Stout","GoudyHandtooled BT","GoudyOLSt BT","Gujarati Sangam MN","Gulim","GulimChe","Gungsuh","GungsuhChe","Gurmukhi MN","Haettenschweiler","Harlow Solid Italic","Harrington","Heather","Heiti SC","Heiti TC","HELV","Herald","High Tower Text","Hiragino Kaku Gothic ProN","Hiragino Mincho ProN","Hoefler Text","Humanst 521 Cn BT","Humanst521 BT","Humanst521 Lt BT","Imprint MT Shadow","Incised901 Bd BT","Incised901 BT","Incised901 Lt BT","INCONSOLATA","Informal Roman","Informal011 BT","INTERSTATE","IrisUPC","Iskoola Pota","JasmineUPC","Jazz LET","Jenson","Jester","Jokerman","Juice ITC","Kabel Bk BT","Kabel Ult BT","Kailasa","KaiTi","Kalinga","Kannada Sangam MN","Kartika","Kaufmann Bd BT","Kaufmann BT","Khmer UI","KodchiangUPC","Kokila","Korinna BT","Kristen ITC","Krungthep","Kunstler Script","Lao UI","Latha","Leelawadee","Letter Gothic","Levenim MT","LilyUPC","Lithograph","Lithograph Light","Long Island","Lydian BT","Magneto","Maiandra GD","Malayalam Sangam MN","Malgun Gothic","Mangal","Marigold","Marion","Marker Felt","Market","Marlett","Matisse ITC","Matura MT Script Capitals","Meiryo","Meiryo UI","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Tai Le","Microsoft Uighur","Microsoft YaHei","Microsoft Yi Baiti","MingLiU","MingLiU_HKSCS","MingLiU_HKSCS-ExtB","MingLiU-ExtB","Minion","Minion Pro","Miriam","Miriam Fixed","Mistral","Modern","Modern No. 20","Mona Lisa Solid ITC TT","Mongolian Baiti","MONO","MoolBoran","Mrs Eaves","MS LineDraw","MS Mincho","MS PMincho","MS Reference Specialty","MS UI Gothic","MT Extra","MUSEO","MV Boli","Nadeem","Narkisim","NEVIS","News Gothic","News GothicMT","NewsGoth BT","Niagara Engraved","Niagara Solid","Noteworthy","NSimSun","Nyala","OCR A Extended","Old Century","Old English Text MT","Onyx","Onyx BT","OPTIMA","Oriya Sangam MN","OSAKA","OzHandicraft BT","Palace Script MT","Papyrus","Parchment","Party LET","Pegasus","Perpetua","Perpetua Titling MT","PetitaBold","Pickwick","Plantagenet Cherokee","Playbill","PMingLiU","PMingLiU-ExtB","Poor Richard","Poster","PosterBodoni BT","PRINCETOWN LET","Pristina","PTBarnum BT","Pythagoras","Raavi","Rage Italic","Ravie","Ribbon131 Bd BT","Rockwell","Rockwell Condensed","Rockwell Extra Bold","Rod","Roman","Sakkal Majalla","Santa Fe LET","Savoye LET","Sceptre","Script","Script MT Bold","SCRIPTINA","Serifa","Serifa BT","Serifa Th BT","ShelleyVolante BT","Sherwood","Shonar Bangla","Showcard Gothic","Shruti","Signboard","SILKSCREEN","SimHei","Simplified Arabic","Simplified Arabic Fixed","SimSun","SimSun-ExtB","Sinhala Sangam MN","Sketch Rockwell","Skia","Small Fonts","Snap ITC","Snell Roundhand","Socket","Souvenir Lt BT","Staccato222 BT","Steamer","Stencil","Storybook","Styllo","Subway","Swis721 BlkEx BT","Swiss911 XCm BT","Sylfaen","Synchro LET","System","Tamil Sangam MN","Technical","Teletype","Telugu Sangam MN","Tempus Sans ITC","Terminal","Thonburi","Traditional Arabic","Trajan","TRAJAN PRO","Tristan","Tubular","Tunga","Tw Cen MT","Tw Cen MT Condensed","Tw Cen MT Condensed Extra Bold","TypoUpright BT","Unicorn","Univers","Univers CE 55 Medium","Univers Condensed","Utsaah","Vagabond","Vani","Vijaya","Viner Hand ITC","VisualUI","Vivaldi","Vladimir Script","Vrinda","Westminster","WHITNEY","Wide Latin","ZapfEllipt BT","ZapfHumnst BT","ZapfHumnst Dm BT","Zapfino","Zurich BlkEx BT","Zurich Ex BT","ZWAdobeF"])),i=i.concat(n.options.userDefinedFonts);var o=document.getElementsByTagName("body")[0],a=document.createElement("div"),s=document.createElement("div"),c={},u={},l=function(){var e=document.createElement("span");return e.style.position="absolute",e.style.left="-9999px",e.style.fontSize="72px",e.style.lineHeight="normal",e.innerHTML="mmmmmmmmmmlli",e},d=function(e,t){var n=l();return n.style.fontFamily="'"+e+"',"+t,n},h=function(){for(var e=[],t=0,n=r.length;t<n;t++){var i=l();i.style.fontFamily=r[t],a.appendChild(i),e.push(i)}return e}();o.appendChild(a);for(var p=0,f=r.length;p<f;p++)c[r[p]]=h[p].offsetWidth,u[r[p]]=h[p].offsetHeight;var m=function(){for(var e={},t=0,n=i.length;t<n;t++){for(var o=[],a=0,c=r.length;a<c;a++){var u=d(i[t],r[a]);s.appendChild(u),o.push(u)}e[i[t]]=o}return e}();o.appendChild(s);for(var g=[],v=0,y=i.length;v<y;v++)(function(e){for(var t=!1,n=0;n<r.length;n++)if(t=e[n].offsetWidth!==c[r[n]]||e[n].offsetHeight!==u[r[n]])return t;return t})(m[i[v]])&&g.push(i[v]);o.removeChild(s),o.removeChild(a),e.push({key:"js_fonts",value:g}),t(e)},1)},pluginsKey:function(e){return this.options.excludePlugins||(this.isIE()?this.options.excludeIEPlugins||e.push({key:"ie_plugins",value:this.getIEPlugins()}):e.push({key:"regular_plugins",value:this.getRegularPlugins()})),e},getRegularPlugins:function(){for(var e=[],t=0,n=navigator.plugins.length;t<n;t++)e.push(navigator.plugins[t]);return this.pluginsShouldBeSorted()&&(e=e.sort(function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),this.map(e,function(e){var t=this.map(e,function(e){return[e.type,e.suffixes].join("~")}).join(",");return[e.name,e.description,t].join("::")},this)},getIEPlugins:function(){var e=[];return(Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(window,"ActiveXObject")||"ActiveXObject"in window)&&(e=this.map(["AcroPDF.PDF","Adodb.Stream","AgControl.AgControl","DevalVRXCtrl.DevalVRXCtrl.1","MacromediaFlashPaper.MacromediaFlashPaper","Msxml2.DOMDocument","Msxml2.XMLHTTP","PDF.PdfCtrl","QuickTime.QuickTime","QuickTimeCheckObject.QuickTimeCheck.1","RealPlayer","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)","Scripting.Dictionary","SWCtl.SWCtl","Shell.UIHelper","ShockwaveFlash.ShockwaveFlash","Skype.Detection","TDCCtl.TDCCtl","WMPlayer.OCX","rmocx.RealPlayer G2 Control","rmocx.RealPlayer G2 Control.1"],function(e){try{return new ActiveXObject(e),e}catch(e){return null}})),navigator.plugins&&(e=e.concat(this.getRegularPlugins())),e},pluginsShouldBeSorted:function(){for(var e=!1,t=0,n=this.options.sortPluginsFor.length;t<n;t++){var r=this.options.sortPluginsFor[t];if(navigator.userAgent.match(r)){e=!0;break}}return e},touchSupportKey:function(e){return this.options.excludeTouchSupport||e.push({key:"touch_support",value:this.getTouchSupport()}),e},hardwareConcurrencyKey:function(e){return this.options.excludeHardwareConcurrency||e.push({key:"hardware_concurrency",value:this.getHardwareConcurrency()}),e},hasSessionStorage:function(){try{return!!window.sessionStorage}catch(e){return!0}},hasLocalStorage:function(){try{return!!window.localStorage}catch(e){return!0}},hasIndexedDB:function(){try{return!!window.indexedDB}catch(e){return!0}},getHardwareConcurrency:function(){return navigator.hardwareConcurrency?navigator.hardwareConcurrency:"unknown"},getNavigatorCpuClass:function(){return navigator.cpuClass?navigator.cpuClass:"unknown"},getNavigatorPlatform:function(){return navigator.platform?navigator.platform:"unknown"},getDoNotTrack:function(){return navigator.doNotTrack?navigator.doNotTrack:navigator.msDoNotTrack?navigator.msDoNotTrack:window.doNotTrack?window.doNotTrack:"unknown"},getTouchSupport:function(){var e=0,t=!1;void 0!==navigator.maxTouchPoints?e=navigator.maxTouchPoints:void 0!==navigator.msMaxTouchPoints&&(e=navigator.msMaxTouchPoints);try{document.createEvent("TouchEvent"),t=!0}catch(e){}return[e,t,"ontouchstart"in window]},getCanvasFp:function(){var e=[],t=document.createElement("canvas");t.width=2e3,t.height=200,t.style.display="inline";var n=t.getContext("2d");return n.rect(0,0,10,10),n.rect(2,2,6,6),e.push("canvas winding:"+(!1===n.isPointInPath(5,5,"evenodd")?"yes":"no")),n.textBaseline="alphabetic",n.fillStyle="#f60",n.fillRect(125,1,62,20),n.fillStyle="#069",this.options.dontUseFakeFontInCanvas?n.font="11pt Arial":n.font="11pt no-real-font-123",n.fillText("Cwm fjordbank glyphs vext quiz, ????",2,15),n.fillStyle="rgba(102, 204, 0, 0.2)",n.font="18pt Arial",n.fillText("Cwm fjordbank glyphs vext quiz, ????",4,45),n.globalCompositeOperation="multiply",n.fillStyle="rgb(255,0,255)",n.beginPath(),n.arc(50,50,50,0,2*Math.PI,!0),n.closePath(),n.fill(),n.fillStyle="rgb(0,255,255)",n.beginPath(),n.arc(100,50,50,0,2*Math.PI,!0),n.closePath(),n.fill(),n.fillStyle="rgb(255,255,0)",n.beginPath(),n.arc(75,100,50,0,2*Math.PI,!0),n.closePath(),n.fill(),n.fillStyle="rgb(255,0,255)",n.arc(75,75,75,0,2*Math.PI,!0),n.arc(75,75,25,0,2*Math.PI,!0),n.fill("evenodd"),e.push("canvas fp:"+t.toDataURL()),e.join("~")},getWebglFp:function(){var e,t=function(t){return e.clearColor(0,0,0,1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),"["+t[0]+", "+t[1]+"]"};if(!(e=this.getWebglCanvas()))return null;var n=[],r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r);var i=new Float32Array([-.2,-.9,0,.4,-.26,0,0,.732134444,0]);e.bufferData(e.ARRAY_BUFFER,i,e.STATIC_DRAW),r.itemSize=3,r.numItems=3;var o=e.createProgram(),a=e.createShader(e.VERTEX_SHADER);e.shaderSource(a,"attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}"),e.compileShader(a);var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,"precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}"),e.compileShader(s),e.attachShader(o,a),e.attachShader(o,s),e.linkProgram(o),e.useProgram(o),o.vertexPosAttrib=e.getAttribLocation(o,"attrVertex"),o.offsetUniform=e.getUniformLocation(o,"uniformOffset"),e.enableVertexAttribArray(o.vertexPosArray),e.vertexAttribPointer(o.vertexPosAttrib,r.itemSize,e.FLOAT,!1,0,0),e.uniform2f(o.offsetUniform,1,1),e.drawArrays(e.TRIANGLE_STRIP,0,r.numItems),null!=e.canvas&&n.push(e.canvas.toDataURL()),n.push("extensions:"+e.getSupportedExtensions().join(";")),n.push("webgl aliased line width range:"+t(e.getParameter(e.ALIASED_LINE_WIDTH_RANGE))),n.push("webgl aliased point size range:"+t(e.getParameter(e.ALIASED_POINT_SIZE_RANGE))),n.push("webgl alpha bits:"+e.getParameter(e.ALPHA_BITS)),n.push("webgl antialiasing:"+(e.getContextAttributes().antialias?"yes":"no")),n.push("webgl blue bits:"+e.getParameter(e.BLUE_BITS)),n.push("webgl depth bits:"+e.getParameter(e.DEPTH_BITS)),n.push("webgl green bits:"+e.getParameter(e.GREEN_BITS)),n.push("webgl max anisotropy:"+function(e){var t,n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic");return n?(0===(t=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT))&&(t=2),t):null}(e)),n.push("webgl max combined texture image units:"+e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS)),n.push("webgl max cube map texture size:"+e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE)),n.push("webgl max fragment uniform vectors:"+e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS)),n.push("webgl max render buffer size:"+e.getParameter(e.MAX_RENDERBUFFER_SIZE)),n.push("webgl max texture image units:"+e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)),n.push("webgl max texture size:"+e.getParameter(e.MAX_TEXTURE_SIZE)),n.push("webgl max varying vectors:"+e.getParameter(e.MAX_VARYING_VECTORS)),n.push("webgl max vertex attribs:"+e.getParameter(e.MAX_VERTEX_ATTRIBS)),n.push("webgl max vertex texture image units:"+e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),n.push("webgl max vertex uniform vectors:"+e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS)),n.push("webgl max viewport dims:"+t(e.getParameter(e.MAX_VIEWPORT_DIMS))),n.push("webgl red bits:"+e.getParameter(e.RED_BITS)),n.push("webgl renderer:"+e.getParameter(e.RENDERER)),n.push("webgl shading language version:"+e.getParameter(e.SHADING_LANGUAGE_VERSION)),n.push("webgl stencil bits:"+e.getParameter(e.STENCIL_BITS)),n.push("webgl vendor:"+e.getParameter(e.VENDOR)),n.push("webgl version:"+e.getParameter(e.VERSION));try{var c=e.getExtension("WEBGL_debug_renderer_info");c&&(n.push("webgl unmasked vendor:"+e.getParameter(c.UNMASKED_VENDOR_WEBGL)),n.push("webgl unmasked renderer:"+e.getParameter(c.UNMASKED_RENDERER_WEBGL)))}catch(e){}return e.getShaderPrecisionFormat?(n.push("webgl vertex shader high float precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision),n.push("webgl vertex shader high float precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).rangeMin),n.push("webgl vertex shader high float precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).rangeMax),n.push("webgl vertex shader medium float precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision),n.push("webgl vertex shader medium float precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).rangeMin),n.push("webgl vertex shader medium float precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).rangeMax),n.push("webgl vertex shader low float precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_FLOAT).precision),n.push("webgl vertex shader low float precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_FLOAT).rangeMin),n.push("webgl vertex shader low float precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_FLOAT).rangeMax),n.push("webgl fragment shader high float precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision),n.push("webgl fragment shader high float precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).rangeMin),n.push("webgl fragment shader high float precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).rangeMax),n.push("webgl fragment shader medium float precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision),n.push("webgl fragment shader medium float precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).rangeMin),n.push("webgl fragment shader medium float precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).rangeMax),n.push("webgl fragment shader low float precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_FLOAT).precision),n.push("webgl fragment shader low float precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_FLOAT).rangeMin),n.push("webgl fragment shader low float precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_FLOAT).rangeMax),n.push("webgl vertex shader high int precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_INT).precision),n.push("webgl vertex shader high int precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_INT).rangeMin),n.push("webgl vertex shader high int precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_INT).rangeMax),n.push("webgl vertex shader medium int precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_INT).precision),n.push("webgl vertex shader medium int precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_INT).rangeMin),n.push("webgl vertex shader medium int precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_INT).rangeMax),n.push("webgl vertex shader low int precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_INT).precision),n.push("webgl vertex shader low int precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_INT).rangeMin),n.push("webgl vertex shader low int precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_INT).rangeMax),n.push("webgl fragment shader high int precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_INT).precision),n.push("webgl fragment shader high int precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_INT).rangeMin),n.push("webgl fragment shader high int precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_INT).rangeMax),n.push("webgl fragment shader medium int precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_INT).precision),n.push("webgl fragment shader medium int precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_INT).rangeMin),n.push("webgl fragment shader medium int precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_INT).rangeMax),n.push("webgl fragment shader low int precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_INT).precision),n.push("webgl fragment shader low int precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_INT).rangeMin),n.push("webgl fragment shader low int precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_INT).rangeMax),n.join("~")):n.join("~")},getAdBlock:function(){var e=document.createElement("div");e.innerHTML="&nbsp;",e.className="adsbox";var t=!1;try{document.body.appendChild(e),t=0===document.getElementsByClassName("adsbox")[0].offsetHeight,document.body.removeChild(e)}catch(e){t=!1}return t},getHasLiedLanguages:function(){if(void 0!==navigator.languages)try{if(navigator.languages[0].substr(0,2)!==navigator.language.substr(0,2))return!0}catch(e){return!0}return!1},getHasLiedResolution:function(){return screen.width<screen.availWidth||screen.height<screen.availHeight},getHasLiedOs:function(){var e,t=navigator.userAgent.toLowerCase(),n=navigator.oscpu,r=navigator.platform.toLowerCase();if(e=t.indexOf("windows phone")>=0?"Windows Phone":t.indexOf("win")>=0?"Windows":t.indexOf("android")>=0?"Android":t.indexOf("linux")>=0?"Linux":t.indexOf("iphone")>=0||t.indexOf("ipad")>=0?"iOS":t.indexOf("mac")>=0?"Mac":"Other",("ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0)&&"Windows Phone"!==e&&"Android"!==e&&"iOS"!==e&&"Other"!==e)return!0;if(void 0!==n){if((n=n.toLowerCase()).indexOf("win")>=0&&"Windows"!==e&&"Windows Phone"!==e)return!0;if(n.indexOf("linux")>=0&&"Linux"!==e&&"Android"!==e)return!0;if(n.indexOf("mac")>=0&&"Mac"!==e&&"iOS"!==e)return!0;if(0===n.indexOf("win")&&0===n.indexOf("linux")&&n.indexOf("mac")>=0&&"other"!==e)return!0}return r.indexOf("win")>=0&&"Windows"!==e&&"Windows Phone"!==e||(r.indexOf("linux")>=0||r.indexOf("android")>=0||r.indexOf("pike")>=0)&&"Linux"!==e&&"Android"!==e||(r.indexOf("mac")>=0||r.indexOf("ipad")>=0||r.indexOf("ipod")>=0||r.indexOf("iphone")>=0)&&"Mac"!==e&&"iOS"!==e||0===r.indexOf("win")&&0===r.indexOf("linux")&&r.indexOf("mac")>=0&&"other"!==e||void 0===navigator.plugins&&"Windows"!==e&&"Windows Phone"!==e},getHasLiedBrowser:function(){var e,t=navigator.userAgent.toLowerCase(),n=navigator.productSub;if(("Chrome"==(e=t.indexOf("firefox")>=0?"Firefox":t.indexOf("opera")>=0||t.indexOf("opr")>=0?"Opera":t.indexOf("chrome")>=0?"Chrome":t.indexOf("safari")>=0?"Safari":t.indexOf("trident")>=0?"Internet Explorer":"Other")||"Safari"===e||"Opera"===e)&&"20030107"!==n)return!0;var r,i=eval.toString().length;if(37===i&&"Safari"!==e&&"Firefox"!==e&&"Other"!==e)return!0;if(39===i&&"Internet Explorer"!==e&&"Other"!==e)return!0;if(33===i&&"Chrome"!==e&&"Opera"!==e&&"Other"!==e)return!0;try{throw"a"}catch(e){try{e.toSource(),r=!0}catch(e){r=!1}}return!(!r||"Firefox"===e||"Other"===e)},isCanvasSupported:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},isWebGlSupported:function(){if(!this.isCanvasSupported())return!1;var e,t=document.createElement("canvas");try{e=t.getContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))}catch(t){e=!1}return!!window.WebGLRenderingContext&&!!e},isIE:function(){return"Microsoft Internet Explorer"===navigator.appName||!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},hasSwfObjectLoaded:function(){return void 0!==window.swfobject},hasMinFlashInstalled:function(){return swfobject.hasFlashPlayerVersion("9.0.0")},addFlashDivNode:function(){var e=document.createElement("div");e.setAttribute("id",this.options.swfContainerId),document.body.appendChild(e)},loadSwfAndDetectFonts:function(e){var t="___fp_swf_loaded";window[t]=function(t){e(t)};var n=this.options.swfContainerId;this.addFlashDivNode();var r={onReady:t};swfobject.embedSWF(this.options.swfPath,n,"1","1","9.0.0",!1,r,{allowScriptAccess:"always",menu:"false"},{})},getWebglCanvas:function(){var e=document.createElement("canvas"),t=null;try{t=e.getContext("webgl")||e.getContext("experimental-webgl")}catch(e){}return t||(t=null),t},each:function(e,t,n){if(null!==e)if(this.nativeForEach&&e.forEach===this.nativeForEach)e.forEach(t,n);else if(e.length===+e.length){for(var r=0,i=e.length;r<i;r++)if(t.call(n,e[r],r,e)==={})return}else for(var o in e)if(e.hasOwnProperty(o)&&t.call(n,e[o],o,e)==={})return},map:function(e,t,n){var r=[];return null==e?r:this.nativeMap&&e.map===this.nativeMap?e.map(t,n):(this.each(e,function(e,i,o){r[r.length]=t.call(n,e,i,o)}),r)},x64Add:function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},x64Multiply:function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},x64Rotl:function(e,t){return 32==(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])},x64LeftShift:function(e,t){return 0==(t%=64)?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]},x64Xor:function(e,t){return[e[0]^t[0],e[1]^t[1]]},x64Fmix:function(e){return e=this.x64Xor(e,[0,e[0]>>>1]),e=this.x64Multiply(e,[4283543511,3981806797]),e=this.x64Xor(e,[0,e[0]>>>1]),e=this.x64Multiply(e,[3301882366,444984403]),this.x64Xor(e,[0,e[0]>>>1])},x64hash128:function(e,t){t=t||0;for(var n=(e=e||"").length%16,r=e.length-n,i=[0,t],o=[0,t],a=[0,0],s=[0,0],c=[2277735313,289559509],u=[1291169091,658871167],l=0;l<r;l+=16)a=[255&e.charCodeAt(l+4)|(255&e.charCodeAt(l+5))<<8|(255&e.charCodeAt(l+6))<<16|(255&e.charCodeAt(l+7))<<24,255&e.charCodeAt(l)|(255&e.charCodeAt(l+1))<<8|(255&e.charCodeAt(l+2))<<16|(255&e.charCodeAt(l+3))<<24],s=[255&e.charCodeAt(l+12)|(255&e.charCodeAt(l+13))<<8|(255&e.charCodeAt(l+14))<<16|(255&e.charCodeAt(l+15))<<24,255&e.charCodeAt(l+8)|(255&e.charCodeAt(l+9))<<8|(255&e.charCodeAt(l+10))<<16|(255&e.charCodeAt(l+11))<<24],a=this.x64Multiply(a,c),a=this.x64Rotl(a,31),a=this.x64Multiply(a,u),i=this.x64Xor(i,a),i=this.x64Rotl(i,27),i=this.x64Add(i,o),i=this.x64Add(this.x64Multiply(i,[0,5]),[0,1390208809]),s=this.x64Multiply(s,u),s=this.x64Rotl(s,33),s=this.x64Multiply(s,c),o=this.x64Xor(o,s),o=this.x64Rotl(o,31),o=this.x64Add(o,i),o=this.x64Add(this.x64Multiply(o,[0,5]),[0,944331445]);switch(a=[0,0],s=[0,0],n){case 15:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(l+14)],48));case 14:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(l+13)],40));case 13:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(l+12)],32));case 12:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(l+11)],24));case 11:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(l+10)],16));case 10:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(l+9)],8));case 9:s=this.x64Xor(s,[0,e.charCodeAt(l+8)]),s=this.x64Multiply(s,u),s=this.x64Rotl(s,33),s=this.x64Multiply(s,c),o=this.x64Xor(o,s);case 8:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+7)],56));case 7:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+6)],48));case 6:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+5)],40));case 5:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+4)],32));case 4:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+3)],24));case 3:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+2)],16));case 2:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+1)],8));case 1:a=this.x64Xor(a,[0,e.charCodeAt(l)]),a=this.x64Multiply(a,c),a=this.x64Rotl(a,31),a=this.x64Multiply(a,u),i=this.x64Xor(i,a)}return i=this.x64Xor(i,[0,e.length]),o=this.x64Xor(o,[0,e.length]),i=this.x64Add(i,o),o=this.x64Add(o,i),i=this.x64Fmix(i),o=this.x64Fmix(o),i=this.x64Add(i,o),o=this.x64Add(o,i),("00000000"+(i[0]>>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)}},e.VERSION="1.5.1",e},e.exports?e.exports=n():t.exports?t.exports=n():t.Fingerprint2=n()}),T={default:P,__moduleExports:P},R="ts.fp.binding_id",D={},x=[s("binding_id",function(){return window.localStorage?window.localStorage.getItem(R):null}),s("collector_version",function(){return"1.0.0"}),s("local_ip",new Promise(function(e,t){!function(e){var t=setTimeout(function(){e(null)},300),n={},r=window,i=r.RTCPeerConnection||r.mozRTCPeerConnection||r.webkitRTCPeerConnection,o=(r.webkitRTCPeerConnection,new i({iceServers:[{urls:"stun:dummysrv.dummyserver.com.nowhere"}]},{optional:[{RtpDataChannels:!0}]}));o.onicecandidate=function(r){var i,o;r.candidate&&(i=r.candidate.candidate,o=/([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec(i)[1],void 0===n[o]&&(clearTimeout(t),e(o)),n[o]=!0)},o.createDataChannel(""),o.createOffer({}).then(function(e){o.setLocalDescription(e,function(){},function(){})},function(){})}(function(n){n?e&&(e(n),e=null):t("Timeout")})})),s("cpu_cores",function(){return navigator.hardwareConcurrency})],L=null,M=function(e){var t=Object.keys(D).map(function(e){return s(e,D[e])}),n=x.concat(function(e){return L||(L=new Promise(function(t,n){var r={};e||(r.excludeCanvas=!0,r.excludeWebGL=!0),new P(r).get(function(e,n){for(var r={},i=0;i<n.length;i++)r[n[i].key]=n[i].value;t({fp2_hash:e,fp2_keys:r})})})),L}(e)).concat(t);return Promise.all(n).then(function(e){return function(e){var t={};return Object.assign.apply(null,[t].concat(e)),t}(e)})},F=a(function(e,n){!function(r,i){var o="model",a="name",s="type",c="vendor",u="version",l="mobile",d="tablet",h={extend:function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},has:function(e,t){return"string"==typeof e&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return"string"===t(e)?e.replace(/[^\d\.]/g,"").split(".")[0]:void 0},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},p={rgx:function(e,n){for(var r,i,o,a,s,c,u=0;u<n.length&&!s;){var l=n[u],d=n[u+1];for(r=i=0;r<l.length&&!s;)if(s=l[r++].exec(e))for(o=0;o<d.length;o++)c=s[++i],"object"===t(a=d[o])&&a.length>0?2==a.length?"function"==t(a[1])?this[a[0]]=a[1].call(this,c):this[a[0]]=a[1]:3==a.length?"function"!==t(a[1])||a[1].exec&&a[1].test?this[a[0]]=c?c.replace(a[1],a[2]):void 0:this[a[0]]=c?a[1].call(this,c,a[2]):void 0:4==a.length&&(this[a[0]]=c?a[3].call(this,c.replace(a[1],a[2])):void 0):this[a]=c||void 0;u+=2}},str:function(e,n){for(var r in n)if("object"===t(n[r])&&n[r].length>0){for(var i=0;i<n[r].length;i++)if(h.has(n[r][i],e))return"?"===r?void 0:r}else if(h.has(n[r],e))return"?"===r?void 0:r;return e}},f={browser:{oldsafari:{version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{amazon:{model:{"Fire Phone":["SD","KF"]}},sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"}}}},m={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[a,u],[/(opios)[\/\s]+([\w\.]+)/i],[[a,"Opera Mini"],u],[/\s(opr)\/([\w\.]+)/i],[[a,"Opera"],u],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser)\/([\w\.-]+)/i],[a,u],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[a,"IE"],u],[/(edge)\/((\d+)?[\w\.]+)/i],[a,u],[/(yabrowser)\/([\w\.]+)/i],[[a,"Yandex"],u],[/(puffin)\/([\w\.]+)/i],[[a,"Puffin"],u],[/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[[a,"UCBrowser"],u],[/(comodo_dragon)\/([\w\.]+)/i],[[a,/_/g," "],u],[/(micromessenger)\/([\w\.]+)/i],[[a,"WeChat"],u],[/(QQ)\/([\d\.]+)/i],[a,u],[/m?(qqbrowser)[\/\s]?([\w\.]+)/i],[a,u],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[u,[a,"MIUI Browser"]],[/;fbav\/([\w\.]+);/i],[u,[a,"Facebook"]],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[u,[a,"Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[[a,/(.+)/,"$1 WebView"],u],[/((?:oculus|samsung)browser)\/([\w\.]+)/i],[[a,/(.+(?:g|us))(.+)/,"$1 $2"],u],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i],[u,[a,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[a,u],[/(dolfin)\/([\w\.]+)/i],[[a,"Dolphin"],u],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[a,"Chrome"],u],[/(coast)\/([\w\.]+)/i],[[a,"Opera Coast"],u],[/fxios\/([\w\.-]+)/i],[u,[a,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[u,[a,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[u,a],[/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[[a,"GSA"],u],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[a,[u,p.str,f.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[a,u],[/(navigator|netscape)\/([\w\.-]+)/i],[[a,"Netscape"],u],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[a,u]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[["architecture","amd64"]],[/(ia32(?=;))/i],[["architecture",h.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[["architecture","ia32"]],[/windows\s(ce|mobile);\sppc;/i],[["architecture","arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[["architecture",/ower/,"",h.lowerize]],[/(sun4\w)[;\)]/i],[["architecture","sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[["architecture",h.lowerize]]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],[o,c,[s,d]],[/applecoremedia\/[\w\.]+ \((ipad)/],[o,[c,"Apple"],[s,d]],[/(apple\s{0,1}tv)/i],[[o,"Apple TV"],[c,"Apple"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(hp).+(tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],[c,o,[s,d]],[/(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i],[o,[c,"Amazon"],[s,d]],[/(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i],[[o,p.str,f.device.amazon.model],[c,"Amazon"],[s,l]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[o,c,[s,l]],[/\((ip[honed|\s\w*]+);/i],[o,[c,"Apple"],[s,l]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],[c,o,[s,l]],[/\(bb10;\s(\w+)/i],[o,[c,"BlackBerry"],[s,l]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i],[o,[c,"Asus"],[s,d]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[[c,"Sony"],[o,"Xperia Tablet"],[s,d]],[/android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i],[o,[c,"Sony"],[s,l]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],[c,o,[s,"console"]],[/android.+;\s(shield)\sbuild/i],[o,[c,"Nvidia"],[s,"console"]],[/(playstation\s[34portablevi]+)/i],[o,[c,"Sony"],[s,"console"]],[/(sprint\s(\w+))/i],[[c,p.str,f.device.sprint.vendor],[o,p.str,f.device.sprint.model],[s,l]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],[c,o,[s,d]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w+)*/i,/(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i],[c,[o,/_/g," "],[s,l]],[/(nexus\s9)/i],[o,[c,"HTC"],[s,d]],[/d\/huawei([\w\s-]+)[;\)]/i,/(nexus\s6p)/i],[o,[c,"Huawei"],[s,l]],[/(microsoft);\s(lumia[\s\w]+)/i],[c,o,[s,l]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[o,[c,"Microsoft"],[s,"console"]],[/(kin\.[onetw]{3})/i],[[o,/\./g," "],[c,"Microsoft"],[s,l]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w+)*/i,/(XT\d{3,4}) build\//i,/(nexus\s6)/i],[o,[c,"Motorola"],[s,l]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[o,[c,"Motorola"],[s,d]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[c,h.trim],[o,h.trim],[s,"smarttv"]],[/hbbtv.+maple;(\d+)/i],[[o,/^/,"SmartTV"],[c,"Samsung"],[s,"smarttv"]],[/\(dtv[\);].+(aquos)/i],[o,[c,"Sharp"],[s,"smarttv"]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[[c,"Samsung"],o,[s,d]],[/smart-tv.+(samsung)/i],[c,[s,"smarttv"],o],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i,/sec-((sgh\w+))/i],[[c,"Samsung"],o,[s,l]],[/sie-(\w+)*/i],[o,[c,"Siemens"],[s,l]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]+)*/i],[[c,"Nokia"],o,[s,l]],[/android\s3\.[\s\w;-]{10}(a\d{3})/i],[o,[c,"Acer"],[s,d]],[/android.+([vl]k\-?\d{3})\s+build/i],[o,[c,"LG"],[s,d]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[c,"LG"],o,[s,d]],[/(lg) netcast\.tv/i],[c,o,[s,"smarttv"]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w+)*/i,/android.+lg(\-?[\d\w]+)\s+build/i],[o,[c,"LG"],[s,l]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[o,[c,"Lenovo"],[s,d]],[/linux;.+((jolla));/i],[c,o,[s,l]],[/((pebble))app\/[\d\.]+\s/i],[c,o,[s,"wearable"]],[/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[c,o,[s,l]],[/crkey/i],[[o,"Chromecast"],[c,"Google"]],[/android.+;\s(glass)\s\d/i],[o,[c,"Google"],[s,"wearable"]],[/android.+;\s(pixel c)\s/i],[o,[c,"Google"],[s,d]],[/android.+;\s(pixel xl|pixel)\s/i],[o,[c,"Google"],[s,l]],[/android.+(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d\w)?)\s+build/i,/android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+)?)\s+build/i],[[o,/_/g," "],[c,"Xiaomi"],[s,l]],[/android.+(mi[\s\-_]*(?:pad)?(?:[\s_]*[\w\s]+)?)\s+build/i],[[o,/_/g," "],[c,"Xiaomi"],[s,d]],[/android.+;\s(m[1-5]\snote)\sbuild/i],[o,[c,"Meizu"],[s,d]],[/android.+a000(1)\s+build/i],[o,[c,"OnePlus"],[s,l]],[/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i],[o,[c,"RCA"],[s,d]],[/android.+[;\/]\s*(Venue[\d\s]*)\s+build/i],[o,[c,"Dell"],[s,d]],[/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i],[o,[c,"Verizon"],[s,d]],[/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i],[[c,"Barnes & Noble"],o,[s,d]],[/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i],[o,[c,"NuVision"],[s,d]],[/android.+[;\/]\s*(zte)?.+(k\d{2})\s+build/i],[[c,"ZTE"],o,[s,d]],[/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i],[o,[c,"Swiss"],[s,l]],[/android.+[;\/]\s*(zur\d{3})\s+build/i],[o,[c,"Swiss"],[s,d]],[/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i],[o,[c,"Zeki"],[s,d]],[/(android).+[;\/]\s+([YR]\d{2}x?.*)\s+build/i,/android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(.+)\s+build/i],[[c,"Dragon Touch"],o,[s,d]],[/android.+[;\/]\s*(NS-?.+)\s+build/i],[o,[c,"Insignia"],[s,d]],[/android.+[;\/]\s*((NX|Next)-?.+)\s+build/i],[o,[c,"NextBook"],[s,d]],[/android.+[;\/]\s*(Xtreme\_?)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i],[[c,"Voice"],o,[s,l]],[/android.+[;\/]\s*(LVTEL\-?)?(V1[12])\s+build/i],[[c,"LvTel"],o,[s,l]],[/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i],[o,[c,"Envizen"],[s,d]],[/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(.*\b)\s+build/i],[c,o,[s,d]],[/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i],[o,[c,"MachSpeed"],[s,d]],[/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i],[c,o,[s,d]],[/android.+[;\/]\s*TU_(1491)\s+build/i],[o,[c,"Rotor"],[s,d]],[/android.+(KS(.+))\s+build/i],[o,[c,"Amazon"],[s,d]],[/android.+(Gigaset)[\s\-]+(Q.+)\s+build/i],[c,o,[s,d]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[[s,h.lowerize],c,o],[/(android.+)[;\/].+build/i],[o,[c,"Generic"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[u,[a,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[a,u],[/rv\:([\w\.]+).*(gecko)/i],[u,a]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[a,u],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s]+\w)*/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[a,[u,p.str,f.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[a,"Windows"],[u,p.str,f.os.windows.version]],[/\((bb)(10);/i],[[a,"BlackBerry"],u],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[a,u],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[a,"Symbian"],u],[/\((series40);/i],[a],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[a,"Firefox OS"],u],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[a,u],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[a,"Chromium OS"],u],[/(sunos)\s?([\w\.]+\d)*/i],[[a,"Solaris"],u],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[a,u],[/(haiku)\s(\w+)/i],[a,u],[/cfnetwork\/.+darwin/i,/ip[honead]+(?:.*os\s([\w]+)\slike\smac|;\sopera)/i],[[u,/_/g,"."],[a,"iOS"]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[a,"Mac OS"],[u,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[a,u]]},g=function e(n,i){if("object"===t(n)&&(i=n,n=void 0),!(this instanceof e))return new e(n,i).getResult();var o=n||(r&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),a=i?h.extend(m,i):m;return this.getBrowser=function(){var e={name:void 0,version:void 0};return p.rgx.call(e,o,a.browser),e.major=h.major(e.version),e},this.getCPU=function(){var e={architecture:void 0};return p.rgx.call(e,o,a.cpu),e},this.getDevice=function(){var e={vendor:void 0,model:void 0,type:void 0};return p.rgx.call(e,o,a.device),e},this.getEngine=function(){var e={name:void 0,version:void 0};return p.rgx.call(e,o,a.engine),e},this.getOS=function(){var e={name:void 0,version:void 0};return p.rgx.call(e,o,a.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return o},this.setUA=function(e){return o=e,this},this};g.VERSION="0.7.17",g.BROWSER={NAME:a,MAJOR:"major",VERSION:u},g.CPU={ARCHITECTURE:"architecture"},g.DEVICE={MODEL:o,VENDOR:c,TYPE:s,CONSOLE:"console",MOBILE:l,SMARTTV:"smarttv",TABLET:d,WEARABLE:"wearable",EMBEDDED:"embedded"},g.ENGINE={NAME:a,VERSION:u},g.OS={NAME:a,VERSION:u},e.exports&&(n=e.exports=g),n.UAParser=g;var v=r&&(r.jQuery||r.Zepto);if("undefined"!==t(v)){var y=new g;v.ua=y.getResult(),v.ua.get=function(){return y.getUA()},v.ua.set=function(e){y.setUA(e);var t=y.getResult();for(var n in t)v.ua[n]=t[n]}}}("object"===("undefined"==typeof window?"undefined":t(window))?window:E)}),O={default:F,__moduleExports:F,UAParser:F.UAParser},N=void 0,H=function(){function e(){n(this,e),this.logLevel=com.ts.mobile.sdk.LogLevel.Error,this.collectionResultsPromise=null,this.internalLogger=new S,this.externalLogger=null,window.__XMSDK_PLUGINS={}}return i(e,[{key:"initialize",value:function(e){var t=this;return new Promise(function(n,r){t.enabledCollectors=e,n(!0)})}},{key:"setLogLevel",value:function(e){this.logLevel=e}},{key:"log",value:function(e,t,n){e<=this.logLevel&&this.internalLogger.log(e,t,n),this.externalLogger&&this.externalLogger.log(e,t,n)}},{key:"readStorageKey",value:function(e){return JSON.parse(C.localStorage.getItem(e)||"{}")}},{key:"writeStorageKey",value:function(e,t){C.localStorage.setItem(e,JSON.stringify(t))}},{key:"deleteStorageKey",value:function(e){C.localStorage.removeItem(e)}},{key:"readSessionStorageKey",value:function(e){return JSON.parse(C.sessionStorage.getItem(e)||"{}")}},{key:"writeSessionStorageKey",value:function(e,t){C.sessionStorage.setItem(e,JSON.stringify(t))}},{key:"deleteSessionStorageKey",value:function(e){C.sessionStorage.removeItem(e)}},{key:"promiseCollectionResult",value:function(){var e=this;return new Promise(function(t,n){var r={location:{allow:e.enabledCollectors.indexOf(com.ts.mobile.sdk.CollectorType.Location)>=0,timeout:4e3,maximumAge:18e4},largeData:e.enabledCollectors.indexOf(com.ts.mobile.sdk.CollectorType.LargeData)>=0},i=new Promise(function(e,t){(function(e){function t(e,t,r,i){n={enabled:e||!1,lat:t,lng:r,error:i}}var n=void 0,r=function(){n=void 0},i=function(r,i){n=void 0;var c=e.location;if(!c.allow)return t(!1),void s(r,i);if(o(navigator.geolocation)||"function"!=typeof navigator.geolocation.getCurrentPosition)return t(!1),void s(r,i);var u=setTimeout(function(){l({code:3})},c.timeout),l=function(e){clearTimeout(u),t(!0,void 0,void 0,a(e.code)),s(r,i)};navigator.geolocation.getCurrentPosition(function(e){clearTimeout(u),t(!0,e.coords.latitude,e.coords.longitude),s(r,i)},l,c)},o=function(e){return null==e},a=function(e){return 1===e?"permission_denied":2===e?"position_unavailable":3===e?"timeout":"unknown"},s=function(e,t){if(!o(N)&&!o(n)){var i={metadata:{timestamp:Date.now()},content:{device_details:c(N,t),location:n}};r(),e(i)}},c=function(e,t){var n={device_id:e.id},r=e.details,i=(new t.UAParser).setUA(navigator.userAgent).getResult();return n.os_type=i.os.name,n.os_version=i.os.version,n.device_model=i.browser.name+" "+i.browser.version,n.device_platform=r.navigator_platform,n.tampered=u(r),n.timezone_offset=r.timezone_offset,n},u=function(e){return e&&(e.has_lied_browser||e.has_lied_language||e.has_lied_os||e.has_lied_resolution)};return(e=e||{}).location=function(e,t){var n={};for(var r in t=t||{},e=e||{})n[r]=e[r];for(var r in t)n[r]=t[r];return n}({allow:!1,timeout:4e3,maximumAge:18e4},e.location),r(),{get:function(e){(function(e,t,n){N?s(e,n):new t.default({excludeUserAgent:!0,excludeScreenResolution:!0,excludeJsFonts:!0,excludeFlashFonts:!0,excludePlugins:!0,excludeColorDepth:!0}).get(function(t,r){for(var i={},o=0,a=(r=r||[]).length;o<a;o++){var c=r[o];i[c.key]=c.value}N={id:t,details:i},s(e,n)})})(e,T,O),i(e,O)}}})(r).get(function(t){e(t)})}),o=new Promise(function(e,t){M(r.largeData).then(function(t){e(t)})});e.collectionResultsPromise=Promise.all([i,o]).then(function(e){var t=Object.assign(e[0],e[1]);return t.toJson=function(){return t},t}),t(e.collectionResultsPromise)})}},{key:"calcHexStringEncodedMd5Hash",value:function(e){return function(e,t,n){return t?n?A(t,e):v(A(t,e)):n?b(e):v(b(e))}(com.ts.mobile.sdk.util.hexToAscii(e))}},{key:"generateRandomHexString",value:function(e){var t=new Uint8Array(e);(window.crypto||window.msCrypto).getRandomValues(t);for(var n="",r=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],i=0;i<t.length;i++)n+=r[15&t[i]];return n}},{key:"queryHostInfo",value:function(e){switch(e){case com.ts.mobile.sdkhost.HostInformationKey.Version:return"4.2.0";case com.ts.mobile.sdkhost.HostInformationKey.Platform:return"web";case com.ts.mobile.sdkhost.HostInformationKey.FingerprintSupported:return"false";case com.ts.mobile.sdkhost.HostInformationKey.HostProvidedFeatures:return"";case com.ts.mobile.sdkhost.HostInformationKey.FaceIdKeyBioProtectionSupported:case com.ts.mobile.sdkhost.HostInformationKey.ImageAcquitisionSupported:return"false";case com.ts.mobile.sdkhost.HostInformationKey.AudioAcquitisionSupported:return"true";case com.ts.mobile.sdkhost.HostInformationKey.PersistentKeysSupported:case com.ts.mobile.sdkhost.HostInformationKey.FidoClientPresent:case com.ts.mobile.sdkhost.HostInformationKey.DyadicPresent:return"false";case com.ts.mobile.sdkhost.HostInformationKey.Fido2ClientPresent:return navigator.credentials&&window.PublicKeyCredential?"true":"false";case com.ts.mobile.sdkhost.HostInformationKey.DeviceStrongAuthenticationSupported:return"false";default:throw new Error("Info key is unsupported: ".concat(e))}}},{key:"setExternalLogger",value:function(e){this.externalLogger=e}},{key:"getCurrentTime",value:function(){return Date.now()}},{key:"createDelayedPromise",value:function(e){return new Promise(function(t){setTimeout(t(e),e)})}},{key:"transformApiPath",value:function(e){var t=e.split("/");return t[0]="mobile"!==t[0]||"device"!==t[1]&&"devices"!==t[1]?t[0]:"web",t[0]="auth"===t[0]?"web":t[0],t[1]="login"===t[1]?"authenticate":t[1],t.join("/")}},{key:"calcHexStringEncodedHmacSha1HashWithHexEncodedKey",value:function(e,t){return this.log(com.ts.mobile.sdk.LogLevel.Error,"not-implemented","calcHexStringEncodedHmacSha1HashWithHexEncodedKey not implemented for tarsus-web"),null}},{key:"generatePbkdf2HmacSha1HexString",value:function(e,t,n,r){return Promise.reject("generatePbkdf2HmacSha1HexString not implemented for tarsus-web")}},{key:"fidoClientXact",value:function(e,t,n,r){return Promise.reject("fidoClientXact not implemented for tarsus-web")}},{key:"fido2CredentialsOp",value:function(e,t,n,r,i){var o,a=this,s=navigator,c=i,u=["NotAllowedError","AbortError"],l=function(e){for(var t=new Int8Array(e),n=Array(t.length),r=0;r<n.length;r++)n[r]=t[r];return n},d=function(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0,i=e.length;r<i;r++)n[r]=e.charCodeAt(r);return t};switch(r){case com.ts.mobile.sdkhost.Fido2CredentialsOpType.Create:"string"==typeof c.publicKey.challenge&&(c.publicKey.challenge=d(c.publicKey.challenge),c.publicKey.user.id=d(c.publicKey.user.id),c.publicKey.excludeCredentials=c.publicKey.excludeCredentials.map(function(e){return e.id=base64js.toByteArray(e.id),e})),o=s.credentials.create(c).then(function(e){return{type:"public-key",id:e.id,rawId:l(e.rawId),response:{attestationObject:l(e.response.attestationObject),clientDataJSON:l(e.response.clientDataJSON)}}});break;case com.ts.mobile.sdkhost.Fido2CredentialsOpType.Get:"string"==typeof c.publicKey.challenge&&(c.publicKey.challenge=d(c.publicKey.challenge),c.publicKey.allowCredentials&&(c.publicKey.allowCredentials=c.publicKey.allowCredentials.map(function(e){return e.id=base64js.toByteArray(e.id),e}))),o=s.credentials.get(c).then(function(e){return{type:"public-key",id:e.id,rawId:l(e.rawId),response:{clientDataJSON:l(e.response.clientDataJSON),authenticatorData:l(e.response.authenticatorData),signature:l(e.response.signature),userHandle:e.response.userHandle&&l(e.response.userHandle)}}})}return o.catch(function(e){throw u.indexOf(e.name)>-1?(a.log(com.ts.mobile.sdk.LogLevel.Debug,"fido2","Received FIDO2 cancellation request from platform; Error: ".concat(e)),new com.ts.mobile.sdk.impl.AuthenticationErrorImpl(com.ts.mobile.sdk.AuthenticationErrorCode.UserCanceled,"Redirection to next policy canceled.")):e})}},{key:"generateKeyPair",value:function(e,t,n,r){return Promise.reject("generateKeyPair not implemented for tarsus-web")}},{key:"getKeyPair",value:function(e,t,n){return this.log(com.ts.mobile.sdk.LogLevel.Error,"not-implemented","getKeyPair not implemented for tarsus-web"),null}},{key:"deleteKeyPair",value:function(e){this.log(com.ts.mobile.sdk.LogLevel.Error,"not-implemented","deleteKeyPair not implemented for tarsus-web")}},{key:"importSymmetricKey",value:function(e,t,n,r){return this.log(com.ts.mobile.sdk.LogLevel.Error,"not-implemented","importSymmetricKey not implemented for tarsus-web"),null}},{key:"calcHexStringEncodedSha256Hash",value:function(e){var t=com.ts.mobile.sdk.util.hexToAscii(e);return sha256(com.ts.mobile.sdk.util.toUTF8Array(t))}},{key:"calcHexStringEncodedSha512Hash",value:function(e){throw this.log(com.ts.mobile.sdk.LogLevel.Error,"not-implemented","calcHexStringEncodedSha512Hash not implemented for tarsus-web"),new Error("Method not implemented.")}},{key:"generateHexSeededKeyPairExternalRepresentation",value:function(e,t){return Promise.reject("Method not implemented.")}},{key:"generateKeyPairExternalRepresentation",value:function(e){return Promise.reject("Method not implemented.")}},{key:"importVolatileKeyPair",value:function(e,t){throw new Error("Method not implemented.")}},{key:"importVolatileSymmetricKey",value:function(e,t){throw new Error("Method not implemented.")}},{key:"loadPlugin",value:function(e){var t=window.__XMSDK_PLUGINS[e];return t?(this.log(com.ts.mobile.sdk.LogLevel.Debug,"plugins","Found defined plugin "+e),Promise.resolve(t)):(this.log(com.ts.mobile.sdk.LogLevel.Error,"plugins","Could not find defined plugin "+e),Promise.reject(new com.ts.mobile.sdk.impl.AuthenticationErrorImpl(com.ts.mobile.sdk.AuthenticationErrorCode.AppImplementation,"Could not find defined plugin "+e)))}},{key:"dyadicRefreshToken",value:function(e){throw new Error("Method not implemented.")}},{key:"dyadicEnroll",value:function(e,t){return Promise.reject("Method not implemented.")}},{key:"dyadicSign",value:function(e){return Promise.reject("Method not implemented.")}},{key:"dyadicDelete",value:function(){return Promise.reject("Method not implemented.")}},{key:"importVolatileKeyPairFromPublicKeyHex",value:function(e,t){throw new Error("Method not implemented.")}}]),e}(),B=com.ts.mobile.sdk.createSdk(),U=new H;B.setTarsusHost(U),B.setTransportProvider(new _(U)),B.setEnabledCollectors([com.ts.mobile.sdk.CollectorType.DeviceDetails,com.ts.mobile.sdk.CollectorType.LargeData]),B.setLogLevel(com.ts.mobile.sdk.LogLevel.Error),e.XmSdk=function(){return B},Object.defineProperty(e,"__esModule",{value:!0})}),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.__tarsusInterfaceName="InputResponseType",e}();e.InputResponseType=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.__tarsusInterfaceName="AuthenticationActionParameter",e}();e.AuthenticationActionParameter=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={}));__extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getAuthenticatorInput=function(){return this._authenticatorInput},n.prototype.setAuthenticatorInput=function(e){this._authenticatorInput=e},n.prototype.getSelectedTargets=function(){return this._selectedTargets},n.prototype.setSelectedTargets=function(e){this._selectedTargets=e},n.createAuthenticatorInput=function(t){return e.ts.mobile.sdk.impl.TargetBasedAuthenticatorInputImpl.createAuthenticatorInput(t)},n.createTargetSelectionRequest=function(t){return e.ts.mobile.sdk.impl.TargetBasedAuthenticatorInputImpl.createTargetSelectionRequest(t)},n.createTargetsSelectionRequest=function(t){return e.ts.mobile.sdk.impl.TargetBasedAuthenticatorInputImpl.createTargetsSelectionRequest(t)},n.__tarsusInterfaceName="TargetBasedAuthenticatorInput",n}(t.InputResponseType);t.TargetBasedAuthenticatorInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="OtpInput",t}(e.InputResponseType);e.OtpInput=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSuccessResponse=function(t){return e.ts.mobile.sdk.impl.PlaceholderInputResponseImpl.createSuccessResponse(t)},n.createdFailedResponse=function(t,n){return e.ts.mobile.sdk.impl.PlaceholderInputResponseImpl.createdFailedResponse(t,n)},n.createFailedResponseWithServerProvidedStatus=function(t){return e.ts.mobile.sdk.impl.PlaceholderInputResponseImpl.createFailedResponseWithServerProvidedStatus(t)},n.__tarsusInterfaceName="PlaceholderInputResponse",n}(t.InputResponseType);t.PlaceholderInputResponse=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.__tarsusInterfaceName="PushRequestPayload",e}();e.PushRequestPayload=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSuccessResponse=function(t){return e.ts.mobile.sdk.impl.FidoInputResponseImpl.createSuccessResponse(t)},n.createdFailedResponse=function(t,n){return e.ts.mobile.sdk.impl.FidoInputResponseImpl.createdFailedResponse(t,n)},n.__tarsusInterfaceName="FidoInputResponse",n}(t.InputResponseType);t.FidoInputResponse=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createWithUserId=function(t){return e.ts.mobile.sdk.impl.MobileApprovePushRequestPayloadImpl.createWithUserId(t)},n.createWithUserTicket=function(t){return e.ts.mobile.sdk.impl.MobileApprovePushRequestPayloadImpl.createWithUserTicket(t)},n.createWithJsonPayload=function(t){return e.ts.mobile.sdk.impl.MobileApprovePushRequestPayloadImpl.createWithJsonPayload(t)},n.__tarsusInterfaceName="MobileApprovePushRequestPayload",n}(t.PushRequestPayload);t.MobileApprovePushRequestPayload=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSecurityQuestionAnswersInputResponse=function(t){return e.ts.mobile.sdk.impl.SecurityQuestionInputResponseImpl.createSecurityQuestionAnswersInputResponse(t)},n.__tarsusInterfaceName="SecurityQuestionInputResponse",n}(t.InputResponseType);t.SecurityQuestionInputResponse=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getAnswerText=function(){return this._answerText},t.createWithText=function(t){return e.ts.mobile.sdk.impl.SecurityQuestionAnswerImpl.createWithText(t)},t.__tarsusInterfaceName="SecurityQuestionAnswer",t}();t.SecurityQuestionAnswer=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getQuestion=function(){return this._question},t.prototype.getAnswer=function(){return this._answer},t.createAnswerToQuestion=function(t,n){return e.ts.mobile.sdk.impl.SecurityQuestionAndAnswerImpl.createAnswerToQuestion(t,n)},t.__tarsusInterfaceName="SecurityQuestionAndAnswer",t}();t.SecurityQuestionAndAnswer=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getAssertionData=function(){return this._assertionData},e.prototype.setAssertionData=function(e){this._assertionData=e},e.prototype.getStoredData=function(){return this._storedData},e.prototype.setStoredData=function(e){this._storedData=e},e.__tarsusInterfaceName="TotpProvisionOutput",e}();e.TotpProvisionOutput=t}(e.tarsusplugin||(e.tarsusplugin={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t){this._stepTag=e,this._passphraseText=t}return e.prototype.getStepTag=function(){return this._stepTag},e.prototype.getAcquisitionChallenges=function(){return[]},e.prototype.getPassphraseText=function(){return this._passphraseText},e.__tarsusInterfaceName="AudioAcquisitionStepDescription",e}();e.AudioAcquisitionStepDescriptionImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getTarget=function(){return this._target},n.create=function(t){return e.ts.mobile.sdk.impl.AuthenticationActionParameterTargetSelectionImpl.create(t)},n.__tarsusInterfaceName="AuthenticationActionParameterTargetSelection",n}(t.AuthenticationActionParameter);t.AuthenticationActionParameterTargetSelection=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(t){var n=e.call(this)||this;return n._target=t,n}return __extends(t,e),t.create=function(e){return new t(e)},t.__tarsusInterfaceName="AuthenticationActionParameterTargetSelection",t}(e.AuthenticationActionParameterTargetSelection),t.AuthenticationActionParameterTargetSelectionImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getErrorCode=function(){return this._errorCode},t.prototype.getMessage=function(){return this._message},t.prototype.getData=function(){return this._data},t.createApplicationGeneratedGeneralError=function(t,n){return e.ts.mobile.sdk.impl.AuthenticationErrorImpl.createApplicationGeneratedGeneralError(t,n)},t.createApplicationGeneratedCommunicationError=function(t,n){return e.ts.mobile.sdk.impl.AuthenticationErrorImpl.createApplicationGeneratedCommunicationError(t,n)},t.__tarsusInterfaceName="AuthenticationError",t}();t.AuthenticationError=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={}));var com;__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};!function(e){!function(e){!function(e){var t,n,r;t=e.sdk||(e.sdk={}),n=t.impl||(t.impl={}),r=function(r){function i(e,t,n){var i=r.call(this)||this;return i._errorCode=e,i._message=t,i._data=__assign({},n||{},{public_properties:{}}),i}return __extends(i,r),i.errorForServerResponse=function(e){var n={server_error_code:e.error_code,server_error_message:e.error_message,server_error_data:e.data},r=e.error_message||"Internal error",o=t.AuthenticationErrorCode.Internal;switch(e.error_code){case 2009:o=t.AuthenticationErrorCode.DeviceNotFound;break;case 28:var a=new i(t.AuthenticationErrorCode.InvalidIdToken,r);return a.setPublicProperty(t.AuthenticationErrorProperty.InvalidIdTokenErrorReason,t.AuthenticationErrorPropertySymbol.InvalidIdTokenErrorReasonBadToken),a;case 29:return(a=new i(t.AuthenticationErrorCode.InvalidIdToken,r)).setPublicProperty(t.AuthenticationErrorProperty.InvalidIdTokenErrorReason,t.AuthenticationErrorPropertySymbol.InvalidIdTokenErrorReasonExpiredToken),a;case 3001:case 3002:o=t.AuthenticationErrorCode.InvalidDeviceBinding;break;case 4e3:case 4002:o=t.AuthenticationErrorCode.ControlFlowExpired;break;case 4005:case 4006:o=t.AuthenticationErrorCode.SessionRequired;break;case 6001:case 6002:o=t.AuthenticationErrorCode.ApprovalWrongState}return new i(o,r,n)},i.createApplicationGeneratedGeneralError=function(e,n){return new i(t.AuthenticationErrorCode.Internal,e,n)},i.createApplicationGeneratedCommunicationError=function(e,n){return new i(t.AuthenticationErrorCode.Communication,e,n)},i.errorForSessionRejectionFailureData=function(e){var n=t.AuthenticationErrorCode.PolicyRejection,r="Session rejected by server.",o={failure_data:e};if(e&&e.source)switch(e.reason&&e.reason.type){case t.core.Protocol.FailureReasonType.ApprovalExpired:n=t.AuthenticationErrorCode.ApprovalWrongState,r="Approval expired.",o.approval_state="expired"}return new i(n,r,o)},i.errorForHostInternalBiometricErrorData=function(r,i){var o;switch(r[e.sdkhost.ErrorDataInternalError]){case e.sdkhost.InternalErrorBiometricInvalidated:o=new n.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorInvalidated,i+" registration invalidated.");break;case e.sdkhost.InternalErrorWrongBiometric:o=new n.AuthenticationErrorImpl(t.AuthenticationErrorCode.InvalidInput,"Invalid "+i+" was input.");break;case e.sdkhost.InternalErrorBiometricNotConfigured:(o=new n.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorExternalConfigError,i+" not configured on this device.")).setPublicProperty(t.AuthenticationErrorProperty.AuthenticatorExternalConfigErrorReason,t.AuthenticationErrorPropertySymbol.AuthenticatorExternalConfigErrorReasonBiometricsNotEnrolled);break;case e.sdkhost.InternalErrorBiometricOsLockTemporary:(o=new n.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorExternalConfigError,i+" authentication is temporarily locked by the OS.")).setPublicProperty(t.AuthenticationErrorProperty.AuthenticatorExternalConfigErrorReason,t.AuthenticationErrorPropertySymbol.AuthenticatorExternalConfigErrorReasonBiometricsOsLockTemporary);break;case e.sdkhost.InternalErrorBiometricOsLockPermanent:(o=new n.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorExternalConfigError,i+" authentication is permanently locked by the OS.")).setPublicProperty(t.AuthenticationErrorProperty.AuthenticatorExternalConfigErrorReason,t.AuthenticationErrorPropertySymbol.AuthenticatorExternalConfigErrorReasonBiometricsOsLockPermanent);break;default:o=null}return o},i.prototype.setPublicProperty=function(e,n){this._data.public_properties[t.AuthenticationErrorProperty[e]]=n},i.prototype.getPublicProperty=function(e){return this._data.public_properties[t.AuthenticationErrorProperty[e]]},i.prototype.getPublicBooleanProperty=function(e){var n=this.getPublicProperty(e);if(n&&"boolean"!=typeof n)throw new i(t.AuthenticationErrorCode.AppImplementation,"type of property "+t.AuthenticationErrorProperty[e]+" is not 'boolean'");return n},i.prototype.getPublicNumberProperty=function(e){var n=this.getPublicProperty(e);if(n&&"number"!=typeof n)throw new i(t.AuthenticationErrorCode.AppImplementation,"type of property "+t.AuthenticationErrorProperty[e]+" is not 'number'");return n},i.prototype.getPublicStringProperty=function(e){var n=this.getPublicProperty(e);if(n&&"string"!=typeof n)throw new i(t.AuthenticationErrorCode.AppImplementation,"type of property "+t.AuthenticationErrorProperty[e]+" is not 'string'");return n},i.prototype.getPublicSymbolicProperty=function(e){var n=this.getPublicProperty(e);if(n&&!t.AuthenticationErrorProperty[e])throw new i(t.AuthenticationErrorCode.AppImplementation,"type of property "+t.AuthenticationErrorProperty[e]+" is not 'AuthenticationErrorPropertySymbol'");return n},i.prototype.toString=function(){return"AuthenticationError<"+t.AuthenticationErrorCode[this._errorCode]+", "+this._message+", "+JSON.stringify(this._data)+">"},i.errorForAssertionResponse=function(e){var n;switch(e.assertion_error_code){case t.core.Protocol.AssertionErrorCode.FailedAssertion:n=t.AuthenticationErrorCode.InvalidInput;break;case t.core.Protocol.AssertionErrorCode.MethodLocked:n=t.AuthenticationErrorCode.AuthenticatorLocked;break;case t.core.Protocol.AssertionErrorCode.HistoryRepeat:n=t.AuthenticationErrorCode.RegisteredSecretAlreadyInHistory;break;default:n=t.AuthenticationErrorCode.Internal}var r={assertion_error_code:e.assertion_error_code,additional_data:e.data};return new i(n,e.assertion_error_message||"Assertion error code "+e.assertion_error_code,r)},i.appImplementationError=function(e){return new i(t.AuthenticationErrorCode.AppImplementation,e)},i.errorForTransportResponse=function(e){return new i(t.AuthenticationErrorCode.Communication,"HTTP response error",{status:e.getStatus(),body:e.getBodyJson()})},i.ensureAuthenticationError=function(e){if(i.dynamicCast(e))return e;var n={js_error_message:e.toString()};return e.stack&&(n.js_error_stack=e.stack),new i(t.AuthenticationErrorCode.Internal,"Internal error occurred ("+e.toString()+")",n)},i.augmentErrorData=function(e,t){var n,r={},o=e.getData();if(o)for(n in o)r[n]=o[n];for(n in t)r[n]=t[n];return new i(e.getErrorCode(),e.getMessage(),r)},i.dynamicCast=function(e){return void 0!==e.getErrorCode&&void 0!==e.getMessage&&void 0!==e.getData},i}(t.AuthenticationError),n.AuthenticationErrorImpl=r}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t){this._authenticator=e,this._suggestedParams=t}return e.prototype.getAuthenticator=function(){return this._authenticator},e.prototype.getSuggestedParameters=function(){return this._suggestedParams},e}();e.AuthenticationOptionImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t,n,r){this._appData=n||null,this._token=e||null,this._internalData=r||null,this._deviceId=t||null}return e.prototype.getToken=function(){return this._token||""},e.prototype.getDeviceId=function(){return this._deviceId||""},e.prototype.getData=function(){return this._appData||{}},e.prototype.getInternalData=function(){return this._internalData},e.fromCflowServerResponse=function(t,n){return new e(t.token,n,t.application_data,t.data)},e}();e.AuthenticationResultImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getResultType=function(){return this._resultType},t.prototype.setResultType=function(e){this._resultType=e},t.prototype.getSelectedAuthenticator=function(){return this._selectedAuthenticator},t.prototype.setSelectedAuthenticator=function(e){this._selectedAuthenticator=e},t.prototype.getSelectedAuthenticationParameters=function(){return this._selectedAuthenticationParameters},t.prototype.setSelectedAuthenticationParameters=function(e){this._selectedAuthenticationParameters=e},t.createAbortRequest=function(){return e.ts.mobile.sdk.impl.AuthenticatorSelectionResultImpl.createAbortRequest()},t.createSelectionRequest=function(t){return e.ts.mobile.sdk.impl.AuthenticatorSelectionResultImpl.createSelectionRequest(t)},t.createParameterizedSelectionRequest=function(t,n){return e.ts.mobile.sdk.impl.AuthenticatorSelectionResultImpl.createParameterizedSelectionRequest(t,n)},t.__tarsusInterfaceName="AuthenticatorSelectionResult",t}();t.AuthenticatorSelectionResult=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createAbortRequest=function(){var t=new n;return t.setResultType(e.AuthenticatorSelectionResultType.Abort),t},n.createSelectionRequest=function(t){var r=new n;return r.setResultType(e.AuthenticatorSelectionResultType.SelectAuthenticator),r.setSelectedAuthenticator(t),r},n}(e.AuthenticatorSelectionResult),t.AuthenticatorSelectionResultImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e){this._acquisitionChallenges=e}return e.prototype.getStepTag=function(){return"imageAcquisition"},e.prototype.getAcquisitionChallenges=function(){return this._acquisitionChallenges},e.__tarsusInterfaceName="CameraAcquisitionStepDescription",e}();e.CameraAcquisitionStepDescriptionImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getLocalEnrollmentKeySizeInBytes=function(){return this._localEnrollmentKeySizeInBytes},t.prototype.getLocalEnrollmentKeyIterationCount=function(){return this._localEnrollmentKeyIterationCount},t.prototype.setLocalEnrollmentKeyIterationCount=function(e){this._localEnrollmentKeyIterationCount=e},t.create=function(t){return e.ts.mobile.sdk.impl.ClientCryptoSettingsImpl.create(t)},t.__tarsusInterfaceName="ClientCryptoSettings",t}();t.ClientCryptoSettings=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setLocalEnrollmentKeyIterationCount(e),n._localEnrollmentKeySizeInBytes=32,n},t}(e.ClientCryptoSettings),t.ClientCryptoSettingsImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(){function t(e,t){this._description=e,this._menuItemOptions=t||{}}return t.prototype.getDescription=function(){return this._description},t.prototype.getAvailableActions=function(){var t=this,n=[];switch(this._description.getRegistrationStatus()){case e.AuthenticatorRegistrationStatus.Registered:n=[e.AuthenticatorConfigurationAction.Reregister,e.AuthenticatorConfigurationAction.Unregister];break;case e.AuthenticatorRegistrationStatus.Unregistered:case e.AuthenticatorRegistrationStatus.LocallyInvalid:n=[e.AuthenticatorConfigurationAction.Register]}return n.filter(function(n){return n==e.AuthenticatorConfigurationAction.Reregister&&!t._menuItemOptions.hide_reregister||n==e.AuthenticatorConfigurationAction.Register&&!t._menuItemOptions.hide_register||n==e.AuthenticatorConfigurationAction.Unregister&&!t._menuItemOptions.hide_unregister})},t}(),t.ConfigurableAuthenticatorImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getUserChoice=function(){return this._userChoice},t.prototype.setUserChoice=function(e){this._userChoice=e},t.create=function(t){return e.ts.mobile.sdk.impl.ConfirmationInputImpl.create(t)},t.__tarsusInterfaceName="ConfirmationInput",t}();t.ConfirmationInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setUserChoice(e),n},t}(e.ConfirmationInput),t.ConfirmationInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getRequestType=function(){return this._requestType},t.prototype.setRequestType=function(e){this._requestType=e},t.create=function(t){return e.ts.mobile.sdk.impl.ControlRequestImpl.create(t)},t.__tarsusInterfaceName="ControlRequest",t}();t.ControlRequest=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setRequestType(e),n},t}(e.ControlRequest),t.ControlRequestImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t){this._id=e,this._name=t}return e.prototype.getId=function(){return this._id},e.prototype.getName=function(){return this._name},e}();e.DeviceGroupImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(){function n(e){this.updateFromServer(e)}return n.prototype.getDeviceHwId=function(){return this._id},n.prototype.getDeviceId=function(){return this._logicalId},n.prototype.getName=function(){return this._name?this._name:this._model+" "+this._osType+" "+this._osVersion},n.prototype.getStatus=function(){return this._status},n.prototype.getLastAccess=function(){return this._lastAccess},n.prototype.getLastAccessLocation=function(){return this._lastAccessLocation},n.prototype.getLastAccessLocationAttributes=function(){return this._lastAccessLocationAttributes},n.prototype.getLastBind=function(){return this._lastBind},n.prototype.getRegistered=function(){return this._registered},n.prototype.getModel=function(){return this._model},n.prototype.getOsType=function(){return this._osType},n.prototype.getOsVersion=function(){return this._osVersion},n.prototype.getUseCount=function(){return this._useCount},n.prototype.getPushSupported=function(){return this._pushSupported},n.prototype.getIsCurrent=function(){return this._isCurrent},n.prototype.getDeviecId=function(){return this._id},n.prototype.getGroups=function(){return this._groups},n.prototype.setStatus=function(e){this._status=e},n.prototype.setName=function(e){this._name=e},n.prototype.forceCurrent=function(){this._isCurrent=!0},n.prototype.updateFromServer=function(n){switch(this._model=e.util.getDeviceModel(n.device_model,n.os_type),this._name=n.name,this._lastBind=Date.parse(n.last_bind_date),this._lastAccess=Date.parse(n.last_access),this._registered=Date.parse(n.registered),this._osType=e.util.getOsName(n.os_type),this._osVersion=n.os_version,this._useCount=n.use_count,this._pushSupported=n.supports_push,this._isCurrent=n.cur_device,this._id=n.device_id,this._logicalId=n.logical_device_id,n.status){case e.core.Protocol.DeviceStatusServerFormat.Disabled:this._status=e.DeviceStatus.Disabled;break;case e.core.Protocol.DeviceStatusServerFormat.LongInactivity:this._status=e.DeviceStatus.LongInactivity;break;case e.core.Protocol.DeviceStatusServerFormat.NoRecentActivity:this._status=e.DeviceStatus.NoRecentActivity;break;case e.core.Protocol.DeviceStatusServerFormat.RecentlyUsed:this._status=e.DeviceStatus.RecentlyUsed;break;case e.core.Protocol.DeviceStatusServerFormat.Removed:this._status=e.DeviceStatus.Removed;break;default:throw new t.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unknown device status "+n.status)}if(n.last_access_location){var r=new e.GeoLocation;r.longitude=n.last_access_location.lng,r.latitude=n.last_access_location.lat,this._lastAccessLocation=r,this._lastAccessLocationAttributes=new t.LocationAttributesImpl(n.last_access_location)}n.groups&&(this._groups=n.groups.map(function(e){return new t.DeviceGroupImpl(e.id,e.name)}))},n}(),t.DeviceInfoImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getOsName=function(e){var t=e;switch(e){case"iPhone":case"iPad":t="iOS"}return t},e.prototype.getDeviceModel=function(e,t){var n=e;if("iPhone"==t)switch(e){case"i386":case"x86_64":n="Simulator";break;case"iPod1,1":case"iPod2,1":case"iPod3,1":case"iPod4,1":case"iPod7,1":n="iPod Touch";break;case"iPhone1,1":case"iPhone1,2":case"iPhone2,1":n="iPhone";break;case"iPad1,1":n="iPad";break;case"iPad2,1":n="iPad 2";break;case"iPad3,1":n="iPad";break;case"iPhone3,1":case"iPhone3,3":n="iPhone 4";break;case"iPhone4,1":n="iPhone 4S";break;case"iPhone5,1":case"iPhone5,2":n="iPhone 5";break;case"iPad3,4":n="iPad";break;case"iPad2,5":n="iPad Mini";break;case"iPhone5,3":case"iPhone5,4":n="iPhone 5c";break;case"iPhone6,1":case"iPhone6,2":n="iPhone 5s";break;case"iPhone7,1":n="iPhone 6 Plus";break;case"iPhone7,2":n="iPhone 6";break;case"iPhone8,1":n="iPhone 6S";break;case"iPhone8,2":n="iPhone 6S Plus";break;case"iPhone8,4":n="iPhone SE";break;case"iPhone9,1":case"iPhone9,3":n="iPhone 7";break;case"iPhone9,2":case"iPhone9,4":n="iPhone 7 Plus";break;case"iPhone10,1":case"iPhone10,4":n="iPhone 8";break;case"iPhone10,2":case"iPhone10,5":n="iPhone 8 Plus";break;case"iPhone10,3":case"iPhone10,6":n="iPhone X";break;case"iPad4,1":case"iPad4,2":n="iPad Air";break;case"iPad4,4":case"iPad4,5":case"iPad4,7":n="iPad Mini";break;case"iPad6,7":case"iPad6,8":n='iPad Pro (12.9")';break;case"iPad6,3":case"iPad6,4":n='iPad Pro (9.7")';break;case"iPhone11,2":n="iPhone XS";break;case"iPhone11,6":case"iPhone11,4":n="iPhone XS Max";break;case"iPhone11,8":n="iPhone XR";break;case"iPad6,7":case"iPad6,8":n='iPad Pro (12.9")';break;case"iPad6,11":case"iPad6,12":n="iPad (2017)";break;case"iPad7,1":case"iPad7,2":n="iPad Pro 2nd Gen";break;case"iPad7,3":case"iPad7,4":n='iPad Pro (10.5")';break;case"iPad7,5":case"iPad7,6":n="iPad";break;case"iPad8,1":case"iPad8,2":case"iPad8,3":case"iPad8,4":n='iPad Pro (11")';break;case"iPad8,5":case"iPad8,6":case"iPad8,7":case"iPad8,8":n='iPad Pro (12.9")'}return n},e}();e.DeviceModelConverter=t}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getPrompt=function(){return this._prompt},n.prototype.setPrompt=function(e){this._prompt=e},n.create=function(t){return e.ts.mobile.sdk.impl.DeviceStrongAuthenticatorInputImpl.create(t)},n.__tarsusInterfaceName="DeviceStrongAuthenticatorInput",n}(t.InputResponseType);t.DeviceStrongAuthenticatorInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return e&&n.setPrompt(e),n},t}(e.DeviceStrongAuthenticatorInput),t.DeviceStrongAuthenticatorInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSuccessResponse=function(t){return e.ts.mobile.sdk.impl.Fido2InputResponseImpl.createSuccessResponse(t)},n.createdFailedResponse=function(t){return e.ts.mobile.sdk.impl.Fido2InputResponseImpl.createdFailedResponse(t)},n.__tarsusInterfaceName="Fido2InputResponse",n}(t.InputResponseType);t.Fido2InputResponse=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSuccessResponse=function(t){var n=new e.Fido2AuthenticatorSuccessResponse;return n.setFido2Response(t),n},n.createdFailedResponse=function(t){var n=new e.Fido2AuthenticationFailedResponse;return n.setFailureError(t),n},n}(e.Fido2InputResponse),t.Fido2InputResponseImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSuccessResponse=function(t){var n=new e.FidoAuthSuccessResponse;return n.setFidoResponse(t),n},n.createdFailedResponse=function(t,n){var r=new e.FidoAuthFailureResponse;return r.setFailureError(n),r.setExpired(t.getExpired()),r.setLocked(t.getLocked()),r.setRegistered(t.getRegistered()),r.setRegistrationStatus(t.getRegistrationStatus()),r},n}(e.PlaceholderInputResponse),t.FidoInputResponseImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getPrompt=function(){return this._prompt},n.prototype.setPrompt=function(e){this._prompt=e},n.prototype.getFallbackButtonTitle=function(){return this._fallbackButtonTitle},n.prototype.setFallbackButtonTitle=function(e){this._fallbackButtonTitle=e},n.prototype.getFallbackControlRequestType=function(){return this._fallbackControlRequestType},n.prototype.setFallbackControlRequestType=function(e){this._fallbackControlRequestType=e},n.create=function(t){return e.ts.mobile.sdk.impl.FingerprintInputImpl.create(t)},n.createFallbackEnabledPrompt=function(t,n,r){return e.ts.mobile.sdk.impl.FingerprintInputImpl.createFallbackEnabledPrompt(t,n,r)},n.__tarsusInterfaceName="FingerprintInput",n}(t.InputResponseType);t.FingerprintInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.create=function(e){var t=new n;return e&&t.setPrompt(e),t},n.createFallbackEnabledPrompt=function(t,r,i){var o=new n;return t&&o.setPrompt(t),r&&o.setFallbackButtonTitle(r),i?o.setFallbackControlRequestType(i):o.setFallbackControlRequestType(e.ControlRequestType.SelectMethod),o},n}(e.FingerprintInput),t.FingerprintInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getJsonData=function(){return this._jsonData},t.prototype.setJsonData=function(e){this._jsonData=e},t.prototype.getControlRequest=function(){return this._controlRequest},t.prototype.setControlRequest=function(e){this._controlRequest=e},t.createFormInputSubmissionRequest=function(t){return e.ts.mobile.sdk.impl.FormInputImpl.createFormInputSubmissionRequest(t)},t.createFormCancellationRequest=function(){return e.ts.mobile.sdk.impl.FormInputImpl.createFormCancellationRequest()},t.__tarsusInterfaceName="FormInput",t}();t.FormInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createFormInputSubmissionRequest=function(t){var r=new n;return r.setJsonData(t),r.setControlRequest(e.FormControlRequest.Submit),r},n.createFormCancellationRequest=function(){var t=new n;return t.setControlRequest(e.FormControlRequest.Abort),t},n}(e.FormInput),t.FormInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){return function(){}}();e.GeoLocation=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="IdentifyDevicePushRequestPayload",t}(e.PushRequestPayload);e.IdentifyDevicePushRequestPayload=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.userId=function(){return this._userId},t.prototype.title=function(){return this._title},t.createWithJsonPayload=function(e){var n=e,r=new t;return r._userId=n.user_id,r._title=n.body,r},t}(e.IdentifyDevicePushRequestPayload),t.IdentifyDevicePushRequestPayloadImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getResponse=function(){return this._response},t.prototype.setResponse=function(e){this._response=e},t.prototype.getControlRequest=function(){return this._controlRequest},t.prototype.setControlRequest=function(e){this._controlRequest=e},t.createControlResponse=function(t){return e.ts.mobile.sdk.impl.InputOrControlResponseImpl.createControlResponse(t)},t.createInputResponse=function(t){return e.ts.mobile.sdk.impl.InputOrControlResponseImpl.createInputResponse(t)},t.__tarsusInterfaceName="InputOrControlResponse",t}();t.InputOrControlResponse=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createControlResponse=function(e){var n=new t;return n.setControlRequest(e),n},t.createInputResponse=function(e){var n=new t;return n.setResponse(e),n},t.prototype.isControlRequest=function(){return!!this._controlRequest},t}(e.InputOrControlResponse),t.InputOrControlResponseImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getContinueProcessing=function(){return this._continueProcessing},t.prototype.setContinueProcessing=function(e){this._continueProcessing=e},t.create=function(t){return e.ts.mobile.sdk.impl.JsonDataProcessingResultImpl.create(t)},t.__tarsusInterfaceName="JsonDataProcessingResult",t}();t.JsonDataProcessingResult=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setContinueProcessing(e),n},t}(e.JsonDataProcessingResult),t.JsonDataProcessingResultImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e){this.city=e.city,this.state=e.state,this.country=e.country}return e.prototype.getCity=function(){return this.city},e.prototype.getCountry=function(){return this.country},e.prototype.getState=function(){return this.state},e}();e.LocationAttributesImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(){function n(e){this._deviceInfo=new t.DeviceInfoImpl(e)}return n.prototype.getInfo=function(){return this._deviceInfo},n.prototype.getAvailableActions=function(){if(this._deviceInfo.getStatus()==e.DeviceStatus.Removed)return[];var t=[e.DeviceManagementAction.Rename];return this._deviceInfo.getIsCurrent()||t.push(e.DeviceManagementAction.Remove),this._deviceInfo.getPushSupported()&&t.push(e.DeviceManagementAction.Identify),t},n}(),t.ManagedDeviceImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(){function n(n){switch(this._approval=new t.MobileApprovalImpl(n),this._approval.getStatus()){case e.MobileApprovalStatus.Pending:this._availableActions=[e.MobileApprovalAction.Approve,e.MobileApprovalAction.Deny];break;default:this._availableActions=[]}}return n.prototype.getApproval=function(){return this._approval},n.prototype.getAvailableActions=function(){return this._availableActions},n}(),t.ManagedMobileApprovalImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(){function n(n){switch(this._approvalId=n.approval_id,this._source=n.source,this._title=n.title,this._details=n.details,this._creationTime=n.create,this._finishTime=n.finish,this._expiresAt=n.create+1e3*n.expiry_in,n.status){case e.core.Protocol.ServerResponseDataApprovalsApprovalStatus.Approved:this._status=e.MobileApprovalStatus.Approved;break;case e.core.Protocol.ServerResponseDataApprovalsApprovalStatus.Denied:this._status=e.MobileApprovalStatus.Denied;break;case e.core.Protocol.ServerResponseDataApprovalsApprovalStatus.Expired:this._status=e.MobileApprovalStatus.Expired;break;case e.core.Protocol.ServerResponseDataApprovalsApprovalStatus.Pending:this._status=e.MobileApprovalStatus.Pending;break;default:throw new t.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unknown approval status "+n.status)}}return n.prototype.getApprovalId=function(){return this._approvalId},n.prototype.getSource=function(){return this._source},n.prototype.getTitle=function(){return this._title},n.prototype.getDetails=function(){return this._details},n.prototype.getCreationTime=function(){return this._creationTime},n.prototype.getFinishTime=function(){return this._finishTime},n.prototype.getExpiresAt=function(){return this._expiresAt},n.prototype.getStatus=function(){return this._status},n.prototype.isExpired=function(){return this._status==e.MobileApprovalStatus.Expired},n.prototype.updateStatus=function(e){this._status=e},n}(),t.MobileApprovalImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="MobileApproveInput",t}(e.InputResponseType);e.MobileApproveInput=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createRequestPollingInput=function(){return e.ts.mobile.sdk.impl.MobileApproveInputRequestPollingImpl.createRequestPollingInput()},n.__tarsusInterfaceName="MobileApproveInputRequestPolling",n}(t.MobileApproveInput);t.MobileApproveInputRequestPolling=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createRequestPollingInput=function(){return new t},t}(e.MobileApproveInputRequestPolling),t.MobileApproveInputRequestPollingImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t){this.value=e,this.format=t}return e.prototype.getValue=function(){return this.value},e.prototype.getFormat=function(){return this.format},e.create=function(t,n){return new e(t,n)},e}();e.MobileApproveOtpImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.userId=function(){return this._userId},t.prototype.title=function(){return this._title},t.prototype.body=function(){return this._body},t.prototype.source=function(){return this._source},t.prototype.ticket=function(){return this._ticket},t.createWithUserId=function(e){var n=new t;return n._userId=e,n},t.createWithUserTicket=function(e){var n=new t;return n._userId=e,n},t.createWithJsonPayload=function(e){var n=e,r=new t;return r._userId=n.user_id,r._title=n.body,r._body=n.details,r._source=n.source,r},t}(e.MobileApprovePushRequestPayload),t.MobileApprovePushRequestPayloadImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getPrompt=function(){return this._prompt},n.prototype.setPrompt=function(e){this._prompt=e},n.prototype.getFallbackButtonTitle=function(){return this._fallbackButtonTitle},n.prototype.setFallbackButtonTitle=function(e){this._fallbackButtonTitle=e},n.prototype.getFallbackControlRequestType=function(){return this._fallbackControlRequestType},n.prototype.setFallbackControlRequestType=function(e){this._fallbackControlRequestType=e},n.create=function(t){return e.ts.mobile.sdk.impl.NativeFaceInputImpl.create(t)},n.createFallbackEnabledPrompt=function(t,n,r){return e.ts.mobile.sdk.impl.NativeFaceInputImpl.createFallbackEnabledPrompt(t,n,r)},n.__tarsusInterfaceName="NativeFaceInput",n}(t.InputResponseType);t.NativeFaceInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.create=function(e){var t=new n;return e&&t.setPrompt(e),t},n.createFallbackEnabledPrompt=function(t,r,i){var o=new n;return t&&o.setPrompt(t),r&&o.setFallbackButtonTitle(r),i?o.setFallbackControlRequestType(i):o.setFallbackControlRequestType(e.ControlRequestType.SelectMethod),o},n}(e.NativeFaceInput),t.NativeFaceInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Password=0]="Password",e[e.Fingerprint=1]="Fingerprint",e[e.Pincode=2]="Pincode",e[e.Pattern=3]="Pattern",e[e.Otp=4]="Otp",e[e.Face=5]="Face",e[e.Voice=6]="Voice",e[e.Eye=7]="Eye",e[e.Emoji=8]="Emoji",e[e.Questions=9]="Questions",e[e.FaceID=10]="FaceID",e[e.Generic=11]="Generic",e[e.MobileApprove=12]="MobileApprove",e[e.Totp=13]="Totp",e[e.DeviceStrongAuthenticator=14]="DeviceStrongAuthenticator"}(e.AuthenticatorType||(e.AuthenticatorType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.RedirectTypeBind=0]="RedirectTypeBind",e[e.RedirectTypeAuthenticate=1]="RedirectTypeAuthenticate",e[e.RedirectTypeBindOrAuthenticate=2]="RedirectTypeBindOrAuthenticate",e[e.RedirectTypeInvokePolicy=3]="RedirectTypeInvokePolicy"}(e.RedirectType||(e.RedirectType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n,r;t.AuthTypeData={password:{authTypeEnum:e.AuthenticatorType.Password,authTypeName:"Password"},fingerprint:{authTypeEnum:e.AuthenticatorType.Fingerprint,authTypeName:"Fingerprint"},pin:{authTypeEnum:e.AuthenticatorType.Pincode,authTypeName:"PIN"},pin_centralized:{authTypeEnum:e.AuthenticatorType.Pincode,authTypeName:"PIN"},pattern:{authTypeEnum:e.AuthenticatorType.Pattern,authTypeName:"Pattern"},pattern_centralized:{authTypeEnum:e.AuthenticatorType.Pattern,authTypeName:"Pattern"},otp:{authTypeEnum:e.AuthenticatorType.Otp,authTypeName:"OTP"},face:{authTypeEnum:e.AuthenticatorType.Face,authTypeName:"Face"},face_server:{authTypeEnum:e.AuthenticatorType.Face,authTypeName:"Face"},voice_server:{authTypeEnum:e.AuthenticatorType.Voice,authTypeName:"Voice"},eye:{authTypeEnum:e.AuthenticatorType.Eye,authTypeName:"Eye"},emoji:{authTypeEnum:e.AuthenticatorType.Emoji,authTypeName:"Emoji"},question:{authTypeEnum:e.AuthenticatorType.Questions,authTypeName:"Questions"},face_id:{authTypeEnum:e.AuthenticatorType.FaceID,authTypeName:"FaceID"},mobile_approve:{authTypeEnum:e.AuthenticatorType.MobileApprove,authTypeName:"MobileApprove"},totp:{authTypeEnum:e.AuthenticatorType.Totp,authTypeName:"Totp"},device_biometrics:{authTypeEnum:e.AuthenticatorType.DeviceStrongAuthenticator,authTypeName:"DeviceStrongAuthenticator"},fido2:{authTypeEnum:e.AuthenticatorType.Generic,authTypeName:"FIDO2Authenticator"}},(t.SessionStateChangeState||(t.SessionStateChangeState={})).Closed="closed",function(e){e.Pending="pending",e.Completed="completed",e.Rejected="rejected"}(t.AuthSessionState||(t.AuthSessionState={})),function(e){e.LOGINS="frequency_logins",e.DAYS="frequency_days"}(t.PromotionStrategyFrequency||(t.PromotionStrategyFrequency={})),function(e){e.Numeric="numeric",e.Alphanumeric="alphanumeric",e.Binary="binary"}(t.QrCodeFormatType||(t.QrCodeFormatType={})),function(e){e.Alphanumeric="alphanumeric",e.QrCode="qrcode"}(t.TicketIdFormatType||(t.TicketIdFormatType={})),(t.FailureSourceTransactionType||(t.FailureSourceTransactionType={})).ApprovalApprove="approval_approve",function(e){e.AutoExecute="auto_execute",e.AssertionRejected="assertion_rejected",e.Policy="policy",e.Locked="locked",e.ApprovalExpired="approval_expired"}(t.FailureReasonType||(t.FailureReasonType={})),function(e){e.DefaultAuthenticator="default",e.AuthenticatorMenu="menu",e.FirstAuthenticator="first"}(t.AuthMenuPresentationMode||(t.AuthMenuPresentationMode={})),function(e){e.Registered="registered",e.Registering="registering",e.Unregistered="unregistered"}(t.AuthenticationMethodStatus||(t.AuthenticationMethodStatus={})),function(e){e.Validate="validate",e.Generate="generate"}(t.AuthenticationMethodOtpState||(t.AuthenticationMethodOtpState={})),function(e){e.None="none",e.Sms="sms",e.Email="email",e.Voice="voice",e.Push="push_notification"}(t.AuthenticationMethodOtpChannelType||(t.AuthenticationMethodOtpChannelType={})),function(e){e.Numeric="numeric",e.QrCode="qrcode",e.External="external",e.Unknown=""}(t.OtpFormatType||(t.OtpFormatType={})),function(e){e.WaitForApproval="wait_for_approval",e.WaitForAuthenticate="wait_for_authenticate"}(t.AuthenticationMethodMobileApproveState||(t.AuthenticationMethodMobileApproveState={})),function(e){e.AlphaNumeric="alpha_numeric",e.Numeric="numeric",e.QrCode="qrcode"}(t.TotpChallengeFormatType||(t.TotpChallengeFormatType={})),function(e){e.SelectTargets="select_targets",e.Validate="validate",e.Generate="generate"}(t.AuthenticationMethodTotpState||(t.AuthenticationMethodTotpState={})),function(e){e.RedirectTypeNameBind="bind",e.RedirectTypeNameAuthenticate="auth",e.RedirectTypeNameBindOrAuthenticate="bind_or_auth",e.RedirectTypeNameInvokePolicy="invoke"}(r=t.RedirectTypeName||(t.RedirectTypeName={})),t.RedirectTypeMap=((n={})[r.RedirectTypeNameBind]=e.RedirectType.RedirectTypeBind,n[r.RedirectTypeNameAuthenticate]=e.RedirectType.RedirectTypeAuthenticate,n[r.RedirectTypeNameBindOrAuthenticate]=e.RedirectType.RedirectTypeBindOrAuthenticate,n[r.RedirectTypeNameInvokePolicy]=e.RedirectType.RedirectTypeInvokePolicy,n),function(e){e[e.NotRegistered=1]="NotRegistered",e[e.InvalidAction=2]="InvalidAction",e[e.BadConfig=3]="BadConfig",e[e.BadFch=4]="BadFch",e[e.FailedAssertion=5]="FailedAssertion",e[e.MethodLocked=6]="MethodLocked",e[e.DataMissing=7]="DataMissing",e[e.HistoryRepeat=11]="HistoryRepeat",e[e.MustRegister=14]="MustRegister",e[e.NotFinished=16]="NotFinished",e[e.MissingQuestions=17]="MissingQuestions",e[e.RepeatCurrentStep=18]="RepeatCurrentStep",e[e.FailOver=19]="FailOver",e[e.AssertionContainerNotComplete=20]="AssertionContainerNotComplete"}(t.AssertionErrorCode||(t.AssertionErrorCode={})),function(e){e.Pending="pending",e.Approved="approved",e.Denied="declined",e.Expired="expired"}(t.ServerResponseDataApprovalsApprovalStatus||(t.ServerResponseDataApprovalsApprovalStatus={})),function(e){e.RecentlyUsed="recently_used",e.NoRecentActivity="no_recent_activity",e.LongInactivity="long_inactivity",e.Disabled="disabled",e.Removed="removed"}(t.DeviceStatusServerFormat||(t.DeviceStatusServerFormat={})),function(e){e.Active="active",e.Disabled="disabled"}(t.CollectorState||(t.CollectorState={}))})((t=e.core||(e.core={})).Protocol||(t.Protocol={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function t(){}return t.fromAssertionFormat=function(t){switch(t.type){case e.core.Protocol.OtpFormatType.Numeric:return new n(t.length);case e.core.Protocol.OtpFormatType.QrCode:return new r;case e.core.Protocol.OtpFormatType.External:return new o(t.data);default:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid format type encountered: "+t.type)}},t}();e.OtpFormatImpl=t;var n=function(){function e(e){this._length=e}return e.prototype.getOtpLength=function(){return this._length},e.prototype.getType=function(){return i.Numeric},e.__tarsusInterfaceName="OtpFormatNumeric",e}();e.OtpFormatNumericImpl=n;var r=function(){function e(){}return e.prototype.getType=function(){return i.QrCode},e.__tarsusInterfaceName="OtpFormatQr",e}();e.OtpFormatQrImpl=r;var i,o=function(){function e(e){this._data=e}return e.prototype.getData=function(){return this._data},e.prototype.getType=function(){return i.External},e.__tarsusInterfaceName="OtpFormatExternal",e}();e.OtpFormatExternalImpl=o,function(e){e[e.Numeric=0]="Numeric",e[e.QrCode=1]="QrCode",e[e.External=2]="External"}(i=e.OtpFormatType||(e.OtpFormatType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getOtp=function(){return this._otp},n.prototype.setOtp=function(e){this._otp=e},n.createOtpSubmission=function(t){return e.ts.mobile.sdk.impl.OtpInputOtpSubmissionImpl.createOtpSubmission(t)},n.__tarsusInterfaceName="OtpInputOtpSubmission",n}(t.OtpInput);t.OtpInputOtpSubmission=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createOtpSubmission=function(e){var n=new t;return n.setOtp(e),n},t}(e.OtpInputOtpSubmission),t.OtpInputOtpSubmissionImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createOtpResendRequest=function(){return e.ts.mobile.sdk.impl.OtpInputRequestResendImpl.createOtpResendRequest()},n.__tarsusInterfaceName="OtpInputRequestResend",n}(t.OtpInput);t.OtpInputRequestResend=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createOtpResendRequest=function(){return new t},t}(e.OtpInputRequestResend),t.OtpInputRequestResendImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="OtpPushRequestPayload",t}(e.PushRequestPayload);e.OtpPushRequestPayload=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.userId=function(){return this._userId},t.prototype.title=function(){return this._title},t.prototype.body=function(){return this._body},t.createWithJsonPayload=function(e){var n=e,r=new t;return r._userId=n.user_id,r._title=n.title,r._body=n.body,r},t}(e.OtpPushRequestPayload),t.OtpPushRequestPayloadImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getPassword=function(){return this._password},n.prototype.setPassword=function(e){this._password=e},n.create=function(t){return e.ts.mobile.sdk.impl.PasswordInputImpl.create(t)},n.__tarsusInterfaceName="PasswordInput",n}(t.InputResponseType);t.PasswordInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setPassword(e),n},t}(e.PasswordInput),t.PasswordInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getPatternDescription=function(){return this._patternDescription},n.prototype.setPatternDescription=function(e){this._patternDescription=e},n.create=function(t){return e.ts.mobile.sdk.impl.PatternInputImpl.create(t)},n.__tarsusInterfaceName="PatternInput",n}(t.InputResponseType);t.PatternInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return __extends(r,n),r.create=function(e){var t=new r;return t.setPatternDescription(e),t},r.validateFormat=function(e){return null!=e.getPatternDescription().match(/^(r:[0-9]+,c:[0-9]+)+$/)},r.getPatternLength=function(n){if(r.validateFormat(n))return n.getPatternDescription().match(/r/g).length;throw new t.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern input.")},r}(e.PatternInput),t.PatternInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getPin=function(){return this._pin},n.prototype.setPin=function(e){this._pin=e},n.create=function(t){return e.ts.mobile.sdk.impl.PinInputImpl.create(t)},n.__tarsusInterfaceName="PinInput",n}(t.InputResponseType);t.PinInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setPin(e),n},t}(e.PinInput),t.PinInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSuccessResponse=function(t){var n=new e.PlaceholderAuthSuccessResponse;return n.setPlaceholderToken(t),n},n.createdFailedResponse=function(t,n){var r=new e.PlaceholderAuthFailureResponse;return r.setFailureError(n),r.setExpired(t.getExpired()),r.setLocked(t.getLocked()),r.setRegistered(t.getRegistered()),r.setRegistrationStatus(t.getRegistrationStatus()),r},n.createFailedResponseWithServerProvidedStatus=function(t){var n=new e.PlaceholderAuthFailureWithServerProvidedStatusResponse;return n.setFailureError(t),n},n}(e.PlaceholderInputResponse),t.PlaceholderInputResponseImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e){this._actionType=e.type}return e.prototype.getActionType=function(){return this._actionType},e.prototype.getAltLabel=function(){return""},e}();e.PolicyActionImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getControlRequest=function(){return this._controlRequest},t.prototype.setControlRequest=function(e){this._controlRequest=e},t.createControlResponse=function(t){return e.ts.mobile.sdk.impl.PromotionInputImpl.createControlResponse(t)},t.prototype.getSelectedAuthenticator=function(){return this._selectedAuthenticator},t.prototype.setSelectedAuthenticator=function(e){this._selectedAuthenticator=e},t.createAuthenticatorDescription=function(t){return e.ts.mobile.sdk.impl.PromotionInputImpl.createAuthenticatorDescription(t)},t.__tarsusInterfaceName="PromotionInput",t}();t.PromotionInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.isControlRequest=function(){return!(void 0===this._controlRequest||null===this._controlRequest)},t.createControlResponse=function(e){var n=new t;return n.setControlRequest(e),n},t.createAuthenticatorDescription=function(e){var n=new t;return n.setSelectedAuthenticator(e),n},t}(e.PromotionInput),t.PromotionInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function t(){}return t.fromAssertionFormat=function(t){switch(t){case e.core.Protocol.QrCodeFormatType.Numeric:return e.QrCodeFormat.Numeric;case e.core.Protocol.QrCodeFormatType.Alphanumeric:return e.QrCodeFormat.Alphanumeric;case e.core.Protocol.QrCodeFormatType.Binary:return e.QrCodeFormat.Binary;default:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid qr code format type encountered: "+t.type)}},t}();e.QrCodeFormatImpl=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getQrCode=function(){return this._qrCode},t.prototype.getQrCodeFormat=function(){return this._qrCodeFormat},t.createQrCodeResult=function(t,n){return e.ts.mobile.sdk.impl.QrCodeResultImpl.createQrCodeResult(t,n)},t.__tarsusInterfaceName="QrCodeResult",t}();t.QrCodeResult=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createQrCodeResult=function(e,n){var r=new t;return r._qrCode=e,r._qrCodeFormat=n,r},t}(e.QrCodeResult),t.QrCodeResultImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getRedirectResponse=function(){return this._redirectResponse},t.prototype.setRedirectResponse=function(e){this._redirectResponse=e},t.create=function(t){return e.ts.mobile.sdk.impl.RedirectInputImpl.create(t)},t.__tarsusInterfaceName="RedirectInput",t}();t.RedirectInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setRedirectResponse(e),n},t}(e.RedirectInput),t.RedirectInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getServerAddress=function(){return this._serverAddress},t.prototype.setServerAddress=function(e){this._serverAddress=e},t.prototype.getRealm=function(){return this._realm},t.prototype.setRealm=function(e){this._realm=e},t.prototype.getAppId=function(){return this._appId},t.prototype.setAppId=function(e){this._appId=e},t.prototype.getTokenName=function(){return this._tokenName},t.prototype.setTokenName=function(e){this._tokenName=e},t.prototype.getToken=function(){return this._token},t.prototype.setToken=function(e){this._token=e},t.prototype.getCryptoMode=function(){return this._cryptoMode},t.prototype.setCryptoMode=function(e){this._cryptoMode=e},t.create=function(t,n,r,i){return e.ts.mobile.sdk.impl.SDKConnectionSettingsImpl.create(t,n,r,i)},t.createWithCryptoMode=function(t,n,r,i,o){return e.ts.mobile.sdk.impl.SDKConnectionSettingsImpl.createWithCryptoMode(t,n,r,i,o)},t.__tarsusInterfaceName="SDKConnectionSettings",t}();t.SDKConnectionSettings=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.create=function(t,n,r,i){return this.createWithCryptoMode(t,n,r,i,e.ConnectionCryptoMode.None)},n.createWithCryptoMode=function(e,t,r,i,o){var a=new n;return a.setServerAddress(e),a.setAppId(t),a.setTokenName(r),a.setToken(i),a.setCryptoMode(o),a},n}(e.SDKConnectionSettings),t.SDKConnectionSettingsImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getQrCodeResult=function(){return this._qrCodeResult},n.prototype.setQrCodeResult=function(e){this._qrCodeResult=e},n.createScanQrCodeInput=function(t){return e.ts.mobile.sdk.impl.ScanQrCodeInputImpl.createScanQrCodeInput(t)},n.__tarsusInterfaceName="ScanQrCodeInput",n}(t.InputResponseType);t.ScanQrCodeInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createScanQrCodeInput=function(e){var n=new t;return n.setQrCodeResult(e),n},t}(e.ScanQrCodeInput),t.ScanQrCodeInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createAnswerToQuestion=function(e,n){var r=new t;return r._question=e,r._answer=n,r},t}(e.SecurityQuestionAndAnswer),t.SecurityQuestionAndAnswerImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createWithText=function(e){var n=new t;return n._answerText=e,n},t}(e.SecurityQuestionAnswer),t.SecurityQuestionAnswerImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t,n){this._id=e,this._text=t,this._registered=n}return e.prototype.getSecurityQuestionId=function(){return this._id},e.prototype.getSecurityQuestionText=function(){return this._text},e.__tarsusInterfaceName="SecurityQuestion",e}();e.SecurityQuestionImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createSecurityQuestionAnswersInputResponse=function(t){var n=new e.SecurityQuestionAnswersInputResponse;return n._answers=t,n},n}(e.SecurityQuestionInputResponse),t.SecurityQuestionInputResponseImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getStepTag=function(){return"question"},e.prototype.getSecurityQuestions=function(){return this._securityQuestions},e.prototype.getMinAnswersNeeded=function(){return this._minAnswers},e.createForAuthQuestion=function(t){var n=new e;return n._minAnswers=1,n._securityQuestions=[t],n},e.createForRegistrationQuestions=function(t,n){var r=new e;return r._minAnswers=n,r._securityQuestions=t,r},e.__tarsusInterfaceName="SecurityQuestionStepDescription",e}();e.SecurityQuestionStepDescriptionImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t="undefined"!=typeof window?window:t;t.com=e}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(t,n){var r=e.call(this)||this;return n&&(r._selectedTargets=n),t&&(r._authenticatorInput=t),r}return __extends(t,e),t.createAuthenticatorInput=function(e){return new t(e,null)},t.createTargetSelectionRequest=function(e){return new t(null,[e])},t.createTargetsSelectionRequest=function(e){return new t(null,e)},t}(e.TargetBasedAuthenticatorInput),t.TargetBasedAuthenticatorInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function t(t,n,r,i,o,a,s){this._deviceId=t,this._model=e.util.getDeviceModel(n,o),this._isCurrentDevice=i,this._osType=e.util.getOsName(o),this._osVersion=a,this._lastAccessed=r,this._alias=s}return t.prototype.getDeviceId=function(){return this._deviceId},t.prototype.getModel=function(){return this._model},t.prototype.getLastAccessed=function(){return this._lastAccessed},t.prototype.getIsCurrent=function(){return this._isCurrentDevice},t.prototype.getOsType=function(){return this._osType},t.prototype.getOsVersion=function(){return this._osVersion},t.prototype.getAlias=function(){return this._alias},t.prototype.describe=function(){var e=new Date(this._lastAccessed).toLocaleDateString();return(this._alias?this._alias+" : ":"")+this._model+" last accessed on "+e},t.fromServerFormat=function(e){return new t(e.device_id,e.model,e.last_access,e.current_device,e.os_type,e.os_version,e.alias||null)},t}();e.TargetDeviceDetailsImpl=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createPollRequest=function(){return e.ts.mobile.sdk.impl.TicketWaitInputImpl.createPollRequest()},n.__tarsusInterfaceName="TicketWaitInput",n}(t.InputResponseType);t.TicketWaitInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="TicketWaitInputPollRequest",t}(e.TicketWaitInput);e.TicketWaitInputPollRequest=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(t){var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createPollRequest=function(){return new r},t}(e.TicketWaitInput);t.TicketWaitInputImpl=n;var r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="TicketWaitInputPollRequest",t}(e.TicketWaitInputPollRequest);t.TicketWaitInputPollRequestImpl=r}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Qr=0]="Qr",e[e.Alphanumeric=1]="Alphanumeric"}(e.TicketIdFormat||(e.TicketIdFormat={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(t){var n=function(){function t(e){this._ticketId=e}return t.prototype.getFormat=function(){switch(this._ticketId.format){case e.core.Protocol.TicketIdFormatType.Alphanumeric:return e.TicketIdFormat.Alphanumeric;case e.core.Protocol.TicketIdFormatType.QrCode:default:return e.TicketIdFormat.Qr}},t.prototype.getValue=function(){return this._ticketId.value},t}();t.TicketIdImpl=n;var r=function(){function e(e){this._title=e.title,this._text=e.text,this._ticketId=new n(e.ticket_id)}return e.prototype.getTitle=function(){return this._title},e.prototype.getText=function(){return this._text},e.prototype.getTicketId=function(){return this._ticketId},e}();t.TicketWaitingInformationImpl=r}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function t(){}return t.fromAssertionFormat=function(t){switch(t.type){case e.core.Protocol.TotpChallengeFormatType.Numeric:return new r;case e.core.Protocol.TotpChallengeFormatType.QrCode:return new o;case e.core.Protocol.TotpChallengeFormatType.AlphaNumeric:return new n;default:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid format type encountered: "+t.type)}},t}();e.TotpChallengeFormatImpl=t;var n=function(){function e(){}return e.prototype.getType=function(){return i.AlphaNumeric},e.__tarsusInterfaceName="TotpChallengeFormatAlphaNumeric",e}();e.TotpChallengeFormatAlphaNumericImpl=n;var r=function(){function e(){}return e.prototype.getType=function(){return i.Numeric},e.__tarsusInterfaceName="TotpChallengeFormatNumeric",e}();e.TotpChallengeFormatNumericImpl=r;var i,o=function(){function e(){}return e.prototype.getType=function(){return i.QrCode},e.__tarsusInterfaceName="TotpChallengeFormatQr",e}();e.TotpChallengeFormatQrImpl=o,function(e){e[e.AlphaNumeric=0]="AlphaNumeric",e[e.Numeric=1]="Numeric",e[e.QrCode=2]="QrCode"}(i=e.TotpChallengeFormatType||(e.TotpChallengeFormatType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getChallenge=function(){return this._challenge},n.prototype.setChallenge=function(e){this._challenge=e},n.create=function(t){return e.ts.mobile.sdk.impl.TotpChallengeInputImpl.create(t)},n.__tarsusInterfaceName="TotpChallengeInput",n}(t.InputResponseType);t.TotpChallengeInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setChallenge(e),n},t}(e.TotpChallengeInput),t.TotpChallengeInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.createTotpGenerationRequest=function(t,n,r){var i=new e;return i.setUserId(t.userHandle),i.setChallenge(n),i.setGeneratorName(r),i},e.prototype.getChallenge=function(){return this._challenge},e.prototype.getGeneratorName=function(){return this._generatorName},e.prototype.setGeneratorName=function(e){this._generatorName=e},e.prototype.setChallenge=function(e){this._challenge=e},e.prototype.setUserId=function(e){this._userId=e},e.prototype.getUserId=function(){return this._userId},e.prototype.setUserHandleType=function(e){this._userHandleType=e},e.prototype.getUserHandleType=function(){return this._userHandleType},e}();e.TotpGenerationRequestImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.__tarsusInterfaceName="TotpInput",t}(e.InputResponseType);e.TotpInput=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.getCode=function(){return this._code},n.prototype.setCode=function(e){this._code=e},n.createTotpCodeSubmission=function(t){return e.ts.mobile.sdk.impl.TotpInputCodeSubmissionImpl.createTotpCodeSubmission(t)},n.__tarsusInterfaceName="TotpInputCodeSubmission",n}(t.TotpInput);t.TotpInputCodeSubmission=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.createTotpCodeSubmission=function(e){var n=new t;return n.setCode(e),n},t}(e.TotpInputCodeSubmission),t.TotpInputCodeSubmissionImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){var n=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._components=e}return e.prototype.toString=function(){return this._components.map(function(e){return e.replace(/([\\.])/g,function(e){return"\\"+("."==e?"p":e)})}).join(".")},e.fromString=function(t){return new(e.bind.apply(e,[void 0].concat(t.split("."))))},e.prototype.concat=function(t){return new(e.bind.apply(e,[void 0].concat(this._components.concat(t._components))))},e}();t.TarsusKeyPath=n;var r=function(){function t(e){this._host=e}return t.prototype.readStorageKey=function(e){return this._host.readStorageKey(e.toString())},t.prototype.writeStorageKey=function(e,t){this._host.writeStorageKey(e.toString(),t)},t.prototype.deleteStorageKey=function(e){this._host.deleteStorageKey(e.toString())},t.prototype.readSessionStorageKey=function(e){return this._host.readSessionStorageKey(e.toString())},t.prototype.writeSessionStorageKey=function(e,t){this._host.writeSessionStorageKey(e.toString(),t)},t.prototype.deleteSessionStorageKey=function(e){this._host.deleteSessionStorageKey(e.toString())},t.prototype.generateKeyPair=function(e,t,n,r){return this._host.generateKeyPair(e.toString(),t,n,r)},t.prototype.generateKeyPairExternalRepresentation=function(e){return this._host.generateKeyPairExternalRepresentation(e)},t.prototype.generateHexSeededKeyPairExternalRepresentation=function(e,t){return this._host.generateHexSeededKeyPairExternalRepresentation(e,t)},t.prototype.getKeyPair=function(e,t,n){return this._host.getKeyPair(e.toString(),t,n)},t.prototype.deleteKeyPair=function(e){this._host.deleteKeyPair(e.toString())},t.prototype.importVolatileSymmetricKey=function(e,t){return this._host.importVolatileSymmetricKey(e,t)},t.prototype.importVolatileKeyPair=function(e,t){return this._host.importVolatileKeyPair(e,t)},t.prototype.importVolatileKeyPairFromPublicKeyHex=function(e,t){return this._host.importVolatileKeyPairFromPublicKeyHex(e,t)},t.prototype.generatePbkdf2HmacSha1HexString=function(e,t,n,r){return this._host.generatePbkdf2HmacSha1HexString(e,t,n,r)},t.prototype.calcHexStringEncodedSha256Hash=function(e){return this._host.calcHexStringEncodedSha256Hash(e)},t.prototype.calcHexStringEncodedSha512Hash=function(e){return this._host.calcHexStringEncodedSha512Hash(e)},t.prototype.generateRandomHexString=function(e){return this._host.generateRandomHexString(e)},t.prototype.queryHostInfo=function(e){return this._host.queryHostInfo(e)},t.prototype.calcHexStringEncodedHmacSha1HashWithHexEncodedKey=function(e,t){return this._host.calcHexStringEncodedHmacSha1HashWithHexEncodedKey(e,t)},t.prototype.getCurrentTime=function(){return this._host.getCurrentTime()},t.prototype.createDelayedPromise=function(e){return this._host.createDelayedPromise(e)},t.prototype.fidoClientXact=function(e,t,n,r){return this._host.fidoClientXact(e,t,n,r)},t.prototype.fido2CredentialsOp=function(e,t,n,r,i){return this._host.fido2CredentialsOp(e,t,n,r,i)},t.prototype.dyadicEnroll=function(e,t){return this._host.dyadicEnroll(e,t)},t.prototype.dyadicSign=function(e){return this._host.dyadicSign(e)},t.prototype.dyadicDelete=function(){return this._host.dyadicDelete()},t.prototype.dyadicRefreshToken=function(e){return this._host.dyadicRefreshToken(e)},t.prototype.transformApiPath=function(e){return this._host.transformApiPath(e)},t.prototype.log=function(e,t,n){return this._host.log(e,t,n)},t.prototype.loadPlugin=function(e){return this._host.loadPlugin(e)},t.prototype.deviceSupportsCryptoBind=function(){return"true"==this.queryHostInfo(e.sdkhost.HostInformationKey.PersistentKeysSupported)},t}();t.TarsusHostServices=r})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(t){var n=new t.core.TarsusKeyPath("currentSession"),r=function(){function r(){this.mandatoryCollectors=[t.CollectorType.DeviceDetails,t.CollectorType.ExternalSDKDetails,t.CollectorType.HWAuthenticators,t.CollectorType.LocalEnrollments,t.CollectorType.Capabilities]}return r.prototype.pushRequestPayloadFromJSON=function(e){var n=e.push_type;switch(n){case"otp_notification":return t.impl.OtpPushRequestPayloadImpl.createWithJsonPayload(e);case"device_notification":return t.impl.IdentifyDevicePushRequestPayloadImpl.createWithJsonPayload(e);case"approval":return t.impl.MobileApprovePushRequestPayloadImpl.createWithJsonPayload(e)}throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Payload with type "+n+" isn't recognized")},r.prototype.setTarsusHost=function(e){this._nativeHost=e,this.host=new t.core.TarsusHostServices(e),this.pluginManager=new t.core.TarsusPluginManager(this),this.enabledCollectors=[t.CollectorType.Accounts,t.CollectorType.DeviceDetails,t.CollectorType.Contacts,t.CollectorType.Owner,t.CollectorType.Software,t.CollectorType.Location,t.CollectorType.Bluetooth,t.CollectorType.ExternalSDKDetails,t.CollectorType.HWAuthenticators,t.CollectorType.FidoAuthenticators,t.CollectorType.Capabilities,t.CollectorType.LargeData,t.CollectorType.LocalEnrollments],this.currentPersistUserData=!0},r.prototype.setConnectionSettings=function(e){this.connectionSettings=e},r.prototype.setClientCryptoSettings=function(e){this.cryptoSettings=e},r.prototype.setEnabledCollectors=function(e){this.enabledCollectors=e,this.addMandatoryCollectorsIfNeeded()},r.prototype.setLogLevel=function(e){this._nativeHost.setLogLevel(e)},r.prototype.setExternalLogger=function(e){this._nativeHost.setExternalLogger(e)},r.prototype.setTransportProvider=function(e){this.transportProvider=e},r.prototype.setUiHandler=function(e){this.currentUiHandler=e},r.prototype.setPushToken=function(e){this._lastReceivedPushToken=e},r.prototype.setPersistUserData=function(e){this.currentPersistUserData=e},Object.defineProperty(r.prototype,"currentSession",{get:function(){return this._currentSession},enumerable:!0,configurable:!0}),r.prototype.installPlugin=function(e,t){this.pluginManager.installPlugin(e,t)},r.prototype.initialize=function(){var e=this;return new Promise(function(r,i){if(!e.host)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to initialize SDK without host.");if(!e.connectionSettings)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to initialize SDK without connection settings.");if(!e.transportProvider)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to initialize SDK without transport provider.");e.cryptoSettings||(e.cryptoSettings=t.ClientCryptoSettings.create(1e4)),e.fidoClient=new t.core.fidoclient.TarsusFidoClient(e),e._nativeHost.initialize(e.enabledCollectors).then(function(r){return e.pluginManager.initializePlugins().then(function(){var r=e.host.readSessionStorageKey(n);if(r){e.log(t.LogLevel.Info,"Loading existing session from session store");try{e._currentSession=t.core.Session.fromJson(e,r),e.log(t.LogLevel.Debug,"Loaded existing session for user "+(e._currentSession.user&&e._currentSession.user.displayName))}catch(r){e.log(t.LogLevel.Warning,"Failed to load existing session from session store. Discarding existing session "+r+".")}}return!0})}).then(r,i)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.getUsersInfo=function(){var e=[];return t.core.User.iterateUsers(this,function(n){e.push(t.impl.UserInfoImpl.createWithUser(n))}),e},r.prototype.isBoundForUser=function(e){var n=t.core.User.findUser(this,e);return!(!n||!n.deviceBound)},r.prototype.getBoundUserIds=function(){var e=[];return t.core.User.iterateUsers(this,function(t){t.userId&&t.deviceBound&&e.push(t.userId)}),e},r.prototype.getKnownUserIds=function(){var e=[];return t.core.User.iterateUsers(this,function(t){t.userId&&(t.hasLoggedIn||t.deviceBound)&&e.push(t.userId)}),e},r.prototype.logout=function(){var e=this;return new Promise(function(n,r){if(e._currentSession)if(e._currentSession.canTerminate()){var i,o=e._currentSession.createLogoutRequest(),a=e._currentSession;e._currentSession=null,e.saveCurrentSession(),a.invalidated?(e.log(t.LogLevel.Info,"Logging out with an invalidated session; not issuing server request."),i=Promise.resolve(!0)):i=a.performSessionExchange(o).then(function(e){return Promise.resolve(!0)}),i.then(function(e){return t.core.Session.notifySessionObserversOnMainSessionLogout(a),e}).then(n,r)}else r(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to logout with a locked session."));else r(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"No logged in user."))}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.isTotpProvisionedForUser=function(e,n){var r=t.core.User.findUser(this,e);if(!r)return this.log(t.LogLevel.Error,"Can not find user record for <"+e+">"),!1;var i=new t.core.LocalSession(this,r);return t.core.totp.TotpPropertiesProcessor.createWithUserWithoutUIInteraction(r,this,i).isTotpProvisionedForGenerator(n||t.core.totp.TotpPropertiesProcessor.BACKWARD_COMPATIBILITY_DEFAULT_GENERATOR)},r.prototype.getVersionInfo=function(){return this._versionInfo||(this._versionInfo=new t.impl.VersionInfoImpl(this.host.queryHostInfo(e.sdkhost.HostInformationKey.Platform),this.host.queryHostInfo(e.sdkhost.HostInformationKey.Version))),this._versionInfo},r.prototype.resolveUserForBind=function(e,n){var r=t.core.User.findUser(this,e);if(r&&r.deviceBound)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to bind an already bound user on this device.",{user:e});return r||(this.log(t.LogLevel.Debug,"bind: Creating new user "+e),r=t.core.User.createUser(this,e,n?t.UserHandleType.IdToken:t.UserHandleType.UserId)),r},r.prototype.internalBind=function(n,r,i){var o=this,a=!1;return new Promise(function(s,c){if(o.log(t.LogLevel.Debug,"Bind for user "+(n.userId||n.idToken)),o.ensureConfigured(),o._currentSession)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to start a session (bind) with a current primary active session.");var u=new t.core.Session(o,n);a=!0,o._currentSession=u,o.log(t.LogLevel.Debug,"bind: Generating new device keys for "+(n.userId||n.idToken));var l=o.host.generateKeyPair(n.deviceSigningKeyTag,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.None,!0),d=o.host.generateKeyPair(n.deviceEncryptionKeyTag,e.sdkhost.KeyClass.StdEncryptionKey,e.sdkhost.KeyBiometricProtectionMode.None,!0),h=t.util.wrapPromiseWithActivityIndicator(o.currentUiHandler,null,i,Promise.all([l,d])).then(function(e){var n=e[0],i=e[1];return o.log(t.LogLevel.Debug,"bind: key generation done"),o.promiseCollectionResult().then(function(e){return o.log(t.LogLevel.Debug,"bind: Collection result completed, Initiating request promise"),u.createBindRequest(e,o._lastReceivedPushToken,n,i,r)})}),p=!1,f=function(e){if(p)return e;p=!0;var n=u.deviceId();return n&&(o.log(t.LogLevel.Debug,"bind: binding device to user after succesful completion"),u.user.bindDeviceToUser(n)),t.core.Session.notifySessionObserversOnMainSessionLogin(u),e};o.log(t.LogLevel.Debug,"bind: Sending request"),u.startControlFlow(h,null,i,f).then(function(e){return f(e),o.saveCurrentSession(),u.persistUserData&&t.core.User.save(o,u.user),e}).then(s,c)}).catch(function(e){return a&&(o.log(t.LogLevel.Debug,"bind: Clearing session after error"),o._currentSession=null),Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.bindWithIdToken=function(e,n,r){try{var i=this.resolveUserForBind(e,!0);return this.internalBind(i,n,r)}catch(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},r.prototype.bind=function(e,n,r){try{var i=this.resolveUserForBind(e,!1);return this.internalBind(i,n,r)}catch(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},r.prototype.resolveUserForAuthenticate=function(e,n){var r;return this.host.deviceSupportsCryptoBind()?r=this.lookupBoundUser(e):(r=t.core.User.findUser(this,e))||(this.log(t.LogLevel.Debug,"authenticate: Creating new user "+e),r=t.core.User.createUser(this,e,n?t.UserHandleType.IdToken:t.UserHandleType.UserId)),r},r.prototype.internalAuthenticate=function(e,n,r,i){var o=this,a=!1;return new Promise(function(s,c){if(o.log(t.LogLevel.Debug,"Authenticate for user "+(e.userId||e.idToken)+" with policy "+n),o.ensureConfigured(),o._currentSession)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to start a session (authenticate) with a current primary active session.");var u=new t.core.Session(o,e);a=!0,o._currentSession=u,o.log(t.LogLevel.Debug,"authenticate: Initiating message setup");var l=t.util.wrapPromiseWithActivityIndicator(o.currentUiHandler,null,i,o.promiseCollectionResult()).then(function(e){return o.log(t.LogLevel.Debug,"authenticate: Collection done; setting up request"),u.createLoginRequest(e,o._lastReceivedPushToken,n,r)});o.log(t.LogLevel.Debug,"authenticate: Sending request"),o._currentSession.startControlFlow(l,null,i).then(function(e){return o.saveCurrentSession(),o.log(t.LogLevel.Debug,"authenticate: marking user has logged in after succesful completion"),u.user.markLoggedIn(),u.persistUserData&&t.core.User.save(o,u.user),t.core.Session.notifySessionObserversOnMainSessionLogin(u),e}).then(s,c)}).catch(function(e){return a&&(o.log(t.LogLevel.Debug,"authenticate: Clearing session after error"),o._currentSession=null),Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.authenticate=function(e,n,r,i){try{var o=this.resolveUserForAuthenticate(e,!1);return this.internalAuthenticate(o,n,r,i)}catch(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},r.prototype.authenticateWithIdToken=function(e,n,r,i){try{var o=this.resolveUserForAuthenticate(e,!0);return this.internalAuthenticate(o,n,r,i)}catch(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},r.prototype.invokePolicy=function(e,n,r){var i=this;return this.log(t.LogLevel.Debug,"Invoke policy "+e+" for current session."),new Promise(function(o,a){i.ensureConfigured(),i.runWithCurrentSession(function(o){i.log(t.LogLevel.Debug,"invokePolicy: Initiating request creation");var a=i.promiseCollectionResult().then(function(r){return i.log(t.LogLevel.Debug,"invokePolicy: Collection done; setting up request"),o.createLoginRequest(r,i._lastReceivedPushToken,e,n)});return i.log(t.LogLevel.Debug,"invokePolicy: Initiating control flow"),o.startControlFlow(a,null,r)}).then(o,a)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.startTotpSessionForUser=function(e,n,r,i){var o=this;return r=r||t.core.totp.TotpPropertiesProcessor.BACKWARD_COMPATIBILITY_DEFAULT_GENERATOR,this.log(t.LogLevel.Debug,"Start TOTP session for user "+e+", generator "+r),new Promise(function(a,s){o.ensureConfigured(),o.log(t.LogLevel.Debug,"Get TOTP data for <"+e+", "+r+">");var c=t.core.User.findUser(o,e);if(!c)throw o.log(t.LogLevel.Error,"Can not find user record for <"+e+">"),new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Can not find user <"+e+">");var u=new t.core.LocalSession(o,c);t.core.totp.TotpPropertiesProcessor.createWithUserHandle(e,o,u,i).runCodeGenerationSession(r,n,i,o.currentUiHandler).then(a,s)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.totpGenerationRequestForUserFromCanonicalString=function(e,n){this.ensureConfigured(),this.log(t.LogLevel.Debug,"Get TOTP request for <"+e+">");var r=t.core.User.findUser(this,e);if(!r)throw this.log(t.LogLevel.Error,"Can not find user record for <"+e+">"),new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Can not find user <"+e+">");var i=new t.core.LocalSession(this,r);return t.core.totp.TotpPropertiesProcessor.createWithUserWithoutUIInteraction(r,this,i).totpRequestFromCanonicalString(n)},r.prototype.startTotpSessionWithRequest=function(e,n){var r=this;return new Promise(function(i,o){r.ensureConfigured(),r.log(t.LogLevel.Debug,"Start TOTP session for user "+e.getUserId()+", generator "+e.getGeneratorName());var a=t.core.User.findUser(r,e.getUserId());if(!a)throw r.log(t.LogLevel.Error,"Can not find user record for <"+e.getUserId()+">"),new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Can not find user <"+e.getUserId()+">");var s=new t.core.LocalSession(r,a);t.core.totp.TotpPropertiesProcessor.createWithUserHandle(e.getUserId(),r,s,n).runCodeGenerationSessionWithRequest(e,n,r.currentUiHandler).then(i,o)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.startDeviceManagementSession=function(e){var n=this;return new Promise(function(r,i){n.ensureConfigured(),n.runWithCurrentSession(function(r){return n.log(t.LogLevel.Debug,"User in current session: "+r.user.displayName),new t.core.DeviceManagementSessionProcessor(n,r,e).run()}).then(function(e){switch(e){case t.core.DeviceManagementSessionProcessorReturnReason.CurrentDeviceDeleted:var r=n._currentSession&&n._currentSession.user;return n.log(t.LogLevel.Debug,"Invalidating current session after deletion of current device."),n._currentSession=null,n.saveCurrentSession(),r?(n.log(t.LogLevel.Debug,"Clearing data for current user ("+r.displayName+") after deletion of current device."),n.clearDataForUser(r.userHandle)):n.log(t.LogLevel.Warning,"No current user after deletion of current device; not clearing sesison."),!0;case t.core.DeviceManagementSessionProcessorReturnReason.FinishSession:return!0}}).then(r,i)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.startAuthenticationConfiguration=function(e){var n=this;return this.log(t.LogLevel.Debug,"Start authentication configuration for current session"),new Promise(function(r,i){n.ensureConfigured(),n.runWithCurrentSession(function(r){return n.log(t.LogLevel.Debug,"User in current session: "+r.user.displayName),new t.core.AuthenticationConfigurationSessionProcessor(n,r,e).run()}).then(r,i)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.startAuthenticationConfigurationWithToken=function(e,n){var r=this;return this.log(t.LogLevel.Debug,"Start approval for provided session token"),new Promise(function(i,o){r.ensureConfigured(),r.runWithCurrentSession(function(i){return r.log(t.LogLevel.Debug,"User in current session: "+i.user.displayName),new t.core.AuthenticationConfigurationSessionProcessor(r,i,n,e).run()}).then(i,o)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.startApprovalsSessionForCurrentSession=function(e){var n=this;return this.log(t.LogLevel.Debug,"Start approval for current session"),new Promise(function(r,i){n.ensureConfigured(),n.runWithCurrentSession(function(r){return n.log(t.LogLevel.Debug,"User in current session: "+r.user.displayName),new t.core.ApprovalSessionProcessor(n,r,e).run()}).then(r,i)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.startApprovalsSessionForPushedRequest=function(e,n){var r=this;return this.log(t.LogLevel.Debug,"Start approval for push request"),new Promise(function(i,o){if(r.ensureConfigured(),!e.userId())return e.ticket()?void o(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Mobile approval push by ticket not yet implemented.")):void o(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Unknown mobile approval push request."));r.log(t.LogLevel.Debug,"startApprovalsSessionForPushedRequest with userid "+e.userId());var a=r.lookupBoundUser(e.userId()),s=new t.core.Session(r,a);new t.core.ApprovalSessionProcessor(r,s,n).run().then(i,o)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.invokeAnonymousPolicy=function(e,n,r){var i=this;return this.log(t.LogLevel.Debug,"Start anonymous policy "+e),new Promise(function(o,a){i.log(t.LogLevel.Debug,"authenticate: Initiating message setup");var s,c=i.promiseCollectionResult();s=t.core.Session.createAnonymousSession(i);var u=c.then(function(r){return i.log(t.LogLevel.Debug,"invokeAnonymusPolicy: Collection done; setting up request"),s.createAnonPolicyRequest(r,i._lastReceivedPushToken,e,n)});i.log(t.LogLevel.Debug,"authenticate: Sending request"),s.startControlFlow(u,null,r).then(function(e){return e},function(e){throw i.log(t.LogLevel.Debug,"authenticate: Clearing session after error"),e}).then(o,a)}).catch(function(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.cancelCurrentRunningControlFlow=function(){this.log(t.LogLevel.Debug,"Cancel current running control flow requested."),this._currentSession?this._currentSession.cancelCurrentControlFlow():this.log(t.LogLevel.Error,"No current session")},r.prototype.ensureConfigured=function(){if(!this.currentUiHandler)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to start authentication without a registered UIHandler.")},r.prototype.saveCurrentSession=function(){this._currentSession?this.host.writeSessionStorageKey(n,this._currentSession.toJson()):this.host.deleteSessionStorageKey(n)},r.prototype.runWithCurrentSession=function(e){var n=this;if(!this._currentSession)return Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.SessionRequired,"Operation requires an active session."));var r=this._currentSession;return r.lock(),e(r).finally(function(){r.unlock(),n.saveCurrentSession()})},r.prototype.log=function(e,t){this._nativeHost.log(e,"TransmitSDK/Tarsus",t)},r.prototype.promiseCollectionResult=function(){var e=this;return this._nativeHost.promiseCollectionResult().then(function(t){return e.addTarsusCollectedData(t)})},r.prototype.getClientFeatureSet=function(){var n,r=this.host.queryHostInfo(e.sdkhost.HostInformationKey.HostProvidedFeatures);return n=r&&r.length?r.split(",").map(function(e){return parseInt(e)}):[],t.core.STATIC_FEATURE_SET.concat(n)},r.prototype.clearDataForUser=function(e){try{if(this.log(t.LogLevel.Debug,"Delete data for user "+e+"."),this._currentSession)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to call clearDataForUser with an active primary ongoing session.");var n=t.core.User.findUser(this,e);if(!n)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to call clearDataForUser with a non existing user.");try{this.host.deleteKeyPair(n.deviceSigningKeyTag)}catch(e){this.log(t.LogLevel.Warning,"Can't delete device signing key.")}try{this.host.deleteKeyPair(n.deviceEncryptionKeyTag)}catch(e){this.log(t.LogLevel.Warning,"Can't delete device encryption key.")}try{t.core.LocalEnrollment.deleteEnrollmentsForUser(n,this)}catch(e){this.log(t.LogLevel.Warning,"Can't delete enrollments for user.")}var r=new t.core.LocalSession(this,n);try{t.core.totp.TotpPropertiesProcessor.createWithUserWithoutUIInteraction(n,this,r).deleteAllProvisions()}catch(e){this.log(t.LogLevel.Warning,"Can't delete enrollments for user.")}t.core.User.deleteUser(n,this)}catch(n){throw this.log(t.LogLevel.Warning,"Can't delete data for user "+e+": "+n),n}},r.prototype.clearAllData=function(){var e=this;if(this._currentSession)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to call clearAllData with an active primary ongoing session.");this.log(t.LogLevel.Debug,"Delete all data: collecting users");var n=[];t.core.User.iterateUsers(this,function(e){n.push(e.userHandle)}),this.log(t.LogLevel.Debug,"Delete all data: deleting users"),n.forEach(function(n){try{e.clearDataForUser(n)}catch(r){e.log(t.LogLevel.Warning,"Error when deleting user "+n+": "+r)}})},r.prototype.lookupBoundUser=function(e){var n=t.core.User.findUser(this,e);if(!n)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to authenticate with an unknown user on this device.",{user:e});if(!n.deviceBound)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to authenticate with an unbound user on this device.",{user:e});return n},r.prototype.addTarsusCollectedData=function(e){var n=this;return new Promise(function(r,o){var a=new Array,s=new Array;Object.keys(t.core.collectors.TarsusCollectors).forEach(function(e){var r=new t.core.collectors.TarsusCollectors[e].createCollector(n.enabledCollectors);r.isEnabled()&&(s.push(e),a.push(r.provide(n)))}),Promise.all(a.map(function(e){return e.catch(function(e){return new Error(e)})})).then(function(o){var a=e.toJson();for(var c in o)o[c]instanceof Error?n.log(t.LogLevel.Error,"caught collection error "+o[c]):(n.log(t.LogLevel.Debug,"Tarsus collected from: "+s[c]+" "+JSON.stringify(o[c])),a.content[s[c]]=n.mergeCollectedData(o[c],a.content[s[c]]));r(new i(a))}).catch(function(e){o(e)})})},r.prototype.mergeCollectedData=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},r.prototype.addMandatoryCollectorsIfNeeded=function(){var e=this;this.mandatoryCollectors.forEach(function(n){e.enabledCollectors.indexOf(n)<0&&(e.enabledCollectors.push(n),e.log(t.LogLevel.Warning,t.CollectorType[n]+" collector is mandatory, and will remain enabled."))})},r.__tarsusInterfaceName="TransmitSDKXm",r}();t.TransmitSDKXmImpl=r;var i=function(){function e(e){this.theResult=e}return e.prototype.toJson=function(){return this.theResult},e}();t.CollectionResultImpl=i,t.createSdk=function(){return new r}}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getUserChoice=function(){return this._userChoice},t.prototype.setUserChoice=function(e){this._userChoice=e},t.create=function(t){return e.ts.mobile.sdk.impl.UnregistrationInputImpl.create(t)},t.__tarsusInterfaceName="UnregistrationInput",t}();t.UnregistrationInput=n}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e){var n=new t;return n.setUserChoice(e),n},t}(e.UnregistrationInput),t.UnregistrationInputImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getUserHandle=function(){return this._user.userHandle},e.prototype.getUserHandleType=function(){return this._user.userHandleType},e.prototype.getDisplayName=function(){return this._user.displayName},e.prototype.getDeviceBound=function(){return this._user.deviceBound},e.prototype.getHasLoggedIn=function(){return this._user.hasLoggedIn},e.createWithUser=function(t){var n=new e;return n._user=t,n},e}();e.UserInfoImpl=t}(e.impl||(e.impl={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(){function t(e,t){this._sdkVersion=t,this._platformName=e}return t.prototype.getSdkVersion=function(){return this._sdkVersion},t.prototype.getTarsusVersion=function(){return e.core.TARSUS_VERSION},t.prototype.getPlatformName=function(){return this._platformName},t.prototype.getApiLevel=function(){return e.core.API_LEVEL},t}(),t.VersionInfoImpl=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){function t(e){return parseInt(e)===e}function n(e){if(!t(e.length))return!1;for(var n=0;n<e.length;n++)if(!t(e[n])||e[n]<0||e[n]>255)return!1;return!0}function r(e,r){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return r&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!n(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(t(e.length)&&n(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function i(e){return new Uint8Array(e)}function o(e,t,n,r,i){null==r&&null==i||(e=e.slice?e.slice(r,i):Array.prototype.slice.call(e,r,i)),t.set(e,n)}function a(e){for(var t=[],n=0;n<e.length;n+=4)t.push(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]);return t}var s=function(){return{toBytes:function(e){var t=[],n=0;for(e=encodeURI(e);n<e.length;){var i=e.charCodeAt(n++);37===i?(t.push(parseInt(e.substr(n,2),16)),n+=2):t.push(i)}return r(t)},fromBytes:function(e){for(var t=[],n=0;n<e.length;){var r=e[n];r<128?(t.push(String.fromCharCode(r)),n++):r>191&&r<224?(t.push(String.fromCharCode((31&r)<<6|63&e[n+1])),n+=2):(t.push(String.fromCharCode((15&r)<<12|(63&e[n+1])<<6|63&e[n+2])),n+=3)}return t.join("")}}}(),c=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},fromBytes:function(t){for(var n=[],r=0;r<t.length;r++){var i=t[r];n.push(e[(240&i)>>4]+e[15&i])}return n.join("")}}}(),u={16:10,24:12,32:14},l=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],d=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],h=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],p=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],f=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],m=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],g=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],v=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],y=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],b=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],A=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],_=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],S=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],I=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],w=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925],k=function(e){if(!(this instanceof k))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:r(e,!0)}),this._prepare()};k.prototype._prepare=function(){var e=u[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var n,r=4*(e+1),i=this.key.length/4,o=a(this.key);for(t=0;t<i;t++)n=t>>2,this._Ke[n][t%4]=o[t],this._Kd[e-n][t%4]=o[t];for(var s,c=0,h=i;h<r;){if(s=o[i-1],o[0]^=d[s>>16&255]<<24^d[s>>8&255]<<16^d[255&s]<<8^d[s>>24&255]^l[c]<<24,c+=1,8!=i)for(t=1;t<i;t++)o[t]^=o[t-1];else{for(t=1;t<i/2;t++)o[t]^=o[t-1];s=o[i/2-1],o[i/2]^=d[255&s]^d[s>>8&255]<<8^d[s>>16&255]<<16^d[s>>24&255]<<24;for(t=i/2+1;t<i;t++)o[t]^=o[t-1]}for(t=0;t<i&&h<r;)p=h>>2,f=h%4,this._Ke[p][f]=o[t],this._Kd[e-p][f]=o[t++],h++}for(var p=1;p<e;p++)for(var f=0;f<4;f++)s=this._Kd[p][f],this._Kd[p][f]=_[s>>24&255]^S[s>>16&255]^I[s>>8&255]^w[255&s]},k.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,n=[0,0,0,0],r=a(e),o=0;o<4;o++)r[o]^=this._Ke[0][o];for(var s=1;s<t;s++){for(o=0;o<4;o++)n[o]=p[r[o]>>24&255]^f[r[(o+1)%4]>>16&255]^m[r[(o+2)%4]>>8&255]^g[255&r[(o+3)%4]]^this._Ke[s][o];r=n.slice()}var c,u=i(16);for(o=0;o<4;o++)c=this._Ke[t][o],u[4*o]=255&(d[r[o]>>24&255]^c>>24),u[4*o+1]=255&(d[r[(o+1)%4]>>16&255]^c>>16),u[4*o+2]=255&(d[r[(o+2)%4]>>8&255]^c>>8),u[4*o+3]=255&(d[255&r[(o+3)%4]]^c);return u},k.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,n=[0,0,0,0],r=a(e),o=0;o<4;o++)r[o]^=this._Kd[0][o];for(var s=1;s<t;s++){for(o=0;o<4;o++)n[o]=v[r[o]>>24&255]^y[r[(o+3)%4]>>16&255]^b[r[(o+2)%4]>>8&255]^A[255&r[(o+1)%4]]^this._Kd[s][o];r=n.slice()}var c,u=i(16);for(o=0;o<4;o++)c=this._Kd[t][o],u[4*o]=255&(h[r[o]>>24&255]^c>>24),u[4*o+1]=255&(h[r[(o+3)%4]>>16&255]^c>>16),u[4*o+2]=255&(h[r[(o+2)%4]>>8&255]^c>>8),u[4*o+3]=255&(h[255&r[(o+1)%4]]^c);return u};var C=function(e){if(!(this instanceof C))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new k(e)};C.prototype.encrypt=function(e){if((e=r(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=i(e.length),n=i(16),a=0;a<e.length;a+=16)o(e,n,0,a,a+16),o(n=this._aes.encrypt(n),t,a);return t},C.prototype.decrypt=function(e){if((e=r(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=i(e.length),n=i(16),a=0;a<e.length;a+=16)o(e,n,0,a,a+16),o(n=this._aes.decrypt(n),t,a);return t};var E=function(e,t){if(!(this instanceof E))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=i(16);this._lastCipherblock=r(t,!0),this._aes=new k(e)};E.prototype.encrypt=function(e){if((e=r(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=i(e.length),n=i(16),a=0;a<e.length;a+=16){o(e,n,0,a,a+16);for(var s=0;s<16;s++)n[s]^=this._lastCipherblock[s];this._lastCipherblock=this._aes.encrypt(n),o(this._lastCipherblock,t,a)}return t},E.prototype.decrypt=function(e){if((e=r(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=i(e.length),n=i(16),a=0;a<e.length;a+=16){o(e,n,0,a,a+16),n=this._aes.decrypt(n);for(var s=0;s<16;s++)t[a+s]=n[s]^this._lastCipherblock[s];o(e,this._lastCipherblock,0,a,a+16)}return t};var P=function(e,t,n){if(!(this instanceof P))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 size)")}else t=i(16);n||(n=1),this.segmentSize=n,this._shiftRegister=r(t,!0),this._aes=new k(e)};P.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t,n=r(e,!0),i=0;i<n.length;i+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var a=0;a<this.segmentSize;a++)n[i+a]^=t[a];o(this._shiftRegister,this._shiftRegister,0,this.segmentSize),o(n,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return n},P.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t,n=r(e,!0),i=0;i<n.length;i+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var a=0;a<this.segmentSize;a++)n[i+a]^=t[a];o(this._shiftRegister,this._shiftRegister,0,this.segmentSize),o(e,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return n};var T=function(e,t){if(!(this instanceof T))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=i(16);this._lastPrecipher=r(t,!0),this._lastPrecipherIndex=16,this._aes=new k(e)};T.prototype.encrypt=function(e){for(var t=r(e,!0),n=0;n<t.length;n++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[n]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},T.prototype.decrypt=T.prototype.encrypt;var R=function(e){if(!(this instanceof R))throw Error("Counter must be instanitated with `new`");0===e||e||(e=1),"number"==typeof e?(this._counter=i(16),this.setValue(e)):this.setBytes(e)};R.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");if(e>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},R.prototype.setBytes=function(e){if(16!=(e=r(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},R.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var D=function(e,t){if(!(this instanceof D))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof R||(t=new R(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new k(e)};D.prototype.encrypt=function(e){for(var t=r(e,!0),n=0;n<t.length;n++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[n]^=this._remainingCounter[this._remainingCounterIndex++];return t},D.prototype.decrypt=D.prototype.encrypt;var x={AES:k,Counter:R,ModeOfOperation:{ecb:C,cbc:E,cfb:P,ofb:T,ctr:D},utils:{hex:c,utf8:s},padding:{pkcs7:{pad:function(e){var t=16-(e=r(e,!0)).length%16,n=i(e.length+t);o(e,n);for(var a=e.length;a<n.length;a++)n[a]=t;return n},strip:function(e){if((e=r(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(t>16)throw new Error("PKCS#7 padding byte out of range");for(var n=e.length-t,a=0;a<t;a++)if(e[n+a]!==t)throw new Error("PKCS#7 invalid padding byte");var s=i(n);return o(e,s,0,0,n),s}}},_arrayTest:{coerceArray:r,createArray:i,copyArray:o}};e.aesjs&&(x._aesjs=e.aesjs),e.aesjs=x}("undefined"!=typeof window?window:global),function(e){("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).elliptic=function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){return i(t[a][1][e]||e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";var r=n;r.version=e("../package.json").version,r.utils=e("./elliptic/utils"),r.rand=e("brorand"),r.curve=e("./elliptic/curve"),r.curves=e("./elliptic/curves"),r.ec=e("./elliptic/ec"),r.eddsa=e("./elliptic/eddsa")},{"../package.json":30,"./elliptic/curve":4,"./elliptic/curves":7,"./elliptic/ec":8,"./elliptic/eddsa":11,"./elliptic/utils":15,brorand:17}],2:[function(e,t,n){"use strict";function r(e,t){this.type=e,this.p=new o(t.p,16),this.red=t.prime?o.red(t.prime):o.mont(this.p),this.zero=new o(0).toRed(this.red),this.one=new o(1).toRed(this.red),this.two=new o(2).toRed(this.red),this.n=t.n&&new o(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function i(e,t){this.curve=e,this.type=t,this.precomputed=null}var o=e("bn.js"),a=e("../../elliptic").utils,s=a.getNAF,c=a.getJSF,u=a.assert;t.exports=r,r.prototype.point=function(){throw new Error("Not implemented")},r.prototype.validate=function(){throw new Error("Not implemented")},r.prototype._fixedNafMul=function(e,t){u(e.precomputed);var n=e._getDoubles(),r=s(t,1),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;for(var o=[],a=0;a<r.length;a+=n.step){var c=0;for(t=a+n.step-1;t>=a;t--)c=(c<<1)+r[t];o.push(c)}for(var l=this.jpoint(null,null,null),d=this.jpoint(null,null,null),h=i;h>0;h--){for(a=0;a<o.length;a++)(c=o[a])===h?d=d.mixedAdd(n.points[a]):c===-h&&(d=d.mixedAdd(n.points[a].neg()));l=l.add(d)}return l.toP()},r.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=s(t,n),a=this.jpoint(null,null,null),c=o.length-1;c>=0;c--){for(t=0;c>=0&&0===o[c];c--)t++;if(c>=0&&t++,a=a.dblp(t),c<0)break;var l=o[c];u(0!==l),a="affine"===e.type?l>0?a.mixedAdd(i[l-1>>1]):a.mixedAdd(i[-l-1>>1].neg()):l>0?a.add(i[l-1>>1]):a.add(i[-l-1>>1].neg())}return"affine"===e.type?a.toP():a},r.prototype._wnafMulAdd=function(e,t,n,r,i){for(var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d=0;d<r;d++){var h=(k=t[d])._getNAFPoints(e);o[d]=h.wnd,a[d]=h.points}for(d=r-1;d>=1;d-=2){var p=d-1,f=d;if(1===o[p]&&1===o[f]){var m=[t[p],null,null,t[f]];0===t[p].y.cmp(t[f].y)?(m[1]=t[p].add(t[f]),m[2]=t[p].toJ().mixedAdd(t[f].neg())):0===t[p].y.cmp(t[f].y.redNeg())?(m[1]=t[p].toJ().mixedAdd(t[f]),m[2]=t[p].add(t[f].neg())):(m[1]=t[p].toJ().mixedAdd(t[f]),m[2]=t[p].toJ().mixedAdd(t[f].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=c(n[p],n[f]);l=Math.max(v[0].length,l),u[p]=new Array(l),u[f]=new Array(l);for(var y=0;y<l;y++){var b=0|v[0][y],A=0|v[1][y];u[p][y]=g[3*(b+1)+(A+1)],u[f][y]=0,a[p]=m}}else u[p]=s(n[p],o[p]),u[f]=s(n[f],o[f]),l=Math.max(u[p].length,l),l=Math.max(u[f].length,l)}var _=this.jpoint(null,null,null),S=this._wnafT4;for(d=l;d>=0;d--){for(var I=0;d>=0;){var w=!0;for(y=0;y<r;y++)S[y]=0|u[y][d],0!==S[y]&&(w=!1);if(!w)break;I++,d--}if(d>=0&&I++,_=_.dblp(I),d<0)break;for(y=0;y<r;y++){var k,C=S[y];0!==C&&(C>0?k=a[y][C-1>>1]:C<0&&(k=a[y][-C-1>>1].neg()),_="affine"===k.type?_.mixedAdd(k):_.add(k))}}for(d=0;d<r;d++)a[d]=null;return i?_:_.toP()},r.BasePoint=i,i.prototype.eq=function(){throw new Error("Not implemented")},i.prototype.validate=function(){return this.curve.validate(this)},r.prototype.decodePoint=function(e,t){e=a.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?u(e[e.length-1]%2==0):7===e[0]&&u(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},i.prototype.encodeCompressed=function(e){return this.encode(e,!0)},i.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},i.prototype.encode=function(e,t){return a.encode(this._encode(t),e)},i.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},i.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},i.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)r=r.dbl();n.push(r)}return{step:e,points:n}},i.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},i.prototype._getBeta=function(){return null},i.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}},{"../../elliptic":1,"bn.js":16}],3:[function(e,t,n){"use strict";function r(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,u.call(this,"edwards",e),this.a=new s(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new s(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new s(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),l(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function i(e,t,n,r,i){u.BasePoint.call(this,e,"projective"),null===t&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new s(t,16),this.y=new s(n,16),this.z=r?new s(r,16):this.curve.one,this.t=i&&new s(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}var o=e("../curve"),a=e("../../elliptic"),s=e("bn.js"),c=e("inherits"),u=o.base,l=a.utils.assert;c(r,u),t.exports=r,r.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},r.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},r.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},r.prototype.pointFromX=function(e,t){(e=new s(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var c=a.fromRed().isOdd();return(t&&!c||!t&&c)&&(a=a.redNeg()),this.point(e,a)},r.prototype.pointFromY=function(e,t){(e=new s(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=n.redSub(this.one),i=n.redMul(this.d).redAdd(this.one),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},r.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return 0===r.cmp(i)},c(i,u.BasePoint),r.prototype.pointFromJSON=function(e){return i.fromJSON(this,e)},r.prototype.point=function(e,t,n,r){return new i(this,e,t,n,r)},i.fromJSON=function(e,t){return new i(e,t[0],t[1],t[2])},i.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},i.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},i.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),a=o.redSub(n),s=r.redSub(t),c=i.redMul(a),u=o.redMul(s),l=i.redMul(s),d=a.redMul(o);return this.curve.point(c,u,d,l)},i.prototype._projDbl=function(){var e,t,n,r=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=(u=this.curve._mulA(i)).redAdd(o);if(this.zOne)e=r.redSub(i).redSub(o).redMul(a.redSub(this.curve.two)),t=a.redMul(u.redSub(o)),n=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),c=a.redSub(s).redISub(s);e=r.redSub(i).redISub(o).redMul(c),t=a.redMul(u.redSub(o)),n=a.redMul(c)}}else{var u=i.redAdd(o);s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),c=u.redSub(s).redSub(s),e=this.curve._mulC(r.redISub(u)).redMul(c),t=this.curve._mulC(u).redMul(i.redISub(o)),n=u.redMul(c)}return this.curve.point(e,t,n)},i.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},i.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),a=i.redSub(r),s=i.redAdd(r),c=n.redAdd(t),u=o.redMul(a),l=s.redMul(c),d=o.redMul(c),h=a.redMul(s);return this.curve.point(u,l,h,d)},i.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),c=i.redSub(s),u=i.redAdd(s),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),d=r.redMul(c).redMul(l);return this.curve.twisted?(t=r.redMul(u).redMul(a.redSub(this.curve._mulA(o))),n=c.redMul(u)):(t=r.redMul(u).redMul(a.redSub(o)),n=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,n)},i.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},i.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},i.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},i.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},i.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},i.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},i.prototype.getY=function(){return this.normalize(),this.y.fromRed()},i.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},i.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}return!1},i.prototype.toP=i.prototype.normalize,i.prototype.mixedAdd=i.prototype.add},{"../../elliptic":1,"../curve":4,"bn.js":16,inherits:27}],4:[function(e,t,n){"use strict";var r=n;r.base=e("./base"),r.short=e("./short"),r.mont=e("./mont"),r.edwards=e("./edwards")},{"./base":2,"./edwards":3,"./mont":5,"./short":6}],5:[function(e,t,n){"use strict";function r(e){c.call(this,"mont",e),this.a=new a(e.a,16).toRed(this.red),this.b=new a(e.b,16).toRed(this.red),this.i4=new a(4).toRed(this.red).redInvm(),this.two=new a(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function i(e,t,n){c.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new a(t,16),this.z=new a(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var o=e("../curve"),a=e("bn.js"),s=e("inherits"),c=o.base,u=e("../../elliptic").utils;s(r,c),t.exports=r,r.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},s(i,c.BasePoint),r.prototype.decodePoint=function(e,t){return this.point(u.toArray(e,t),1)},r.prototype.point=function(e,t){return new i(this,e,t)},r.prototype.pointFromJSON=function(e){return i.fromJSON(this,e)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(e,t){return new i(e,t[0],t[1]||e.one)},i.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},i.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},i.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),a=i.redMul(r),s=t.z.redMul(o.redAdd(a).redSqr()),c=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,c)},i.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":1,"../curve":4,"bn.js":16,inherits:27}],6:[function(e,t,n){"use strict";function r(e){l.call(this,"short",e),this.a=new c(e.a,16).toRed(this.red),this.b=new c(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function i(e,t,n,r){l.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new c(t,16),this.y=new c(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function o(e,t,n,r){l.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new c(0)):(this.x=new c(t,16),this.y=new c(n,16),this.z=new c(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var a=e("../curve"),s=e("../../elliptic"),c=e("bn.js"),u=e("inherits"),l=a.base,d=s.utils.assert;u(r,l),t.exports=r,r.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new c(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new c(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],d(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map(function(e){return{a:new c(e.a,16),b:new c(e.b,16)}}):this._getEndoBasis(n)}}},r.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:c.mont(e),n=new c(2).toRed(t).redInvm(),r=n.redNeg(),i=new c(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},r.prototype._getEndoBasis=function(e){for(var t,n,r,i,o,a,s,u,l,d=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,p=this.n.clone(),f=new c(1),m=new c(0),g=new c(0),v=new c(1),y=0;0!==h.cmpn(0);){var b=p.div(h);u=p.sub(b.mul(h)),l=g.sub(b.mul(f));var A=v.sub(b.mul(m));if(!r&&u.cmp(d)<0)t=s.neg(),n=f,r=u.neg(),i=l;else if(r&&2==++y)break;s=u,p=h,h=u,g=f,f=l,v=m,m=A}o=u.neg(),a=l;var _=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(_)>=0&&(o=t,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},r.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),c=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},r.prototype.pointFromX=function(e,t){(e=new c(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},r.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},r.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(t[o]),s=e[o],c=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),c=c.neg(!0)),r[2*o]=s,r[2*o+1]=c,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var u=this._wnafMulAdd(1,r,i,2*o,n),l=0;l<2*o;l++)r[l]=null,i[l]=null;return u},u(i,l.BasePoint),r.prototype.point=function(e,t,n){return new i(this,e,t,n)},r.prototype.pointFromJSON=function(e,t){return i.fromJSON(this,e,t)},i.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},i.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},i.fromJSON=function(e,t,n){function r(t){return e.point(t[0],t[1],n)}"string"==typeof t&&(t=JSON.parse(t));var i=e.point(t[0],t[1],n);if(!t[2])return i;var o=t[2];return i.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[i].concat(o.doubles.points.map(r))},naf:o.naf&&{wnd:o.naf.wnd,points:[i].concat(o.naf.points.map(r))}},i},i.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},i.prototype.isInfinity=function(){return this.inf},i.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},i.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},i.prototype.getX=function(){return this.x.fromRed()},i.prototype.getY=function(){return this.y.fromRed()},i.prototype.mul=function(e){return e=new c(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},i.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},i.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},i.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},i.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},i.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},u(o,l.BasePoint),r.prototype.jpoint=function(e,t,n){return new o(this,e,t,n)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),d=r.redMul(u),h=c.redSqr().redIAdd(l).redISub(d).redISub(d),p=c.redMul(d.redISub(h)).redISub(o.redMul(l)),f=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(h,p,f)},o.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=n.redMul(c),d=s.redSqr().redIAdd(u).redISub(l).redISub(l),h=s.redMul(l.redISub(d)).redISub(i.redMul(u)),p=this.z.redMul(a);return this.curve.jpoint(d,h,p)},o.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,c=s.redSqr().redSqr(),u=a.redAdd(a);for(n=0;n<e;n++){var l=o.redSqr(),d=u.redSqr(),h=d.redSqr(),p=l.redAdd(l).redIAdd(l).redIAdd(r.redMul(c)),f=o.redMul(d),m=p.redSqr().redISub(f.redAdd(f)),g=f.redISub(m),v=p.redMul(g);v=v.redIAdd(v).redISub(h);var y=u.redMul(s);n+1<e&&(c=c.redMul(h)),o=m,s=y,u=v}return this.curve.jpoint(o,u.redMul(i),s)},o.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},o.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),c=s.redSqr().redISub(a).redISub(a),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=s.redMul(a.redISub(c)).redISub(u),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),p=this.x.redAdd(d).redSqr().redISub(l).redISub(h);p=p.redIAdd(p);var f=l.redAdd(l).redIAdd(l),m=f.redSqr(),g=h.redIAdd(h);g=(g=g.redIAdd(g)).redIAdd(g),e=m.redISub(p).redISub(p),t=f.redMul(p.redISub(e)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(e,t,n)},o.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),c=s.redSqr().redISub(a).redISub(a);e=c;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=s.redMul(a.redISub(c)).redISub(u),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),p=this.x.redSub(l).redMul(this.x.redAdd(l));p=p.redAdd(p).redIAdd(p);var f=h.redIAdd(h),m=(f=f.redIAdd(f)).redAdd(f);e=p.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var g=d.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=p.redMul(f.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,n)},o.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=t.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(a),l=s.redSqr().redISub(u.redAdd(u)),d=u.redISub(l),h=a.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var p=s.redMul(d).redISub(h),f=n.redAdd(n).redMul(r);return this.curve.jpoint(l,p,f)},o.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),c=r.redIAdd(r);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(s).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var h=this.y.redMul(u.redMul(c.redISub(u)).redISub(a.redMul(s)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var p=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(d,h,p)},o.prototype.mul=function(e,t){return e=new c(e,t),this.curve._wnafMul(this,e)},o.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(0!==this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0))return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)},o.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(n))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}return!1},o.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},o.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":1,"../curve":4,"bn.js":16,inherits:27}],7:[function(e,t,n){"use strict";function r(e){"short"===e.type?this.curve=new c.curve.short(e):"edwards"===e.type?this.curve=new c.curve.edwards(e):this.curve=new c.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,u(this.g.validate(),"Invalid curve"),u(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function i(e,t){Object.defineProperty(a,e,{configurable:!0,enumerable:!0,get:function(){var n=new r(t);return Object.defineProperty(a,e,{configurable:!0,enumerable:!0,value:n}),n}})}var o,a=n,s=e("hash.js"),c=e("../elliptic"),u=c.utils.assert;a.PresetCurve=r,i("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:s.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),i("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:s.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),i("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:s.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),i("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:s.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),i("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:s.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),i("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["9"]}),i("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{o=e("./precomputed/secp256k1")}catch(e){o=void 0}i("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:s.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})},{"../elliptic":1,"./precomputed/secp256k1":14,"hash.js":19}],8:[function(e,t,n){"use strict";function r(e){return this instanceof r?("string"==typeof e&&(s(a.curves.hasOwnProperty(e),"Unknown curve "+e),e=a.curves[e]),e instanceof a.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),void(this.hash=e.hash||e.curve.hash)):new r(e)}var i=e("bn.js"),o=e("hmac-drbg"),a=e("../../elliptic"),s=a.utils.assert,c=e("./key"),u=e("./signature");t.exports=r,r.prototype.keyPair=function(e){return new c(this,e)},r.prototype.keyFromPrivate=function(e,t){return c.fromPrivate(this,e,t)},r.prototype.keyFromPublic=function(e,t){return c.fromPublic(this,e,t)},r.prototype.genKeyPair=function(e){e||(e={});for(var t=new o({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new i(2));;){var s=new i(t.generate(n));if(!(s.cmp(r)>0))return s.iaddn(1),this.keyFromPrivate(s)}},r.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},r.prototype.sign=function(e,t,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new i(e,16));for(var a=this.n.byteLength(),s=t.getPrivate().toArray("be",a),c=e.toArray("be",a),l=new o({hash:this.hash,entropy:s,nonce:c,pers:r.pers,persEnc:r.persEnc||"utf8"}),d=this.n.sub(new i(1)),h=0;;h++){var p=r.k?r.k(h):new i(l.generate(this.n.byteLength()));if(!((p=this._truncateToN(p,!0)).cmpn(1)<=0||p.cmp(d)>=0)){var f=this.g.mul(p);if(!f.isInfinity()){var m=f.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var v=p.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));if(0!==(v=v.umod(this.n)).cmpn(0)){var y=(f.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return r.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),y^=1),new u({r:g,s:v,recoveryParam:y})}}}}}},r.prototype.verify=function(e,t,n,r){e=this._truncateToN(new i(e,16)),n=this.keyFromPublic(n,r);var o=(t=new u(t,"hex")).r,a=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,c=a.invm(this.n),l=c.mul(e).umod(this.n),d=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(l,n.getPublic(),d)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(l,n.getPublic(),d)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},r.prototype.recoverPubKey=function(e,t,n,r){s((3&n)===n,"The recovery param is more than two bits"),t=new u(t,r);var o=this.n,a=new i(e),c=t.r,l=t.s,d=1&n,h=n>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");c=h?this.curve.pointFromX(c.add(this.curve.n),d):this.curve.pointFromX(c,d);var p=t.r.invm(o),f=o.sub(a).mul(p).umod(o),m=l.mul(p).umod(o);return this.g.mulAdd(f,c,m)},r.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new u(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":1,"./key":9,"./signature":10,"bn.js":16,"hmac-drbg":25}],9:[function(e,t,n){"use strict";function r(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var i=e("bn.js"),o=e("../../elliptic").utils.assert;t.exports=r,r.fromPublic=function(e,t,n){return t instanceof r?t:new r(e,{pub:t,pubEnc:n})},r.fromPrivate=function(e,t,n){return t instanceof r?t:new r(e,{priv:t,privEnc:n})},r.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},r.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},r.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},r.prototype._importPrivate=function(e,t){this.priv=new i(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},r.prototype._importPublic=function(e,t){return e.x||e.y?("mont"===this.ec.curve.type?o(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||o(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y))):void(this.pub=this.ec.curve.decodePoint(e,t))},r.prototype.derive=function(e){return e.mul(this.priv).getX()},r.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},r.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},r.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},{"../../elliptic":1,"bn.js":16}],10:[function(e,t,n){"use strict";function r(e,t){return e instanceof r?e:void(this._importDER(e,t)||(u(e.r&&e.s,"Signature without r or s"),this.r=new s(e.r,16),this.s=new s(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam))}function i(e,t){var n=e[t.place++];if(!(128&n))return n;for(var r=15&n,i=0,o=0,a=t.place;o<r;o++,a++)i<<=8,i|=e[a];return t.place=a,i}function o(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t<n;)t++;return 0===t?e:e.slice(t)}function a(e,t){if(t<128)e.push(t);else{var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}var s=e("bn.js"),c=e("../../elliptic").utils,u=c.assert;t.exports=r,r.prototype._importDER=function(e,t){e=c.toArray(e,t);var n=new function(){this.place=0};if(48!==e[n.place++])return!1;if(i(e,n)+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var r=i(e,n),o=e.slice(n.place,r+n.place);if(n.place+=r,2!==e[n.place++])return!1;var a=i(e,n);if(e.length!==a+n.place)return!1;var u=e.slice(n.place,a+n.place);return 0===o[0]&&128&o[1]&&(o=o.slice(1)),0===u[0]&&128&u[1]&&(u=u.slice(1)),this.r=new s(o),this.s=new s(u),this.recoveryParam=null,!0},r.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=o(t),n=o(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];a(r,t.length),(r=r.concat(t)).push(2),a(r,n.length);var i=r.concat(n),s=[48];return a(s,i.length),s=s.concat(i),c.encode(s,e)}},{"../../elliptic":1,"bn.js":16}],11:[function(e,t,n){"use strict";function r(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof r))return new r(e);e=o.curves[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=i.sha512}var i=e("hash.js"),o=e("../../elliptic"),a=o.utils,s=a.assert,c=a.parseBytes,u=e("./key"),l=e("./signature");t.exports=r,r.prototype.sign=function(e,t){e=c(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),s=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},r.prototype.verify=function(e,t,n){e=c(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},r.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return a.intFromLE(e.digest()).umod(this.curve.n)},r.prototype.keyFromPublic=function(e){return u.fromPublic(this,e)},r.prototype.keyFromSecret=function(e){return u.fromSecret(this,e)},r.prototype.makeSignature=function(e){return e instanceof l?e:new l(this,e)},r.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},r.prototype.decodePoint=function(e){var t=(e=a.parseBytes(e)).length-1,n=e.slice(0,t).concat(-129&e[t]),r=0!=(128&e[t]),i=a.intFromLE(n);return this.curve.pointFromY(i,r)},r.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},r.prototype.decodeInt=function(e){return a.intFromLE(e)},r.prototype.isPoint=function(e){return e instanceof this.pointClass}},{"../../elliptic":1,"./key":12,"./signature":13,"hash.js":19}],12:[function(e,t,n){"use strict";function r(e,t){this.eddsa=e,this._secret=a(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=a(t.pub)}var i=e("../../elliptic").utils,o=i.assert,a=i.parseBytes,s=i.cachedProperty;r.fromPublic=function(e,t){return t instanceof r?t:new r(e,{pub:t})},r.fromSecret=function(e,t){return t instanceof r?t:new r(e,{secret:t})},r.prototype.secret=function(){return this._secret},s(r,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),s(r,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),s(r,"privBytes",function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),s(r,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),s(r,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),s(r,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),r.prototype.sign=function(e){return o(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},r.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},r.prototype.getSecret=function(e){return o(this._secret,"KeyPair is public only"),i.encode(this.secret(),e)},r.prototype.getPublic=function(e){return i.encode(this.pubBytes(),e)},t.exports=r},{"../../elliptic":1}],13:[function(e,t,n){"use strict";function r(e,t){this.eddsa=e,"object"!=typeof t&&(t=c(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),a(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof i&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}var i=e("bn.js"),o=e("../../elliptic").utils,a=o.assert,s=o.cachedProperty,c=o.parseBytes;s(r,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),s(r,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),s(r,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),s(r,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),r.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},r.prototype.toHex=function(){return o.encode(this.toBytes(),"hex").toUpperCase()},t.exports=r},{"../../elliptic":1,"bn.js":16}],14:[function(e,t,n){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},{}],15:[function(e,t,n){"use strict";var r=n,i=e("bn.js"),o=e("minimalistic-assert"),a=e("minimalistic-crypto-utils");r.assert=o,r.toArray=a.toArray,r.zero2=a.zero2,r.toHex=a.toHex,r.encode=a.encode,r.getNAF=function(e,t){for(var n=[],r=1<<t+1,i=e.clone();i.cmpn(1)>=0;){var o;if(i.isOdd()){var a=i.andln(r-1);o=a>(r>>1)-1?(r>>1)-a:a,i.isubn(o)}else o=0;n.push(o);for(var s=0!==i.cmpn(0)&&0===i.andln(r-1)?t+1:1,c=1;c<s;c++)n.push(0);i.iushrn(s)}return n},r.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r=0,i=0;e.cmpn(-r)>0||t.cmpn(-i)>0;){var o,a,s,c=e.andln(3)+r&3,u=t.andln(3)+i&3;3===c&&(c=-1),3===u&&(u=-1),o=0==(1&c)?0:3!=(s=e.andln(7)+r&7)&&5!==s||2!==u?c:-c,n[0].push(o),a=0==(1&u)?0:3!=(s=t.andln(7)+i&7)&&5!==s||2!==c?u:-u,n[1].push(a),2*r===o+1&&(r=1-r),2*i===a+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return n},r.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new i(e,"hex","le")}},{"bn.js":16,"minimalistic-assert":28,"minimalistic-crypto-utils":29}],16:[function(e,t,n){!function(t,n){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){return o.isBN(e)?e:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))))}function a(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o<i;o++){var a=e.charCodeAt(o)-48;r<<=4,r|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return r}function s(e,t,n,r){for(var i=0,o=Math.min(e.length,n),a=t;a<o;a++){var s=e.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}function c(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,c=a/67108864|0;n.words[0]=s;for(var u=1;u<r;u++){for(var l=c>>>26,d=67108863&c,h=Math.min(u,t.length-1),p=Math.max(0,u-e.length+1);p<=h;p++){var f=u-p|0;l+=(a=(i=0|e.words[f])*(o=0|t.words[p])+d)/67108864|0,d=67108863&a}n.words[u]=0|d,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n.strip()}function u(e,t,n){return(new l).mulp(e,t,n)}function l(e,t){this.x=e,this.y=t}function d(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function f(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function g(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function v(e){g.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var y;"object"==typeof t?t.exports=o:n.BN=o,o.BN=o,o.wordSize=26;try{y=e("buffer").Buffer}catch(e){}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,o=0;for(n=e.length-6,r=0;n>=t;n-=6)i=a(e,n,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==t&&(i=a(e,t,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,c=Math.min(o,o-a)+n,u=0,l=n;l<c;l+=r)u=s(e,l,l+r,t),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=s(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var b=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],A=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var n;if(e=e||10,t=0|t||1,16===e||"hex"===e){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<i|o)).toString(16);n=0!=(o=s>>>24-i&16777215)||a!==this.length-1?b[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=A[e],l=_[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var h=d.modn(l).toString(e);n=(d=d.idivn(l)).isZero()?h+n:b[u-h.length]+h+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r(void 0!==y),this.toArrayLike(y,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(o),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<o;s++)u[s]=0}else{for(s=0;s<o-i;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[o-s-1]=a}return u},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var S=function(e,t,n){var r,i,o,a=e.words,s=t.words,c=n.words,u=0,l=0|a[0],d=8191&l,h=l>>>13,p=0|a[1],f=8191&p,m=p>>>13,g=0|a[2],v=8191&g,y=g>>>13,b=0|a[3],A=8191&b,_=b>>>13,S=0|a[4],I=8191&S,w=S>>>13,k=0|a[5],C=8191&k,E=k>>>13,P=0|a[6],T=8191&P,R=P>>>13,D=0|a[7],x=8191&D,L=D>>>13,M=0|a[8],F=8191&M,O=M>>>13,N=0|a[9],H=8191&N,B=N>>>13,U=0|s[0],q=8191&U,K=U>>>13,$=0|s[1],j=8191&$,V=$>>>13,W=0|s[2],G=8191&W,z=W>>>13,Q=0|s[3],X=8191&Q,J=Q>>>13,Y=0|s[4],Z=8191&Y,ee=Y>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,he=le>>>13,pe=0|s[9],fe=8191&pe,me=pe>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(u+(r=Math.imul(d,q))|0)+((8191&(i=(i=Math.imul(d,K))+Math.imul(h,q)|0))<<13)|0;u=((o=Math.imul(h,K))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(f,q),i=(i=Math.imul(f,K))+Math.imul(m,q)|0,o=Math.imul(m,K);var ve=(u+(r=r+Math.imul(d,j)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(h,j)|0))<<13)|0;u=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,q),i=(i=Math.imul(v,K))+Math.imul(y,q)|0,o=Math.imul(y,K),r=r+Math.imul(f,j)|0,i=(i=i+Math.imul(f,V)|0)+Math.imul(m,j)|0,o=o+Math.imul(m,V)|0;var ye=(u+(r=r+Math.imul(d,G)|0)|0)+((8191&(i=(i=i+Math.imul(d,z)|0)+Math.imul(h,G)|0))<<13)|0;u=((o=o+Math.imul(h,z)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(A,q),i=(i=Math.imul(A,K))+Math.imul(_,q)|0,o=Math.imul(_,K),r=r+Math.imul(v,j)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(y,j)|0,o=o+Math.imul(y,V)|0,r=r+Math.imul(f,G)|0,i=(i=i+Math.imul(f,z)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,z)|0;var be=(u+(r=r+Math.imul(d,X)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(h,X)|0))<<13)|0;u=((o=o+Math.imul(h,J)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(I,q),i=(i=Math.imul(I,K))+Math.imul(w,q)|0,o=Math.imul(w,K),r=r+Math.imul(A,j)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(_,j)|0,o=o+Math.imul(_,V)|0,r=r+Math.imul(v,G)|0,i=(i=i+Math.imul(v,z)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,z)|0,r=r+Math.imul(f,X)|0,i=(i=i+Math.imul(f,J)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,J)|0;var Ae=(u+(r=r+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(h,Z)|0))<<13)|0;u=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(C,q),i=(i=Math.imul(C,K))+Math.imul(E,q)|0,o=Math.imul(E,K),r=r+Math.imul(I,j)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(w,j)|0,o=o+Math.imul(w,V)|0,r=r+Math.imul(A,G)|0,i=(i=i+Math.imul(A,z)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,z)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(f,Z)|0,i=(i=i+Math.imul(f,ee)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,ee)|0;var _e=(u+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(h,ne)|0))<<13)|0;u=((o=o+Math.imul(h,re)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(T,q),i=(i=Math.imul(T,K))+Math.imul(R,q)|0,o=Math.imul(R,K),r=r+Math.imul(C,j)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(E,j)|0,o=o+Math.imul(E,V)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,z)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,z)|0,r=r+Math.imul(A,X)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,J)|0,r=r+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(f,ne)|0,i=(i=i+Math.imul(f,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var Se=(u+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(h,oe)|0))<<13)|0;u=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(x,q),i=(i=Math.imul(x,K))+Math.imul(L,q)|0,o=Math.imul(L,K),r=r+Math.imul(T,j)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(R,j)|0,o=o+Math.imul(R,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,z)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,z)|0,r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,J)|0,r=r+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(f,oe)|0,i=(i=i+Math.imul(f,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var Ie=(u+(r=r+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(h,ce)|0))<<13)|0;u=((o=o+Math.imul(h,ue)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(F,q),i=(i=Math.imul(F,K))+Math.imul(O,q)|0,o=Math.imul(O,K),r=r+Math.imul(x,j)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(L,j)|0,o=o+Math.imul(L,V)|0,r=r+Math.imul(T,G)|0,i=(i=i+Math.imul(T,z)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,z)|0,r=r+Math.imul(C,X)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,J)|0,r=r+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,ee)|0,r=r+Math.imul(A,ne)|0,i=(i=i+Math.imul(A,re)|0)+Math.imul(_,ne)|0,o=o+Math.imul(_,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,r=r+Math.imul(f,ce)|0,i=(i=i+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0;var we=(u+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,he)|0)+Math.imul(h,de)|0))<<13)|0;u=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(H,q),i=(i=Math.imul(H,K))+Math.imul(B,q)|0,o=Math.imul(B,K),r=r+Math.imul(F,j)|0,i=(i=i+Math.imul(F,V)|0)+Math.imul(O,j)|0,o=o+Math.imul(O,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,z)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,z)|0,r=r+Math.imul(T,X)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,J)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(w,ne)|0,o=o+Math.imul(w,re)|0,r=r+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,r=r+Math.imul(v,ce)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,r=r+Math.imul(f,de)|0,i=(i=i+Math.imul(f,he)|0)+Math.imul(m,de)|0,o=o+Math.imul(m,he)|0;var ke=(u+(r=r+Math.imul(d,fe)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(h,fe)|0))<<13)|0;u=((o=o+Math.imul(h,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(H,j),i=(i=Math.imul(H,V))+Math.imul(B,j)|0,o=Math.imul(B,V),r=r+Math.imul(F,G)|0,i=(i=i+Math.imul(F,z)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,z)|0,r=r+Math.imul(x,X)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,J)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(E,ne)|0,o=o+Math.imul(E,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,ae)|0,r=r+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(_,ce)|0,o=o+Math.imul(_,ue)|0,r=r+Math.imul(v,de)|0,i=(i=i+Math.imul(v,he)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,he)|0;var Ce=(u+(r=r+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(H,G),i=(i=Math.imul(H,z))+Math.imul(B,G)|0,o=Math.imul(B,z),r=r+Math.imul(F,X)|0,i=(i=i+Math.imul(F,J)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,J)|0,r=r+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,ae)|0,r=r+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(w,ce)|0,o=o+Math.imul(w,ue)|0,r=r+Math.imul(A,de)|0,i=(i=i+Math.imul(A,he)|0)+Math.imul(_,de)|0,o=o+Math.imul(_,he)|0;var Ee=(u+(r=r+Math.imul(v,fe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,fe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(H,X),i=(i=Math.imul(H,J))+Math.imul(B,X)|0,o=Math.imul(B,J),r=r+Math.imul(F,Z)|0,i=(i=i+Math.imul(F,ee)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(x,ne)|0,i=(i=i+Math.imul(x,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,ae)|0,r=r+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,r=r+Math.imul(I,de)|0,i=(i=i+Math.imul(I,he)|0)+Math.imul(w,de)|0,o=o+Math.imul(w,he)|0;var Pe=(u+(r=r+Math.imul(A,fe)|0)|0)+((8191&(i=(i=i+Math.imul(A,me)|0)+Math.imul(_,fe)|0))<<13)|0;u=((o=o+Math.imul(_,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(H,Z),i=(i=Math.imul(H,ee))+Math.imul(B,Z)|0,o=Math.imul(B,ee),r=r+Math.imul(F,ne)|0,i=(i=i+Math.imul(F,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,ae)|0,r=r+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,he)|0)+Math.imul(E,de)|0,o=o+Math.imul(E,he)|0;var Te=(u+(r=r+Math.imul(I,fe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(w,fe)|0))<<13)|0;u=((o=o+Math.imul(w,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(H,ne),i=(i=Math.imul(H,re))+Math.imul(B,ne)|0,o=Math.imul(B,re),r=r+Math.imul(F,oe)|0,i=(i=i+Math.imul(F,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,r=r+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,r=r+Math.imul(T,de)|0,i=(i=i+Math.imul(T,he)|0)+Math.imul(R,de)|0,o=o+Math.imul(R,he)|0;var Re=(u+(r=r+Math.imul(C,fe)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(E,fe)|0))<<13)|0;u=((o=o+Math.imul(E,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(H,oe),i=(i=Math.imul(H,ae))+Math.imul(B,oe)|0,o=Math.imul(B,ae),r=r+Math.imul(F,ce)|0,i=(i=i+Math.imul(F,ue)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,ue)|0,r=r+Math.imul(x,de)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,he)|0;var De=(u+(r=r+Math.imul(T,fe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((o=o+Math.imul(R,me)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863,r=Math.imul(H,ce),i=(i=Math.imul(H,ue))+Math.imul(B,ce)|0,o=Math.imul(B,ue),r=r+Math.imul(F,de)|0,i=(i=i+Math.imul(F,he)|0)+Math.imul(O,de)|0,o=o+Math.imul(O,he)|0;var xe=(u+(r=r+Math.imul(x,fe)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(L,fe)|0))<<13)|0;u=((o=o+Math.imul(L,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(H,de),i=(i=Math.imul(H,he))+Math.imul(B,de)|0,o=Math.imul(B,he);var Le=(u+(r=r+Math.imul(F,fe)|0)|0)+((8191&(i=(i=i+Math.imul(F,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Me=(u+(r=Math.imul(H,fe))|0)+((8191&(i=(i=Math.imul(H,me))+Math.imul(B,fe)|0))<<13)|0;return u=((o=Math.imul(B,me))+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,c[0]=ge,c[1]=ve,c[2]=ye,c[3]=be,c[4]=Ae,c[5]=_e,c[6]=Se,c[7]=Ie,c[8]=we,c[9]=ke,c[10]=Ce,c[11]=Ee,c[12]=Pe,c[13]=Te,c[14]=Re,c[15]=De,c[16]=xe,c[17]=Le,c[18]=Me,0!==u&&(c[19]=u,n.length++),n};Math.imul||(S=c),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?S(this,e,t):n<63?c(this,e,t):n<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,c=Math.min(o,t.length-1),u=Math.max(0,o-e.length+1);u<=c;u++){var l=o-u,d=(0|e.words[l])*(0|t.words[u]),h=67108863&d;s=67108863&(h=h+s|0),i+=(a=(a=a+(d/67108864|0)|0)+(h>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):u(this,e,t)},l.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},l.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},l.prototype.permute=function(e,t,n,r,i,o){for(var a=0;a<o;a++)r[a]=t[e[a]],i[a]=n[e[a]]},l.prototype.transform=function(e,t,n,r,i,o){this.permute(o,e,t,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var d=c,h=u,p=0;p<a;p++){var f=n[l+p],m=r[l+p],g=n[l+p+a],v=r[l+p+a],y=d*g-h*v;v=d*v+h*g,g=y,n[l+p]=f+g,r[l+p]=m+v,n[l+p+a]=f-g,r[l+p+a]=m-v,p!==s&&(y=c*d-u*h,h=c*h+u*d,d=y)}},l.prototype.guessLen13b=function(e,t){var n=1|Math.max(t,e),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},l.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},l.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=8192*Math.round(e[2*r+1]/t)+Math.round(e[2*r]/t)+n;e[r]=67108863&i,n=i<67108864?0:i/67108864|0}return e},l.prototype.convert13b=function(e,t,n,i){for(var o=0,a=0;a<t;a++)o+=0|e[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},l.prototype.stub=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=0;return t},l.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),c=new Array(r),u=new Array(r),l=new Array(r),d=new Array(r),h=n.words;h.length=r,this.convert13b(e.words,e.length,a,r),this.convert13b(t.words,t.length,u,r),this.transform(a,o,s,c,r,i),this.transform(u,o,l,d,r,i);for(var p=0;p<r;p++){var f=s[p]*l[p]-c[p]*d[p];c[p]=s[p]*d[p]+c[p]*l[p],s[p]=f}return this.conjugate(s,c,r),this.transform(s,c,h,o,r,i),this.conjugate(h,o,r),this.normalize13b(h,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),u(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,c=(0|this.words[t])-s<<n;this.words[t]=c|a,a=s>>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,c=n;if(i-=a,i=Math.max(0,i),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=i);u--){var d=0|this.words[u];this.words[u]=l<<26-o|d>>>o,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n||!(this.words[n]&i))},o.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,n){var i,o=e.length+n;this._expand(o);var a,s=0;for(i=0;i<e.length;i++){a=(0|this.words[i+n])+s;var c=(0|e.words[i])*t;s=((a-=67108863&c)>>26)-(c/67108864|0),this.words[i+n]=67108863&a}for(;i<this.length-n;i++)s=(a=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&a;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(a=-(0|this.words[i])+s)>>26,this.words[i]=67108863&a;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,a=0|i.words[i.length-1];0!=(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,c=r.length-i.length;if("mod"!==t){(s=new o(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=r.clone()._ishlnsubmul(i,1,c);0===l.negative&&(r=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var h=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(h=Math.min(h/a|0,67108863),r._ishlnsubmul(i,h,d);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=h)}return s&&s.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var h=0,p=1;0==(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;0==(n.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(n.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(s),a.isub(c)):(n.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,i=e.clone();n=0!==n.negative?n.umod(e):n.clone();for(var a=new o(1),s=new o(0),c=i.clone();n.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(n.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(n.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,h=1;0==(i.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(i.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);n.cmp(i)>=0?(n.isub(i),a.isub(s)):(i.isub(n),s.isub(a))}return(t=0===n.cmpn(1)?a:s).cmpn(0)<0&&t.iadd(e),t},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new g(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var I={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},d.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n.strip(),n},d.prototype.split=function(e,t){e.iushrn(this.n,0,t)},d.prototype.imulK=function(e){return e.imul(this.k)},i(h,d),h.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},h.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(p,d),i(f,d),i(m,d),m.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(I[e])return I[e];var t;if("k256"===e)t=new h;else if("p224"===e)t=new p;else if("p192"===e)t=new f;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new m}return I[e]=t,t},g.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},g.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},g.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},g.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},g.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},g.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},g.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},g.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},g.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},g.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},g.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},g.prototype.isqr=function(e){return this.imul(e,e.clone())},g.prototype.sqr=function(e){return this.mul(e,e)},g.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),h=this.pow(e,i.addn(1).iushrn(1)),p=this.pow(e,i),f=a;0!==p.cmp(s);){for(var m=p,g=0;0!==m.cmp(s);g++)m=m.redSqr();r(g<f);var v=this.pow(d,new o(1).iushln(f-g-1));h=h.redMul(v),d=v.redSqr(),p=p.redMul(d),f=g}return h},g.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},g.prototype.pow=function(e,t){if(t.isZero())return new o(1);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),r=t.length-1;r>=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var d=u>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}c=26}return i},g.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},g.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new v(e)},i(v,g),v.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},v.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},v.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},v.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},v.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{}],17:[function(e,t,n){function r(e){this.rand=e}var i;if(t.exports=function(e){return i||(i=new r(null)),i.generate(e)},t.exports.Rand=r,r.prototype.generate=function(e){return this._rand(e)},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?r.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?r.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:r.prototype._rand=function(){throw new Error("Not implemented yet")};else try{var o=e("crypto");r.prototype._rand=function(e){return o.randomBytes(e)}}catch(e){r.prototype._rand=function(e){for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t}}},{crypto:18}],18:[function(e,t,n){},{}],19:[function(e,t,n){var r=n;r.utils=e("./hash/utils"),r.common=e("./hash/common"),r.sha=e("./hash/sha"),r.ripemd=e("./hash/ripemd"),r.hmac=e("./hash/hmac"),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},{"./hash/common":20,"./hash/hmac":21,"./hash/ripemd":22,"./hash/sha":23,"./hash/utils":24}],20:[function(e,t,n){function r(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var i=e("../hash").utils,o=i.assert;n.BlockHash=r,r.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},r.prototype.digest=function(e){return this.update(this._pad()),o(null===this.pending),this._digest(e)},r.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=e>>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r}},{"../hash":19}],21:[function(e,t,n){function r(e,t,n){return this instanceof r?(this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,void this._init(i.toArray(t,n))):new r(e,t,n)}var i=e("../hash").utils,o=i.assert;t.exports=r,r.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),o(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},r.prototype.update=function(e,t){return this.inner.update(e,t),this},r.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},{"../hash":19}],22:[function(e,t,n){function r(){return this instanceof r?(p.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],void(this.endian="little")):new r}function i(e,t,n,r){return e<=15?t^n^r:e<=31?t&n|~t&r:e<=47?(t|~n)^r:e<=63?t&r|n&~r:t^(n|~r)}function o(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function a(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var s=e("../hash"),c=s.utils,u=c.rotl32,l=c.sum32,d=c.sum32_3,h=c.sum32_4,p=s.common.BlockHash;c.inherits(r,p),n.ripemd160=r,r.blockSize=512,r.outSize=160,r.hmacStrength=192,r.padLength=64,r.prototype._update=function(e,t){for(var n=this.h[0],r=this.h[1],s=this.h[2],c=this.h[3],p=this.h[4],y=n,b=r,A=s,_=c,S=p,I=0;I<80;I++){var w=l(u(h(n,i(I,r,s,c),e[f[I]+t],o(I)),g[I]),p);n=p,p=c,c=u(s,10),s=r,r=w,w=l(u(h(y,i(79-I,b,A,_),e[m[I]+t],a(I)),v[I]),S),y=S,S=_,_=u(A,10),A=b,b=w}w=d(this.h[1],s,_),this.h[1]=d(this.h[2],c,S),this.h[2]=d(this.h[3],p,y),this.h[3]=d(this.h[4],n,b),this.h[4]=d(this.h[0],r,A),this.h[0]=w},r.prototype._digest=function(e){return"hex"===e?c.toHex32(this.h,"little"):c.split32(this.h,"little")};var f=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],m=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],v=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"../hash":19}],23:[function(e,t,n){function r(){return this instanceof r?(W.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=G,void(this.W=new Array(64))):new r}function i(){return this instanceof i?(r.call(this),void(this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])):new i}function o(){return this instanceof o?(W.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=z,void(this.W=new Array(160))):new o}function a(){return this instanceof a?(o.call(this),void(this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428])):new a}function s(){return this instanceof s?(W.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],void(this.W=new Array(80))):new s}function c(e,t,n){return e&t^~e&n}function u(e,t,n){return e&t^e&n^t&n}function l(e){return R(e,2)^R(e,13)^R(e,22)}function d(e){return R(e,6)^R(e,11)^R(e,25)}function h(e){return R(e,7)^R(e,18)^e>>>3}function p(e){return R(e,17)^R(e,19)^e>>>10}function f(e,t,n,r){return 0===e?c(t,n,r):1===e||3===e?function(e,t,n){return e^t^n}(t,n,r):2===e?u(t,n,r):void 0}function m(e,t,n,r,i,o){var a=e&n^~e&i;return a<0&&(a+=4294967296),a}function g(e,t,n,r,i,o){var a=t&r^~t&o;return a<0&&(a+=4294967296),a}function v(e,t,n,r,i,o){var a=e&n^e&i^n&i;return a<0&&(a+=4294967296),a}function y(e,t,n,r,i,o){var a=t&r^t&o^r&o;return a<0&&(a+=4294967296),a}function b(e,t){var n=F(e,t,28)^F(t,e,2)^F(t,e,7);return n<0&&(n+=4294967296),n}function A(e,t){var n=O(e,t,28)^O(t,e,2)^O(t,e,7);return n<0&&(n+=4294967296),n}function _(e,t){var n=F(e,t,14)^F(e,t,18)^F(t,e,9);return n<0&&(n+=4294967296),n}function S(e,t){var n=O(e,t,14)^O(e,t,18)^O(t,e,9);return n<0&&(n+=4294967296),n}function I(e,t){var n=F(e,t,1)^F(e,t,8)^N(e,t,7);return n<0&&(n+=4294967296),n}function w(e,t){var n=O(e,t,1)^O(e,t,8)^H(e,t,7);return n<0&&(n+=4294967296),n}function k(e,t){var n=F(e,t,19)^F(t,e,29)^N(e,t,6);return n<0&&(n+=4294967296),n}function C(e,t){var n=O(e,t,19)^O(t,e,29)^H(e,t,6);return n<0&&(n+=4294967296),n}var E=e("../hash"),P=E.utils,T=P.assert,R=P.rotr32,D=P.rotl32,x=P.sum32,L=P.sum32_4,M=P.sum32_5,F=P.rotr64_hi,O=P.rotr64_lo,N=P.shr64_hi,H=P.shr64_lo,B=P.sum64,U=P.sum64_hi,q=P.sum64_lo,K=P.sum64_4_hi,$=P.sum64_4_lo,j=P.sum64_5_hi,V=P.sum64_5_lo,W=E.common.BlockHash,G=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],z=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Q=[1518500249,1859775393,2400959708,3395469782];P.inherits(r,W),n.sha256=r,r.blockSize=512,r.outSize=256,r.hmacStrength=192,r.padLength=64,r.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=L(p(n[r-2]),n[r-7],h(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],f=this.h[4],m=this.h[5],g=this.h[6],v=this.h[7];for(T(this.k.length===n.length),r=0;r<n.length;r++){var y=M(v,d(f),c(f,m,g),this.k[r],n[r]),b=x(l(i),u(i,o,a));v=g,g=m,m=f,f=x(s,y),s=a,a=o,o=i,i=x(y,b)}this.h[0]=x(this.h[0],i),this.h[1]=x(this.h[1],o),this.h[2]=x(this.h[2],a),this.h[3]=x(this.h[3],s),this.h[4]=x(this.h[4],f),this.h[5]=x(this.h[5],m),this.h[6]=x(this.h[6],g),this.h[7]=x(this.h[7],v)},r.prototype._digest=function(e){return"hex"===e?P.toHex32(this.h,"big"):P.split32(this.h,"big")},P.inherits(i,r),n.sha224=i,i.blockSize=512,i.outSize=224,i.hmacStrength=192,i.padLength=64,i.prototype._digest=function(e){return"hex"===e?P.toHex32(this.h.slice(0,7),"big"):P.split32(this.h.slice(0,7),"big")},P.inherits(o,W),n.sha512=o,o.blockSize=1024,o.outSize=512,o.hmacStrength=192,o.padLength=128,o.prototype._prepareBlock=function(e,t){for(var n=this.W,r=0;r<32;r++)n[r]=e[t+r];for(;r<n.length;r+=2){var i=k(n[r-4],n[r-3]),o=C(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],c=I(n[r-30],n[r-29]),u=w(n[r-30],n[r-29]),l=n[r-32],d=n[r-31];n[r]=K(i,o,a,s,c,u,l,d),n[r+1]=$(i,o,a,s,c,u,l,d)}},o.prototype._update=function(e,t){this._prepareBlock(e,t);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],c=this.h[5],u=this.h[6],l=this.h[7],d=this.h[8],h=this.h[9],p=this.h[10],f=this.h[11],I=this.h[12],w=this.h[13],k=this.h[14],C=this.h[15];T(this.k.length===n.length);for(var E=0;E<n.length;E+=2){var P=k,R=C,D=_(d,h),x=S(d,h),L=m(d,0,p,0,I),M=g(0,h,0,f,0,w),F=this.k[E],O=this.k[E+1],N=n[E],H=n[E+1],K=j(P,R,D,x,L,M,F,O,N,H),$=V(P,R,D,x,L,M,F,O,N,H),W=(P=b(r,i),R=A(r,i),D=v(r,0,o,0,s),x=y(0,i,0,a,0,c),U(P,R,D,x)),G=q(P,R,D,x);k=I,C=w,I=p,w=f,p=d,f=h,d=U(u,l,K,$),h=q(l,l,K,$),u=s,l=c,s=o,c=a,o=r,a=i,r=U(K,$,W,G),i=q(K,$,W,G)}B(this.h,0,r,i),B(this.h,2,o,a),B(this.h,4,s,c),B(this.h,6,u,l),B(this.h,8,d,h),B(this.h,10,p,f),B(this.h,12,I,w),B(this.h,14,k,C)},o.prototype._digest=function(e){return"hex"===e?P.toHex32(this.h,"big"):P.split32(this.h,"big")},P.inherits(a,o),n.sha384=a,a.blockSize=1024,a.outSize=384,a.hmacStrength=192,a.padLength=128,a.prototype._digest=function(e){return"hex"===e?P.toHex32(this.h.slice(0,12),"big"):P.split32(this.h.slice(0,12),"big")},P.inherits(s,W),n.sha1=s,s.blockSize=512,s.outSize=160,s.hmacStrength=80,s.padLength=64,s.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=D(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],c=this.h[4];for(r=0;r<n.length;r++){var u=~~(r/20),l=M(D(i,5),f(u,o,a,s),c,n[r],Q[u]);c=s,s=a,a=D(o,30),o=i,i=l}this.h[0]=x(this.h[0],i),this.h[1]=x(this.h[1],o),this.h[2]=x(this.h[2],a),this.h[3]=x(this.h[3],s),this.h[4]=x(this.h[4],c)},s.prototype._digest=function(e){return"hex"===e?P.toHex32(this.h,"big"):P.split32(this.h,"big")}},{"../hash":19}],24:[function(e,t,n){function r(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function i(e){return 1===e.length?"0"+e:e}function o(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}function a(e,t){if(!e)throw new Error(t||"Assertion failed")}var s=n,c=e("inherits");s.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(var r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}}else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}else for(r=0;r<e.length;r++)n[r]=0|e[r];return n},s.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=i(e[n].toString(16));return t},s.htonl=r,s.toHex32=function(e,t){for(var n="",i=0;i<e.length;i++){var a=e[i];"little"===t&&(a=r(a)),n+=o(a.toString(16))}return n},s.zero2=i,s.zero8=o,s.join32=function(e,t,n,r){var i=n-t;a(i%4==0);for(var o=new Array(i/4),s=0,c=t;s<o.length;s++,c+=4){var u;u="big"===r?e[c]<<24|e[c+1]<<16|e[c+2]<<8|e[c+3]:e[c+3]<<24|e[c+2]<<16|e[c+1]<<8|e[c],o[s]=u>>>0}return o},s.split32=function(e,t){for(var n=new Array(4*e.length),r=0,i=0;r<e.length;r++,i+=4){var o=e[r];"big"===t?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},s.rotr32=function(e,t){return e>>>t|e<<32-t},s.rotl32=function(e,t){return e<<t|e>>>32-t},s.sum32=function(e,t){return e+t>>>0},s.sum32_3=function(e,t,n){return e+t+n>>>0},s.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},s.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},s.assert=a,s.inherits=c,n.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0,a=(o<r?1:0)+n+i;e[t]=a>>>0,e[t+1]=o},n.sum64_hi=function(e,t,n,r){return(t+r>>>0<t?1:0)+e+n>>>0},n.sum64_lo=function(e,t,n,r){return t+r>>>0},n.sum64_4_hi=function(e,t,n,r,i,o,a,s){var c=0,u=t;return c+=(u=u+r>>>0)<t?1:0,c+=(u=u+o>>>0)<o?1:0,e+n+i+a+(c+=(u=u+s>>>0)<s?1:0)>>>0},n.sum64_4_lo=function(e,t,n,r,i,o,a,s){return t+r+o+s>>>0},n.sum64_5_hi=function(e,t,n,r,i,o,a,s,c,u){var l=0,d=t;return l+=(d=d+r>>>0)<t?1:0,l+=(d=d+o>>>0)<o?1:0,l+=(d=d+s>>>0)<s?1:0,e+n+i+a+c+(l+=(d=d+u>>>0)<u?1:0)>>>0},n.sum64_5_lo=function(e,t,n,r,i,o,a,s,c,u){return t+r+o+s+u>>>0},n.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},n.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},n.shr64_hi=function(e,t,n){return e>>>n},n.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},{inherits:27}],25:[function(e,t,n){"use strict";function r(e){if(!(this instanceof r))return new r(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this.reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=o.toArray(e.entropy,e.entropyEnc||"hex"),n=o.toArray(e.nonce,e.nonceEnc||"hex"),i=o.toArray(e.pers,e.persEnc||"hex");a(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,i)}var i=e("hash.js"),o=e("minimalistic-crypto-utils"),a=e("minimalistic-assert");t.exports=r,r.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this.reseed=1,this.reseedInterval=281474976710656},r.prototype._hmac=function(){return new i.hmac(this.hash,this.K)},r.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},r.prototype.reseed=function(e,t,n,r){"string"!=typeof t&&(r=n,n=t,t=null),e=o.toArray(e,t),n=o.toArray(n,r),a(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this.reseed=1},r.prototype.generate=function(e,t,n,r){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=o.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var a=i.slice(0,e);return this._update(n),this.reseed++,o.encode(a,t)}},{"hash.js":19,"minimalistic-assert":28,"minimalistic-crypto-utils":26}],26:[function(e,t,n){"use strict";function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}var o=n;o.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16));else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},o.zero2=r,o.toHex=i,o.encode=function(e,t){return"hex"===t?i(e):e}},{}],27:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],28:[function(e,t,n){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}t.exports=r,r.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},{}],29:[function(e,t,n){"use strict";function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}var o=n;o.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},o.zero2=r,o.toHex=i,o.encode=function(e,t){return"hex"===t?i(e):e}},{}],30:[function(e,t,n){t.exports={name:"elliptic",version:"6.4.0",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"}}},{}]},{},[1])(1)}(),function(e){"use strict";function t(e,t){t?(l[0]=l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0,this.blocks=l):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}function n(e,n,o){var a,s=typeof e;if("string"===s){var c,u=[],l=e.length,d=0;for(a=0;a<l;++a)(c=e.charCodeAt(a))<128?u[d++]=c:c<2048?(u[d++]=192|c>>6,u[d++]=128|63&c):c<55296||c>=57344?(u[d++]=224|c>>12,u[d++]=128|c>>6&63,u[d++]=128|63&c):(c=65536+((1023&c)<<10|1023&e.charCodeAt(++a)),u[d++]=240|c>>18,u[d++]=128|c>>12&63,u[d++]=128|c>>6&63,u[d++]=128|63&c);e=u}else{if("object"!==s)throw new Error(r);if(null===e)throw new Error(r);if(i&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||i&&ArrayBuffer.isView(e)))throw new Error(r)}e.length>64&&(e=new t(n,!0).update(e).array());var h=[],p=[];for(a=0;a<64;++a){var f=e[a]||0;h[a]=92^f,p[a]=54^f}t.call(this,n,o),this.update(p),this.oKeyPad=h,this.inner=!0,this.sharedMemory=o}var r="input is invalid type",i=!e.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,o="0123456789abcdef".split(""),a=[-2147483648,8388608,32768,128],s=[24,16,8,0],c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],u=["hex","array","digest","arrayBuffer"],l=[];!e.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!i||!e.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var d=function(e,n){return function(r){return new t(n,!0).update(r)[e]()}},h=function(e){var n=d("hex",e);n.create=function(){return new t(e)},n.update=function(e){return n.create().update(e)};for(var r=0;r<u.length;++r){var i=u[r];n[i]=d(i,e)}return n},p=function(e,t){return function(r,i){return new n(r,t,!0).update(i)[e]()}},f=function(e){var t=p("hex",e);t.create=function(t){return new n(t,e)},t.update=function(e,n){return t.create(e).update(n)};for(var r=0;r<u.length;++r){var i=u[r];t[i]=p(i,e)}return t};t.prototype.update=function(e){if(!this.finalized){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(r);if(null===e)throw new Error(r);if(i&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||i&&ArrayBuffer.isView(e)))throw new Error(r);t=!0}for(var o,a,c=0,u=e.length,l=this.blocks;c<u;){if(this.hashed&&(this.hashed=!1,l[0]=this.block,l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0),t)for(a=this.start;c<u&&a<64;++c)l[a>>2]|=e[c]<<s[3&a++];else for(a=this.start;c<u&&a<64;++c)(o=e.charCodeAt(c))<128?l[a>>2]|=o<<s[3&a++]:o<2048?(l[a>>2]|=(192|o>>6)<<s[3&a++],l[a>>2]|=(128|63&o)<<s[3&a++]):o<55296||o>=57344?(l[a>>2]|=(224|o>>12)<<s[3&a++],l[a>>2]|=(128|o>>6&63)<<s[3&a++],l[a>>2]|=(128|63&o)<<s[3&a++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++c)),l[a>>2]|=(240|o>>18)<<s[3&a++],l[a>>2]|=(128|o>>12&63)<<s[3&a++],l[a>>2]|=(128|o>>6&63)<<s[3&a++],l[a>>2]|=(128|63&o)<<s[3&a++]);this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.block=l[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=a[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},t.prototype.hash=function(){var e,t,n,r,i,o,a,s,u,l=this.h0,d=this.h1,h=this.h2,p=this.h3,f=this.h4,m=this.h5,g=this.h6,v=this.h7,y=this.blocks;for(e=16;e<64;++e)t=((i=y[e-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,n=((i=y[e-2])>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,y[e]=y[e-16]+t+y[e-7]+n<<0;for(u=d&h,e=0;e<64;e+=4)this.first?(this.is224?(o=300032,v=(i=y[0]-1413257819)-150054599<<0,p=i+24177077<<0):(o=704751109,v=(i=y[0]-210244248)-1521486534<<0,p=i+143694565<<0),this.first=!1):(t=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),r=(o=l&d)^l&h^u,v=p+(i=v+(n=(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&m^~f&g)+c[e]+y[e])<<0,p=i+(t+r)<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),r=(a=p&l)^p&d^o,g=h+(i=g+(n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&f^~v&m)+c[e+1]+y[e+1])<<0,t=((h=i+(t+r)<<0)>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),r=(s=h&p)^h&l^a,m=d+(i=m+(n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&v^~g&f)+c[e+2]+y[e+2])<<0,t=((d=i+(t+r)<<0)>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),r=(u=d&h)^d&p^s,f=l+(i=f+(n=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(m&g^~m&v)+c[e+3]+y[e+3])<<0,l=i+(t+r)<<0;this.h0=this.h0+l<<0,this.h1=this.h1+d<<0,this.h2=this.h2+h<<0,this.h3=this.h3+p<<0,this.h4=this.h4+f<<0,this.h5=this.h5+m<<0,this.h6=this.h6+g<<0,this.h7=this.h7+v<<0},t.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,c=this.h7,u=o[e>>28&15]+o[e>>24&15]+o[e>>20&15]+o[e>>16&15]+o[e>>12&15]+o[e>>8&15]+o[e>>4&15]+o[15&e]+o[t>>28&15]+o[t>>24&15]+o[t>>20&15]+o[t>>16&15]+o[t>>12&15]+o[t>>8&15]+o[t>>4&15]+o[15&t]+o[n>>28&15]+o[n>>24&15]+o[n>>20&15]+o[n>>16&15]+o[n>>12&15]+o[n>>8&15]+o[n>>4&15]+o[15&n]+o[r>>28&15]+o[r>>24&15]+o[r>>20&15]+o[r>>16&15]+o[r>>12&15]+o[r>>8&15]+o[r>>4&15]+o[15&r]+o[i>>28&15]+o[i>>24&15]+o[i>>20&15]+o[i>>16&15]+o[i>>12&15]+o[i>>8&15]+o[i>>4&15]+o[15&i]+o[a>>28&15]+o[a>>24&15]+o[a>>20&15]+o[a>>16&15]+o[a>>12&15]+o[a>>8&15]+o[a>>4&15]+o[15&a]+o[s>>28&15]+o[s>>24&15]+o[s>>20&15]+o[s>>16&15]+o[s>>12&15]+o[s>>8&15]+o[s>>4&15]+o[15&s];return this.is224||(u+=o[c>>28&15]+o[c>>24&15]+o[c>>20&15]+o[c>>16&15]+o[c>>12&15]+o[c>>8&15]+o[c>>4&15]+o[15&c]),u},t.prototype.toString=t.prototype.hex,t.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,o=this.h5,a=this.h6,s=this.h7,c=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,r>>24&255,r>>16&255,r>>8&255,255&r,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a];return this.is224||c.push(s>>24&255,s>>16&255,s>>8&255,255&s),c},t.prototype.array=t.prototype.digest,t.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e},n.prototype=new t,n.prototype.finalize=function(){if(t.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();t.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(e),t.prototype.finalize.call(this)}};var m=h();m.sha256=m,m.sha224=h(!0),m.sha256.hmac=f(),m.sha224.hmac=f(!0),e.sha256=m.sha256,e.sha224=m.sha224}("undefined"!=typeof window?window:global),function(e){"use strict";function t(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function n(e){var t=e.length%4;if(t>0)for(var n=4-t;n>0;)e+="=",n--;return e}function r(e){return a[e>>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}function i(e,t,n){for(var i,o=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(r(i));return o.join("")}var o={byteLength:function(e){var r=t(n(e)),i=r[0],o=r[1];return 3*(i+o)/4-o},toByteArray:function(e){for(var r,i=t(n(e)),o=i[0],a=i[1],u=new c(function(e,t,n){return 3*(t+n)/4-n}(0,o,a)),l=0,d=a>0?o-4:o,h=0;h<d;h+=4)r=s[e.charCodeAt(h)]<<18|s[e.charCodeAt(h+1)]<<12|s[e.charCodeAt(h+2)]<<6|s[e.charCodeAt(h+3)],u[l++]=r>>16&255,u[l++]=r>>8&255,u[l++]=255&r;return 2===a&&(r=s[e.charCodeAt(h)]<<2|s[e.charCodeAt(h+1)]>>4,u[l++]=255&r),1===a&&(r=s[e.charCodeAt(h)]<<10|s[e.charCodeAt(h+1)]<<4|s[e.charCodeAt(h+2)]>>2,u[l++]=r>>8&255,u[l++]=255&r),u},fromByteArray:function(e){for(var t,n=e.length,r=n%3,o=[],s=16383,c=0,u=n-r;c<u;c+=s)o.push(i(e,c,c+s>u?u:c+s));return 1===r?(t=e[n-1],o.push(a[t>>2]+a[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"=")),o.join("")}};e.base64js=o;for(var a=[],s=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,d=u.length;l<d;++l)a[l]=u[l],s[u.charCodeAt(l)]=l;s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63}("undefined"!=typeof window?window:global),function(e){!function(e){!function(e){!function(e){var t,n;t=e.core||(e.core={}),n=function(){function t(e,t,n){this._session=t,this._sdk=e,this._clientContext=n,this._uiHandler=e.currentUiHandler}return t.prototype.run=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"approvals: Starting session"),this.queryApprovalsFromServer().then(function(e){return new Promise(function(n,r){t._completeFn=n,t._rejectFn=r,t.kickStartSession(e)})})},t.prototype.approve=function(t,n){return this.changeApprovalStatus(t,e.MobileApprovalStatus.Approved,n)},t.prototype.deny=function(t){return this.changeApprovalStatus(t,e.MobileApprovalStatus.Denied).then(function(e){return!0})},t.prototype.requestRefreshApprovals=function(){var t=this;return this.queryApprovalsFromServer().then(function(e){return t.updateManagedApprovals(e),!0},function(t){throw e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t)})},t.prototype.finishSession=function(){if(!this._appSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to finish a non started approval session.");this._appSession.endSession(),this._appSession=null,this._completeFn(!0)},t.prototype.kickStartSession=function(t){this._appSession=this._sdk.currentUiHandler.createApprovalsSession(this._session.user.displayName),this._appSession?(this.updateManagedApprovals(t),this._appSession.startSession(this,null,this._clientContext)):this._rejectFn(e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createTicketWaitSession."))},t.prototype.updateManagedApprovals=function(t){if(this._managedApprovals=t,!this._appSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to update approvals on a non started approval session.");this._appSession.setSessionApprovalsList(t)},t.prototype.queryApprovalsFromServer=function(){var t=this;this._sdk.log(e.LogLevel.Debug,"approvals: Initiating collection");var n=this._sdk.promiseCollectionResult();return e.util.wrapPromiseWithActivityIndicator(this._uiHandler,null,this._clientContext,n.then(function(n){t._sdk.log(e.LogLevel.Debug,"approvals: Collection done; setting up request to query approvals");var r=t._session.createApprovalsFetchRequest(n);return t._sdk.log(e.LogLevel.Debug,"approvals: Sending request to query approvals"),t._session.performSessionExchange(r).then(function(t){return t.data.approvals.map(function(t){return new e.impl.ManagedMobileApprovalImpl(t)})})}))},t.prototype.changeApprovalStatus=function(t,n,r){var i=this;this._sdk.log(e.LogLevel.Debug,"approval: change status of approval "+t.getApproval().getApprovalId()+" to "+n),this._sdk.log(e.LogLevel.Debug,"approval: Initiating request promise");var o=this._sdk.promiseCollectionResult().then(function(r){return i._sdk.log(e.LogLevel.Debug,"approval: Collection done; setting up request"),i._session.createApprovalReplyRequest(r,t.getApproval().getApprovalId(),n)});return this._sdk.log(e.LogLevel.Debug,"approval: Initiating control flow"),this._session.startControlFlow(o,t.getApproval(),r||this._clientContext).then(function(e){return t.getApproval().updateStatus(n),i.updateManagedApprovals(i._managedApprovals),e},function(t){var n=e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t);throw i._sdk.log(e.LogLevel.Debug,"approval: Got server error "+n),n.getErrorCode()==e.AuthenticationErrorCode.Internal&&n.getData()&&6001==n.getData().server_error_code?(i._sdk.log(e.LogLevel.Debug,"approval: Converting server error"),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.ApprovalWrongState,n.getMessage())):n})},t}(),t.ApprovalSessionProcessor=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n;!function(r){var i;!function(e){e[e.Builtin=0]="Builtin",e[e.Placeholder=1]="Placeholder",e[e.Fido=2]="Fido"}(i=r.AuthenticatorPrototype||(r.AuthenticatorPrototype={}));var o=function(){function o(e,t,n,r){this._session=e,this._authenticatorId=t;var o=t.match(/^placeholder_(.*)$/);if(o){this._authenticatorPrototype=i.Placeholder,this._placeholderId=o[1];var a=n;this._authetnicationMethodTypeName=a.placeholder_type}else if(t.match(/^fido_(.*)$/)){this._authenticatorPrototype=i.Fido;var s=n;this._authetnicationMethodTypeName=s.authenticator_type}else this._authenticatorPrototype=i.Builtin,this._authetnicationMethodTypeName=this._authenticatorId;this._authenticatorMethodConfig=n,this._serverReportedRegistrationStatus=r.status,this._expired=r.expired||!1,this._locked=r.locked||!1}return Object.defineProperty(o.prototype,"authenticationDriverDescriptor",{get:function(){var t=this.internalAuthenticationDriverDescriptor();if(!t)throw new e.ts.mobile.sdk.impl.AuthenticationErrorImpl(e.ts.mobile.sdk.AuthenticationErrorCode.Internal,"Unhandled authenticator: "+this.getAuthenticatorId());return t},enumerable:!0,configurable:!0}),o.prototype.internalAuthenticationDriverDescriptor=function(){switch(this._authenticatorPrototype){case i.Placeholder:return r.AuthenticatorDrivers.__placeholder;case i.Fido:return new r.AuthenticationDriverDescriptorFido(this._authenticatorMethodConfig.fido_policy);case i.Builtin:default:return r.AuthenticatorDrivers[this.getAuthenticatorId()]}},o.prototype.getAuthenticatorId=function(){return this._authenticatorId},o.prototype.getType=function(){var e=n.Protocol.AuthTypeData[this._authetnicationMethodTypeName];return e&&"authTypeEnum"in e?e.authTypeEnum:t.AuthenticatorType.Generic},o.prototype.getName=function(){var e=n.Protocol.AuthTypeData[this._authetnicationMethodTypeName];return e&&e.authTypeName||"Generic"},o.prototype.getExpired=function(){return this._expired},o.prototype.getRegistered=function(){return this.getRegistrationStatus()==t.AuthenticatorRegistrationStatus.Registered},o.prototype.getRegistrationStatus=function(){return this._serverReportedRegistrationStatus!=n.Protocol.AuthenticationMethodStatus.Registered?t.AuthenticatorRegistrationStatus.Unregistered:this.authenticationDriverDescriptor.evaluateLocalRegistrationStatus(this._session)},o.prototype.getLocked=function(){return this._locked},o.prototype.getDefaultAuthenticator=function(){return this._session.user.defaultAuthId==this.getAuthenticatorId()},o.prototype.getSupportedOnDevice=function(){return this.internalAuthenticationDriverDescriptor()&&this.authenticationDriverDescriptor.isSupportedOnDevice(this._session)},o.prototype.getPlaceholderId=function(){return this._placeholderId},o.prototype.updateWithAuthenticatorState=function(e){this._expired=e.expired||!1,this._locked=e.locked||!1,this._serverReportedRegistrationStatus=e.status},o}();r.AuthenticatorDescriptionImpl=o}((n=t.core||(t.core={})).authenticationdrivers||(n.authenticationdrivers={}))}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getEnabled=function(){return this.getSupportedOnDevice()},t}(t.authenticationdrivers.AuthenticatorDescriptionImpl),r=function(){function r(e,t,n,r){this._sdk=e,this._session=t,this._token=r||null,this._clientContext=n,this._uiHandler=this._sdk.currentUiHandler}return r.prototype.run=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"configuration: Starting session"),this.queryConfigMenuFromServerAndFilter().then(function(e){return new Promise(function(n,r){t.kickStartSession(e),t._completeFn=n,t._rejectFn=r})})},r.prototype.registerAuthenticator=function(e,t){return this.requestAuthenticatorRegistrationChange(e,!0,t)},r.prototype.reregisterAuthenticator=function(e,t){return this.requestAuthenticatorRegistrationChange(e,!0,t)},r.prototype.setDefaultAuthenticator=function(n){var r=this;return this._sdk.log(e.LogLevel.Info,"Coniguration: Updating user default authenticator."),new Promise(function(e,i){if(!r._session.anonymous){var o=r._session.user;o.updateDefaultAuthId(n.getDescription().getAuthenticatorId()),r._session.persistUserData&&t.User.save(r._sdk,o)}e(!0),r.updateManagedAuthenticators(r._authenticators)})},r.prototype.unregisterAuthenticator=function(e,t){return this.requestAuthenticatorRegistrationChange(e,!1,t).then(function(e){return!0})},r.prototype.requestRefreshAuthenticators=function(){var t=this;return this.queryConfigMenuFromServerAndFilter().then(function(e){return t.updateManagedAuthenticators(e),!0},function(t){throw e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t)})},r.prototype.finishSession=function(){if(!this._appSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to finish a non started config session.");this._appSession.endSession(),this._appSession=null,this._completeFn(!0)},r.prototype.kickStartSession=function(t){this._appSession=this._uiHandler.createAuthenticationConfigurationSession(this._session.user.displayName),this._appSession?(this._appSession.startSession(this,null,this._clientContext),this.updateManagedAuthenticators(t)):this._rejectFn(e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createAuthenticationConfigurationSession."))},r.prototype.updateManagedAuthenticators=function(t){if(!this._appSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to work with a non started config session.");var n={};t.forEach(function(e){n[e.getDescription().getAuthenticatorId()]=e}),this._authenticators=t,this._authenticatorsByName=n,this._appSession.setAuthenticatorsList(t)},r.prototype.queryConfigMenuFromServerAndFilter=function(){var t=this;this._sdk.log(e.LogLevel.Debug,"configuration: Initiating collection");var r=this._sdk.promiseCollectionResult();return e.util.wrapPromiseWithActivityIndicator(this._uiHandler,null,this._clientContext,r.then(function(r){t._sdk.log(e.LogLevel.Debug,"configuration: Collection done; setting up request to query for config menu");var i=t._session.createConfigMenuFetchRequest(r,t._token);return t._sdk.log(e.LogLevel.Debug,"configuration: Sending request to query approvals"),t._session.performSessionExchange(i).then(function(r){var i=r.data&&"configuration"==r.data.type&&r.data;if(!i)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid configuration screen structure encountered.");return i.methods.map(function(r){var i=new n(t._session,r.type,r,r);return new e.impl.ConfigurableAuthenticatorImpl(i,r.options)}).filter(function(e){return e.getDescription().getSupportedOnDevice()})})}))},r.prototype.requestAuthenticatorRegistrationChange=function(n,r,i){var o=this;this._sdk.log(e.LogLevel.Debug,"configuration: Authenticator "+n.getDescription().getName()+" request (un)registration "+r),this._sdk.log(e.LogLevel.Debug,"configuration: Initiating registration request promise");var a=this._sdk.promiseCollectionResult().then(function(t){return o._sdk.log(e.LogLevel.Debug,"configuration: Collection done; setting up request"),o._session.createAuthRegistrationRequest(t,n.getDescription().getAuthenticatorId(),r,o._token)});return this._sdk.log(e.LogLevel.Debug,"configuration: Initiating control flow"),this._session.startControlFlow(a,null,i||this._clientContext).then(function(i){var a=i.getInternalData(),s=!1;if(a&&a.methods&&a.methods.length&&(o._sdk.log(e.LogLevel.Debug,"configuration: Processing updates."),a.methods.forEach(function(e){var t=o._authenticatorsByName[e.type];t&&(t.getDescription().updateWithAuthenticatorState(e),s=!0)})),s){if(!r&&n.getDescription().getDefaultAuthenticator&&!o._session.anonymous){var c=o._session.user;c.updateDefaultAuthId(""),o._session.persistUserData&&t.User.save(o._sdk,c)}o.updateManagedAuthenticators(o._authenticators)}return i},function(t){throw e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t)})},r}(),t.AuthenticationConfigurationSessionProcessor=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t){this._sdk=e,this._user=t}return Object.defineProperty(e.prototype,"user",{get:function(){return this._user},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sdk",{get:function(){return this._sdk},enumerable:!0,configurable:!0}),e}();e.BaseSession=t;var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(t);e.LocalSession=n}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.core||(e.core={}),n=function(){function n(e,t,n){this._sdk=e,this._session=t,this._cancelled=!1,this._uiHandler=e.currentUiHandler,this._clientContext=n}return Object.defineProperty(n.prototype,"initiatingRequest",{get:function(){return this._initiatingRequest},enumerable:!0,configurable:!0}),n.prototype.cancelFlow=function(){this._cancelled=!0,this._currentActionDriver&&this._currentActionDriver.cancelRun(),this._uiHandler.controlFlowCancelled(this._clientContext)},n.prototype.startControlFlow=function(t,n){var r=this;return this._cancelled?this.createExternalCancellationRejectionPromise():e.util.wrapPromiseWithActivityIndicator(this._uiHandler,null,this._clientContext,this._session.performSessionExchange(t)).then(function(e){return r._initiatingRequest=t,r._approval=n||null,r._uiHandler.controlFlowStarting(r._clientContext),r.promiseControlFlowCompletion(e).then(function(e){return r._uiHandler.controlFlowEnded(null,r._clientContext),e},function(e){throw r._uiHandler.controlFlowEnded(e,r._clientContext),e})})},Object.defineProperty(n.prototype,"challenge",{get:function(){return this._initialCflowResponse&&this._initialCflowResponse.challenge||null},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"approval",{get:function(){return this._approval||null},enumerable:!0,configurable:!0}),n.prototype.promiseControlFlowCompletion=function(e){return this._initialCflowResponse=e.data,this.processSingleStepExchange(this._initialCflowResponse)},n.prototype.processSingleStepExchange=function(n){var r,i=this;return n.control_flow&&(this._controlFlow=n.control_flow,this._currentControlFlowStep=0,this._sdk.log(e.LogLevel.Debug,"Got ControlFlow with "+this._controlFlow.length+" steps.")),n.data&&n.data.json_data?(this._sdk.log(e.LogLevel.Debug,"Got a JSON data attachment on control flow response. Processing."),r=t.actiondrivers.ActionDriverJsonData.handleJsonDataByUiHandler(this._uiHandler,n,n.data.json_data,null,this._clientContext)):r=Promise.resolve(n),r.then(function(r){switch(n.state){case t.Protocol.AuthSessionState.Pending:return i._sdk.log(e.LogLevel.Debug,"Execute step "+i._currentControlFlowStep+"."),(o=i._controlFlow[i._currentControlFlowStep])?i._cancelled?i.createExternalCancellationRejectionPromise():i.promiseCancellableSingleActionProcessing(o).then(function(e){return i._currentControlFlowStep++,i.processSingleStepExchange(e)}):(i._sdk.log(e.LogLevel.Error,"Step "+i._currentControlFlowStep+" nonexisting."),Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Session state is pending but no control flow.")));case t.Protocol.AuthSessionState.Rejected:i._sdk.log(e.LogLevel.Debug,"Handle control flow rejection.");var o=i._controlFlow&&i._controlFlow[i._currentControlFlowStep]||null;return i._uiHandler.handlePolicyRejection(n.rejection_data&&n.rejection_data.title||null,n.rejection_data&&n.rejection_data.text||null,n.rejection_data&&n.rejection_data.button_text||null,n.failure_data,o?new e.impl.PolicyActionImpl(o):null,i._clientContext).then(function(t){if(-1!=t.getUserChoice())throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"ConfirmationInput.getUserChoice must be set to -1.");throw e.impl.AuthenticationErrorImpl.errorForSessionRejectionFailureData(n.failure_data)});case t.Protocol.AuthSessionState.Completed:return i._sdk.log(e.LogLevel.Debug,"Handle control flow completion."),Promise.resolve(e.impl.AuthenticationResultImpl.fromCflowServerResponse(n,i._session.deviceId()))}})},n.prototype.promiseCancellableSingleActionProcessing=function(n){var r=this,i=t.actiondrivers.ActionDrivers[n.type];if(!i)return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Don't know how to handle action.",{actionType:n.type}));var o=new i(this,n);return this._currentActionDriver=o,this._uiHandler.controlFlowActionStarting(o.policyAction(),this._clientContext),o.run().then(function(e){return r._uiHandler.controlFlowActionEnded(null,o.policyAction(),r._clientContext),e},function(e){throw r._uiHandler.controlFlowActionEnded(e,o.policyAction(),r._clientContext),e}).finally(function(){r._currentActionDriver=null})},n.prototype.createAssertionRequest=function(n,r,i,o){if(!this.challenge)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to create an assertion request without an initial control flow request.");var a={action:n.type,assert:r||"action",assertion_id:n.assertion_id,fch:this.challenge};if(i&&(a.data=i),o){var s=a;for(var c in o)s[c]=o[c]}return new t.SessionExchangeRequest("POST","auth/assert",a)},n.prototype.createExternalCancellationRejectionPromise=function(){return Promise.reject(this.createExternalCancellationError())},n.prototype.createExternalCancellationError=function(){return new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Operation cancelled by user.",{control_flow_external_cancellation:!0})},n}(),t.ControlFlowProcessor=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.core||(e.core={}),n=function(){function t(t,n){if(this.sdk=t,this.ec=new elliptic.ec("secp256k1"),n&&(this.sessionId=n.session_id,this.aesKey=this.base64ToJsArray(n.key),!this.isReady()))throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Can't deserialize crypto session")}return t.prototype.getExchangeRequestHeader=function(){if(!this.kp){var e={entropy:this.sdk.host.generateRandomHexString(192),entropyEnc:"hex"};this.kp=this.ec.genKeyPair(e)}return{type:"key_exchange",scheme:2,y:this.jsArrayToBase64(this.kp.getPublic().encode())}},t.prototype.processExchangeResponseHeader=function(e){if(2!=e.scheme)throw"Unsupported crypto scheme "+e.scheme;this.sessionId=e.crypto_session_id;var t=this.kp.derive(this.ec.keyFromPublic(atob(e.y)).getPublic()),n=sha256.create();n.update(t.toArray("be",32)),this.aesKey=n.digest()},t.prototype.isReady=function(){return!(!this.aesKey||!this.sessionId)},t.prototype.decryptResponse=function(e){var t=null;if(e.headers.forEach(function(e){"encryption"==e.type&&(t=e)}),t){var n=this.base64ToJsArray(t.iv),r=new aesjs.ModeOfOperation.cbc(this.aesKey,n),i=this.base64ToJsArray(e.data),o=r.decrypt(i),a=aesjs.utils.utf8.fromBytes(o);a=this.pkcs7Unpad(a),e.data=JSON.parse(a)}return e},t.prototype.encryptRequest=function(t){var n=this,r=this.sdk.host.generateRandomHexString(32),i=aesjs.utils.hex.toBytes(r),o={type:"encryption",iv:e.util.hexToBase64(r),crypto_session_id:this.sessionId},a=t.headers.map(function(e){return n.encryptStringToBase64(JSON.stringify(e),i)}),s=JSON.stringify(t.data),c=this.encryptStringToBase64(s,i);t.headers=[o],t.enc_headers=a,t.data=c},t.prototype.encryptStringToBase64=function(e,t){var n=new aesjs.ModeOfOperation.cbc(this.aesKey,t),r=aesjs.utils.utf8.toBytes(e),i=this.pkcs7Pad(r),o=n.encrypt(i);return this.jsArrayToBase64(o)},t.prototype.toJson=function(){return{scheme:2,session_id:this.sessionId,key:this.jsArrayToBase64(this.aesKey)}},t.fromJson=function(e,n){return new t(e,n)},t.prototype.jsArrayToBase64=function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)},t.prototype.base64ToJsArray=function(e){for(var t=atob(e),n=[],r=0;r<t.length;r++)n.push(t.charCodeAt(r));return n},t.prototype.pkcs7Pad=function(e){var t=16-e.length%16,n=new Uint8Array(e.length+t);n.set(e,0);for(var r=0;r<t;r++)n[e.length+r]=t;return n},t.prototype.pkcs7Unpad=function(e){var t=e.charCodeAt(e.length-1);return e.slice(0,-t)},t}(),t.Scheme2CryptoSession=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(t){var n;!function(e){e[e.FinishSession=0]="FinishSession",e[e.CurrentDeviceDeleted=1]="CurrentDeviceDeleted"}(n=t.DeviceManagementSessionProcessorReturnReason||(t.DeviceManagementSessionProcessorReturnReason={}));var r=function(){function t(e,t,n,r){this._sdk=e,this._session=t,this._clientContext=n,this._token=r||null,this._uiHandler=this._sdk.currentUiHandler}return t.prototype.run=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"device management: Starting session"),this.queryDevicesFromServer().then(function(e){return new Promise(function(n,r){t._completeFn=n,t._rejectFn=r,t.kickStartSession(e)})})},t.prototype.removeDevice=function(t,n){var r=this;return new Promise(function(n,i){if(t.getInfo().getIsCurrent())throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Illegal attempt to delete the current device using 'DeviceManagementSessionServices.removeDevice'. The current device must only be deleted using DeviceManagementSessionServices.removeCurrentDeviceAndFinishSession.");var o=r.ensureValidDevice(t);r.performDeviceAction(o,e.DeviceManagementAction.Remove,null).then(function(t){return r._sdk.log(e.LogLevel.Debug,"device management: Updating device state locally"),o.getInfo().setStatus(e.DeviceStatus.Removed),r.updateManagedDevices(r._managedDevices.filter(function(e){return e!=o})),!0}).then(n,i)})},t.prototype.removeCurrentDeviceAndFinishSession=function(t){var r,i=this;return this._appSession?(r=this._appSession,new Promise(function(t,o){i._sdk.log(e.LogLevel.Debug,"device management: Start removing current device");var a=i._managedDevices.filter(function(e){return e.getInfo().getIsCurrent()});if(1!=a.length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Couldn't locate current device in device list.");var s=a[0];i.performDeviceAction(s,e.DeviceManagementAction.Remove,null).then(function(t){return i._sdk.log(e.LogLevel.Debug,"device management: Updating device state locally"),s.getInfo().setStatus(e.DeviceStatus.Removed),!0}).then(function(){t(!0),r.endSession(),i._appSession=null,i._completeFn(n.CurrentDeviceDeleted)}).catch(o)})):Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to finish a non started device management session."))},t.prototype.identifyDevice=function(t,n){var r=this;return new Promise(function(n,i){var o=r.ensureValidDevice(t);return r.performDeviceAction(o,e.DeviceManagementAction.Identify,null).then(function(e){return!0}).then(n,i)})},t.prototype.renameDevice=function(t,n,r){var i=this;return new Promise(function(r,o){var a=i.ensureValidDevice(t),s={name:n};return i.performDeviceAction(a,e.DeviceManagementAction.Rename,s).then(function(t){return i._sdk.log(e.LogLevel.Debug,"device management: Updating device state locally"),a.getInfo().setName(n),i.updateManagedDevices(i._managedDevices),!0}).then(r,o)})},t.prototype.requestRefreshDevices=function(){var t=this;return this.queryDevicesFromServer().then(function(e){return t.updateManagedDevices(e),!0},function(t){throw e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t)})},t.prototype.finishSession=function(){if(!this._appSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to finish a non started device management session.");this._appSession.endSession(),this._appSession=null,this._completeFn(n.FinishSession)},t.prototype.kickStartSession=function(t){this._appSession=this._sdk.currentUiHandler.createDeviceManagementSession(this._session.user.displayName),this._appSession?(this.updateManagedDevices(t),this._appSession.startSession(this,null,this._clientContext)):this._rejectFn(e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createDeviceManagementSession."))},t.prototype.updateManagedDevices=function(t){if(!this._appSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to update device list for a non started device management session.");this._managedDevices=t,this._appSession.setSessionDevicesList(t)},t.prototype.querySingleDeviceFromServer=function(t){var n=this;this._sdk.log(e.LogLevel.Debug,"device management: Initiating collection");var r=this._sdk.promiseCollectionResult();return e.util.wrapPromiseWithActivityIndicator(this._uiHandler,null,this._clientContext,r.then(function(r){n._sdk.log(e.LogLevel.Debug,"device management: Collection done; setting up request to query single device");var i=n._session.createSingleDeviceFetchRequest(r,n._token,t);return n._sdk.log(e.LogLevel.Debug,"device management: Sending request to query devices"),n._session.performSessionExchange(i).then(function(e){return e.data})}))},t.prototype.queryDevicesFromServer=function(){var t=this;this._sdk.log(e.LogLevel.Debug,"device management: Initiating collection");var n=this._sdk.promiseCollectionResult();return e.util.wrapPromiseWithActivityIndicator(this._uiHandler,null,this._clientContext,n.then(function(n){t._sdk.log(e.LogLevel.Debug,"device management: Collection done; setting up request to query devices");var r=t._session.createDevicesFetchRequest(n,t._token);return t._sdk.log(e.LogLevel.Debug,"device management: Sending request to query devices"),t._session.performSessionExchange(r).then(function(n){return t._uiHandler.endActivityIndicator(null,t._clientContext),n.data.map(function(n){var r=new e.impl.ManagedDeviceImpl(n);return r.getInfo().getDeviecId()==t._session.user.deviceId&&r.getInfo().forceCurrent(),r})})}))},t.prototype.performDeviceAction=function(t,n,r){var i,o=this;switch(n){case e.DeviceManagementAction.Identify:i="notify";break;case e.DeviceManagementAction.Remove:i="remove";break;case e.DeviceManagementAction.Rename:i="name";break;default:return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid device action specified "+n))}this._sdk.log(e.LogLevel.Debug,"devices: action "+i+" on "+t.getInfo().getDeviecId()),this._sdk.log(e.LogLevel.Debug,"devices: Initiating collection");var a=this._sdk.promiseCollectionResult();return e.util.wrapPromiseWithActivityIndicator(this._uiHandler,null,this._clientContext,a.then(function(n){o._sdk.log(e.LogLevel.Debug,"devices: Collection done; setting up request");var a=o._session.createDeviceActionRequest(n,o._token,t.getInfo().getDeviecId(),i,r);return o._sdk.log(e.LogLevel.Debug,"devices: Sending request"),o._session.performSessionExchange(a).then(function(e){return e})}).catch(function(t){throw e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t)}))},t.prototype.ensureValidDevice=function(t){var n=this._managedDevices.indexOf(t);if(n<0)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Attempt to perform a device action on a device not originally included in device management session.");return this._managedDevices[n]},t}();t.DeviceManagementSessionProcessor=r}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.core||(e.core={}),n=function(){function t(e){this._name=e,this._extensions=[],t._extensionPoints[e]=this}return t.prototype.extend=function(e){this._extensions.push(e)},t.prototype.forEach=function(e){this._extensions.forEach(e)},t.prototype.firstNonNull=function(e){var t=null;return this._extensions.forEach(function(n){t||(t=e(n))}),t},t.byName=function(t){var n=this._extensionPoints[t];if(!n)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid extension point requested: "+t);return n},t._extensionPoints={},t}(),t.ExtensionPoint=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.core||(e.core={}),n=function(){function t(){}return t.installOnSdk=function(e){e.setExternalLogger(new t)},t.prototype.log=function(t,n,r){var i="["+n+"] "+r;switch(t){case e.LogLevel.Debug:console.log(i);break;case e.LogLevel.Info:console.info(i);break;case e.LogLevel.Warning:console.warn(i);break;case e.LogLevel.Error:case e.LogLevel.Critical:console.error(i)}},t}(),t.JsConsoleLogger=n}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(t){var n,r;!function(e){e.Registering="registering",e.Registered="registered",e.Unregistered="unregistered"}(n=t.LocalEnrollmentStatus||(t.LocalEnrollmentStatus={})),function(e){e.None="none",e.Validated="validated",e.Invalidated="invalidated"}(r=t.LocalEnrollmentValidationStatus||(t.LocalEnrollmentValidationStatus={}));var i=function(){function i(){}return Object.defineProperty(i.prototype,"salt",{get:function(){return this._record.salt},set:function(e){this._record.salt=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"status",{get:function(){return this._record.status||n.Unregistered},set:function(e){this._record.status=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"version",{get:function(){return this._record.version},set:function(e){this._record.version=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"authenticatorId",{get:function(){return this._record.authenticatorId},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"validationStatus",{get:function(){return this._record.validationStatus},set:function(e){this._record.validationStatus=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"publicKeyHash",{get:function(){return this._record.publicKeyHash},set:function(e){this._record.publicKeyHash=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cryptoSettings",{get:function(){return this._record.cryptoSettings?e.ClientCryptoSettings.create(this._record.cryptoSettings.pbkdf_iterations_count):null},set:function(e){this._record.cryptoSettings=e?{pbkdf_iterations_count:e.getLocalEnrollmentKeyIterationCount(),pbkdf_key_size:e.getLocalEnrollmentKeySizeInBytes()}:null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"keyMaterial",{get:function(){return this._record.keyMeterial},set:function(e){this._record.keyMeterial=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"authenticatorConfig",{get:function(){return this._record.authenticatorConfig},set:function(e){this._record.authenticatorConfig=e},enumerable:!0,configurable:!0}),i.prototype.setFingerprintDbSnapshot=function(e){this._record.fingerprintDbSsnapshot=e},i.enrollmentWithRecord=function(e){var t=new i;return t._record=e,t},i.enrollmentsForUser=function(t,n){var r={},o=n.host.readStorageKey(this.storageKeyForEnrollmentsForUser(t.guid));for(var a in n.log(e.LogLevel.Debug,"Got db "+JSON.stringify(o)),o)n.log(e.LogLevel.Debug,"Got db wEnrollmentKey"+a),r[a]=i.enrollmentWithRecord(o[a]);return r},i.deleteEnrollmentsForUser=function(e,t){t.host.deleteStorageKey(this.storageKeyForEnrollmentsForUser(e.guid))},i.createNew=function(e,t,o,a,s){var c={salt:o,status:n.Unregistered,version:t,authenticatorId:e,cryptoSettings:null,validationStatus:r.None,publicKeyHash:s},u=new i;return u._record=c,u},i.updateEnrollmentsForUser=function(e,t,n){var r={};for(var i in t)r[i]=t[i]._record;n.host.writeStorageKey(this.storageKeyForEnrollmentsForUser(e.guid),r)},i.invalidateLocalRegistrationStatusAndNotifyUIHandler=function(t,n){return new Promise(function(i,o){if(!t)throw"No user interaction session provider!";t._sdk.log(e.LogLevel.Info,"Marking authenticator as invalidated and invoking UI Handler");var a=t._session.user.localEnrollments[n.getAuthenticatorId()];a.validationStatus=r.Invalidated,t._session.user.updateEnrollmentRecord(a),t._uiHandler.localAuthenticatorInvalidated(n,t._clientContext).then(function(e){i(e)})})},i.storageKeyForEnrollmentsForUser=function(e){return new t.TarsusKeyPath("per_user",e.toString(),"local_enrollments")},i.listInvalidatedLocalEnrollments=function(e){var t,n=new Array;for(var i in e.user.localEnrollments)(t=e.user.localEnrollments[i]).validationStatus==r.Invalidated&&n.push(t);return n},i}();t.LocalEnrollment=i}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){e.TARSUS_EXTENSION_POINT_NAME_MESSAGE_FILTERS="com.ts.mobile.sdk.core.messageFilters",e.TARSUS_EXTENSION_POINT_NAME_SESSION_OBSERVERS="com.ts.mobile.sdk.core.sessionObservers",e.TARSUS_EXTENSION_POINT_NAME_PLACEHOLDER_EXTENSION="com.ts.mobile.sdk.core.placeholderExtension"}(e.tarsusplugin||(e.tarsusplugin={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){var n;!function(r){var i=function(i){function s(t,n){var r=i.call(this,t,n)||this;r._lockCount=0,r._invalidated=!1,r._persistUserData=t.currentPersistUserData;var o=t.host.deviceSupportsCryptoBind()?n&&n.deviceBound:n&&n.hasLoggedIn,a="web"==t.host.queryHostInfo(e.ts.mobile.sdkhost.HostInformationKey.Platform);return r._deviceId=o&&!a?n.deviceId:null,r}return __extends(s,i),Object.defineProperty(s.prototype,"anonymous",{get:function(){return this._anonymous},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"invalidated",{get:function(){return this._invalidated},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"persistUserData",{get:function(){return this._persistUserData},enumerable:!0,configurable:!0}),s.createAnonymousSession=function(e){var t=new s(e,r.User.createEphemeralUser(e));return t._anonymous=!0,t},s.prototype.createBindRequest=function(e,t,n,i,o){var a={collection_result:e.toJson(),public_key:n.publicKeyToJson(),encryption_public_key:i.publicKeyToJson(),push_token:t};return o&&(a.params=o),new r.SessionExchangeRequest("POST","auth/bind",a)},s.prototype.createLoginRequest=function(e,t,n,i){var o={collection_result:e.toJson(),push_token:t};return n&&(o.policy_request_id=n),i&&(o.params=i),new r.SessionExchangeRequest("POST","auth/login",o)},s.prototype.createAnonPolicyRequest=function(e,t,n,i){var o={collection_result:e.toJson(),push_token:t};return n&&(o.policy_request_id=n),i&&(o.params=i),new r.SessionExchangeRequest("POST","auth/anonymous_invoke",o)},s.prototype.createLogoutRequest=function(){return new r.SessionExchangeRequest("POST","auth/logout",{})},s.prototype.createApprovalsFetchRequest=function(e){var t={collection_result:e.toJson()};return new r.SessionExchangeRequest("POST","approvals/actions/fetch",t)},s.prototype.createApprovalReplyRequest=function(e,t,i){var o={collection_result:e.toJson(),status:i==n.MobileApprovalStatus.Approved?r.Protocol.ServerResponseDataApprovalsApprovalStatus.Approved:r.Protocol.ServerResponseDataApprovalsApprovalStatus.Denied};return new r.SessionExchangeRequest("POST","auth/approve?apid="+t,o)},s.prototype.createSingleDeviceFetchRequest=function(e,t,n){var i={collection_result:e.toJson(),device_id:n};return t&&(i.token=t),new r.SessionExchangeRequest("POST","mobile/device",i)},s.prototype.createDevicesFetchRequest=function(e,t){var n={collection_result:e.toJson()};return t&&(n.token=t),new r.SessionExchangeRequest("POST","mobile/devices",n)},s.prototype.createDeviceActionRequest=function(e,t,n,i,o){var a={collection_result:e.toJson(),device_id:n};return t&&(a.token=t),o&&Object.keys(o).forEach(function(e){a[e]=o[e]}),new r.SessionExchangeRequest("POST","mobile/device/action?action="+i,a)},s.prototype.createConfigMenuFetchRequest=function(e,t){var n={collection_result:e.toJson()};return t&&(n.token=t),new r.SessionExchangeRequest("POST","auth/authenticator/config_menu",n)},s.prototype.createAuthRegistrationRequest=function(e,t,n,i){var o={collection_result:e.toJson(),type:t};i&&(o.token=i);var a=n?"register":"unregister";return new r.SessionExchangeRequest("POST","auth/authenticator/"+a,o)},s.prototype.startControlFlow=function(e,t,i,o){var a=this;if(void 0===o&&(o=function(e){return e}),this._currentControlFlowProcessor){var s="Attempt to start a control flow while an existing control flow ("+this._currentControlFlowProcessor.challenge+") is running.";return this._sdk.log(n.LogLevel.Error,s),Promise.reject(new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.AppImplementation,s))}var c=new r.ControlFlowProcessor(this._sdk,this,i);return this._currentControlFlowProcessor=c,e.then(function(e){return a._sdk.log(n.LogLevel.Debug,"Start control flow"),new Promise(function(i,o){r.authenticationdrivers.SimpleAuthenticationDriverDescriptor.refreshInvalidatedAuthenticatorsEnrollments(a).catch(function(e){a._sdk.log(n.LogLevel.Warning,"Could not refresh invalidated authenticators enrollments: "+e)}).finally(function(){i(c.startControlFlow(e,t))})})}).then(function(e){return o(e)}).finally(function(){a._sdk.log(n.LogLevel.Debug,"Retire control flow "+c.challenge),a._currentControlFlowProcessor=null}).then(function(e){var t=e.getInternalData();if(t&&t.redirect){var o=t.redirect,s=o.policy_id||null,u=o.target.user_id||o.target.token;return c._uiHandler.handlePolicyRedirect(r.Protocol.RedirectTypeMap[o.redirect_type],s,u,o.params,i).then(function(e){switch(e.getRedirectResponse()){case n.RedirectResponseType.RedirectToPolicy:return a.processRedirectRequest(o,i);case n.RedirectResponseType.CancelRedirect:return Promise.reject(new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.UserCanceled,"Redirection to next policy canceled."))}})}return e})},s.prototype.getCurrentControlFlowProcessor=function(){return this._currentControlFlowProcessor},s.prototype.generateInvalidatedAuthenticatorsHeadersIfNeeded=function(){for(var e,t=new Array,i=0,o=r.LocalEnrollment.listInvalidatedLocalEnrollments(this);i<o.length;i++)if(e=o[i],this._sdk.log(n.LogLevel.Debug,"Found invalidated authenticator: "+e.authenticatorId),e.publicKeyHash){var a={type:"public_key_hash",hash:e.publicKeyHash},s={type:"registration_invalidated",method:e.authenticatorId,registration_id:a};t.push(s)}return t},s.prototype.processRedirectRequest=function(e,t){try{var i=e.policy_id||null,o=e.params;if("current"==e.target.type);else if("user_id"==e.target.type){var a=e.target.user_id||this._user.userId;if(!a)throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Internal,"failed to resolve user id for redirect request <"+e.redirect_type+", "+e.target.type+">");a!=this._user.userId&&(this._sdk.log(n.LogLevel.Debug,"User id in request is different than that of the current user <"+a+", "+this._user.userId+">"),this._user=r.User.findUser(this._sdk,a)||r.User.createUser(this._sdk,a,n.UserHandleType.UserId))}else{if("uid_token"!=e.target.type)throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Internal,"Unhandled redirect target type '"+e.target.type+"'");var s=e.target.token||this._user.idToken;if(!s)throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Internal,"failed to resolve id token for redirect request <"+e.redirect_type+", "+e.target.type+">");s!=this._user.idToken&&(this._sdk.log(n.LogLevel.Debug,"Id token in request is different than that of the current user <"+s+", "+this._user.idToken+">"),this._user=r.User.findUser(this._sdk,s)||r.User.createUser(this._sdk,s,n.UserHandleType.IdToken))}switch(this._sdk.log(n.LogLevel.Info,"control flow || type:"+e.redirect_type+" policy: "+i),e.redirect_type){case r.Protocol.RedirectTypeName.RedirectTypeNameAuthenticate:return this._sdk.internalAuthenticate(this._user,i,o,t);case r.Protocol.RedirectTypeName.RedirectTypeNameBind:return this._sdk.internalBind(this._user,o,t);case r.Protocol.RedirectTypeName.RedirectTypeNameInvokePolicy:return this._sdk.invokePolicy(i,o,t);case r.Protocol.RedirectTypeName.RedirectTypeNameBindOrAuthenticate:return this._user.deviceBound?this._sdk.internalAuthenticate(this._user,i,o,t):this._sdk.internalBind(this._user,o,t);default:throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Internal,"Unhandled redirect type '"+e.redirect_type+"'")}}catch(e){return Promise.reject(n.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},Object.defineProperty(s.prototype,"deviceSigningKeyPair",{get:function(){if(!this._deviceKeyPair&&!this._anonymous&&this._sdk.host.deviceSupportsCryptoBind()&&(this._deviceKeyPair=this._sdk.host.getKeyPair(this._user.deviceSigningKeyTag,t.sdkhost.KeyClass.StdSigningKey,t.sdkhost.KeyBiometricProtectionMode.None),!this._deviceKeyPair))throw this._sdk.log(n.LogLevel.Error,"Could not load device signing key pair for this device."),new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.InvalidDeviceBinding,"Invalid device signature - could not load device signing key pair.");return this._deviceKeyPair},enumerable:!0,configurable:!0}),s.prototype.performSessionExchange=function(e){return this.performSessionExchangeInternal(e,!0,!0)},s.prototype.performSessionExchangeInternal=function(e,t,i){var o=this;return this._invalidated?(this._sdk.log(n.LogLevel.Error,"Attempt to execute a session exchange from invalidated session."),Promise.reject(new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.SessionRequired,"Session was invalidated by server."))):this.connectionSettings().getCryptoMode()==n.ConnectionCryptoMode.Full&&!this._currentCryptoSession&&i?this.performSessionExchangeInternal(new r.SessionExchangeRequest("POST","auth/key_exchange",{r:"Hello Encrypted World"}),t).then(function(t){return o.performSessionExchangeInternal(e)}):(this._sdk.log(n.LogLevel.Debug,"Preprocess request "+JSON.stringify(e)),this.preprocessSessionExchangeRequest(e).then(function(i){return o.promisePossiblyEncryptedTransportRequest(i).then(function(i){return o.preprocessTransportRequest(i).then(function(i){return o._sdk.log(n.LogLevel.Debug,"Will send request "+JSON.stringify(i)),o._sdk.transportProvider.sendRequest(i).then(function(i){o._sdk.log(n.LogLevel.Debug,"Got response "+JSON.stringify(i));try{var a=JSON.parse(i.getBodyJson())}catch(e){throw n.impl.AuthenticationErrorImpl.errorForTransportResponse(i)}o.postprocessResponse(a);var s=(a=o.possiblyDecryptResponse(a)).data&&a.data.state==r.Protocol.AuthSessionState.Rejected;if(200==i.getStatus()&&!a.error_code||401==i.getStatus()&&s)return a;if(200==i.getStatus()||a.error_code){if(23==a.error_code&&t)return o._currentCryptoSession=null,o.performSessionExchangeInternal(e,!1,!0);throw n.impl.AuthenticationErrorImpl.errorForServerResponse(a)}throw n.impl.AuthenticationErrorImpl.errorForTransportResponse(i)})})})}))},s.prototype.cancelCurrentControlFlow=function(){this._currentControlFlowProcessor?this._currentControlFlowProcessor.cancelFlow():this._sdk.log(n.LogLevel.Error,"No current control flow.")},s.prototype.deviceId=function(){return this._deviceId},s.prototype.preprocessTransportRequest=function(e){var t=this,r={aid:this.connectionSettings().getAppId()};this._deviceId&&(r.did=this._deviceId),this._sessionId&&(r.sid=this._sessionId),e.setUrl(this.urlWithConcatenatedQuery(e.getUrl(),r));var i=e.getHeaders()||[],o=new n.TransportHeader;o.setName("X-TS-Client-Version"),o.setValue(this.clientVersionHeader),i.push(o);var a=new n.TransportHeader;a.setName("Authorization"),a.setValue("TSToken "+this.connectionSettings().getToken()+"; tid="+this.connectionSettings().getTokenName()),i.push(a);try{if(this._deviceId&&this.deviceSigningKeyPair)return this.generateSignatureForRequest(e).then(function(r){var o=new n.TransportHeader;return o.setName("Content-Signature"),o.setValue("data:"+r+";key-id:"+t._deviceId+";scheme:3"),i.push(o),e.setHeaders(i),e})}catch(e){return Promise.reject(e)}return e.setHeaders(i),Promise.resolve(e)},s.prototype.postprocessResponse=function(e){var t=this;e.headers&&e.headers.forEach(function(e){s.headerProcessors[e.type].call(t,e)})},s.prototype.encryptEnvelopedMessageIfNeeded=function(e){var t=this.generateKeyExchangeHeaderIfNeeded();this._currentCryptoSession&&this._currentCryptoSession.isReady()&&this._currentCryptoSession.encryptRequest(e),t&&e.headers.push(t)},s.prototype.promisePossiblyEncryptedTransportRequest=function(e){var t=this;return new Promise(function(r,i){var o={headers:e.envelopeHeaders,data:e.body};t.encryptEnvelopedMessageIfNeeded(o);var a=new n.TransportRequest,s=t._sdk.host.transformApiPath(e.serverRelativeUrl);a.setMethod(e.method);var c=t._sdk.connectionSettings.getRealm()||"",u=c.length?"/"+c:"";a.setUrl(""+t._sdk.connectionSettings.getServerAddress()+u+"/api/v2/"+s),a.setBodyJson(JSON.stringify(o)),r(a)})},s.prototype.possiblyDecryptResponse=function(e){return this._currentCryptoSession&&this._currentCryptoSession.isReady()&&(e=this._currentCryptoSession.decryptResponse(e)),e},s.prototype.generateKeyExchangeHeaderIfNeeded=function(){return this.connectionSettings().getCryptoMode()==n.ConnectionCryptoMode.None||this._currentCryptoSession?null:(this._currentCryptoSession=new r.Scheme2CryptoSession(this._sdk),this._currentCryptoSession.getExchangeRequestHeader())},s.prototype.preprocessSessionExchangeRequest=function(e){var t=this;return new Promise(function(r,i){var o=t.generateUserIDHeaderIfNeeded();o&&e.addEnvelopeHeader(o);var c=t.generateInvalidatedAuthenticatorsHeadersIfNeeded();if(c)for(var u=0,l=c;u<l.length;u++){var d=l[u];e.addEnvelopeHeader(d)}var h=Promise.resolve(!0),p=new a(e);s.messageFilteringExtensionPoint.forEach(function(e){h=h.then(function(r){return e.filterMessage(t.createPluginSessionInfo(),p).catch(function(e){return t.sdk.log(n.LogLevel.Warning,"Error during message filtering: "+e),!0})})}),h.then(function(t){return r(e)},i)})},s.prototype.generateUserIDHeaderIfNeeded=function(){if(this._anonymous){if(this._user.ephemeralUserId)return{type:"uid",uid:this._user.ephemeralUserId}}else{if(this._user.userId)return{type:"uid",uid:this._user.userId};if(this._user.idToken)return{type:"uid_token",token:this._user.idToken}}return null},s.prototype.processKeyExchangeResponseHeader=function(e){this._currentCryptoSession&&this._currentCryptoSession.processExchangeResponseHeader(e)},s.prototype.generateSignatureForRequest=function(e){var t=e.getUrl(),r=t.indexOf("?");if(r>0){var i=e.getUrl().substring(r+1);t=e.getUrl().substring(0,r)+"?"+i.split("&").sort().join("&")}var o=/%%/g,a=t.substr(this.connectionSettings().getServerAddress().length).replace(o,"\\%")+"%%"+this.clientVersionHeader.replace(o,"\\%")+"%%"+e.getBodyJson().replace(o,"\\%"),s=n.util.asciiToHex(a);return this.deviceSigningKeyPair.signHex(s).then(function(e){return n.util.hexToBase64(e)})},s.prototype.connectionSettings=function(){return this._sdk.connectionSettings},s.prototype.processSessionIdHeader=function(e){this._sdk.log(n.LogLevel.Debug,"Processing session ID header "+e),this._sessionId=e.session_id},s.prototype.processDeviceIdHeader=function(e){this._sdk.log(n.LogLevel.Debug,"Processing Device ID header "+e),this._deviceId?this._deviceId!=e.device_id&&this._sdk.log(n.LogLevel.Warning,"Received device ID "+e.device_id+" in a session with an existing device id "+this._deviceId):(this._user.setProvisionalDeviceId(e.device_id),this._deviceId=e.device_id)},s.prototype.processSessionStateChangeHeader=function(e){switch(this._sdk.log(n.LogLevel.Debug,"Processing session state change header "+e+" to state "+e.state),e.state){case r.Protocol.SessionStateChangeState.Closed:this._sdk.log(n.LogLevel.Debug,"Invalidating session."),this._invalidated=!0;break;default:throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Communication,"Invalid session state change encountered in header.")}},s.prototype.processSessionEphemeralUserHeader=function(e){this._sdk.log(n.LogLevel.Debug,"Processing ephemeral user Id header "+e),this._user.updateEphemeralUserId(e.uid)},s.prototype.noHeaderProcessing=function(e){},s.prototype.processEncryptedSharedSecretHeader=function(e){},s.prototype.processDisplayNameHeader=function(e){this._sdk.log(n.LogLevel.Debug,"Processing display name header '"+e.display_name+"'"),r.User.updateUserDisplayName(e.display_name,this._user,this._sdk)},s.prototype.processUidTokenHeader=function(e){this._sdk.log(n.LogLevel.Debug,"Processing uid_token header '"+e.token+"'"),r.User.updateUserIdToken(e.token,this._user,this._sdk)},s.prototype.urlWithConcatenatedQuery=function(e,t){var n="";return e.indexOf("?")<0?n="?":"&"!=e[e.length-1]&&(n="&"),e+n+Object.keys(t).map(function(e){return e+"="+encodeURIComponent(t[e])}).join("&")},Object.defineProperty(s.prototype,"clientVersionHeader",{get:function(){if(!this._cachedClientVersionHeader){var e=this._sdk.getClientFeatureSet().join(",");this._cachedClientVersionHeader=this._sdk.getVersionInfo().getSdkVersion()+";["+e+"]"}return this._cachedClientVersionHeader},enumerable:!0,configurable:!0}),s.prototype.createPluginSessionInfo=function(){return new o(this)},s.prototype.lock=function(){this._sdk.log(n.LogLevel.Debug,"Locking session "+this._sessionId),this._lockCount++},s.prototype.unlock=function(){if(this._sdk.log(n.LogLevel.Debug,"Unlocking session "+this._sessionId),--this._lockCount<0)throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Internal,"Unbalanced session locking: Attempt to unlock an already unlocked sessoin.")},s.prototype.canTerminate=function(){return!this._lockCount},s.prototype.toJson=function(){var e={session_id:this._sessionId,user_name:this._user.displayName,device_id:this._deviceId,invalidated:this._invalidated,user:r.User.toUserRecord(this._user),persistUserData:this._persistUserData};return this._currentCryptoSession&&this._currentCryptoSession.isReady()&&(e.c_session=this._currentCryptoSession.toJson()),e},s.fromJson=function(e,t){var i=t,o=r.User.fromUserRecord(i.user,e);if(o||r.User.findUser(e,i.user_name),!o)throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.Internal,"Can't deserialize session -- user "+i.user_name+" not found.");var a=new s(e,o);return a._sessionId=i.session_id,a._deviceId=i.device_id,a._invalidated=i.invalidated||!1,a._persistUserData=i.persistUserData||!0,i.c_session&&(a._currentCryptoSession=r.Scheme2CryptoSession.fromJson(e,i.c_session)),a},s.notifySessionObserversOnMainSessionLogin=function(e){var t=e.createPluginSessionInfo();this.sessionObservationExtensionPoint.forEach(function(e){e.mainSessionStarted(t)})},s.notifySessionObserversOnMainSessionLogout=function(e){var t=e.createPluginSessionInfo();this.sessionObservationExtensionPoint.forEach(function(e){e.mainSessionEnded(t)})},s.headerProcessors={session_id:s.prototype.processSessionIdHeader,device_id:s.prototype.processDeviceIdHeader,encrypted_shared_secret:s.prototype.processEncryptedSharedSecretHeader,session_state:s.prototype.processSessionStateChangeHeader,ephemeral_uid:s.prototype.processSessionEphemeralUserHeader,key_exchange:s.prototype.processKeyExchangeResponseHeader,encryption:s.prototype.noHeaderProcessing,display_name:s.prototype.processDisplayNameHeader,uid_token:s.prototype.processUidTokenHeader},s.messageFilteringExtensionPoint=new r.ExtensionPoint(t.tarsusplugin.TARSUS_EXTENSION_POINT_NAME_MESSAGE_FILTERS),s.sessionObservationExtensionPoint=new r.ExtensionPoint(t.tarsusplugin.TARSUS_EXTENSION_POINT_NAME_SESSION_OBSERVERS),s}(r.BaseSession);r.Session=i;var o=function(){function e(e){this._underlying=e}return e.prototype.getUsername=function(){return this._underlying.user.displayName},e}(),a=function(){function e(e){this._underlying=e}return e.prototype.getMethod=function(){return this._underlying.method},e.prototype.getBody=function(){return this._underlying.body},e.prototype.getHeaders=function(){return this._underlying.envelopeHeaders},e.prototype.addHeader=function(e){this._underlying.addEnvelopeHeader(e)},e}()}((n=t.sdk||(t.sdk={})).core||(n.core={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t,n,r){this._requestMethod=e,this._requestServerRelativeUrl=t,this._requestBody=n,this._envelopeHeaders=r||[]}return e.prototype.addEnvelopeHeader=function(e){this._envelopeHeaders.push(e)},Object.defineProperty(e.prototype,"method",{get:function(){return this._requestMethod},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"serverRelativeUrl",{get:function(){return this._requestServerRelativeUrl},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return this._requestBody},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"envelopeHeaders",{get:function(){return this._envelopeHeaders},enumerable:!0,configurable:!0}),e}();e.SessionExchangeRequest=t}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(n){var r=function(){function e(e){this._sdk=e}return e.prototype.extend=function(e,t){n.ExtensionPoint.byName(e).extend(t)},e.prototype.getSdk=function(){return this._sdk},e.prototype.generateRandomHexString=function(e){return this._sdk.host.generateRandomHexString(e)},e}();n.TarsusPluginHostImpl=r;var i=function(){function n(e){this._installedPluginsAndConfigs={},this._initializedPlugins=[],this._sdk=e,this._pluginHost=new r(this._sdk)}return n.prototype.getInitializedPlugins=function(){return this._initializedPlugins.concat([])},n.prototype.installPlugin=function(e,n){if(this._installedPluginsAndConfigs[e])throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to install plugin "+e+" twice.");this._installedPluginsAndConfigs[e]=n},n.prototype.initializePlugins=function(){var n=this;this._sdk.log(t.LogLevel.Debug,"Starting plugin initialization...");var r=Object.keys(this._installedPluginsAndConfigs).map(function(r){return n._sdk.log(t.LogLevel.Debug,"Loading plugin "+r+"..."),n._sdk.host.loadPlugin(r).then(function(i){var o=i.getPluginInfo(),a=e.tarsusplugin.impl.PluginInfoImpl.toString(o);if(i.getPluginInfo().getPluginName()!=r)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Plugin "+r+": getPluginInfo() reported mismatched name -- "+a+".");return n._sdk.log(t.LogLevel.Info,"Initializing plugin "+a+"..."),i.initialize(n._pluginHost,n._installedPluginsAndConfigs[r]).then(function(){n._initializedPlugins.push(i)}).catch(function(e){n._sdk.log(t.LogLevel.Error,"Couldn't initialize plugin "+a+": "+e)})})});return Promise.all(r).then(function(){n._sdk.log(t.LogLevel.Debug,"Plugin initialization completed sucessfuly")})},n}();n.TarsusPluginManager=i})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(t){var n=function(){function e(){}return e.prototype.toString=function(){return this._guidStr},e.prototype.equalString=function(e){return this._guidStr==e},e.prototype.equalsUserGuid=function(e){return this.toString()==e.toString()},e.createWithLength=function(t,n){var r=new e;return r._guidStr=n.host.generateRandomHexString(t),r},e.createFromString=function(t){var n=new e;return n._guidStr=t,n},e}();t.UserGuid=n;var r=function(){function r(){}return Object.defineProperty(r.prototype,"guid",{get:function(){return this._guid},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"userId",{get:function(){return this._userId},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"displayName",{get:function(){return this._displayName||this._userId},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"idToken",{get:function(){return this._idToken},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"deviceId",{get:function(){return this._deviceId},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"phoneNumber",{get:function(){return this._phoneNumber},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"defaultAuthId",{get:function(){return this._defaultAuthId},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"deviceBound",{get:function(){return this._deviceBound},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"hasLoggedIn",{get:function(){return this._hasLoggedIn},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"deviceSigningKeyTag",{get:function(){return new t.TarsusKeyPath("per_user",this._guid.toString(),"device_key")},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"deviceEncryptionKeyTag",{get:function(){return new t.TarsusKeyPath("per_user",this._guid.toString(),"enc_enabled")},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"ephemeralUserId",{get:function(){return this._ephemeralUserId},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"userHandle",{get:function(){return this._userId||this._idToken},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"userHandleType",{get:function(){return this._userId?e.UserHandleType.UserId:e.UserHandleType.IdToken},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"localEnrollments",{get:function(){return this._localEnrollments||(this._localEnrollments=t.LocalEnrollment.enrollmentsForUser(this,this._sdk)),this._localEnrollments},enumerable:!0,configurable:!0}),r.prototype.updateDefaultAuthId=function(e){this._defaultAuthId=e},r.prototype.updateEphemeralUserId=function(t){if(!this._ephemeral)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid ephemeral user name update reaquest header, user is not ephemeral.");if(this._ephemeralUserId)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to set an ephemeral userId after it has already been updated once.");this._ephemeralUserId=t},r.updateUserDisplayName=function(e,t,n){t._displayName=e,n.currentSession&&n.currentSession.persistUserData&&r.save(n,t)},r.updateUserIdToken=function(e,t,n){t._idToken=e,delete t._userId,n.currentSession&&n.currentSession.persistUserData&&r.save(n,t)},r.prototype.setProvisionalDeviceId=function(t){if(this.deviceBound)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to record a provisional device ID for an already bound user record.",{});this._deviceId=t},r.prototype.bindDeviceToUser=function(t){if(this.deviceBound)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to record a device for an already bound user record.",{});if(this._deviceId!=t)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to bind user to a device ID different than provisional device ID.",{});this._deviceBound=!0},r.prototype.markLoggedIn=function(){this._hasLoggedIn=!0},r.iterateUsers=function(e,t){for(var n=e.host.readStorageKey(r.storageKey),i=0;i<n.length;i++){var o=t(r.fromUserRecord(n[i],e));if(null!=o)return o}return e.currentSession?t(e.currentSession.user):null},r.findUser=function(e,t){return r.iterateUsers(e,function(e){return e.userHandle.toLowerCase()==t.toLowerCase()?e:null})},r.createUser=function(t,i,o){if(!i)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"userHandle must not be empty");var a=new r;return o==e.UserHandleType.UserId?a._userId=i:a._idToken=i,a._guid=n.createWithLength(32,t),a._deviceBound=!1,a._hasLoggedIn=!1,a._phoneNumber="",a._sdk=t,a._ephemeral=!1,a},r.createEphemeralUser=function(e){var t=new r;return t._guid=n.createWithLength(32,e),t._deviceBound=!1,t._hasLoggedIn=!1,t._phoneNumber="",t._sdk=e,t._ephemeral=!0,t._ephemeralUserId=null,t},r.deleteUser=function(t,n){var i=n.host.readStorageKey(r.storageKey);n.log(e.LogLevel.Warning,"=== CURRENTL LEN    "+i.length);for(var o=0;o<i.length;o++){var a=r.fromUserRecord(i[o],n);if(t.guid.equalsUserGuid(a.guid))break}if(o<i.length){for(;o<i.length-1;)i[o]=i[o+1],o++;var s=i.length-1;delete i[i.length-1],n.log(e.LogLevel.Warning,"=== CURRENTL LEN2    "+i.length),i.length=s,n.log(e.LogLevel.Warning,"=== CURRENTL LEN3    "+i.length),n.host.writeStorageKey(r.storageKey,i)}else n.log(e.LogLevel.Warning,"Attempt to delete nonexisting user "+t.userHandle)},r.prototype.createEnrollmentRecord=function(e,n,r,i,o){var a=t.LocalEnrollment.createNew(e,n,r,this._sdk,o);return a.status=i,a},r.prototype.updateEnrollmentRecord=function(n){if(this._ephemeral)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to update enrollment record for ephemeral user.",{});var r={};for(var i in this.localEnrollments)r[i]=this.localEnrollments[i];r[n.authenticatorId]=n,t.LocalEnrollment.updateEnrollmentsForUser(this,r,this._sdk),this._localEnrollments=r},r.toUserRecord=function(e){return{default_auth_id:e._defaultAuthId,device_bound:e._deviceBound,has_logged_in:e._hasLoggedIn,device_id:e._deviceId,last_auth:"<null>",guid:e._guid.toString(),user_id:e.userId,display_name:e._displayName,id_token:e._idToken,user_number:e._phoneNumber,schemeVersion:"v0"}},r.save=function(t,n){if(n._ephemeral)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to save ephemeral user record to persistent store.",{});var i=t.host.readStorageKey(r.storageKey);i.length=i.length||0;for(var o=0;o<i.length&&!r.fromUserRecord(i[o],t).guid.equalsUserGuid(n.guid);o++);i[o]=r.toUserRecord(n),i.length<o+1&&(i.length=o+1),t.host.writeStorageKey(r.storageKey,i)},r.fromUserRecord=function(e,t){var i=new r;return i._sdk=t,i._defaultAuthId=e.default_auth_id,i._deviceBound=e.device_bound,i._hasLoggedIn=e.has_logged_in,i._deviceId=e.device_id,i._phoneNumber=e.user_number,i._userId=e.user_id,i._idToken=e.id_token,"v0"===e.schemeVersion?(i._guid=n.createFromString(e.guid),i._displayName=e.display_name):(i._guid=n.createFromString(e.user_id),i._displayName=e.user_id),i},r.storageKey=new t.TarsusKeyPath("users"),r}();t.User=r}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){e.InternalErrorWrongBiometric=1e3,e.InternalErrorBiometricInvalidated=1001,e.InternalErrorBiometricKeyStoreError=1002,e.InternalErrorBiometricNotConfigured=1003,e.InternalErrorBiometricOsLockTemporary=1004,e.InternalErrorBiometricOsLockPermanent=1005,e.InternalErrorBiometricFallbackPressed=1006,e.ErrorDataInternalError="internal_error",e.ErrorDataNumFailures="num_failures",e.ErrorDataServerErrorCode="server_error_code",e.ErrorDataServerErrorMessage="server_error_message",e.ErrorDataServerErrorData="server_error_data",e.ErrorDataRetriesLeft="retries",e.ErrorDataCommunicationError="communication_error",e.ErrorDataCommunicationSSL="ssl",e.FeatureCodeServerHeaders=1,e.FeatureCodeAuthFailover=2,e.FeatureCodeUnifiedRegFlow=3,e.FeatureCodePromotionAction=6,e.FeatureCodeSilentFingerprintRegistration=7,e.FeatureCodeMultiMethodRegistrationAction=8,e.FeatureCodeOtpCodeInvalidated=10,e.FeatureCodeEnvelopedClientRequest=11,e.FeatureCodeUnregistrationFlow=12,e.FeatureCodeFaceIdAuthentication=13,e.FeatureCodeDynamicPolicySupport=14,e.FeatureCodeAutoRequestForSignContent=19}(e.sdkhost||(e.sdkhost={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){t.TARSUS_VERSION="4.2.0",t.API_LEVEL=8,t.STATIC_FEATURE_SET=[e.sdkhost.FeatureCodeServerHeaders,e.sdkhost.FeatureCodeAuthFailover,e.sdkhost.FeatureCodeUnifiedRegFlow,e.sdkhost.FeatureCodePromotionAction,e.sdkhost.FeatureCodeSilentFingerprintRegistration,e.sdkhost.FeatureCodeMultiMethodRegistrationAction,e.sdkhost.FeatureCodeOtpCodeInvalidated,e.sdkhost.FeatureCodeEnvelopedClientRequest,e.sdkhost.FeatureCodeUnregistrationFlow,e.sdkhost.FeatureCodeDynamicPolicySupport]})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(){function t(e,t){this._controlFlowProcessor=e,this._action=t,this._sdk=this._controlFlowProcessor._sdk,this._uiHandler=this._controlFlowProcessor._uiHandler,this._clientContext=this._controlFlowProcessor._clientContext}return t.prototype.cancelRun=function(){},t.prototype.policyAction=function(){return this._policyAction||(this._policyAction=new e.impl.PolicyActionImpl(this._action)),this._policyAction},t.prototype.sendAssertionRequest=function(t,n,r){var i=this._controlFlowProcessor.createAssertionRequest(this._action,t,n,r);return e.util.wrapPromiseWithActivityIndicator(this._uiHandler,this.policyAction(),this._clientContext,this._controlFlowProcessor._session.performSessionExchange(i).then(function(t){if(!t.data)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Communication,"Invalid response to assertion.",{responseBody:JSON.stringify(t)});return t.data}))},t}();t.ActionDriver=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(n,r){var i=t.call(this,n,r)||this;return i._clientContext=i._controlFlowProcessor._clientContext,i._cancellationHolder=new e.util.CancelablePromiseHolder,i}return __extends(n,t),n.prototype.run=function(){var t=this;return this._cancellationHolder.resolveWith(function(e,n){t.doRunAction().then(e,n)}),this._cancellationHolder.cancellablePromise.catch(function(n){if(n==e.util.CancelablePromiseHolder.CancelRequest)return t._controlFlowProcessor.createExternalCancellationRejectionPromise();throw n})},n.prototype.cancelRun=function(){this._cancellationHolder.cancel()},n}(t.ActionDriver);t.SimpleCancellationActionDriver=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(n){var r=function(e){function t(t,n,r,i,o,a,s,c){var u=e.call(this,s._controlFlowProcessor._session,t,n,r)||this;return u._assertionId=i,u._retriesLeft=o,u._actionDriver=s,u._fallback=a,u._registration=c,u}return __extends(t,e),Object.defineProperty(t.prototype,"authDriver",{get:function(){return this._authDriver||(this._authDriver=this.authenticationDriverDescriptor.createAuthenticationDriver(this._actionDriver,this._authenticatorMethodConfig,this)),this._authDriver},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"suggestedParameters",{get:function(){return this.getEnabled()?this.authenticationDriverDescriptor.suggestParameters(this._authenticatorMethodConfig,this):[]},enumerable:!0,configurable:!0}),t.prototype.getEnabled=function(){return(this._registration||this.getRegistered()&&!this.getLocked())&&this.getSupportedOnDevice()},Object.defineProperty(t.prototype,"fallback",{get:function(){return this._fallback},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"assertionId",{get:function(){return this._assertionId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"retriesLeft",{get:function(){return this._retriesLeft},enumerable:!0,configurable:!0}),t.prototype.updateWithAssertionResult=function(e){e.retries_left&&(this._retriesLeft=e.retries_left),e.locked&&(this._locked=e.locked)},t.fromUnregistrationAction=function(e,n){return new t(e.method,e,e,e.assertion_id,null,null,n,!1)},t.fromPromotionAction=function(e,n){return new t(e.method,e,e,e.assertion_id,e.retries_left,e.fallback||null,n,!0)},t.fromAuthenticationActionMenuOption=function(e,n){return new t(e.type,e,e,e.assertion_id,e.retries_left,e.fallback||null,n,!1)},t.fromRegistrationAction=function(e,n){return new t(e.method,e,e,e.assertion_id,null,null,n,!0)},t}(t.authenticationdrivers.AuthenticatorDescriptionImpl);n.AuthenticationMenuAuthenticator=r;var i=function(t){function n(e,n){var r=t.call(this,e,n)||this;return r._externallyCancelled=!1,r}return __extends(n,t),n.prototype.doRunAction=function(){var e=this;return new Promise(function(t,n){e._completionFunction=t,e._rejectionFunction=n,e.runActionWithCompletionFunctions()})},Object.defineProperty(n.prototype,"availableAuthenticatorsForSwitching",{get:function(){return this.availableAuthenticators},enumerable:!0,configurable:!0}),n.prototype.sendAuthenticatorAssertionRequest=function(t,n,r,i){this._sdk.log(e.LogLevel.Debug,"Sending authenticator asserion request for "+t.getAuthenticatorId()+": assert="+n);var o={assertion_id:t.assertionId,method:t.getAuthenticatorId()};if(i)for(var a in i)o[a]=i[a];return this.sendAssertionRequest(n,r,o)},n.prototype.completeAuthenticationWithAssertionResult=function(e){this._completionFunction(e)},n.prototype.completeAuthenticationWithError=function(e){this._rejectionFunction(e)},n.prototype.prepareForRunningAuthenticationDriver=function(e){return this._externallyCancelled?(this.completeAuthenticationWithError(this._controlFlowProcessor.createExternalCancellationError()),!1):(this._runningAuthenticatorDriver=e,!0)},n.prototype.cancelRun=function(){this._externallyCancelled=!0,this._runningAuthenticatorDriver&&this._runningAuthenticatorDriver.onCancelRun(),t.prototype.cancelRun.call(this)},n}(n.SimpleCancellationActionDriver);n.ActionDriverAuthenticatorOp=i})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.actiondrivers||(t.actiondrivers={}),r=function(r){function i(e,t){return r.call(this,e,t)||this}return __extends(i,r),i.prototype.runActionWithCompletionFunctions=function(){var n=this._action;this._sdk.log(e.LogLevel.Debug,"Loading authenticator descriptions"),this.loadAuthenticatorDescriptionsFromAction(n),this._shouldUpdateDefaultAuth=n.options&&n.options.update_default,this._sdk.log(e.LogLevel.Debug,"Starting auth presentation"),this.runWithPresentationMode(n.options&&n.options.start_with||t.Protocol.AuthMenuPresentationMode.DefaultAuthenticator)},Object.defineProperty(i.prototype,"availableAuthenticators",{get:function(){return this.updateAvailableAuthenticatorsList(),this._availableAuthenticators.concat([])},enumerable:!0,configurable:!0}),i.prototype.runWithPresentationMode=function(n,r){var i=this;this.updateAvailableAuthenticatorsList();var o=n==t.Protocol.AuthMenuPresentationMode.AuthenticatorMenu&&this._uiHandler.shouldIncludeDisabledAuthenticatorsInMenu(this.policyAction(),this._clientContext)?this._allAuthenticators:this._availableAuthenticators;if(r&&(o=o.filter(function(e){return r.filter(function(t){return t.getAuthenticatorId()==e.getAuthenticatorId()}).length>0})),o.length)switch(n){case t.Protocol.AuthMenuPresentationMode.AuthenticatorMenu:var a=o.map(function(t){return new e.impl.AuthenticationOptionImpl(t,t.suggestedParameters)});this._uiHandler.selectAuthenticator(a,this.policyAction(),this._clientContext).then(function(t){switch(t.getResultType()){case e.AuthenticatorSelectionResultType.Abort:i.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Cancel during authenticator selection."));break;case e.AuthenticatorSelectionResultType.SelectAuthenticator:if(!(a.filter(function(e){return e.getAuthenticator()==t.getSelectedAuthenticator()}).length>0)){i.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"selectAuthenticator returned an authenticator not within options."));break}if(!t.getSelectedAuthenticator().getEnabled()){i.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"selectAuthenticator returned a non-enabled authenticator."));break}i.runAuthenticator(t.getSelectedAuthenticator(),t.getSelectedAuthenticationParameters())}});break;case t.Protocol.AuthMenuPresentationMode.DefaultAuthenticator:this._defaultAuthenticator&&this._availableAuthenticators.indexOf(this._defaultAuthenticator)>=0?this.runAuthenticator(this._defaultAuthenticator,[]):(this._sdk.log(e.LogLevel.Warning,"Default authenticator for user not found. Falling back to first authenticator in list."),this.runAuthenticator(this._availableAuthenticators[0],[]));break;case t.Protocol.AuthMenuPresentationMode.FirstAuthenticator:this.runAuthenticator(this._availableAuthenticators[0],[])}else this._allAuthenticators.filter(function(e){return e.getLocked()}).length>0?this.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AllAuthenticatorsLocked,"All authenticators locked.")):this.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.NoRegisteredAuthenticator,"No registered authenticator available."))},i.prototype.loadAuthenticatorDescriptionsFromAction=function(e){var t=this;this._allAuthenticators=e.methods.map(function(e){return n.AuthenticationMenuAuthenticator.fromAuthenticationActionMenuOption(e,t)})},i.prototype.updateAvailableAuthenticatorsList=function(){var t=this;this._defaultAuthenticator=null,this._availableAuthenticators=[],this._allAuthenticators.forEach(function(e){e.getEnabled()&&t._availableAuthenticators.push(e),e.getDefaultAuthenticator()&&(t._defaultAuthenticator=e)}),this._defaultAuthenticator||(this._defaultAuthenticator=this._availableAuthenticators[0]),this._sdk.log(e.LogLevel.Debug,"Updated available authenticators list; "+this._availableAuthenticators.length+" available authenticators")},i.prototype.runAuthenticator=function(n,r){var i=this,o=n.authDriver;this.prepareForRunningAuthenticationDriver(o)&&o.runAuthentication(r).then(function(r){if(r instanceof t.authenticationdrivers.AuthenticationDriverSessionResultSwitchAuthenticator)r.requiredAuthenticator?i.runAuthenticator(r.requiredAuthenticator,[]):i.runWithPresentationMode(t.Protocol.AuthMenuPresentationMode.AuthenticatorMenu,r.allowedAuthenticators);else if(r instanceof t.authenticationdrivers.AuthenticationDriverSessionResultAuthenticationCompleted){if(i._shouldUpdateDefaultAuth&&(i._sdk.log(e.LogLevel.Info,"Updating user default authenticator."),!i._controlFlowProcessor._session.anonymous)){var o=i._controlFlowProcessor._session.user;o.updateDefaultAuthId(n.getAuthenticatorId()),i._controlFlowProcessor._session.persistUserData&&t.User.save(i._sdk,o)}i.completeAuthenticationWithAssertionResult(r.assertionResult)}else i.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unknown authentication driver result type encountered."))},function(t){i._sdk.log(e.LogLevel.Debug,"Received authentication driver error "+t),i.completeAuthenticationWithError(t)})},i}(n.ActionDriverAuthenticatorOp),n.ActionDriverAuthentication=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(e,t){return n.call(this,e,t)||this}return __extends(r,n),r.prototype.doRunAction=function(){var n=this;this._sdk.log(e.LogLevel.Debug,"Executing confirmation action.");var r=this._action;return this._uiHandler.getConfirmationInput(r.title,r.text,r.continue_button_text,r.cancel_button_text,this.policyAction(),this._clientContext).then(function(i){var o={user_cancelled:1==i.getUserChoice()},a=Promise.resolve(o);if(r.require_sign_content){var s={params:{title:r.title,text:r.text,continue_button_text:r.continue_button_text,cancel_button_text:r.cancel_button_text,parameters:r.parameters,image:r.image},user_input:o.user_cancelled?r.cancel_button_text:r.continue_button_text};a=a.then(function(e){return t.ActionDriverSignContent.augmentAssertionDataWithSignedContent(e,s,n._controlFlowProcessor._session.deviceSigningKeyPair,n._sdk)})}return a.then(function(t){return n._sdk.log(e.LogLevel.Debug,"Asserting confirmation: "+t),n.sendAssertionRequest(null,t).then(function(e){return e})})})},r}(t.SimpleCancellationActionDriver);t.ActionDriverConfirmation=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.actiondrivers||(t.actiondrivers={}),r=function(n){function r(e,t){return n.call(this,e,t)||this}return __extends(r,n),r.prototype.doRunAction=function(){var n=this;this._sdk.log(e.LogLevel.Debug,"Executing disable TOTP action...");var r=this._action,i=t.totp.TotpPropertiesProcessor.createWithUser(this._controlFlowProcessor._session.user,this._sdk,this._clientContext,this._controlFlowProcessor._session);return this._sdk.log(e.LogLevel.Debug,"Obtained TOTP processor."),r.config_ids.forEach(function(t){n._sdk.log(e.LogLevel.Debug,"Deleting TOTP processor "+t+"."),i.deleteProvisionForGenerator(t),n._sdk.log(e.LogLevel.Debug,"TOTP processor "+t+" deleted.")}),this.sendAssertionRequest()},r}(n.SimpleCancellationActionDriver),n.ActionDriverDisableTotp=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.actiondrivers||(t.actiondrivers={}),r=function(n){function r(t,r){var i=n.call(this,t,r)||this;return i.onPromiseResult=function(t){switch(t.getControlRequest()){case e.FormControlRequest.Submit:var n={input:t.getJsonData()};i.request(n);break;case e.FormControlRequest.Abort:i.session.endSession(),i.rejectionFunction(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"User cancelled a form action."))}},i}return __extends(r,n),r.prototype.doRunAction=function(){var t=this,n=this._action,i=r.formExtensionPoint.firstNonNull(function(e){return e.createFormSession(n.form_id,n.app_data)});return i?(this._sdk.log(e.LogLevel.Debug,'Using extension of type "com.ts.mobile.plugins.form.settings" for formId '+n.form_id),this.session=i):this.session=this._uiHandler.createFormSession(n.form_id,n.app_data),this.session?new Promise(function(r,i){t.completionFunction=r,t.rejectionFunction=i,t.session.startSession(t._clientContext,new e.impl.PolicyActionImpl(n)),t.session.promiseFormInput().then(t.onPromiseResult)}):Promise.reject(e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createFormSession."))},r.prototype.request=function(e){var n=this;this.sendAssertionRequest(null,null,e).then(function(e){var r=e.data;switch(e.assertion_error_code){case t.Protocol.AssertionErrorCode.NotFinished:n.session.onContinue(r),n.session.promiseFormInput().then(n.onPromiseResult);break;case t.Protocol.AssertionErrorCode.RepeatCurrentStep:n.session.onError(r),n.session.promiseFormInput().then(n.onPromiseResult);break;default:n.session.endSession(),n.completionFunction(e)}}).catch(function(e){n.session.endSession(),n.rejectionFunction(e)})},r.formExtensionPoint=new t.ExtensionPoint("com.ts.mobile.plugins.form.settings"),r}(n.SimpleCancellationActionDriver),n.ActionDriverForm=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n){return t.call(this,e,n)||this}return __extends(n,t),n.prototype.doRunAction=function(){var t=this;this._sdk.log(e.LogLevel.Debug,"Executing information action.");var n=this._action;return this._uiHandler.getInformationResponse(n.title,n.text,n.button_text,this.policyAction(),this._clientContext).then(function(n){if(t._sdk.log(e.LogLevel.Debug,"Asserting information"),-1!=n.getUserChoice())throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"ConfirmationInput.getUserChoice must be set to -1.");return t.sendAssertionRequest()})},n}(t.SimpleCancellationActionDriver);t.ActionDriverInformation=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n){return t.call(this,e,n)||this}return __extends(n,t),n.prototype.run=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"Executing JSON data action."),this.sendAssertionRequest().then(function(r){return t._sdk.log(e.LogLevel.Debug,"Executing JSON data action: "+r),n.handleJsonDataByUiHandler(t._uiHandler,r,r.data.json_data,t._policyAction,t._clientContext)})},n.handleJsonDataByUiHandler=function(t,n,r,i,o){return t.processJsonData(r,i,o).then(function(t){if(t.getContinueProcessing())return n;throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"User cancelled a JSON action.")})},n}(t.ActionDriver);t.ActionDriverJsonData=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(n){var r=function(){};n.Stragety=r;var i=function(r){function i(e,t){var n=r.call(this,e,t)||this;return n.isAssertionContainerNotComplete=!1,n}return __extends(i,r),i.prototype.runActionWithCompletionFunctions=function(){var t=this;if(this._sdk.log(e.LogLevel.Debug,"ActionDriverPromotion#runActionWithCompletionFunctions() started"),this._action=this._action,this._action.assertions.length<1)return this._sdk.log(e.LogLevel.Info,"runActionWithCompletionFunctions() Promotion has no assertions, finishing action."),void this.completeWithDeclineAssertion();if(!this.shouldDisplayPromotion())return this._sdk.log(e.LogLevel.Info,"runActionWithCompletionFunctions() Promotion stragety stop, finishing action."),void this.completeWithDeclineAssertion();if(this._session=this._uiHandler.createRegistrationPromotionSession(this._controlFlowProcessor._session.user.displayName,this._policyAction),this._session){this._session.startSession(this._clientContext,new e.impl.PolicyActionImpl(this._action));var r=this._action.options;this._session.promptIntroduction(r.title,r.text,r.ok_button,r.decline_button).then(function(e){if(t.handlePromotionInputControlRequest(e)){for(var r=t._action.assertions,i=new Array,o=0;o<r.length;o++){var a=n.AuthenticationMenuAuthenticator.fromPromotionAction(r[o],t);a.getSupportedOnDevice()&&i.push(a)}t._authenticatorList=i,t.suggestAuthenticators()}})}else this._rejectionFunction(e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createRegistrationPromotionSession."))},i.prototype.sendAssertionRequest=function(e,n,i){var o=this;return this.isAssertionContainerNotComplete=!1,r.prototype.sendAssertionRequest.call(this,e,n,i).then(function(e){return e.assertion_error_code==t.Protocol.AssertionErrorCode.AssertionContainerNotComplete&&(e.assertion_error_code=void 0,o.isAssertionContainerNotComplete=!0),e})},i.prototype.suggestAuthenticators=function(n){var r=this;if(void 0===n&&(n=this._authenticatorList),this._currentAuthentictorSelected){var i=n.indexOf(this._currentAuthentictorSelected);i>-1&&n.splice(i,1)}this._session.setPromotedAuthenticators(n).then(function(n){if(r.handlePromotionInputControlRequest(n)){var i=n.getSelectedAuthenticator();r._currentAuthentictorSelected=i;var o=i.authDriver;r.prepareForRunningAuthenticationDriver(o)&&i.authDriver.runRegistration().then(function(n){if(n instanceof t.authenticationdrivers.AuthenticationDriverSessionResultAuthenticationCompleted)r.isAssertionContainerNotComplete?(r._sdk.log(e.LogLevel.Debug,"suggestAuthenticators() callback result: promotion not completed. showing list again."),r.suggestAuthenticators()):(r._sdk.log(e.LogLevel.Debug,"suggestAuthenticators() callback result: promotion completed. finishing"),r.completeAuthenticationWithAssertionResult(n.assertionResult));else if(n instanceof t.authenticationdrivers.AuthenticationDriverSessionResultSwitchAuthenticator)if(n.allowedAuthenticators){r._sdk.log(e.LogLevel.Debug,"suggestAuthenticators() callback result: switch authentciator with allowed authenticators called");var i=n.allowedAuthenticators;r._currentAuthentictorSelected=null,r.suggestAuthenticators(i)}else r._sdk.log(e.LogLevel.Debug,"suggestAuthenticators() callback result: switch authentciator called"),r._currentAuthentictorSelected=null,r.suggestAuthenticators();else r._sdk.log(e.LogLevel.Error,"suggestAuthenticators() unexpected callback result: stopping with error.'"),r.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unknown authentication driver result type encountered during registration."))},function(t){r._sdk.log(e.LogLevel.Error,"suggestAuthenticators() error callback result: stopping with error. error: '"+t._data+"'"),r.completeAuthenticationWithError(t)})}else r._sdk.log(e.LogLevel.Debug,"suggestAuthenticators() stopped by ControlRequest of type "+n.getControlRequest())})},i.prototype.handlePromotionInputControlRequest=function(t){if(!t.isControlRequest())return!0;switch(t.getControlRequest()){case e.PromotionControlRequest.Continue:return!0;case e.PromotionControlRequest.Skip:return this.completeWithDeclineAssertion(),!1;case e.PromotionControlRequest.Abort:return this.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"User aborted/canceled")),!1;default:return this._sdk.log(e.LogLevel.Warning,"handlePromotionInputControlRequest() received invalid PromotionInput, unsupported ControlRequest"),!1}},i.prototype.sendDeclineAssertion=function(){return this.sendAssertionRequest(i.ASSERT_DECLINE)},i.prototype.completeWithDeclineAssertion=function(){var e=this;this.sendDeclineAssertion().then(function(t){e.completeAuthenticationWithAssertionResult(t)}).catch(function(t){e.completeAuthenticationWithError(t)})},i.prototype.completeAuthenticationWithAssertionResult=function(e){this._session&&this._session.endSession(),r.prototype.completeAuthenticationWithAssertionResult.call(this,e)},i.prototype.completeAuthenticationWithError=function(e){this._session.endSession(),r.prototype.completeAuthenticationWithError.call(this,e)},Object.defineProperty(i.prototype,"availableAuthenticatorsForSwitching",{get:function(){return this.availableAuthenticators},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"availableAuthenticators",{get:function(){return this._authenticatorList.concat([])},enumerable:!0,configurable:!0}),i.prototype.shouldDisplayPromotion=function(){var n=this._sdk.host,r=new t.TarsusKeyPath("stragety"),i=n.readStorageKey(r);if(null==i.days||null==i.logins)return this._sdk.log(e.LogLevel.Debug,"shouldDisplayPromotion() first promotion. Stored data was empty."),this.updateStrategy(r,1),!0;for(var o=!0,a=0,s=this._action.options.strategies;a<s.length;a++){var c=s[a];if(0==this.checkStrategy(c,i,r)){this._sdk.log(e.LogLevel.Debug,"shouldDisplayPromotion() strategy stopped promotion. strategy type: "+c.type),o=!1;break}}var u=i.logins+1;return this.updateStrategy(r,u),o},i.prototype.updateStrategy=function(e,t){var n={days:(new Date).getTime(),logins:t};this._sdk.host.writeStorageKey(e,n)},i.prototype.checkStrategy=function(e,n,r){if(this._sdk.host,e.type==t.Protocol.PromotionStrategyFrequency.LOGINS)return n.logins%e.value==0;if(e.type==t.Protocol.PromotionStrategyFrequency.DAYS){var i=new Date,o=new Date;return o.setTime(n.days),i.getDate()+e.value>=o.getDate()}return!1},i.ASSERT_DECLINE="decline",i.ACTION_REGISTRATION="registration",i.ACTION_PROMOTION="registration_promotion",i}(n.ActionDriverAuthenticatorOp);n.ActionDriverPromotion=i})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.actiondrivers||(t.actiondrivers={}),r=function(n){function r(e,t){return n.call(this,e,t)||this}return __extends(r,n),r.prototype.doRunAction=function(){var n=this;this._sdk.log(e.LogLevel.Debug,"Executing provision TOTP action."),this._cfmAction=this._action;var r=t.totp.TotpPropertiesProcessor.createWithUser(this._controlFlowProcessor._session.user,this._sdk,this._clientContext,this._controlFlowProcessor._session),i=r.createTotpDriver(this._cfmAction.generator,this._cfmAction.otp_type);return i?(r.deleteProvisionForGenerator(this._cfmAction.generator),i.promiseProvisionOutput(this._cfmAction,this.policyAction(),this._clientContext,this._uiHandler).then(function(e){return n.sendAssertionRequest(null,e.getAssertionData()).then(function(t){return e.finalize(t),r.updateWithProvisionedGenerator(n._cfmAction,e),t})})):(this._sdk.log(e.LogLevel.Error,"failed to create TOTP driver"),Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"failed to create TOTP driver")))},r}(n.SimpleCancellationActionDriver),n.ActionDriverProvisionTotp=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.actiondrivers||(t.actiondrivers={}),r=function(r){function i(e,t){return r.call(this,e,t)||this}return __extends(i,r),i.prototype.runActionWithCompletionFunctions=function(){var r=this,i=this._action;this._sdk.log(e.LogLevel.Debug,"Loading and validating authenticator description");for(var o=0;o<i.assertions.length;o++){var a=n.AuthenticationMenuAuthenticator.fromRegistrationAction(i.assertions[o],this);if(a.getSupportedOnDevice()){this._registeredAuthenticator=a,this._silentRegistration=!!i.assertions[o].silent;break}}if(this._registeredAuthenticator){var s=this._registeredAuthenticator.authDriver;this.prepareForRunningAuthenticationDriver(s)&&(this._sdk.log(e.LogLevel.Debug,"Starting auth registeration"),s.runRegistration().then(function(n){n instanceof t.authenticationdrivers.AuthenticationDriverSessionResultAuthenticationCompleted?r.completeAuthenticationWithAssertionResult(n.assertionResult):r.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unknown authentication driver result type encountered during registration."))},function(t){r._sdk.log(e.LogLevel.Debug,"Received authentication driver error "+t),r.completeAuthenticationWithError(t)}))}else this.completeAuthenticationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"No supported authenticator listed in registeration request."))},Object.defineProperty(i.prototype,"availableAuthenticatorsForSwitching",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"availableAuthenticators",{get:function(){return[this._registeredAuthenticator]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isSilentRegistration",{get:function(){return this._silentRegistration},enumerable:!0,configurable:!0}),i}(n.ActionDriverAuthenticatorOp),n.ActionDriverRegistration=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n){return t.call(this,e,n)||this}return __extends(n,t),n.prototype.run=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"Executing scan qr action."),new Promise(function(n,r){var i=t._action,o=e.QrCodeFormat.Alphanumeric;if(i.qr_code_format_type&&(o=e.QrCodeFormatImpl.fromAssertionFormat(i.qr_code_format_type)),t._session=t._uiHandler.createScanQrSession(t._policyAction,t._clientContext),!t._session)throw e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createScanQrSession.");t._session.startSession(t._clientContext,new e.impl.PolicyActionImpl(t._action)),t._session.getScanQrResponse(i.instructions,o).then(function(i){if(i.isControlRequest())return t.processControlRequest(i.getControlRequest()).then(function(){});var o={qr_content:i.getResponse().getQrCodeResult().getQrCode()};t._sdk.log(e.LogLevel.Debug,"Asserting scan qr: "+o.qr_content),t.sendAssertionRequest(null,o).then(function(e){n(e)}).catch(function(n){t._sdk.log(e.LogLevel.Error,"Scan qr sendAssertionRequest error: "+n),t._session.endSession(),r(n)})}).finally(function(){t._session.endSession()}).catch(function(n){t._sdk.log(e.LogLevel.Error,"Scan qr action error: "+n),r(n)})})},n.prototype.processControlRequest=function(t){var n=this;return new Promise(function(r,i){switch(n._sdk.log(e.LogLevel.Debug,"Processing control request "+t.getRequestType()),t.getRequestType()){case e.ControlRequestType.CancelAuthenticator:i(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Scan qr code action canceled by user."));break;default:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Unsupported control request: "+t.getRequestType()+" for scan qr action.")}})},n}(t.ActionDriver);t.ActionDriverScanQr=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n){return t.call(this,e,n)||this}return __extends(n,t),n.augmentAssertionDataWithSignedContent=function(t,n,r,i){var o=JSON.stringify(n);i.log(e.LogLevel.Debug,"Signing consent payload: "+o);var a=e.util.asciiToHex(o);return r.signHex(a).then(function(n){var r=e.util.hexToBase64(n),i={payload:o,signed_payload:r};return t.sign_content_data=i,t})},n.prototype.run=function(){var t=this;this._sdk.log(e.LogLevel.Debug,"Executing consent action.");var r={params:this._controlFlowProcessor.initiatingRequest.body.params||{}},i=this._controlFlowProcessor.approval;return i&&(r.approval={approval_id:i.getApprovalId(),message:{title:i.getTitle(),details:i.getDetails()}}),n.augmentAssertionDataWithSignedContent({},r,this._controlFlowProcessor._session.deviceSigningKeyPair,this._sdk).then(function(e){return t.sendAssertionRequest(null,e)})},n}(t.ActionDriver);t.ActionDriverSignContent=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n){return t.call(this,e,n)||this}return __extends(n,t),n.prototype.doRunAction=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"Executing ticket wait action."),new Promise(function(n,r){var i=t._action;if(t._session=t._uiHandler.createTicketWaitSession(t._policyAction,t._clientContext),!t._session)throw e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createTicketWaitSession.");t._session.setWaitingTicket(new e.impl.TicketWaitingInformationImpl(i)),t._session.startSession(new e.impl.PolicyActionImpl(t._action),t._clientContext),t.pollServer().then(function(e){n(e)}).finally(function(){t._session.endSession()}).catch(function(n){t._sdk.log(e.LogLevel.Error,"Wait for ticket action error: "+n),r(n)})})},n.prototype.pollServer=function(){var t=this;return this._sdk.log(e.LogLevel.Debug,"Asserting ticket wait poll"),this.sendAssertionRequest(null,{}).then(function(e){return 13==e.assertion_error_code?t.inputLoop(e):e})},n.prototype.inputLoop=function(t){var n=this;return this._session.promiseInput().then(function(r){if(r.isControlRequest())return n.processControlRequest(r.getControlRequest()).then(function(){return t});var i=r.getResponse();if(i instanceof e.TicketWaitInputPollRequest)return n.pollServer();throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Expected polling request input response but got: "+i)})},n.prototype.processControlRequest=function(t){var n=this;return new Promise(function(r,i){switch(n._sdk.log(e.LogLevel.Debug,"Processing control request "+t.getRequestType()),t.getRequestType()){case e.ControlRequestType.CancelAuthenticator:case e.ControlRequestType.AbortAuthentication:i(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Wait for ticket action canceled by user."));break;default:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Unsupported control request: "+t.getRequestType()+" for ticket wait action.")}})},n}(t.SimpleCancellationActionDriver);t.ActionDriverTicketWait=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(e,t){return n.call(this,e,t)||this}return __extends(r,n),r.prototype.runActionWithCompletionFunctions=function(){this._action=this._action,this._sdk.log(e.LogLevel.Debug,"Started unregister action!"),t.AuthenticationMenuAuthenticator.fromUnregistrationAction(this._action,this).authDriver.runUnregistration().then(this._completionFunction,this._rejectionFunction)},Object.defineProperty(r.prototype,"availableAuthenticators",{get:function(){return this._availableAuthenticators.concat([])},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isSilentRegistration",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isPlaceholder",{get:function(){return 0==this._action.method.indexOf("placeholder")},enumerable:!0,configurable:!0}),r.prototype.sendUnregisterAssertion=function(){return this.sendAssertionRequest()},r}(t.ActionDriverAuthenticatorOp);t.ActionDriverUnregistration=n})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r,i;r=n.dyadic||(n.dyadic={}),i=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return __extends(r,n),r.prototype.run=function(){var n=this;return"false"==this._sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.DyadicPresent)?Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Dyadic capability is not present (is Dyadic SDK integrated?)")):this.issueDyadicRequest().then(function(e){return n.sendAssertionRequest(null,n.buildAssertionData(e)).then(function(r){var i=n.dyadicServerResponseFromAssertionResponse(r);return i?e.finalize(i).then(function(e){return r}):Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Dyadic data missing from server response"))})})},r.prototype.dyadicServerResponseFromAssertionResponse=function(e){var t=e.data&&e.data.dyadic;return t&&t.server_response},r.prototype.buildAssertionData=function(e){var t={requestData:"request_data",requestPayload:"request_payload",proxyPayload:"proxy_payload"},n=e.getServerRequest();Object.keys(t).forEach(function(e){var r=t[e];n[r]=n[e],delete n[e];var i=n[r];i&&(i.original_data=i.originalData,delete i.originalData)});var r={dyadic:n};return r.dyadic.token_uid=e.getTokenId()||this._controlFlowProcessor._session.deviceId(),r},r}(n.ActionDriver),r.ActionDriverDyadic=i}((n=t.core||(t.core={})).actiondrivers||(n.actiondrivers={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.issueDyadicRequest=function(){var e=this._action,t=this._controlFlowProcessor._session.user.guid.toString();return this._sdk.host.dyadicEnroll(t,e.server_info)},t}(e.ActionDriverDyadic);e.ActionDriverDyadicEnroll=t}(e.dyadic||(e.dyadic={}))}(e.actiondrivers||(e.actiondrivers={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(){function e(){}return e.prototype.getServerRequest=function(){return this._serverRequest},e.prototype.getTokenId=function(){return this._signHandle.getTokenId()},e.prototype.finalize=function(e){var t=this,n=e,r=this._signHandle.finalize(n.server_response);return n.otp_token_refresh&&Object.keys(n.otp_token_refresh).forEach(function(e){r=r.then(function(r){return t._refreshTokenHandles[e].finalize(n.otp_token_refresh[e])})}),r},e.create=function(t,n,r){var i=new e;return i._refreshTokenHandles=t,i._signHandle=n,i._serverRequest=r,i},e}(),r=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return __extends(r,t),r.prototype.issueDyadicRequest=function(){var t=this,r=this._action,i=e.util.asciiToHex(r.assertion_id+this._controlFlowProcessor.challenge);return this._sdk.host.dyadicSign(i).then(function(e){var i={},o=e.getServerRequest(),a=Promise.resolve(!0);return r.otp_token_uids&&0<r.otp_token_uids.length&&(o.otp_token_refresh={},r.otp_token_uids.forEach(function(e){a=a.then(function(n){return t._sdk.host.dyadicRefreshToken(e).then(function(t){return i[e]=t,o.otp_token_refresh[e]=t.getServerRequest(),!0})})})),a.then(function(t){return n.create(i,e,o)})})},r.prototype.dyadicServerResponseFromAssertionResponse=function(e){return e.data&&e.data.dyadic},r}(t.ActionDriverDyadic);t.ActionDriverDyadicSign=r}(t.dyadic||(t.dyadic={}))})((t=e.core||(e.core={})).actiondrivers||(t.actiondrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.issueDyadicRequest=function(){return this._sdk.host.dyadicDelete()},t}(e.ActionDriverDyadic);e.ActionDriverDyadicDelete=t}(e.dyadic||(e.dyadic={}))}(e.actiondrivers||(e.actiondrivers={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.ActionDrivers={confirmation:e.ActionDriverConfirmation,information:e.ActionDriverInformation,json_data:e.ActionDriverJsonData,authentication:e.ActionDriverAuthentication,registration:e.ActionDriverRegistration,unregistration:e.ActionDriverUnregistration,provision_totp:e.ActionDriverProvisionTotp,disable_totp:e.ActionDriverDisableTotp,sign_content:e.ActionDriverSignContent,form:e.ActionDriverForm,registration_promotion:e.ActionDriverPromotion,scan_qr:e.ActionDriverScanQr,wait_for_ticket:e.ActionDriverTicketWait,dyadic_enroll:e.dyadic.ActionDriverDyadicEnroll,dyadic_sign:e.dyadic.ActionDriverDyadicSign,dyadic_un_enroll:e.dyadic.ActionDriverDyadicDelete}}(e.actiondrivers||(e.actiondrivers={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i=function(){function i(e,t,n){this._externalCancelled=!1,this._actionDriver=e,this._authenticatorConfig=t,this._authenticatorDescription=n,this._sdk=e._sdk,this._uiHandler=e._uiHandler,this._clientContext=e._clientContext}return i.prototype.runAuthentication=function(e){return this._authenticationParameters=e,this.runMode(t.AuthenticatorSessionMode.Authentication)},i.prototype.runRegistration=function(){return this._actionDriver.isSilentRegistration?r.instanceOfAuthenticationDriverSilentRegistrationSupport(this)?(this._sdk.log(t.LogLevel.Debug,"Invoking silent registration for "+this._authenticatorDescription.getAuthenticatorId()),this.runSilentRegistration()):Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorError,"Silent registration not supported for this authenticator")):this.runMode(t.AuthenticatorSessionMode.Registration)},i.prototype.runUnregistration=function(){var e=this,n=this._actionDriver;return this._sdk.currentUiHandler.handleAuthenticatorUnregistration(this._authenticatorDescription,n.isPlaceholder,n.policyAction(),this._clientContext).then(function(r){if(e._sdk.log(t.LogLevel.Debug,"handleAuthenticatorUnregistration() result: "+r),0==r.getUserChoice())return n.sendUnregisterAssertion().then(function(t){return e.handleUnregistrationAssertionResult(t),t});var i=new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Unregistration failed due to app implementation rejecting unregistertion.");return Promise.reject(i)})},i.prototype.onCancelRun=function(){this._externalCancelled=!0},Object.defineProperty(i.prototype,"user",{get:function(){return this._actionDriver._controlFlowProcessor._session.user},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"operationMode",{get:function(){return this._operationMode},enumerable:!0,configurable:!0}),i.prototype.completeAuthenticatorSessionWithResult=function(e){this._inputSession&&this._inputSession.endSession(),this._completionFunction(e)},i.prototype.completeAuthenticatorSessionWithError=function(e){if(this._inputSession)try{this._inputSession.endSession()}catch(e){this._sdk.log(t.LogLevel.Warning,"Can't dismiss authenticator session during error reporting.")}this._rejectionFunction(e)},i.prototype.handleInputOrControlResponse=function(e){try{e.isControlRequest()?this.processControlRequest(e.getControlRequest()):this._operationMode==t.AuthenticatorSessionMode.Authentication?this.handleAuthenticationInputResponse(e.getResponse()):this.handleRegistrationInputResponse(e.getResponse())}catch(e){this.performErrorRecoveryForError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},i.prototype.processRegisterAssertion=function(e,n){var i=this;this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"register",e,n).then(function(e){i.handleRegisterAssertionResult(e)||(i._sdk.log(t.LogLevel.Info,"Registration session done."),i.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultAuthenticationCompleted(e)))}).catch(function(e){i._sdk.log(t.LogLevel.Error,"Perform error recovery with server error "+e),i.performErrorRecoveryForError(e)})},i.prototype.processAuthenticateAssertion=function(e,n){var i=this;this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"authenticate",e,n).then(function(e){i.handleAuthenticateAssertionResult(e)||(i._sdk.log(t.LogLevel.Info,"Authenticator session done."),i.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultAuthenticationCompleted(e)))}).catch(function(e){i._sdk.log(t.LogLevel.Error,"Perform error recovery with server error "+e),i.performErrorRecoveryForError(e)})},i.prototype.runMode=function(e){var n=this;return new Promise(function(r,i){if(n._completionFunction=r,n._rejectionFunction=i,n._operationMode=e,n._inputSession=n.createAuthenticatorSession(),!n._inputSession)throw t.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from authenticator session creation call.");n._inputSession.startSession(n._authenticatorDescription,n._operationMode,n._actionDriver.policyAction(),n._clientContext),n.authOrRegInStartedSession(!1)}).catch(function(e){throw t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e)})},i.prototype.handleGeneralAssertionResult=function(e){return this._sdk.log(t.LogLevel.Debug,"Authenticator assertion response "+JSON.stringify(e)),e.data&&(this._sdk.log(t.LogLevel.Debug,"Processing authenticator assertion response: updating assertion authenticator description"),this._authenticatorDescription.updateWithAssertionResult(e.data)),e.state!=n.Protocol.AuthSessionState.Pending&&(this._sdk.log(t.LogLevel.Info,"Authenticator session complete; status "+e.state),this.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultAuthenticationCompleted(e)),!0)},i.prototype.handleUnregistrationAssertionResult=function(e){},i.prototype.handleRegisterAssertionResult=function(e){return!!this.handleGeneralAssertionResult(e)||!!e.assertion_error_code&&(this._sdk.log(t.LogLevel.Error,"handleRegisterAssertionResult() Assertion error encoutered. Starting error recovery."),this.performErrorRecoveryForError(t.impl.AuthenticationErrorImpl.errorForAssertionResponse(e)),!0)},i.prototype.handleAuthenticateAssertionResult=function(e){if(this.handleGeneralAssertionResult(e))return!0;if(e.assertion_error_code)switch(e.assertion_error_code){case n.Protocol.AssertionErrorCode.MustRegister:return this._sdk.log(t.LogLevel.Info,"handleAuthenticateAssertionResult() Authenticator expired; must register"),this.handleRegistrationDueToExpiration(),!0;case n.Protocol.AssertionErrorCode.FailOver:return this._sdk.log(t.LogLevel.Info,"handleAuthenticateAssertionResult() Failover signalled"),this.handleFallback(),!0;default:return this._sdk.log(t.LogLevel.Error,"handleAuthenticateAssertionResult() Assertion error encoutered. Starting error recovery. 2"),this.performErrorRecoveryForError(t.impl.AuthenticationErrorImpl.errorForAssertionResponse(e)),!0}else if(this._authenticatorDescription.getExpired())return this._sdk.log(t.LogLevel.Info,"Authenticator expired; must register"),this.handleRegistrationDueToExpiration(),!0;return!1},i.prototype.processAuthFailureAssertionAndHandleError=function(e,r){var i=this,o={num_of_failures:r};this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"auth_failure",o).then(function(r){if(!i.handleGeneralAssertionResult(r)){if(r.assertion_error_code)switch(r.assertion_error_code){case n.Protocol.AssertionErrorCode.FailOver:return i._sdk.log(t.LogLevel.Info,"Failover signalled during local failure report"),i.handleFallback(),!0}if(r.data){var o={};for(var a in e.getData())o[a]=e.getData()[a];for(var a in r.data)o[a]=r.data[a];e=new t.impl.AuthenticationErrorImpl(e.getErrorCode(),e.getMessage(),o)}i.performErrorRecoveryForError(e)}},function(e){var n=t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e);i._sdk.log(t.LogLevel.Error,"Error ${authError} signalled during local failure report"),i.performErrorRecoveryForError(n,!0)})},i.prototype.handleRegistrationDueToExpiration=function(){this._inputSession.changeSessionModeToRegistrationAfterExpiration(),this._operationMode=t.AuthenticatorSessionMode.Registration,this.registerInStartedSession(!1)},i.prototype.authOrRegInStartedSession=function(e){this._operationMode==t.AuthenticatorSessionMode.Authentication?this.authenticateInStartedSession(e):this.registerInStartedSession(e)},i.prototype.processControlRequest=function(e){switch(this._sdk.log(t.LogLevel.Debug,"Processing control request "+e.getRequestType()),e.getRequestType()){case t.ControlRequestType.AbortAuthentication:this.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.UserCanceled,"Authentication cancelled due to abort control request."));break;case t.ControlRequestType.ChangeMethod:this.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultSwitchAuthenticator(null,this.getAuthenticationActionOtherAuthenticators()));break;case t.ControlRequestType.SelectMethod:this.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultSwitchAuthenticator);break;case t.ControlRequestType.CancelAuthenticator:this.invokeUiHandlerCancellation();break;case t.ControlRequestType.RetryAuthenticator:this.authOrRegInStartedSession(!0);break;default:this.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Invalid ControlRequestType value during authentication session."))}},i.prototype.invokeUiHandlerCancellation=function(){var e=this;if(this._externalCancelled)this.processControlRequest(t.ControlRequest.create(t.ControlRequestType.AbortAuthentication));else{var n=[t.ControlRequestType.RetryAuthenticator,t.ControlRequestType.AbortAuthentication];this.getAuthenticationActionOtherAuthenticators().length>0&&n.push(t.ControlRequestType.ChangeMethod),this._actionDriver.availableAuthenticatorsForSwitching.length>0&&n.push(t.ControlRequestType.SelectMethod),this._uiHandler.controlOptionForCancellationRequestInSession(n,this._inputSession).then(function(r){return r.getRequestType()==t.ControlRequestType.CancelAuthenticator?void e.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"controlOptionForCancellationRequestInSession returned CancelAuthenticator which is an invalid option.")):n.indexOf(r.getRequestType())<0?void e.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"controlOptionForCancellationRequestInSession returned an invalid option.")):void e.processControlRequest(r)})}},i.prototype.getAuthenticationActionOtherAuthenticators=function(){var e=this;return this._actionDriver.availableAuthenticatorsForSwitching.filter(function(t){return t!=e._authenticatorDescription})},i.prototype.handleFallback=function(){var e=this;if(this._authenticatorDescription.fallback){var n=[t.AuthenticatorFallbackAction.Retry,t.AuthenticatorFallbackAction.Cancel],i=null,o=this._authenticatorDescription.fallback.method;o?(i=this._actionDriver.availableAuthenticators.filter(function(e){return e.getAuthenticatorId()==o})[0])&&n.push(t.AuthenticatorFallbackAction.Fallback):this.getAuthenticationActionOtherAuthenticators().length>0&&n.push(t.AuthenticatorFallbackAction.AuthMenu),this._uiHandler.selectAuthenticatorFallbackAction(n,i,this._inputSession,this._actionDriver.policyAction(),this._clientContext).then(function(o){switch(e._sdk.log(t.LogLevel.Debug,"Fallback action selected "+o),n.indexOf(o)<0&&(e._sdk.log(t.LogLevel.Error,"Invalid fallback action selected: "+o+" not in "+n),e.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Invalid fallback action selected by callback."))),o){case t.AuthenticatorFallbackAction.Fallback:case t.AuthenticatorFallbackAction.AuthMenu:e.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultSwitchAuthenticator(i));break;case t.AuthenticatorFallbackAction.Retry:e.authOrRegInStartedSession(!0);break;case t.AuthenticatorFallbackAction.Cancel:e.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.UserCanceled,"User cancel in response to fallback action."))}})}else this.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Cannot handle a fallback error without fallback specification in action."))},i.prototype.recoveryOptionsForError=function(e,n){var r=[t.AuthenticationErrorRecovery.Fail];return[t.AuthenticationErrorCode.AllAuthenticatorsLocked,t.AuthenticationErrorCode.AppImplementation,t.AuthenticationErrorCode.ControlFlowExpired,t.AuthenticationErrorCode.SessionRequired,t.AuthenticationErrorCode.InvalidDeviceBinding,t.AuthenticationErrorCode.UserCanceled].indexOf(e.getErrorCode())>=0?r:(n||!this._authenticatorDescription.getEnabled()||this._operationMode==t.AuthenticatorSessionMode.Authentication&&e.getErrorCode()==t.AuthenticationErrorCode.AuthenticatorExternalConfigError||r.push(t.AuthenticationErrorRecovery.RetryAuthenticator),this.getAuthenticationActionOtherAuthenticators().length>0&&r.push(t.AuthenticationErrorRecovery.ChangeAuthenticator),this._actionDriver.availableAuthenticatorsForSwitching.length>0&&r.push(t.AuthenticationErrorRecovery.SelectAuthenticator),r)},i.prototype.performErrorRecoveryForError=function(n,r){var i=this,o={};o[e.sdkhost.ErrorDataRetriesLeft]=this._authenticatorDescription.retriesLeft;var a=(t.impl.AuthenticationErrorImpl.augmentErrorData(n,o),this.recoveryOptionsForError(n,r)),s=this.defaultRecoveryForError(n);a.indexOf(s)<0&&(s=a.indexOf(t.AuthenticationErrorRecovery.SelectAuthenticator)>=0?t.AuthenticationErrorRecovery.SelectAuthenticator:t.AuthenticationErrorRecovery.Fail),this._inputSession.promiseRecoveryForError(n,a,s).then(function(e){i._sdk.log(t.LogLevel.Debug,"Error recovery selected "+e),i._sdk.log(t.LogLevel.Debug,"recover from error: "+n.getErrorCode()),a.indexOf(e)<0&&(i._sdk.log(t.LogLevel.Error,"Invalid error recovery option from callback: "+e+" not in "+a),i.completeAuthenticatorSessionWithError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Invalid error recovery action selected by callback."))),i.handleErrorRecoveryAction(e,n)})},i.prototype.handleErrorRecoveryAction=function(e,n){switch(e){case t.AuthenticationErrorRecovery.RetryAuthenticator:this.authOrRegInStartedSession(!0);break;case t.AuthenticationErrorRecovery.ChangeAuthenticator:this.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultSwitchAuthenticator(null,this.getAuthenticationActionOtherAuthenticators()));break;case t.AuthenticationErrorRecovery.SelectAuthenticator:this.completeAuthenticatorSessionWithResult(new r.AuthenticationDriverSessionResultSwitchAuthenticator);break;case t.AuthenticationErrorRecovery.Fail:default:this.completeAuthenticatorSessionWithError(n)}},i.prototype.defaultRecoveryForError=function(e){return this._operationMode==t.AuthenticatorSessionMode.Authentication?!this._authenticatorDescription.getLocked()&&this._authenticatorDescription.getRegistered()&&this._authenticatorDescription.getEnabled()&&e.getErrorCode()!=t.AuthenticationErrorCode.AuthenticatorLocked&&e.getErrorCode()!=t.AuthenticationErrorCode.AllAuthenticatorsLocked?t.AuthenticationErrorRecovery.RetryAuthenticator:e.getErrorCode()!=t.AuthenticationErrorCode.AllAuthenticatorsLocked?t.AuthenticationErrorRecovery.ChangeAuthenticator:t.AuthenticationErrorRecovery.Fail:t.AuthenticationErrorRecovery.RetryAuthenticator},i}(),r.AuthenticationDriver=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),n.prototype.authenticateInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.prototype.registerInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.prototype.handleAuthenticationInputResponse=function(t){var n;try{n=this.generateAssertionDataForInputResponse(t)}catch(t){return void this.performErrorRecoveryForError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))}this.processAuthenticateAssertion(n)},n.prototype.handleRegistrationInputResponse=function(t){try{var n=this.generateAssertionDataForInputResponse(t)}catch(t){return void this.performErrorRecoveryForError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))}this.processRegisterAssertion(n)},n.prototype.generateAssertionDataForInputResponse=function(e){return{secret:this.generateSecretToSignForInputResponse(e)}},n}(t.AuthenticationDriver);t.AuthenticationDriverCentralizedSecretInputBased=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(){function n(e){this._authenticationDriverCtor=e}return n.prototype.createAuthenticationDriver=function(e,t,n){return new this._authenticationDriverCtor(e,t,n)},n.prototype.evaluateLocalRegistrationStatus=function(t){return e.AuthenticatorRegistrationStatus.Registered},n.prototype.isSupportedOnDevice=function(e){return!0},n.prototype.suggestParameters=function(e,t){return[]},n.refreshInvalidatedAuthenticatorsEnrollments=function(e){return new Promise(function(n,r){var i,o=new Array;for(var a in e.user.localEnrollments){i=e.user.localEnrollments[a];var s=t.AuthenticatorDrivers[i.authenticatorId];o.push(s.checkAuthenticatorInvalidatedAndNotifyUIHandler(e))}Promise.all(o).then(function(e){n(e)}).catch(function(e){r(e)})})},n.prototype.checkAuthenticatorInvalidatedAndNotifyUIHandler=function(e){return Promise.resolve(!0)},n}();t.SimpleAuthenticationDriverDescriptor=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r,i;t=e.core||(e.core={}),n=t.authenticationdrivers||(t.authenticationdrivers={}),r=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return __extends(n,e),n.prototype.getEnabled=function(){return this.getSupportedOnDevice()},n.getDescription=function(e,r){return new n(e,r,{},{status:t.Protocol.AuthenticationMethodStatus.Unregistered})},n}(n.AuthenticatorDescriptionImpl),i=function(i){function o(e,t){var n=i.call(this,e)||this;return n._authenticatorType=t,n}return __extends(o,i),o.prototype.evaluateLocalRegistrationStatus=function(n){var r=n.user.localEnrollments[this._authenticatorType];return r?r.validationStatus==t.LocalEnrollmentValidationStatus.Invalidated?e.AuthenticatorRegistrationStatus.LocallyInvalid:e.AuthenticatorRegistrationStatus.Registered:e.AuthenticatorRegistrationStatus.LocallyInvalid},o.prototype.checkAuthenticatorInvalidatedAndNotifyUIHandler=function(i){var o=this;return new Promise(function(a,s){i.sdk.log(e.LogLevel.Info,"Checking if authenticator "+o._authenticatorType+" has become invalidated.");var c=i.user.localEnrollments[o._authenticatorType];if(c.status==t.LocalEnrollmentStatus.Registered&&c.validationStatus!=t.LocalEnrollmentValidationStatus.Invalidated)if(n.AuthenticatorDrivers[o._authenticatorType].evaluateLocalRegistrationStatus(i)==e.AuthenticatorRegistrationStatus.LocallyInvalid){i.sdk.log(e.LogLevel.Info,"Authenticator "+o._authenticatorType+" already became invalidated. Invalidating enrollment record and notifying ui handler.");var u=r.getDescription(i,c.authenticatorId);t.LocalEnrollment.invalidateLocalRegistrationStatusAndNotifyUIHandler(i.getCurrentControlFlowProcessor(),u).then(function(e){a(e)}).catch(function(e){s(e)})}else a(!1);else a(!1)})},o}(n.SimpleAuthenticationDriverDescriptor),n.AuthenticationDriverDescriptorLocal=i}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r=function(r){function i(){return r.call(this,n.AuthenticationDriverDeviceStrongAuthentication,i.authenticatorName)||this}return __extends(i,r),i.prototype.evaluateLocalRegistrationStatus=function(e){return t.AuthenticatorRegistrationStatus.Registered},i.prototype.isSupportedOnDevice=function(t){var n=t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.DeviceStrongAuthenticationSupported);return!!n&&"false"!=n},i.authenticatorName="native_biometrics",i}(n.AuthenticationDriverDescriptorLocal);n.AuthenticationDriverDescriptorDeviceStrongAuthentication=r}((n=t.core||(t.core={})).authenticationdrivers||(n.authenticationdrivers={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(n){function r(){return n.call(this,t.AuthenticationDriverFace)||this}return __extends(r,n),r.prototype.isSupportedOnDevice=function(t){return"true"==t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.ImageAcquitisionSupported)},r}(t.SimpleAuthenticationDriverDescriptor);t.AuthenticationDriverDescriptorFace=n}(t.authenticationdrivers||(t.authenticationdrivers={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(e){var r=n.call(this,t.AuthenticationDriverFido)||this;return r._fidoPolicy=e,r}return __extends(r,n),r.prototype.isSupportedOnDevice=function(n){n.sdk.log(e.LogLevel.Debug,"Check FIDO authenticator support for "+JSON.stringify(this._fidoPolicy));var r=t.AuthenticationDriverFido.hasEligibleClientProvidersForPolicy(n.sdk,this._fidoPolicy);return r||n.sdk.log(e.LogLevel.Info,"Encountered non-supported FIDO request."),r},r.prototype.evaluateLocalRegistrationStatus=function(t){return e.AuthenticatorRegistrationStatus.Registered},r}(t.SimpleAuthenticationDriverDescriptor);t.AuthenticationDriverDescriptorFido=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.isSupportedOnDevice=function(t){return"true"===t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.Fido2ClientPresent)},n}(t.SimpleAuthenticationDriverDescriptor);t.AuthenticationDriverDescriptorFido2=n}(t.authenticationdrivers||(t.authenticationdrivers={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r=function(r){function i(){return r.call(this,n.AuthenticationDriverFingerprint,i.authenticatorName)||this}return __extends(i,r),i.prototype.evaluateLocalRegistrationStatus=function(o){var a=r.prototype.evaluateLocalRegistrationStatus.call(this,o);if(a!=t.AuthenticatorRegistrationStatus.Registered)return a;var s=o.user.localEnrollments[i.authenticatorName],c=n.AuthenticationDriverFingerprint.authenticatorKeyTagForUser(o.user,s.version,s.salt),u=o.sdk.host.getKeyPair(c,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);return u?(u.closeKeyPair(),t.AuthenticatorRegistrationStatus.Registered):t.AuthenticatorRegistrationStatus.LocallyInvalid},i.prototype.isSupportedOnDevice=function(t){return"true"==t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.FingerprintSupported)},i.authenticatorName="fingerprint",i}(n.AuthenticationDriverDescriptorLocal);n.AuthenticationDriverDescriptorFingerprint=r}((n=t.core||(t.core={})).authenticationdrivers||(n.authenticationdrivers={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(){function e(e,t){this._targetIdentifier=e,this._description=t.describe(),this._deviceDetails=t}return e.prototype.getDescription=function(){return this._description},e.prototype.getDeviceIdentifier=function(){return this._targetIdentifier},e.prototype.getDeviceDetails=function(){return this._deviceDetails},e.__tarsusInterfaceName="MobileApproveTarget",e}();t.MobileApproveTargetImpl=n;var r=function(){function r(){}return r.prototype.evaluateLocalRegistrationStatus=function(t){return e.AuthenticatorRegistrationStatus.Registered},r.prototype.isSupportedOnDevice=function(e){return!0},r.prototype.suggestParameters=function(t,n){return r.createTargetsFromConfig(t).map(function(t){return e.AuthenticationActionParameterTargetSelection.create(t)})},r.prototype.createAuthenticationDriver=function(e,n,r){return new t.AuthenticationDriverMobileApprove(e,n,r)},r.createTargetsFromConfig=function(t){return t.selectable_devices.map(function(t,r){var i=e.TargetDeviceDetailsImpl.fromServerFormat(t);return new n(t.device_id,i)})},r.prototype.checkAuthenticatorInvalidatedAndNotifyUIHandler=function(e){return Promise.resolve(!0)},r}();t.AuthenticationDriverDescriptorMobileApprove=r})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r=function(r){function i(){return r.call(this,n.AuthenticationDriverNativeFace,i.authenticatorName)||this}return __extends(i,r),i.prototype.evaluateLocalRegistrationStatus=function(o){var a=r.prototype.evaluateLocalRegistrationStatus.call(this,o);if(a!=t.AuthenticatorRegistrationStatus.Registered)return a;var s=o.user.localEnrollments[i.authenticatorName],c=n.AuthenticationDriverNativeFace.authenticatorKeyTagForUser(o.user,s.version,s.salt),u=o.sdk.host.getKeyPair(c,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);return u?(u.closeKeyPair(),t.AuthenticatorRegistrationStatus.Registered):t.AuthenticatorRegistrationStatus.LocallyInvalid},i.prototype.isSupportedOnDevice=function(t){return"true"==t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.FaceIdKeyBioProtectionSupported)},i.authenticatorName="face_id",i}(n.AuthenticationDriverDescriptorLocal);n.AuthenticationDriverDescriptorNativeFace=r}((n=t.core||(t.core={})).authenticationdrivers||(n.authenticationdrivers={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(n){var r=function(){function e(e,t,n,r,i,o){this._channelIndex=e,this._channelAssertionId=t,this._targetIdentifier=n,this._description=r,this._channel=i,this._deviceDetails=o}return e.prototype.getDescription=function(){return this._description},e.prototype.getChannel=function(){return this._channel},e.prototype.getTargetIdentifier=function(){return this._targetIdentifier},e.prototype.getChannelAssertionId=function(){return this._channelAssertionId},e.prototype.getChannelIndex=function(){return this._channelIndex},e.prototype.getDeviceDetails=function(){return this._deviceDetails},e.__tarsusInterfaceName="OtpTarget",e}();n.OtpTargetImpl=r;var i=function(){function i(){}return i.prototype.evaluateLocalRegistrationStatus=function(t){return e.AuthenticatorRegistrationStatus.Registered},i.prototype.isSupportedOnDevice=function(e){return!0},i.prototype.suggestParameters=function(t,n){return this.createTargetsFromConfig(t).map(function(t){return e.AuthenticationActionParameterTargetSelection.create(t)})},i.prototype.createAuthenticationDriver=function(e,t,r){var i=this.createTargetsFromConfig(t);return new n.AuthenticationDriverOtp(e,t,i,r)},i.prototype.createTargetsFromConfig=function(n){return n.channels.map(function(n){var i;switch(n.type){case t.Protocol.AuthenticationMethodOtpChannelType.Email:i=e.OtpChannel.Email;break;case t.Protocol.AuthenticationMethodOtpChannelType.Sms:i=e.OtpChannel.Sms;break;case t.Protocol.AuthenticationMethodOtpChannelType.Voice:i=e.OtpChannel.VoiceCall;break;case t.Protocol.AuthenticationMethodOtpChannelType.Push:i=e.OtpChannel.PushNotification;break;default:i=e.OtpChannel.Unknown}return!n.targets&&n.target&&(n.targets={},n.targets[0]=n.target),n.targets||(n.targets={}),Object.keys(n.targets).map(function(t,o){var a=n.targets[t];switch(i){case e.OtpChannel.PushNotification:var s=a,c=e.TargetDeviceDetailsImpl.fromServerFormat(s);return new r(o,n.assertion_id,t,c.describe(),i,c);default:var u=a;return new r(o,n.assertion_id,t,u,i,null)}})}).reduce(function(e,t){return e.concat(t)},[])},i.prototype.checkAuthenticatorInvalidatedAndNotifyUIHandler=function(e){return Promise.resolve(!0)},i}();n.AuthenticationDriverDescriptorOtp=i})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(){function e(e,t){this._targetIdentifier=e,this._description=t.describe(),this._deviceDetails=t}return e.prototype.getDescription=function(){return this._description},e.prototype.getDeviceIdentifier=function(){return this._targetIdentifier},e.prototype.getDeviceDetails=function(){return this._deviceDetails},e.__tarsusInterfaceName="TotpTarget",e}();t.TotpTargetImpl=n;var r=function(){function r(){}return r.prototype.evaluateLocalRegistrationStatus=function(t){return e.AuthenticatorRegistrationStatus.Registered},r.prototype.isSupportedOnDevice=function(e){return!0},r.prototype.suggestParameters=function(t,n){return r.createTargetsFromConfig(t).map(function(t){return e.AuthenticationActionParameterTargetSelection.create(t)})},r.prototype.createAuthenticationDriver=function(e,n,r){return new t.AuthenticationDriverTotp(e,n,r)},r.createTargetsFromConfig=function(t){var r=t;return r.selectable_devices?r.selectable_devices.map(function(t,r){var i=e.TargetDeviceDetailsImpl.fromServerFormat(t);return new n(t.device_id,i)}):[]},r.prototype.checkAuthenticatorInvalidatedAndNotifyUIHandler=function(e){return Promise.resolve(!0)},r}();t.AuthenticationDriverDescriptorTotp=r})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(n){function r(){return n.call(this,t.AuthenticationDriverVoice)||this}return __extends(r,n),r.prototype.isSupportedOnDevice=function(t){return"true"==t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.AudioAcquitisionSupported)},r}(t.SimpleAuthenticationDriverDescriptor);t.AuthenticationDriverDescriptorVoice=n}(t.authenticationdrivers||(t.authenticationdrivers={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.authenticationdrivers||(t.authenticationdrivers={}),r=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),Object.defineProperty(i.prototype,"lastObtainedKeyPair",{get:function(){return this._lastObtainedKeyPair},set:function(e){this._lastObtainedKeyPair&&this._lastObtainedKeyPair!=e&&this._lastObtainedKeyPair.closeKeyPair(),this._lastObtainedKeyPair=e},enumerable:!0,configurable:!0}),i.prototype.completeAuthenticatorSessionWithResult=function(i){this.operationMode===e.AuthenticatorSessionMode.Registration&&i instanceof n.AuthenticationDriverSessionResultAuthenticationCompleted&&(!i.assertionResult.assertion_error_code||i.assertionResult.assertion_error_code===t.Protocol.AssertionErrorCode.AssertionContainerNotComplete)&&(this._enrollmentRecordToCommit?(this._sdk.log(e.LogLevel.Debug,"Updating local enrollment record on registration"),this.user.updateEnrollmentRecord(this._enrollmentRecordToCommit)):this._sdk.log(e.LogLevel.Warning,"No enrollment record to update.")),this._enrollmentRecordToCommit=null,this.lastObtainedKeyPair=null,r.prototype.completeAuthenticatorSessionWithResult.call(this,i)},i.prototype.completeAuthenticatorSessionWithError=function(e){this.lastObtainedKeyPair=null,r.prototype.completeAuthenticatorSessionWithError.call(this,e)},i.prototype.registerInStartedSession=function(e){this._enrollmentRecordToCommit=null},i.prototype.calculateAssertionFieldsWithAuthenticatorKey=function(t){var n=this;return new Promise(function(r,i){var o=e.util.asciiToHex(n.localAuthenticatorChallenge());t.signHex(o).then(function(t){return{fch:e.util.hexToBase64(t)}}).then(r,i)})},i.prototype.handleAuthenticationInputResponse=function(n){var r=this,i=this.user.localEnrollments[this.authenticatorType];i||this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.NoRegisteredAuthenticator,"Missing key for "+this.authenticatorType+" authenticator")),this.getKeyForEnrollmentDataAndInput(i,n).then(function(n){return r._sdk.log(e.LogLevel.Debug,"Local authenticator key obtained; signing challenge"),r._externalCancelled?Promise.reject(r._actionDriver._controlFlowProcessor.createExternalCancellationError()):(r.lastObtainedKeyPair=n.key,r.calculateAssertionFieldsWithAuthenticatorKey(r.lastObtainedKeyPair).then(function(o){var a={};if(n.rolloverKeyData){r._sdk.log(e.LogLevel.Info,"Local authenticator rollover requested");var s={};n.rolloverKeyData.key&&(s.key=n.rolloverKeyData.key.publicKeyToJson(),s.version=n.rolloverKeyData.schemeVersion),n.rolloverReason&&(s.reason=n.rolloverReason),a.rollover=s,i.status=t.LocalEnrollmentStatus.Registered,i.validationStatus=t.LocalEnrollmentValidationStatus.Validated,i.salt=n.rolloverKeyData.salt,i.version=n.rolloverKeyData.schemeVersion,i.keyMaterial=n.rolloverKeyData.keyMeterial,i.cryptoSettings=r._sdk.cryptoSettings,i.authenticatorConfig=n.rolloverKeyData.authenticatorConfig,r._enrollmentRecordToCommit=i}r.processAuthenticateAssertion(a,o)},function(e){return Promise.reject(e)}))}).catch(function(t){r.processLocalAuthenticatorError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},i.prototype.getNewOrUpdatedEnrollmentRecord=function(n){this._sdk.log(e.LogLevel.Debug,"Register "+this.authenticatorType+": fetching local enrollment record");var r=this.user.localEnrollments[this.authenticatorType],i=n.key.publicKeyToJson().key,o=this._sdk.host.calcHexStringEncodedSha256Hash(e.util.base64ToHex(i));return r||(this._sdk.log(e.LogLevel.Debug,"Register "+this.authenticatorType+": Generating new local enrollment record"),r=this.user.createEnrollmentRecord(this.authenticatorType,n.schemeVersion,n.salt,t.LocalEnrollmentStatus.Unregistered,o)),r.status=t.LocalEnrollmentStatus.Registered,r.validationStatus=t.LocalEnrollmentValidationStatus.Validated,r.salt=n.salt,r.version=n.schemeVersion,r.cryptoSettings=this._sdk.cryptoSettings,r.publicKeyHash=o,r.keyMaterial=n.keyMeterial,r.authenticatorConfig=n.authenticatorConfig,r},i.prototype.handleRegistrationInputResponse=function(t){var n=this;this._sdk.log(e.LogLevel.Debug,"Register "+this.authenticatorType+": Generating pending enrollment data"),this.generatePendingEnrollment(t).then(function(t){n._sdk.log(e.LogLevel.Debug,"Register "+n.authenticatorType+": Signing registration assertion");var r=n.getNewOrUpdatedEnrollmentRecord(t);return n._enrollmentRecordToCommit=r,e.util.asciiToHex(n.localAuthenticatorChallenge()),n._externalCancelled?Promise.reject(n._actionDriver._controlFlowProcessor.createExternalCancellationError()):(n.lastObtainedKeyPair=t.key,n.calculateAssertionFieldsWithAuthenticatorKey(n.lastObtainedKeyPair).then(function(r){n._sdk.log(e.LogLevel.Debug,"Register "+n.authenticatorType+": Preparing registration assertion");try{var i=__assign({public_key:t.key.publicKeyToJson(),version:t.schemeVersion},r);n.processRegisterAssertion(null,i)}finally{n.lastObtainedKeyPair=null}},function(e){return n.lastObtainedKeyPair=null,Promise.reject(e)}))}).catch(function(t){n.processLocalAuthenticatorError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},i.prototype.handleRegisterAssertionResult=function(e){return e.data&&e.data.update_vaults&&t.vault.MultiCredsVault.updateVaultsProtectingCreds(this.user,e.data.update_vaults,this._uiHandler,this._sdk),r.prototype.handleRegisterAssertionResult.call(this,e)},i.prototype.handleUnregistrationAssertionResult=function(e){var n=this.user.localEnrollments[this.authenticatorType];n.status=t.LocalEnrollmentStatus.Unregistered,this.user.updateEnrollmentRecord(n),e.data&&e.data.update_vaults&&t.vault.MultiCredsVault.updateVaultsProtectingCreds(this.user,e.data.update_vaults,this._uiHandler,this._sdk),r.prototype.handleUnregistrationAssertionResult.call(this,e)},i.prototype.handleAuthenticateAssertionResult=function(t){return this._enrollmentRecordToCommit&&!t.assertion_error_code&&(this._sdk.log(e.LogLevel.Debug,"Pending commit for enrollment; checking rollover status."),t.data&&t.data.rollover&&0==t.data.rollover.code?(this._sdk.log(e.LogLevel.Info,"Updating local enrollment record on authentication result"),this.user.updateEnrollmentRecord(this._enrollmentRecordToCommit)):this._sdk.log(e.LogLevel.Error,"Received a rollover failure response from the server; aboting rollover.")),this._enrollmentRecordToCommit=null,r.prototype.handleAuthenticateAssertionResult.call(this,t)},i.prototype.processLocalAuthenticatorError=function(e){this.performErrorRecoveryForError(e)},i.prototype.localAuthenticatorChallenge=function(){return this._actionDriver._controlFlowProcessor.challenge+this._authenticatorDescription.assertionId},i.prototype.getAuthenticatorEnrollmentConfig=function(){return null},i.prototype.onCancelRun=function(){r.prototype.onCancelRun.call(this),this.lastObtainedKeyPair&&(this.lastObtainedKeyPair=null)},i.prototype.shouldAllowBiometricFallbackButton=function(n){var r=this;if(!n)return!1;var i=this._actionDriver.availableAuthenticatorsForSwitching.filter(function(e){return e!=r._authenticatorDescription});if(this._actionDriver instanceof t.actiondrivers.ActionDriverRegistration||this._actionDriver instanceof t.actiondrivers.ActionDriverAuthentication&&0==i.length)return!1;var o=n,a=o.getFallbackButtonTitle();if(!(a&&a.length>0))return!1;var s=o.getFallbackControlRequestType();switch(null==s&&(s=e.ControlRequestType.SelectMethod),s){case e.ControlRequestType.ChangeMethod:case e.ControlRequestType.SelectMethod:return this._actionDriver.availableAuthenticators.length>1;default:return!0}},i}(n.AuthenticationDriver),n.AuthenticationDriverLocal=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.instanceOfAuthenticationDriverSilentRegistrationSupport=function(e){return e.runSilentRegistration}}(e.authenticationdrivers||(e.authenticationdrivers={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i=function(i){function o(e,t,n){return i.call(this,e,t,n)||this}return __extends(o,i),o.authenticatorKeyTagForUser=function(e,t,i){return new n.TarsusKeyPath("per_user",e.guid.toString(),"local_auth_keys",r.AuthenticationDriverDescriptorDeviceStrongAuthentication.authenticatorName,t,i)},o.prototype.runSilentRegistration=function(){var e=this;return this.generateAuthenticatorKey().then(function(n){var i=e.getNewOrUpdatedEnrollmentRecord(n),o={public_key:n.key.publicKeyToJson(),encrypted_challenge_mode:!0,version:n.schemeVersion};return e._actionDriver.sendAuthenticatorAssertionRequest(e._authenticatorDescription,"register",null,o).then(function(n){if(n.assertion_error_code)throw t.impl.AuthenticationErrorImpl.errorForAssertionResponse(n);return e.user.updateEnrollmentRecord(i),new r.AuthenticationDriverSessionResultAuthenticationCompleted(n)})})},o.prototype.createAuthenticatorSession=function(){return this._sdk.log(t.LogLevel.Debug,"Create DSA session."),this._uiHandler.createDeviceStrongAuthenticatorAuthSession(r.AuthenticationDriverDescriptorDeviceStrongAuthentication.authenticatorName,this.user.displayName)},o.prototype.authenticateInStartedSession=function(e){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},o.prototype.registerInStartedSession=function(e){var n=this;this._sdk.log(t.LogLevel.Debug,"Register DSA in started session."),i.prototype.registerInStartedSession.call(this,e),this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},Object.defineProperty(o.prototype,"authenticatorType",{get:function(){return r.AuthenticationDriverDescriptorDeviceStrongAuthentication.authenticatorName},enumerable:!0,configurable:!0}),o.prototype.processLocalAuthenticatorError=function(r){var i=this,o=r,a=0,s=Promise.resolve();if(o.getErrorCode()==t.AuthenticationErrorCode.Internal&&o.getData()){var c=o.getData();a=c[e.sdkhost.ErrorDataNumFailures]||0,o=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(c,"Biometrics")||o,(c[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricInvalidated||c[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricNotConfigured&&this._authenticatorDescription.getRegistered())&&(this._sdk.log(t.LogLevel.Debug,"Biometric invalidated "+c[e.sdkhost.ErrorDataInternalError]),s=n.LocalEnrollment.invalidateLocalRegistrationStatusAndNotifyUIHandler(this._actionDriver._controlFlowProcessor,this._authenticatorDescription))}s.catch(function(e){i._sdk.log(t.LogLevel.Error,e)}),s.finally(function(){if(o.getData(),o.getErrorCode()==t.AuthenticationErrorCode.UserCanceled)return i._sdk.log(t.LogLevel.Debug,"Device strong authenticator captured user cancel error code."),void i.invokeUiHandlerCancellation();a&&i._operationMode==t.AuthenticatorSessionMode.Authentication?i.processAuthFailureAssertionAndHandleError(o,a):i.performErrorRecoveryForError(o)})},o.prototype.getKeyForEnrollmentDataAndInput=function(n,r){var i=this;return new Promise(function(o,a){var s=r,c=i.authenticatorKeyTagForScheme(n.version,n.salt),u=i._sdk.host.getKeyPair(c,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);if(!u){var l={};throw l[e.sdkhost.ErrorDataInternalError]=e.sdkhost.InternalErrorBiometricInvalidated,new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to authenticate with invalidated  biometrics.",l)}u.setBiometricPromptInfo(s.getPrompt(),null,i._uiHandler,i._inputSession),o({key:u})})},o.prototype.generatePendingEnrollment=function(e){var t=this;return this.generateAuthenticatorKey().then(function(n){var r=e;return n.key.setBiometricPromptInfo(r?r.getPrompt():null,null,t._uiHandler,t._inputSession),n})},o.prototype.generateAuthenticatorKey=function(){var n;n=this._sdk.host.generateRandomHexString(24);var r=(e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,this.authenticatorKeyTagForScheme("v1",n));return t.util.wrapPromiseWithActivityIndicator(this._uiHandler,this._actionDriver.policyAction(),this._clientContext,this._sdk.host.generateKeyPair(r,e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb,!0).then(function(e){return{key:e,salt:n,schemeVersion:"v1"}},function(e){if(e.getErrorCode()==t.AuthenticationErrorCode.Internal&&e.getData()){var n=e.getData(),r=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(n,"Biometrics");if(r)throw r}throw e}))},o.prototype.calculateAssertionFieldsWithAuthenticatorKey=function(e){var n=this._authenticatorConfig;if(this.operationMode==t.AuthenticatorSessionMode.Registration)return Promise.resolve({data:{encrypted_challenge_mode:!0}});var r=n&&n.encrypted_challenge;return r?new Promise(function(n,i){var o=t.util.base64ToHex(r);e.decrypt(o).then(function(e){return{fch:t.util.hexToBase64(e)}}).then(n,i)}):Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Invalid server response for decrypt-mode authenticator. Missing encrypted challenge."))},o.prototype.authenticatorKeyTagForScheme=function(e,t){return o.authenticatorKeyTagForUser(this.user,e,t)},o}(r.AuthenticationDriverLocal),r.AuthenticationDriverDeviceStrongAuthentication=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.authenticationdrivers||(t.authenticationdrivers={}),r=function(n){function r(e,t,r){return n.call(this,e,t,r)||this}return __extends(r,n),r.prototype.getMaxStep=function(){return-1},r.prototype.authenticateInStartedSession=function(e){e||this.initializeFirstStep(),this.pumpStep()},r.prototype.registerInStartedSession=function(e){e||this.initializeFirstStep(),this.pumpStep()},r.prototype.pumpStep=function(){var t=this,n=this._inputSession;n.setInputStep(this._currentStepIndex,this.getMaxStep(),this._currentStep),n.promiseInput().then(function(e){return t.handleInputOrControlResponse(e)},function(n){return t.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(n))})},r.prototype.handleAuthenticateAssertionResult=function(e){return!!this.handleStepManagementAssertionResult(e)||n.prototype.handleAuthenticateAssertionResult.call(this,e)},r.prototype.handleRegisterAssertionResult=function(e){return!!this.handleStepManagementAssertionResult(e)||n.prototype.handleRegisterAssertionResult.call(this,e)},r.prototype.handleStepManagementAssertionResult=function(e){if(e.assertion_error_code==t.Protocol.AssertionErrorCode.NotFinished)return(n=this.prepareNextAuthenticationStep(e))!=this._currentStep&&(this._currentStep=n,this._currentStepIndex++),this.pumpStep(),!0;if(e.assertion_error_code==t.Protocol.AssertionErrorCode.RepeatCurrentStep){var n=this.updateCurrentAuthenticationStep(e,this._currentStep);return this.pumpStep(),!0}return!1},r.prototype.initializeFirstStep=function(){this._currentStep=this.createInitialInputStep(),this._currentStepIndex=0},r}(n.AuthenticationDriver),n.AuthenticationDriverMultiStep=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),n.prototype.createAuthenticatorSession=function(){return this._uiHandler.createFaceAuthSession("face",this.user.displayName)},n.prototype.createInitialInputStep=function(){var t=this._authenticatorConfig;return new e.impl.CameraAcquisitionStepDescriptionImpl(t.acquisition_challenges)},n.prototype.prepareNextAuthenticationStep=function(e){return this.createInitialInputStep()},n.prototype.updateCurrentAuthenticationStep=function(e,t){return t},n.prototype.handleAuthenticationInputResponse=function(e){var t=e;this.processAuthenticateAssertion(t.getAcquisitionResponse())},n.prototype.handleRegistrationInputResponse=function(e){var t=e;this.processRegisterAssertion(t.getAcquisitionResponse())},n}(t.AuthenticationDriverMultiStep);t.AuthenticationDriverFace=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(r){var i=function(){function e(e,t,n,r,i,o){this._uiHandler=n,this._clientContext=r,this._actionContext=i,this._fidoRequest=o,this._user=t,this._sdk=e}return e.prototype.startSession=function(e,t,n,r){this._authDescription=e},e.prototype.changeSessionModeToRegistrationAfterExpiration=function(){throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Can't change FIDO asession mode from authentication to registration.")},e.prototype.promiseRecoveryForError=function(e,n,r){return Promise.resolve(t.AuthenticationErrorRecovery.Fail)},e.prototype.promiseInput=function(){var e=this;return this.fidoClientXact().then(function(e){return t.InputOrControlResponse.createInputResponse(t.FidoInputResponse.createSuccessResponse(e))},function(n){var r=t.impl.AuthenticationErrorImpl.ensureAuthenticationError(n);return e._sdk.log(t.LogLevel.Debug,"Received FIDO error response from client: "+r),r.getErrorCode()==t.AuthenticationErrorCode.UserCanceled?t.InputOrControlResponse.createControlResponse(t.impl.ControlRequestImpl.create(t.ControlRequestType.CancelAuthenticator)):t.InputOrControlResponse.createInputResponse(t.FidoInputResponse.createdFailedResponse(e._authDescription,r))})},e.prototype.completeSuccessfulAuthenticatorSession=function(){return this.fidoClientSendCompletion({},1200)},e.prototype.endSession=function(){},e}(),o=function(e){function t(t,n,r,i,o,a){return e.call(this,t,n,r,i,o,a)||this}return __extends(t,e),t.prototype.fidoClientXact=function(){return this._sdk.host.fidoClientXact(this._uiHandler,this._clientContext,this._actionContext,this._fidoRequest)},t.prototype.fidoClientSendCompletion=function(e,t){var n={__completion:{responseCode:t,message:e}};return this._sdk.host.fidoClientXact(this._uiHandler,this._clientContext,this._actionContext,n).then(function(e){return!0})},t}(i),a=function(){function r(){}return r.prototype.createSession=function(e,t,n,r,i,a){return new o(e,t,n,r,i,a)},r.prototype.canHandlePolicy=function(e,t){return!n.fidoclient.TarsusFidoClient.isPolicyTransmitFidoClientExclusive(t)&&!!this.checkPlatformClientIsPresent(e)},r.prototype.getAvailableAuthenticatorsIds=function(e){var n=this;return new Promise(function(r,i){if(!n.checkPlatformClientIsPresent(e))return e.log(t.LogLevel.Debug,"No platform FIDO client, therefore no available platform FIDO authenticators"),r();var o=null;if(e.currentSession){var a=e.currentSession.getCurrentControlFlowProcessor();a&&(o=a._clientContext)}n.requestFidoClientDiscovery(e,e.currentUiHandler,o,n.getPolicyAction()).then(function(e){for(var t=e.availableAuthenticators,n=new Array,i=0,o=t;i<o.length;i++){var a=o[i];n.push(a.aaid)}r(n)},function(n){e.log(t.LogLevel.Debug,"Received FIDO discovery error response from client: "+n),i(n)})})},r.prototype.checkPlatformClientIsPresent=function(n){return null==this._hasPlatformClient&&(this._hasPlatformClient="true"===n.host.queryHostInfo(e.sdkhost.HostInformationKey.FidoClientPresent),this._hasPlatformClient||n.log(t.LogLevel.Info,"No platform FIDO client.")),this._hasPlatformClient},r.prototype.getPolicyAction=function(){var e=new Object;return e.type="",e.assertion_id="",new t.impl.PolicyActionImpl(e)},r.prototype.requestFidoClientDiscovery=function(e,t,n,r){return e.host.fidoClientXact(t,n,r,{discovery:!0})},r}(),s=function(e){function t(t,n,r,i,o,a){return e.call(this,t,n,r,i,o,a)||this}return __extends(t,e),t.prototype.fidoClientXact=function(){return this._sdk.fidoClient.fidoClientXact(this._authDescription,this._uiHandler,this._user,this._clientContext,this._actionContext,this._fidoRequest)},t.prototype.fidoClientSendCompletion=function(e,t){return Promise.resolve(!0)},t}(i),c=function(){function e(){}return e.prototype.createSession=function(e,t,n,r,i,o){return new s(e,t,n,r,i,o)},e.prototype.canHandlePolicy=function(e,t){return e.fidoClient.canHandlePolicy(t)},e.prototype.getAvailableAuthenticatorsIds=function(e){return new Promise(function(e,t){var r=new Array;Object.keys(n.fidoclient.FidoAuthenticators).forEach(function(e){r.push(e)}),e(r)})},e}();r._fidoClientProviders=[new c,new a];var u=function(e){function i(t,n,r){return e.call(this,t,n,r)||this}return __extends(i,e),i.getEligibleClientProvidersForPolicy=function(e,t){return r._fidoClientProviders.filter(function(n){return n.canHandlePolicy(e,t)})},i.hasEligibleClientProvidersForPolicy=function(e,t){return this.getEligibleClientProvidersForPolicy(e,t).length>0},i.prototype.runUnregistration=function(){var n=this;return e.prototype.runUnregistration.call(this).finally(function(){var e=n._authenticatorConfig;new Promise(function(r,o){var a=e.fido_policy;if(a.rejected||!a.accepted||1!=a.accepted.length)throw"Invalid fido policy (class 1)";if(1!=a.accepted[0].length||1!=Object.keys(a.accepted[0][0]).length||!a.accepted[0][0].aaid||1!=a.accepted[0][0].aaid.length)throw"Invalid fido policy (class 2)";var s=a.accepted[0][0].aaid[0];n._sdk.log(t.LogLevel.Debug,"Will unregister AAID "+s+".");var c=i.getEligibleClientProvidersForPolicy(n._sdk,e.fido_policy);if(0==c.length)n._sdk.log(t.LogLevel.Warning,"Can't find FIDO client for unregister op: "+JSON.stringify(e.fido_policy)+"."),r();else{var u=e.fido_request;u.header.appID=e.fido_appid;var l=c[0].createSession(n._sdk,n.user,n._uiHandler,n._clientContext,n._actionDriver.policyAction(),u);l.startSession(n._authenticatorDescription,t.AuthenticatorSessionMode.Registration,n._actionDriver.policyAction(),n._clientContext),l.promiseInput().then(function(e){if(e.isControlRequest())throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorError,"Unexpected control response from FIDO client during unregistration.");var n=e.getResponse();if(n instanceof t.FidoAuthFailureResponse)throw n.getFailureError();return e}).finally(function(){l.endSession()}).then(r,o)}}).then(function(){n._sdk.log(t.LogLevel.Info,"FIDO authenticator unregistered: "+JSON.stringify(e.fido_policy)+".")},function(e){var r=t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e);n._sdk.log(t.LogLevel.Error,"Error during FIDO unregistration: "+r+".")})})},i.prototype.completeAuthenticatorSessionWithResult=function(n){var i=this;n instanceof r.AuthenticationDriverSessionResultAuthenticationCompleted?this._inputSession.completeSuccessfulAuthenticatorSession().then(function(t){e.prototype.completeAuthenticatorSessionWithResult.call(i,n)},function(n){e.prototype.completeAuthenticatorSessionWithError.call(i,t.impl.AuthenticationErrorImpl.ensureAuthenticationError(n))}):e.prototype.completeAuthenticatorSessionWithResult.call(this,n)},i.prototype.createAuthenticatorSession=function(){var e=this._authenticatorConfig,n=i.getEligibleClientProvidersForPolicy(this._sdk,e.fido_policy);if(e.fido_request.header.appID=e.fido_appid,n.length>0)return n[0].createSession(this._sdk,this.user,this._uiHandler,this._clientContext,this._actionDriver.policyAction(),e.fido_request);throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorExternalConfigError,"Can't find FIDO client to handle FIDO request.",{fidoRequest:e.fido_request})},i.prototype.authenticateInStartedSession=function(e){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},i.prototype.registerInStartedSession=function(e){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},i.prototype.handleAuthenticationInputResponse=function(e){e instanceof t.FidoAuthSuccessResponse?this.handleFidoSuccessAuthResponse(e):this.handleFidoError(e)},i.prototype.handleFidoSuccessAuthResponse=function(e){this.processAuthenticateAssertion({fido_response:e.getFidoResponse()})},i.prototype.handleFidoError=function(e){e instanceof t.FidoAuthFailureResponse?(this._sdk.log(t.LogLevel.Debug,"FIDO session received FidoAuthFailureResponse."),this.handleFidoFailureResponse(e)):(this._sdk.log(t.LogLevel.Error,"FIDO session received unknkown response type."),this.performErrorRecoveryForError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"FIDO session received unknkown response type.")))},i.prototype.handleFidoFailureResponse=function(e){var r={status:e.getRegistrationStatus()==t.AuthenticatorRegistrationStatus.Registered?n.Protocol.AuthenticationMethodStatus.Registered:n.Protocol.AuthenticationMethodStatus.Unregistered,expired:e.getExpired(),locked:e.getLocked(),last_used:0};this._authenticatorDescription.updateWithAuthenticatorState(r),this.performErrorRecoveryForError(e.getFailureError())},i.prototype.handleFidoSuccessRegResponse=function(e){this.processRegisterAssertion({fido_response:e.getFidoResponse()})},i.prototype.handleRegistrationInputResponse=function(e){e instanceof t.FidoAuthSuccessResponse?this.handleFidoSuccessRegResponse(e):this.handleFidoError(e)},i.prototype.defaultRecoveryForError=function(e){return this._operationMode==t.AuthenticatorSessionMode.Authentication?t.AuthenticationErrorRecovery.ChangeAuthenticator:t.AuthenticationErrorRecovery.Fail},i}(r.AuthenticationDriver);r.AuthenticationDriverFido=u}((n=t.core||(t.core={})).authenticationdrivers||(n.authenticationdrivers={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){var n,r;n=t.sdk||(t.sdk={}),function(r){var i=function(){function r(e,t,n,r,i,o){this.cancellationDOMErrorNames=["NotAllowedError","AbortError"],this.sdk=e,this.username=t,this.uiHandler=n,this.clientContext=r,this.actionContext=i,this.config=o}return r.prototype.startSession=function(e,t,n,r){this.description=e,this.mode=t,this.actionContext=n,this.clientContext=r},r.prototype.changeSessionModeToRegistrationAfterExpiration=function(){this.mode=e.ts.mobile.sdk.AuthenticatorSessionMode.Registration},r.prototype.promiseRecoveryForError=function(e,t,r){return Promise.resolve(n.AuthenticationErrorRecovery.Fail)},r.prototype.promiseInput=function(){var r,i,o=this;return this.mode===e.ts.mobile.sdk.AuthenticatorSessionMode.Authentication?(r=this.config.credentialRequestOptions,i=t.sdkhost.Fido2CredentialsOpType.Get):(r=this.config.credentialCreationOptions,i=t.sdkhost.Fido2CredentialsOpType.Create),this.sdk.host.fido2CredentialsOp(this.uiHandler,this.clientContext,this.actionContext,i,r).then(function(e){return n.InputOrControlResponse.createInputResponse(n.Fido2InputResponse.createSuccessResponse(e))}).catch(function(t){var r=e.ts.mobile.sdk.impl.AuthenticationErrorImpl.ensureAuthenticationError(t);return r.getErrorCode()===n.AuthenticationErrorCode.UserCanceled?(o.sdk.log(n.LogLevel.Debug,"Received FIDO2 cancellation request."),n.InputOrControlResponse.createControlResponse(n.ControlRequest.create(n.ControlRequestType.CancelAuthenticator))):(o.sdk.log(n.LogLevel.Debug,"Received FIDO2 error response from client: "+r),n.InputOrControlResponse.createInputResponse(n.Fido2InputResponse.createdFailedResponse(r)))})},r.prototype.endSession=function(){},r}();r.Fido2AuthenticatorSession=i;var o=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return __extends(r,e),r.prototype.createAuthenticatorSession=function(){if("true"===this._sdk.host.queryHostInfo(t.sdkhost.HostInformationKey.Fido2ClientPresent))return new i(this._sdk,this.user.displayName,this._uiHandler,this._clientContext,this._actionDriver.policyAction(),this._authenticatorConfig);throw new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.AuthenticatorExternalConfigError,"Can't find FIDO2 client to handle FIDO2 authentication.")},r.prototype.authenticateInStartedSession=function(e){var t=this;this._inputSession.promiseInput().then(function(e){return t.handleInputOrControlResponse(e)},function(e){return t.completeAuthenticatorSessionWithError(n.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.handleAuthenticationInputResponse=function(e){if(e instanceof n.Fido2AuthenticatorSuccessResponse){this._sdk.log(n.LogLevel.Debug,"Fido2 received Fido2AuthenticatorSuccessResponse.");var t=e.getFido2Response();this.processAuthenticateAssertion({assertion_credential:{id:t.id,rawId:t.rawId,response:{authenticatorData:t.response.authenticatorData,clientDataJSON:t.response.clientDataJSON,signature:t.response.signature,userHandle:t.response.userHandle},type:t.type}})}else e instanceof n.Fido2AuthenticationFailedResponse?(this._sdk.log(n.LogLevel.Debug,"Fido2 received Fido2AuthenticationFailedResponse."),this.handleFido2FailureResponse(e)):(this._sdk.log(n.LogLevel.Error,"Fido2 received unknkown response type."),this.performErrorRecoveryForError(new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.AppImplementation,"Fido2 received unknkown response type.")))},r.prototype.registerInStartedSession=function(e){var t=this;this._inputSession.promiseInput().then(function(e){return t.handleInputOrControlResponse(e)},function(e){return t.completeAuthenticatorSessionWithError(n.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},r.prototype.handleRegistrationInputResponse=function(e){if(e instanceof n.Fido2AuthenticatorSuccessResponse){this._sdk.log(n.LogLevel.Debug,"Fido2 received Fido2AuthenticatorSuccessResponse.");var t=e.getFido2Response();this.processRegisterAssertion({attestation_credential:{id:t.id,rawId:t.rawId,response:{attestationObject:t.response.attestationObject,clientDataJSON:t.response.clientDataJSON},type:t.type}})}else e instanceof n.Fido2AuthenticationFailedResponse?(this._sdk.log(n.LogLevel.Debug,"Fido2 received Fido2AuthenticationFailedResponse."),this.handleFido2FailureResponse(e)):(this._sdk.log(n.LogLevel.Error,"Fido2 received unknkown response type."),this.performErrorRecoveryForError(new n.impl.AuthenticationErrorImpl(n.AuthenticationErrorCode.AppImplementation,"Fido2 received unknkown response type.")))},r.prototype.handleFido2FailureResponse=function(e){this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"auth_failure",{num_of_failures:1}),this.performErrorRecoveryForError(e.getFailureError())},r}(r.AuthenticationDriver);r.AuthenticationDriverFido2=o}((r=n.core||(n.core={})).authenticationdrivers||(r.authenticationdrivers={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i,o;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i="v3",o=function(o){function a(e,t,n){return o.call(this,e,t,n)||this}return __extends(a,o),a.prototype.getBiometricPromptFallbackControlType=function(){return null!=this._biometricPromptFallbackControlType?this._biometricPromptFallbackControlType:t.ControlRequestType.SelectMethod},a.authenticatorKeyTagForUser=function(e,t,i){return new n.TarsusKeyPath("per_user",e.guid.toString(),"local_auth_keys",r.AuthenticationDriverDescriptorFingerprint.authenticatorName,t,i)},a.prototype.shouldAllowBiometricFallbackButton=function(e){var r=this;if(!e)return!1;var i=this._actionDriver.availableAuthenticatorsForSwitching.filter(function(e){return e!=r._authenticatorDescription});if(this._actionDriver instanceof n.actiondrivers.ActionDriverRegistration||this._actionDriver instanceof n.actiondrivers.ActionDriverAuthentication&&0==i.length)return!1;var o=e,a=o.getFallbackButtonTitle();if(!(a&&a.length>0))return!1;var s=o.getFallbackControlRequestType();switch(null==s&&(s=t.ControlRequestType.SelectMethod),s){case t.ControlRequestType.ChangeMethod:return this._actionDriver.availableAuthenticatorsForSwitching.filter(function(e){return e!=r._authenticatorDescription}).length>0;case t.ControlRequestType.SelectMethod:return this._actionDriver.availableAuthenticatorsForSwitching.length>0;default:return!0}},a.prototype.runSilentRegistration=function(){var e=this;return this.generateAuthenticatorKey().then(function(n){var i=e.getNewOrUpdatedEnrollmentRecord(n),o={public_key:n.key.publicKeyToJson(),version:n.schemeVersion};return e._actionDriver.sendAuthenticatorAssertionRequest(e._authenticatorDescription,"register",null,o).then(function(n){if(n.assertion_error_code)throw t.impl.AuthenticationErrorImpl.errorForAssertionResponse(n);return e.user.updateEnrollmentRecord(i),new r.AuthenticationDriverSessionResultAuthenticationCompleted(n)})})},a.prototype.createAuthenticatorSession=function(){return this._uiHandler.createFingerprintAuthSession(r.AuthenticationDriverDescriptorFingerprint.authenticatorName,this.user.displayName)},a.prototype.authenticateInStartedSession=function(e){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},a.prototype.registerInStartedSession=function(e){var n=this;o.prototype.registerInStartedSession.call(this,e),this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},Object.defineProperty(a.prototype,"authenticatorType",{get:function(){return r.AuthenticationDriverDescriptorFingerprint.authenticatorName},enumerable:!0,configurable:!0}),a.prototype.processLocalAuthenticatorError=function(r){var i=this,o=r,a=0,s=Promise.resolve();if(o.getErrorCode()==t.AuthenticationErrorCode.Internal&&o.getData()){var c=o.getData();a=c[e.sdkhost.ErrorDataNumFailures]||a,o=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(c,"Fingerprint")||o,(c[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricNotConfigured&&this._authenticatorDescription.getRegistered()||c[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricInvalidated)&&(s=n.LocalEnrollment.invalidateLocalRegistrationStatusAndNotifyUIHandler(this._actionDriver._controlFlowProcessor,this._authenticatorDescription))}s.catch(function(e){i._sdk.log(t.LogLevel.Error,e)}),s.finally(function(){var n=o.getData();return a&&i._operationMode==t.AuthenticatorSessionMode.Authentication?void i.processAuthFailureAssertionAndHandleError(o,a):n[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricFallbackPressed?(i._sdk.log(t.LogLevel.Debug,"Biometric prompt fallback button pressed"),void i.processControlRequest(t.ControlRequest.create(i.getBiometricPromptFallbackControlType()))):o.getErrorCode()==t.AuthenticationErrorCode.UserCanceled?(i._sdk.log(t.LogLevel.Debug,"Fingerprint authenticator captured user cancel error code."),void i.invokeUiHandlerCancellation()):void i.performErrorRecoveryForError(o)})},a.prototype.getKeyForEnrollmentDataAndInput=function(n,r){var o=this;return new Promise(function(a,s){var c=r,u=o.shouldAllowBiometricFallbackButton(c);u&&(o._biometricPromptFallbackControlType=c.getFallbackControlRequestType());var l=o.authenticatorKeyTagForScheme(n.version,n.salt),d=o._sdk.host.getKeyPair(l,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);if(!d){var h={};throw h[e.sdkhost.ErrorDataInternalError]=e.sdkhost.InternalErrorBiometricInvalidated,new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to authenticate with invalidated Fingerprint.",h)}d.setBiometricPromptInfo(c.getPrompt(),u?c.getFallbackButtonTitle():null,o._uiHandler,o._inputSession);var p={key:d};"v0"==n.version||"v1"==n.version||"v2"==n.version&&"true"!=o._sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.StdSigningKeyIsHardwareProtectedSignAndEncryptKey)?(o._sdk.log(t.LogLevel.Info,"Fingerprint: Key rollover from "+n.version+" to "+i),o.generateAuthenticatorKey().then(function(e){return p.rolloverKeyData=e,p.rolloverReason="Upgrading fingerprint authenticator scheme from "+n.version+" to "+i,p}).then(a,s)):a(p)})},a.prototype.generatePendingEnrollment=function(e){var t=this;return this.generateAuthenticatorKey().then(function(n){var r=e,i=t.shouldAllowBiometricFallbackButton(r);return i&&(t._biometricPromptFallbackControlType=r.getFallbackControlRequestType()),n.key.setBiometricPromptInfo(r?r.getPrompt():null,i?r.getFallbackButtonTitle():null,t._uiHandler,t._inputSession),n})},a.prototype.generateAuthenticatorKey=function(){var n;n=this._sdk.host.generateRandomHexString(24);var r=(e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,this.authenticatorKeyTagForScheme(i,n));return t.util.wrapPromiseWithActivityIndicator(this._uiHandler,this._actionDriver.policyAction(),this._clientContext,this._sdk.host.generateKeyPair(r,e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb,!0).then(function(e){return{key:e,salt:n,schemeVersion:i}},function(e){if(e.getErrorCode()==t.AuthenticationErrorCode.Internal&&e.getData()){var n=e.getData(),r=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(n,"Fingerprint");if(r)throw r}throw e}))},a.prototype.authenticatorKeyTagForScheme=function(e,t){return a.authenticatorKeyTagForUser(this.user,e,t)},a}(r.AuthenticationDriverLocal),r.AuthenticationDriverFingerprint=o}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){function t(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}function n(e){var t,n="";for(t=0;t<e.length;t++){var r=e[t];if(r<128)n+=String.fromCharCode(r);else if(r>191&&r<224)n+=String.fromCharCode((31&r)<<6|63&e[t+1]),t+=1;else if(r>223&&r<240)n+=String.fromCharCode((15&r)<<12|(63&e[t+1])<<6|63&e[t+2]),t+=2;else{var i=((7&r)<<18|(63&e[t+1])<<12|(63&e[t+2])<<6|63&e[t+3])-65536;n+=String.fromCharCode(i>>10|55296,1023&i|56320),t+=3}}return n}function r(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n).toString(16);r.length<2&&(r="0"+r),t+=r}return t}e.numberToHex=function(e,t){var n=e.toString(16);if(n.length>t/4)throw"Number out of range for bitcount.";for(;n.length<t/4;)n="0"+n;return n},e.toUTF8Array=t,e.fromUTF8Array=n,e.hexToAscii=function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(parseInt(e.substr(r,2),16));return n(t)},e.asciiToHex=function(e){return t(e).map(function(e){var t=e.toString(16);return t.length<2&&(t="0"+t),t}).join("")},e.base64ToHex=function(e){return r(atob(e))},e.bytesToHex=r,e.hexToBase64=function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,r=0,i="",o=0;o<e.length;o++)n=(n<<4)+parseInt(e[o],16),(r+=4)>=6&&(i+=t[n>>r-6],n&=255>>8-(r-=6));for(r&&(i+=t[n<<6-r]);i.length%4;)i+="=";return i},e.isHexString=function(e){return new RegExp("^([0-9A-Fa-f]{2})+$").test(e)},e.nameof=function(e){return e},e.wrapPromiseWithActivityIndicator=function(e,t,n,r){return e.startActivityIndicator(t,n),r.then(function(r){return e.endActivityIndicator(t,n),r},function(r){return e.endActivityIndicator(t,n),Promise.reject(r)})},e.getOsName=function(e){var t=e;switch(e){case"iPhone":case"iPad":t="iOS"}return t},e.getDeviceModel=function(e,t){var n=e;if("iPhone"==t)switch(e){case"i386":case"x86_64":n="Simulator";break;case"iPod1,1":case"iPod2,1":case"iPod3,1":case"iPod4,1":case"iPod7,1":n="iPod Touch";break;case"iPhone1,1":case"iPhone1,2":case"iPhone2,1":n="iPhone";break;case"iPad1,1":n="iPad";break;case"iPad2,1":n="iPad 2";break;case"iPad3,1":n="iPad";break;case"iPhone3,1":case"iPhone3,3":n="iPhone 4";break;case"iPhone4,1":n="iPhone 4S";break;case"iPhone5,1":case"iPhone5,2":n="iPhone 5";break;case"iPad3,4":n="iPad";break;case"iPad2,5":n="iPad Mini";break;case"iPhone5,3":case"iPhone5,4":n="iPhone 5c";break;case"iPhone6,1":case"iPhone6,2":n="iPhone 5s";break;case"iPhone7,1":n="iPhone 6 Plus";break;case"iPhone7,2":n="iPhone 6";break;case"iPhone8,1":n="iPhone 6S";break;case"iPhone8,2":n="iPhone 6S Plus";break;case"iPhone8,4":n="iPhone SE";break;case"iPhone9,1":case"iPhone9,3":n="iPhone 7";break;case"iPhone9,2":case"iPhone9,4":n="iPhone 7 Plus";break;case"iPhone10,1":case"iPhone10,4":n="iPhone 8";break;case"iPhone10,2":case"iPhone10,5":n="iPhone 8 Plus";break;case"iPhone10,3":case"iPhone10,6":n="iPhone X";break;case"iPad4,1":case"iPad4,2":n="iPad Air";break;case"iPad4,4":case"iPad4,5":case"iPad4,7":n="iPad Mini";break;case"iPad6,7":case"iPad6,8":n='iPad Pro (12.9")';break;case"iPad6,3":case"iPad6,4":n='iPad Pro (9.7")';break;case"iPhone11,2":n="iPhone XS";break;case"iPhone11,6":case"iPhone11,4":n="iPhone XS Max";break;case"iPhone11,8":n="iPhone XR";break;case"iPad6,7":case"iPad6,8":n='iPad Pro (12.9")';break;case"iPad6,11":case"iPad6,12":n="iPad (2017)";break;case"iPad7,1":case"iPad7,2":n="iPad Pro 2nd Gen";break;case"iPad7,3":case"iPad7,4":n='iPad Pro (10.5")';break;case"iPad7,5":case"iPad7,6":n="iPad";break;case"iPad8,1":case"iPad8,2":case"iPad8,3":case"iPad8,4":n='iPad Pro (11")';break;case"iPad8,5":case"iPad8,6":case"iPad8,7":case"iPad8,8":n='iPad Pro (12.9")'}return n};var i=function(){function e(){var t=this;this._cancelPromise=new Promise(function(n,r){t._cancelFn=function(){r(e.CancelRequest)},t._cancelled&&r(e.CancelRequest)})}return Object.defineProperty(e.prototype,"cancellablePromise",{get:function(){return this._cancellablePromise},enumerable:!0,configurable:!0}),e.prototype.resolveWith=function(e){this._cancelled?this._cancellablePromise=this._cancelPromise:(this._underlyingPromise=new Promise(e),this._cancellablePromise=Promise.race([this._cancelPromise,this._underlyingPromise]))},e.prototype.cancel=function(){this._cancelled=!0,this._cancelFn&&this._cancelFn()},e.CancelRequest={},e}();e.CancelablePromiseHolder=i}(e.util||(e.util={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),i.prototype.processLocalAuthenticatorError=function(e){var n=e;e.getErrorCode()==t.AuthenticationErrorCode.InvalidInput&&this._operationMode==t.AuthenticatorSessionMode.Authentication?this.processAuthFailureAssertionAndHandleError(n,1):this.performErrorRecoveryForError(n)},i.prototype.getKeyForEnrollmentDataAndInput=function(e,n){var r=this;return new Promise(function(t,i){"v2"==e.version?r.getKeyForEnrollmentDataAndInputV2(e,n).then(t,i):r.getKeyForEnrollmentDataAndInputPreV2(e,n).then(t,i)}).then(function(i){if(!i)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.InvalidInput,"Invalid input provided to authenticator.");var o={key:i};return"v0"==e.version||"v1"==e.version?(r._sdk.log(t.LogLevel.Info,r.authenticatorType+": Key rollover from "+e.version+" to v2"),r.generatePendingEnrollment(n).then(function(e){return o.rolloverKeyData=e,o.rolloverReason="Upgrading "+r.authenticatorType+" authenticator scheme",o})):o})},i.prototype.generatePendingEnrollment=function(r){var i=this;return new Promise(function(o,a){var s=i._sdk.host.generateRandomHexString(32),c=i._sdk.host.generateRandomHexString(64),u=i.extractPbkdfInputFromInputResponse(r);return t.util.wrapPromiseWithActivityIndicator(i._uiHandler,i._actionDriver.policyAction(),i._clientContext,i._sdk.host.generateHexSeededKeyPairExternalRepresentation(e.sdkhost.KeyClass.FidoECCSigningKey,c).then(function(t){return n.vault.pbkdfStretchHexSecretIntoAESKey(s,u,i._sdk.cryptoSettings.getLocalEnrollmentKeySizeInBytes(),i._sdk.cryptoSettings.getLocalEnrollmentKeyIterationCount(),!0,i._sdk).then(function(n){return n.encrypt(c).then(function(n){return{key:i._sdk.host.importVolatileKeyPair(e.sdkhost.KeyClass.FidoECCSigningKey,t),salt:s,schemeVersion:"v2",keyMeterial:n}})})})).then(o,a)})},i.prototype.getKeyForEnrollmentDataAndInputV2=function(t,r){var i=this,o=this.extractPbkdfInputFromInputResponse(r);return n.vault.pbkdfStretchHexSecretIntoAESKey(t.salt,o,t.cryptoSettings.getLocalEnrollmentKeySizeInBytes(),t.cryptoSettings.getLocalEnrollmentKeyIterationCount(),!0,this._sdk).then(function(n){return n.decrypt(t.keyMaterial,null).then(function(t){return i._sdk.host.generateHexSeededKeyPairExternalRepresentation(e.sdkhost.KeyClass.FidoECCSigningKey,t).then(function(t){return i._sdk.host.importVolatileKeyPair(e.sdkhost.KeyClass.FidoECCSigningKey,t)})})})},i.prototype.getKeyForEnrollmentDataAndInputPreV2=function(t,n){var r=this;return this.authenticatorKeyTagForScheme(t.version,t.salt,t.cryptoSettings,n).then(function(t){return r._sdk.host.getKeyPair(t,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.None)})},i.prototype.authenticatorKeyTagForScheme=function(e,r,i,o){var a=this;return new Promise(function(s,c){var u=a.extractPbkdfInputFromInputResponse(o);if("v0"==e&&(a._sdk.log(t.LogLevel.Debug,"Using SDK CryptoSettings for migrated enrollment."),i=a._sdk.cryptoSettings),!i)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Missing crypt settings for local enrollment.");a._sdk.host.generatePbkdf2HmacSha1HexString(r,u,i.getLocalEnrollmentKeySizeInBytes(),i.getLocalEnrollmentKeyIterationCount()).then(function(r){var i=t.util.hexToBase64(r);return new n.TarsusKeyPath("per_user",a.user.guid.toString(),"local_auth_keys",a.authenticatorType,e,i)}).then(s,c)})},i}(r.AuthenticationDriverLocal),r.AuthenticationDriverLocalSecretInputBased=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),Object.defineProperty(n.prototype,"authenticatorType",{get:function(){return n.authenticatorName},enumerable:!0,configurable:!0}),n.prototype.handleAuthenticationInputResponse=function(n){var r=n;e.impl.PatternInputImpl.validateFormat(r)?t.prototype.handleAuthenticationInputResponse.call(this,n):this.processLocalAuthenticatorError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern description format."))},n.prototype.handleRegistrationInputResponse=function(n){var r=this._authenticatorConfig,i=n;return e.impl.PatternInputImpl.validateFormat(i)?r.min_length&&e.impl.PatternInputImpl.getPatternLength(i)<r.min_length?void this.processLocalAuthenticatorError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern length.")):void t.prototype.handleRegistrationInputResponse.call(this,n):void this.processLocalAuthenticatorError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern description format."))},n.prototype.extractPbkdfInputFromInputResponse=function(t){var n=t;return e.util.asciiToHex(n.getPatternDescription())},n.prototype.createAuthenticatorSession=function(){return this._uiHandler.createPatternAuthSession(n.authenticatorName,this.user.displayName,3,4)},n.prototype.authenticateInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.prototype.registerInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.authenticatorName="pattern",n}(t.AuthenticationDriverLocalSecretInputBased);t.AuthenticationDriverLocalPattern=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),Object.defineProperty(n.prototype,"authenticatorType",{get:function(){return n.authenticatorName},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"pinLength",{get:function(){return this._authenticatorConfig.length},enumerable:!0,configurable:!0}),n.prototype.handleRegistrationInputResponse=function(n){n.getPin().length!=this.pinLength?this.processLocalAuthenticatorError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,"Expecting an entry of length "+this.pinLength+".")):t.prototype.handleRegistrationInputResponse.call(this,n)},n.prototype.generatePendingEnrollment=function(e){var n=this;return t.prototype.generatePendingEnrollment.call(this,e).then(function(e){var t={length:n.pinLength};return e.authenticatorConfig=t,e})},n.prototype.extractPbkdfInputFromInputResponse=function(t){var n=t;return e.util.asciiToHex(n.getPin())},n.prototype.createAuthenticatorSession=function(){return this._uiHandler.createPinAuthSession(n.authenticatorName,this.user.displayName,this.pinLength)},n.prototype.authenticateInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.prototype.registerInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.authenticatorName="pin",n}(t.AuthenticationDriverLocalSecretInputBased);t.AuthenticationDriverLocalPinCode=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(e,t,r){return n.call(this,e,t,r)||this}return __extends(r,n),r.prototype.poll=function(){var n=this;this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"authenticate",this.pollingAssertionData(),{}).then(function(r){n.filterAssertionResult(r)&&n.shouldContinuePolling(r)?n.pumpInput():n.handleAuthenticateAssertionResult(r)||(n._sdk.log(e.LogLevel.Info,"Authenticator session done."),n.completeAuthenticatorSessionWithResult(new t.AuthenticationDriverSessionResultAuthenticationCompleted(r)))}).catch(function(t){n.performErrorRecoveryForError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},r}(t.AuthenticationDriver);t.AuthenticationDriverPolling=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n,r,i;n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i=function(i){function o(e,t,n){var r=i.call(this,e,t,n)||this;return r.methodName="mobileApprove",r.setupDataModel(t,n),r}return __extends(o,i),o.prototype.createAuthenticatorSession=function(){var r=this._uiHandler.createMobileApproveAuthSession("mobile_approve",this.user.displayName,this._instructions);if(!r)throw t.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createMobileApproveAuthSession");if(r.setAvailableTargets(this._selectableDevices),this._state==n.Protocol.AuthenticationMethodMobileApproveState.WaitForAuthenticate){this._selectedDevices=this._selectableDevices.map(function(e){return e});var i=null;if(this._otp){var o=t.OtpFormatImpl.fromAssertionFormat(this._otp.format);i=e.ts.mobile.sdk.impl.MobileApproveOtpImpl.create(this._otp.value,o)}r.setCreatedApprovalInfo(this._selectedDevices,i)}if(this._authenticationParameters){var a=this._authenticationParameters.filter(function(e){t.AuthenticationActionParameterTargetSelection});if(0!=a.length){this._sdk.log(t.LogLevel.Debug,"Target based driver found target selection parameters.");var s=this._selectableDevices.reduce(function(e,t){return e[t.getDeviceIdentifier()]=t,e},{});this._pendingTargetSelection=a.map(function(e){var n=e.getTarget(),r=s[n.getDeviceIdentifier()];if(!r)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Authentication parameter tried to select a device not presented as a selectable target");return r},{}),this._sdk.log(t.LogLevel.Debug,"Target based driver will select targets "+this._pendingTargetSelection+" based on selection parameter.")}}return r},o.prototype.authenticateInStartedSession=function(e){this._autoExecuted?this._autoExecuted=!1:this.reset(),this.pumpInput()},o.prototype.pumpInput=function(){if(this._state===n.Protocol.AuthenticationMethodMobileApproveState.WaitForApproval)this.createApproval();else{if(this._state!==n.Protocol.AuthenticationMethodMobileApproveState.WaitForAuthenticate)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Illegal authenticator state encountered: "+this._state);this.requestInputAndHandle()}},o.prototype.registerInStartedSession=function(e){throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Cannot register Mobile Approve authenticator.")},o.prototype.createApproval=function(){if(this._approvalId=null,this._pendingTargetSelection&&Object.keys(this._pendingTargetSelection).length){this._sdk.log(t.LogLevel.Debug,"Performing pending target selection "+this._pendingTargetSelection);var e=t.TargetBasedAuthenticatorInput.createTargetsSelectionRequest(this._pendingTargetSelection);this._pendingTargetSelection=null,this.handleAuthenticationInputResponse(e)}else this._strategy.user_selection&&this._selectableDevices&&this._selectableDevices.length?this.requestInputAndHandle():this.handleAuthenticationInputResponse(t.TargetBasedAuthenticatorInput.createTargetsSelectionRequest([]))},o.prototype.requestInputAndHandle=function(){var e=this;this._inputSession.promiseInput().then(function(t){e.handleInputOrControlResponse(t)})},o.prototype.handleAuthenticationInputResponse=function(e){switch(this._state){case n.Protocol.AuthenticationMethodMobileApproveState.WaitForApproval:var r=e.getSelectedTargets();if(r){this.handleTargetSelectionInput(r);break}throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Expected target selection input response but got: "+e);case n.Protocol.AuthenticationMethodMobileApproveState.WaitForAuthenticate:if(e.getAuthenticatorInput()instanceof t.MobileApproveInputRequestPolling){this.poll();break}throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Expected polling request input response but got: "+e);default:throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Illegal state for authenticator: "+this._state)}},o.prototype.handleTargetSelectionInput=function(e){var n=this;this._selectedDevices=e.map(function(e){var r=e;if(n._selectableDevices.indexOf(r)<0)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Attempt to select a Mobile Approve target not originally listed in the session.");return r}),this.createForSelectedTargets()},o.prototype.createForSelectedTargets=function(){var n,r=this;n=this._selectedDevices&&this._selectedDevices.length?{device_ids:this._selectedDevices.map(function(e){return e.getDeviceIdentifier()})}:{},this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"approval",n,{}).then(function(n){if(!r.handleGeneralAssertionResult(n))if(n.assertion_error_code)r._sdk.log(t.LogLevel.Error,"Assertion error encoutered. Starting error recovery."),r.performErrorRecoveryForError(t.impl.AuthenticationErrorImpl.errorForAssertionResponse(n));else{var i=null,o=n.data;if(o.otp){var a=t.OtpFormatImpl.fromAssertionFormat(o.otp.format);i=e.ts.mobile.sdk.impl.MobileApproveOtpImpl.create(o.otp.value,a)}r._approvalId=o.approval_id||null,r._state=o.state,r._inputSession.setCreatedApprovalInfo(r._selectedDevices,i),r._sdk.log(t.LogLevel.Debug,"Restarting auth or reg."),r.pumpInput()}}).catch(function(e){r.completeAuthenticatorSessionWithError(e)})},o.prototype.handleRegistrationInputResponse=function(e){throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Cannot register Mobile Approve authenticator.")},o.prototype.processControlRequest=function(e){e.getRequestType()===t.ControlRequestType.RetryAuthenticator&&this.reset(),i.prototype.processControlRequest.call(this,e)},o.prototype.filterAssertionResult=function(e){if(5==e.assertion_error_code)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.ApprovalDenied,"Approval was denied");if(21==e.assertion_error_code)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.ApprovalExpired,"Approval has expired");return!0},o.prototype.shouldContinuePolling=function(e){return 13==e.assertion_error_code},o.prototype.pollingAssertionData=function(){return{approval_id:this._approvalId}},o.prototype.reset=function(){this._state=n.Protocol.AuthenticationMethodMobileApproveState.WaitForApproval,this._approvalId=null,this._selectedDevices=null,this._inputSession.setCreatedApprovalInfo(null,null)},o.prototype.setupDataModel=function(e,t){this._state=e.state,this._otp=e.otp||null,this._strategy=e.strategy,this._selectableDevices=r.AuthenticationDriverDescriptorMobileApprove.createTargetsFromConfig(e),this._instructions=e.instructions,this._approvalId=e.approval_id||null,this._approvalId&&(this._autoExecuted=!0)},o}(r.AuthenticationDriverPolling),r.AuthenticationDriverMobileApprove=i}(t.sdk||(t.sdk={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i=function(i){function o(e,t,n){return i.call(this,e,t,n)||this}return __extends(o,i),o.prototype.getBiometricPromptFallbackControlType=function(){return null!=this._biometricPromptFallbackControlType?this._biometricPromptFallbackControlType:t.ControlRequestType.SelectMethod},o.authenticatorKeyTagForUser=function(e,t,r){return new n.TarsusKeyPath("per_user",e.guid.toString(),"local_auth_keys","native_face",t,r)},o.prototype.shouldAllowBiometricFallbackButton=function(e){var r=this;if(!e)return!1;var i=this._actionDriver.availableAuthenticatorsForSwitching.filter(function(e){return e!=r._authenticatorDescription});if(this._actionDriver instanceof n.actiondrivers.ActionDriverRegistration||this._actionDriver instanceof n.actiondrivers.ActionDriverAuthentication&&0==i.length)return!1;var o=e,a=o.getFallbackButtonTitle();if(!(a&&a.length>0))return!1;var s=o.getFallbackControlRequestType();switch(null==s&&(s=t.ControlRequestType.SelectMethod),s){case t.ControlRequestType.ChangeMethod:return this._actionDriver.availableAuthenticatorsForSwitching.filter(function(e){return e!=r._authenticatorDescription}).length>0;case t.ControlRequestType.SelectMethod:return this._actionDriver.availableAuthenticatorsForSwitching.length>0;default:return!0}},o.prototype.runSilentRegistration=function(){var e=this;return this.generateFaceNativeKeyForScheme("v2").then(function(n){var i=e.getNewOrUpdatedEnrollmentRecord(n),o={public_key:n.key.publicKeyToJson(),version:n.schemeVersion};return e._actionDriver.sendAuthenticatorAssertionRequest(e._authenticatorDescription,"register",null,o).then(function(n){if(n.assertion_error_code)throw t.impl.AuthenticationErrorImpl.errorForAssertionResponse(n);return e.user.updateEnrollmentRecord(i),new r.AuthenticationDriverSessionResultAuthenticationCompleted(n)})})},o.prototype.createAuthenticatorSession=function(){return this._uiHandler.createNativeFaceAuthSession(r.AuthenticationDriverDescriptorNativeFace.authenticatorName,this.user.displayName)},o.prototype.authenticateInStartedSession=function(e){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},o.prototype.registerInStartedSession=function(e){var n=this;i.prototype.registerInStartedSession.call(this,e),this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},Object.defineProperty(o.prototype,"authenticatorType",{get:function(){return r.AuthenticationDriverDescriptorNativeFace.authenticatorName},enumerable:!0,configurable:!0}),o.prototype.processLocalAuthenticatorError=function(r){var i=this,o=r,a=0,s=Promise.resolve();if(o.getErrorCode()==t.AuthenticationErrorCode.Internal&&o.getData()){var c=o.getData();a=c[e.sdkhost.ErrorDataNumFailures]||a,o=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(c,"Native Face")||o,(c[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricNotConfigured&&this._authenticatorDescription.getRegistered()||c[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricInvalidated)&&(s=n.LocalEnrollment.invalidateLocalRegistrationStatusAndNotifyUIHandler(this._actionDriver._controlFlowProcessor,this._authenticatorDescription))}s.catch(function(e){i._sdk.log(t.LogLevel.Error,e)}),s.finally(function(){var n=o.getData();return a&&i._operationMode==t.AuthenticatorSessionMode.Authentication?void i.processAuthFailureAssertionAndHandleError(o,a):n[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricFallbackPressed?(i._sdk.log(t.LogLevel.Debug,"Biometric prompt fallback button pressed"),void i.processControlRequest(t.ControlRequest.create(i.getBiometricPromptFallbackControlType()))):o.getErrorCode()==t.AuthenticationErrorCode.UserCanceled?(i._sdk.log(t.LogLevel.Debug,"Native face authenticator captured user cancel error code."),void i.invokeUiHandlerCancellation()):void i.performErrorRecoveryForError(o)})},o.prototype.getKeyForEnrollmentDataAndInput=function(n,r){var i=this;return new Promise(function(o,a){var s=r,c=i.shouldAllowBiometricFallbackButton(s);c&&(i._biometricPromptFallbackControlType=s.getFallbackControlRequestType());var u=i.authenticatorKeyTagForScheme(n.version,n.salt),l=i._sdk.host.getKeyPair(u,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);if(!l){var d={};throw d[e.sdkhost.ErrorDataInternalError]=e.sdkhost.InternalErrorBiometricInvalidated,new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to authenticate with invalidated FaceID.",d)}l.setBiometricPromptInfo(s?s.getPrompt():null,c?s.getFallbackButtonTitle():null,i._uiHandler,i._inputSession);var h={key:l};"v0"==n.version||"v1"==n.version?(i._sdk.log(t.LogLevel.Info,"Native face: Key rollover from "+n.version+" to v2"),i.generateKeyForScheme(r,"v2").then(function(e){return h.rolloverKeyData=e,h.rolloverReason="Upgrading native face authenticator scheme from "+n.version+" to v2",h}).then(o,a)):o(h)})},o.prototype.generatePendingEnrollment=function(e){var t=this,n=e,r=this.shouldAllowBiometricFallbackButton(n);return r&&(this._biometricPromptFallbackControlType=n.getFallbackControlRequestType()),this.generateKeyForScheme(e,"v2").then(function(e){return e.key.setBiometricPromptInfo(n.getPrompt(),r?n.getFallbackButtonTitle():null,t._uiHandler,t._inputSession),e})},o.prototype.generateKeyForScheme=function(e,t){return this.generateFaceNativeKeyForScheme(t)},o.prototype.generateFaceNativeKeyForScheme=function(n){var r;r="v1"==n||"v2"==n?this._sdk.host.generateRandomHexString(24):"";var i=this.authenticatorKeyTagForScheme(n,r);return t.util.wrapPromiseWithActivityIndicator(this._uiHandler,this._actionDriver.policyAction(),this._clientContext,this._sdk.host.generateKeyPair(i,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb,!0).then(function(e){return{key:e,salt:r,schemeVersion:n}},function(e){if(e.getErrorCode()==t.AuthenticationErrorCode.Internal&&e.getData()){var n=e.getData(),r=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(n,"Native Face");if(r)throw r}throw e}))},o.prototype.authenticatorKeyTagForScheme=function(e,t){return o.authenticatorKeyTagForUser(this.user,e,t)},o}(r.AuthenticationDriverLocal),r.AuthenticationDriverNativeFace=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.authenticationdrivers||(t.authenticationdrivers={}),r=function(n){function r(e,t,r,i){var o=n.call(this,e,t,i)||this;return o._possibleTargets=r,o.setupDataModel(t),o}return __extends(r,n),r.prototype.getPossibleTargets=function(){return this._possibleTargets},r.prototype.createAuthenticatorSession=function(){var n;if(this._otpInitialState==t.Protocol.AuthenticationMethodOtpState.Validate&&(this._lastSelectedTarget=this._possibleTargets[0]),0!=(n=this._authenticationParameters?this._authenticationParameters.filter(function(t){return t instanceof e.AuthenticationActionParameterTargetSelection}):[]).length){this._sdk.log(e.LogLevel.Debug,"Target based driver found target selection parameters.");var r=n[0].getTarget().getChannelAssertionId(),i=this._possibleTargets.filter(function(e){return e.getChannelAssertionId()==r});i.length?(this._pendingTargetSelection=i[0],this._sdk.log(e.LogLevel.Debug,"Target based driver will select target "+this._pendingTargetSelection+" based on selection parameter."),this._lastSelectedTarget=this._pendingTargetSelection):this._sdk.log(e.LogLevel.Warning,"Target selection parameter for target based auth driver specified invalid target assertiong id "+r+".")}var o=this._uiHandler.createOtpAuthSession("otp",this.user.displayName,this._possibleTargets,this._lastSelectedTarget);if(!o)throw e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createOtpAuthSession");return o.setAvailableTargets(this._possibleTargets),o},r.prototype.authenticateInStartedSession=function(t){var n=this;if(0==this._possibleTargets.length)return this._sdk.log(e.LogLevel.Warning,"No authentication target available for OTP. Doing error recovery."),void this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AuthenticatorExternalConfigError,"No targets available for OTP."),!0);if(this._sdk.log(e.LogLevel.Debug,"Notifying current session of generated OTP format and target"),this._inputSession.setGeneratedOtp(this._format,this._lastSelectedTarget),this._pendingTargetSelection){this._sdk.log(e.LogLevel.Debug,"Performing pending target selection "+this._pendingTargetSelection);var r=e.TargetBasedAuthenticatorInput.createTargetsSelectionRequest([this._pendingTargetSelection]);this._pendingTargetSelection=null,this.handleInputOrControlResponse(e.InputOrControlResponse.createInputResponse(r))}else this._inputSession.promiseInput().then(function(e){n.handleInputOrControlResponse(e)}).catch(function(t){n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},r.prototype.registerInStartedSession=function(t){throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Cannot register OTP authenticator.")},r.prototype.handleTargetBasedAuthenticatorConcreteInput=function(t){if(t instanceof e.OtpInputOtpSubmission)this.processAuthenticateAssertion({otp:t.getOtp()},{assertion_id:this._possibleTargets[0].getChannelAssertionId()});else{if(!(t instanceof e.OtpInputRequestResend))throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Unknown OTP response type received from application callback.");this.triggerForSelectedTarget()}},r.prototype.handleAuthenticateAssertionResult=function(t){return t.data&&t.data.additional_error_code&&1==t.data.additional_error_code&&(this._sdk.log(e.LogLevel.Debug,"Reached max number of attempts - invalidating current target."),this._lastSelectedTarget=null,this._format=null),n.prototype.handleAuthenticateAssertionResult.call(this,t)},r.prototype.handleAuthenticationInputResponse=function(t){if(t.getAuthenticatorInput())this.handleTargetBasedAuthenticatorConcreteInput(t.getAuthenticatorInput());else{if(!t.getSelectedTargets()[0])throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid target-based authetnicator response type received from application callback. Target-based authenticator inputs must be created by calling TargetBasedAuthenticatorInput.createAuthenticatorInput.");var n=t.getSelectedTargets();if(n.length>1)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Attempt to select multiple OTP targets while OTP supports only a single target.");var r=n[0];if(this._possibleTargets.indexOf(r)<0)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Attempt to select an OTP target not originally listed in the session.");this._lastSelectedTarget=r,this.triggerForSelectedTarget()}},r.prototype.triggerForSelectedTarget=function(){var n=this;if(!this._lastSelectedTarget)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to trigger OTP generation without a selected target.");var r={target_id:this._lastSelectedTarget.getTargetIdentifier(),channel_index:this._lastSelectedTarget.getChannelIndex()},i={assertion_id:this._lastSelectedTarget.getChannelAssertionId()};this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"otp",r,i).then(function(r){r.assertion_error_code&&r.assertion_error_code!=t.Protocol.AssertionErrorCode.FailOver&&(n._sdk.log(e.LogLevel.Error,"Assertion error encoutered. Clearing last selected target."),n._lastSelectedTarget=null),n.handleAuthenticateAssertionResult(r)||(r.data&&r.data.otp_format&&(n._sdk.log(e.LogLevel.Debug,"Received updated OTP and format."),n._format=e.OtpFormatImpl.fromAssertionFormat(r.data.otp_format)),n._sdk.log(e.LogLevel.Debug,"Restarting auth or reg."),n.authOrRegInStartedSession(!0))}).catch(function(e){n.completeAuthenticatorSessionWithError(e)})},r.prototype.handleRegistrationInputResponse=function(t){throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Cannot register OTP authenticator.")},r.prototype.setupDataModel=function(t){this._otpInitialState=t.state;var n=t.format||t.otp_format;this._format=n&&e.OtpFormatImpl.fromAssertionFormat(n)||null},r}(n.AuthenticationDriver),n.AuthenticationDriverOtp=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),n.prototype.createAuthenticatorSession=function(){return this._uiHandler.createPasswordAuthSession("password",this.user.displayName)},n.prototype.authenticateInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.prototype.registerInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeAuthenticatorSessionWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},n.prototype.handleAuthenticationInputResponse=function(t){var n=t.getPassword();n&&n.length>0?this.processAuthenticateAssertion({password:n}):this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,"Password can't be empty"))},n.prototype.handleRegistrationInputResponse=function(t){var n=t.getPassword();n&&n.length>0?this.processRegisterAssertion({password:n}):this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,"Password can't be empty"))},n}(t.AuthenticationDriver);t.AuthenticationDriverPassword=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),n.prototype.createAuthenticatorSession=function(){return this._uiHandler.createPatternAuthSession("pattern_centralized",this.user.displayName,3,4)},n.prototype.handleAuthenticationInputResponse=function(n){var r=n;e.impl.PatternInputImpl.validateFormat(r)?t.prototype.handleAuthenticationInputResponse.call(this,n):this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern description format."))},n.prototype.handleRegistrationInputResponse=function(n){var r=n,i=this._authenticatorConfig;return e.impl.PatternInputImpl.validateFormat(r)?i.min_length&&e.impl.PatternInputImpl.getPatternLength(r)<i.min_length?void this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern length.")):void t.prototype.handleRegistrationInputResponse.call(this,n):void this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern description format."))},n.prototype.generateSecretToSignForInputResponse=function(e){return e.getPatternDescription()},n}(t.AuthenticationDriverCentralizedSecretInputBased);t.AuthenticationDriverPattern=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),Object.defineProperty(n.prototype,"pinLength",{get:function(){return this._authenticatorConfig.length},enumerable:!0,configurable:!0}),n.prototype.createAuthenticatorSession=function(){return this._uiHandler.createPinAuthSession("pin_centralized",this.user.displayName,this.pinLength)},n.prototype.handleRegistrationInputResponse=function(n){n.getPin().length==this.pinLength?t.prototype.handleRegistrationInputResponse.call(this,n):this.performErrorRecoveryForError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,"Invalid PIN length provided.",{expected_length:this.pinLength}))},n.prototype.generateSecretToSignForInputResponse=function(e){return e.getPin()},n}(t.AuthenticationDriverCentralizedSecretInputBased);t.AuthenticationDriverPinCode=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.authenticationdrivers||(n.authenticationdrivers={}),i=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),i.prototype.createAuthenticatorSession=function(){var e=this,t=this.generatePlaceholderServerTokenGenerationPayload();return i.placeholderExtensionPoint.firstNonNull(function(n){return n.createPlaceholderAuthSession(e._authenticatorDescription.getPlaceholderId(),e._authenticatorConfig.placeholder_type||"",e._authenticatorDescription.getName()||"",e.user.displayName,e._authenticatorConfig.data||"",t)})||this._uiHandler.createPlaceholderAuthSession(this._authenticatorDescription.getPlaceholderId(),this._authenticatorConfig.placeholder_type||"",this._authenticatorDescription.getName()||"",this.user.displayName,this._authenticatorConfig.data||"",t)},i.prototype.authenticateOrRegisterInStratedSession=function(e){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(e){return n.completeAuthenticatorSessionWithError(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))})},i.prototype.authenticateInStartedSession=function(e){this.authenticateOrRegisterInStratedSession(e)},i.prototype.registerInStartedSession=function(e){this.authenticateOrRegisterInStratedSession(e)},i.prototype.handleAuthenticationInputResponse=function(e){this.handleAuthenticationOrRegistrationInputResponse(e)},i.prototype.handleRegistrationInputResponse=function(e){this.handleAuthenticationOrRegistrationInputResponse(e)},i.prototype.handleAuthenticationOrRegistrationInputResponse=function(e){e instanceof t.PlaceholderAuthSuccessResponse?(this._sdk.log(t.LogLevel.Debug,"Placeholder received PlaceholderAuthSuccessResponse."),this.handlePlaceholderSuccessResponse(e)):e instanceof t.PlaceholderAuthFailureResponse?(this._sdk.log(t.LogLevel.Debug,"Placeholder received PlaceholderAuthFailureResponse."),this.handlePlaceholderFailureResponse(e)):e instanceof t.PlaceholderAuthFailureWithServerProvidedStatusResponse?(this._sdk.log(t.LogLevel.Debug,"Placehoder received PlaceholderAuthFailureWithServerProvidedStatusResponse"),this.processAuthFailureAssertionAndHandleError(e.getFailureError(),1)):(this._sdk.log(t.LogLevel.Error,"Placeholder received unknkown response type."),this.performErrorRecoveryForError(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Placeholder received unknkown response type.")))},i.prototype.handlePlaceholderSuccessResponse=function(e){var n={token:e.getPlaceholderToken()};this._operationMode==t.AuthenticatorSessionMode.Authentication?this.processAuthenticateAssertion(n):this.processRegisterAssertion(n)},i.prototype.handlePlaceholderFailureResponse=function(e){this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"auth_failure",{num_of_failures:1});var r={status:e.getRegistrationStatus()==t.AuthenticatorRegistrationStatus.Registered?n.Protocol.AuthenticationMethodStatus.Registered:n.Protocol.AuthenticationMethodStatus.Unregistered,expired:e.getExpired(),locked:e.getLocked(),last_used:0};this._authenticatorDescription.updateWithAuthenticatorState(r),this.performErrorRecoveryForError(e.getFailureError())},i.prototype.generatePlaceholderServerTokenGenerationPayload=function(){var e=this.user.deviceId||this._actionDriver._controlFlowProcessor._session.deviceId(),t={assertion_id:this._authenticatorDescription.assertionId,challenge:this._actionDriver._controlFlowProcessor.challenge,device_id:e,auth_type:this._authenticatorDescription.getAuthenticatorId()};return btoa(JSON.stringify(t))},i.placeholderExtensionPoint=new n.ExtensionPoint(e.tarsusplugin.TARSUS_EXTENSION_POINT_NAME_PLACEHOLDER_EXTENSION),i}(r.AuthenticationDriver),r.AuthenticationDriverPlaceholder=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){var i=t.call(this,e,n,r)||this;return i._pendingRestartRequest=!1,i}return __extends(n,t),n.prototype.createAuthenticatorSession=function(){return this._pendingRestartRequest=!1,this._uiHandler.createSecurityQuestionAuthSession("question",this.user.displayName)},n.prototype.authenticateInStartedSession=function(n){var r=this,i=Promise.resolve(null);this._pendingRestartRequest&&(this._pendingRestartRequest=!1,i=this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"restart",{}).then(function(t){t.data&&t.data.question?r._currentStep=r.loadStepFromQuestionDict(t.data.question):r.completeAuthenticatorSessionWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unexpected response to question restart request."))})),i.then(function(e){t.prototype.authenticateInStartedSession.call(r,n)})},n.prototype.loadStepFromQuestionDict=function(t){var n=Object.keys(t);if(1!=n.length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Expecting a single authentication question.");return e.impl.SecurityQuestionStepDescriptionImpl.createForAuthQuestion(new e.impl.SecurityQuestionImpl(n[0],t[n[0]],!0))},n.prototype.createInitialInputStep=function(){var t=this._authenticatorConfig;switch(this._operationMode){case e.AuthenticatorSessionMode.Authentication:if(!t.question)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Expecting authentication question dictionary.");return this.loadStepFromQuestionDict(t.question);case e.AuthenticatorSessionMode.Registration:if(!t.questions||!t.reg_min_questions)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Expecting registration question dictionary.");var n=t.questions,r=Object.keys(n).map(function(t){return new e.impl.SecurityQuestionImpl(t,n[t].text,n[t].registered)});return e.impl.SecurityQuestionStepDescriptionImpl.createForRegistrationQuestions(r,t.reg_min_questions)}},n.prototype.prepareNextAuthenticationStep=function(e){return this.loadStepFromQuestionDict(e.data.question)},n.prototype.updateCurrentAuthenticationStep=function(e,t){return t},n.prototype.handleAuthenticationInputResponse=function(t){var n=t;if(this.verifyValidAnswers(n),1!=n.getAnswers().length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Expecting exactly one answer on secuirty question authentication.");var r=this.securityQuestionAnswersResposneToAnswerMap(n);this.processAuthenticateAssertion({answer:r})},n.prototype.handleRegistrationInputResponse=function(t){var n=t;if(this.verifyValidAnswers(n),this.currentSecurityQuestionsStep().getMinAnswersNeeded()>n.getAnswers().length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Not enough answers provided to security questions registration process.");var r=this.securityQuestionAnswersResposneToAnswerMap(n);this.processRegisterAssertion({answers:r})},n.prototype.handleErrorRecoveryAction=function(n,r){r.getErrorCode()==e.AuthenticationErrorCode.InvalidInput&&(this._pendingRestartRequest=!0),t.prototype.handleErrorRecoveryAction.call(this,n,r)},n.prototype.verifyValidAnswers=function(t){for(var n=0,r=t.getAnswers();n<r.length;n++){var i=r[n];if(i.getAnswer()&&(!i.getAnswer().getAnswerText()||0==i.getAnswer().getAnswerText().length))throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Empty answers are not allowed.")}},n.prototype.securityQuestionAnswersResposneToAnswerMap=function(t){var n=this,r={};return t.getAnswers().forEach(function(t){if(n.currentSecurityQuestionsStep().getSecurityQuestions().indexOf(t.getQuestion())<0)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Answer provided to a question not included in this step.");var i=n._sdk.host.calcHexStringEncodedSha256Hash(e.util.asciiToHex(t.getAnswer().getAnswerText().toLowerCase()));r[t.getQuestion().getSecurityQuestionId()]=i}),r},n.prototype.currentSecurityQuestionsStep=function(){return this._currentStep},n}(t.AuthenticationDriverMultiStep);t.AuthenticationDriverSecurityQuestions=n})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){return function(){}}();e.AuthenticationDriverSessionResult=t;var n=function(e){function t(t,n){var r=e.call(this)||this;return r.requiredAuthenticator=t||null,r.allowedAuthenticators=n||null,r}return __extends(t,e),t}(t);e.AuthenticationDriverSessionResultSwitchAuthenticator=n;var r=function(e){function t(t){var n=e.call(this)||this;return n.assertionResult=t,n}return __extends(t,e),t}(t);e.AuthenticationDriverSessionResultAuthenticationCompleted=r}(e.authenticationdrivers||(e.authenticationdrivers={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.authenticationdrivers||(t.authenticationdrivers={}),r=function(r){function i(e,t,n){var i=r.call(this,e,t,n)||this;return i._previousSelectedDevices=[],i.methodName="totp",i.setupDataModel(t,n),i}return __extends(i,r),i.prototype.setupDataModel=function(e,r){this._state=e.state,this._requiresChallengeGeneration=e.state!=t.Protocol.AuthenticationMethodTotpState.Validate,this._selectedDevices=null,this._state==t.Protocol.AuthenticationMethodTotpState.Validate&&e.challenge&&(this._challenge=this.createTotpChallenge(e.challenge)),e.selectable_devices?this._selectableDevices=n.AuthenticationDriverDescriptorTotp.createTargetsFromConfig(e):this._selectableDevices=null},i.prototype.createAuthenticatorSession=function(){if(this._authenticationParameters){var t=this._authenticationParameters.filter(function(t){e.AuthenticationActionParameterTargetSelection});if(this._selectableDevices&&0!=t.length){this._sdk.log(e.LogLevel.Debug,"Target based driver found target selection parameters.");var n=this._selectableDevices.reduce(function(e,t){return e[t.getDeviceIdentifier()]=t,e},{});this._pendingTargetSelection=t.map(function(t){var r=t.getTarget(),i=n[r.getDeviceIdentifier()];if(!i)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Authentication parameter tried to select a device not presented as a selectable target");return i},{}),this._sdk.log(e.LogLevel.Debug,"Target based driver will select targets "+this._pendingTargetSelection+" based on selection parameter.")}}var r=this._uiHandler.createTotpAuthSession("totp",this.user.displayName);if(!r)throw e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createTotpAuthSession");return r.setAvailableTargets(this._selectableDevices),r},i.prototype.handleRegistrationInputResponse=function(t){throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Cannot register TOTP authenticator.")},i.prototype.registerInStartedSession=function(t){throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Cannot register TOTP authenticator.")},i.prototype.authenticateInStartedSession=function(t){!this._selectedDevices&&this._pendingTargetSelection&&this._pendingTargetSelection.length&&(this._sdk.log(e.LogLevel.Debug,"TOTP authentication driver has "+this._pendingTargetSelection.length+" pending targets."),this._selectedDevices=this._pendingTargetSelection),this.requestInput()},i.prototype.requestInput=function(){var t=this;this._inputSession.setTargetDevices(this._selectedDevices),this._inputSession.setChallenge(this._challenge),this.pendingChallengeGeneration()?this.sendGenerateTotpAssertion():this._inputSession.promiseInput().then(function(e){t.handleInputOrControlResponse(e)}).catch(function(n){t.performErrorRecoveryForError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(n))})},i.prototype.handleAuthenticationInputResponse=function(t){var n=t.getAuthenticatorInput(),r=t.getSelectedTargets();if(n){this._sdk.log(e.LogLevel.Debug,"Handling OTP code Input.");var i={totp:n.getCode()};this._selectedDevices&&(i.device_ids=this._selectedDevices.map(function(e){return e.getDeviceIdentifier()})),this.processAuthenticateAssertion(i)}else{if(!r||!this._selectableDevices)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid target-based authenticator response type received from application callback. Target-based authenticator inputs must be created by calling TargetBasedAuthenticatorInput.createAuthenticatorInput.");var o=this._selectableDevices;if(this._sdk.log(e.LogLevel.Debug,"Handling target selection Input."),this._selectedDevices=r.map(function(t){var n=t;if(o.indexOf(n)<0)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Attempt to select a Totp target not originally listed in the session.");return n}),0===this._selectedDevices.length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,"No targets selected for TOTP.");this.requestInput()}},i.prototype.sendGenerateTotpAssertion=function(){var n=this,r={};this._selectedDevices&&(r.device_ids=this._selectedDevices.map(function(e){return e.getDeviceIdentifier()})),this._sdk.log(e.LogLevel.Debug,"Requesting TOTP generation"),this._actionDriver.sendAuthenticatorAssertionRequest(this._authenticatorDescription,"generate",r,{}).then(function(r){n._previousSelectedDevices=n._selectedDevices||[],r.assertion_error_code&&r.assertion_error_code!=t.Protocol.AssertionErrorCode.FailOver&&(n._sdk.log(e.LogLevel.Error,"Assertion error encountered."),n._selectedDevices=null),!n.handleAuthenticateAssertionResult(r)&&r.data&&(n._state=r.data.state,r.data.challenge&&(n._challenge=n.createTotpChallenge(r.data.challenge)),n.requestInput())}).catch(function(t){n.performErrorRecoveryForError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},i.prototype.pendingChallengeGeneration=function(){var e=this._selectedDevices&&(this._previousSelectedDevices.length!==this._selectedDevices.length||this._previousSelectedDevices.some(function(e,t){return e!==this._selectedDevices[t]},this)),n=!this._selectableDevices;return this._requiresChallengeGeneration&&(e||n&&this._state==t.Protocol.AuthenticationMethodTotpState.Generate)},i.prototype.createTotpChallenge=function(t){var n=new e.TotpChallenge;return n.setValue(t.value),n.setFormat(e.TotpChallengeFormatImpl.fromAssertionFormat(t.format)),n},i.prototype.handleAuthenticateAssertionResult=function(n){if(n.assertion_error_code&&n.assertion_error_code==t.Protocol.AssertionErrorCode.RepeatCurrentStep&&n.data&&"check_digit"==n.data.reason){this._sdk.log(e.LogLevel.Info,"handleAuthenticateAssertionResult() for Totp code with incorrect check digit");var i=new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,n.assertion_error_message||"Totp code with incorrect check digit");return i.setPublicProperty(e.AuthenticationErrorProperty.AuthenticatorInvalidInputErrorDescription,e.AuthenticationErrorPropertySymbol.AuthenticatorInvalidInputErrorDescriptionTotpIncorrectCheckDigit),this.performErrorRecoveryForError(i),!0}return r.prototype.handleAuthenticateAssertionResult.call(this,n)},i}(n.AuthenticationDriver),n.AuthenticationDriverTotp=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n;!function(e){e.LONG="tooLong",e.SHORT="tooShort",e.LOUD="tooLoud",e.SOFT="tooSoft",e.NOISY="tooNoisy",e.WRONG_PASSPHRASE="wrongPassphrase",e.VALID_PASSPHRASE="000"}(n||(n={}));var r=function(t){function r(e,n,r){return t.call(this,e,n,r)||this}return __extends(r,t),r.prototype.createAuthenticatorSession=function(){return this._uiHandler.createVoiceAuthSession("voice",this.user.displayName)},r.prototype.updatePassphraseFromAssertionResultIfNeeded=function(t){var n=t.data;if(n){var r=n.passphrase_text;r&&(this._sdk.log(e.LogLevel.Info,"handleAuthenticateAssertionResult() received updated passphrase"),this._authenticatorConfig.passphrase_text=r)}},r.prototype.handleRegisterAssertionResult=function(e){return this.updatePassphraseFromAssertionResultIfNeeded(e),t.prototype.handleRegisterAssertionResult.call(this,e)},r.prototype.handleAuthenticateAssertionResult=function(e){return this.updatePassphraseFromAssertionResultIfNeeded(e),t.prototype.handleAuthenticateAssertionResult.call(this,e)},r.prototype.createInitialInputStep=function(){var t=this._authenticatorConfig;return new e.impl.AudioAcquisitionStepDescriptionImpl(this.createStepTag(),t.passphrase_text)},r.prototype.prepareNextAuthenticationStep=function(t){var n=this._authenticatorConfig;return new e.impl.AudioAcquisitionStepDescriptionImpl(this.createStepTag(t.data&&t.data.additional_error_code),n.passphrase_text)},r.prototype.updateCurrentAuthenticationStep=function(e,t){return this.prepareNextAuthenticationStep(e)},r.prototype.handleAuthenticationInputResponse=function(e){var t=e;this.processAuthenticateAssertion(t.getAcquisitionResponse())},r.prototype.handleRegistrationInputResponse=function(e){var t=e;this.processRegisterAssertion(t.getAcquisitionResponse())},r.prototype.createStepTag=function(e){return"voice_"+(e?this.mapHintToVoiceError(e):n.VALID_PASSPHRASE)},r.prototype.mapHintToVoiceError=function(t){switch(t){case 101:return n.LONG;case 102:return n.SHORT;case 103:return n.LOUD;case 104:return n.SOFT;case 105:return n.NOISY;case 106:return n.WRONG_PASSPHRASE;default:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Voice error code "+t+" is unknown/unhandled")}},r}(t.AuthenticationDriverMultiStep);t.AuthenticationDriverVoice=r})((t=e.core||(e.core={})).authenticationdrivers||(t.authenticationdrivers={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.AuthenticatorDrivers={password:new e.SimpleAuthenticationDriverDescriptor(e.AuthenticationDriverPassword),pin_centralized:new e.SimpleAuthenticationDriverDescriptor(e.AuthenticationDriverPinCode),pin:new e.AuthenticationDriverDescriptorLocal(e.AuthenticationDriverLocalPinCode,e.AuthenticationDriverLocalPinCode.authenticatorName),pattern:new e.AuthenticationDriverDescriptorLocal(e.AuthenticationDriverLocalPattern,e.AuthenticationDriverLocalPattern.authenticatorName),pattern_centralized:new e.SimpleAuthenticationDriverDescriptor(e.AuthenticationDriverPattern),fingerprint:new e.AuthenticationDriverDescriptorFingerprint,face_id:new e.AuthenticationDriverDescriptorNativeFace,otp:new e.AuthenticationDriverDescriptorOtp,face_server:new e.AuthenticationDriverDescriptorFace,voice_server:new e.AuthenticationDriverDescriptorVoice,mobile_approve:new e.AuthenticationDriverDescriptorMobileApprove,totp:new e.AuthenticationDriverDescriptorTotp,question:new e.SimpleAuthenticationDriverDescriptor(e.AuthenticationDriverSecurityQuestions),fido2:new e.AuthenticationDriverDescriptorFido2(e.AuthenticationDriverFido2),device_biometrics:new e.AuthenticationDriverDescriptorDeviceStrongAuthentication,__placeholder:new e.SimpleAuthenticationDriverDescriptor(e.AuthenticationDriverPlaceholder)}}(e.authenticationdrivers||(e.authenticationdrivers={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e){this.enabledCollectors=e}return e.prototype.isEnabled=function(){var e=this.getAssociatedCollectorType();return null==e||-1!=this.enabledCollectors.indexOf(e)},e}();e.Collector=t}(e.collectors||(e.collectors={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n){var r=t.call(this,e)||this;return r.cacheValidityPeriod=n,r}return __extends(n,t),n.prototype.provide=function(e){var t=this;return new Promise(function(n,r){var i=t.getCachedData(e);i?n(i):t.provideNewData(e).then(function(r){t.saveCollectionResultToLocalStorage(e,r),n(r)},r)})},n.prototype.saveCollectionResultToLocalStorage=function(e,t){var n=e.host,r=this.getSchemeVersionTarsusKeyPath(),i=new Object;i.timeStamp=Date.now(),i.collectionResult=t,n.writeStorageKey(r,i)},n.prototype.getCachedData=function(t){var n=t.host,r=this.getSchemeVersionTarsusKeyPath(),i=n.readStorageKey(r);if(!i.collectionResult||!i.timeStamp)return t.log(e.LogLevel.Debug,"No collected data found in cache."),null;var o=i.timeStamp;return Date.now()-o>this.cacheValidityPeriod?(t.log(e.LogLevel.Debug,"Cached collected data invalidated."),null):(t.log(e.LogLevel.Debug,"Loaded cached collector data: "+JSON.stringify(i.collectionResult)),i.collectionResult)},n}(t.Collector);t.CacheableCollector=n})((t=e.core||(e.core={})).collectors||(t.collectors={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return __extends(r,n),r.prototype.provide=function(t){var n=new Object,r=new Object;return r.audio_acquisition_supported="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.AudioAcquitisionSupported),r.finger_print_supported="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.FingerprintSupported),r.image_acquisition_supported="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.ImageAcquitisionSupported),r.persistent_keys_supported="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.PersistentKeysSupported),r.face_id_key_bio_protection_supported="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.FaceIdKeyBioProtectionSupported),r.fido_client_present="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.FidoClientPresent),r.dyadic_present="true"==t.host.queryHostInfo(e.sdkhost.HostInformationKey.DyadicPresent),r.installed_plugins=t.pluginManager.getInitializedPlugins().map(function(t){return{plugin_name:t.getPluginInfo().getPluginName(),plugin_version:e.tarsusplugin.impl.PluginInfoImpl.versionToString(t.getPluginInfo())}}),""!=t.host.queryHostInfo(e.sdkhost.HostInformationKey.HostProvidedFeatures)&&(r.host_provided_features=t.host.queryHostInfo(e.sdkhost.HostInformationKey.HostProvidedFeatures)),n=r,Promise.resolve(n)},r.prototype.getAssociatedCollectorType=function(){return t.CollectorType.Capabilities},r}(n.Collector);n.CapabilitiesCollector=r}((n=t.core||(t.core={})).collectors||(n.collectors={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.collectors||(t.collectors={}),r=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return __extends(r,n),r.prototype.provide=function(n){var r=new Object;for(var i in e.CollectorType)r[i]=t.Protocol.CollectorState.Disabled;for(var o=0,a=this.enabledCollectors;o<a.length;o++)r[a[o]]=t.Protocol.CollectorState.Active;var s=new Object;for(var c in e.CollectorType)this.isNumeric(c)&&(s[e.CollectorType[c].toLowerCase()]=r[c]);return Promise.resolve(s)},r.prototype.getAssociatedCollectorType=function(){return null},r.prototype.isNumeric=function(e){return parseInt(e,10)>=0},r}(n.Collector),n.CollectorsStateCollector=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.collectors||(t.collectors={}),r=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return __extends(r,n),r.prototype.provide=function(e){var n=e.host.readStorageKey(t.User.storageKey);n.length=n.length||0;var r=new Object;return r.logged_users=n.length,Promise.resolve(r)},r.prototype.getAssociatedCollectorType=function(){return e.CollectorType.DeviceDetails},r}(n.Collector),n.DeviceDetailsCollector=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.collectors||(t.collectors={}),r=function(n){function r(e){return n.call(this,e,r.cacheValidityPeriod)||this}return __extends(r,n),r.prototype.provideNewData=function(n){var r=this;return new Promise(function(i,o){if(!n.currentSession)throw"No valid session.";var a=new Object;n.log(e.LogLevel.Debug,"Refreshing fido authenticators data");for(var s=new Array,c=0,u=t.authenticationdrivers._fidoClientProviders;c<u.length;c++){var l=u[c];s.push(l.getAvailableAuthenticatorsIds(n))}Promise.all(s.map(function(e){return e.catch(function(e){return new Error(e)})})).then(function(e){var t=r.getCollectedAaids(e,n);a.fido=t,i(a)}).catch(function(t){n.log(e.LogLevel.Error,"Error parsing fido authenticators collection results"+t),i({})})})},r.prototype.getAssociatedCollectorType=function(){return e.CollectorType.FidoAuthenticators},r.prototype.getSchemeVersionTarsusKeyPath=function(){return new t.TarsusKeyPath("fido_collection_result")},r.prototype.getCollectedAaids=function(t,n){for(var r=new Array,i=0,o=t;i<o.length;i++){var a=o[i];if(a instanceof Error)n.log(e.LogLevel.Error,"Error collecting fido authenticators details "+a);else if(a&&a.length>0)for(var s=0,c=a;s<c.length;s++){var u=c[s];if(u){var l=new Object;l.aaid=u,r.push(l)}}}return r},r.cacheValidityPeriod=6048e5,r}(n.CacheableCollector),n.FidoAuthenticatorsCollector=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.collectors||(t.collectors={}),r=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return __extends(r,n),r.prototype.provide=function(e){for(var t=new Object,n=0,i=r.authenticatorDriversLocal;n<i.length;n++){var o=i[n],a=this.provideLocalEnrollmentData(e,o);a&&(t[o]=a)}return Promise.resolve(t)},r.prototype.getAssociatedCollectorType=function(){return e.CollectorType.LocalEnrollments},r.prototype.provideLocalEnrollmentData=function(e,t){var n=null;if(e.currentSession){var r=e.currentSession.user.localEnrollments[t];r&&((n=new Object).registration_status=r.status,n.validation_status=r.validationStatus)}return n},r.authenticatorDriversLocal=[t.authenticationdrivers.AuthenticationDriverLocalPinCode.authenticatorName,t.authenticationdrivers.AuthenticationDriverLocalPattern.authenticatorName,t.authenticationdrivers.AuthenticationDriverDescriptorFingerprint.authenticatorName,t.authenticationdrivers.AuthenticationDriverDescriptorNativeFace.authenticatorName],r}(n.Collector),n.LocalEnrollmentsCollector=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.TarsusCollectors={capabilities:{createCollector:e.CapabilitiesCollector},collector_state:{createCollector:e.CollectorsStateCollector},device_details:{createCollector:e.DeviceDetailsCollector},hw_authenticators:{createCollector:e.FidoAuthenticatorsCollector},local_enrollments:{createCollector:e.LocalEnrollmentsCollector}}}(e.collectors||(e.collectors={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){return function(){}}();e.CredentialOperationResult=t;var n=function(e){function t(t){var n=e.call(this)||this;return n.signature=t,n}return __extends(t,e),t}(t);e.CredentialSignResult=n;var r=function(e){function t(t){var n=e.call(this)||this;return n.keyPair=t,n}return __extends(t,e),t}(t);e.CredentialUnwrapAsymmetricResult=r;var i=function(e){function t(t,n){var r=e.call(this)||this;return r.requiredAuthenticator=t||null,r.allowedAuthenticators=n||null,r}return __extends(t,e),t}(t);e.CredentialAuthOperationResultSwitchAuthenticator=i}(e.credential||(e.credential={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e,t,n){this._credentialId=e,this._host=t,this._userInteractionSessionProvider=n}return Object.defineProperty(e.prototype,"credentialId",{get:function(){return this._credentialId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"user",{get:function(){return this._userInteractionSessionProvider._session.user},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"host",{get:function(){return this._host},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sdk",{get:function(){return this._userInteractionSessionProvider._sdk},enumerable:!0,configurable:!0}),e.prototype.getClientContext=function(){return this._userInteractionSessionProvider._clientContext},e}();e.PKCredential=t}(e.credential||(e.credential={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(e,t,r){var i=n.call(this,e,t,r)||this;return i._externalCancelled=!1,i}return __extends(r,n),Object.defineProperty(r.prototype,"uiHandler",{get:function(){return this._userInteractionSessionProvider._uiHandler},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"authenticatorDescription",{get:function(){return this._authenticatorDescription},enumerable:!0,configurable:!0}),r.prototype.onCancelRun=function(){this._externalCancelled=!0},r.prototype.startCredentialSession=function(t){if(this._authenticatorConfig=this.host.getAuthenticatorConfig(this),this._inputSession=this.createAuthenticatorSession(),!this._inputSession)throw e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from authenticator session creation call.");this._authenticatorDescription=this.host.getAuthenticatorDescription(this),this._inputSession.startSession(this._authenticatorDescription,e.AuthenticatorSessionMode.Authentication,this.host.getPolicyAction(this),t)},r.prototype.endCredentialSession=function(){this._inputSession&&this._inputSession.endSession()},r.prototype.promiseRecoveryForError=function(t,n,r){var i=this;return n.indexOf(r)<0&&(r=n.indexOf(e.AuthenticationErrorRecovery.SelectAuthenticator)>=0?e.AuthenticationErrorRecovery.SelectAuthenticator:e.AuthenticationErrorRecovery.Fail),this._inputSession.promiseRecoveryForError(t,n,r).then(function(r){return i.sdk.log(e.LogLevel.Debug,"Error recovery selected "+r),i.sdk.log(e.LogLevel.Debug,"recover from error: "+t.getErrorCode()),n.indexOf(r)<0?(i.sdk.log(e.LogLevel.Error,"Invalid error recovery option from callback: "+r+" not in "+n),Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid error recovery action selected by callback."))):Promise.resolve(r)})},r.prototype.authenticateInStartedSession=function(t){var n=this;this._inputSession.promiseInput().then(function(e){return n.handleInputOrControlResponse(e)},function(t){return n.completeCredentialOperationWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})},r.prototype.processLocalAuthenticatorError=function(e){this.completeCredentialOperationWithError(e)},r.prototype.completeCredentialOperationWithResult=function(e){this._completionFunction(e)},r.prototype.completeCredentialOperationWithError=function(e){this._rejectionFunction(e)},r.prototype.handleInputOrControlResponse=function(t){try{t.isControlRequest()?this.processControlRequest(t.getControlRequest()):this.handleAuthenticationInputResponse(t.getResponse())}catch(t){this.completeCredentialOperationWithError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))}},r.prototype.processControlRequest=function(n){switch(this.sdk.log(e.LogLevel.Debug,"Processing control request "+n.getRequestType()),n.getRequestType()){case e.ControlRequestType.AbortAuthentication:this.completeCredentialOperationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Authentication cancelled due to abort control request."));break;case e.ControlRequestType.ChangeMethod:this.completeCredentialOperationWithResult(new t.CredentialAuthOperationResultSwitchAuthenticator(null,this.host.availableAuthenticatorsForSwitchMethod(this)));break;case e.ControlRequestType.SelectMethod:this.completeCredentialOperationWithResult(new t.CredentialAuthOperationResultSwitchAuthenticator);break;case e.ControlRequestType.CancelAuthenticator:this.invokeUiHandlerCancellation();break;case e.ControlRequestType.RetryAuthenticator:this.authenticateInStartedSession(!0);break;default:this.completeCredentialOperationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid ControlRequestType value during authentication session."))}},r.prototype.invokeUiHandlerCancellation=function(){var t=this;if(this._externalCancelled)this.processControlRequest(e.ControlRequest.create(e.ControlRequestType.AbortAuthentication));else{var n=[e.ControlRequestType.RetryAuthenticator,e.ControlRequestType.AbortAuthentication];this.getOtherAuthenticators().length>0&&n.push(e.ControlRequestType.ChangeMethod),this.host.availableAuthenticatorsForSwitchMethod(this).length>0&&n.push(e.ControlRequestType.SelectMethod),this.uiHandler.controlOptionForCancellationRequestInSession(n,this._inputSession).then(function(r){return r.getRequestType()==e.ControlRequestType.CancelAuthenticator?void t.completeCredentialOperationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"controlOptionForCancellationRequestInSession returned CancelAuthenticator which is an invalid option.")):n.indexOf(r.getRequestType())<0?void t.completeCredentialOperationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"controlOptionForCancellationRequestInSession returned an invalid option.")):void t.processControlRequest(r)})}},r.prototype.getOtherAuthenticators=function(){var e=this;return this.host.availableAuthenticatorsForSwitchMethod(this).filter(function(t){return t!=e._authenticatorDescription})},r}(t.PKCredential);t.PKCredentialAuth=n})((t=e.core||(e.core={})).credential||(t.credential={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.credential||(t.credential={}),r=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),i.prototype.evaluateLocalRegistrationStatus=function(){var n=this.user.localEnrollments[this.credentialId];return n?n.validationStatus==t.LocalEnrollmentValidationStatus.Invalidated?e.AuthenticatorRegistrationStatus.LocallyInvalid:n.status!=t.LocalEnrollmentStatus.Registered?e.AuthenticatorRegistrationStatus.Unregistered:e.AuthenticatorRegistrationStatus.Registered:e.AuthenticatorRegistrationStatus.LocallyInvalid},Object.defineProperty(i.prototype,"lastObtainedKeyPair",{get:function(){return this._lastObtainedKeyPair},set:function(e){this._lastObtainedKeyPair&&this._lastObtainedKeyPair!=e&&this._lastObtainedKeyPair.closeKeyPair(),this._lastObtainedKeyPair=e},enumerable:!0,configurable:!0}),i.prototype.endCredentialSession=function(){this.lastObtainedKeyPair&&(this.lastObtainedKeyPair=null),r.prototype.endCredentialSession.call(this)},i.prototype.onCancelRun=function(){r.prototype.onCancelRun.call(this),this.lastObtainedKeyPair&&(this.lastObtainedKeyPair=null)},i.prototype.handleAuthenticationInputResponse=function(t){var n=this,r=this.user.localEnrollments[this.credentialId];r?this.getKeyForEnrollmentDataAndInput(r,t).then(function(t){n.sdk.log(e.LogLevel.Debug,"Local authenticator key obtained; signing challenge"),n.completeCredentialOperationWithResult(t)}).catch(function(t){n.processLocalAuthenticatorError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))}):this.completeCredentialOperationWithError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.NoRegisteredAuthenticator,"Missing key for fingerprint authenticator"))},i.prototype.signHex=function(t){var r=this;return new Promise(function(i,o){r._rejectionFunction=o,r._completionFunction=r.buildCompletionFunction(i,o,function(){r.lastObtainedKeyPair.signHex(t).then(function(e){return i(new n.CredentialSignResult(e))},function(t){return r.processLocalAuthenticatorError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})}),r.authenticateInStartedSession(!1)})},i.prototype.unwrapAsymmetricKeyPairFromPrivateHex=function(t,r){var i=this;return new Promise(function(o,a){i._rejectionFunction=a,i._completionFunction=i.buildCompletionFunction(o,a,function(){i.lastObtainedKeyPair.unwrapAsymmetricKeyPairFromPrivateKeyHex(t,r).then(function(e){return o(new n.CredentialUnwrapAsymmetricResult(e))},function(t){return i.processLocalAuthenticatorError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))})}),i.authenticateInStartedSession(!1)})},i.prototype.buildCompletionFunction=function(t,r,i){var o=this;return function(a){if(a instanceof n.CredentialOperationResult)t(a);else{o.lastObtainedKeyPair=a;try{i()}catch(t){r(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(t))}}}},i}(n.PKCredentialAuth),n.PKCredentialAuthLocal=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.credential||(n.credential={}),i=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),i.prototype.getKeyForEnrollmentDataAndInput=function(e,n){var r=this;return new Promise(function(t,i){"v2"==e.version?r.getKeyForEnrollmentDataAndInputV2(e,n).then(t,i):r.getKeyForEnrollmentDataAndInputPreV2(e,n).then(t,i)}).then(function(e){if(!e)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.InvalidInput,"Invalid input provided to credential.");return e})},i.prototype.getKeyForEnrollmentDataAndInputV2=function(t,r){var i=this,o=this.extractPbkdfInputFromInputResponse(r);return n.vault.pbkdfStretchHexSecretIntoAESKey(t.salt,o,t.cryptoSettings.getLocalEnrollmentKeySizeInBytes(),t.cryptoSettings.getLocalEnrollmentKeyIterationCount(),!0,this.sdk).then(function(n){return n.decrypt(t.keyMaterial,null).then(function(t){return i.sdk.host.generateHexSeededKeyPairExternalRepresentation(e.sdkhost.KeyClass.FidoECCSigningKey,t).then(function(t){return i.sdk.host.importVolatileKeyPair(e.sdkhost.KeyClass.FidoECCSigningKey,t)})})})},i.prototype.getKeyForEnrollmentDataAndInputPreV2=function(t,n){var r=this;return this.authenticatorKeyTagForScheme(t.version,t.salt,t.cryptoSettings,n).then(function(t){return r.sdk.host.getKeyPair(t,e.sdkhost.KeyClass.StdSigningKey,e.sdkhost.KeyBiometricProtectionMode.None)})},i.prototype.authenticatorKeyTagForScheme=function(e,r,i,o){var a=this;return new Promise(function(s,c){var u=a.extractPbkdfInputFromInputResponse(o);if("v0"==e&&(a.sdk.log(t.LogLevel.Debug,"Using SDK CryptoSettings for migrated enrollment."),i=a.sdk.cryptoSettings),!i)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Missing crypto settings for local enrollment.");a.sdk.host.generatePbkdf2HmacSha1HexString(r,u,i.getLocalEnrollmentKeySizeInBytes(),i.getLocalEnrollmentKeyIterationCount()).then(function(r){var i=t.util.hexToBase64(r);return new n.TarsusKeyPath("per_user",a.user.guid.toString(),"local_auth_keys",a.credentialId,e,i)}).then(s,c)})},i}(r.PKCredentialAuthLocal),r.PKCredentialLocalSecretInputBased=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(){};t.CredentialAuthPinCodeConfig=n;var r=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),Object.defineProperty(n.prototype,"pinLength",{get:function(){return this._authenticatorConfig.length},enumerable:!0,configurable:!0}),n.prototype.extractPbkdfInputFromInputResponse=function(t){var n=t;return e.util.asciiToHex(n.getPin())},n.prototype.createAuthenticatorSession=function(){return this.uiHandler.createPinAuthSession(this.credentialId,this.user.displayName,this.pinLength)},n.create=function(e,t,r){return new n(e,t,r)},n}(t.PKCredentialLocalSecretInputBased);t.PKCredentialLocalPinCode=r})((t=e.core||(e.core={})).credential||(t.credential={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(t){function n(e,n,r){return t.call(this,e,n,r)||this}return __extends(n,t),n.prototype.handleAuthenticationInputResponse=function(n){var r=n;e.impl.PatternInputImpl.validateFormat(r)?t.prototype.handleAuthenticationInputResponse.call(this,n):this.processLocalAuthenticatorError(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Invalid pattern description format."))},n.prototype.extractPbkdfInputFromInputResponse=function(t){var n=t;return e.util.asciiToHex(n.getPatternDescription())},n.prototype.createAuthenticatorSession=function(){return this.uiHandler.createPatternAuthSession(this.credentialId,this.user.displayName,3,4)},n.create=function(e,t,r){return new n(e,t,r)},n}(t.PKCredentialLocalSecretInputBased);t.PKCredentialLocalPattern=n})((t=e.core||(e.core={})).credential||(t.credential={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.credential||(n.credential={}),i=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),i.prototype.authenticatorKeyTagForUser=function(e,t,r){return new n.TarsusKeyPath("per_user",e.guid.toString(),"local_auth_keys",this.credentialId,t,r)},i.prototype.evaluateLocalRegistrationStatus=function(){var n=r.prototype.evaluateLocalRegistrationStatus.call(this);if(n!=t.AuthenticatorRegistrationStatus.Registered)return n;var i=this.user.localEnrollments[this.credentialId],o=this.authenticatorKeyTagForScheme(i.version,i.salt),a=this.sdk.host.getKeyPair(o,e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);return a?(a.closeKeyPair(),t.AuthenticatorRegistrationStatus.Registered):t.AuthenticatorRegistrationStatus.LocallyInvalid},i.prototype.createAuthenticatorSession=function(){return this.uiHandler.createFingerprintAuthSession(this.credentialId,this.user.displayName)},i.prototype.processLocalAuthenticatorError=function(r){var i=this,o=r,a=Promise.resolve();if(o.getErrorCode()==t.AuthenticationErrorCode.Internal&&o.getData()){var s=o.getData();o=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(s,"Fingerprint")||o,(s[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricNotConfigured&&this._authenticatorDescription.getRegistered()||s[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricInvalidated)&&(a=n.LocalEnrollment.invalidateLocalRegistrationStatusAndNotifyUIHandler(this._userInteractionSessionProvider,this._authenticatorDescription))}a.catch(function(e){i.sdk.log(t.LogLevel.Error,e)}),a.finally(function(){if(o.getErrorCode()==t.AuthenticationErrorCode.UserCanceled)return i.sdk.log(t.LogLevel.Debug,"Fingerprint authenticator captured user cancel error code."),void i.invokeUiHandlerCancellation();i.completeCredentialOperationWithError(o)})},i.prototype.getKeyForEnrollmentDataAndInput=function(n,r){var i=this;return new Promise(function(o,a){var s=r,c=i.authenticatorKeyTagForScheme(n.version,n.salt),u=i.sdk.host.getKeyPair(c,e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);if(!u){var l={};throw l[e.sdkhost.ErrorDataInternalError]=e.sdkhost.InternalErrorBiometricInvalidated,new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to authenticate with invalidated Fingerprint.",l)}u.setBiometricPromptInfo(s.getPrompt(),i.shouldAllowBiometricFallbackButton(s)?s.getFallbackButtonTitle():null,i.uiHandler,i._inputSession),o(u)})},i.prototype.shouldAllowBiometricFallbackButton=function(e){if(!e)return!1;var t=e.getFallbackButtonTitle();return!!(t&&t.length>0)},i.prototype.authenticatorKeyTagForScheme=function(e,t){return this.authenticatorKeyTagForUser(this.user,e,t)},i.create=function(e,t,n){return new i(e,t,n)},i}(r.PKCredentialAuthLocal),r.PKCredentialFingerprint=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.credential||(n.credential={}),i=function(r){function i(e,t,n){return r.call(this,e,t,n)||this}return __extends(i,r),i.prototype.authenticatorKeyTagForUser=function(e,t,r){return new n.TarsusKeyPath("per_user",e.guid.toString(),"local_auth_keys","native_face",t,r)},i.prototype.evaluateLocalRegistrationStatus=function(){var n=r.prototype.evaluateLocalRegistrationStatus.call(this);if(n!=t.AuthenticatorRegistrationStatus.Registered)return n;var i=this.user.localEnrollments[this.credentialId],o=this.authenticatorKeyTagForScheme(i.version,i.salt),a=this.sdk.host.getKeyPair(o,e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);return a?(a.closeKeyPair(),t.AuthenticatorRegistrationStatus.Registered):t.AuthenticatorRegistrationStatus.LocallyInvalid},i.prototype.createAuthenticatorSession=function(){return this.uiHandler.createNativeFaceAuthSession(this.credentialId,this.user.displayName)},i.prototype.processLocalAuthenticatorError=function(r){var i=this,o=r,a=Promise.resolve();if(o.getErrorCode()==t.AuthenticationErrorCode.Internal&&o.getData()){var s=o.getData();o=t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(s,"Native Face")||o,(s[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricNotConfigured&&this._authenticatorDescription.getRegistered()||s[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricInvalidated)&&(a=n.LocalEnrollment.invalidateLocalRegistrationStatusAndNotifyUIHandler(this._userInteractionSessionProvider,this._authenticatorDescription))}a.catch(function(e){i.sdk.log(t.LogLevel.Error,e)}),a.finally(function(){if(o.getErrorCode()==t.AuthenticationErrorCode.UserCanceled)return i.sdk.log(t.LogLevel.Debug,"Native face authenticator captured user cancel error code."),void i.invokeUiHandlerCancellation();i.completeCredentialOperationWithError(o)})},i.prototype.getKeyForEnrollmentDataAndInput=function(n,r){var i=this;return new Promise(function(o,a){var s=r,c=i.authenticatorKeyTagForScheme(n.version,n.salt),u=i.sdk.host.getKeyPair(c,e.sdkhost.KeyClass.HardwareProtectedSignAndEncryptKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);if(!u){var l={};throw l[e.sdkhost.ErrorDataInternalError]=e.sdkhost.InternalErrorBiometricInvalidated,new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to authenticate with invalidated FaceID.",l)}u.setBiometricPromptInfo(s.getPrompt(),i.shouldAllowBiometricFallbackButton(s)?s.getFallbackButtonTitle():null,i.uiHandler,i._inputSession),o(u)})},i.prototype.shouldAllowBiometricFallbackButton=function(e){if(!e)return!1;var t=e.getFallbackButtonTitle();return!!(t&&t.length>0)},i.prototype.authenticatorKeyTagForScheme=function(e,t){return this.authenticatorKeyTagForUser(this.user,e,t)},i.create=function(e,t,n){return new i(e,t,n)},i}(r.PKCredentialAuthLocal),r.PKCredentialNativeFace=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.CredentialTypes={pin:e.PKCredentialLocalPinCode,pattern:e.PKCredentialLocalPattern,fingerprint:e.PKCredentialFingerprint,face_id:e.PKCredentialNativeFace}}(e.credential||(e.credential={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(){function e(e){this._authCtor=e}return e.prototype.createFidoAuthenticator=function(e,t,n,r,i,o){return new this._authCtor(e,t,n,r,i,o)},e.prototype.isAuthenticatorSupportedOnDevice=function(e){return!0},e}();e.SimpleFidoAuthenticatorDescriptor=t}(e.fidoclient||(e.fidoclient={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(n){function r(){return n.call(this,t.FidoAuthenticatorFingerprint)||this}return __extends(r,n),r.prototype.isAuthenticatorSupportedOnDevice=function(t){return"true"==t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.FingerprintSupported)},r}(t.SimpleFidoAuthenticatorDescriptor);t.FidoAuthenticatorDescriptorFingerprint=n}(t.fidoclient||(t.fidoclient={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(n){function r(){return n.call(this,t.FidoAuthenticatorNativeFace)||this}return __extends(r,n),r.prototype.isAuthenticatorSupportedOnDevice=function(t){return"true"==t.sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.FaceIdKeyBioProtectionSupported)},r}(t.SimpleFidoAuthenticatorDescriptor);t.FidoAuthenticatorDescriptorNativeFace=n}(t.fidoclient||(t.fidoclient={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(){function n(e,t,n,r,i,o){this._client=t,this._sdk=t.sdk,this._uiHandler=r,this._user=n,this._clientContext=i,this._action=o,this._authenticationDescription=e}return n.prototype.signHexWithKeyPair=function(e,t){return e.signHex(t)},n.prototype.generateKeyIdHex=function(t,n){return this._sdk.host.calcHexStringEncodedSha256Hash(e.util.asciiToHex(n.guid.toString()+"."+t+"."+this.aaid))},n.prototype.fidoRegisterWithHexUaf1TlvResponse=function(n,r,i){var o=this;return new Promise(function(i,a){o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator start auth session"),o.startAuthenticationSession(e.AuthenticatorSessionMode.Registration),o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator Prepare FCHash and key ID");var s=o._sdk.host.calcHexStringEncodedSha256Hash(e.util.asciiToHex(r)),c=o.generateKeyIdHex(n,o._user);o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator generate key pair"),o.generateKeyPair(c,n,o._user).then(function(n){o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator prepare KRD");var r=e.util.base64ToHex(n.publicKeyToJson().key),i={TAG_AAID:o.aaid,TAG_ASSERTION_INFO:{AuthenticatorVersion:o.authenticatorVersion,AuthenticationMode:1,SignatureAlgAndEncoding:t.ALG_SIGN_SECP256R1_ECDSA_SHA256_RAW,PublicKeyAlgAndEncoding:t.ALG_KEY_ECC_X962_RAW},TAG_FINAL_CHALLENGE_HASH:s,TAG_KEYID:c,TAG_COUNTERS:{SignCounter:o.signCounter,RegCounter:o.regCounter},TAG_PUB_KEY:r},a=e.util.tlvEncodeHex(t.FidoTLVTags,{TAG_UAFV1_KRD:i});return o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator sign assertion"),o.signHexWithKeyPair(n,a).then(function(n){o._sdk.log(e.LogLevel.Debug,"FIDO KRD Surrogate Assertion signature "+n);var r={TAG_UAFV1_REG_ASSERTION:{TAG_UAFV1_KRD:i,TAG_ATTESTATION_BASIC_SURROGATE:{TAG_SIGNATURE:n}}},a=e.util.tlvEncodeHex(t.FidoTLVTags,r);return o._sdk.log(e.LogLevel.Debug,"FIDO reg assertion TLV hex: "+a),e.util.hexToBase64(a)}).finally(function(){return n.closeKeyPair()})}).finally(function(){o.finishAuthenticationSession()}).then(i,a)})},n.prototype.fidoDeregister=function(e){var t=this.generateKeyIdHex(e,this._user);return this.deleteKeyPair(t,e,this._user)},n.prototype.fidoAuthenticateWithHexUaf1TlvResponse=function(n,r,i){var o=this;return new Promise(function(i,a){o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator start auth session"),o.startAuthenticationSession(e.AuthenticatorSessionMode.Authentication),o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator Prepare FCHash and key ID");var s=o._sdk.host.calcHexStringEncodedSha256Hash(e.util.asciiToHex(r)),c=o.generateKeyIdHex(n,o._user);o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator prepare signed data block for FIDO auth assertion");var u={TAG_AAID:o.aaid,TAG_ASSERTION_INFO:{AuthenticatorVersion:o.authenticatorVersion,AuthenticationMode:1,SignatureAlgAndEncoding:t.ALG_SIGN_SECP256R1_ECDSA_SHA256_RAW},TAG_AUTHENTICATOR_NONCE:o._sdk.host.generateRandomHexString(16),TAG_FINAL_CHALLENGE_HASH:s,TAG_TRANSACTION_CONTENT_HASH:"",TAG_KEYID:c,TAG_COUNTERS:{SignCounter:o.signCounter}},l=e.util.tlvEncodeHex(t.FidoTLVTags,{TAG_UAFV1_SIGNED_DATA:u});o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator loading key"),o.loadKeyPair(c,n,o._user).then(function(n){return o._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator signing auth assertion"),o.signHexWithKeyPair(n,l).then(function(n){o._sdk.log(e.LogLevel.Debug,"FIDO authentication assertion signature "+n);var r={TAG_UAFV1_AUTH_ASSERTION:{TAG_UAFV1_SIGNED_DATA:u,TAG_SIGNATURE:n}},i=e.util.tlvEncodeHex(t.FidoTLVTags,r);return o._sdk.log(e.LogLevel.Debug,"FIDO auth assertion TLV hex: "+i),e.util.hexToBase64(i)}).finally(function(){return n.closeKeyPair()})}).finally(function(){o.finishAuthenticationSession()}).then(i,a)})},n.prototype.startAuthenticationSession=function(e){this._authMode=e},n.prototype.finishAuthenticationSession=function(){},n}();t.SimpleFidoAuthenticator=n})((t=e.core||(e.core={})).fidoclient||(t.fidoclient={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.vault||(t.vault={}),r=function(){function r(e,t,n,r,i,o){this._user=e,this._vaultData=t,this._vaultId=n,this._vaultOwner=r,this._sdk=i,this._uiHandler=o}return Object.defineProperty(r,"noIntegrityElementKey",{get:function(){return"element"},enumerable:!0,configurable:!0}),r.prototype.isEmpty=function(){return null===this._vaultData||null===this._vaultData.data||""===this._vaultData.data},r.prototype.lock=function(){this._unlockedData=null,this.finalizeLock()},r.prototype.readVaultKey=function(t){if(!this._unlockedData)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to read from  a locked vault.");if(this.noIntegrity&&t!=r.noIntegrityElementKey)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unprotected vault may store only '"+r.noIntegrityElementKey+"' key");return this._unlockedData[t]},r.prototype.writeVaultKey=function(t,n){var i=this;if(!this._unlockedData)return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to write to a locked vault."));if(this.noIntegrity){if(t!=r.noIntegrityElementKey)return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unprotected vault may store only '"+r.noIntegrityElementKey+"' key"));if(!e.util.isHexString(n))return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Expecting hex string."))}this._unlockedData[t]=n;var o=this.hexStringFromJsonToEncrypt(this._unlockedData);return this.internalDataEncrypt(o).then(function(e){i._vaultData.data=e,r.updateVaultForUserWithId(i._user,i._vaultData,i._vaultId,i._sdk)})},r.getVaultForUserWithId=function(t,r,i,o,a){var s=this.vaultsForUser(t,o)[r.toString()];if(!s)throw o.log(e.LogLevel.Warning,"vault '"+r+"' for user '"+t.displayName+"' not found in '"+this.getStorageKeyForVaultsForUser(t.guid).toString()+"'"),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Vault not found.");var c=n.VaultTypes[s.type];if(!c)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"unhandled vault type: "+s.type);return new c(t,s,r,i,o,a)},r.deleteVaultForUserWithId=function(t,r,i){i.log(e.LogLevel.Debug,"Delete vault "+r+" for user "+t.displayName);var o=this.vaultsForUser(t,i),a=o[r.toString()];if(a){var s=n.VaultTypes[a.type];if(!s)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"unhandled vault type: "+a.type);i.log(e.LogLevel.Debug,"Vault descriptor found; deleting."),s.deletePrivateResources(t,a,i),delete o[r.toString()],i.log(e.LogLevel.Debug,"Updating storage after vault deletion."),i.host.writeStorageKey(this.getStorageKeyForVaultsForUser(t.guid),o)}else i.log(e.LogLevel.Warning,"vault '"+r+"' for user '"+t.displayName+"' not found in '"+this.getStorageKeyForVaultsForUser(t.guid).toString()+"'")},r.deleteAllVaultsForUser=function(e,t){t.host.deleteStorageKey(this.getStorageKeyForVaultsForUser(e.guid))},r.prototype.hexStringFromJsonToEncrypt=function(t){return this.noIntegrity?t[n.AuthenticatorVault.noIntegrityElementKey]:e.util.asciiToHex(JSON.stringify(t))},r.prototype.jsonFromDecryptedHexString=function(t){if(this.noIntegrity){var n={};return n[r.noIntegrityElementKey]=t,n}return JSON.parse(e.util.hexToAscii(t))},Object.defineProperty(r.prototype,"noIntegrity",{get:function(){return this._vaultData.noIntegrity},enumerable:!0,configurable:!0}),r.updateVaultForUserWithId=function(t,n,i,o){if(n.data.length>r.MAX_DATA_SIZE)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"vault size can not exceed "+r.MAX_DATA_SIZE);var a=this.vaultsForUser(t,o);a[i.toString()]=n,o.host.writeStorageKey(this.getStorageKeyForVaultsForUser(t.guid),a)},r.prototype.getValidErrorRecoveryOptions=function(t){var n=[e.AuthenticationErrorCode.AppImplementation,e.AuthenticationErrorCode.Internal,e.AuthenticationErrorCode.UserCanceled],r=[e.AuthenticationErrorCode.AuthenticatorExternalConfigError,e.AuthenticationErrorCode.AuthenticatorInvalidated,e.AuthenticationErrorCode.AuthenticatorLocked];if(n.indexOf(t.getErrorCode())>=0)return[e.AuthenticationErrorRecovery.Fail];var i=this._vaultOwner.getValidErrorRecoveryOptions(t);return r.indexOf(t.getErrorCode())>=0&&(i=i.filter(function(t){return t!=e.AuthenticationErrorRecovery.RetryAuthenticator})),i},r.getStorageKeyForVaultsForUser=function(e){return new t.TarsusKeyPath("per_user",e.toString(),"vaults")},r.migrateIncorrectlyStoredVaultsForUserIfExists=function(e,n){var r=new t.TarsusKeyPath("per_user","user","vaults"),i=n.host.readStorageKey(r);i&&0<Object.keys(i).length&&(n.host.writeStorageKey(e,i),n.host.deleteStorageKey(r))},r.vaultsForUser=function(e,t){var n=this.getStorageKeyForVaultsForUser(e.guid),r=t.host.readStorageKey(n);return(!r||0>=Object.keys(r).length)&&(this.migrateIncorrectlyStoredVaultsForUserIfExists(n,t),r=t.host.readStorageKey(n)),r||{}},r.MAX_DATA_SIZE=1e3,r}(),n.Vault=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(e,t,r,i,o,a){return n.call(this,e,t,r,i,o,a)||this}return __extends(r,n),r.prototype.unlock=function(n,r){var i=this;return new Promise(function(o,a){i._rejectFn=a,i._completeFn=o,i._policyAction=n,i._clientContext=r;var s=t.VaultTypes[i._vaultData.type];if(!t.isAuthenticatorVaultDescriptor(s))return i._sdk.log(e.LogLevel.Error,"failed to get descriptor for vault "+i._vaultId),void a(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"failed to create authenticator session"));if(i._sdk.log(e.LogLevel.Debug,"Creating vault unlock authenticator session"),i._inputSession=i.createAuthenticatorSession(),!i._inputSession)throw e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from vault unlock authenticator session creation.");i._sdk.log(e.LogLevel.Debug,"Invoking startSession on vault unlock authenticator session"),i._inputSession.startSession(s.getAuthenticatorDescription(i._sdk),e.AuthenticatorSessionMode.Authentication,n,r),i.unlockInStartedSession()})},r.prototype.unlockInStartedSession=function(){var t=this;this._sdk.log(e.LogLevel.Debug,"Getting vault unlock input"),this._inputSession.promiseInput().then(function(n){if(!n.isControlRequest())return t._sdk.log(e.LogLevel.Debug,"Vault got authenticator input. Trying to unlock."),t.prepareToUnlock(t._inputSession,n.getResponse(),t._vaultData.data,t._policyAction,t._clientContext).then(function(){return t._sdk.log(e.LogLevel.Debug,"Unlock preparation complete."),t.isEmpty()?(t._sdk.log(e.LogLevel.Info,"Unlockling empty vault."),t._unlockedData={},!0):(t._sdk.log(e.LogLevel.Debug,"Decrypting vault."),t.internalDataDecrypt(t._vaultData.data).then(function(n){return t._unlockedData=t.jsonFromDecryptedHexString(n),t._sdk.log(e.LogLevel.Info,"Vault unlocked."),!0}))}).then(function(e){t._inputSession.endSession(),t._completeFn(e)});t._sdk.log(e.LogLevel.Debug,"Vault unlock: received control request "+n.getControlRequest()),t.processControlRequest(n.getControlRequest())}).catch(function(n){var r=e.impl.AuthenticationErrorImpl.ensureAuthenticationError(n);t._sdk.log(e.LogLevel.Error,r.getMessage()),t.handleLocalDecryptError(e.impl.AuthenticationErrorImpl.ensureAuthenticationError(r))})},r.prototype.handleLocalDecryptError=function(t){var n=this,r=this.getValidErrorRecoveryOptions(t),i=r.indexOf(e.AuthenticationErrorRecovery.RetryAuthenticator)>=0?e.AuthenticationErrorRecovery.RetryAuthenticator:e.AuthenticationErrorRecovery.Fail;this._inputSession.promiseRecoveryForError(t,r,i).then(function(i){switch(i){case e.AuthenticationErrorRecovery.RetryAuthenticator:n.unlockInStartedSession();break;case e.AuthenticationErrorRecovery.Fail:n._inputSession.endSession(),n._rejectFn(t);break;case e.AuthenticationErrorRecovery.ChangeAuthenticator:if(r.indexOf(e.AuthenticationErrorRecovery.ChangeAuthenticator)>-1){n._inputSession.endSession(),n._completeFn(!1);break}default:n._inputSession.endSession(),n._rejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"recovery option choice was not offered"))}})},r.prototype.processControlRequest=function(t){switch(this._sdk.log(e.LogLevel.Debug,"Processing control request "+t.getRequestType()),t.getRequestType()){case e.ControlRequestType.AbortAuthentication:this._inputSession.endSession(),this._rejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Authentication cancelled due to abort control request."));case e.ControlRequestType.ChangeMethod:this._inputSession.endSession(),this._completeFn(!1);break;case e.ControlRequestType.CancelAuthenticator:this.invokeUiHandlerCancellation();break;case e.ControlRequestType.RetryAuthenticator:this.unlockInStartedSession();break;default:this._inputSession.endSession(),this._rejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Invalid ControlRequestType value during authentication session."))}},r.prototype.invokeUiHandlerCancellation=function(){var t=this,n=this._vaultOwner.getValidCancelOptions();null==n?(this._inputSession.endSession(),this._rejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Authentication cancelled due to abort control request."))):this._uiHandler.controlOptionForCancellationRequestInSession(n,this._inputSession).then(function(n){n.getRequestType()==e.ControlRequestType.CancelAuthenticator?(t._inputSession.endSession(),t._rejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"controlOptionForCancellationRequestInSession returned CancelAuthenticator which is an invalid option."))):t.processControlRequest(n)})},r}(t.Vault);t.AuthenticatorVault=n;var r=function(){function t(e,t){this._type=e,this._name=t}return t.prototype.getAuthenticatorId=function(){return this._name},t.prototype.getName=function(){return this._name},t.prototype.getType=function(){return this._type},t.prototype.getSupportedOnDevice=function(){return!0},t.prototype.getRegistrationStatus=function(){return e.AuthenticatorRegistrationStatus.Registered},t.prototype.getDefaultAuthenticator=function(){return!1},t.prototype.getRegistered=function(){return!0},t.prototype.getExpired=function(){return!1},t.prototype.getLocked=function(){return!1},t.prototype.getEnabled=function(){return!0},t}();t.AuthenticatorVaultDescription=r})((t=e.core||(e.core={})).vault||(t.vault={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.fidoclient||(n.fidoclient={}),i=function(r){function i(e,t,n,i,o,a){return r.call(this,e,t,n,i,o,a)||this}return __extends(i,r),Object.defineProperty(i.prototype,"aaid",{get:function(){return"1206#0002"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"authenticatorVersion",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"signCounter",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"regCounter",{get:function(){return 0},enumerable:!0,configurable:!0}),i.prototype.keyTag=function(e,t){return new n.TarsusKeyPath("per_user",e.guid.toString(),"fido_authenticators",this.aaid,t)},i.prototype.startAuthenticationSession=function(e){if(r.prototype.startAuthenticationSession.call(this,e),this._fpSession=this._uiHandler.createFingerprintAuthSession(n.authenticationdrivers.AuthenticationDriverDescriptorFingerprint.authenticatorName,this._user.displayName),!this._fpSession)throw t.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createFingerprintAuthSession.");this._fpSession.startSession(this._authenticationDescription,e,this._action,this._clientContext)},i.prototype.finishAuthenticationSession=function(){this._fpSession&&(this._fpSession.endSession(),this._fpSession=null)},i.prototype.signHexWithKeyPair=function(n,r){var i=this;return n.signHex(r).catch(function(o){if(o.getData()[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorWrongBiometric||o.getData()[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricOsLockTemporary)return i._sdk.log(t.LogLevel.Debug,"FIDO signing received a wrong biometric error; retrying authentication."),i.signHexWithKeyPair(n,r);throw i._sdk.log(t.LogLevel.Debug,"FIDO signing received an error: "+o+". Propagating."),o})},i.prototype.prepareKeyPairBio=function(e){var n=this;try{return this._fpSession?this._fpSession.promiseInput().then(function(r){if(!r.isControlRequest()){var i=r.getResponse();return e.setBiometricPromptInfo(i.getPrompt(),"",n._uiHandler,n._fpSession),e}switch(r.getControlRequest().getRequestType()){case t.ControlRequestType.CancelAuthenticator:throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.UserCanceled,"User cancelled authentication");default:throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Unsupported control code when running fingerprint session within FIDO: "+r.getControlRequest().getRequestType())}}):Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to prepare key biometrics without an existing FP session"))}catch(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},i.prototype.generateKeyPair=function(t,n,r){var i=this;return this._sdk.host.generateKeyPair(this.keyTag(r,t),e.sdkhost.KeyClass.FidoECCSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb,!0).then(function(e){return i.prepareKeyPairBio(e)})},i.prototype.deleteKeyPair=function(e,t,n){var r=this;return new Promise(function(t,i){r._sdk.host.deleteKeyPair(r.keyTag(n,e))})},i.prototype.loadKeyPair=function(t,n,r){var i=this;return new Promise(function(n,o){var a=i._sdk.host.getKeyPair(i.keyTag(r,t),e.sdkhost.KeyClass.FidoECCSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);i.prepareKeyPairBio(a).then(n,o)})},i}(r.SimpleFidoAuthenticator),r.FidoAuthenticatorFingerprint=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.fidoclient||(n.fidoclient={}),i=function(r){function i(e,t,n,i,o,a){return r.call(this,e,t,n,i,o,a)||this}return __extends(i,r),Object.defineProperty(i.prototype,"aaid",{get:function(){return"1206#0003"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"authenticatorVersion",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"signCounter",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"regCounter",{get:function(){return 0},enumerable:!0,configurable:!0}),i.prototype.keyTag=function(e,t){return new n.TarsusKeyPath("per_user",e.guid.toString(),"fido_authenticators",this.aaid,t)},i.prototype.startAuthenticationSession=function(e){if(r.prototype.startAuthenticationSession.call(this,e),this._nfSession=this._uiHandler.createNativeFaceAuthSession(n.authenticationdrivers.AuthenticationDriverDescriptorNativeFace.authenticatorName,this._user.displayName),!this._nfSession)throw t.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createNativeFaceAuthSession.");this._nfSession.startSession(this._authenticationDescription,e,this._action,this._clientContext)},i.prototype.finishAuthenticationSession=function(){this._nfSession&&(this._nfSession.endSession(),this._nfSession=null)},i.prototype.signHexWithKeyPair=function(n,r){var i=this;return n.signHex(r).catch(function(o){if(o.getData()[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorWrongBiometric||o.getData()[e.sdkhost.ErrorDataInternalError]==e.sdkhost.InternalErrorBiometricOsLockTemporary)return i._sdk.log(t.LogLevel.Debug,"FIDO signing received a wrong biometric error; retrying authentication."),i.signHexWithKeyPair(n,r);throw i._sdk.log(t.LogLevel.Debug,"FIDO signing received an error: "+o+". Propagating."),o})},i.prototype.prepareKeyPairBio=function(e){var n=this;try{return this._nfSession?this._nfSession.promiseInput().then(function(r){if(!r.isControlRequest()){var i=r.getResponse();return e.setBiometricPromptInfo(i.getPrompt(),"",n._uiHandler,n._nfSession),e}switch(r.getControlRequest().getRequestType()){case t.ControlRequestType.CancelAuthenticator:throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.UserCanceled,"User cancelled authentication");default:throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"Unsupported control code when running fingerprint session within FIDO: "+r.getControlRequest().getRequestType())}}):Promise.reject(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Attempt to prepare key biometrics without an existing NF session"))}catch(e){return Promise.reject(t.impl.AuthenticationErrorImpl.ensureAuthenticationError(e))}},i.prototype.generateKeyPair=function(t,n,r){var i=this;return this._sdk.host.generateKeyPair(this.keyTag(r,t),e.sdkhost.KeyClass.FidoECCSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb,!0).then(function(e){return i.prepareKeyPairBio(e)})},i.prototype.deleteKeyPair=function(e,t,n){var r=this;return new Promise(function(t,i){r._sdk.host.deleteKeyPair(r.keyTag(n,e))})},i.prototype.loadKeyPair=function(t,n,r){var i=this;return new Promise(function(n,o){var a=i._sdk.host.getKeyPair(i.keyTag(r,t),e.sdkhost.KeyClass.FidoECCSigningKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);i.prepareKeyPairBio(a).then(n,o)})},i}(r.SimpleFidoAuthenticator),r.FidoAuthenticatorNativeFace=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i,o;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.fidoclient||(n.fidoclient={}),i="fidoKey",o=function(r){function o(e,t,n,i,o,a){return r.call(this,e,t,n,i,o,a)||this}return __extends(o,r),Object.defineProperty(o.prototype,"signCounter",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"regCounter",{get:function(){return 0},enumerable:!0,configurable:!0}),o.prototype.getValidCancelOptions=function(){return null},o.prototype.getValidErrorRecoveryOptions=function(e){return[t.AuthenticationErrorRecovery.RetryAuthenticator,t.AuthenticationErrorRecovery.Fail]},o.prototype.deleteKeyPair=function(e,t,r){var i=this;return new Promise(function(t,r){n.vault.Vault.deleteVaultForUserWithId(i._user,i.vaultId(e),i._sdk),t()})},o.prototype.vaultId=function(e){return new n.TarsusKeyPath("fido_authenticators",this.aaid,e)},o.prototype.generateKeyPair=function(r,o,a){var s=this;return this._sdk.host.generateKeyPairExternalRepresentation(e.sdkhost.KeyClass.FidoECCSigningKey).then(function(o){var c=s.vaultId(r);s._sdk.log(t.LogLevel.Debug,"Deleting existing vault");try{n.vault.Vault.deleteVaultForUserWithId(a,c,s._sdk)}catch(e){}return s._sdk.log(t.LogLevel.Debug,"Creating new vault"),s.authenticatorVaultDescriptor().createNew(a,c,s,s._sdk,s._uiHandler).then(function(e){return e.unlock(s._action,s._clientContext).then(function(n){if(n)return s._sdk.log(t.LogLevel.Debug,"Updating key in vault"),e.writeVaultKey(i,o).then(function(){return e.lock()});throw s._sdk.log(t.LogLevel.Error,"Aborting vault-based FIDO registration due to unlockResult == false"),new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorError,"Could not unlock vault for registration")})}).then(function(){return s._sdk.host.importVolatileKeyPair(e.sdkhost.KeyClass.FidoECCSigningKey,o)})})},o.prototype.loadKeyPair=function(r,o,a){var s=this;return new Promise(function(o,c){s._sdk.log(t.LogLevel.Debug,"Tarsus FIDO authenticator load key material from vault");var u=n.vault.Vault.getVaultForUserWithId(a,s.vaultId(r),s,s._sdk,s._uiHandler);u.unlock(s._action,s._clientContext).then(function(e){if(!e)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AuthenticatorError,"Unable to unlock authenticator.");s._sdk.log(t.LogLevel.Debug,"Tarsus FIDO authenticator vault unlocked");var n=u.readVaultKey(i);return s._sdk.log(t.LogLevel.Debug,"Tarsus FIDO authenticator key material read"),u.lock(),s._sdk.log(t.LogLevel.Debug,"Tarsus FIDO authenticator vault locked"),n}).then(function(n){return s._sdk.log(t.LogLevel.Debug,"Tarsus FIDO authenticator key materialized"),s._sdk.host.importVolatileKeyPair(e.sdkhost.KeyClass.FidoECCSigningKey,n)}).then(o,c)})},o}(r.SimpleFidoAuthenticator),r.FidoAuthenticatorVaultBased=o}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t,n;t=e.fidoclient||(e.fidoclient={}),n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),Object.defineProperty(n.prototype,"aaid",{get:function(){return"1206#0001"},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"authenticatorVersion",{get:function(){return 1},enumerable:!0,configurable:!0}),n.prototype.authenticatorVaultDescriptor=function(){return e.vault.VaultTypes.password},n}(t.FidoAuthenticatorVaultBased),t.FidoAuthenticatorPin=n}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.FidoAuthenticators={"1206#0001":new e.SimpleFidoAuthenticatorDescriptor(e.FidoAuthenticatorPin),"1206#0002":new e.FidoAuthenticatorDescriptorFingerprint,"1206#0003":new e.FidoAuthenticatorDescriptorNativeFace}}(e.fidoclient||(e.fidoclient={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){function t(e){return!!e.tlvSerializable}function n(n,r){var i=[];return Object.keys(r).forEach(function(o){var a=n[o];if(!a)throw"TLV encoding error: Unknown tag "+o;var s=r[o];s instanceof Array||(s=[s]),s.forEach(function(r){var s=r.__type||a.tagType||t(r)&&e.TlvTypes.Serializable;if(!s)throw"Unknown type for tag "+o;r.__type&&(r=r.__value);var c=s(r,n);i.push(e.TlvTypes.UInt16(a.id)),i.push(e.TlvTypes.UInt16(c.length/2)),i.push(c)})}),i.join("")}e.instanceOfTlvSerializable=t,e.TlvTypes={UInt8:function(t){return e.numberToHex(t,8)},UInt16:function(t){return e.numberToHex(t>>8&255|(255&t)<<8,16)},UInt32:function(t){return e.numberToHex((255&t)<<24|(t>>8&255)<<16|(t>>16&255)<<8|t>>24&255,32)},Object:function(e,t){return n(t,e)},Serializable:function(e,t){return e.tlvSerialize(t)},String:function(t,n){return e.asciiToHex(t)},HexBinary:function(e,t){return e},Struct:function(e){return function(t,n){var r=[];return Object.keys(e).forEach(function(i){if(i in t){var o=t[i],a=e[i];r.push(a(o,n))}}),r.join("")}}},e.tlvEncodeHex=n}(e.util||(e.util={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){t.ALG_SIGN_SECP256R1_ECDSA_SHA256_RAW=1,t.ALG_KEY_ECC_X962_RAW=256,t.FidoTLVTags={TAG_UAFV1_REG_ASSERTION:{id:15873,tagType:e.util.TlvTypes.Object},TAG_UAFV1_AUTH_ASSERTION:{id:15874,tagType:e.util.TlvTypes.Object},TAG_UAFV1_KRD:{id:15875,tagType:e.util.TlvTypes.Object},TAG_UAFV1_SIGNED_DATA:{id:15876,tagType:e.util.TlvTypes.Object},TAG_ATTESTATION_BASIC_SURROGATE:{id:15880,tagType:e.util.TlvTypes.Object},TAG_SIGNATURE:{id:11782,tagType:e.util.TlvTypes.HexBinary},TAG_KEYID:{id:11785,tagType:e.util.TlvTypes.HexBinary},TAG_FINAL_CHALLENGE_HASH:{id:11786,tagType:e.util.TlvTypes.HexBinary},TAG_AAID:{id:11787,tagType:e.util.TlvTypes.String},TAG_PUB_KEY:{id:11788,tagType:e.util.TlvTypes.HexBinary},TAG_COUNTERS:{id:11789,tagType:e.util.TlvTypes.Struct({SignCounter:e.util.TlvTypes.UInt32,RegCounter:e.util.TlvTypes.UInt32})},TAG_ASSERTION_INFO:{id:11790,tagType:e.util.TlvTypes.Struct({AuthenticatorVersion:e.util.TlvTypes.UInt16,AuthenticationMode:e.util.TlvTypes.UInt8,SignatureAlgAndEncoding:e.util.TlvTypes.UInt16,PublicKeyAlgAndEncoding:e.util.TlvTypes.UInt16})},TAG_AUTHENTICATOR_NONCE:{id:11791,tagType:e.util.TlvTypes.HexBinary},TAG_TRANSACTION_CONTENT_HASH:{id:11792,tagType:e.util.TlvTypes.HexBinary}}})((t=e.core||(e.core={})).fidoclient||(t.fidoclient={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n;!function(e){e[e.Reg=1]="Reg",e[e.Auth=2]="Auth",e[e.Dereg=3]="Dereg"}(n||(n={}));var r=function(e,t){this.aaid=e,this.keyId=t||null},i=function(){function e(e){var t=this;if(!e)throw"Missing policy.";if(e.rejected)throw"Unsupported policy 'rejected'";this._acceptedAuths=[],e.accepted.forEach(function(e){if(1==e.length){var n=null,i=null,o=!1,a=Object.keys(e[0]);for(var s in a)switch(a[s]){case"aaid":n=e[0].aaid;break;case"keyIDs":i=e[0].keyIDs;break;default:o=!0}if(o)return;if(!n)return;var c=i||[null];n.forEach(function(e){c.forEach(function(n){t._acceptedAuths.push(new r(e,n))})})}})}return Object.defineProperty(e.prototype,"acceptedAuths",{get:function(){return this._acceptedAuths},enumerable:!0,configurable:!0}),e}(),o=function(){function t(t){try{if(1!=t.header.upv.major||0!=t.header.upv.minor&&1!=t.header.upv.minor)throw"Invalid FIDO protocol version "+t.header.upv.major+"."+t.header.upv.minor;var r=t.header.op;if(this._operation=n[r],!this._operation)throw"Invalid FIDO protocol op "+t.header.op;if(this._appId=t.header.appID,!this._appId)throw"Missing appID";this._serverData=t.header.serverData,this._challenge=t.challenge,this._username=t.username;var o=t.policy;if(!o&&t.authenticators){var a=[];t.authenticators.forEach(function(e){a.push([{aaid:[e.aaid]}])}),o={accepted:a}}o&&(this._policy=new i(o)),this._header=t.header}catch(n){throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Cannot parse FIDO request ["+JSON.stringify(t)+"]: "+n,{fidoRequest:t,reason:n.toString()})}}return Object.defineProperty(t.prototype,"policy",{get:function(){return this._policy},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"challenge",{get:function(){return this._challenge},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"username",{get:function(){return this._username},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"operation",{get:function(){return this._operation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"header",{get:function(){return this._header},enumerable:!0,configurable:!0}),t.prototype.createFinalChallenge=function(){if(!this.challenge)throw"Missing challenge";var e={appID:this.appId,challenge:this.challenge,facetID:this.appId,channelBinding:{}};return btoa(JSON.stringify(e))},t}(),a=function(){function r(e){this._sdk=e}return Object.defineProperty(r.prototype,"sdk",{get:function(){return this._sdk},enumerable:!0,configurable:!0}),r.prototype.fidoResponseWithUaf1TlvAssertion=function(e,t,n){return{header:e.header,fcParams:t,assertions:[{assertion:n,assertionScheme:"UAFV1TLV"}]}},r.prototype.fidoClientXactReg=function(n,r){var i=this;return new Promise(function(o,a){if(!n.username)throw"Missing username in client registration request";if(!n.challenge)throw"Missing challenge";var s=n.createFinalChallenge();i._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client ready for registration action"),r.fidoRegisterWithHexUaf1TlvResponse(n.appId,s,t.FidoTLVTags.TAG_ATTESTATION_BASIC_SURROGATE.id).then(function(t){i._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator done succesfully"),o(i.fidoResponseWithUaf1TlvAssertion(n,s,t))},a)})},r.prototype.fidoClientXactDereg=function(t,n){var r=this;return new Promise(function(i,o){r._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client ready for deregistration action"),n.fidoDeregister(t.appId).then(function(){r._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator done succesfully"),i({})},o)})},r.prototype.fidoClientXactAuth=function(n,r){var i=this;return new Promise(function(o,a){if(!n.challenge)throw"Missing challenge";var s=n.createFinalChallenge();i._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client ready for authentication action"),r.fidoAuthenticateWithHexUaf1TlvResponse(n.appId,s,t.FidoTLVTags.TAG_ATTESTATION_BASIC_SURROGATE.id).then(function(t){i._sdk.log(e.LogLevel.Debug,"Tarsus FIDO authenticator done succesfully"),o(i.fidoResponseWithUaf1TlvAssertion(n,s,t))},a)})},r.prototype.fidoClientXact=function(r,i,a,s,c,u){var l=this;return new Promise(function(d,h){l._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client parsing FIDO request");var p=new o(u);if(p.username&&p.username.toLowerCase()!=a.userHandle.toLowerCase())throw l._sdk.log(e.LogLevel.Error,"Tarsus FIDO client encountered FIDO request with username not matching session username."),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Tarsus FIDO client encountered FIDO request with username not matching session username.");var f=p.policy.acceptedAuths.map(function(e){return t.FidoAuthenticators[e.aaid]}).filter(function(e){return!!e});if(!f.length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Couldn't find driver for Tarsus native FIDO client request.");l._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client loading authenticator");var m=f[0].createFidoAuthenticator(r,l,a,i,s,c);l._sdk.log(e.LogLevel.Info,"Tarsus FIDO client authenticator loaded: "+m.aaid);var g=null;switch(p.operation){case n.Reg:l._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client processing registration request."),g=l.fidoClientXactReg(p,m);break;case n.Auth:l._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client processing authentication request."),g=l.fidoClientXactAuth(p,m);break;case n.Dereg:l._sdk.log(e.LogLevel.Debug,"Tarsus FIDO client processing deregistration request."),g=l.fidoClientXactDereg(p,m);break;default:throw l._sdk.log(e.LogLevel.Error,"Unsupported FIDO Op when dispatching request: "+n[p.operation]),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unsupported FIDO op "+n[p.operation])}g.then(d,h)})},r.prototype.canHandlePolicy=function(e){var n=this;return new i(e).acceptedAuths.filter(function(e){return t.FidoAuthenticators[e.aaid]&&t.FidoAuthenticators[e.aaid].isAuthenticatorSupportedOnDevice(n)}).length>0},r.isPolicyTransmitFidoClientExclusive=function(e){return 0==new i(e).acceptedAuths.filter(function(e){return!t.FidoAuthenticators[e.aaid]}).length},r}();t.TarsusFidoClient=a})((t=e.core||(e.core={})).fidoclient||(t.fidoclient={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r=function(){function e(e,t,n,r,i){this._countdownTask=new s(t,n,r,1e3,i)}return e.prototype.promiseCodeGeneration=function(e){return this._countdownTask.run(e)},e}();n.TotpCodeGeneratorTimeBased=r;var i=function(){function e(n,r){if(n<1)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"timeStamp must be positive: "+n);e.assertValidTime(r),this._timeStep=n,this._startTime=r}return e.assertValidTime=function(e){if(e<0)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Negative time: "+e)},Object.defineProperty(e.prototype,"timeStep",{get:function(){return this._timeStep},enumerable:!0,configurable:!0}),e.prototype.getValueAtTime=function(t){e.assertValidTime(t);var n=t-this._startTime;return n>=0?Math.floor(n/this._timeStep):Math.floor((n-(this._timeStep-1))/this._timeStep)},e.prototype.getValueStartTime=function(e){return this._startTime+e*this._timeStep},e}(),o=function(){function e(e,t){this._sdk=t,this._hexElement=e}return e.prototype.sign=function(e){return this._sdk.host.calcHexStringEncodedHmacSha1HashWithHexEncodedKey(this._hexElement,e)},e}(),a=function(){function e(n,r){if(r<0||r>e.MAX_PASSCODE_LENGTH)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"PassCodeLength must be between 1 and "+e.MAX_PASSCODE_LENGTH+" digits.");this._signer=n,this._codeLength=r}return e.prototype.generateResponseCode=function(e,t){var n=t&&t.length||0,r=new ArrayBuffer(8+n),i=new DataView(r);if(i.setUint32(0,4294967295&Math.floor(e/4294967296)),i.setUint32(4,4294967295&e),t)for(var o=0;o<n;o++)i.setUint8(o+8,t.charCodeAt(o));return this.generateResponseCodeForByteArray(i)},e.prototype.generateResponseCodeForByteArray=function(e){for(var t="",n=0;n<e.byteLength;n++){var r=e.getUint8(n).toString(16);r.length<2&&(r="0"+r),t+=r}var i=this._signer.sign(t),o=parseInt(i[i.length-1],16),a=i.substring(2*o,2*o+8),s=(2147483647&parseInt(a,16))%Math.pow(10,this._codeLength);return this.padOutput(s)},e.prototype.padOutput=function(e){for(var t=e.toString(),n=t.length;n<this._codeLength;n++)t="0"+t;return t},e.MAX_PASSCODE_LENGTH=9,e.PASS_CODE_LENGTH=6,e.ADJACENT_INTERVALS=1,e.DIGITS_POWER=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9],e}(),s=function(){function n(e,t,n,r,s){this._lastSeenCounterValue=0x8000000000000000,this._counter=new i(t,0),this._generator=new a(new o(n,s),e),this._remainingTimeNotificationPeriod=r,this._sdk=s}return n.prototype.run=function(n){this._sdk.log(t.LogLevel.Debug,"Genearting a TOTP code.");var r=this._sdk.host.getCurrentTime(),i=this.getCounterValue(r);this._lastSeenCounterValue!=i&&(this._lastSeenCounterValue=i,this.fireTotpCounterValueChanged(n)),this._sdk.log(t.LogLevel.Debug,"Notifying session of TOTP value and countdown"),r=this._sdk.host.getCurrentTime();var o=this.getCounterValueAge(r),a=this._remainingTimeNotificationPeriod-o%this._remainingTimeNotificationPeriod;return Promise.resolve(e.tarsusplugin.TotpCodeGenerationOutput.create(this._mCode,null,this._counter.timeStep,Math.floor(this.getTimeTillNextCounterValue(r)/1e3),a,!1,null))},n.prototype.fireTotpCounterValueChanged=function(e){var t=Math.floor(this._sdk.host.getCurrentTime()/1e3),n=this._counter.getValueAtTime(t);this._mCode=this._generator.generateResponseCode(n,e)},n.prototype.getTimeTillNextCounterValue=function(e){var t=this.getCounterValue(e)+1;return 1e3*this._counter.getValueStartTime(t)-e},n.prototype.getCounterValue=function(e){return this._counter.getValueAtTime(Math.floor(e/1e3))},n.prototype.getCounterValueAge=function(e){return e-1e3*this._counter.getValueStartTime(this.getCounterValue(e))},n}()}((n=t.core||(t.core={})).totp||(n.totp={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;!function(e){var n,r,i;n=e.core||(e.core={}),r=n.totp||(n.totp={}),i=function(){function r(e,t,r){this._generatorName=e,this._user=t,this._sdk=r,this._vaultId=new n.TarsusKeyPath("totp_properties",this._generatorName)}return r.prototype.promiseProvisionOutput=function(e,t,n,r){var i=this;return this._isProvisioning=!0,this.createProvisionOutput(e,t,n,r).then(function(o){return i.selectAndCreateVault(o.getSecretToLock(),e,t,n,r).then(function(){return o.getUnprotectedProvisionOutput()})})},r.prototype.promiseCodeGenerator=function(t,n,r,i){var o=this;return this._isProvisioning=!1,this.unlockOtpSecret(i,r).then(function(a){return o._sdk.log(e.LogLevel.Debug,"generating TOTP session"),o.createCodeGenerator(t,n,a,r,i)})},r.prototype.updateProtectedProperties=function(t){return"string"==typeof t&&this._unlockedVault?this._unlockedVault.writeVaultKey(this.elementVaultKey,t):Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"could not update protected properties for generator <"+this._generatorName+">"))},r.prototype.deprovision=function(){n.vault.Vault.deleteVaultForUserWithId(this._user,this._vaultId,this._sdk)},r.prototype.unlockOtpSecret=function(t,r){var i=this;return new Promise(function(r){i._sdk.log(e.LogLevel.Debug,"Getting TOTP vault"),r(n.vault.Vault.getVaultForUserWithId(i._user,i._vaultId,i,i._sdk,t))}).catch(function(t){return i._sdk.log(e.LogLevel.Error,"Error obtaining vault for TOTP <"+i._user.displayName+", "+i._generatorName+">: "+t),Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.TotpNotProvisioned,"Totp generator '"+i._generatorName+"' for user '"+i._user.displayName+"' isn't provisioned",{underlying_error:t.toString()}))}).then(function(t){return i._sdk.log(e.LogLevel.Info,"Unlocking vault for TOTP seed"),t.unlock(null,r).then(function(n){if(!n)throw i._sdk.log(e.LogLevel.Error,"Change authetnicator requested during vault unlock for TOTP"),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"change authenticator isn't possible here");i._sdk.log(e.LogLevel.Debug,"TOTP Vault unlocked");var r=t.readVaultKey(i.elementVaultKey);return i._unlockedVault=t,i._sdk.log(e.LogLevel.Debug,"TOTP Vault locked"),r})})},r.prototype.getValidErrorRecoveryOptions=function(t){var n=[e.AuthenticationErrorRecovery.Fail,e.AuthenticationErrorRecovery.RetryAuthenticator];return this._isProvisioning&&this._availableAuthenticators.length>1&&n.push(e.AuthenticationErrorRecovery.ChangeAuthenticator),n},r.prototype.getValidCancelOptions=function(){var t=[e.ControlRequestType.RetryAuthenticator,e.ControlRequestType.AbortAuthentication];return this._isProvisioning&&this._availableAuthenticators.length>1&&t.push(e.ControlRequestType.ChangeMethod),t},r.prototype.getAvailableAuthenticators=function(e){var r=this,i=new Array;return Object.keys(n.vault.VaultTypes).forEach(function(e){var o=n.vault.VaultTypes[e];if(n.vault.isAuthenticatorVaultDescriptor(o)){var a=o.getAuthenticatorDescription(r._sdk);a.getSupportedOnDevice()&&i.push(new t.impl.AuthenticationOptionImpl(a,[]))}}),i=i.filter(function(t){return-1!==e.indexOf(t.getAuthenticator().getName())})},r.prototype.selectAndCreateVault=function(t,n,r,i,o){var a,s=this;if(n.protection_method){var c=this.getAvailableAuthenticators(n.protection_method);this._availableAuthenticators=c,this._sdk.log(e.LogLevel.Debug,"Selecting authenticator vault"),a=1<this._availableAuthenticators.length?o.selectAuthenticator(this._availableAuthenticators,r,i).then(function(t){switch(t.getResultType()){case e.AuthenticatorSelectionResultType.Abort:throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"Cancel during authenticator selection.");case e.AuthenticatorSelectionResultType.SelectAuthenticator:if(t.getSelectedAuthenticationParameters().length)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Authentication parameters not allowed in vault.");return t.getSelectedAuthenticator().getName()}}):Promise.resolve(this._availableAuthenticators[0].getAuthenticator().getName())}else{if(!n.vault)return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"failed to parse TOTP protection type"));var u=n.vault.vault_type;this._sdk.log(e.LogLevel.Debug,"Using '"+u+"' vault"),a=Promise.resolve(u)}return a.then(function(e){return s.createAndWriteToVault(e,t,n,o,r,i)})},r.prototype.createAndWriteToVault=function(t,r,i,o,a,s){var c=this,u=n.vault.VaultTypes[t];if(!u)return Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Unhandled protection method "+t));var l=u.supportsNoIntegrity()&&i.integrity_protection_disabled;return u.createNew(this._user,this._vaultId,this,this._sdk,o,l,i).then(function(e){return e.unlock(a,s).then(function(t){return t?e.writeVaultKey(c.elementVaultKey,r).then(function(){e.lock()}):c.selectAndCreateVault(r,i,a,s,o)})})},Object.defineProperty(r.prototype,"elementVaultKey",{get:function(){return n.vault.Vault.noIntegrityElementKey},enumerable:!0,configurable:!0}),r}(),r.TotpDriverVaultBased=i}(t=e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(n){var r=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.createCodeGenerator=function(e,t,n,r,i){return Promise.resolve(new o(e,n,this._sdk))},n.prototype.createProvisionOutput=function(t,n,r,o){return Promise.resolve(e.tarsusplugin.VaultBasedTotpProvisionOutput.create(t.ec_private_key||"",new i))},n.create=function(e,t,r){return new n(e,t,r)},n}(n.TotpDriverVaultBased);n.TotpDriverEc=r;var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.finalize=function(e){},t}(e.tarsusplugin.TotpProvisionOutput),o=function(){function n(e,r,i){this._sdk=i,this._sdk.log(t.LogLevel.Debug,"Construct EC OTP Code generator"),this._codeLen=e,n._ec||(n._ec=new elliptic.ec("p256"),this._sdk.log(t.LogLevel.Debug,"EC Loaded"));var o=t.util.base64ToHex(r),a=o.substring(o.length-64,o.length);this._keypair=n._ec.keyFromPrivate(a),this._sdk.log(t.LogLevel.Debug,"Private key parsed")}return n.prototype.promiseCodeGeneration=function(r){if(this._sdk.log(t.LogLevel.Debug,"Start generate EC OTP Code"),!r)return Promise.reject(t.impl.AuthenticationErrorImpl.appImplementationError("EC OTP generation requries a challenge."));var i=n._ec.keyFromPublic(atob(r));this._sdk.log(t.LogLevel.Debug,"Challenge parsed");var o=this._keypair.derive(i.getPublic()).toArray("be");o.push(0,0,0,1),o.push.apply(o,atob(r).split("").map(function(e){return e.charCodeAt(0)}));var a=o.map(function(e){return t.util.numberToHex(e,8)}).join(""),s=this._sdk.host.calcHexStringEncodedSha512Hash(a),c=n._ec.keyFromPrivate(parseInt("1000000000000".substring(0,1+this._codeLen),10).toString(16)).getPrivate(),u=2*(15&parseInt(s.substring(s.length-1),16)),l=s.substring(u,u+16);l=(127&parseInt(l.substring(0,2),16)).toString(16)+l.substring(2);var d=n._ec.keyFromPrivate(l).getPrivate().mod(c).toString(10,this._codeLen);return Promise.resolve(e.tarsusplugin.TotpCodeGenerationOutput.create(d,null,-1,-1,-1,!1,null))},n}()}((n=t.core||(t.core={})).totp||(n.totp={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.totp||(n.totp={}),i=function(i){function o(){return null!==i&&i.apply(this,arguments)||this}return __extends(o,i),o.prototype.otpSecretToLock=function(r){var i=this;return new Promise(function(o,a){var s=n.User.findUser(i._sdk,i._user.userHandle);if(s){var c=i._sdk.host.getKeyPair(s.deviceEncryptionKeyTag,e.sdkhost.KeyClass.StdEncryptionKey,e.sdkhost.KeyBiometricProtectionMode.None);if(!c)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"failed to find device encryption key for <"+i._user.displayName+">");var u=t.util.base64ToHex(r.shared_key);o(c.decrypt(u))}else a(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"failed to find user record for <"+i._user.displayName+">"))})},o.prototype.createCodeGenerator=function(e,t,n,i,o){return Promise.resolve(new r.TotpCodeGeneratorTimeBased(this,e,t.ttl,n,this._sdk))},o.prototype.createProvisionOutput=function(t,n,i,o){var a={ttl:t.ttl};return this.otpSecretToLock(t).then(function(t){var n=r.TotpProvisionOutputTimeBased.create(null,a);return e.tarsusplugin.VaultBasedTotpProvisionOutput.create(t,n)})},o.create=function(e,t,n){return new o(e,t,n)},o.transformOldToNewDataForUser=function(e){return{ttl:e.ttl}},o}(r.TotpDriverVaultBased),r.TotpDriverTimeBased=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.totp||(e.totp={}),n={totp:{create:t.TotpDriverTimeBased.create},ecotp:{create:t.TotpDriverEc.create}},r=function(){function r(){}return r.driverForTypeName=function(e,r,i,o){var a,s;if(this._extensionPoint.forEach(function(t){a||e!=t.getTotpTypeName()||(a=t)}),a)return a.create(r,i.guid.toString());if(this._extensionPointForVaultBased.forEach(function(t){s||e!=t.getTotpTypeName()||(s=t)}),s){var c=s.create(r,i.guid.toString());return new t.VaultBasedTotpDriverProxy(c,r,i,o)}var u=n[e];return u&&u.create(r,i,o)},r._extensionPoint=new e.ExtensionPoint("com.ts.mobile.plugins.totp"),r._extensionPointForVaultBased=new e.ExtensionPoint("com.ts.mobile.plugins.totp.vault"),r}(),t.TotpDrivers=r}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n,r;t=e.core||(e.core={}),n=t.totp||(t.totp={}),r=function(){function r(r,i,o,a){if(this._user=r,this._shouldStopCodeGen=!0,this._sdk=i,this._uiHandler=i.currentUiHandler,this._clientContext=a,this._session=o,this._sdk.log(e.LogLevel.Debug,"Loading TOTP processors for user "+r.displayName),this._propertiesContainer=this._sdk.host.readStorageKey(this.totpPropertiesContainerStorageKey),"v0"!=this._propertiesContainer.version){this._sdk.log(e.LogLevel.Debug,"Creating TOTP records for user "+this._user.displayName),this._propertiesContainer.properties={};var s=new t.TarsusKeyPath("per_user",this._user.guid.toString(),"totp_properties","default"),c=this._sdk.host.readStorageKey(s);if(0<Object.keys(c).length){if(this._user.deviceBound){this._sdk.log(e.LogLevel.Debug,"Migrating TOTP records for default TOTP generator for user "+this._user.displayName);var u={type:"totp",length:c.length,provision_id:this.provisionIdForGenerator("default"),specific_data:n.TotpDriverTimeBased.transformOldToNewDataForUser(c)};this._propertiesContainer.properties.default=u,this._sdk.log(e.LogLevel.Debug,"Updating storage on migration"),this.updateStorage()}else this._sdk.log(e.LogLevel.Warning,"Migration of TOTP records for user "+this._user.displayName+" can not be perfomed (user not bound)");this._sdk.log(e.LogLevel.Debug,"Deleting old TOTP records storage key"),this._sdk.host.deleteStorageKey(s)}this._propertiesContainer.version="v0",this.updateStorage()}}return Object.defineProperty(r.prototype,"totpPropertiesContainerStorageKey",{get:function(){return new t.TarsusKeyPath("per_user",this._user.guid.toString(),"totp")},enumerable:!0,configurable:!0}),r.prototype.isTotpProvisionedForGenerator=function(e){return!!this._propertiesContainer.properties[e]},r.prototype.updateWithProvisionedGenerator=function(e,t){var n={type:e.otp_type,length:e.length,add_check_digit:e.add_check_digit,provision_id:this.provisionIdForGenerator(e.generator)};t.getStoredData()&&(n.specific_data=t.getStoredData()),this._propertiesContainer.properties[e.generator]=n,this.updateStorage()},r.prototype.deleteProvisionForGenerator=function(e){var t=this.getTotpDriver(e);t&&(delete this._propertiesContainer.properties[e],this.updateStorage(),t.deprovision())},r.prototype.deleteAllProvisions=function(){var t=this,n=new Array;Object.keys(this._propertiesContainer.properties).forEach(function(r){var i=t.getTotpDriver(r);i?n.push(i):t._sdk.log(e.LogLevel.Error,"Failed to delete TOTP provisioning for "+r)}),this._propertiesContainer.properties={},this._sdk.host.deleteStorageKey(this.totpPropertiesContainerStorageKey),n.forEach(function(n){try{n.deprovision()}catch(r){t._sdk.log(e.LogLevel.Error,"Failed to delete TOTP private resources for "+n)}})},r.prototype.createTotpDriver=function(t,r){return n.TotpDrivers.driverForTypeName(r,t,this._user,this._sdk)||(this._sdk.log(e.LogLevel.Error,"Unhandled TOTP type: "+r),null)},r.prototype.getTotpDriver=function(t){var r=this._propertiesContainer.properties[t];return r?n.TotpDrivers.driverForTypeName(r.type,t,this._user,this._sdk)||(this._sdk.log(e.LogLevel.Error,"Unhandled TOTP type: "+r.type),null):(this._sdk.log(e.LogLevel.Warning,"Failed to find TOTP provision properties for "+t),null)},r.prototype.totpRequestFromCanonicalString=function(t){var r=this,i=null,o=null;if(255==(t=atob(t)).charCodeAt(0)){var a=n.parsing.totpDataFromCanonical(t.slice(1));a&&0<a.challengesSpecs.length&&Object.keys(this._propertiesContainer.properties).some(function(e){return a.challengesSpecs.some(function(t){return 0==r._propertiesContainer.properties[e].provision_id.lastIndexOf(t.seedId,0)&&(i=t.challenge,o=e,!0)})})}else o="default",i=t;if(!i||!o)throw this._sdk.log(e.LogLevel.Warning,"Failed to find TOTP attributes in canonical string"),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Failed to find TOTP attributes in canonical string");return e.impl.TotpGenerationRequestImpl.createTotpGenerationRequest(this._user,i,o)},r.prototype.runCodeGenerationSession=function(t,n,r,i){var o=this;return new Promise(function(a,s){o._sdk.log(e.LogLevel.Info,"Run TOTP generation session");var c=o.getTotpDriver(t);if(!c)return o._sdk.log(e.LogLevel.Error,"TOTP data not found for <"+o._user.displayName+", "+t+">"),void s(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.TotpNotProvisioned,"Totp generator '"+t+"' for '"+o._user.displayName+"' isn't provisioned"));var u=o._propertiesContainer.properties[t];c.promiseCodeGenerator(u.length,u.specific_data,r,i).then(function(c){o._appCodeGenSession=i.createTotpGenerationSession(o._user.displayName,t),o._appCodeGenSession?(o._generatorName=t,o._codeGenerator=c,o._requireChallenge=n,o._codeGenCompleteFn=a,o._codeGenRejectFn=s,o._sdk.log(e.LogLevel.Debug,"Invoking TOTP client session startSession"),o._appCodeGenSession.startSession(o,null,r),o._sdk.log(e.LogLevel.Info,"TOTP client session running")):s(e.impl.AuthenticationErrorImpl.appImplementationError("Invalid return from createTotpGenerationSession."))}).catch(s)})},r.prototype.runCodeGenerationSessionWithRequest=function(e,t,n){return this._codeGenDesignatedRequest=e,this.runCodeGenerationSession(e.getGeneratorName(),!1,t,n)},r.prototype.startCodeGeneration=function(){if(this._sdk.log(e.LogLevel.Debug,"Got request to start code generation."),!this._appCodeGenSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to start code generation on a finished TOTP session.");this._shouldStopCodeGen=!1,this._requireChallenge?this.startChallengeRequireCodeGeneration(this._appCodeGenSession):(this._sdk.log(e.LogLevel.Debug,"TOTP session starting code generation"),this.generateCode(this._codeGenDesignatedRequest&&this._codeGenDesignatedRequest.getChallenge()))},r.prototype.finishSession=function(){if(this._sdk.log(e.LogLevel.Debug,"TOTP session finishing"),this._shouldStopCodeGen=!0,!this._appCodeGenSession)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Attempt to finish a finished TOTP session.");this._appCodeGenSession.endSession(),this._appCodeGenSession=null,this._codeGenCompleteFn(!0)},r.prototype.updatedWithGeneratorSpecificProperties=function(e,t){var n=this._propertiesContainer.properties[e];return!!n&&(n.specific_data=t,this.updateStorage(),!0)},r.prototype.startChallengeRequireCodeGeneration=function(t){var n=this;this._sdk.log(e.LogLevel.Debug,"Starting TOTP challenge acquisition."),t.promiseChallengeInput().then(function(r){if(r.isControlRequest())switch(r.getControlRequest().getRequestType()){case e.ControlRequestType.AbortAuthentication:t.endSession(),n._codeGenRejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.UserCanceled,"User cancelled generation"));break;default:t.endSession(),n._codeGenRejectFn(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.AppImplementation,"Unsupported control code when running TOTP challenge acquisition: "+r.getControlRequest().getRequestType()))}else n._sdk.log(e.LogLevel.Debug,"Challenge acquired successfully. Going to start generation of TOTP codes."),n.generateCode(r.getResponse().getChallenge())})},r.prototype.generateCode=function(t){var n=this;this._shouldStopCodeGen||this._codeGenerator.promiseCodeGeneration(t||null).then(function(r){var i;if(n._shouldStopCodeGen||(r.getMessage()&&n._appCodeGenSession.setMessage(r.getMessage()),i=n._propertiesContainer.properties[n._generatorName].add_check_digit?n.computeErrorControlledCode(r.getCode()):r.getCode(),n._appCodeGenSession.setTotpCode(i,r.getTimeStepSeconds(),r.getExpiresInSeconds()),0<r.getSecondsTillNextInvocation()&&n._sdk.host.createDelayedPromise(r.getSecondsTillNextInvocation()).then(function(e){n.generateCode(t)})),r.getShouldUpdateSpecificProperties()&&!n.updatedWithGeneratorSpecificProperties(n._generatorName,r.getGeneratorSpecificDataToStore()))throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"could not update generator properties <"+n._generatorName+">")}).catch(function(e){n._shouldStopCodeGen=!0,n._appCodeGenSession.endSession(),n._codeGenRejectFn(e)})},r.prototype.computeErrorControlledCode=function(e){for(var t=0,n=e.length-1;n>=0;n--){var r=Number(e[n]);(e.length-n)%2&&9<(r*=2)&&(r=r%10+1),t+=r}return e+9*t%10},r.prototype.updateStorage=function(){this._sdk.host.writeStorageKey(this.totpPropertiesContainerStorageKey,this._propertiesContainer)},r.prototype.provisionIdForGenerator=function(t){var n=e.util.asciiToHex(""+this._user.deviceId+t);return this._sdk.host.calcHexStringEncodedSha256Hash(n)},r.createWithUserHandle=function(n,i,o,a){var s=t.User.findUser(i,n);if(!s)throw i.log(e.LogLevel.Error,"Can not find user record for <"+n+">"),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Can not find user <"+n+">");return new r(s,i,o,a)},r.createWithUserHandleWithoutUIInteraction=function(n,i,o){var a=t.User.findUser(i,n);if(!a)throw i.log(e.LogLevel.Error,"Can not find user record for <"+n+">"),new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Can not find user <"+n+">");return new r(a,i,o,new Object)},r.createWithUser=function(e,t,n,i){return new r(e,t,i,n)},r.createWithUserWithoutUIInteraction=function(e,t,n){return new r(e,t,n,new Object)},r.BACKWARD_COMPATIBILITY_DEFAULT_GENERATOR="default",r}(),n.TotpPropertiesProcessor=r}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.finalize=function(e){},t.create=function(e,n){var r=new t;return r.setAssertionData(e),r.setStoredData(n),r},t}(e.tarsusplugin.TotpProvisionOutput);t.TotpProvisionOutputTimeBased=n}(t.totp||(t.totp={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){var t=function(e){function t(t,n,r,i){var o=e.call(this,n,r,i)||this;return o._underlyingDriver=t,o}return __extends(t,e),t.prototype.createCodeGenerator=function(e,t,n,r,i){return this._underlyingDriver.promiseCodeGenerator(e,n,t,r,i)},t.prototype.createProvisionOutput=function(e,t,n,r){return this._underlyingDriver.promiseProvisionOutput(e,t,n,r)},t}(e.TotpDriverVaultBased);e.VaultBasedTotpDriverProxy=t}(e.totp||(e.totp={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){!function(t){t.totpDataFromCanonical=function(t){try{var n={version:0,prefixes:[],challengesSpecs:[]},r=0;n.version=t.charCodeAt(r++);for(var i,o=t.charCodeAt(r++),a=0;a<o;a++)i=t.charCodeAt(r++),n.prefixes.push(t.slice(r,r+i)),r+=i;for(;r<t.length;){var s=t.charCodeAt(r++);i=4;var c=e.util.bytesToHex(t.slice(r,r+i));r+=i;var u=t.charCodeAt(r++);i=t.charCodeAt(r++);var l=""+n.prefixes[u]+t.slice(r,r+i);r+=i,n.challengesSpecs.push({version:s,seedId:c,challenge:l})}return n}catch(e){}return null}}(t.parsing||(t.parsing={}))})((t=e.core||(e.core={})).totp||(t.totp={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r,i;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),r=n.vault||(n.vault={}),i=function(r){function i(){return null!==r&&r.apply(this,arguments)||this}return __extends(i,r),i.supportsNoIntegrity=function(){return!1},i.INCORRECT_KEY_TAG_TO_FALLBACK=function(e){return new n.TarsusKeyPath("per_user`, userId, `vault_keys",e.type,e.salt)},i.getVaultKeyTagForUser=function(e,t){return new n.TarsusKeyPath("per_user",e.toString(),"vault_keys",t.type,t.salt)},i.deletePrivateResources=function(e,n,r){r.log(t.LogLevel.Debug,"Biometric authenticator vault deleting private resources..."),r.host.deleteKeyPair(i.getVaultKeyTagForUser(e.guid,n))},i.prototype.translateBiometricInternalError=function(e){if(e.getErrorCode()==t.AuthenticationErrorCode.Internal&&e.getData()){var n=e.getData();return t.impl.AuthenticationErrorImpl.errorForHostInternalBiometricErrorData(n,this.biometricType)||e}return e},i.prototype.prepareToUnlock=function(n,r,o,a,s){var c=this;return new Promise(function(o,a){var s,u=i.getVaultKeyTagForUser(c._user.guid,c._vaultData);c.isEmpty()?(c._sdk.log(t.LogLevel.Debug,"Generating a new key for empty "+c.biometricType+" vault."),s=t.util.wrapPromiseWithActivityIndicator(c._uiHandler,c._policyAction,c._clientContext,c._sdk.host.generateKeyPair(u,e.sdkhost.KeyClass.StdEncryptionKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb,!0)).catch(function(e){throw c.translateBiometricInternalError(e)})):s=new Promise(function(n){var r=c._sdk.host.getKeyPair(u,e.sdkhost.KeyClass.StdEncryptionKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb);if(!r&&!(r=c._sdk.host.getKeyPair(i.INCORRECT_KEY_TAG_TO_FALLBACK(c._vaultData),e.sdkhost.KeyClass.StdEncryptionKey,e.sdkhost.KeyBiometricProtectionMode.BindToEnrollmentDb)))throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Your biometric settings on the device has been changed");n(r)}),s.then(function(e){c.updateKeyPairWithAuthenticationInput(e,n,r),c._encryptionKeyPair=e}).then(o,a)})},i.prototype.internalDataDecrypt=function(e){var t=this;return this._encryptionKeyPair.decrypt(e).then(function(e){return t._encryptionKeyPair.closeKeyPair(),e},function(e){throw t._encryptionKeyPair.closeKeyPair(),t.translateBiometricInternalError(e)})},i.prototype.internalDataEncrypt=function(e){return this._encryptionKeyPair.encrypt(e)},i.prototype.finalizeLock=function(){this._encryptionKeyPair=null},i.prototype.handleLocalDecryptError=function(e){e.getErrorCode()==t.AuthenticationErrorCode.UserCanceled?this.invokeUiHandlerCancellation():r.prototype.handleLocalDecryptError.call(this,e)},i}(r.AuthenticatorVault),r.AuthenticatorVaultBiometric=i}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(r){var i=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.biometricType="FaceId",t}return __extends(r,e),r.prototype.updateKeyPairWithAuthenticationInput=function(e,t,n){e.setBiometricPromptInfo(n.getPrompt(),"",this._uiHandler,t)},r.createNew=function(e,i,o,a,s,c,u){return new Promise(function(u,l){if(c)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"This vault type does not support disabling integrity protection");var d={type:n.authenticationdrivers.AuthenticationDriverDescriptorNativeFace.authenticatorName,salt:a.host.generateRandomHexString(24),data:""};u(new r(e,d,i,o,a,s))})},r.getAuthenticatorDescription=function(e){return new o(e)},r.prototype.createAuthenticatorSession=function(){return this._uiHandler.createNativeFaceAuthSession(n.authenticationdrivers.AuthenticationDriverDescriptorNativeFace.authenticatorName,this._user.displayName)},r}(r.AuthenticatorVaultBiometric);r.AuthenticatorVaultFaceId=i;var o=function(r){function i(e){var i=r.call(this,t.AuthenticatorType.FaceID,n.authenticationdrivers.AuthenticationDriverDescriptorNativeFace.authenticatorName)||this;return i._sdk=e,i}return __extends(i,r),i.prototype.getSupportedOnDevice=function(){return"true"===this._sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.FaceIdKeyBioProtectionSupported)},i}(r.AuthenticatorVaultDescription)}((n=t.core||(t.core={})).vault||(n.vault={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n;t=e.sdk||(e.sdk={}),function(r){var i=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.biometricType="Fingerprint",t}return __extends(r,e),r.prototype.updateKeyPairWithAuthenticationInput=function(e,t,n){e.setBiometricPromptInfo(n.getPrompt(),"",this._uiHandler,t)},r.createNew=function(e,i,o,a,s,c,u){return new Promise(function(u,l){if(c)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"This vault type does not support disabling integrity protection");var d={type:n.authenticationdrivers.AuthenticationDriverDescriptorFingerprint.authenticatorName,salt:a.host.generateRandomHexString(24),data:""};u(new r(e,d,i,o,a,s))})},r.getAuthenticatorDescription=function(e){return new o(e)},r.prototype.createAuthenticatorSession=function(){return this._uiHandler.createFingerprintAuthSession(n.authenticationdrivers.AuthenticationDriverDescriptorFingerprint.authenticatorName,this._user.displayName)},r}(r.AuthenticatorVaultBiometric);r.AuthenticatorVaultFingerprint=i;var o=function(r){function i(e){var i=r.call(this,t.AuthenticatorType.Fingerprint,n.authenticationdrivers.AuthenticationDriverDescriptorFingerprint.authenticatorName)||this;return i._sdk=e,i}return __extends(i,r),i.prototype.getSupportedOnDevice=function(){return"true"===this._sdk.host.queryHostInfo(e.sdkhost.HostInformationKey.FingerprintSupported)},i}(r.AuthenticatorVaultDescription)}((n=t.core||(t.core={})).vault||(n.vault={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t;(function(t){var n=function(n){function r(t,r,i,o,a,s){var c=n.call(this,t,r,i,o,a,s)||this;if(!c._vaultData.cryptoSettings)throw new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"vault data is missing cryptography settings");return c}return __extends(r,n),r.createNew=function(e,t,n,i,o,a,s){return new Promise(function(s){var c={type:r._authenticatorName,salt:i.host.generateRandomHexString(24),data:"",cryptoSettings:{pbkdf_iterations_count:i.cryptoSettings.getLocalEnrollmentKeyIterationCount(),pbkdf_key_size:i.cryptoSettings.getLocalEnrollmentKeySizeInBytes()},noIntegrity:a};s(new r(e,c,t,n,i,o))})},r.supportsNoIntegrity=function(){return!0},r.deletePrivateResources=function(e,t,n){},r.getAuthenticatorDescription=function(n){return new t.AuthenticatorVaultDescription(e.AuthenticatorType.Password,r._authenticatorName)},r.prototype.createAuthenticatorSession=function(){return this._uiHandler.createPasswordAuthSession(r._authenticatorName,this._user.displayName)},r.prototype.prepareToUnlock=function(n,r,i,o,a){var s=this,c=r;return this._vaultData.cryptoSettings?t.pbkdfStretchHexSecretIntoAESKey(this._vaultData.salt,e.util.asciiToHex(c.getPassword()),this._vaultData.cryptoSettings.pbkdf_key_size,this._vaultData.cryptoSettings.pbkdf_iterations_count,this.noIntegrity||!1,this._sdk).then(function(e){s._encryptionKey=e}):Promise.reject(new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.Internal,"Missing crypt settings for password vault."))},r.prototype.internalDataDecrypt=function(t){var n=this;return this._encryptionKey.decrypt(t,null).catch(function(t){throw n.noIntegrity?t:new e.impl.AuthenticationErrorImpl(e.AuthenticationErrorCode.InvalidInput,"Incorrect password input.")})},r.prototype.internalDataEncrypt=function(e){return this._encryptionKey.encrypt(e)},r.prototype.finalizeLock=function(){this._encryptionKey=null},r._authenticatorName="password",r}(t.AuthenticatorVault);t.AuthenticatorVaultPassword=n})((t=e.core||(e.core={})).vault||(t.vault={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t,n,r;t=e.sdk||(e.sdk={}),n=t.core||(t.core={}),function(i){var o=function(o){function s(e,t,r,i,a,s){var c=o.call(this,e,t,r,i,a,s)||this;return c._selectedCredential=null,c._session=new n.LocalSession(c._sdk,c._user),c}return __extends(s,o),s.createNew=function(e,n,r,i,o,a,c){return new Promise(function(u,l){if(c&&c.vault){var d={type:"multi_credential_protection",data:"",noIntegrity:a,eskr_pub:{type:c.vault.eskr_pub.type,key:t.util.base64ToHex(c.vault.eskr_pub.key)},ephemeralW:"",protectingCreds:[]},h=new s(e,d,n,r,i,o);h.addOrUpdateProtectingCreds(c.vault),u(h)}else l(new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"failt to parse provision data for vault "+n))})},s.updateVaultsProtectingCreds=function(e,o,a,s){s.log(t.LogLevel.Debug,"checking for updated credentials on multi creds vaults"),o.forEach(function(o){var c=r.Vault.getVaultForUserWithId(e,n.TarsusKeyPath.fromString(o.vault_id),new(function(){function e(){}return e.prototype.getValidCancelOptions=function(){return null},e.prototype.getValidErrorRecoveryOptions=function(e){return[t.AuthenticationErrorRecovery.Fail]},e}()),s,a);if(c instanceof r.MultiCredsVault){if(s.log(t.LogLevel.Debug,"checking for updated credentials on vault '"+o.vault_id+"'"),"add_credentials"==o.update_type)c.addOrUpdateProtectingCreds(o);else{if("remove_credentials"!=o.update_type)return void s.log(t.LogLevel.Warning,"Unhandled vault update type '"+o.update_type+"'");c.removeProtectingCreds(o)}i.Vault.updateVaultForUserWithId(e,c._vaultData,c._vaultId,s)}else s.log(t.LogLevel.Warning,"Unhandled vault type for '"+o.vault_id+"'")})},s.supportsNoIntegrity=function(){return!0},s.deletePrivateResources=function(e,t,n){},s.prototype.unlock=function(e,n){var r=this;return new Promise(function(i,o){if(r._policyAction=e,r._clientContext=n,r.isEmpty())return r._sdk.log(t.LogLevel.Info,"Unlocking empty vault '"+r._vaultId+"'"),r._unlockedData={},void i(!0);r.buildAuthenticationOptions(),(1<r._authenticationOptions.length?r._uiHandler.selectAuthenticator(r._authenticationOptions,e,n).then(function(e){switch(e.getResultType()){case t.AuthenticatorSelectionResultType.Abort:throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.UserCanceled,"Cancel during authenticator selection.");case t.AuthenticatorSelectionResultType.SelectAuthenticator:var n=e.getSelectedAuthenticator();if(!n.getRegistered())throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.AppImplementation,"unregistered authenticator selected "+n.getAuthenticatorId());return n}}):Promise.resolve(r._authenticationOptions[0].getAuthenticator())).then(function(e){r._selectedCredential=e.credential,r._selectedCredential.startCredentialSession(r._clientContext),r._sdk.log(t.LogLevel.Info,"Unlocking existing vault '"+r._vaultId+"', using credential '"+r._selectedCredential.credentialId+"'"),r.unlockInstartedSession().then(i,o)}).catch(o)})},s.prototype.finalizeLock=function(){this._selectedCredential=null},s.prototype.internalDataEncrypt=function(n){var r=this,o=this._sdk.host.generateRandomHexString(64);this._sdk.log(t.LogLevel.Debug,"Generated ephemeral key for vault '"+this._vaultId+"'");var a=this.noIntegrity?e.sdkhost.KeyClass.NoIntegrityAES:e.sdkhost.KeyClass.GeneralPurposeAES,s=this._sdk.host.importVolatileSymmetricKey(o,a);return s.encrypt(n).then(function(n){return r._sdk.log(t.LogLevel.Debug,"ecnrypted data using ephemeral key for vault '"+r._vaultId+"'"),r._sdk.host.importVolatileKeyPairFromPublicKeyHex(e.sdkhost.KeyClass.FidoECCSigningKey,r._vaultData.eskr_pub.key).wrapSymmetricKey(s).then(function(e){return r._sdk.log(t.LogLevel.Debug,"wrapped ephemeral key with eskr_pub for vault '"+r._vaultId+"'"),r._vaultData.ephemeralW=e,i.Vault.updateVaultForUserWithId(r._user,r._vaultData,r._vaultId,r._sdk),n})})},s.prototype.internalDataDecrypt=function(e){var t=this,n=this._ephemeral.decrypt(e,null);return n.finally(function(){return t._ephemeral=null}),n},s.prototype.getPolicyAction=function(e){return this._policyAction},s.prototype.availableAuthenticatorsForSwitchMethod=function(){return this._availableCredentials},s.prototype.getAuthenticatorConfig=function(e){return this._availableCredentials.filter(function(t){return t.getAuthenticatorId()==e.credentialId})[0].getAuthenticatorConfig()},s.prototype.getAuthenticatorDescription=function(e){return this._availableCredentials.filter(function(t){return t.getAuthenticatorId()==e.credentialId})[0]},s.prototype.getUIHandler=function(e){return this._uiHandler},s.prototype.unlockInstartedSession=function(){var r=this,i=this._selectedCredential.authenticatorDescription.getEskrPriW();return this._sdk.log(t.LogLevel.Debug,"unwrapping eskr_pri_w for vault '"+this._vaultId+"'"),this._selectedCredential.unwrapAsymmetricKeyPairFromPrivateHex(i,e.sdkhost.KeyClass.FidoECCSigningKey).then(function(i){if(i instanceof n.credential.CredentialUnwrapAsymmetricResult){r._sdk.log(t.LogLevel.Debug,"eskr_pri_w unwrapped successfully, unwrapping ephemeral for vault '"+r._vaultId+"'");var o=r._vaultData.noIntegrity?e.sdkhost.KeyClass.NoIntegrityAES:e.sdkhost.KeyClass.GeneralPurposeAES;return i.keyPair.unwrapSymmetricKeyHex(r._vaultData.ephemeralW,o).then(function(e){return r._sdk.log(t.LogLevel.Debug,"ephemeral unwrapped successfully, decrypting for vault '"+r._vaultId+"'"),r._ephemeral=e,r.internalDataDecrypt(r._vaultData.data).then(function(e){return r._sdk.log(t.LogLevel.Debug,"decrypted successfully for vault '"+r._vaultId+"'"),r._unlockedData=r.jsonFromDecryptedHexString(e),r._selectedCredential.endCredentialSession(),!0}).catch(function(e){throw r._sdk.log(t.LogLevel.Error,"decrypt failed for vault '"+r._vaultId+"': "+e),r.noIntegrity||e.getErrorCode()!=t.AuthenticationErrorCode.Internal||(e=new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.InvalidInput,"Authentication failed.")),e})}).catch(function(e){throw r._sdk.log(t.LogLevel.Error,"uwrap ephemeral failed: "+e),e})}if(i instanceof n.credential.CredentialAuthOperationResultSwitchAuthenticator)return r._selectedCredential.endCredentialSession(),r.unlock(r._policyAction,r._clientContext);throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"Unhandled credential opreation result")}).catch(function(e){r._sdk.log(t.LogLevel.Error,"unwrap eskr_pri_w or nested operation failed for vault '"+r._vaultId+"': "+e);var n=r.getValidErrorRecoveryOptions(e),i=n.indexOf(t.AuthenticationErrorRecovery.RetryAuthenticator)>=0?t.AuthenticationErrorRecovery.RetryAuthenticator:t.AuthenticationErrorRecovery.Fail;return n.indexOf(t.AuthenticationErrorRecovery.ChangeAuthenticator)<0&&r._authenticationOptions.length>1&&n.push(t.AuthenticationErrorRecovery.ChangeAuthenticator),r._selectedCredential.promiseRecoveryForError(e,n,i).then(function(t){return r.handleErrorRecoveryAction(t,e)})})},s.prototype.handleErrorRecoveryAction=function(e,n){switch(e){case t.AuthenticationErrorRecovery.RetryAuthenticator:return this.unlockInstartedSession();case t.AuthenticationErrorRecovery.ChangeAuthenticator:case t.AuthenticationErrorRecovery.SelectAuthenticator:return this._selectedCredential.endCredentialSession(),this.unlock(this._policyAction,this._clientContext);case t.AuthenticationErrorRecovery.Fail:default:return this._selectedCredential.endCredentialSession(),Promise.reject(n)}},s.prototype.addOrUpdateProtectingCreds=function(e){var n=this;e.protecting_credentials.forEach(function(e){if(e.local_authenticator_id){var r=n._vaultData.protectingCreds.filter(function(t){return t.local_authenticator_id==e.local_authenticator_id}),i={local_authenticator_id:e.local_authenticator_id,eskr_pri_w:t.util.base64ToHex(e.eskr_pri_w),authenticatorConfig:e.attrs};if(r.length<1)n._sdk.log(t.LogLevel.Debug,"adding credential '"+i.local_authenticator_id+"' for vault '"+n._vaultId+"'"),n._vaultData.protectingCreds.push(i);else{n._sdk.log(t.LogLevel.Debug,"updating credential '"+i.local_authenticator_id+"' for vault '"+n._vaultId+"'");var o=n._vaultData.protectingCreds.indexOf(r[0]);n._vaultData.protectingCreds[o]=i}}else n._sdk.log(t.LogLevel.Warning,"Unhandled credential type")})},s.prototype.removeProtectingCreds=function(e){var n=this;e.protecting_credentials.forEach(function(e){if(e.local_authenticator_id){var r=n._vaultData.protectingCreds.filter(function(r){return r.local_authenticator_id!=e.local_authenticator_id||(n._sdk.log(t.LogLevel.Debug,"removing credential '"+e.local_authenticator_id+"' for vault '"+n._vaultId+"'"),!1)});n._vaultData.protectingCreds=r}else n._sdk.log(t.LogLevel.Warning,"Unhandled credential type")})},s.prototype.buildAuthenticationOptions=function(){var e=this;this._sdk.log(t.LogLevel.Debug,"building authentication options for vault '"+this._vaultId+"'");var r=n.User.findUser(this._sdk,this._user.userHandle);if(!r)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.Internal,"failed to find storage record for user '"+this._user.displayName+"'");this._availableCredentials=[],this._authenticationOptions=[];var i=this._uiHandler.shouldIncludeDisabledAuthenticatorsInMenu(this._policyAction,this._clientContext);if(this._vaultData.protectingCreds.forEach(function(n){var o=n.local_authenticator_id;if(o)if(r.localEnrollments[o]){var s=new a(n,e,r,e._sdk,e._clientContext);i||s.getRegistered()?(e._sdk.log(t.LogLevel.Debug,"adding authentication option '"+s.getAuthenticatorId()+"' for vault '"+e._vaultId+"'"),e._availableCredentials.push(s),e._authenticationOptions.push(new t.impl.AuthenticationOptionImpl(s,[]))):e._sdk.log(t.LogLevel.Debug,"Not adding unregistered authentication option '"+s.getAuthenticatorId()+"' for vault '"+e._vaultId+"'")}else e._sdk.log(t.LogLevel.Warning,"enrollment record '"+o+"' for user '"+e._user.displayName+"' isn't found");else e._sdk.log(t.LogLevel.Warning,"Unhandled credential type")}),this._availableCredentials.length<=0)throw new t.impl.AuthenticationErrorImpl(t.AuthenticationErrorCode.NoRegisteredAuthenticator,"No registered authenticator available.")},s}(i.Vault);i.MultiCredsVault=o;var a=function(){function e(e,t,n,r,i){this._credSpec=e,this._holder=t,this._user=n,this._sdk=r,this._clientContext=i}return Object.defineProperty(e.prototype,"credential",{get:function(){return this._credential||(this._credential=n.credential.CredentialTypes[this._credSpec.local_authenticator_id].create(this._credSpec.local_authenticator_id,this._holder,this._holder)),this._credential},enumerable:!0,configurable:!0}),e.prototype.getAuthenticatorId=function(){return this._credSpec.local_authenticator_id},e.prototype.getName=function(){return n.Protocol.AuthTypeData[this._credSpec.local_authenticator_id].authTypeName},e.prototype.getType=function(){return n.Protocol.AuthTypeData[this._credSpec.local_authenticator_id].authTypeEnum},e.prototype.getRegistered=function(){return this.getRegistrationStatus()===t.AuthenticatorRegistrationStatus.Registered},e.prototype.getDefaultAuthenticator=function(){return!1},e.prototype.getExpired=function(){return!1},e.prototype.getEnabled=function(){return!0},e.prototype.getLocked=function(){return!1},e.prototype.getSupportedOnDevice=function(){return!0},e.prototype.getRegistrationStatus=function(){return this.credential.evaluateLocalRegistrationStatus()},e.prototype.getEskrPriW=function(){return this._credSpec.eskr_pri_w},e.prototype.getAuthenticatorConfig=function(){return this._user.localEnrollments[this._credSpec.local_authenticator_id].authenticatorConfig||this._credSpec.authenticatorConfig},e}();i.MultiCredsVaultCredentialDescription=a}(r=n.vault||(n.vault={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){var t;(function(t){!function(t){t.pbkdfStretchHexSecretIntoAESKey=function(t,n,r,i,o,a){return a.host.generatePbkdf2HmacSha1HexString(t,n,r,i).then(function(t){return a.host.importVolatileSymmetricKey(t,o?e.sdkhost.KeyClass.NoIntegrityAES:e.sdkhost.KeyClass.GeneralPurposeAES)})}}(t.vault||(t.vault={}))})((t=e.sdk||(e.sdk={})).core||(t.core={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){!function(e){e.isAuthenticatorVaultDescriptor=function(e){return"getAuthenticatorDescription"in e},e.VaultTypes={multi_credential_protection:e.MultiCredsVault,password:e.AuthenticatorVaultPassword,fingerprint:e.AuthenticatorVaultFingerprint,face_id:e.AuthenticatorVaultFaceId}}(e.vault||(e.vault={}))}(e.core||(e.core={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getAcquisitionResponse=function(){return this._acquisitionResponse},t.prototype.setAcquisitionResponse=function(e){this._acquisitionResponse=e},t.__tarsusInterfaceName="AudioInputResponse",t}(e.InputResponseType);e.AudioInputResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Internal=0]="Internal",e[e.InvalidInput=1]="InvalidInput",e[e.AuthenticatorLocked=2]="AuthenticatorLocked",e[e.AllAuthenticatorsLocked=3]="AllAuthenticatorsLocked",e[e.NoRegisteredAuthenticator=4]="NoRegisteredAuthenticator",e[e.RegisteredSecretAlreadyInHistory=5]="RegisteredSecretAlreadyInHistory",e[e.Communication=6]="Communication",e[e.UserCanceled=7]="UserCanceled",e[e.AppImplementation=8]="AppImplementation",e[e.PolicyRejection=9]="PolicyRejection",e[e.AuthenticatorInvalidated=10]="AuthenticatorInvalidated",e[e.ControlFlowExpired=11]="ControlFlowExpired",e[e.SessionRequired=12]="SessionRequired",e[e.AuthenticatorError=13]="AuthenticatorError",e[e.ApprovalWrongState=14]="ApprovalWrongState",e[e.TotpNotProvisioned=15]="TotpNotProvisioned",e[e.AuthenticatorExternalConfigError=16]="AuthenticatorExternalConfigError",e[e.InvalidDeviceBinding=17]="InvalidDeviceBinding",e[e.InvalidIdToken=18]="InvalidIdToken",e[e.DeviceNotFound=19]="DeviceNotFound",e[e.ApprovalDenied=20]="ApprovalDenied",e[e.ApprovalExpired=21]="ApprovalExpired",e[e.ApplicationGeneratedRecoverableError=22]="ApplicationGeneratedRecoverableError"}(e.AuthenticationErrorCode||(e.AuthenticationErrorCode={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.AuthenticatorExternalConfigErrorReason=0]="AuthenticatorExternalConfigErrorReason",e[e.AuthenticatorInvalidInputErrorDescription=1]="AuthenticatorInvalidInputErrorDescription",e[e.InvalidIdTokenErrorReason=2]="InvalidIdTokenErrorReason"}(e.AuthenticationErrorProperty||(e.AuthenticationErrorProperty={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.AuthenticatorExternalConfigErrorReasonBiometricsNotEnrolled=0]="AuthenticatorExternalConfigErrorReasonBiometricsNotEnrolled",e[e.AuthenticatorExternalConfigErrorReasonBiometricsOsLockTemporary=1]="AuthenticatorExternalConfigErrorReasonBiometricsOsLockTemporary",e[e.AuthenticatorExternalConfigErrorReasonBiometricsOsLockPermanent=2]="AuthenticatorExternalConfigErrorReasonBiometricsOsLockPermanent",e[e.AuthenticatorInvalidInputErrorDescriptionTotpIncorrectCheckDigit=3]="AuthenticatorInvalidInputErrorDescriptionTotpIncorrectCheckDigit",e[e.InvalidIdTokenErrorReasonExpiredToken=4]="InvalidIdTokenErrorReasonExpiredToken",e[e.InvalidIdTokenErrorReasonBadToken=5]="InvalidIdTokenErrorReasonBadToken"}(e.AuthenticationErrorPropertySymbol||(e.AuthenticationErrorPropertySymbol={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.RetryAuthenticator=0]="RetryAuthenticator",e[e.ChangeAuthenticator=1]="ChangeAuthenticator",e[e.SelectAuthenticator=2]="SelectAuthenticator",e[e.Fail=3]="Fail"}(e.AuthenticationErrorRecovery||(e.AuthenticationErrorRecovery={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Register=0]="Register",e[e.Unregister=1]="Unregister",e[e.Reregister=2]="Reregister"}(e.AuthenticatorConfigurationAction||(e.AuthenticatorConfigurationAction={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Fallback=0]="Fallback",e[e.AuthMenu=1]="AuthMenu",e[e.Retry=2]="Retry",e[e.Cancel=3]="Cancel"}(e.AuthenticatorFallbackAction||(e.AuthenticatorFallbackAction={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Registered=0]="Registered",e[e.Unregistered=1]="Unregistered",e[e.LocallyInvalid=2]="LocallyInvalid"}(e.AuthenticatorRegistrationStatus||(e.AuthenticatorRegistrationStatus={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.SelectAuthenticator=0]="SelectAuthenticator",e[e.Abort=1]="Abort"}(e.AuthenticatorSelectionResultType||(e.AuthenticatorSelectionResultType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Authentication=0]="Authentication",e[e.Registration=1]="Registration"}(e.AuthenticatorSessionMode||(e.AuthenticatorSessionMode={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getAcquisitionResponse=function(){return this._acquisitionResponse},t.prototype.setAcquisitionResponse=function(e){this._acquisitionResponse=e},t.__tarsusInterfaceName="CameraInputResponse",t}(e.InputResponseType);e.CameraInputResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Accounts=0]="Accounts",e[e.DeviceDetails=1]="DeviceDetails",e[e.Contacts=2]="Contacts",e[e.Owner=3]="Owner",e[e.Software=4]="Software",e[e.Location=5]="Location",e[e.Bluetooth=6]="Bluetooth",e[e.ExternalSDKDetails=7]="ExternalSDKDetails",e[e.HWAuthenticators=8]="HWAuthenticators",e[e.Capabilities=9]="Capabilities",e[e.FidoAuthenticators=10]="FidoAuthenticators",e[e.LargeData=11]="LargeData",e[e.LocalEnrollments=12]="LocalEnrollments"}(e.CollectorType||(e.CollectorType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.None=0]="None",e[e.Credentials=1]="Credentials",e[e.Full=2]="Full"}(e.ConnectionCryptoMode||(e.ConnectionCryptoMode={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.CancelAuthenticator=0]="CancelAuthenticator",e[e.RetryAuthenticator=1]="RetryAuthenticator",e[e.ChangeMethod=2]="ChangeMethod",e[e.SelectMethod=3]="SelectMethod",e[e.AbortAuthentication=4]="AbortAuthentication"}(e.ControlRequestType||(e.ControlRequestType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Remove=0]="Remove",e[e.Identify=1]="Identify",e[e.Rename=2]="Rename"}(e.DeviceManagementAction||(e.DeviceManagementAction={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.RecentlyUsed=0]="RecentlyUsed",e[e.NoRecentActivity=1]="NoRecentActivity",e[e.LongInactivity=2]="LongInactivity",e[e.Disabled=3]="Disabled",e[e.Removed=4]="Removed"}(e.DeviceStatus||(e.DeviceStatus={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getFailureError=function(){return this._failureError},t.prototype.setFailureError=function(e){this._failureError=e},t.__tarsusInterfaceName="Fido2AuthenticationFailedResponse",t}(e.Fido2InputResponse);e.Fido2AuthenticationFailedResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getFido2Response=function(){return this._fido2Response},t.prototype.setFido2Response=function(e){this._fido2Response=e},t.__tarsusInterfaceName="Fido2AuthenticatorSuccessResponse",t}(e.Fido2InputResponse);e.Fido2AuthenticatorSuccessResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getFailureError=function(){return this._failureError},t.prototype.setFailureError=function(e){this._failureError=e},t.prototype.getExpired=function(){return this._expired},t.prototype.setExpired=function(e){this._expired=e},t.prototype.getRegistered=function(){return this._registered},t.prototype.setRegistered=function(e){this._registered=e},t.prototype.getRegistrationStatus=function(){return this._registrationStatus},t.prototype.setRegistrationStatus=function(e){this._registrationStatus=e},t.prototype.getLocked=function(){return this._locked},t.prototype.setLocked=function(e){this._locked=e},t.__tarsusInterfaceName="FidoAuthFailureResponse",t}(e.FidoInputResponse);e.FidoAuthFailureResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getFidoResponse=function(){return this._fidoResponse},t.prototype.setFidoResponse=function(e){this._fidoResponse=e},t.__tarsusInterfaceName="FidoAuthSuccessResponse",t}(e.FidoInputResponse);e.FidoAuthSuccessResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Submit=0]="Submit",e[e.Abort=1]="Abort"}(e.FormControlRequest||(e.FormControlRequest={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Off=0]="Off",e[e.Critical=1]="Critical",e[e.Error=2]="Error",e[e.Warning=3]="Warning",e[e.Info=4]="Info",e[e.Debug=5]="Debug"}(e.LogLevel||(e.LogLevel={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Approve=0]="Approve",e[e.Deny=1]="Deny"}(e.MobileApprovalAction||(e.MobileApprovalAction={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Pending=0]="Pending",e[e.Approved=1]="Approved",e[e.Denied=2]="Denied",e[e.Expired=3]="Expired"}(e.MobileApprovalStatus||(e.MobileApprovalStatus={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Unknown=0]="Unknown",e[e.Sms=1]="Sms",e[e.Email=2]="Email",e[e.PushNotification=3]="PushNotification",e[e.VoiceCall=4]="VoiceCall"}(e.OtpChannel||(e.OtpChannel={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getFailureError=function(){return this._failureError},t.prototype.setFailureError=function(e){this._failureError=e},t.prototype.getExpired=function(){return this._expired},t.prototype.setExpired=function(e){this._expired=e},t.prototype.getRegistered=function(){return this._registered},t.prototype.setRegistered=function(e){this._registered=e},t.prototype.getRegistrationStatus=function(){return this._registrationStatus},t.prototype.setRegistrationStatus=function(e){this._registrationStatus=e},t.prototype.getLocked=function(){return this._locked},t.prototype.setLocked=function(e){this._locked=e},t.__tarsusInterfaceName="PlaceholderAuthFailureResponse",t}(e.PlaceholderInputResponse);e.PlaceholderAuthFailureResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getFailureError=function(){return this._failureError},t.prototype.setFailureError=function(e){this._failureError=e},t.__tarsusInterfaceName="PlaceholderAuthFailureWithServerProvidedStatusResponse",t}(e.PlaceholderInputResponse);e.PlaceholderAuthFailureWithServerProvidedStatusResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getPlaceholderToken=function(){return this._placeholderToken},t.prototype.setPlaceholderToken=function(e){this._placeholderToken=e},t.__tarsusInterfaceName="PlaceholderAuthSuccessResponse",t}(e.PlaceholderInputResponse);e.PlaceholderAuthSuccessResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Skip=0]="Skip",e[e.Abort=1]="Abort",e[e.Continue=2]="Continue"}(e.PromotionControlRequest||(e.PromotionControlRequest={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Numeric=0]="Numeric",e[e.Alphanumeric=1]="Alphanumeric",e[e.Binary=2]="Binary"}(e.QrCodeFormat||(e.QrCodeFormat={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.RedirectToPolicy=0]="RedirectToPolicy",e[e.CancelRedirect=1]="CancelRedirect"}(e.RedirectResponseType||(e.RedirectResponseType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getAnswers=function(){return this._answers},t.__tarsusInterfaceName="SecurityQuestionAnswersInputResponse",t}(e.SecurityQuestionInputResponse);e.SecurityQuestionAnswersInputResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getValue=function(){return this._value},e.prototype.setValue=function(e){this._value=e},e.prototype.getFormat=function(){return this._format},e.prototype.setFormat=function(e){this._format=e},e.__tarsusInterfaceName="TotpChallenge",e}();e.TotpChallenge=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getName=function(){return this._name},e.prototype.setName=function(e){this._name=e},e.prototype.getValue=function(){return this._value},e.prototype.setValue=function(e){this._value=e},e.__tarsusInterfaceName="TransportHeader",e}();e.TransportHeader=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getUrl=function(){return this._url},e.prototype.setUrl=function(e){this._url=e},e.prototype.getMethod=function(){return this._method},e.prototype.setMethod=function(e){this._method=e},e.prototype.getHeaders=function(){return this._headers},e.prototype.setHeaders=function(e){this._headers=e},e.prototype.getBodyJson=function(){return this._bodyJson},e.prototype.setBodyJson=function(e){this._bodyJson=e},e.__tarsusInterfaceName="TransportRequest",e}();e.TransportRequest=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t=function(){function e(){}return e.prototype.getStatus=function(){return this._status},e.prototype.setStatus=function(e){this._status=e},e.prototype.getMethod=function(){return this._method},e.prototype.setMethod=function(e){this._method=e},e.prototype.getHeaders=function(){return this._headers},e.prototype.setHeaders=function(e){this._headers=e},e.prototype.getBodyJson=function(){return this._bodyJson},e.prototype.setBodyJson=function(e){this._bodyJson=e},e.__tarsusInterfaceName="TransportResponse",e}();e.TransportResponse=t}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.UserId=0]="UserId",e[e.IdToken=1]="IdToken"}(e.UserHandleType||(e.UserHandleType={}))}(e.sdk||(e.sdk={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Create=0]="Create",e[e.Get=1]="Get"}(e.Fido2CredentialsOpType||(e.Fido2CredentialsOpType={}))}(e.sdkhost||(e.sdkhost={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.Version=0]="Version",e[e.Platform=1]="Platform",e[e.FingerprintSupported=2]="FingerprintSupported",e[e.HostProvidedFeatures=3]="HostProvidedFeatures",e[e.FaceIdKeyBioProtectionSupported=4]="FaceIdKeyBioProtectionSupported",e[e.ImageAcquitisionSupported=5]="ImageAcquitisionSupported",e[e.AudioAcquitisionSupported=6]="AudioAcquitisionSupported",e[e.PersistentKeysSupported=7]="PersistentKeysSupported",e[e.FidoClientPresent=8]="FidoClientPresent",e[e.DyadicPresent=9]="DyadicPresent",e[e.StdSigningKeyIsHardwareProtectedSignAndEncryptKey=10]="StdSigningKeyIsHardwareProtectedSignAndEncryptKey",e[e.Fido2ClientPresent=11]="Fido2ClientPresent",e[e.DeviceStrongAuthenticationSupported=12]="DeviceStrongAuthenticationSupported"}(e.HostInformationKey||(e.HostInformationKey={}))}(e.sdkhost||(e.sdkhost={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.None=0]="None",e[e.NormalProtection=1]="NormalProtection",e[e.BindToEnrollmentDb=2]="BindToEnrollmentDb"}(e.KeyBiometricProtectionMode||(e.KeyBiometricProtectionMode={}))}(e.sdkhost||(e.sdkhost={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){!function(e){e[e.StdSigningKey=0]="StdSigningKey",e[e.StdEncryptionKey=1]="StdEncryptionKey",e[e.GeneralPurposeAES=2]="GeneralPurposeAES",e[e.NoIntegrityAES=3]="NoIntegrityAES",e[e.FidoECCSigningKey=4]="FidoECCSigningKey",e[e.HardwareProtectedSignAndEncryptKey=5]="HardwareProtectedSignAndEncryptKey"}(e.KeyClass||(e.KeyClass={}))}(e.sdkhost||(e.sdkhost={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getPluginName=function(){return this._pluginName},t.prototype.setPluginName=function(e){this._pluginName=e},t.prototype.getVersionMajor=function(){return this._versionMajor},t.prototype.setVersionMajor=function(e){this._versionMajor=e},t.prototype.getVersionMinor=function(){return this._versionMinor},t.prototype.setVersionMinor=function(e){this._versionMinor=e},t.prototype.getVersionPatch=function(){return this._versionPatch},t.prototype.setVersionPatch=function(e){this._versionPatch=e},t.prototype.getRequiredPluginApiLevel=function(){return this._requiredPluginApiLevel},t.prototype.setRequiredPluginApiLevel=function(e){this._requiredPluginApiLevel=e},t.create=function(){return e.ts.mobile.tarsusplugin.impl.PluginInfoImpl.create()},t.__tarsusInterfaceName="PluginInfo",t}();t.PluginInfo=n}(t.tarsusplugin||(t.tarsusplugin={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getCode=function(){return this._code},t.prototype.getTimeStepSeconds=function(){return this._timeStepSeconds},t.prototype.getExpiresInSeconds=function(){return this._expiresInSeconds},t.prototype.getSecondsTillNextInvocation=function(){return this._secondsTillNextInvocation},t.prototype.getShouldUpdateSpecificProperties=function(){return this._shouldUpdateSpecificProperties},t.prototype.getGeneratorSpecificDataToStore=function(){return this._generatorSpecificDataToStore},t.prototype.getMessage=function(){return this._message},t.create=function(t,n,r,i,o,a,s){return e.ts.mobile.tarsusplugin.impl.TotpCodeGenerationOutputImpl.create(t,n,r,i,o,a,s)},t.__tarsusInterfaceName="TotpCodeGenerationOutput",t}();t.TotpCodeGenerationOutput=n}(t.tarsusplugin||(t.tarsusplugin={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n=function(){function t(){}return t.prototype.getUnprotectedProvisionOutput=function(){return this._unprotectedProvisionOutput},t.prototype.getSecretToLock=function(){return this._secretToLock},t.create=function(t,n){return e.ts.mobile.tarsusplugin.impl.VaultBasedTotpProvisionOutputImpl.create(t,n)},t.__tarsusInterfaceName="VaultBasedTotpProvisionOutput",t}();t.VaultBasedTotpProvisionOutput=n}(t.tarsusplugin||(t.tarsusplugin={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){var t;(function(t){!function(t){var n,r;n=t.impl||(t.impl={}),r=function(t){function n(){var e=t.call(this)||this;return e._versionMajor=0,e._versionMinor=0,e._versionPatch=0,e}return __extends(n,t),n.create=function(){return new e.ts.mobile.tarsusplugin.impl.PluginInfoImpl},n.versionToString=function(e){return e.getVersionMajor()+"."+e.getVersionMinor()+"."+e.getVersionPatch()},n.toString=function(e){return e.getPluginName()+" v"+this.versionToString(e)},n}(t.PluginInfo),n.PluginInfoImpl=r}(t.tarsusplugin||(t.tarsusplugin={}))})((t=e.ts||(e.ts={})).mobile||(t.mobile={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e,n,r,i,o,a,s){var c=new t;return c._code=e,n&&(c._message=n),c._timeStepSeconds=r,c._expiresInSeconds=i,c._secondsTillNextInvocation=o,c._shouldUpdateSpecificProperties=a,s&&(c._generatorSpecificDataToStore=s),c},t}(e.TotpCodeGenerationOutput),t.TotpCodeGenerationOutputImpl=n}(e.tarsusplugin||(e.tarsusplugin={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e){!function(e){!function(e){!function(e){var t,n;t=e.impl||(e.impl={}),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.create=function(e,n){var r=new t;return r._secretToLock=e,r._unprotectedProvisionOutput=n,r},t}(e.VaultBasedTotpProvisionOutput),t.VaultBasedTotpProvisionOutputImpl=n}(e.tarsusplugin||(e.tarsusplugin={}))}(e.mobile||(e.mobile={}))}(e.ts||(e.ts={}))}(com||(com={})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("XmSdk",["exports"],t):t((e=e||self).xmsdk={})}(this,function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function o(e,t,n){var r;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(n=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var r=0,i={};r<arguments.length;r++){var o=arguments[r];for(var a in o)i[a]=o[a]}return i}({path:"/"},{},n)).expires){var i=new Date;i.setMilliseconds(i.getMilliseconds()+864e5*n.expires),n.expires=i}n.expires=n.expires?n.expires.toUTCString():"";try{r=JSON.stringify(t),/^[\{\[]/.test(r)&&(t=r)}catch(e){}t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=(e=(e=encodeURIComponent(String(e))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var o="";for(var a in n)n[a]&&(o+="; "+a,!0!==n[a]&&(o+="="+n[a]));return document.cookie=e+"="+t+o}e||(r={});for(var s=document.cookie?document.cookie.split("; "):[],c=/(%[0-9A-Z]{2})+/g,u=0;u<s.length;u++){var l=s[u].split("="),d=l.slice(1).join("=");'"'===d.charAt(0)&&(d=d.slice(1,-1));try{var h=l[0].replace(c,decodeURIComponent);if(d=d.replace(c,decodeURIComponent),e===h){r=d;break}e||(r[h]=d)}catch(e){}}return r}}function a(e,t){return e(t={exports:{}},t.exports),t.exports}function s(e,t){if(!(t instanceof Promise)){var n=t;t=new Promise(function(e,t){try{e(n())}catch(e){t(e)}})}return t.then(function(t){var n={};return null!=t&&(n[e]=t),n},function(t){var n={};return n[e]={__err__:t},n})}function c(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function u(e,t,n,r,i,o){return c((a=c(c(t,e),c(r,o)))<<(s=i)|a>>>32-s,n);var a,s}function l(e,t,n,r,i,o,a){return u(t&n|~t&r,e,t,i,o,a)}function d(e,t,n,r,i,o,a){return u(t&r|n&~r,e,t,i,o,a)}function h(e,t,n,r,i,o,a){return u(t^n^r,e,t,i,o,a)}function p(e,t,n,r,i,o,a){return u(n^(t|~r),e,t,i,o,a)}function f(e,t){var n,r,i,o,a;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var s=1732584193,u=-271733879,f=-1732584194,m=271733878;for(n=0;n<e.length;n+=16)r=s,i=u,o=f,a=m,s=p(s=h(s=h(s=h(s=h(s=d(s=d(s=d(s=d(s=l(s=l(s=l(s=l(s,u,f,m,e[n],7,-680876936),u=l(u,f=l(f,m=l(m,s,u,f,e[n+1],12,-389564586),s,u,e[n+2],17,606105819),m,s,e[n+3],22,-1044525330),f,m,e[n+4],7,-176418897),u=l(u,f=l(f,m=l(m,s,u,f,e[n+5],12,1200080426),s,u,e[n+6],17,-1473231341),m,s,e[n+7],22,-45705983),f,m,e[n+8],7,1770035416),u=l(u,f=l(f,m=l(m,s,u,f,e[n+9],12,-1958414417),s,u,e[n+10],17,-42063),m,s,e[n+11],22,-1990404162),f,m,e[n+12],7,1804603682),u=l(u,f=l(f,m=l(m,s,u,f,e[n+13],12,-40341101),s,u,e[n+14],17,-1502002290),m,s,e[n+15],22,1236535329),f,m,e[n+1],5,-165796510),u=d(u,f=d(f,m=d(m,s,u,f,e[n+6],9,-1069501632),s,u,e[n+11],14,643717713),m,s,e[n],20,-373897302),f,m,e[n+5],5,-701558691),u=d(u,f=d(f,m=d(m,s,u,f,e[n+10],9,38016083),s,u,e[n+15],14,-660478335),m,s,e[n+4],20,-405537848),f,m,e[n+9],5,568446438),u=d(u,f=d(f,m=d(m,s,u,f,e[n+14],9,-1019803690),s,u,e[n+3],14,-187363961),m,s,e[n+8],20,1163531501),f,m,e[n+13],5,-1444681467),u=d(u,f=d(f,m=d(m,s,u,f,e[n+2],9,-51403784),s,u,e[n+7],14,1735328473),m,s,e[n+12],20,-1926607734),f,m,e[n+5],4,-378558),u=h(u,f=h(f,m=h(m,s,u,f,e[n+8],11,-2022574463),s,u,e[n+11],16,1839030562),m,s,e[n+14],23,-35309556),f,m,e[n+1],4,-1530992060),u=h(u,f=h(f,m=h(m,s,u,f,e[n+4],11,1272893353),s,u,e[n+7],16,-155497632),m,s,e[n+10],23,-1094730640),f,m,e[n+13],4,681279174),u=h(u,f=h(f,m=h(m,s,u,f,e[n],11,-358537222),s,u,e[n+3],16,-722521979),m,s,e[n+6],23,76029189),f,m,e[n+9],4,-640364487),u=h(u,f=h(f,m=h(m,s,u,f,e[n+12],11,-421815835),s,u,e[n+15],16,530742520),m,s,e[n+2],23,-995338651),f,m,e[n],6,-198630844),u=p(u=p(u=p(u=p(u,f=p(f,m=p(m,s,u,f,e[n+7],10,1126891415),s,u,e[n+14],15,-1416354905),m,s,e[n+5],21,-57434055),f=p(f,m=p(m,s=p(s,u,f,m,e[n+12],6,1700485571),u,f,e[n+3],10,-1894986606),s,u,e[n+10],15,-1051523),m,s,e[n+1],21,-2054922799),f=p(f,m=p(m,s=p(s,u,f,m,e[n+8],6,1873313359),u,f,e[n+15],10,-30611744),s,u,e[n+6],15,-1560198380),m,s,e[n+13],21,1309151649),f=p(f,m=p(m,s=p(s,u,f,m,e[n+4],6,-145523070),u,f,e[n+11],10,-1120210379),s,u,e[n+2],15,718787259),m,s,e[n+9],21,-343485551),s=c(s,r),u=c(u,i),f=c(f,o),m=c(m,a);return[s,u,f,m]}function m(e){var t,n="",r=32*e.length;for(t=0;t<r;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function g(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function v(e){var t,n,r="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),r+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return r}function y(e){return unescape(encodeURIComponent(e))}function b(e){return function(e){return m(f(g(e),8*e.length))}(y(e))}function A(e,t){return function(e,t){var n,r,i=g(e),o=[],a=[];for(o[15]=a[15]=void 0,i.length>16&&(i=f(i,8*e.length)),n=0;n<16;n+=1)o[n]=909522486^i[n],a[n]=1549556828^i[n];return r=f(o.concat(g(t)),512+8*t.length),m(f(a.concat(r),640))}(y(e),y(t))}var _=function(){function e(t){n(this,e),this._host=t}return i(e,[{key:"extractHeaders",value:function(e){return e.trim().split(/[\r\n]+/).map(function(e){var t=e.split(": "),n=t.shift(),r=t.join(": "),i=new com.ts.mobile.sdk.TransportHeader;return i.setName(n),i.setValue(r),i})}},{key:"sendRequest",value:function(e){var t=this;return new Promise(function(n,r){var i=new XMLHttpRequest,o=function(){r(new com.ts.mobile.sdk.impl.AuthenticationErrorImpl(com.ts.mobile.sdk.AuthenticationErrorCode.Communication,i.responseText))};i.open(e.getMethod(),e.getUrl(),!0),i.withCredentials=!0,i.onreadystatechange=function(){if(4===i.readyState)try{if(0===i.status)return t._host.log(com.ts.mobile.sdk.LogLevel.Error,"transport","Destination server is invalid or the server does not support access-control-allow-origin."),r(new com.ts.mobile.sdk.impl.AuthenticationErrorImpl(com.ts.mobile.sdk.AuthenticationErrorCode.Communication,i.responseText));JSON.parse(i.responseText);var a=new com.ts.mobile.sdk.TransportResponse;a.setStatus(i.status),a.setMethod(e.getMethod()),a.setHeaders(t.extractHeaders(i.getAllResponseHeaders())),a.setBodyJson(i.responseText),n(a)}catch(e){o()}},i.onerror=function(){o()},e.getHeaders().forEach(function(e){i.setRequestHeader(e.getName(),e.getValue())}),i.setRequestHeader("Content-Type","application/json"),i.send(e.getBodyJson())})}}]),e}(),S=function(){function e(){n(this,e)}return i(e,[{key:"formatAsTwoDigits",value:function(e){return e.toLocaleString("EN",{minimumIntegerDigits:2,useGrouping:!1})}},{key:"logDateFormat",value:function(e){var t=e.getFullYear(),n=this.formatAsTwoDigits(e.getMonth()+1),r=this.formatAsTwoDigits(e.getDate()),i=this.formatAsTwoDigits(e.getHours()),o=this.formatAsTwoDigits(e.getMinutes()),a=this.formatAsTwoDigits(e.getSeconds()),s=e.getMilliseconds().toLocaleString("EN",{minimumIntegerDigits:3,useGrouping:!1});return"".concat(t,"-").concat(n,"-").concat(r," ").concat(i,":").concat(o,":").concat(a,".").concat(s)}},{key:"log",value:function(e,t,n){var r=com.ts.mobile.sdk.LogLevel[e].toUpperCase();console.log("".concat(this.logDateFormat(new Date),"\t").concat(r,"\t").concat(t,":\t").concat(n))}}]),e}(),I={set:o,get:function(e){return o.call(o,e)},remove:function(e){o(e,"",{expires:-1})}},w=function(){function e(t){n(this,e),this._persistent=t}return i(e,[{key:"setItem",value:function(e,t){var n=btoa(t);this._persistent?I.set(e,n,{expires:365}):I.set(e,n)}},{key:"removeItem",value:function(e){I.remove(e)}},{key:"getItem",value:function(e){var t=I.get(e);return t&&(t=atob(t)),t}}]),e}(),k=function(){function e(){n(this,e),this._memStore={}}return i(e,[{key:"setItem",value:function(e,t){this._memStore[e]=t}},{key:"removeItem",value:function(e){delete this._memStore[e]}},{key:"getItem",value:function(e){return this._memStore[e]}}]),e}(),C=function(){function e(t){if(n(this,e),"undefined"!=typeof window)try{this.currentStorage=window[t],this.currentStorage.setItem("ts:test","ok"),this.currentStorage.removeItem("ts:test")}catch(e){console.warn("Failed to use browser storage. Resorting to cookies."),this.currentStorage=new w("localStorage"==t)}else this.currentStorage=new k}return i(e,[{key:"setItem",value:function(e,t){this.currentStorage.setItem(e,t)}},{key:"getItem",value:function(e){return this.currentStorage.getItem(e)}},{key:"removeItem",value:function(e){this.currentStorage.removeItem(e)}}]),e}();C.localStorage=new C("localStorage"),C.sessionStorage=new C("sessionStorage");var E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},P=a(function(e){var t,n;t=E,n=function(){var e=function e(t){if(!(this instanceof e))return new e(t);this.options=this.extend(t,{swfContainerId:"fingerprintjs2",swfPath:"flash/compiled/FontList.swf",detectScreenOrientation:!0,sortPluginsFor:[/palemoon/i],userDefinedFonts:[]}),this.nativeForEach=Array.prototype.forEach,this.nativeMap=Array.prototype.map};return e.prototype={extend:function(e,t){if(null==e)return t;for(var n in e)null!=e[n]&&t[n]!==e[n]&&(t[n]=e[n]);return t},get:function(e){var t=this,n={data:[],push:function(e){var n=e.key,r=e.value;"function"==typeof t.options.preprocessor&&(r=t.options.preprocessor(n,r)),this.data.push({key:n,value:r})}};n=this.userAgentKey(n),n=this.languageKey(n),n=this.colorDepthKey(n),n=this.pixelRatioKey(n),n=this.hardwareConcurrencyKey(n),n=this.screenResolutionKey(n),n=this.availableScreenResolutionKey(n),n=this.timezoneOffsetKey(n),n=this.sessionStorageKey(n),n=this.localStorageKey(n),n=this.indexedDbKey(n),n=this.addBehaviorKey(n),n=this.openDatabaseKey(n),n=this.cpuClassKey(n),n=this.platformKey(n),n=this.doNotTrackKey(n),n=this.pluginsKey(n),n=this.canvasKey(n),n=this.webglKey(n),n=this.adBlockKey(n),n=this.hasLiedLanguagesKey(n),n=this.hasLiedResolutionKey(n),n=this.hasLiedOsKey(n),n=this.hasLiedBrowserKey(n),n=this.touchSupportKey(n),n=this.customEntropyFunction(n),this.fontsKey(n,function(n){var r=[];t.each(n.data,function(e){var t=e.value;void 0!==e.value.join&&(t=e.value.join(";")),r.push(t)});var i=t.x64hash128(r.join("~~~"),31);return e(i,n.data)})},customEntropyFunction:function(e){return"function"==typeof this.options.customFunction&&e.push({key:"custom",value:this.options.customFunction()}),e},userAgentKey:function(e){return this.options.excludeUserAgent||e.push({key:"user_agent",value:this.getUserAgent()}),e},getUserAgent:function(){return navigator.userAgent},languageKey:function(e){return this.options.excludeLanguage||e.push({key:"language",value:navigator.language||navigator.userLanguage||navigator.browserLanguage||navigator.systemLanguage||""}),e},colorDepthKey:function(e){return this.options.excludeColorDepth||e.push({key:"color_depth",value:screen.colorDepth||-1}),e},pixelRatioKey:function(e){return this.options.excludePixelRatio||e.push({key:"pixel_ratio",value:this.getPixelRatio()}),e},getPixelRatio:function(){return window.devicePixelRatio||""},screenResolutionKey:function(e){return this.options.excludeScreenResolution?e:this.getScreenResolution(e)},getScreenResolution:function(e){var t;return void 0!==(t=this.options.detectScreenOrientation&&screen.height>screen.width?[screen.height,screen.width]:[screen.width,screen.height])&&e.push({key:"resolution",value:t}),e},availableScreenResolutionKey:function(e){return this.options.excludeAvailableScreenResolution?e:this.getAvailableScreenResolution(e)},getAvailableScreenResolution:function(e){var t;return screen.availWidth&&screen.availHeight&&(t=this.options.detectScreenOrientation?screen.availHeight>screen.availWidth?[screen.availHeight,screen.availWidth]:[screen.availWidth,screen.availHeight]:[screen.availHeight,screen.availWidth]),void 0!==t&&e.push({key:"available_resolution",value:t}),e},timezoneOffsetKey:function(e){return this.options.excludeTimezoneOffset||e.push({key:"timezone_offset",value:(new Date).getTimezoneOffset()}),e},sessionStorageKey:function(e){return!this.options.excludeSessionStorage&&this.hasSessionStorage()&&e.push({key:"session_storage",value:1}),e},localStorageKey:function(e){return!this.options.excludeSessionStorage&&this.hasLocalStorage()&&e.push({key:"local_storage",value:1}),e},indexedDbKey:function(e){return!this.options.excludeIndexedDB&&this.hasIndexedDB()&&e.push({key:"indexed_db",value:1}),e},addBehaviorKey:function(e){return document.body&&!this.options.excludeAddBehavior&&document.body.addBehavior&&e.push({key:"add_behavior",value:1}),e},openDatabaseKey:function(e){return!this.options.excludeOpenDatabase&&window.openDatabase&&e.push({key:"open_database",value:1}),e},cpuClassKey:function(e){return this.options.excludeCpuClass||e.push({key:"cpu_class",value:this.getNavigatorCpuClass()}),e},platformKey:function(e){return this.options.excludePlatform||e.push({key:"navigator_platform",value:this.getNavigatorPlatform()}),e},doNotTrackKey:function(e){return this.options.excludeDoNotTrack||e.push({key:"do_not_track",value:this.getDoNotTrack()}),e},canvasKey:function(e){return!this.options.excludeCanvas&&this.isCanvasSupported()&&e.push({key:"canvas",value:this.getCanvasFp()}),e},webglKey:function(e){return this.options.excludeWebGL?e:this.isWebGlSupported()?(e.push({key:"webgl",value:this.getWebglFp()}),e):e},adBlockKey:function(e){return this.options.excludeAdBlock||e.push({key:"adblock",value:this.getAdBlock()}),e},hasLiedLanguagesKey:function(e){return this.options.excludeHasLiedLanguages||e.push({key:"has_lied_languages",value:this.getHasLiedLanguages()}),e},hasLiedResolutionKey:function(e){return this.options.excludeHasLiedResolution||e.push({key:"has_lied_resolution",value:this.getHasLiedResolution()}),e},hasLiedOsKey:function(e){return this.options.excludeHasLiedOs||e.push({key:"has_lied_os",value:this.getHasLiedOs()}),e},hasLiedBrowserKey:function(e){return this.options.excludeHasLiedBrowser||e.push({key:"has_lied_browser",value:this.getHasLiedBrowser()}),e},fontsKey:function(e,t){return this.options.excludeJsFonts?this.flashFontsKey(e,t):this.jsFontsKey(e,t)},flashFontsKey:function(e,t){return this.options.excludeFlashFonts?t(e):this.hasSwfObjectLoaded()&&this.hasMinFlashInstalled()?void 0===this.options.swfPath?t(e):void this.loadSwfAndDetectFonts(function(n){e.push({key:"swf_fonts",value:n.join(";")}),t(e)}):t(e)},jsFontsKey:function(e,t){var n=this;return setTimeout(function(){var r=["monospace","sans-serif","serif"],i=["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial MT","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Bitstream Vera Sans Mono","Book Antiqua","Bookman Old Style","Calibri","Cambria","Cambria Math","Century","Century Gothic","Century Schoolbook","Comic Sans","Comic Sans MS","Consolas","Courier","Courier New","Garamond","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax","LUCIDA GRANDE","Lucida Handwriting","Lucida Sans","Lucida Sans Typewriter","Lucida Sans Unicode","Microsoft Sans Serif","Monaco","Monotype Corsiva","MS Gothic","MS Outlook","MS PGothic","MS Reference Sans Serif","MS Sans Serif","MS Serif","MYRIAD","MYRIAD PRO","Palatino","Palatino Linotype","Segoe Print","Segoe Script","Segoe UI","Segoe UI Light","Segoe UI Semibold","Segoe UI Symbol","Tahoma","Times","Times New Roman","Times New Roman PS","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3"];n.options.extendedJsFonts&&(i=i.concat(["Abadi MT Condensed Light","Academy Engraved LET","ADOBE CASLON PRO","Adobe Garamond","ADOBE GARAMOND PRO","Agency FB","Aharoni","Albertus Extra Bold","Albertus Medium","Algerian","Amazone BT","American Typewriter","American Typewriter Condensed","AmerType Md BT","Andalus","Angsana New","AngsanaUPC","Antique Olive","Aparajita","Apple Chancery","Apple Color Emoji","Apple SD Gothic Neo","Arabic Typesetting","ARCHER","ARNO PRO","Arrus BT","Aurora Cn BT","AvantGarde Bk BT","AvantGarde Md BT","AVENIR","Ayuthaya","Bandy","Bangla Sangam MN","Bank Gothic","BankGothic Md BT","Baskerville","Baskerville Old Face","Batang","BatangChe","Bauer Bodoni","Bauhaus 93","Bazooka","Bell MT","Bembo","Benguiat Bk BT","Berlin Sans FB","Berlin Sans FB Demi","Bernard MT Condensed","BernhardFashion BT","BernhardMod BT","Big Caslon","BinnerD","Blackadder ITC","BlairMdITC TT","Bodoni 72","Bodoni 72 Oldstyle","Bodoni 72 Smallcaps","Bodoni MT","Bodoni MT Black","Bodoni MT Condensed","Bodoni MT Poster Compressed","Bookshelf Symbol 7","Boulder","Bradley Hand","Bradley Hand ITC","Bremen Bd BT","Britannic Bold","Broadway","Browallia New","BrowalliaUPC","Brush Script MT","Californian FB","Calisto MT","Calligrapher","Candara","CaslonOpnface BT","Castellar","Centaur","Cezanne","CG Omega","CG Times","Chalkboard","Chalkboard SE","Chalkduster","Charlesworth","Charter Bd BT","Charter BT","Chaucer","ChelthmITC Bk BT","Chiller","Clarendon","Clarendon Condensed","CloisterBlack BT","Cochin","Colonna MT","Constantia","Cooper Black","Copperplate","Copperplate Gothic","Copperplate Gothic Bold","Copperplate Gothic Light","CopperplGoth Bd BT","Corbel","Cordia New","CordiaUPC","Cornerstone","Coronet","Cuckoo","Curlz MT","DaunPenh","Dauphin","David","DB LCD Temp","DELICIOUS","Denmark","DFKai-SB","Didot","DilleniaUPC","DIN","DokChampa","Dotum","DotumChe","Ebrima","Edwardian Script ITC","Elephant","English 111 Vivace BT","Engravers MT","EngraversGothic BT","Eras Bold ITC","Eras Demi ITC","Eras Light ITC","Eras Medium ITC","EucrosiaUPC","Euphemia","Euphemia UCAS","EUROSTILE","Exotc350 Bd BT","FangSong","Felix Titling","Fixedsys","FONTIN","Footlight MT Light","Forte","FrankRuehl","Fransiscan","Freefrm721 Blk BT","FreesiaUPC","Freestyle Script","French Script MT","FrnkGothITC Bk BT","Fruitger","FRUTIGER","Futura","Futura Bk BT","Futura Lt BT","Futura Md BT","Futura ZBlk BT","FuturaBlack BT","Gabriola","Galliard BT","Gautami","Geeza Pro","Geometr231 BT","Geometr231 Hv BT","Geometr231 Lt BT","GeoSlab 703 Lt BT","GeoSlab 703 XBd BT","Gigi","Gill Sans","Gill Sans MT","Gill Sans MT Condensed","Gill Sans MT Ext Condensed Bold","Gill Sans Ultra Bold","Gill Sans Ultra Bold Condensed","Gisha","Gloucester MT Extra Condensed","GOTHAM","GOTHAM BOLD","Goudy Old Style","Goudy Stout","GoudyHandtooled BT","GoudyOLSt BT","Gujarati Sangam MN","Gulim","GulimChe","Gungsuh","GungsuhChe","Gurmukhi MN","Haettenschweiler","Harlow Solid Italic","Harrington","Heather","Heiti SC","Heiti TC","HELV","Herald","High Tower Text","Hiragino Kaku Gothic ProN","Hiragino Mincho ProN","Hoefler Text","Humanst 521 Cn BT","Humanst521 BT","Humanst521 Lt BT","Imprint MT Shadow","Incised901 Bd BT","Incised901 BT","Incised901 Lt BT","INCONSOLATA","Informal Roman","Informal011 BT","INTERSTATE","IrisUPC","Iskoola Pota","JasmineUPC","Jazz LET","Jenson","Jester","Jokerman","Juice ITC","Kabel Bk BT","Kabel Ult BT","Kailasa","KaiTi","Kalinga","Kannada Sangam MN","Kartika","Kaufmann Bd BT","Kaufmann BT","Khmer UI","KodchiangUPC","Kokila","Korinna BT","Kristen ITC","Krungthep","Kunstler Script","Lao UI","Latha","Leelawadee","Letter Gothic","Levenim MT","LilyUPC","Lithograph","Lithograph Light","Long Island","Lydian BT","Magneto","Maiandra GD","Malayalam Sangam MN","Malgun Gothic","Mangal","Marigold","Marion","Marker Felt","Market","Marlett","Matisse ITC","Matura MT Script Capitals","Meiryo","Meiryo UI","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Tai Le","Microsoft Uighur","Microsoft YaHei","Microsoft Yi Baiti","MingLiU","MingLiU_HKSCS","MingLiU_HKSCS-ExtB","MingLiU-ExtB","Minion","Minion Pro","Miriam","Miriam Fixed","Mistral","Modern","Modern No. 20","Mona Lisa Solid ITC TT","Mongolian Baiti","MONO","MoolBoran","Mrs Eaves","MS LineDraw","MS Mincho","MS PMincho","MS Reference Specialty","MS UI Gothic","MT Extra","MUSEO","MV Boli","Nadeem","Narkisim","NEVIS","News Gothic","News GothicMT","NewsGoth BT","Niagara Engraved","Niagara Solid","Noteworthy","NSimSun","Nyala","OCR A Extended","Old Century","Old English Text MT","Onyx","Onyx BT","OPTIMA","Oriya Sangam MN","OSAKA","OzHandicraft BT","Palace Script MT","Papyrus","Parchment","Party LET","Pegasus","Perpetua","Perpetua Titling MT","PetitaBold","Pickwick","Plantagenet Cherokee","Playbill","PMingLiU","PMingLiU-ExtB","Poor Richard","Poster","PosterBodoni BT","PRINCETOWN LET","Pristina","PTBarnum BT","Pythagoras","Raavi","Rage Italic","Ravie","Ribbon131 Bd BT","Rockwell","Rockwell Condensed","Rockwell Extra Bold","Rod","Roman","Sakkal Majalla","Santa Fe LET","Savoye LET","Sceptre","Script","Script MT Bold","SCRIPTINA","Serifa","Serifa BT","Serifa Th BT","ShelleyVolante BT","Sherwood","Shonar Bangla","Showcard Gothic","Shruti","Signboard","SILKSCREEN","SimHei","Simplified Arabic","Simplified Arabic Fixed","SimSun","SimSun-ExtB","Sinhala Sangam MN","Sketch Rockwell","Skia","Small Fonts","Snap ITC","Snell Roundhand","Socket","Souvenir Lt BT","Staccato222 BT","Steamer","Stencil","Storybook","Styllo","Subway","Swis721 BlkEx BT","Swiss911 XCm BT","Sylfaen","Synchro LET","System","Tamil Sangam MN","Technical","Teletype","Telugu Sangam MN","Tempus Sans ITC","Terminal","Thonburi","Traditional Arabic","Trajan","TRAJAN PRO","Tristan","Tubular","Tunga","Tw Cen MT","Tw Cen MT Condensed","Tw Cen MT Condensed Extra Bold","TypoUpright BT","Unicorn","Univers","Univers CE 55 Medium","Univers Condensed","Utsaah","Vagabond","Vani","Vijaya","Viner Hand ITC","VisualUI","Vivaldi","Vladimir Script","Vrinda","Westminster","WHITNEY","Wide Latin","ZapfEllipt BT","ZapfHumnst BT","ZapfHumnst Dm BT","Zapfino","Zurich BlkEx BT","Zurich Ex BT","ZWAdobeF"])),i=i.concat(n.options.userDefinedFonts);var o=document.getElementsByTagName("body")[0],a=document.createElement("div"),s=document.createElement("div"),c={},u={},l=function(){var e=document.createElement("span");return e.style.position="absolute",e.style.left="-9999px",e.style.fontSize="72px",e.style.lineHeight="normal",e.innerHTML="mmmmmmmmmmlli",e},d=function(e,t){var n=l();return n.style.fontFamily="'"+e+"',"+t,n},h=function(){for(var e=[],t=0,n=r.length;t<n;t++){var i=l();i.style.fontFamily=r[t],a.appendChild(i),e.push(i)}return e}();o.appendChild(a);for(var p=0,f=r.length;p<f;p++)c[r[p]]=h[p].offsetWidth,u[r[p]]=h[p].offsetHeight;var m=function(){for(var e={},t=0,n=i.length;t<n;t++){for(var o=[],a=0,c=r.length;a<c;a++){var u=d(i[t],r[a]);s.appendChild(u),o.push(u)}e[i[t]]=o}return e}();o.appendChild(s);for(var g=[],v=0,y=i.length;v<y;v++)(function(e){for(var t=!1,n=0;n<r.length;n++)if(t=e[n].offsetWidth!==c[r[n]]||e[n].offsetHeight!==u[r[n]])return t;return t})(m[i[v]])&&g.push(i[v]);o.removeChild(s),o.removeChild(a),e.push({key:"js_fonts",value:g}),t(e)},1)},pluginsKey:function(e){return this.options.excludePlugins||(this.isIE()?this.options.excludeIEPlugins||e.push({key:"ie_plugins",value:this.getIEPlugins()}):e.push({key:"regular_plugins",value:this.getRegularPlugins()})),e},getRegularPlugins:function(){for(var e=[],t=0,n=navigator.plugins.length;t<n;t++)e.push(navigator.plugins[t]);return this.pluginsShouldBeSorted()&&(e=e.sort(function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),this.map(e,function(e){var t=this.map(e,function(e){return[e.type,e.suffixes].join("~")}).join(",");return[e.name,e.description,t].join("::")},this)},getIEPlugins:function(){var e=[];return(Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(window,"ActiveXObject")||"ActiveXObject"in window)&&(e=this.map(["AcroPDF.PDF","Adodb.Stream","AgControl.AgControl","DevalVRXCtrl.DevalVRXCtrl.1","MacromediaFlashPaper.MacromediaFlashPaper","Msxml2.DOMDocument","Msxml2.XMLHTTP","PDF.PdfCtrl","QuickTime.QuickTime","QuickTimeCheckObject.QuickTimeCheck.1","RealPlayer","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)","Scripting.Dictionary","SWCtl.SWCtl","Shell.UIHelper","ShockwaveFlash.ShockwaveFlash","Skype.Detection","TDCCtl.TDCCtl","WMPlayer.OCX","rmocx.RealPlayer G2 Control","rmocx.RealPlayer G2 Control.1"],function(e){try{return new ActiveXObject(e),e}catch(e){return null}})),navigator.plugins&&(e=e.concat(this.getRegularPlugins())),e},pluginsShouldBeSorted:function(){for(var e=!1,t=0,n=this.options.sortPluginsFor.length;t<n;t++){var r=this.options.sortPluginsFor[t];if(navigator.userAgent.match(r)){e=!0;break}}return e},touchSupportKey:function(e){return this.options.excludeTouchSupport||e.push({key:"touch_support",value:this.getTouchSupport()}),e},hardwareConcurrencyKey:function(e){return this.options.excludeHardwareConcurrency||e.push({key:"hardware_concurrency",value:this.getHardwareConcurrency()}),e},hasSessionStorage:function(){try{return!!window.sessionStorage}catch(e){return!0}},hasLocalStorage:function(){try{return!!window.localStorage}catch(e){return!0}},hasIndexedDB:function(){try{return!!window.indexedDB}catch(e){return!0}},getHardwareConcurrency:function(){return navigator.hardwareConcurrency?navigator.hardwareConcurrency:"unknown"},getNavigatorCpuClass:function(){return navigator.cpuClass?navigator.cpuClass:"unknown"},getNavigatorPlatform:function(){return navigator.platform?navigator.platform:"unknown"},getDoNotTrack:function(){return navigator.doNotTrack?navigator.doNotTrack:navigator.msDoNotTrack?navigator.msDoNotTrack:window.doNotTrack?window.doNotTrack:"unknown"},getTouchSupport:function(){var e=0,t=!1;void 0!==navigator.maxTouchPoints?e=navigator.maxTouchPoints:void 0!==navigator.msMaxTouchPoints&&(e=navigator.msMaxTouchPoints);try{document.createEvent("TouchEvent"),t=!0}catch(e){}return[e,t,"ontouchstart"in window]},getCanvasFp:function(){var e=[],t=document.createElement("canvas");t.width=2e3,t.height=200,t.style.display="inline";var n=t.getContext("2d");return n.rect(0,0,10,10),n.rect(2,2,6,6),e.push("canvas winding:"+(!1===n.isPointInPath(5,5,"evenodd")?"yes":"no")),n.textBaseline="alphabetic",n.fillStyle="#f60",n.fillRect(125,1,62,20),n.fillStyle="#069",this.options.dontUseFakeFontInCanvas?n.font="11pt Arial":n.font="11pt no-real-font-123",n.fillText("Cwm fjordbank glyphs vext quiz, ????",2,15),n.fillStyle="rgba(102, 204, 0, 0.2)",n.font="18pt Arial",n.fillText("Cwm fjordbank glyphs vext quiz, ????",4,45),n.globalCompositeOperation="multiply",n.fillStyle="rgb(255,0,255)",n.beginPath(),n.arc(50,50,50,0,2*Math.PI,!0),n.closePath(),n.fill(),n.fillStyle="rgb(0,255,255)",n.beginPath(),n.arc(100,50,50,0,2*Math.PI,!0),n.closePath(),n.fill(),n.fillStyle="rgb(255,255,0)",n.beginPath(),n.arc(75,100,50,0,2*Math.PI,!0),n.closePath(),n.fill(),n.fillStyle="rgb(255,0,255)",n.arc(75,75,75,0,2*Math.PI,!0),n.arc(75,75,25,0,2*Math.PI,!0),n.fill("evenodd"),e.push("canvas fp:"+t.toDataURL()),e.join("~")},getWebglFp:function(){var e,t=function(t){return e.clearColor(0,0,0,1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),"["+t[0]+", "+t[1]+"]"};if(!(e=this.getWebglCanvas()))return null;var n=[],r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r);var i=new Float32Array([-.2,-.9,0,.4,-.26,0,0,.732134444,0]);e.bufferData(e.ARRAY_BUFFER,i,e.STATIC_DRAW),r.itemSize=3,r.numItems=3;var o=e.createProgram(),a=e.createShader(e.VERTEX_SHADER);e.shaderSource(a,"attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}"),e.compileShader(a);var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,"precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}"),e.compileShader(s),e.attachShader(o,a),e.attachShader(o,s),e.linkProgram(o),e.useProgram(o),o.vertexPosAttrib=e.getAttribLocation(o,"attrVertex"),o.offsetUniform=e.getUniformLocation(o,"uniformOffset"),e.enableVertexAttribArray(o.vertexPosArray),e.vertexAttribPointer(o.vertexPosAttrib,r.itemSize,e.FLOAT,!1,0,0),e.uniform2f(o.offsetUniform,1,1),e.drawArrays(e.TRIANGLE_STRIP,0,r.numItems),null!=e.canvas&&n.push(e.canvas.toDataURL()),n.push("extensions:"+e.getSupportedExtensions().join(";")),n.push("webgl aliased line width range:"+t(e.getParameter(e.ALIASED_LINE_WIDTH_RANGE))),n.push("webgl aliased point size range:"+t(e.getParameter(e.ALIASED_POINT_SIZE_RANGE))),n.push("webgl alpha bits:"+e.getParameter(e.ALPHA_BITS)),n.push("webgl antialiasing:"+(e.getContextAttributes().antialias?"yes":"no")),n.push("webgl blue bits:"+e.getParameter(e.BLUE_BITS)),n.push("webgl depth bits:"+e.getParameter(e.DEPTH_BITS)),n.push("webgl green bits:"+e.getParameter(e.GREEN_BITS)),n.push("webgl max anisotropy:"+function(e){var t,n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic");return n?(0===(t=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT))&&(t=2),t):null}(e)),n.push("webgl max combined texture image units:"+e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS)),n.push("webgl max cube map texture size:"+e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE)),n.push("webgl max fragment uniform vectors:"+e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS)),n.push("webgl max render buffer size:"+e.getParameter(e.MAX_RENDERBUFFER_SIZE)),n.push("webgl max texture image units:"+e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)),n.push("webgl max texture size:"+e.getParameter(e.MAX_TEXTURE_SIZE)),n.push("webgl max varying vectors:"+e.getParameter(e.MAX_VARYING_VECTORS)),n.push("webgl max vertex attribs:"+e.getParameter(e.MAX_VERTEX_ATTRIBS)),n.push("webgl max vertex texture image units:"+e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),n.push("webgl max vertex uniform vectors:"+e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS)),n.push("webgl max viewport dims:"+t(e.getParameter(e.MAX_VIEWPORT_DIMS))),n.push("webgl red bits:"+e.getParameter(e.RED_BITS)),n.push("webgl renderer:"+e.getParameter(e.RENDERER)),n.push("webgl shading language version:"+e.getParameter(e.SHADING_LANGUAGE_VERSION)),n.push("webgl stencil bits:"+e.getParameter(e.STENCIL_BITS)),n.push("webgl vendor:"+e.getParameter(e.VENDOR)),n.push("webgl version:"+e.getParameter(e.VERSION));try{var c=e.getExtension("WEBGL_debug_renderer_info");c&&(n.push("webgl unmasked vendor:"+e.getParameter(c.UNMASKED_VENDOR_WEBGL)),n.push("webgl unmasked renderer:"+e.getParameter(c.UNMASKED_RENDERER_WEBGL)))}catch(e){}return e.getShaderPrecisionFormat?(n.push("webgl vertex shader high float precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision),n.push("webgl vertex shader high float precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).rangeMin),n.push("webgl vertex shader high float precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).rangeMax),n.push("webgl vertex shader medium float precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision),n.push("webgl vertex shader medium float precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).rangeMin),n.push("webgl vertex shader medium float precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).rangeMax),n.push("webgl vertex shader low float precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_FLOAT).precision),n.push("webgl vertex shader low float precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_FLOAT).rangeMin),n.push("webgl vertex shader low float precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_FLOAT).rangeMax),n.push("webgl fragment shader high float precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision),n.push("webgl fragment shader high float precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).rangeMin),n.push("webgl fragment shader high float precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).rangeMax),n.push("webgl fragment shader medium float precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision),n.push("webgl fragment shader medium float precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).rangeMin),n.push("webgl fragment shader medium float precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).rangeMax),n.push("webgl fragment shader low float precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_FLOAT).precision),n.push("webgl fragment shader low float precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_FLOAT).rangeMin),n.push("webgl fragment shader low float precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_FLOAT).rangeMax),n.push("webgl vertex shader high int precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_INT).precision),n.push("webgl vertex shader high int precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_INT).rangeMin),n.push("webgl vertex shader high int precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_INT).rangeMax),n.push("webgl vertex shader medium int precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_INT).precision),n.push("webgl vertex shader medium int precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_INT).rangeMin),n.push("webgl vertex shader medium int precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_INT).rangeMax),n.push("webgl vertex shader low int precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_INT).precision),n.push("webgl vertex shader low int precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_INT).rangeMin),n.push("webgl vertex shader low int precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_INT).rangeMax),n.push("webgl fragment shader high int precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_INT).precision),n.push("webgl fragment shader high int precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_INT).rangeMin),n.push("webgl fragment shader high int precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_INT).rangeMax),n.push("webgl fragment shader medium int precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_INT).precision),n.push("webgl fragment shader medium int precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_INT).rangeMin),n.push("webgl fragment shader medium int precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_INT).rangeMax),n.push("webgl fragment shader low int precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_INT).precision),n.push("webgl fragment shader low int precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_INT).rangeMin),n.push("webgl fragment shader low int precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_INT).rangeMax),n.join("~")):n.join("~")},getAdBlock:function(){var e=document.createElement("div");e.innerHTML="&nbsp;",e.className="adsbox";var t=!1;try{document.body.appendChild(e),t=0===document.getElementsByClassName("adsbox")[0].offsetHeight,document.body.removeChild(e)}catch(e){t=!1}return t},getHasLiedLanguages:function(){if(void 0!==navigator.languages)try{if(navigator.languages[0].substr(0,2)!==navigator.language.substr(0,2))return!0}catch(e){return!0}return!1},getHasLiedResolution:function(){return screen.width<screen.availWidth||screen.height<screen.availHeight},getHasLiedOs:function(){var e,t=navigator.userAgent.toLowerCase(),n=navigator.oscpu,r=navigator.platform.toLowerCase();if(e=t.indexOf("windows phone")>=0?"Windows Phone":t.indexOf("win")>=0?"Windows":t.indexOf("android")>=0?"Android":t.indexOf("linux")>=0?"Linux":t.indexOf("iphone")>=0||t.indexOf("ipad")>=0?"iOS":t.indexOf("mac")>=0?"Mac":"Other",("ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0)&&"Windows Phone"!==e&&"Android"!==e&&"iOS"!==e&&"Other"!==e)return!0;if(void 0!==n){if((n=n.toLowerCase()).indexOf("win")>=0&&"Windows"!==e&&"Windows Phone"!==e)return!0;if(n.indexOf("linux")>=0&&"Linux"!==e&&"Android"!==e)return!0;if(n.indexOf("mac")>=0&&"Mac"!==e&&"iOS"!==e)return!0;if(0===n.indexOf("win")&&0===n.indexOf("linux")&&n.indexOf("mac")>=0&&"other"!==e)return!0}return r.indexOf("win")>=0&&"Windows"!==e&&"Windows Phone"!==e||(r.indexOf("linux")>=0||r.indexOf("android")>=0||r.indexOf("pike")>=0)&&"Linux"!==e&&"Android"!==e||(r.indexOf("mac")>=0||r.indexOf("ipad")>=0||r.indexOf("ipod")>=0||r.indexOf("iphone")>=0)&&"Mac"!==e&&"iOS"!==e||0===r.indexOf("win")&&0===r.indexOf("linux")&&r.indexOf("mac")>=0&&"other"!==e||void 0===navigator.plugins&&"Windows"!==e&&"Windows Phone"!==e},getHasLiedBrowser:function(){var e,t=navigator.userAgent.toLowerCase(),n=navigator.productSub;if(("Chrome"==(e=t.indexOf("firefox")>=0?"Firefox":t.indexOf("opera")>=0||t.indexOf("opr")>=0?"Opera":t.indexOf("chrome")>=0?"Chrome":t.indexOf("safari")>=0?"Safari":t.indexOf("trident")>=0?"Internet Explorer":"Other")||"Safari"===e||"Opera"===e)&&"20030107"!==n)return!0;var r,i=eval.toString().length;if(37===i&&"Safari"!==e&&"Firefox"!==e&&"Other"!==e)return!0;if(39===i&&"Internet Explorer"!==e&&"Other"!==e)return!0;if(33===i&&"Chrome"!==e&&"Opera"!==e&&"Other"!==e)return!0;try{throw"a"}catch(e){try{e.toSource(),r=!0}catch(e){r=!1}}return!(!r||"Firefox"===e||"Other"===e)},isCanvasSupported:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},isWebGlSupported:function(){if(!this.isCanvasSupported())return!1;var e,t=document.createElement("canvas");try{e=t.getContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))}catch(t){e=!1}return!!window.WebGLRenderingContext&&!!e},isIE:function(){return"Microsoft Internet Explorer"===navigator.appName||!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},hasSwfObjectLoaded:function(){return void 0!==window.swfobject},hasMinFlashInstalled:function(){return swfobject.hasFlashPlayerVersion("9.0.0")},addFlashDivNode:function(){var e=document.createElement("div");e.setAttribute("id",this.options.swfContainerId),document.body.appendChild(e)},loadSwfAndDetectFonts:function(e){var t="___fp_swf_loaded";window[t]=function(t){e(t)};var n=this.options.swfContainerId;this.addFlashDivNode();var r={onReady:t};swfobject.embedSWF(this.options.swfPath,n,"1","1","9.0.0",!1,r,{allowScriptAccess:"always",menu:"false"},{})},getWebglCanvas:function(){var e=document.createElement("canvas"),t=null;try{t=e.getContext("webgl")||e.getContext("experimental-webgl")}catch(e){}return t||(t=null),t},each:function(e,t,n){if(null!==e)if(this.nativeForEach&&e.forEach===this.nativeForEach)e.forEach(t,n);else if(e.length===+e.length){for(var r=0,i=e.length;r<i;r++)if(t.call(n,e[r],r,e)==={})return}else for(var o in e)if(e.hasOwnProperty(o)&&t.call(n,e[o],o,e)==={})return},map:function(e,t,n){var r=[];return null==e?r:this.nativeMap&&e.map===this.nativeMap?e.map(t,n):(this.each(e,function(e,i,o){r[r.length]=t.call(n,e,i,o)}),r)},x64Add:function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},x64Multiply:function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},x64Rotl:function(e,t){return 32==(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])},x64LeftShift:function(e,t){return 0==(t%=64)?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]},x64Xor:function(e,t){return[e[0]^t[0],e[1]^t[1]]},x64Fmix:function(e){return e=this.x64Xor(e,[0,e[0]>>>1]),e=this.x64Multiply(e,[4283543511,3981806797]),e=this.x64Xor(e,[0,e[0]>>>1]),e=this.x64Multiply(e,[3301882366,444984403]),this.x64Xor(e,[0,e[0]>>>1])},x64hash128:function(e,t){t=t||0;for(var n=(e=e||"").length%16,r=e.length-n,i=[0,t],o=[0,t],a=[0,0],s=[0,0],c=[2277735313,289559509],u=[1291169091,658871167],l=0;l<r;l+=16)a=[255&e.charCodeAt(l+4)|(255&e.charCodeAt(l+5))<<8|(255&e.charCodeAt(l+6))<<16|(255&e.charCodeAt(l+7))<<24,255&e.charCodeAt(l)|(255&e.charCodeAt(l+1))<<8|(255&e.charCodeAt(l+2))<<16|(255&e.charCodeAt(l+3))<<24],s=[255&e.charCodeAt(l+12)|(255&e.charCodeAt(l+13))<<8|(255&e.charCodeAt(l+14))<<16|(255&e.charCodeAt(l+15))<<24,255&e.charCodeAt(l+8)|(255&e.charCodeAt(l+9))<<8|(255&e.charCodeAt(l+10))<<16|(255&e.charCodeAt(l+11))<<24],a=this.x64Multiply(a,c),a=this.x64Rotl(a,31),a=this.x64Multiply(a,u),i=this.x64Xor(i,a),i=this.x64Rotl(i,27),i=this.x64Add(i,o),i=this.x64Add(this.x64Multiply(i,[0,5]),[0,1390208809]),s=this.x64Multiply(s,u),s=this.x64Rotl(s,33),s=this.x64Multiply(s,c),o=this.x64Xor(o,s),o=this.x64Rotl(o,31),o=this.x64Add(o,i),o=this.x64Add(this.x64Multiply(o,[0,5]),[0,944331445]);switch(a=[0,0],s=[0,0],n){case 15:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(l+14)],48));case 14:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(l+13)],40));case 13:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(l+12)],32));case 12:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(l+11)],24));case 11:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(l+10)],16));case 10:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(l+9)],8));case 9:s=this.x64Xor(s,[0,e.charCodeAt(l+8)]),s=this.x64Multiply(s,u),s=this.x64Rotl(s,33),s=this.x64Multiply(s,c),o=this.x64Xor(o,s);case 8:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+7)],56));case 7:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+6)],48));case 6:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+5)],40));case 5:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+4)],32));case 4:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+3)],24));case 3:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+2)],16));case 2:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(l+1)],8));case 1:a=this.x64Xor(a,[0,e.charCodeAt(l)]),a=this.x64Multiply(a,c),a=this.x64Rotl(a,31),a=this.x64Multiply(a,u),i=this.x64Xor(i,a)}return i=this.x64Xor(i,[0,e.length]),o=this.x64Xor(o,[0,e.length]),i=this.x64Add(i,o),o=this.x64Add(o,i),i=this.x64Fmix(i),o=this.x64Fmix(o),i=this.x64Add(i,o),o=this.x64Add(o,i),("00000000"+(i[0]>>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)}},e.VERSION="1.5.1",e},e.exports?e.exports=n():t.exports?t.exports=n():t.Fingerprint2=n()}),T={default:P,__moduleExports:P},R="ts.fp.binding_id",D={},x=[s("binding_id",function(){return window.localStorage?window.localStorage.getItem(R):null}),s("collector_version",function(){return"1.0.0"}),s("local_ip",new Promise(function(e,t){!function(e){var t=setTimeout(function(){e(null)},300),n={},r=window,i=r.RTCPeerConnection||r.mozRTCPeerConnection||r.webkitRTCPeerConnection,o=(r.webkitRTCPeerConnection,new i({iceServers:[{urls:"stun:dummysrv.dummyserver.com.nowhere"}]},{optional:[{RtpDataChannels:!0}]}));o.onicecandidate=function(r){var i,o;r.candidate&&(i=r.candidate.candidate,o=/([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec(i)[1],void 0===n[o]&&(clearTimeout(t),e(o)),n[o]=!0)},o.createDataChannel(""),o.createOffer({}).then(function(e){o.setLocalDescription(e,function(){},function(){})},function(){})}(function(n){n?e&&(e(n),e=null):t("Timeout")})})),s("cpu_cores",function(){return navigator.hardwareConcurrency})],L=null,M=function(e){var t=Object.keys(D).map(function(e){return s(e,D[e])}),n=x.concat(function(e){return L||(L=new Promise(function(t,n){var r={};e||(r.excludeCanvas=!0,r.excludeWebGL=!0),new P(r).get(function(e,n){for(var r={},i=0;i<n.length;i++)r[n[i].key]=n[i].value;t({fp2_hash:e,fp2_keys:r})})})),L}(e)).concat(t);return Promise.all(n).then(function(e){return function(e){var t={};return Object.assign.apply(null,[t].concat(e)),t}(e)})},F=a(function(e,n){!function(r,i){var o="model",a="name",s="type",c="vendor",u="version",l="mobile",d="tablet",h={extend:function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},has:function(e,t){return"string"==typeof e&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return"string"===t(e)?e.replace(/[^\d\.]/g,"").split(".")[0]:void 0},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},p={rgx:function(e,n){for(var r,i,o,a,s,c,u=0;u<n.length&&!s;){var l=n[u],d=n[u+1];for(r=i=0;r<l.length&&!s;)if(s=l[r++].exec(e))for(o=0;o<d.length;o++)c=s[++i],"object"===t(a=d[o])&&a.length>0?2==a.length?"function"==t(a[1])?this[a[0]]=a[1].call(this,c):this[a[0]]=a[1]:3==a.length?"function"!==t(a[1])||a[1].exec&&a[1].test?this[a[0]]=c?c.replace(a[1],a[2]):void 0:this[a[0]]=c?a[1].call(this,c,a[2]):void 0:4==a.length&&(this[a[0]]=c?a[3].call(this,c.replace(a[1],a[2])):void 0):this[a]=c||void 0;u+=2}},str:function(e,n){for(var r in n)if("object"===t(n[r])&&n[r].length>0){for(var i=0;i<n[r].length;i++)if(h.has(n[r][i],e))return"?"===r?void 0:r}else if(h.has(n[r],e))return"?"===r?void 0:r;return e}},f={browser:{oldsafari:{version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{amazon:{model:{"Fire Phone":["SD","KF"]}},sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"}}}},m={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[a,u],[/(opios)[\/\s]+([\w\.]+)/i],[[a,"Opera Mini"],u],[/\s(opr)\/([\w\.]+)/i],[[a,"Opera"],u],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser)\/([\w\.-]+)/i],[a,u],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[a,"IE"],u],[/(edge)\/((\d+)?[\w\.]+)/i],[a,u],[/(yabrowser)\/([\w\.]+)/i],[[a,"Yandex"],u],[/(puffin)\/([\w\.]+)/i],[[a,"Puffin"],u],[/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[[a,"UCBrowser"],u],[/(comodo_dragon)\/([\w\.]+)/i],[[a,/_/g," "],u],[/(micromessenger)\/([\w\.]+)/i],[[a,"WeChat"],u],[/(QQ)\/([\d\.]+)/i],[a,u],[/m?(qqbrowser)[\/\s]?([\w\.]+)/i],[a,u],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[u,[a,"MIUI Browser"]],[/;fbav\/([\w\.]+);/i],[u,[a,"Facebook"]],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[u,[a,"Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[[a,/(.+)/,"$1 WebView"],u],[/((?:oculus|samsung)browser)\/([\w\.]+)/i],[[a,/(.+(?:g|us))(.+)/,"$1 $2"],u],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i],[u,[a,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[a,u],[/(dolfin)\/([\w\.]+)/i],[[a,"Dolphin"],u],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[a,"Chrome"],u],[/(coast)\/([\w\.]+)/i],[[a,"Opera Coast"],u],[/fxios\/([\w\.-]+)/i],[u,[a,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[u,[a,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[u,a],[/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[[a,"GSA"],u],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[a,[u,p.str,f.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[a,u],[/(navigator|netscape)\/([\w\.-]+)/i],[[a,"Netscape"],u],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[a,u]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[["architecture","amd64"]],[/(ia32(?=;))/i],[["architecture",h.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[["architecture","ia32"]],[/windows\s(ce|mobile);\sppc;/i],[["architecture","arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[["architecture",/ower/,"",h.lowerize]],[/(sun4\w)[;\)]/i],[["architecture","sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[["architecture",h.lowerize]]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],[o,c,[s,d]],[/applecoremedia\/[\w\.]+ \((ipad)/],[o,[c,"Apple"],[s,d]],[/(apple\s{0,1}tv)/i],[[o,"Apple TV"],[c,"Apple"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(hp).+(tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],[c,o,[s,d]],[/(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i],[o,[c,"Amazon"],[s,d]],[/(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i],[[o,p.str,f.device.amazon.model],[c,"Amazon"],[s,l]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[o,c,[s,l]],[/\((ip[honed|\s\w*]+);/i],[o,[c,"Apple"],[s,l]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],[c,o,[s,l]],[/\(bb10;\s(\w+)/i],[o,[c,"BlackBerry"],[s,l]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i],[o,[c,"Asus"],[s,d]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[[c,"Sony"],[o,"Xperia Tablet"],[s,d]],[/android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i],[o,[c,"Sony"],[s,l]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],[c,o,[s,"console"]],[/android.+;\s(shield)\sbuild/i],[o,[c,"Nvidia"],[s,"console"]],[/(playstation\s[34portablevi]+)/i],[o,[c,"Sony"],[s,"console"]],[/(sprint\s(\w+))/i],[[c,p.str,f.device.sprint.vendor],[o,p.str,f.device.sprint.model],[s,l]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],[c,o,[s,d]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w+)*/i,/(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i],[c,[o,/_/g," "],[s,l]],[/(nexus\s9)/i],[o,[c,"HTC"],[s,d]],[/d\/huawei([\w\s-]+)[;\)]/i,/(nexus\s6p)/i],[o,[c,"Huawei"],[s,l]],[/(microsoft);\s(lumia[\s\w]+)/i],[c,o,[s,l]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[o,[c,"Microsoft"],[s,"console"]],[/(kin\.[onetw]{3})/i],[[o,/\./g," "],[c,"Microsoft"],[s,l]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w+)*/i,/(XT\d{3,4}) build\//i,/(nexus\s6)/i],[o,[c,"Motorola"],[s,l]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[o,[c,"Motorola"],[s,d]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[c,h.trim],[o,h.trim],[s,"smarttv"]],[/hbbtv.+maple;(\d+)/i],[[o,/^/,"SmartTV"],[c,"Samsung"],[s,"smarttv"]],[/\(dtv[\);].+(aquos)/i],[o,[c,"Sharp"],[s,"smarttv"]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[[c,"Samsung"],o,[s,d]],[/smart-tv.+(samsung)/i],[c,[s,"smarttv"],o],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i,/sec-((sgh\w+))/i],[[c,"Samsung"],o,[s,l]],[/sie-(\w+)*/i],[o,[c,"Siemens"],[s,l]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]+)*/i],[[c,"Nokia"],o,[s,l]],[/android\s3\.[\s\w;-]{10}(a\d{3})/i],[o,[c,"Acer"],[s,d]],[/android.+([vl]k\-?\d{3})\s+build/i],[o,[c,"LG"],[s,d]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[c,"LG"],o,[s,d]],[/(lg) netcast\.tv/i],[c,o,[s,"smarttv"]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w+)*/i,/android.+lg(\-?[\d\w]+)\s+build/i],[o,[c,"LG"],[s,l]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[o,[c,"Lenovo"],[s,d]],[/linux;.+((jolla));/i],[c,o,[s,l]],[/((pebble))app\/[\d\.]+\s/i],[c,o,[s,"wearable"]],[/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[c,o,[s,l]],[/crkey/i],[[o,"Chromecast"],[c,"Google"]],[/android.+;\s(glass)\s\d/i],[o,[c,"Google"],[s,"wearable"]],[/android.+;\s(pixel c)\s/i],[o,[c,"Google"],[s,d]],[/android.+;\s(pixel xl|pixel)\s/i],[o,[c,"Google"],[s,l]],[/android.+(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d\w)?)\s+build/i,/android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+)?)\s+build/i],[[o,/_/g," "],[c,"Xiaomi"],[s,l]],[/android.+(mi[\s\-_]*(?:pad)?(?:[\s_]*[\w\s]+)?)\s+build/i],[[o,/_/g," "],[c,"Xiaomi"],[s,d]],[/android.+;\s(m[1-5]\snote)\sbuild/i],[o,[c,"Meizu"],[s,d]],[/android.+a000(1)\s+build/i],[o,[c,"OnePlus"],[s,l]],[/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i],[o,[c,"RCA"],[s,d]],[/android.+[;\/]\s*(Venue[\d\s]*)\s+build/i],[o,[c,"Dell"],[s,d]],[/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i],[o,[c,"Verizon"],[s,d]],[/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i],[[c,"Barnes & Noble"],o,[s,d]],[/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i],[o,[c,"NuVision"],[s,d]],[/android.+[;\/]\s*(zte)?.+(k\d{2})\s+build/i],[[c,"ZTE"],o,[s,d]],[/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i],[o,[c,"Swiss"],[s,l]],[/android.+[;\/]\s*(zur\d{3})\s+build/i],[o,[c,"Swiss"],[s,d]],[/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i],[o,[c,"Zeki"],[s,d]],[/(android).+[;\/]\s+([YR]\d{2}x?.*)\s+build/i,/android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(.+)\s+build/i],[[c,"Dragon Touch"],o,[s,d]],[/android.+[;\/]\s*(NS-?.+)\s+build/i],[o,[c,"Insignia"],[s,d]],[/android.+[;\/]\s*((NX|Next)-?.+)\s+build/i],[o,[c,"NextBook"],[s,d]],[/android.+[;\/]\s*(Xtreme\_?)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i],[[c,"Voice"],o,[s,l]],[/android.+[;\/]\s*(LVTEL\-?)?(V1[12])\s+build/i],[[c,"LvTel"],o,[s,l]],[/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i],[o,[c,"Envizen"],[s,d]],[/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(.*\b)\s+build/i],[c,o,[s,d]],[/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i],[o,[c,"MachSpeed"],[s,d]],[/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i],[c,o,[s,d]],[/android.+[;\/]\s*TU_(1491)\s+build/i],[o,[c,"Rotor"],[s,d]],[/android.+(KS(.+))\s+build/i],[o,[c,"Amazon"],[s,d]],[/android.+(Gigaset)[\s\-]+(Q.+)\s+build/i],[c,o,[s,d]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[[s,h.lowerize],c,o],[/(android.+)[;\/].+build/i],[o,[c,"Generic"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[u,[a,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[a,u],[/rv\:([\w\.]+).*(gecko)/i],[u,a]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[a,u],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s]+\w)*/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[a,[u,p.str,f.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[a,"Windows"],[u,p.str,f.os.windows.version]],[/\((bb)(10);/i],[[a,"BlackBerry"],u],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[a,u],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[a,"Symbian"],u],[/\((series40);/i],[a],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[a,"Firefox OS"],u],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[a,u],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[a,"Chromium OS"],u],[/(sunos)\s?([\w\.]+\d)*/i],[[a,"Solaris"],u],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[a,u],[/(haiku)\s(\w+)/i],[a,u],[/cfnetwork\/.+darwin/i,/ip[honead]+(?:.*os\s([\w]+)\slike\smac|;\sopera)/i],[[u,/_/g,"."],[a,"iOS"]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[a,"Mac OS"],[u,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[a,u]]},g=function e(n,i){if("object"===t(n)&&(i=n,n=void 0),!(this instanceof e))return new e(n,i).getResult();var o=n||(r&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),a=i?h.extend(m,i):m;return this.getBrowser=function(){var e={name:void 0,version:void 0};return p.rgx.call(e,o,a.browser),e.major=h.major(e.version),e},this.getCPU=function(){var e={architecture:void 0};return p.rgx.call(e,o,a.cpu),e},this.getDevice=function(){var e={vendor:void 0,model:void 0,type:void 0};return p.rgx.call(e,o,a.device),e},this.getEngine=function(){var e={name:void 0,version:void 0};return p.rgx.call(e,o,a.engine),e},this.getOS=function(){var e={name:void 0,version:void 0};return p.rgx.call(e,o,a.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return o},this.setUA=function(e){return o=e,this},this};g.VERSION="0.7.17",g.BROWSER={NAME:a,MAJOR:"major",VERSION:u},g.CPU={ARCHITECTURE:"architecture"},g.DEVICE={MODEL:o,VENDOR:c,TYPE:s,CONSOLE:"console",MOBILE:l,SMARTTV:"smarttv",TABLET:d,WEARABLE:"wearable",EMBEDDED:"embedded"},g.ENGINE={NAME:a,VERSION:u},g.OS={NAME:a,VERSION:u},e.exports&&(n=e.exports=g),n.UAParser=g;var v=r&&(r.jQuery||r.Zepto);if("undefined"!==t(v)){var y=new g;v.ua=y.getResult(),v.ua.get=function(){return y.getUA()},v.ua.set=function(e){y.setUA(e);var t=y.getResult();for(var n in t)v.ua[n]=t[n]}}}("object"===("undefined"==typeof window?"undefined":t(window))?window:E)}),O={default:F,__moduleExports:F,UAParser:F.UAParser},N=void 0,H=function(){function e(){n(this,e),this.logLevel=com.ts.mobile.sdk.LogLevel.Error,this.collectionResultsPromise=null,this.internalLogger=new S,this.externalLogger=null,window.__XMSDK_PLUGINS={}}return i(e,[{key:"initialize",value:function(e){var t=this;return new Promise(function(n,r){t.enabledCollectors=e,n(!0)})}},{key:"setLogLevel",value:function(e){this.logLevel=e}},{key:"log",value:function(e,t,n){e<=this.logLevel&&this.internalLogger.log(e,t,n),this.externalLogger&&this.externalLogger.log(e,t,n)}},{key:"readStorageKey",value:function(e){return JSON.parse(C.localStorage.getItem(e)||"{}")}},{key:"writeStorageKey",value:function(e,t){C.localStorage.setItem(e,JSON.stringify(t))}},{key:"deleteStorageKey",value:function(e){C.localStorage.removeItem(e)}},{key:"readSessionStorageKey",value:function(e){return JSON.parse(C.sessionStorage.getItem(e)||"{}")}},{key:"writeSessionStorageKey",value:function(e,t){C.sessionStorage.setItem(e,JSON.stringify(t))}},{key:"deleteSessionStorageKey",value:function(e){C.sessionStorage.removeItem(e)}},{key:"promiseCollectionResult",value:function(){var e=this;return new Promise(function(t,n){var r={location:{allow:e.enabledCollectors.indexOf(com.ts.mobile.sdk.CollectorType.Location)>=0,timeout:4e3,maximumAge:18e4},largeData:e.enabledCollectors.indexOf(com.ts.mobile.sdk.CollectorType.LargeData)>=0},i=new Promise(function(e,t){(function(e){function t(e,t,r,i){n={enabled:e||!1,lat:t,lng:r,error:i}}var n=void 0,r=function(){n=void 0},i=function(r,i){n=void 0;var c=e.location;if(!c.allow)return t(!1),void s(r,i);if(o(navigator.geolocation)||"function"!=typeof navigator.geolocation.getCurrentPosition)return t(!1),void s(r,i);var u=setTimeout(function(){l({code:3})},c.timeout),l=function(e){clearTimeout(u),t(!0,void 0,void 0,a(e.code)),s(r,i)};navigator.geolocation.getCurrentPosition(function(e){clearTimeout(u),t(!0,e.coords.latitude,e.coords.longitude),s(r,i)},l,c)},o=function(e){return null==e},a=function(e){return 1===e?"permission_denied":2===e?"position_unavailable":3===e?"timeout":"unknown"},s=function(e,t){if(!o(N)&&!o(n)){var i={metadata:{timestamp:Date.now()},content:{device_details:c(N,t),location:n}};r(),e(i)}},c=function(e,t){var n={device_id:e.id},r=e.details,i=(new t.UAParser).setUA(navigator.userAgent).getResult();return n.os_type=i.os.name,n.os_version=i.os.version,n.device_model=i.browser.name+" "+i.browser.version,n.device_platform=r.navigator_platform,n.tampered=u(r),n.timezone_offset=r.timezone_offset,n},u=function(e){return e&&(e.has_lied_browser||e.has_lied_language||e.has_lied_os||e.has_lied_resolution)};return(e=e||{}).location=function(e,t){var n={};for(var r in t=t||{},e=e||{})n[r]=e[r];for(var r in t)n[r]=t[r];return n}({allow:!1,timeout:4e3,maximumAge:18e4},e.location),r(),{get:function(e){(function(e,t,n){N?s(e,n):new t.default({excludeUserAgent:!0,excludeScreenResolution:!0,excludeJsFonts:!0,excludeFlashFonts:!0,excludePlugins:!0,excludeColorDepth:!0}).get(function(t,r){for(var i={},o=0,a=(r=r||[]).length;o<a;o++){var c=r[o];i[c.key]=c.value}N={id:t,details:i},s(e,n)})})(e,T,O),i(e,O)}}})(r).get(function(t){e(t)})}),o=new Promise(function(e,t){M(r.largeData).then(function(t){e(t)})});e.collectionResultsPromise=Promise.all([i,o]).then(function(e){var t=Object.assign(e[0],e[1]);return t.toJson=function(){return t},t}),t(e.collectionResultsPromise)})}},{key:"calcHexStringEncodedMd5Hash",value:function(e){return function(e,t,n){return t?n?A(t,e):v(A(t,e)):n?b(e):v(b(e))}(com.ts.mobile.sdk.util.hexToAscii(e))}},{key:"generateRandomHexString",value:function(e){var t=new Uint8Array(e);(window.crypto||window.msCrypto).getRandomValues(t);for(var n="",r=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],i=0;i<t.length;i++)n+=r[15&t[i]];return n}},{key:"queryHostInfo",value:function(e){switch(e){case com.ts.mobile.sdkhost.HostInformationKey.Version:return"4.2.0";case com.ts.mobile.sdkhost.HostInformationKey.Platform:return"web";case com.ts.mobile.sdkhost.HostInformationKey.FingerprintSupported:return"false";case com.ts.mobile.sdkhost.HostInformationKey.HostProvidedFeatures:return"";case com.ts.mobile.sdkhost.HostInformationKey.FaceIdKeyBioProtectionSupported:case com.ts.mobile.sdkhost.HostInformationKey.ImageAcquitisionSupported:return"false";case com.ts.mobile.sdkhost.HostInformationKey.AudioAcquitisionSupported:return"true";case com.ts.mobile.sdkhost.HostInformationKey.PersistentKeysSupported:case com.ts.mobile.sdkhost.HostInformationKey.FidoClientPresent:case com.ts.mobile.sdkhost.HostInformationKey.DyadicPresent:return"false";case com.ts.mobile.sdkhost.HostInformationKey.Fido2ClientPresent:return navigator.credentials&&window.PublicKeyCredential?"true":"false";case com.ts.mobile.sdkhost.HostInformationKey.DeviceStrongAuthenticationSupported:return"false";default:throw new Error("Info key is unsupported: ".concat(e))}}},{key:"setExternalLogger",value:function(e){this.externalLogger=e}},{key:"getCurrentTime",value:function(){return Date.now()}},{key:"createDelayedPromise",value:function(e){return new Promise(function(t){setTimeout(t(e),e)})}},{key:"transformApiPath",value:function(e){var t=e.split("/");return t[0]="mobile"!==t[0]||"device"!==t[1]&&"devices"!==t[1]?t[0]:"web",t[0]="auth"===t[0]?"web":t[0],t[1]="login"===t[1]?"authenticate":t[1],t.join("/")}},{key:"calcHexStringEncodedHmacSha1HashWithHexEncodedKey",value:function(e,t){return this.log(com.ts.mobile.sdk.LogLevel.Error,"not-implemented","calcHexStringEncodedHmacSha1HashWithHexEncodedKey not implemented for tarsus-web"),null}},{key:"generatePbkdf2HmacSha1HexString",value:function(e,t,n,r){return Promise.reject("generatePbkdf2HmacSha1HexString not implemented for tarsus-web")}},{key:"fidoClientXact",value:function(e,t,n,r){return Promise.reject("fidoClientXact not implemented for tarsus-web")}},{key:"fido2CredentialsOp",value:function(e,t,n,r,i){var o,a=this,s=navigator,c=i,u=["NotAllowedError","AbortError"],l=function(e){for(var t=new Int8Array(e),n=Array(t.length),r=0;r<n.length;r++)n[r]=t[r];return n},d=function(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0,i=e.length;r<i;r++)n[r]=e.charCodeAt(r);return t};switch(r){case com.ts.mobile.sdkhost.Fido2CredentialsOpType.Create:"string"==typeof c.publicKey.challenge&&(c.publicKey.challenge=d(c.publicKey.challenge),c.publicKey.user.id=d(c.publicKey.user.id),c.publicKey.excludeCredentials=c.publicKey.excludeCredentials.map(function(e){return e.id=base64js.toByteArray(e.id),e})),o=s.credentials.create(c).then(function(e){return{type:"public-key",id:e.id,rawId:l(e.rawId),response:{attestationObject:l(e.response.attestationObject),clientDataJSON:l(e.response.clientDataJSON)}}});break;case com.ts.mobile.sdkhost.Fido2CredentialsOpType.Get:"string"==typeof c.publicKey.challenge&&(c.publicKey.challenge=d(c.publicKey.challenge),c.publicKey.allowCredentials&&(c.publicKey.allowCredentials=c.publicKey.allowCredentials.map(function(e){return e.id=base64js.toByteArray(e.id),e}))),o=s.credentials.get(c).then(function(e){return{type:"public-key",id:e.id,rawId:l(e.rawId),response:{clientDataJSON:l(e.response.clientDataJSON),authenticatorData:l(e.response.authenticatorData),signature:l(e.response.signature),userHandle:e.response.userHandle&&l(e.response.userHandle)}}})}return o.catch(function(e){throw u.indexOf(e.name)>-1?(a.log(com.ts.mobile.sdk.LogLevel.Debug,"fido2","Received FIDO2 cancellation request from platform; Error: ".concat(e)),new com.ts.mobile.sdk.impl.AuthenticationErrorImpl(com.ts.mobile.sdk.AuthenticationErrorCode.UserCanceled,"Redirection to next policy canceled.")):e})}},{key:"generateKeyPair",value:function(e,t,n,r){return Promise.reject("generateKeyPair not implemented for tarsus-web")}},{key:"getKeyPair",value:function(e,t,n){return this.log(com.ts.mobile.sdk.LogLevel.Error,"not-implemented","getKeyPair not implemented for tarsus-web"),null}},{key:"deleteKeyPair",value:function(e){this.log(com.ts.mobile.sdk.LogLevel.Error,"not-implemented","deleteKeyPair not implemented for tarsus-web")}},{key:"importSymmetricKey",value:function(e,t,n,r){return this.log(com.ts.mobile.sdk.LogLevel.Error,"not-implemented","importSymmetricKey not implemented for tarsus-web"),null}},{key:"calcHexStringEncodedSha256Hash",value:function(e){var t=com.ts.mobile.sdk.util.hexToAscii(e);return sha256(com.ts.mobile.sdk.util.toUTF8Array(t))}},{key:"calcHexStringEncodedSha512Hash",value:function(e){throw this.log(com.ts.mobile.sdk.LogLevel.Error,"not-implemented","calcHexStringEncodedSha512Hash not implemented for tarsus-web"),new Error("Method not implemented.")}},{key:"generateHexSeededKeyPairExternalRepresentation",value:function(e,t){return Promise.reject("Method not implemented.")}},{key:"generateKeyPairExternalRepresentation",value:function(e){return Promise.reject("Method not implemented.")}},{key:"importVolatileKeyPair",value:function(e,t){throw new Error("Method not implemented.")}},{key:"importVolatileSymmetricKey",value:function(e,t){throw new Error("Method not implemented.")}},{key:"loadPlugin",value:function(e){var t=window.__XMSDK_PLUGINS[e];return t?(this.log(com.ts.mobile.sdk.LogLevel.Debug,"plugins","Found defined plugin "+e),Promise.resolve(t)):(this.log(com.ts.mobile.sdk.LogLevel.Error,"plugins","Could not find defined plugin "+e),Promise.reject(new com.ts.mobile.sdk.impl.AuthenticationErrorImpl(com.ts.mobile.sdk.AuthenticationErrorCode.AppImplementation,"Could not find defined plugin "+e)))}},{key:"dyadicRefreshToken",value:function(e){throw new Error("Method not implemented.")}},{key:"dyadicEnroll",value:function(e,t){return Promise.reject("Method not implemented.")}},{key:"dyadicSign",value:function(e){return Promise.reject("Method not implemented.")}},{key:"dyadicDelete",value:function(){return Promise.reject("Method not implemented.")}},{key:"importVolatileKeyPairFromPublicKeyHex",value:function(e,t){throw new Error("Method not implemented.")}}]),e}(),B=com.ts.mobile.sdk.createSdk(),U=new H;B.setTarsusHost(U),B.setTransportProvider(new _(U)),B.setEnabledCollectors([com.ts.mobile.sdk.CollectorType.DeviceDetails,com.ts.mobile.sdk.CollectorType.LargeData]),B.setLogLevel(com.ts.mobile.sdk.LogLevel.Error),e.XmSdk=function(){return B},Object.defineProperty(e,"__esModule",{value:!0})}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("XmSdk")):"function"==typeof define&&define.amd?define("xmui",["exports","XmSdk"],t):t((e=e||self).xmui={},e.xmsdk)}(this,function(e,t){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&function(e,t){(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}(e,t)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function u(e,t,n){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=s(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function l(e,t,n,r,i,o,a){var s=$('<div class="xmuiCore xmuiForm xmuiConfirmationForm">            <div class="xmuiPageHeader">                <div>                    <span class="xmuiConfirmationTitle"></span>                </div>            </div>            <div class="xmuiFullHeightContentBelowPrompt">                <div class="xmuiConfirmationText"/><br/>                <div>                    <button class="xmuiConfirmationContinueButton" type="button"/>                    <button class="xmuiConfirmationCancelButton" type="button"/>                </div>            </div>        </div>');return a.appendElement(s,o),a.setAriaBusy(o),new Promise(function(i,c){s.find(".xmuiConfirmationTitle").text(e),s.find(".xmuiConfirmationText").html(t);var u=s.find(".xmuiConfirmationContinueButton");u.text(n),u.click(function(){s.fadeOut(function(){a.clearContainer(o),i(com.ts.mobile.sdk.ConfirmationInput.create(0))})});var l=s.find(".xmuiConfirmationCancelButton");l.text(r),l.click(function(){s.fadeOut(function(){a.clearContainer(o),i(com.ts.mobile.sdk.ConfirmationInput.create(1))})}),a.unsetAriaBusy(o)})}function d(e,t,n,r,i,o){var a=$('<div class="xmuiCore xmuiForm xmuiInformationForm">            <div class="xmuiPageHeader">                <div>                    <span class="xmuiInformationTitle"</span>                </div>            </div>            <div class="xmuiFullHeightContentBelowPrompt">                <div class="xmuiInformationText"/><br/>                <div>                    <button class="xmuiInformationButton" type="button"/>                </div>            </div>        </div>');return o.appendElement(a,i),o.setAriaBusy(i),new Promise(function(r,s){a.find(".xmuiInformationTitle").text(e),a.find(".xmuiInformationText").html(t);var c=a.find(".xmuiInformationButton");c.text(n),c.click(function(){a.fadeOut(function(){o.clearContainer(i),r(com.ts.mobile.sdk.ConfirmationInput.create(-1))})}),o.unsetAriaBusy(i)})}function h(e){for(var t=e.holder,n=e.option,r=n.matrix,i=n.margin,o=n.radius,a=['<ul class="patt-wrap" style="padding:'+i+'px">'],s=0,c=r[0]*r[1];s<c;s++)a.push('<li class="patt-circ" style="margin:'+i+"px; width : "+2*o+"px; height : "+2*o+"px; -webkit-border-radius: "+o+"px; -moz-border-radius: "+o+"px; border-radius: "+o+'px; "><div class="patt-dots"></div></li>');a.push("</ul>"),t.html(a.join("")).css({width:r[1]*(2*o+2*i)+2*i+"px",height:r[0]*(2*o+2*i)+2*i+"px"}),e.pattCircle=e.holder.find(".patt-circ")}function p(e,t,n,r){var i=t-e,o=r-n;return{length:Math.ceil(Math.sqrt(i*i+o*o)),angle:Math.round(180*Math.atan2(o,i)/Math.PI)}}function f(){}function m(e,t){var r=this,i=r.token=Math.random(),o=S[i]=new f,a=o.holder=$(e);if(0!==a.length){o.object=r;var s={onDraw:_},c=(t=t||{}).matrix;c&&c[0]*c[1]>9&&(s.delimiter=","),t=o.option=$.extend({},m.defaults,s,t),h(o),a.addClass("patt-holder"),"static"==a.css("position")&&a.css("position","relative"),(a.bind||a.on).call(a,"mousedown touchstart",function(e){I.call(this,e,r)});var u=t.mapper;"object"==n(u)?o.mapperFunc=function(e){return u[e]}:o.mapperFunc="function"==typeof u?u:_,o.option.mapper=null}}var g=function(){function e(t,n,i){r(this,e),this.userId=t,this.actionContext=n,this.common=i}return o(e,[{key:"startSession",value:function(e,t){this.clientContext=e,this.actionContext=t,this.common.log("Starting registration promotion action session")}},{key:"endSession",value:function(){this.common.log("Ending registration promotion action session")}},{key:"promptIntroduction",value:function(e,t,n,r){var i=this,o=$('<div class="xmuiCore xmuiForm xmuiRegistationPromotionForm">                <div class="xmuiFullHeightContentBelowPrompt">                    <div class="xmuiPageHeader">                        <div>                            <span></span>                        </div>                    </div>                    <div class="xmuiRegistationPromotionText"/><br/>                    <div>                        <button class="xmuiRegistationPromotionContinueButton" type="button"/>                        <button class="xmuiRegistationPromotionSkipButton" type="button"/>                        <button class="xmuiRegistationPromotionAbortButton" type="button"/>                    </div>                </div>            </div>');return this.common.setAriaBusy(this.clientContext),o.find("span").text(e),o.find(".xmuiRegistationPromotionText").text(t),this.common.appendElement(o,this.clientContext),new Promise(function(e,t){var a=o.find(".xmuiRegistationPromotionContinueButton");a.text(n),a.click(function(){o.fadeOut(function(){i.common.clearContainer(i.clientContext),e(com.ts.mobile.sdk.PromotionInput.createControlResponse(com.ts.mobile.sdk.PromotionControlRequest.Continue))})});var s=o.find(".xmuiRegistationPromotionAbortButton");s.text("Abort"),s.click(function(){o.fadeOut(function(){i.common.clearContainer(i.clientContext),e(com.ts.mobile.sdk.PromotionInput.createControlResponse(com.ts.mobile.sdk.PromotionControlRequest.Abort))})});var c=o.find(".xmuiRegistationPromotionSkipButton");c.text(r),c.click(function(){o.fadeOut(function(){i.common.clearContainer(i.clientContext),e(com.ts.mobile.sdk.PromotionInput.createControlResponse(com.ts.mobile.sdk.PromotionControlRequest.Skip))})}),i.common.unsetAriaBusy(i.clientContext)})}},{key:"setPromotedAuthenticators",value:function(e){return this.common.registrationPromotionMethodSelectionPromise(e,this.clientContext)}}]),e}(),v=function(){function e(t,n,i){r(this,e),this.supportsInlineError=!1,this.title=t,this.username=n,this.common=i}return o(e,[{key:"startSession",value:function(e,t,n,r){this.description=e,this.mode=t,this.actionContext=n,this.clientContext=r,this.common.log("Starting session; session mode: [".concat(this.mode,"], authenticator: [").concat(this.title,"]"))}},{key:"changeSessionModeToRegistrationAfterExpiration",value:function(){this.common.log("Changing session mode to registration after expiration; authenticator: [".concat(this.title,"]")),this.mode=com.ts.mobile.sdk.AuthenticatorSessionMode.Registration,this.authError=null}},{key:"promiseRecoveryForError",value:function(e,t,n){return this.common.log("Starting error recovery; session mode: [".concat(this.mode,"], authenticator: [").concat(this.title,"], error: [").concat(e,"]")),this.supportsInlineError&&n===com.ts.mobile.sdk.AuthenticationErrorRecovery.RetryAuthenticator?(this.authError=e,Promise.resolve(n)):n===com.ts.mobile.sdk.AuthenticationErrorRecovery.Fail?Promise.resolve(n):this.common.promiseRecoveryForError(e,t,n,this.clientContext)}},{key:"endSession",value:function(){this.common.log("Ending session; session mode: [".concat(this.mode,"], authenticator: [").concat(this.title,"]"))}},{key:"promiseInput",value:function(){var e,t=this;switch(this.common.setAriaBusy(this.clientContext),this.mode){case com.ts.mobile.sdk.AuthenticatorSessionMode.Authentication:this.common.log("Fetching authentication input; authenticator: [".concat(this.title,"]")),this.common.unsetAriaBusy(this.clientContext),e=this.promiseAuthInput();break;case com.ts.mobile.sdk.AuthenticatorSessionMode.Registration:this.common.log("Fetching registration input; authenticator: [".concat(this.title,"]")),this.common.unsetAriaBusy(this.clientContext),e=this.promiseRegInput()}return e.then(function(e){return t.common.clearContainer(t.clientContext),e})}}]),e}(),y=function(e){function t(e,n,i){var o;return r(this,t),(o=c(this,s(t).call(this,e,n,i))).supportsInlineError=!0,o}return a(t,v),o(t,[{key:"newForm",value:function(){return $('<div class="xmuiCore xmuiForm xmuiPasswordForm">                <div class="xmuiPrompt"/>                <div class="xmuiFullHeightContentBelowPrompt">                    <form onsubmit="return false">                        <div>                            <input type="password" data-xmui-customstringtext-placeholder="password.inputPlaceholder"/>                        </div>                        <div>                            <button type="submit"/>                        </div>                    </form>                </div>            </div>')}},{key:"promiseAuthInput",value:function(){var e=this,t=this.newForm(),n=t.find("input"),r=t.find("button"),i=t.find(".xmuiPrompt");return this.common.appendElement(t,this.clientContext),new Promise(function(o,a){e.authError?(i.text(e.authError.getMessage()),i.addClass("xmuiPromptError")):i.text(e.common.resolveString("password.prompt")),n.val(""),n.attr("role","textbox").attr("aria-label",e.common.resolveString("aria.enterPassword")),n.focus(),r.text(e.common.resolveString("password.loginButton")),r.click(function(){var e=com.ts.mobile.sdk.PasswordInput.create(n.val().toString());t.fadeOut(function(){o(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(e))})}),e.common.prependPageHeader(t,e.title,o)})}},{key:"promiseRegInput",value:function(){var e=this,t=this.newForm(),n=t.find("input"),r=t.find("button"),i=t.find(".xmuiPrompt");return this.common.appendElement(t,this.clientContext),new Promise(function(o,a){var s,c=function(){if(s===n.val()){var r=com.ts.mobile.sdk.PasswordInput.create(n.val().toString());t.fadeOut(function(){o(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(r))})}else i.text(e.common.resolveString("password.registration.noMatch")),i.addClass("xmuiPromptError"),n.val(""),n.attr("role","alert").attr("aria-label",e.common.resolveString("aria.passwordsDontMatch"))};e.authError?(i.text(e.authError.getMessage()),i.addClass("xmuiPromptError")):i.text(e.common.resolveString("password.registration.prompt")),n.val(""),n.attr("role","textbox").attr("aria-label",e.common.resolveString("aria.enterPassword")),n.focus(),r.text(e.common.resolveString("password.registration.continueButton")),r.click(function(){s=n.val().toString(),i.text(e.common.resolveString("password.registration.promptAgain")),t.removeClass("xmuiPromptError"),n.val(""),n.attr("role","alert").attr("aria-label",e.common.resolveString("aria.enterPasswordAgain")),r.text(e.common.resolveString("password.registration.registerButton")),e.common.reBind(r,c)}),e.common.prependPageHeader(t,e.title,o)})}}]),t}(),b=function(e){function t(e,n,i,o){var a;return r(this,t),(a=c(this,s(t).call(this,e,n,o))).supportsInlineError=!0,a.pinLength=i,a}return a(t,v),o(t,[{key:"newForm",value:function(){return $('<div class="xmuiCore xmuiForm xmuiPinForm">                <div class="xmuiPrompt"/>                <div class="xmuiFullHeightContentBelowPrompt">                    <form onsubmit="return false">                        <input type="number" class="xmuiPinFormElement" data-xmui-customstringtext-placeholder="pin.inputPlaceholder"/>                        <div style="align-items: center;">                            <button class="xmuiLoginButton" type="submit"/>                        </div>                    </form>                </div>            </div>')}},{key:"promiseAuthInput",value:function(){var e=this,t=this.newForm(),n=t.find("input"),r=t.find("button"),i=t.find(".xmuiPrompt");return this.common.appendElement(t,this.clientContext),new Promise(function(o,a){e.authError?(i.text(e.authError.getMessage()),i.addClass("xmuiPromptError")):i.text(e.common.resolveString("pin.prompt")),n.val(""),n.attr("role","textbox").attr("aria-label",e.common.resolveString("aria.enterPin")),r.text(e.common.resolveString("pin.loginButton")),r.click(function(){var r=e.validateNumericOnly(n,i);if(r){var a=com.ts.mobile.sdk.PinInput.create(r);t.fadeOut(function(){o(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(a))})}}),e.common.prependPageHeader(t,e.title,o)})}},{key:"promiseRegInput",value:function(){var e=this,t=this.newForm(),n=t.find("input"),r=t.find("button"),i=t.find(".xmuiPrompt");return this.common.appendElement(t,this.clientContext),new Promise(function(o,a){var s,c=function(){if(s===n.val()){i.removeClass("xmuiPromptError");var r=com.ts.mobile.sdk.PinInput.create(n.val().toString());t.fadeOut(function(){o(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(r))})}else i.text(e.common.resolveString("pin.registration.noMatch")),i.addClass("xmuiPromptError"),n.val(""),n.attr("role","alert").attr("aria-label",e.common.resolveString("aria.pinsDontMatch"))};e.authError?(i.text(e.authError.getMessage()),i.addClass("xmuiPromptError")):i.text(e.common.resolveString("pin.registration.prompt")),n.val(""),n.attr("role","textbox").attr("aria-label",e.common.resolveString("aria.enterPin")),r.text(e.common.resolveString("pin.registration.continueButton")),r.click(function(){var t=e.validateNumericOnly(n,i);t&&(t.length==e.pinLength?(s=t,i.text(e.common.resolveString("pin.registration.promptAgain")),i.removeClass("xmuiPromptError"),n.val(""),n.attr("role","status").attr("aria-label",e.common.resolveString("aria.enterPinAgain")),r.text(e.common.resolveString("pin.registration.registerButton")),e.common.reBind(r,c)):(i.text(e.common.resolveString("pin.registration.badLength").replace("$length",e.pinLength.toString())),i.addClass("xmuiPromptError"),n.val(""),n.attr("role","alert").attr("aria-label",e.common.resolveString("aria.badPinLength").replace("$length",e.pinLength.toString()))))}),e.common.prependPageHeader(t,e.title,o)})}},{key:"validateNumericOnly",value:function(e,t){for(var n=e.val().toString(),r=n.length;r--;)if(-1==="0123456789".indexOf(n.charAt(r)))return e.empty(),t.text(this.common.resolveString("pin.registration.digitsOnly")),t.addClass("xmuiPromptError"),null;return n}}]),t}(),A=window.document,_=function(){},S={},I=function(e,t){e.preventDefault();var n=S[t.token];if(!n.disabled){n.option.patternVisible||n.holder.addClass("patt-hidden");var r="touchstart"==e.type?"touchmove":"mousemove",i="touchstart"==e.type?"touchend":"mouseup",o=$(this);(o.on||o.bind).call(o,r+".pattern-move",function(e){w.call(this,e,t)}),$(A).one(i,function(){k.call(this,e,t)});var a=n.holder.find(".patt-wrap")[0].getBoundingClientRect();n.wrapTop=a.top,n.wrapLeft=a.left,t.reset()}},w=function(e,t){e.preventDefault();var n=e.clientX||e.originalEvent.touches[0].clientX,r=e.clientY||e.originalEvent.touches[0].clientY,i=S[t.token],o=i.option,a=i.pattCircle,s=i.patternAry,c=i.getIdxFromPoint(n,r),u=c.idx,l=i.mapperFunc(u)||u;if(s.length>0){var d=p(i.lineX1,c.x,i.lineY1,c.y);i.line.css({width:d.length+10+"px",transform:"rotate("+d.angle+"deg)"})}if(u&&(o.allowRepeat&&s[s.length-1]!==l||-1===s.indexOf(l))){var h=$(a[u-1]);if(i.lastPosObj)for(var f=i.lastPosObj,m=f.i,g=f.j,v=c.i-f.i>0?1:-1,y=c.j-f.j>0?1:-1,b=Math.abs(c.i-m),A=Math.abs(c.j-g);0===b&&A>1||0===A&&b>1||A==b&&A>1;){m=b?m+v:m,g=A?g+y:g,b=Math.abs(c.i-m),A=Math.abs(c.j-g);var _=(g-1)*o.matrix[1]+m,I=i.mapperFunc(_)||_;(o.allowRepeat||-1==s.indexOf(I))&&(i.addDirectionClass({i:m,j:g}),i.markPoint($(a[I-1]),I),i.addLine({i:m,j:g}))}i.lastPosObj&&i.addDirectionClass(c),i.markPoint(h,l),i.addLine(c),i.lastPosObj=c}},k=function(e,t){e.preventDefault();var n=S[t.token],r=n.option,i=n.patternAry.join(r.delimiter),o=n.holder;(o.off||o.unbind).call(o,".pattern-move").removeClass("patt-hidden"),i&&(r.onDraw(i),n.line.remove(),n.rightPattern&&(i==n.rightPattern?n.onSuccess():(n.onError(),t.error())))};f.prototype={constructor:f,getIdxFromPoint:function(e,t){var n=this.option,r=n.matrix,i=e-this.wrapLeft,o=t-this.wrapTop,a=null,s=n.margin,c=2*n.radius+2*s,u=Math.ceil(i/c),l=Math.ceil(o/c),d=i%c,h=o%c;return u<=r[1]&&l<=r[0]&&d>2*s&&h>2*s&&(a=(l-1)*r[1]+u),{idx:a,i:u,j:l,x:i,y:o}},markPoint:function(e,t){e.addClass("hovered"),this.patternAry.push(t),this.lastElm=e},addLine:function(e){var t=this.patternAry,n=this.option,r=n.lineOnMove,i=n.margin,o=n.radius,a=(e.i-1)*(2*i+2*o)+2*i+o,s=(e.j-1)*(2*i+2*o)+2*i+o;if(t.length>1){var c=p(this.lineX1,a,this.lineY1,s);this.line.css({width:c.length+"px",transform:"rotate("+c.angle+"deg)"}),r||this.line.show()}var u=$('<div class="patt-lines" style="top:'+(s-2)+"px; left:"+(a-2)+'px"></div>');this.line=u,this.lineX1=a,this.lineY1=s,this.holder.append(u),r||this.line.hide()},addDirectionClass:function(e){var t=this.lastElm,n=this.line,r=this.lastPosObj,i=[];e.j-r.j>0?i.push("s"):e.j-r.j<0&&i.push("n"),e.i-r.i>0?i.push("e"):e.i-r.i<0&&i.push("w"),(i=i.join("-"))&&t.add(n).addClass(i+" dir")}},m.prototype={constructor:m,option:function(e,t){var n=S[this.token],r=n.option;if(void 0===t)return r[e];r[e]=t,"margin"!=e&&"matrix"!=e&&"radius"!=e||h(n)},getPattern:function(){var e=S[this.token];return(e.patternAry||[]).join(e.option.delimiter)},setPattern:function(e){var t=S[this.token],n=t.option,r=n.matrix,i=n.margin,o=n.radius;if(n.enableSetPattern){"string"==typeof e&&(e=e.split(n.delimiter)),this.reset(),t.wrapLeft=0,t.wrapTop=0;for(var a=0;a<e.length;a++){var s=e[a]-1,c=s%r[1]*(2*i+2*o)+2*i+o,u=Math.floor(s/r[1])*(2*i+2*o)+2*i+o;w.call(null,{clientX:c,clientY:u,preventDefault:_},this)}}},enable:function(){S[this.token].disabled=!1},disable:function(){S[this.token].disabled=!0},reset:function(){var e=S[this.token];e.pattCircle.removeClass("hovered dir s n w e s-w s-e n-w n-e"),e.holder.find(".patt-lines").remove(),e.patternAry=[],e.lastPosObj=null,e.holder.removeClass("patt-error")},error:function(){S[this.token].holder.addClass("patt-error")},checkForPattern:function(e,t,n){var r=S[this.token];r.rightPattern=e,r.onSuccess=t||_,r.onError=n||_}},m.defaults={matrix:[3,3],margin:20,radius:25,patternVisible:!0,lineOnMove:!0,delimiter:"",enableSetPattern:!1,allowRepeat:!1};var C,E=function(e){function t(e,n,i,o,a){var u;return r(this,t),(u=c(this,s(t).call(this,e,n,a))).supportsInlineError=!0,u.gridWidth=i,u.gridHeight=o,u}return a(t,v),o(t,[{key:"createPatternInputString",value:function(e){var t=this;return e.map(function(e){return"r:"+Math.floor((e-1)/t.gridWidth)+",c:"+(e-1)%t.gridWidth}).join("")}},{key:"promiseAuthInput",value:function(){var e=this,t=$('<div class="xmuiCore xmuiForm xmuiPatternForm">                <div class="xmuiPrompt"/>                <div class="xmuiFullHeightContentBelowPrompt">                    <div class="xmuiPatternControl xmuiAuthPatternControl"/>                </div>            </div>'),n=t.find(".xmuiPrompt");return this.common.appendElement(t,this.clientContext),new Promise(function(r,i){e.authError?(n.text(e.authError.getMessage()),n.addClass("xmuiPromptError")):n.text(e.common.resolveString("pattern.prompt")),new m(".xmuiAuthPatternControl",{matrix:[e.gridHeight,e.gridWidth],onDraw:function(n){var i=JSON.parse("["+n+"]"),o=com.ts.mobile.sdk.PatternInput.create(e.createPatternInputString(i));t.fadeOut(function(){r(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(o))})}}),e.common.prependPageHeader(t,e.title,r)})}},{key:"promiseRegInput",value:function(){var e=this,t=$('<div class="xmuiCore xmuiForm xmuiPatternForm">                <div class="xmuiPrompt"/>                <div class="xmuiFullHeightContentBelowPrompt">                    <div class="xmuiPatternControl xmuiRegPatternControl"/>                    <div>                        <button class="xmuiPatternRegRestartButton" data-xmui-customstringtext="pattern.registerRestartButton"></button>                        <button class="xmuiPatternRegContinueButton" data-xmui-customstringtext="pattern.registerContinueButton"></button>                    </div>                </div>            </div>'),n=t.find(".xmuiPrompt"),r=t.find(".xmuiPatternRegRestartButton"),i=t.find(".xmuiPatternRegContinueButton");return this.common.appendElement(t,this.clientContext),new Promise(function(o,a){var s=function(){u===e.createPatternInputString(l)?t.fadeOut(function(){o(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(com.ts.mobile.sdk.PatternInput.create(u)))}):(d.reset(),i.attr("disabled","true"),n.addClass("xmuiPromptError"),n.text(e.common.resolveString("pattern.registerNoMatchErrorPrompt")))},c=function(){d.reset(),i.attr("disabled","true"),n.removeClass("xmuiPromptError"),n.text(e.common.resolveString("pattern.registerDrawAgainPrompt")),c=s,u=e.createPatternInputString(l)},u=null,l=null,d=new m(".xmuiRegPatternControl",{matrix:[e.gridHeight,e.gridWidth],onDraw:function(e){l=JSON.parse("["+e+"]"),i.removeAttr("disabled")}});e.authError?(n.text(e.authError.getMessage()),n.addClass("xmuiPromptError")):n.text(e.common.resolveString("pattern.registerDrawPrompt")),i.attr("disabled","true"),i.click(function(){l.length<4?(n.addClass("xmuiPromptError"),n.text(e.common.resolveString("pattern.registerTooShortErrorPrompt").replace("$length",4..toString())),d.reset()):c()}),r.click(function(){n.removeClass("xmuiPromptError");var e=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.RetryAuthenticator);o(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(e))}),e.common.prependPageHeader(t,e.title,o)})}}]),t}();!function(e){e[e.TargetSelection=0]="TargetSelection",e[e.CodeInvalidated=1]="CodeInvalidated",e[e.Input=2]="Input"}(C||(C={}));var P,T=function(e){function t(e,n,i,o,a){var u;return r(this,t),(u=c(this,s(t).call(this,e,n,a))).supportsInlineError=!0,u.possibleTargets=i,u.autoExecedTarget=o,u.state=o?C.Input:C.TargetSelection,u}return a(t,v),o(t,[{key:"setAvailableTargets",value:function(e){this.possibleTargets=e}},{key:"setGeneratedOtp",value:function(e,t){this.generatedFormat=e,this.generatedForTarget=t,t||(null!=this.authError&&this.authError.getErrorCode()===com.ts.mobile.sdk.AuthenticationErrorCode.InvalidInput?this.state=C.CodeInvalidated:this.state=C.TargetSelection)}},{key:"promiseOtpInput",value:function(){var e=this,t=$('<div class="xmuiCore xmuiForm xmuiOtpForm">                <div class="xmuiPrompt"/>                <div class="xmuiFullHeightContentBelowPrompt">                    <form onsubmit="return false">                        <input data-xmui-customstringtext-placeholder="otp.inputPlaceholder"/>                        <div style="align-items: center;">                            <button class="xmuiLoginButton" type="submit" data-xmui-customstringtext="otp.loginButton"/><br>                            <button class="xmuiResendButton" type="button" data-xmui-customstringtext="otp.resendButton"/>                        </div>                    </form>                </div>            </div>'),n=t.find("input"),r=t.find(".xmuiLoginButton"),i=t.find(".xmuiResendButton"),o=t.find(".xmuiPrompt");return this.common.appendElement(t,this.clientContext),new Promise(function(a,s){e.authError?(o.text(e.authError.getMessage()),o.addClass("xmuiPromptError")):o.text(e.common.resolveString("otp.prompt")),n.val(""),r.click(function(){t.fadeOut(function(){var e=com.ts.mobile.sdk.OtpInputOtpSubmission.createOtpSubmission(n.val().toString()),t=com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createAuthenticatorInput(e);a(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(t))})}),i.click(function(){t.fadeOut(function(){e.authError=null;var t=com.ts.mobile.sdk.OtpInputRequestResend.createOtpResendRequest(),n=com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createAuthenticatorInput(t);a(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(n))})}),e.common.prependPageHeader(t,e.title,a)})}},{key:"promiseTargetSelectionInput",value:function(e){var t=this,n=$('<div class="xmuiCore xmuiForm xmuiOtpTargetSelectionForm"><div class="xmuiPrompt"/><div class="xmuiOtpTargetSelectionList"></div></div>'),r=n.find(".xmuiPrompt");e?(r.addClass("xmuiPromptError"),r.text(this.common.resolveString("otp.codeInvalidated"))):(r.text(this.common.resolveString("otpTargetSelection.selectTarget")),r.removeClass("xmuiPromptError"));var i=n.find(".xmuiOtpTargetSelectionList");return this.common.appendElement(n,this.clientContext),new Promise(function(e,r){$.each(t.possibleTargets,function(r,o){var a=com.ts.mobile.sdk.OtpChannel[o.getChannel()],s=t.common.resolveString("otpMethodChannel.".concat(a)).replace("$target",o.getDescription()),c=$('<div class="xmuiMenuItem xmuiOtpTargetSelectionItem">').text(s).click(function(){n.fadeOut(function(){t.authError=null,t.state=C.Input;var n=com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createTargetSelectionRequest(o);e(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(n))})});i.append(c)}),t.common.prependPageHeader(n,t.title,e)})}},{key:"promiseAuthInput",value:function(){switch(this.state){case C.TargetSelection:return this.promiseTargetSelectionInput(!1);case C.CodeInvalidated:return this.promiseTargetSelectionInput(!0);case C.Input:return this.promiseOtpInput()}}},{key:"promiseRegInput",value:function(){return Promise.reject("Otp registration unsupported")}}]),t}(),R=function(e){function t(e,n,i){var o;return r(this,t),(o=c(this,s(t).call(this,e,n,i))).supportsInlineError=!0,o}return a(t,v),o(t,[{key:"newForm",value:function(){return $('<div class="xmuiCore xmuiForm xmuiVoiceForm"><div class="xmuiPrompt"/><div class="xmuiFullHeightContentBelowPrompt"><div class="xmuiVoicePassphrase"/><div class="xmuiAudioAnalyzer" hidden style="display:none"><canvas width="120" height="120"/></div><div class="xmuiAudioControls"><button type="button" data-xmui-customstringtext="voice.startButton"/></div></div></div>')}},{key:"promiseAuthInput",value:function(){var e=this,t=this.newForm(),n=t.find(".xmuiVoicePassphrase"),r=t.find("canvas"),i=t.find(".xmuiAudioControls button"),o=t.find(".xmuiAudioAnalyzer"),a=t.find(".xmuiPrompt"),s=null;i.click(function(){i.hide(),o.show(),s.record()}),r.click(function(){s.stop()}),this.common.appendElement(t,this.clientContext);return new Promise(function(o,c){e.authError?(a.text(e.authError.getMessage()),a.addClass("xmuiPromptError")):a.text(e.common.resolveString("voice.prompt")),n.text(e.currentStep.stepDescription.getPassphraseText());var u={vizCanvas:r.get(0)};s||(s=new function(e,t){function n(){if(f){var e=f.width,t=f.height,r=f.getContext("2d");m(r,e,t)}u&&a(n)}var r,i=window.AudioContext||window.webkitAudioContext,o=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia,a=(navigator.cancelAnimationFrame||navigator.webkitCancelAnimationFrame||navigator.mozCancelAnimationFrame,window.requestAnimationFrame||navigator.webkitRequestAnimationFrame||navigator.mozRequestAnimationFrame),s=e||{},c=s.bufferLen||4096,u=!1,l=[],d=[],h=0,p=function(){},f=s.vizCanvas,m=function(e,t,n){var r=new Uint8Array(v.analyserNode.fftSize);v.analyserNode.getByteFrequencyData(r);var i=r[0];e.clearRect(0,0,t,n),e.beginPath(),e.arc(t/2,n/2,i/255*t/2*.8,0,2*Math.PI,!1),e.fillStyle=s.vizPrimaryColor||"#F6D565",e.fill()},g=s.sampleRate||8e3;this.audioContext=new i,this.jsAudioNode=null,r=this.audioContext.sampleRate,this.audioContext.createScriptProcessor?this.jsAudioNode=this.audioContext.createScriptProcessor(c,2,2):this.jsAudioNode=this.audioContext.createJavaScriptNode(c,2,2),this.analyserNode=this.audioContext.createAnalyser(),this.analyserNode.fftSize=1024;var v=this;this.jsAudioNode.onaudioprocess=function(e){u&&(l.push(new Float32Array(e.inputBuffer.getChannelData(0))),d.push(new Float32Array(e.inputBuffer.getChannelData(1))),h+=e.inputBuffer.getChannelData(0).length)};var y={audio:{mandatory:{googEchoCancellation:"false",googAutoGainControl:"false",googNoiseSuppression:"false",googHighpassFilter:"false"},optional:[]}};Object.assign(y,s.userMediaRequest||{}),o.call(navigator,y,function(e){v.setSourceStream(e)},function(e){t(e),v.setError(e)}),this.getPcm16=function(){for(var e=new ArrayBuffer(2*Math.ceil(h/r*g)),t=new DataView(e),n=0,i=0,o=0,a=Math.floor(r/g),s=r-g*a,c=0;o<l.length;){var u=Math.max(-1,Math.min(1,l[o][i]));t.setInt16(n,u<0?32768*u:32767*u,!0),n+=2,i+=a,(c+=s)>=g&&(c-=g,i++),i>=l[o].length&&(i-=l[o].length,o+=1)}return t},this.setOnEndRecording=function(e){p=e},this.record=function(){l=[],d=[],h=0,u=!0,n()},this.stop=function(){u=!1,p(this)},this.isRecording=function(){return u},this.setSourceStream=function(e){var t=this.audioContext.createMediaStreamSource(e);t.connect(this.jsAudioNode),t.connect(this.analyserNode),this.jsAudioNode.connect(this.audioContext.destination)},this.setError=function(e){this.lastError=e},this.isError=function(){return this.lastError},this.getError=this.isError}(u,e.common.log.bind(e.common))),s.setOnEndRecording(function(t){e.common.showProgressForm(e.clientContext);var n=new x({sample:function(e){for(var t="",n=new Uint8Array(e),r=n.byteLength,i=0;i<r;i++)t+=String.fromCharCode(n[i]);return window.btoa(t)}(t.getPcm16().buffer),passphrase_text:e.currentStep.stepDescription.getPassphraseText()});o(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(n))}),i.show(),i.attr("role","Button").attr("aria-label",e.common.resolveString("aria.voiceRecordButton")),t.find(".xmuiAudioAnalyzer").hide(),e.common.prependPageHeader(t,e.title,o),e.common.hideProgressForm(e.clientContext)})}},{key:"promiseRegInput",value:function(){return Promise.reject("Voice registration unsupported")}},{key:"setInputStep",value:function(e,t,n){this.currentStep=new D(e,t,n)}}]),t}(),D=function e(t,n,i){r(this,e),this.stepNumber=t,this.maxStepNumber=n,this.stepDescription=i},x=function(e){function t(e){var n;return r(this,t),(n=c(this,s(t).call(this))).setAcquisitionResponse(e),n}return a(t,com.ts.mobile.sdk.AudioInputResponse),t}(),L=function(e){function t(e,n,i){var o;return r(this,t),(o=c(this,s(t).call(this,e,n,i))).supportsInlineError=!1,o}return a(t,v),o(t,[{key:"newForm",value:function(){return $('<div class="xmuiCore xmuiForm xmuiSecurityQuestionForm"><div class="xmuiPrompt" data-xmui-customstringtext="question.prompt"/><div class="xmuiFullHeightContentBelowPrompt"><div class="xmuiSecurityQuestionList"></div><button class="xmuiSubmitButton" type="submit" data-xmui-customstringtext="question.submitButton"></button></div></div>')}},{key:"startSession",value:function(e,n,r,i){u(s(t.prototype),"startSession",this).call(this,e,n,r,i)}},{key:"promiseRecoveryForError",value:function(e,n,r){var i=this;return this.common.clearContainer(this.clientContext),u(s(t.prototype),"promiseRecoveryForError",this).call(this,e,n,r).finally(function(){i.questionForm=null})}},{key:"promiseInput",value:function(){var e;switch(this.common.setAriaBusy(this.clientContext),this.questionForm||(this.questionForm=this.newForm(),this.common.appendElement(this.questionForm,this.clientContext)),this.mode){case com.ts.mobile.sdk.AuthenticatorSessionMode.Authentication:this.common.log("Fetching authentication input; authenticator: [".concat(this.title,"]")),this.common.unsetAriaBusy(this.clientContext),e=this.promiseAuthInput();break;case com.ts.mobile.sdk.AuthenticatorSessionMode.Registration:this.common.log("Fetching registration input; authenticator: [".concat(this.title,"]")),this.common.unsetAriaBusy(this.clientContext),e=this.promiseRegInput()}return e}},{key:"endSession",value:function(){this.common.clearContainer(this.clientContext)}},{key:"promiseAuthInput",value:function(){return this.promiseQuestionsInput()}},{key:"promiseRegInput",value:function(){return this.promiseQuestionsInput()}},{key:"promiseQuestionsInput",value:function(){var e=this;return new Promise(function(t,n){var r=e;new Promise(function(t,n){e.common.prependPageHeader(e.questionForm,e.title,t)}).then(function(n){e.common.clearContainer(e.clientContext),e.questionForm=null,t(n)}),e.askQuestions(function(e){var n=[];r.currentStep.getSecurityQuestions().forEach(function(t){var r=e[t.getSecurityQuestionId()];r&&n.push(com.ts.mobile.sdk.SecurityQuestionAndAnswer.createAnswerToQuestion(t,com.ts.mobile.sdk.SecurityQuestionAnswer.createWithText(r)))}),r.questionForm.fadeOut(function(){t(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(com.ts.mobile.sdk.SecurityQuestionInputResponse.createSecurityQuestionAnswersInputResponse(n)))})})})}},{key:"setInputStep",value:function(e,t,n){this.currentStep=n}},{key:"askQuestions",value:function(e){var t=this,n=this.questionForm.find(".xmuiSecurityQuestionList"),r=this.currentStep.getMinAnswersNeeded();this.currentStep.getSecurityQuestions().forEach(function(e){n.append($('<div class="xmuiSecurityQuestion">'+"   ".concat(e.getSecurityQuestionText(),"?")+"   <br/>"+'   <input id="xmui_secq_'.concat(e.getSecurityQuestionId(),'" placeholder="Answer here"/>')+"</div>"))});var i=this.questionForm.find(".xmuiSubmitButton");i.click(function(t){i.off("click");var r={};return n.find("input").each(function(e,t){var n=t;r[n.id.substring(10)]=n.value}),n.find("input").toArray().forEach(function(e){$(e).replaceWith($("<span>").text(e.value))}),e(r),!1}),i.attr("disabled","disabled"),this.questionForm.find("input").on("input",function(e){var n=0;t.questionForm.find("input").each(function(e,t){t.value.length>0&&n++}),n>=r?i.removeAttr("disabled"):i.attr("disabled","disabled")}),this.questionForm.fadeIn()}}]),t}();!function(e){e[e.TargetSelection=0]="TargetSelection",e[e.PollingRequested=1]="PollingRequested",e[e.PollingStarted=2]="PollingStarted"}(P||(P={}));var M,F=function(e){function t(e,n,i,o){var a;return r(this,t),(a=c(this,s(t).call(this,e,n,o))).state=P.TargetSelection,a.pollingIntervalMillis=3e3,a.instructions=i,a}return a(t,v),o(t,[{key:"setPollingIntervalInMillis",value:function(e){this.pollingIntervalMillis=e}},{key:"setCreatedApprovalInfo",value:function(e,t){null!=e?(this.createdForTargets=e,this.otp=t,this.state=P.PollingRequested):(this.createdForTargets=null,this.otp=null,this.state=P.TargetSelection,clearTimeout(this.pollingTimer),this.hidePendingUi())}},{key:"setAvailableTargets",value:function(e){this.availableTargets=e}},{key:"endSession",value:function(){clearTimeout(this.pollingTimer),this.common.clearContainer(this.clientContext)}},{key:"promiseInput",value:function(){var e=this;switch(this.mode){case com.ts.mobile.sdk.AuthenticatorSessionMode.Authentication:switch(this.common.setAriaBusy(this.clientContext),this.common.log("Fetching Mobile Approve authentication input;"),this.state){case P.TargetSelection:return this.promiseTargetSelectionInput();case P.PollingRequested:return this.state=P.PollingStarted,this.promisePendingUI().then(function(t){clearTimeout(e.pollingTimer),e.hidePendingUi(),e.currentPollingResolver?(e.currentPollingResolver(t),e.currentPollingResolver=null):e.pendingCancelRequest=t}),this.startPolling();case P.PollingStarted:return this.startPolling();default:return Promise.reject("Illegal state")}case com.ts.mobile.sdk.AuthenticatorSessionMode.Registration:throw new Error("Method not implemented.")}}},{key:"promiseTargetSelectionInput",value:function(){var e=this,t=$('<div class="xmuiCore xmuiForm xmuiMobileAuthSelectDeviceForm">                <div class="xmuiPrompt" data-xmui-customstringtext="mobileAuthDeviceSelection.selectDevices"/>                <div class="xmuiFullHeightContentBelowPrompt xmuiAuthMobileDeviceSelection">                    <div class="xmuiAuthMobileDeviceSelectionList"></div>                    <div style="align-items: center;">                        <button class="xmuiLoginButton" type="submit" data-xmui-customstringtext="mobileAuthDeviceSelection.select"/>                    </div>                </div>            </div>'),n=t.find(".xmuiAuthMobileDeviceSelectionList"),r=t.find(".xmuiLoginButton"),i=t.find(".xmuiPrompt");return this.common.appendElement(t,this.clientContext),new Promise(function(o,a){e.availableTargets.forEach(function(e){var t=e.getDescription(),r=$("<input/>").attr({id:"xmui_device_"+t,name:"xmui_device_"+t,type:"checkbox"}).data("xmui_device_id",e),i=$("<label/>").attr("htmlFor","xmui_device_"+t).text(t).css("font-size","10pt");n.append(r).append(i).append($("<br/>"))}),r.click(function(){var n=[];t.find("input:checkbox:checked").each(function(e,t){n.push($(t).data("xmui_device_id"))}),n.length<=0?(i.text(e.common.resolveString("mobileApprove.deviceSelection.noneError")),i.addClass("xmuiPromptError"),i.attr("role","alert").attr("aria-label",e.common.resolveString("aria.noDeviceSelected"))):t.fadeOut(function(){var e=com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createTargetsSelectionRequest(n);o(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(e))})}),e.common.prependPageHeader(t,e.title,o)}).then(function(t){return e.common.unsetAriaBusy(e.clientContext),e.common.clearContainer(e.clientContext),t})}},{key:"promisePendingUI",value:function(){var e=this,t=$('<div class="xmuiCore xmuiForm xmuiMobileAuthForm" style="display:none;">                <div class="xmuiFullHeightContentBelowPrompt">                    <div class="xmuiHalfHeight">                        <span class="xmuiHalfHeightText" data-xmui-customstringtext="mobileAuth.approvalPending"/>                    </div>                    <div class="xmuiLoginInstructionsLabel"></div>                    <div class="xmuiOtpText" style="display:none;"></div>                    <div>                        <img class="xmuiOtpImg" style="display:none;"/></img>                    </div>                    <div class="xmuiSpinner xmuiInProgress"></div>                </div>            </div>');return new Promise(function(n,r){e.common.appendElement(t,e.clientContext),t.find(".xmuiLoginInstructionsLabel").text(e.instructions),e.updateOtp(),e.common.prependPageHeader(t,e.title,n),e.common.unsetAriaBusy(e.clientContext),t.fadeIn()})}},{key:"updateOtp",value:function(){if(this.otp)switch(this.otp.getFormat().getType()){case com.ts.mobile.sdk.OtpFormatType.Numeric:var e=$(".xmuiMobileAuthForm").find(".xmuiOtpText");e.text(this.otp.getValue()),e.show();break;case com.ts.mobile.sdk.OtpFormatType.QrCode:var t=$(".xmuiMobileAuthForm").find(".xmuiOtpImg");t.attr("src","data:image/jpeg;base64,"+this.otp.getValue()),t.show();break;default:throw this.common.log("Unsupported otp format"),new Error("Unsupported otp format")}}},{key:"hidePendingUi",value:function(){this.common.unsetAriaBusy(this.clientContext),$(".xmuiMobileAuthForm").hide()}},{key:"promiseRecoveryForError",value:function(e,n,r){var i=this;return new Promise(function(o,a){i.hidePendingUi(),o(u(s(t.prototype),"promiseRecoveryForError",i).call(i,e,n,r))})}},{key:"startPolling",value:function(){var e=this;return new Promise(function(t,n){e.updateOtp(),e.pollingTimer=setTimeout(function(){e.currentPollingResolver=null,t(e.pendingCancelRequest?e.pendingCancelRequest:com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createAuthenticatorInput(com.ts.mobile.sdk.MobileApproveInputRequestPolling.createRequestPollingInput())))},e.pollingIntervalMillis),e.currentPollingResolver=t})}},{key:"promiseAuthInput",value:function(){throw new Error("Method not implemented")}},{key:"promiseRegInput",value:function(){throw new Error("Method not implemented")}}]),t}(),O=function(e){function t(e,n,i){return r(this,t),c(this,s(t).call(this,e,n,i))}return a(t,v),o(t,[{key:"setAvailableTargets",value:function(e){this.availableTargets=e}},{key:"setTargetDevices",value:function(e){this.targetDevices=e}},{key:"setChallenge",value:function(e){this.challenge=e}},{key:"promiseAuthInput",value:function(){return this.availableTargets&&!this.targetDevices?this.promiseTargetSelectionInput():this.promiseCodeInput()}},{key:"promiseRecoveryForError",value:function(e,n,r){if(e.getErrorCode()==com.ts.mobile.sdk.AuthenticationErrorCode.InvalidInput&&n.indexOf(com.ts.mobile.sdk.AuthenticationErrorRecovery.RetryAuthenticator)>=0){if(e.getPublicSymbolicProperty(com.ts.mobile.sdk.AuthenticationErrorProperty.AuthenticatorInvalidInputErrorDescription)==com.ts.mobile.sdk.AuthenticationErrorPropertySymbol.AuthenticatorInvalidInputErrorDescriptionTotpIncorrectCheckDigit)return this.common.log("Totp authentication failed due to invalid check-digit, starting recovery"),this.errorTooltip=this.common.resolveString("totp.invalidCheckDigit"),Promise.resolve(com.ts.mobile.sdk.AuthenticationErrorRecovery.RetryAuthenticator);this.errorTooltip=this.common.resolveString("totp.invalidSecret")}return u(s(t.prototype),"promiseRecoveryForError",this).call(this,e,n,r)}},{key:"promiseTargetSelectionInput",value:function(){var e=this,t=$('<div class="xmuiCore xmuiForm xmuiTotpSelectDeviceForm">                <div class="xmuiPrompt" data-xmui-customstringtext="totpDeviceSelection.selectDevices"/>                <div class="xmuiFullHeightContentBelowPrompt xmuiAuthMobileDeviceSelection">                    <div class="xmuiTotpDeviceSelectionList"></div>                    <div style="align-items: center;">                        <button class="xmuiLoginButton" type="submit" data-xmui-customstringtext="mobileAuthDeviceSelection.select"/>                    </div>                </div>            </div>'),n=t.find(".xmuiTotpDeviceSelectionList"),r=t.find(".xmuiLoginButton"),i=t.find(".xmuiPrompt");return this.common.appendElement(t,this.clientContext),new Promise(function(o,a){e.availableTargets.forEach(function(e){var t=e.getDescription(),r=$("<input/>").attr({id:"xmui_device_"+t,name:"xmui_device_"+t,type:"checkbox"}).data("xmui_device_id",e),i=$("<label/>").attr("htmlFor","xmui_device_"+t).text(t).css("font-size","10pt");n.append(r).append(i).append($("<br/>"))}),r.click(function(){var n=[];t.find("input:checkbox:checked").each(function(e,t){n.push($(t).data("xmui_device_id"))}),n.length<=0?(i.text(e.common.resolveString("totp.deviceSelection.noneError")),i.addClass("xmuiPromptError"),i.attr("role","alert").attr("aria-label",e.common.resolveString("aria.noDeviceSelected"))):t.fadeOut(function(){var e=com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createTargetsSelectionRequest(n);o(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(e))})}),e.common.prependPageHeader(t,e.title,o)})}},{key:"promiseCodeInput",value:function(){var e=this,t=$('<div class="xmuiCore xmuiForm xmuiTotpForm"><div class="xmuiErrorTooltip xmuiPromptError"/><div class="xmuiPrompt"/><div class="xmuiFullHeightContentBelowPrompt"><form onsubmit="return false"><div class="xmuiTotpChallenge" style="display:none;"><h5 data-xmui-customstringtext="totp.challengeHeader"></h5></div><div class="xmuiTotpInput"><input data-xmui-customstringtext-placeholder="totp.inputPlaceholder"/></div><div><button class="xmuiLoginButton" type="button" data-xmui-customstringtext="totp.loginButton"/></div></form></div></div>'),n=t.find("input"),r=t.find("button"),i=t.find(".xmuiTotpChallenge");return this.common.appendElement(t,this.clientContext),new Promise(function(o,a){var s;if(e.challenge){switch(e.challenge.getFormat().getType()){case com.ts.mobile.sdk.TotpChallengeFormatType.Numeric:case com.ts.mobile.sdk.TotpChallengeFormatType.AlphaNumeric:var c=$('<div class="xmuiTotpNumericChallenge">');c.text(e.challenge.getValue()),i.append(c);break;case com.ts.mobile.sdk.TotpChallengeFormatType.QrCode:var u=$("<img>");u.attr("src","data:image/jpeg;base64,"+e.challenge.getValue()),i.append($("<div>").append(u))}s=e.common.resolveString("totp.instructionsWithChallenge"),i.show()}else s=e.common.resolveString("totp.instructions");e.errorTooltip&&t.find(".xmuiErrorTooltip").text(e.errorTooltip),t.find(".xmuiPrompt").text(s),n.val(""),r.click(function(){t.fadeOut(function(){var e=com.ts.mobile.sdk.impl.TotpInputCodeSubmissionImpl.createTotpCodeSubmission(n.val().toString()),t=com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createAuthenticatorInput(e);o(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(t))})}),e.common.prependPageHeader(t,e.title,o)})}},{key:"promiseRegInput",value:function(){throw new Error("Method not implemented.")}}]),t}(),N=function(){function e(t){r(this,e),this.pollingIntervalMillis=3e3,this.common=t}return o(e,[{key:"setWaitingTicket",value:function(e){this.ticketWaitInfo=e,this.ui&&this.loadTicketInfoToUi()}},{key:"startSession",value:function(e,t){this.clientContext=t,this.common.setAriaBusy(this.clientContext),this.ui=this.createUi(),this.loadTicketInfoToUi(),this.common.unsetAriaBusy(this.clientContext),this.ui.fadeIn()}},{key:"endSession",value:function(){this.common.clearContainer(this.clientContext),this.ui=null,this.abortPolling()}},{key:"promiseInput",value:function(){var e=this;return new Promise(function(t,n){e.currentInputPromiseResolver=function(n){return e.currentInputPromiseResolver=null,t(n)},e.startPolling()})}},{key:"startPolling",value:function(){var e=this;this.pollingTimer=setTimeout(function(){e.currentInputPromiseResolver&&e.currentInputPromiseResolver(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(com.ts.mobile.sdk.TicketWaitInput.createPollRequest())),e.pollingTimer=null},this.pollingIntervalMillis)}},{key:"abortPolling",value:function(){this.pollingTimer&&(clearTimeout(this.pollingTimer),this.pollingTimer=null)}},{key:"createUi",value:function(){var e=this,t=$('<div class="xmuiCore xmuiForm xmuiMobileAuthForm" style="display:none;">                <div class="xmuiFullHeightContentBelowPrompt">                    <div class="xmuiLoginInstructionsLabel"></div>                    <div class="xmuiTicketText" style="display:none;"></div>                    <div>                        <img class="xmuiTicketImg" style="display:none;"/></img>                    </div>                    <div class="xmuiSpinner xmuiInProgress"></div>                </div>            </div>');return this.common.prependPageHeader(t,"ticketWait",function(t){e.currentInputPromiseResolver(t)}),this.common.appendElement(t,this.clientContext),t}},{key:"loadTicketInfoToUi",value:function(){if(this.ticketWaitInfo){if(this.ticketWaitInfo.getTicketId())try{switch(this.ticketWaitInfo.getTicketId().getFormat()){case com.ts.mobile.sdk.TicketIdFormat.Alphanumeric:var e=this.ui.find(".xmuiTicketText");e.text(this.ticketWaitInfo.getTicketId().getValue()),e.show();break;case com.ts.mobile.sdk.TicketIdFormat.Qr:var t=this.ui.find(".xmuiTicketImg");t.attr("src","data:image/jpeg;base64,"+this.ticketWaitInfo.getTicketId().getValue()),t.show();break;default:throw this.common.log("Unsupported ticket ID format"),new Error("Unsupported ticket ID format")}}catch(e){this.common.log("Error in loadTicketInfoToUi(), not displaying ticket : "+e)}this.ui.find(".xmuiLoginInstructionsLabel").text(this.ticketWaitInfo.getText()),this.ui.find(".xmuiPageHeader span").text(this.ticketWaitInfo.getTitle())}}}]),e}(),H=function(){function e(){r(this,e),this.isLogEnabled=!0}return o(e,[{key:"resolveString",value:function(e){var t={"progress.pleaseWait":"Please wait...","authMenu.title":"Authentication","authMenu.selectAuthenticator":"Please select authentication method:","authMenu.methodTitle":"Authenticate with $method","configMenu.instructions":"Add, edit or remove authenticators","configMenu.title":"Authentication Options","password.inputPlaceholder":"Password","password.loginButton":"Sign In","password.prompt":"Please type your password","password.registration.prompt":"Please type a new password","password.registration.promptAgain":"Please type the new password again","password.registration.noMatch":"Passwords did not match. Try again","password.registration.continueButton":"Continue","password.registration.registerButton":"Confirm","question.prompt":"Please answer the following","question.submitButton":"Submit","otp.prompt":"Input OTP code","otp.codeInvalidated":"The code is no longer valid, please request a new one","otp.inputPlaceholder":"Input code here","otp.loginButton":"Login","otp.resendButton":"Resend OTP","totp.inputPlaceholder":"Input Time-Based Token code","totp.challengeHeader":"Challenge:","totp.loginButton":"Login","totp.instructions":"Please enter generated time-based token code here","totp.instructionsWithChallenge":"Please generate code using below challenge and enter generated code below","totp.invalidSecret":"Incorrect code, please restart code generation","totp.invalidCheckDigit":"Typing error detected - retype code","enroll.prompt":"Please scan the QR code below to bind your device.","enroll.continue":"Continue","mobileAuth.approvalPending":"Approval pending...","mobileAuthDeviceSelection.selectDevices":"Select devices for mobile approve:","mobileAuthDeviceSelection.select":"Select","mobileApprove.deviceSelection.noneError":"No device selected - please select at least one to continue","totpDeviceSelection.selectDevices":"Select devices for Time-Based Token:","totpDeviceSelection.select":"Select","totp.deviceSelection.noneError":"No device selected - please select at least one to continue","mobilePin.authPending":"Authentication pending...","mobilePin.registrationPending":"Waiting for completion of registration on your mobile device.","mobilePin.registrationInstructions":"Please complete registration on your mobile device.","mobilePin.registerPrompt":"Please type your mobile phone number","mobilePin.registerInputPlaceholder":"Mobile phone number","mobilePin.registerSubmitButton":"Register","mobilePin.authTitle":"Login with Clickable SMS","mobilePin.authAskMobilePrompt":"Please input the last 4 digits of your mobile device phone number to login","mobilePin.authAskMobileInputPlaceholder":"","mobilePin.authAskSubmitButton":"Continue","mobilePin.authCfmMobilePrompt":"Confirm login with your mobile device","mobilePin.loginWith":"Login with ******","otpTargetSelection.selectTarget":"Please select how you want us to deliver an OTP to you","error.xmapiError.invalidPassword":"Invalid password provided","error.xmapiError.invalidTotp":"Invalid code provided","error.xmapiError.invalidPattern":"Invalid pattern provided","error.xmapiError.invalidPin":"Invalid PIN provided","error.xmapiError.invalidOtp":"Invalid OTP provided","error.xmapiError.invalidVoice":"Invalid voice provided","error.xmapiError.approvalDenied":"Mobile approval denied","error.xmapiError.approvalExpired":"Mobile approval expired","error.xmapiError.allAuthenticatorsLocked":"All authenticators are locked","error.xmapiError.noRegisteredAuthenticator":"No registered authenticator is available","error.xmapiError.commError":"Protocol error","error.xmapiError.authRejected":"Access was rejected by server","error.xmapiError.authActionError":"Error occured while handling authentication assertion action","error.xmapiError.secretAlreadyUsed":"Secret has already been used","error.xmapiError.notEnoughAnswers":"Must have at least $count answers","error.xmapiError.corsOrInvalidHost":"Destination server is invalid or the server does not support access-control-allow-origin","error.xmapiError.sessionExpired":"Session has expired","methodName.password":"Password","methodName.voice_server":"Voice Passphrase","methodName.otp":"OTP","methodName.totp":"Time-Based Token","methodName.mobile_approve":"Mobile Approve","methodName.mobile_pin":"Clickable SMS","methodName.question":"Memorable Question","methodName.pattern_centralized":"Pattern","methodName.pin_centralized":"Pin","methodName.fido2":"FIDO2","otpMethodChannel.Sms":"SMS $target","otpMethodChannel.Email":"Email $target","otpMethodChannel.VoiceCall":"Voice call $target","otpMethodChannel.PushNotification":"Push Notification to $target","otpMethodChannel.Unknown":"External Provider $target","pattern.prompt":"Draw your pattern below","pattern.registerDrawPrompt":"Please draw a new pattern","pattern.registerDrawAgainPrompt":"Please draw the pattern again to confirm","pattern.registerTooShortErrorPrompt":"Pattern must be at least $length points long","pattern.registerNoMatchErrorPrompt":"Pattern do not match, please try again","pattern.registerRestartButton":"Start Over","pattern.registerContinueButton":"Continue","pin.prompt":"Input Pin code","pin.inputPlaceholder":"Input Pin code","pin.loginButton":"Login","pin.registration.prompt":"Please type a new PIN","pin.registration.promptAgain":"Please type the new PIN again","pin.registration.noMatch":"PINs did not match. Try again","pin.registration.badLength":"PIN should be $length digits long","pin.registration.digitsOnly":"PIN should contain digits only","pin.registration.continueButton":"Continue","pin.registration.registerButton":"Confirm","recoveryMenu.failed":"Authentication failed: $reason","recoveryMenu.locked":"Authenticator locked.","recoveryMenu.title":"Recovery","failureAction.Fail":"Cancel","failureAction.ChangeAuthenticator":"Change Authentication Method","failureAction.SelectAuthenticator":"Select Authentication Method","failureAction.RetryAuthenticator":"Retry","voice.prompt":"Please click the button below and speak the following phrase:","login.cancelButton":"Cancel","cancelMenu.title":"Cancel Action","cancelMenu.instructions":"Are you sure you want to cancel and go back?","cancelMenu.AbortAuthentication":"Yes","cancelMenu.RetryAuthenticator":"Try Again","cancelMenu.ChangeMethod":"Change Authentication Method","cancelMenu.SelectMethod":"Select Authentication Method","unregister.confirmation.title":"Unregister Authenticator","unregister.confirmation.instructions":"Are you sure you want to unregister $method authentication?","unregister.confirmation.summary":"Authenticator $method unregistered.","unregister.confirmation.continue":"Yes","unregister.confirmation.cancel":"Cancel","configMenu.error.title":"Configuration action failed","configMenu.error.continue":"Reload Menu","device.management.remove.title":"Remove Device","device.management.remove.instructions":"Are you sure you want to remove this device?","device.management.remove.summary":"Device $device has been removed","device.management.remove.continue":"Yes","device.management.remove.cancel":"Cancel","device.management.current.remove.instructions":"Please note you are about to remove the currently logged in device, this will terminate the current session, are you sure you want to continue?","user.management.title":"User Management","user.management.cancelButton":"Cancel","newUser.title":"New User","newUser.cancelButton":"Cancel","newUser.remember":"Remember me on this computer","fallbackMenu.instructions":"We have other authentication options you can choose from. If you continue failing you may get locked out so switching to another option is recommended.","fallbackMenu.title":"Having trouble logging in?","fallbackMenu.Fallback":"Switch to authentication with $method","fallbackMenu.AuthMenu":"Choose a different authenticator","fallbackMenu.Retry":"Go back and let me try again","fallbackMenu.Cancel":"Cancel authentication","removeUser.title":"Remove User","removeUser.text":"Are you sure you want to remove user: $user","removeUser.continue":"Yes","removeUser.cancel":"Cancel","promotion.skipButton":"Skip","aria.unregisterMethod":"Unregister $name","aria.reRegisterMethod":"Re-register $name","aria.registerMethod":"Register $name","aria.lockedMethod":"$name is locked","aria.expiredMethod":"$name has expired","aria.defaultMethod":"$name is set as default authentication method","aria.setDefaultMethod":"click to set $name as default authentication method","aria.existingUser":"Select existing user named: $name","aria.deleteExistingUser":"Delete saved user named: $name","aria.newUser":"Add a new user","aria.enterPassword":"Enter a new password","aria.enterPasswordAgain":"Enter new password again","aria.passwordsDontMatch":"Passwords don't match. Try again","aria.voiceRecordButton":"Start recording voice","aria.enterPin":"Enter a new PIN","aria.enterPinAgain":"Enter new PIN again","aria.pinsDontMatch":"Passwords don't match. Try again","aria.badPinLength":"Pin should be $length digits long","aria.noDeviceSelected":"No device selected"};return null!=t[e]?t[e]:e}},{key:"resolveRtStrings",value:function(){var e=this.resolveString;$("[data-xmui-customstringtext]").each(function(t,n){var r=$(n),i=r.attr("data-xmui-customstringtext"),o=e(i);r.text(o)}),["placeholder"].forEach(function(t){var n="data-xmui-customstringtext-"+t;$("["+n+"]").each(function(r,i){var o=$(i),a=o.attr(n),s=e(a);o.attr(t,s)})})}},{key:"reBind",value:function(e,t){(e.off||e.unbind).call(e,"click"),(e.on||e.bind).call(e,"click",t)}},{key:"setAriaBusy",value:function(t){e.getContainer(t).attr("aria-busy","true")}},{key:"unsetAriaBusy",value:function(t){e.getContainer(t).removeAttr("aria-busy")}},{key:"showProgressForm",value:function(t){var n=e.getContainer(t);if(!n.find(".xmuiInProgress").length){var r=$('<div class="xmuiCore xmuiForm xmuiProgressForm" aria-busy="true" role="alert">                    <div class="xmuiSpinner"/>                    <span style="vertical-align:middle" data-xmui-customstringtext="progress.pleaseWait"></span>                </div>');n.append(r),this.resolveRtStrings()}}},{key:"hideProgressForm",value:function(t){e.getContainer(t).find(".xmuiProgressForm").hide()}},{key:"prependPageHeader",value:function(e,t,n){var r=e.find(".xmuiPageHeader");r.length||(r=$('<div class="xmuiPageHeader">                    <div>                        <span></span>                        <button role="button" data-xmui-customstringtext="login.cancelButton"></button>                    </div>                </div>'),e.prepend(r)),r.find("span").text(this.resolveString("methodName.".concat(t))),r.find("button").click(function(){var e=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.CancelAuthenticator);n(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(e))}),this.resolveRtStrings()}},{key:"promiseCancelAction",value:function(e,t){var n=this;e.indexOf(com.ts.mobile.sdk.ControlRequestType.ChangeMethod)>=0&&e.indexOf(com.ts.mobile.sdk.ControlRequestType.SelectMethod)>=0&&(e=e.filter(function(e){return e!=com.ts.mobile.sdk.ControlRequestType.ChangeMethod}));var r=e.map(function(e){var t=com.ts.mobile.sdk.ControlRequestType[e],r=com.ts.mobile.sdk.ControlRequest.create(e);return{classes:["xmuiCancelActionMenuItem","xmuiCancelMenu_"+t],title:n.resolveString("cancelMenu."+t),resp:r}});return this.promiseMenuInput(r,this.resolveString("cancelMenu.title"),this.resolveString("cancelMenu.instructions"),t).then(function(e){return e.resp})}},{key:"loadForms",value:function(e){var t=$('<div class="xmuiLoginTiles">');this.allFormElements.forEach(function(e){e.appendTo(t)}),t.appendTo(e),this.resolveRtStrings()}},{key:"resolveMethodTitle",value:function(e){return e.getAuthenticatorId().startsWith("placeholder_")?e.getName():this.resolveString("methodName."+e.getAuthenticatorId())}},{key:"resolveMethodAuthenticateTitle",value:function(e){return this.resolveString("authMenu.methodTitle").replace("$method",this.resolveMethodTitle(e))}},{key:"clearContainer",value:function(t){var n=e.getContainer(t),r=n.html();return n.empty(),r}},{key:"restoreContainer",value:function(t,n){e.getContainer(t).html(n)}},{key:"appendElement",value:function(t,n){e.getContainer(n).append(t),this.resolveRtStrings()}},{key:"promiseMenuInput",value:function(e,t,n,r,i,o,a,s){var c=this,u=$('<div class="xmuiCore xmuiForm xmuiMenuForm" role="dialog" aria-labelledby="xmuiMenuTitle" aria-describedby="xmuiMenuInstructions" aria-hidden="true">                <div class="xmuiPageHeader">                    <div>                        <span id="xmuiMenuTitle"></span>                        <button></button>                    </div>                </div>                <h1 id="xmuiMenuInstructions" class="xmuiPrompt"/>                <div class="xmuiFullHeightContentBelowPrompt">                    <div class="xmuiMenuItems" role="menu"></div>                </div>            </div>'),l=u.find(".xmuiPageHeader"),d=l.find("span"),h=l.find("button"),p=u.find(".xmuiPrompt");return u.attr("aria-hidden","false"),this.appendElement(u,r),new Promise(function(l,f){u.find(".xmuiMenuItems").empty(),i?(p.text(i),p.addClass("xmuiPromptError")):(p.text(n),p.removeClass("xmuiPromptError")),d.text(t);var m=0;e.forEach(function(e){var t=$('<div class="xmuiMenuItem xmuiAuthenticatorMenuItem">'),n=$('<span class="xmuiMethodMenuItemText" role="button"></span>');n.text(e.title),t.append(n),e.classes.forEach(function(e){t.addClass(e)}),m+=1,n.attr("tabindex",m),e.disabled?function(e,t){e.addClass("xmuiMenuItemDisabled"),t.attr("aria-disabled","true")}(t,n):(n.attr("aria-label",o?c.resolveString("aria.setDefaultMethod").replace("$name",e.title):e.title),n.click(function(){u.attr("aria-hidden","true"),u.fadeOut(function(){c.clearContainer(r),l(o?{authenticator:e.authenticator,action:M.SetDefault}:e)})})),e.annunciators&&(t=function(e,t,n,i){var a=function(e,t,n,r,i){e.attr("aria-label",c.resolveString(n).replace("$name",t)),e.attr("role",r),e.attr("tabindex",i)},s=e.annunciators||[],l=$("<div>").addClass("xmuiMenuItemAnnunciators").appendTo(t);return s.forEach(function(t){var s=$("<div>").addClass("xmuiMenuItemAnnunciator").addClass(t);o&&function(e,t,n,i,o){var s={authenticator:e.authenticator};switch(t){case"xmuiMethodMenuAnnUnregister":s.action=M.Unregister,a(n,e.title,"aria.unregisterMethod","Button",i);break;case"xmuiMethodMenuAnnReRegister":s.action=M.Reregister,a(n,e.title,"aria.reRegisterMethod","Button",i);break;case"xmuiMehtodMenuAnnRegister":s.action=M.Register,a(n,e.title,"aria.registerMethod","Button",i);break;case"xmuiMethodMenuAnnLocked":a(n,e.title,"aria.lockedMethod","status",i);break;case"xmuiMehtodMenuAnnExpired":a(n,e.title,"aria.expiredMethod","status",i);break;case"xmuiMethodMenuAnnDefault":a(n,e.title,"aria.defaultMethod","status",i)}s.action&&n.click(function(){u.attr("aria-hidden","true"),u.fadeOut(function(){c.clearContainer(r),o(s)})})}(e,t,s,n,i),s.html("&nbsp;"),l.append(s)}),t}(e,t,m,l)),u.find(".xmuiMenuItems").append(t)}),a?(h.text(s||c.resolveString("login.cancelButton")),h.click(function(){u.attr("aria-hidden","true"),c.clearContainer(r),l({abortSelection:!0})})):h.hide(),c.unsetAriaBusy(r)})}},{key:"promiseRecoveryForError",value:function(e,t,n,r){var i=this,o=e.getMessage(),a=e.getData();a&&a.additional_data&&a.additional_data.locked&&(o="Authenticator locked: ".concat(o)),t.indexOf(com.ts.mobile.sdk.AuthenticationErrorRecovery.ChangeAuthenticator)>=0&&t.indexOf(com.ts.mobile.sdk.AuthenticationErrorRecovery.SelectAuthenticator)>=0&&(t=t.filter(function(e){return e!=com.ts.mobile.sdk.AuthenticationErrorRecovery.ChangeAuthenticator}));var s=t.map(function(e){var t=com.ts.mobile.sdk.AuthenticationErrorRecovery[e];return{classes:["xmuiAuthRecoveryMenuItem","xmuiRecoveryMenu_"+t],title:i.resolveString("failureAction."+t),resp:e}});return this.promiseMenuInput(s,this.resolveString("recoveryMenu.title"),null,r,o).then(function(e){return e.resp})}},{key:"methodMenuPromise",value:function(e,t){var n=this;return new Promise(function(r,i){var o=e.map(function(e){var t=e.getAuthenticator();return{disabled:!t.getEnabled()||t.getLocked()||!t.getRegistered(),classes:["xmuiMethodMenuItem","xmuiMethodMenu_"+t.getType()],annunciators:function(e){var t=[];return e.getDefaultAuthenticator()&&t.push("xmuiMethodMenuAnnDefault"),e.getLocked()&&t.push("xmuiMethodMenuAnnLocked"),t}(t),title:n.resolveMethodAuthenticateTitle(t),method:t}});return n.promiseMenuInput(o,n.resolveString("authMenu.title"),n.resolveString("authMenu.selectAuthenticator"),t,null,!1,!0).then(function(e){r(e.abortSelection?com.ts.mobile.sdk.AuthenticatorSelectionResult.createAbortRequest():com.ts.mobile.sdk.AuthenticatorSelectionResult.createSelectionRequest(e.method))})})}},{key:"registrationPromotionMethodSelectionPromise",value:function(e,t){var n=this,r=e.map(function(e){return{classes:["xmuiMethodMenuItem","xmuiMethodMenu_"+e.getType()],title:n.resolveMethodTitle(e),method:e}});return this.promiseMenuInput(r,this.resolveString("authMenu.title"),this.resolveString("authMenu.selectAuthenticator"),t,null,!1,!0,this.resolveString("promotion.skipButton")).then(function(e){return e.abortSelection?com.ts.mobile.sdk.PromotionInput.createControlResponse(com.ts.mobile.sdk.PromotionControlRequest.Skip):com.ts.mobile.sdk.PromotionInput.createAuthenticatorDescription(e.method)})}},{key:"methodFallbackPromise",value:function(e,t,n){var r=this,i=e.map(function(e){var n=r.resolveString("fallbackMenu."+com.ts.mobile.sdk.AuthenticatorFallbackAction[e]);if(e===com.ts.mobile.sdk.AuthenticatorFallbackAction.Fallback){if(!t)throw new Error("Fallback is an option for fallback but no fallback authenticator is defined on action");n=n.replace("$method",t.getName())}return{classes:["xmuiFallbackOptionsMenuItem","xmuiFallbackMenu_"+com.ts.mobile.sdk.AuthenticatorFallbackAction[e]],title:n,resp:e}});return this.promiseMenuInput(i,this.resolveString("fallbackMenu.title"),this.resolveString("fallbackMenu.instructions"),n).then(function(e){return e.resp})}},{key:"configurationSession",value:function(e){var t=this;return new(function(){function e(t){r(this,e),this.common=t}return o(e,[{key:"setAuthenticatorsList",value:function(e){var n=this,r=e.map(function(e){var n=e.getDescription();return{method:n,title:t.resolveMethodTitle(n),classes:["xmuiMethodMenuItem","xmuiMethodMenu_"+n.getAuthenticatorId()],annunciators:function(e,t){var n=[];return e.getDefaultAuthenticator()&&n.push("xmuiMethodMenuAnnDefault"),e.getLocked()&&n.push("xmuiMethodMenuAnnLocked"),e.getRegistered()?(t.indexOf(com.ts.mobile.sdk.AuthenticatorConfigurationAction.Reregister)>-1&&n.push("xmuiMethodMenuAnnReRegister"),t.indexOf(com.ts.mobile.sdk.AuthenticatorConfigurationAction.Unregister)>-1&&n.push("xmuiMethodMenuAnnUnregister")):t.indexOf(com.ts.mobile.sdk.AuthenticatorConfigurationAction.Register)>-1&&n.push("xmuiMehtodMenuAnnRegister"),e.getExpired()&&n.push("xmuiMehtodMenuAnnExpired"),n}(n,e.getAvailableActions()),authenticator:e}});t.promiseMenuInput(r,t.resolveString("configMenu.title"),t.resolveString("configMenu.instructions"),this.clientContext,null,!0).then(function(e){if(!e.abortSelection){var r;switch(e.action){case M.SetDefault:r=n.authentiocationConfigurationSessionServices.setDefaultAuthenticator(e.authenticator);break;case M.Register:r=n.authentiocationConfigurationSessionServices.registerAuthenticator(e.authenticator,n.clientContext).then(function(){n.authentiocationConfigurationSessionServices.setDefaultAuthenticator(e.authenticator)});break;case M.Reregister:r=n.authentiocationConfigurationSessionServices.reregisterAuthenticator(e.authenticator,n.clientContext).then(function(){n.authentiocationConfigurationSessionServices.setDefaultAuthenticator(e.authenticator)});break;case M.Unregister:r=l(n.common.resolveString("unregister.confirmation.title"),n.common.resolveString("unregister.confirmation.instructions").replace("$method",n.common.resolveMethodTitle(e.authenticator.getDescription())),n.common.resolveString("unregister.confirmation.continue"),n.common.resolveString("unregister.confirmation.cancel"),n.actionContext,n.clientContext,t).then(function(t){return 0===t.getUserChoice()?n.authentiocationConfigurationSessionServices.unregisterAuthenticator(e.authenticator,n.clientContext):Promise.resolve(!0)})}return r.then(function(){t.clearContainer(n.clientContext),n.authentiocationConfigurationSessionServices.requestRefreshAuthenticators()})}n.authentiocationConfigurationSessionServices.finishSession()}).catch(function(e){d(n.common.resolveString("configMenu.error.title"),e.getMessage(),n.common.resolveString("configMenu.error.continue"),n.actionContext,n.clientContext,t).then(function(t){-1===t.getUserChoice()&&(e.getErrorCode()==com.ts.mobile.sdk.AuthenticationErrorCode.PolicyRejection?(n.authentiocationConfigurationSessionServices.finishSession(),window.location.reload()):n.authentiocationConfigurationSessionServices.requestRefreshAuthenticators())})})}},{key:"startSession",value:function(e,n,r){this.authentiocationConfigurationSessionServices=e,this.actionContext=n,this.clientContext=r,t.log("Starting configuration session")}},{key:"endSession",value:function(){t.log("Ending configuration session")}}]),e}())(this)}},{key:"deviceManagementPromise",value:function(e,t){var n=this,r=$('<div class="xmuiCore xmuiForm xmuiMenuForm" role="dialog" aria-labelledby="xmuiMenuTitle" aria-describedby="xmuiMenuInstructions" aria-hidden="false">                <div class="xmuiPageHeader">                    <div>                        <span id="xmuiMenuTitle">Device Management</span>                    </div>                </div>                <h1 id="xmuiMenuInstructions" class="xmuiPrompt">Name, Remove and view device details</h1>                <div class="xmuiFullHeightContentBelowPrompt">                    <div class="xmuiMenuItems" role="menu"></div>                </div>            </div>'),i=0;return this.appendElement(r,t),new Promise(function(o,a){e.forEach(function(e){var a=$('<div class="xmuiDeviceItemBackground xmuiDeviceInfoItem">'),s=function(){return $('<span class="xmuiMethodMenuItemText" role="button"></span>')},c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return $('<div class="xmuiDeviceAction" tabindex="'.concat(e,'">&nbsp</div>'))},u=function(e){return new Date(e).toISOString().split("T")[0]},l=e.getInfo();a.append(s().addClass("xmuiDeviceInfoMain").text(l.getName())),a.append(s().addClass("xmuiDeviceInfoSecondary").text("Last access: ".concat(u(l.getLastAccess())))),a.append(s().addClass("xmuiDeviceInfoSecondary").text("Registered at: ".concat(u(l.getRegistered()))));var d=$('<div class="xmuiDeviceItemActions">');l.getIsCurrent()&&d.append($('<span class="xmuiDeviceActive">current</span>'));var h=c(i).addClass("xmuiDeviceItemRemove").click(function(){r.fadeOut(function(){n.clearContainer(t),o({action:com.ts.mobile.sdk.DeviceManagementAction.Remove,device:e})})}),p=c(i).addClass("xmuiDeviceItemRename").click(function(){r.fadeOut(function(){n.clearContainer(t),o({action:com.ts.mobile.sdk.DeviceManagementAction.Rename,device:e})})});d.append(h),d.append(p),a.append(d),a.attr("tabindex",i),i+=1,r.find(".xmuiMenuItems").append(a)})})}},{key:"deviceRename",value:function(e,t){var n=this,r=$('<div class="xmuiCore xmuiForm xmuiConfirmationForm">                <div class="xmuiPageHeader">                    <div>                        <span class="xmuiConfirmationTitle">Rename Device</span>                    </div>                </div>                <div class="xmuiFullHeightContentBelowPrompt">                    <div class="xmuiConfirmationText"/>Please enter new device name<br/>                    <div>                        <input class="xmuiDeviceName" type="text" placeholder="New device name"/><br/>                        <button class="xmuiConfirmationContinueButton" type="button">Save</button>                        <button class="xmuiConfirmationCancelButton" type="button">Cancel</button>                    </div>                </div>            </div>');return this.appendElement(r,t),this.setAriaBusy(t),new Promise(function(e,i){r.find(".xmuiConfirmationContinueButton").click(function(){r.fadeOut(function(){n.clearContainer(t);var i=r.find(".xmuiDeviceName").val();e({save:!0,newDeviceName:i})})}),r.find(".xmuiConfirmationCancelButton").click(function(){r.fadeOut(function(){n.clearContainer(t),e({save:!1})})}),n.unsetAriaBusy(t)})}},{key:"deviceManagementSession",value:function(e){var t=this;return new(function(){function e(t){r(this,e),this.common=t}return o(e,[{key:"setSessionDevicesList",value:function(e){this.devices=e}},{key:"viewDevices",value:function(){var e,n=this;t.deviceManagementPromise(this.devices,this.clientContext).then(function(r){switch(r.action){case com.ts.mobile.sdk.DeviceManagementAction.Remove:var i=r.device.getInfo().getIsCurrent(),o=i?o=n.common.resolveString("device.management.current.remove.instructions"):n.common.resolveString("device.management.remove.instructions").replace("$device",r.device.getInfo().getName());e=l(n.common.resolveString("device.management.remove.title"),o,n.common.resolveString("device.management.remove.continue"),n.common.resolveString("device.management.remove.cancel"),n.actionContext,n.clientContext,t).then(function(e){return 0===e.getUserChoice()?i?n.deviceManagementSessionService.removeCurrentDeviceAndFinishSession(n.clientContext):n.deviceManagementSessionService.removeDevice(r.device,n.clientContext):Promise.resolve(!0)});break;case com.ts.mobile.sdk.DeviceManagementAction.Rename:e=t.deviceRename(r.device,n.clientContext).then(function(e){return e.save?n.deviceManagementSessionService.renameDevice(r.device,e.newDeviceName,n.clientContext):Promise.resolve(!0)})}return e.then(function(){t.clearContainer(n.clientContext),n.deviceManagementSessionService.requestRefreshDevices().then(function(){return n.viewDevices()})})}).catch(function(e){d(n.common.resolveString("configMenu.error.title"),e.getMessage(),n.common.resolveString("configMenu.error.continue"),n.actionContext,n.clientContext,t).then(function(t){-1===t.getUserChoice()&&(e.getErrorCode()==com.ts.mobile.sdk.AuthenticationErrorCode.PolicyRejection?(n.deviceManagementSessionService.finishSession(),window.location.reload()):n.deviceManagementSessionService.requestRefreshDevices().then(function(){return n.viewDevices()}))})})}},{key:"startSession",value:function(e,t,n){this.deviceManagementSessionService=e,this.actionContext=t,this.clientContext=n,this.viewDevices()}},{key:"endSession",value:function(){t.log("Ending device management session")}}]),e}())(this)}},{key:"setLogEnabled",value:function(e){this.isLogEnabled=e}},{key:"log",value:function(e){this.isLogEnabled&&console.log(e)}}],[{key:"getContainer",value:function(e){var t;return t=e&&e.uiContainer?e.uiContainer:$("#transmitContainer").length?$("#transmitContainer").first():$(document.documentElement).append($('<div id="transmitContainer" style="position: absolute; left: 0; top: 0;"></div>')),(t=$(t)).attr("aria-live","assertive"),t}}]),e}();!function(e){e[e.SetDefault=0]="SetDefault",e[e.Register=1]="Register",e[e.Reregister=2]="Reregister",e[e.Unregister=3]="Unregister"}(M||(M={}));var B=function(){function e(){r(this,e),this.common=new H}return o(e,[{key:"startActivityIndicator",value:function(e,t){this.common.showProgressForm(t)}},{key:"endActivityIndicator",value:function(e,t){this.common.hideProgressForm(t)}},{key:"controlFlowCancelled",value:function(e){this.common.log("Control flow cancelled"),this.common.clearContainer(e)}},{key:"controlFlowStarting",value:function(e){this.common.log("Control flow started")}},{key:"controlFlowEnded",value:function(e,t){var n=e?" with error: ".concat(e):"";this.common.log("Control flow ended"+n)}},{key:"controlFlowActionStarting",value:function(e,t){this.common.log("Control flow action starting")}},{key:"controlFlowActionEnded",value:function(e,t,n){this.common.log("Control flow action starting")}},{key:"handleAuthenticatorUnregistration",value:function(e,t,n,r){return Promise.resolve(com.ts.mobile.sdk.UnregistrationInput.create(0))}},{key:"selectAuthenticator",value:function(e,t,n){return this.common.methodMenuPromise(e,n)}},{key:"selectAuthenticatorFallbackAction",value:function(e,t,n,r,i){return this.common.methodFallbackPromise(e,t,i)}},{key:"controlOptionForCancellationRequestInSession",value:function(e,t){return this.common.promiseCancelAction(e,t.clientContext)}},{key:"createPasswordAuthSession",value:function(e,t){return new y(e,t,this.common)}},{key:"createPinAuthSession",value:function(e,t,n){return new b(e,t,n,this.common)}},{key:"createPatternAuthSession",value:function(e,t,n,r){return new E(e,t,n,r,this.common)}},{key:"createOtpAuthSession",value:function(e,t,n,r){return new T(e,t,n,r,this.common)}},{key:"createVoiceAuthSession",value:function(e,t){return new R(e,t,this.common)}},{key:"createSecurityQuestionAuthSession",value:function(e,t){return new L(e,t,this.common)}},{key:"createPlaceholderAuthSession",value:function(e,t,n,r,i,o){throw new Error("Method not implemented by demo application.")}},{key:"getConfirmationInput",value:function(e,t,n,r,i,o){return l(e,t,n,r,0,o,this.common)}},{key:"getInformationResponse",value:function(e,t,n,r,i){return d(e,t,n,0,i,this.common)}},{key:"createMobileApproveAuthSession",value:function(e,t,n){return new F(e,t,n,this.common)}},{key:"createTicketWaitSession",value:function(e,t){return new N(this.common)}},{key:"createTotpAuthSession",value:function(e,t){return new O(e,t,this.common)}},{key:"createFormSession",value:function(e,t){throw new Error("Method not implemented by demo application.")}},{key:"createAuthenticationConfigurationSession",value:function(e){return this.common.configurationSession(e)}},{key:"createRegistrationPromotionSession",value:function(e,t){return new g(e,t,this.common)}},{key:"processJsonData",value:function(e,t,n){throw new Error("Method not implemented by demo application.")}},{key:"createDeviceStrongAuthenticatorAuthSession",value:function(e,t){throw new Error("Method not implemented.")}},{key:"handlePolicyRejection",value:function(e,t,n,r,i,o){return e||t||n?function(e,t,n,r,i){var o=$('<div class="xmuiCore xmuiForm xmuiRejectionForm">            <div class="xmuiPageHeader">                <div>                    <span class="xmuiRejectionTitle"</span>                </div>            </div>            <div class="xmuiFullHeightContentBelowPrompt">                <div class="xmuiRejectionText"/>                <div class="xmuiRejectionData"/>                <div>                    <button class="xmuiRejectionButton" type="button"/>                </div>            </div>        </div>');return i.appendElement(o,r),i.setAriaBusy(r),new Promise(function(a,s){o.find(".xmuiRejectionTitle").text(e),o.find(".xmuiRejectionText").text(t);var c=o.find(".xmuiRejectionButton");c.text(n),c.click(function(){o.fadeOut(function(){i.clearContainer(r),a(com.ts.mobile.sdk.ConfirmationInput.create(-1))})}),i.unsetAriaBusy(r)})}(e,t,n,o,this.common):Promise.resolve(com.ts.mobile.sdk.ConfirmationInput.create(-1))}},{key:"handlePolicyRedirect",value:function(e,t,n,r,i){return this.common.log("Policy redirection requested. redirecting to policy: [".concat(t,"] with additionalParameters: [").concat(r,"]")),Promise.resolve(com.ts.mobile.sdk.RedirectInput.create(com.ts.mobile.sdk.RedirectResponseType.RedirectToPolicy))}},{key:"shouldIncludeDisabledAuthenticatorsInMenu",value:function(e,t){return!0}},{key:"createScanQrSession",value:function(e,t){throw new Error("Method not implemented.")}},{key:"createFingerprintAuthSession",value:function(e,t){throw new Error("Method not implemented.")}},{key:"createApprovalsSession",value:function(e){throw new Error("Method not implemented.")}},{key:"createTotpGenerationSession",value:function(e,t){throw new Error("Method not implemented.")}},{key:"createDeviceManagementSession",value:function(e){return this.common.log("Starting device management session"),this.common.deviceManagementSession(e)}},{key:"createNativeFaceAuthSession",value:function(e,t){throw new Error("Method not implemented.")}},{key:"createFaceAuthSession",value:function(e,t){throw new Error("Method not implemented.")}},{key:"localAuthenticatorInvalidated",value:function(e){throw new Error("Method not implemented.")}},{key:"setLogEnabled",value:function(e){this.common.setLogEnabled(e)}}],[{key:"getContainer",value:function(e){return H.getContainer(e)}}]),e}(),U=new B,q=t;q.XmSdk().setUiHandler(U),Object.isExtensible(q)&&(q.XmUIHandler=B),e.XmUIHandler=B,Object.defineProperty(e,"__esModule",{value:!0})}),define("transmitSDK",["xmsdk","xmui"],function(e,t){}),angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.transition","ui.bootstrap.collapse","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.bindHtml","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.position","ui.bootstrap.datepicker","ui.bootstrap.dropdown","ui.bootstrap.modal","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]),angular.module("ui.bootstrap.tpls",["template/accordion/accordion-group.html","template/accordion/accordion.html","template/alert/alert.html","template/carousel/carousel.html","template/carousel/slide.html","template/datepicker/datepicker.html","template/datepicker/day.html","template/datepicker/month.html","template/datepicker/popup.html","template/datepicker/year.html","template/popmoneydatepicker/datepicker.html","template/popmoneydatepicker/day.html","template/popmoneydatepicker/month.html","template/popmoneydatepicker/popup.html","template/popmoneydatepicker/year.html","template/modal/backdrop.html","template/modal/window.html","template/pagination/pager.html","template/pagination/pagination.html","template/tooltip/tooltip-html-unsafe-popup.html","template/tooltip/tooltip-popup.html","template/popover/popover.html","template/progressbar/bar.html","template/progressbar/progress.html","template/progressbar/progressbar.html","template/rating/rating.html","template/tabs/tab.html","template/tabs/tabset.html","template/timepicker/timepicker.html","template/typeahead/typeahead-match.html","template/typeahead/typeahead-popup.html"]),angular.module("ui.bootstrap.transition",[]).factory("$transition",["$q","$timeout","$rootScope",function(e,t,n){var r=function(i,o,a){a=a||{};var s=e.defer(),c=r[a.animation?"animationEndEventName":"transitionEndEventName"],u=function(e){n.$apply(function(){i.unbind(c,u),s.resolve(i)})};return c&&i.bind(c,u),t(function(){angular.isString(o)?i.addClass(o):angular.isFunction(o)?o(i):angular.isObject(o)&&i.css(o),c||s.resolve(i)}),s.promise.cancel=function(){c&&i.unbind(c,u),s.reject("Transition cancelled")},s.promise},i=document.createElement("trans");function o(e){for(var t in e)if(void 0!==i.style[t])return e[t]}return r.transitionEndEventName=o({WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}),r.animationEndEventName=o({WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"}),r}]),angular.module("ui.bootstrap.collapse",["ui.bootstrap.transition"]).directive("collapse",["$transition",function(e){return{link:function(t,n,r){var i,o=!0;function a(t){var r=e(n,t);return i&&i.cancel(),i=r,r.then(o,o),r;function o(){i===r&&(i=void 0)}}function s(){n.removeClass("collapsing"),n.addClass("collapse in"),n.css({height:"auto"})}function c(){n.removeClass("collapsing"),n.addClass("collapse")}t.$watch(r.collapse,function(e){e?o?(o=!1,c(),n.css({height:0})):(n.css({height:n[0].scrollHeight+"px"}),n[0].offsetWidth,n.removeClass("collapse in").addClass("collapsing"),a({height:0}).then(c)):o?(o=!1,s()):(n.removeClass("collapse").addClass("collapsing"),a({height:"auto"}).then(s))})}}}]),angular.module("ui.bootstrap.accordion",["ui.bootstrap.collapse"]).constant("accordionConfig",{closeOthers:!0}).controller("AccordionController",["$scope","$attrs","accordionConfig",function(e,t,n){this.groups=[],this.closeOthers=function(r){(angular.isDefined(t.closeOthers)?e.$eval(t.closeOthers):n.closeOthers)&&angular.forEach(this.groups,function(e){e!==r&&(e.isOpen=!1)})},this.addGroup=function(e){var t=this;this.groups.push(e),e.$on("$destroy",function(n){t.removeGroup(e)})},this.removeGroup=function(e){var t=this.groups.indexOf(e);-1!==t&&this.groups.splice(t,1)}}]).directive("accordion",function(){return{restrict:"EA",controller:"AccordionController",transclude:!0,replace:!1,templateUrl:"template/accordion/accordion.html"}}).directive("accordionGroup",function(){return{require:"^accordion",restrict:"EA",transclude:!0,replace:!0,templateUrl:"template/accordion/accordion-group.html",scope:{heading:"@",isOpen:"=?",isDisabled:"=?"},controller:function(){this.setHeading=function(e){this.heading=e}},link:function(e,t,n,r){r.addGroup(e),e.$watch("isOpen",function(t){t&&r.closeOthers(e)}),e.toggleOpen=function(){e.isDisabled||(e.isOpen=!e.isOpen)},e.isAccordionSelected=function(){return e.isOpen}}}}).directive("accordionHeading",function(){return{restrict:"EA",transclude:!0,template:"",replace:!0,require:"^accordionGroup",link:function(e,t,n,r,i){r.setHeading(i(e,function(){}))}}}).directive("accordionTransclude",function(){return{require:"^accordionGroup",link:function(e,t,n,r){e.$watch(function(){return r[n.accordionTransclude]},function(e){e&&(t.html(""),t.append(e))})}}}),angular.module("ui.bootstrap.alert",[]).controller("AlertController",["$scope","$attrs",function(e,t){e.closeable="close"in t,this.close=e.close}]).directive("alert",function(){return{restrict:"EA",controller:"AlertController",templateUrl:"template/alert/alert.html",transclude:!0,replace:!0,scope:{type:"@",close:"&"}}}).directive("dismissOnTimeout",["$timeout",function(e){return{require:"alert",link:function(t,n,r,i){e(function(){i.close()},parseInt(r.dismissOnTimeout,10))}}}]),angular.module("ui.bootstrap.bindHtml",[]).directive("bindHtmlUnsafe",function(){return function(e,t,n){t.addClass("ng-binding").data("$binding",n.bindHtmlUnsafe),e.$watch(n.bindHtmlUnsafe,function(e){t.html(e||"")})}}),angular.module("ui.bootstrap.buttons",[]).constant("buttonConfig",{activeClass:"active",toggleEvent:"click"}).controller("ButtonsController",["buttonConfig",function(e){this.activeClass=e.activeClass||"active",this.toggleEvent=e.toggleEvent||"click"}]).directive("btnRadio",function(){return{require:["btnRadio","ngModel"],controller:"ButtonsController",link:function(e,t,n,r){var i=r[0],o=r[1];o.$render=function(){t.toggleClass(i.activeClass,angular.equals(o.$modelValue,e.$eval(n.btnRadio)))},t.bind(i.toggleEvent,function(){var r=t.hasClass(i.activeClass);r&&!angular.isDefined(n.uncheckable)||e.$apply(function(){o.$setViewValue(r?null:e.$eval(n.btnRadio)),o.$render()})})}}}).directive("btnCheckbox",function(){return{require:["btnCheckbox","ngModel"],controller:"ButtonsController",link:function(e,t,n,r){var i=r[0],o=r[1];function a(){return s(n.btnCheckboxTrue,!0)}function s(t,n){var r=e.$eval(t);return angular.isDefined(r)?r:n}o.$render=function(){t.toggleClass(i.activeClass,angular.equals(o.$modelValue,a()))},t.bind(i.toggleEvent,function(){e.$apply(function(){o.$setViewValue(t.hasClass(i.activeClass)?s(n.btnCheckboxFalse,!1):a()),o.$render()})})}}}),angular.module("ui.bootstrap.carousel",["ui.bootstrap.transition"]).controller("CarouselController",["$scope","$timeout","$interval","$transition",function(e,t,n,r){var i,o,a=this,s=a.slides=e.slides=[],c=-1;a.currentSlide=null;var u=!1;function l(){d();var t=+e.interval;!isNaN(t)&&t>0&&(i=n(h,t))}function d(){i&&(n.cancel(i),i=null)}function h(){var t=+e.interval;o&&!isNaN(t)&&t>0?e.next():e.pause()}a.select=e.select=function(n,i){var o=s.indexOf(n);function d(){if(!u){if(a.currentSlide&&angular.isString(i)&&!e.noTransition&&n.$element){n.$element.addClass(i);n.$element[0].offsetWidth;angular.forEach(s,function(e){angular.extend(e,{direction:"",entering:!1,leaving:!1,active:!1})}),angular.extend(n,{direction:i,active:!0,entering:!0}),angular.extend(a.currentSlide||{},{direction:i,leaving:!0}),e.$currentTransition=r(n.$element,{}),t=n,d=a.currentSlide,e.$currentTransition.then(function(){h(t,d)},function(){h(t,d)})}else h(n,a.currentSlide);var t,d;a.currentSlide=n,c=o,l()}}function h(t,n){angular.extend(t,{direction:"",active:!0,leaving:!1,entering:!1}),angular.extend(n||{},{direction:"",active:!1,leaving:!1,entering:!1}),e.$currentTransition=null}void 0===i&&(i=o>c?"next":"prev"),n&&n!==a.currentSlide&&(e.$currentTransition?(e.$currentTransition.cancel(),t(d)):d())},e.$on("$destroy",function(){u=!0}),a.indexOfSlide=function(e){return s.indexOf(e)},e.next=function(){var t=(c+1)%s.length;if(!e.$currentTransition)return a.select(s[t],"next")},e.prev=function(){var t=c-1<0?s.length-1:c-1;if(!e.$currentTransition)return a.select(s[t],"prev")},e.isActive=function(e){return a.currentSlide===e},e.$watch("interval",l),e.$on("$destroy",d),e.play=function(){o||(o=!0,l())},e.pause=function(){e.noPause||(o=!1,d())},a.addSlide=function(t,n){t.$element=n,s.push(t),1===s.length||t.active?(a.select(s[s.length-1]),1==s.length&&e.play()):t.active=!1},a.removeSlide=function(e){var t=s.indexOf(e);s.splice(t,1),s.length>0&&e.active?t>=s.length?a.select(s[t-1]):a.select(s[t]):c>t&&c--}}]).directive("carousel",[function(){return{restrict:"EA",transclude:!0,replace:!0,controller:"CarouselController",require:"carousel",templateUrl:"template/carousel/carousel.html",scope:{interval:"=",noTransition:"=",noPause:"="}}}]).directive("slide",function(){return{require:"^carousel",restrict:"EA",transclude:!0,replace:!0,templateUrl:"template/carousel/slide.html",scope:{active:"=?"},link:function(e,t,n,r){r.addSlide(e,t),e.$on("$destroy",function(){r.removeSlide(e)}),e.$watch("active",function(t){t&&r.select(e)})}}}),angular.module("ui.bootstrap.dateparser",[]).service("dateParser",["$locale","orderByFilter",function(e,t){this.parsers={};var n={yyyy:{regex:"\\d{4}",apply:function(e){this.year=+e}},yy:{regex:"\\d{2}",apply:function(e){this.year=+e+2e3}},y:{regex:"\\d{1,4}",apply:function(e){this.year=+e}},MMMM:{regex:e.DATETIME_FORMATS.MONTH.join("|"),apply:function(t){this.month=e.DATETIME_FORMATS.MONTH.indexOf(t)}},MMM:{regex:e.DATETIME_FORMATS.SHORTMONTH.join("|"),apply:function(t){this.month=e.DATETIME_FORMATS.SHORTMONTH.indexOf(t)}},MM:{regex:"0[1-9]|1[0-2]",apply:function(e){this.month=e-1}},M:{regex:"[1-9]|1[0-2]",apply:function(e){this.month=e-1}},dd:{regex:"[0-2][0-9]{1}|3[0-1]{1}",apply:function(e){this.date=+e}},d:{regex:"[1-2]?[0-9]{1}|3[0-1]{1}",apply:function(e){this.date=+e}},EEEE:{regex:e.DATETIME_FORMATS.DAY.join("|")},EEE:{regex:e.DATETIME_FORMATS.SHORTDAY.join("|")}};this.parse=function(r,i){if(!angular.isString(r)||!i)return r;i=e.DATETIME_FORMATS[i]||i,this.parsers[i]||(this.parsers[i]=function(e){var r=[],i=e.split("");return angular.forEach(n,function(t,n){var o=e.indexOf(n);if(o>-1){e=e.split(""),i[o]="("+t.regex+")",e[o]="$";for(var a=o+1,s=o+n.length;a<s;a++)i[a]="",e[a]="$";e=e.join(""),r.push({index:o,apply:t.apply})}}),{regex:new RegExp("^"+i.join("")+"$"),map:t(r,"index")}}(i));var o=this.parsers[i],a=o.regex,s=o.map,c=r.match(a);if(c&&c.length){for(var u,l={year:1900,month:0,date:1,hours:0},d=1,h=c.length;d<h;d++){var p=s[d-1];p.apply&&p.apply.call(l,c[d])}return function(e,t,n){if(1===t&&n>28)return 29===n&&(e%4==0&&e%100!=0||e%400==0);if(3===t||5===t||8===t||10===t)return n<31;return!0}(l.year,l.month,l.date)&&(u=new Date(l.year,l.month,l.date,l.hours)),u}}}]),angular.module("ui.bootstrap.position",[]).factory("$position",["$document","$window",function(e,t){function n(e){return"static"===(r="position",((n=e).currentStyle?n.currentStyle[r]:t.getComputedStyle?t.getComputedStyle(n)[r]:n.style[r])||"static");var n,r}return{position:function(t){var r=this.offset(t),i={top:0,left:0},o=function(t){for(var r=e[0],i=t.offsetParent||r;i&&i!==r&&n(i);)i=i.offsetParent;return i||r}(t[0]);o!=e[0]&&((i=this.offset(angular.element(o))).top+=o.clientTop-o.scrollTop,i.left+=o.clientLeft-o.scrollLeft);var a=t[0].getBoundingClientRect();return{width:a.width||t.prop("offsetWidth"),height:a.height||t.prop("offsetHeight"),top:r.top-i.top,left:r.left-i.left}},offset:function(n){var r=n[0].getBoundingClientRect();return{width:r.width||n.prop("offsetWidth"),height:r.height||n.prop("offsetHeight"),top:r.top+(t.pageYOffset||e[0].documentElement.scrollTop),left:r.left+(t.pageXOffset||e[0].documentElement.scrollLeft)}},positionElements:function(e,t,n,r){var i,o,a,s,c=n.split("-"),u=c[0],l=c[1]||"center";i=r?this.offset(e):this.position(e),o=t.prop("offsetWidth"),a=t.prop("offsetHeight");var d={center:function(){return i.left+i.width/2-o/2},left:function(){return i.left},right:function(){return i.left+i.width}},h={center:function(){return i.top+i.height/2-a/2},top:function(){return i.top},bottom:function(){return i.top+i.height}};switch(u){case"right":s={top:h[l](),left:d[u]()};break;case"left":s={top:h[l](),left:i.left-o};break;case"bottom":s={top:h[u](),left:d[l]()};break;default:s={top:i.top-a,left:d[l]()}}return s}}}]),angular.module("ui.bootstrap.datepicker",["ui.bootstrap.dateparser","ui.bootstrap.position"]).constant("datepickerConfig",{formatDay:"dd",formatMonth:"MMMM",formatYear:"yyyy",formatDayHeader:"EEE",formatDayTitle:"MMMM yyyy",formatMonthTitle:"yyyy",datepickerMode:"day",minMode:"day",maxMode:"year",showWeeks:!0,startingDay:0,yearRange:20,minDate:null,maxDate:null}).controller("DatepickerController",["$scope","$attrs","$parse","$interpolate","$timeout","$log","dateFilter","datepickerConfig",function(e,t,n,r,i,o,a,s){var c=this,u={$setViewValue:angular.noop};this.modes=["day","month","year"],angular.forEach(["formatDay","formatMonth","formatYear","formatDayHeader","formatDayTitle","formatMonthTitle","minMode","maxMode","showWeeks","startingDay","yearRange"],function(n,i){c[n]=angular.isDefined(t[n])?i<8?r(t[n])(e.$parent):e.$parent.$eval(t[n]):s[n]}),angular.forEach(["minDate","maxDate"],function(r){t[r]?e.$parent.$watch(n(t[r]),function(e){c[r]=e?new Date(e):null,c.refreshView()}):c[r]=s[r]?new Date(s[r]):null}),e.datepickerMode=e.datepickerMode||s.datepickerMode,e.uniqueId="datepicker-"+e.$id+"-"+Math.floor(1e4*Math.random()),this.activeDate=angular.isDefined(t.initDate)?e.$parent.$eval(t.initDate):new Date,e.isActive=function(t){return 0===c.compare(t.date,c.activeDate)&&(e.activeDateId=t.uid,!0)},this.init=function(e){(u=e).$render=function(){c.render()}},this.render=function(){if(u.$modelValue){var e=new Date(u.$modelValue),t=!isNaN(e);t?this.activeDate=e:o.error('Datepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.'),u.$setValidity("date",t)}this.refreshView()},this.refreshView=function(){if(this.element){this._refreshView();var e=u.$modelValue?new Date(u.$modelValue):null;u.$setValidity("date-disabled",!e||this.element&&!this.isDisabled(e))}},this.createDateObject=function(e,t){var n=u.$modelValue?new Date(u.$modelValue):null;return{date:e,label:a(e,t),selected:n&&0===this.compare(e,n),disabled:this.isDisabled(e),current:0===this.compare(e,new Date)}},this.isDisabled=function(n){return this.minDate&&this.compare(n,this.minDate)<0||this.maxDate&&this.compare(n,this.maxDate)>0||t.dateDisabled&&e.dateDisabled({date:n,mode:e.datepickerMode})},this.split=function(e,t){for(var n=[];e.length>0;)n.push(e.splice(0,t));return n},e.select=function(t){if(e.datepickerMode===c.minMode){var n=u.$modelValue?new Date(u.$modelValue):new Date(0,0,0,0,0,0,0);n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),u.$setViewValue(n),u.$render()}else c.activeDate=t,e.datepickerMode=c.modes[c.modes.indexOf(e.datepickerMode)-1]},e.move=function(e){var t=c.activeDate.getFullYear()+e*(c.step.years||0),n=c.activeDate.getMonth()+e*(c.step.months||0);c.activeDate.setFullYear(t,n,1),c.refreshView()},e.toggleMode=function(t){t=t||1,e.datepickerMode===c.maxMode&&1===t||e.datepickerMode===c.minMode&&-1===t||(e.datepickerMode=c.modes[c.modes.indexOf(e.datepickerMode)+t])},e.keys={13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down"};var l=function(){i(function(){c.element[0].focus()},0,!1)};e.$on("datepicker.focus",l),e.keydown=function(t){var n=e.keys[t.which];if(n&&!t.shiftKey&&!t.altKey)if(t.preventDefault(),t.stopPropagation(),"enter"===n||"space"===n){if(c.isDisabled(c.activeDate))return;e.select(c.activeDate),l()}else!t.ctrlKey||"up"!==n&&"down"!==n?(c.handleKeyDown(n,t),c.refreshView()):(e.toggleMode("up"===n?1:-1),l())}}]).constant("popmoneydatepickerConfig",{formatDay:"dd",formatMonth:"MMMM",formatYear:"yyyy",formatDayHeader:"EEE",formatDayTitle:"MMMM yyyy",formatMonthTitle:"yyyy",datepickerMode:"day",minMode:"day",maxMode:"year",showWeeks:!0,startingDay:0,yearRange:20,minDate:null,maxDate:null,expectedDelivery:null}).controller("PopupmoneyDatepickerController",["$scope","$attrs","$parse","$interpolate","$timeout","$log","dateFilter","popmoneydatepickerConfig",function(e,t,n,r,i,o,a,s){var c=this,u={$setViewValue:angular.noop};this.modes=["day","month","year"],angular.forEach(["formatDay","formatMonth","formatYear","formatDayHeader","formatDayTitle","formatMonthTitle","minMode","maxMode","showWeeks","startingDay","yearRange"],function(n,i){c[n]=angular.isDefined(t[n])?i<8?r(t[n])(e.$parent):e.$parent.$eval(t[n]):s[n]}),angular.forEach(["minDate","maxDate"],function(r){t[r]?e.$parent.$watch(n(t[r]),function(e){c[r]=e?new Date(e):null,c.refreshView()}):c[r]=s[r]?new Date(s[r]):null}),e.Selecteddate=null,e.OldSelectedDate=null,e.datepickerMode=e.datepickerMode||s.datepickerMode,e.uniqueId="datepicker-"+e.$id+"-"+Math.floor(1e4*Math.random()),this.activeDate=angular.isDefined(t.initDate)?e.$parent.$eval(t.initDate):new Date,e.$parent.datePickerVm.isPopMoneyCalendar=!0,e.isActive=function(t){return 0===c.compare(t.date,c.activeDate)&&(e.activeDateId=t.uid,!0)},e.isExpectedDelivery=function(e){if(null!=c.expectedDelivery){var t=c.expectedDelivery;if(t=new Date(t),0===c.compare(e.date,t))return!0}return!1},this.init=function(e){(u=e).$render=function(){c.render()}},this.render=function(){if(angular.forEach(["expectedDelivery"],function(r){t[r]&&e.$parent.$watch(n(t[r]),function(e){""!=e&&(c[r]=e)})}),u.$modelValue){var r=new Date(u.$modelValue),i=!isNaN(r);i?this.activeDate=r:o.error('Datepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.'),u.$setValidity("date",i)}this.refreshView()},this.refreshView=function(){if(this.element){this._refreshView();var e=u.$modelValue?new Date(u.$modelValue):null;u.$setValidity("date-disabled",!e||this.element&&!this.isDisabled(e))}},this.createDateObject=function(e,t){var n=u.$modelValue?new Date(u.$modelValue):null;return{date:e,label:a(e,t),selected:n&&0===this.compare(e,n),disabled:this.isDisabled(e),current:0===this.compare(e,new Date)}},this.isDisabled=function(n){return this.minDate&&this.compare(n,this.minDate)<0||this.maxDate&&this.compare(n,this.maxDate)>0||t.dateDisabled&&e.dateDisabled({date:n,mode:e.datepickerMode})},this.split=function(e,t){for(var n=[];e.length>0;)n.push(e.splice(0,t));return n},e.select=function(t){var n;e.datepickerMode===c.minMode?null===t?(null==e.OldSelectedDate&&(e.OldSelectedDate=c.activeDate),e.$parent.datePickerVm.EnableDatePicker=!1,(n=u.$modelValue?new Date(u.$modelValue):new Date(0,0,0,0,0,0,0)).setFullYear(e.OldSelectedDate.getFullYear(),e.OldSelectedDate.getMonth(),e.OldSelectedDate.getDate()),u.$setViewValue(n),u.$render(),e.Selecteddate=n,e.$parent.datePickerVm.setCalendarExpectedDeliveryDate()):(null==e.OldSelectedDate&&(e.OldSelectedDate=c.activeDate),(n=u.$modelValue?new Date(u.$modelValue):new Date(0,0,0,0,0,0,0)).setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),u.$setViewValue(n),u.$render(),e.Selecteddate=n,e.$parent.datePickerVm.isPopMoneyFlow=!0,e.$parent.datePickerVm.startDateSelected(n),e.$parent.datePickerVm.datefirstload=!0,e.$parent.datePickerVm.EnableDatePicker=!0):(c.activeDate=t,e.datepickerMode=c.modes[c.modes.indexOf(e.datepickerMode)-1])},e.SaveWithdrawalDate=function(){null==e.Selecteddate&&(e.Selecteddate=new Date(e.$parent.datePickerVm.dateInput)),u.$setViewValue(e.Selecteddate),u.$render();var t=e.Selecteddate;e.OldSelectedDate=e.Selecteddate,e.$parent.datePickerVm.dateInput=parseInt(t.getMonth())+1+"/"+t.getDate()+"/"+t.getFullYear(),e.$parent.datePickerVm.startDateSelected(e.Selecteddate),e.$parent.datePickerVm.EnableDatePicker=!1,e.$parent.datePickerVm.isDoneButtonForRecurrent=!0},e.move=function(e){var t=c.activeDate.getFullYear()+e*(c.step.years||0),n=c.activeDate.getMonth()+e*(c.step.months||0);c.activeDate.setFullYear(t,n,1),c.refreshView()},e.toggleMode=function(t){t=t||1,e.datepickerMode===c.maxMode&&1===t||e.datepickerMode===c.minMode&&-1===t||(e.datepickerMode=c.modes[c.modes.indexOf(e.datepickerMode)+t])},e.keys={13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down"};var l=function(){i(function(){c.element[0].focus()},0,!1)};e.$on("datepicker.focus",l),e.keydown=function(t){var n=e.keys[t.which];if(n&&!t.shiftKey&&!t.altKey)if(t.preventDefault(),t.stopPropagation(),"enter"===n||"space"===n){if(c.isDisabled(c.activeDate))return;e.select(c.activeDate),l()}else!t.ctrlKey||"up"!==n&&"down"!==n?(c.handleKeyDown(n,t),c.refreshView()):(e.toggleMode("up"===n?1:-1),l())}}]).directive("datepicker",function(){return{restrict:"EA",replace:!0,templateUrl:"template/datepicker/datepicker.html",scope:{datepickerMode:"=?",dateDisabled:"&"},require:["datepicker","?^ngModel"],controller:"DatepickerController",link:function(e,t,n,r){var i=r[0],o=r[1];o&&i.init(o)}}}).directive("daypicker",["dateFilter",function(e){return{restrict:"EA",replace:!0,templateUrl:"template/datepicker/day.html",require:"^datepicker",link:function(t,n,r,i){t.showWeeks=i.showWeeks,i.step={months:1},i.element=n;var o=[31,28,31,30,31,30,31,31,30,31,30,31];function a(e,t){return 1!==t||e%4!=0||e%100==0&&e%400!=0?o[t]:29}i._refreshView=function(){var n=i.activeDate.getFullYear(),r=i.activeDate.getMonth(),o=new Date(n,r,1),a=i.startingDay-o.getDay(),s=a>0?7-a:-a,c=new Date(o);s>0&&c.setDate(1-s);for(var u=function(e,t){var n=new Array(t),r=new Date(e),i=0;for(r.setHours(12);i<t;)n[i++]=new Date(r),r.setDate(r.getDate()+1);return n}(c,42),l=0;l<42;l++)u[l]=angular.extend(i.createDateObject(u[l],i.formatDay),{secondary:u[l].getMonth()!==r,uid:t.uniqueId+"-"+l});t.labels=new Array(7);for(var d=0;d<7;d++)t.labels[d]={abbr:e(u[d].date,i.formatDayHeader),full:e(u[d].date,"EEEE")};if(t.title=e(i.activeDate,i.formatDayTitle),t.rows=i.split(u,7),t.showWeeks){t.weekNumbers=[];for(var h=function(e){var t=new Date(e);t.setDate(t.getDate()+4-(t.getDay()||7));var n=t.getTime();return t.setMonth(0),t.setDate(1),Math.floor(Math.round((n-t)/864e5)/7)+1}(t.rows[0][0].date),p=t.rows.length;t.weekNumbers.push(h++)<p;);}},i.compare=function(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate())-new Date(t.getFullYear(),t.getMonth(),t.getDate())},i.handleKeyDown=function(e,t){var n=i.activeDate.getDate();if("left"===e)n-=1;else if("up"===e)n-=7;else if("right"===e)n+=1;else if("down"===e)n+=7;else if("pageup"===e||"pagedown"===e){var r=i.activeDate.getMonth()+("pageup"===e?-1:1);i.activeDate.setMonth(r,1),n=Math.min(a(i.activeDate.getFullYear(),i.activeDate.getMonth()),n)}else"home"===e?n=1:"end"===e&&(n=a(i.activeDate.getFullYear(),i.activeDate.getMonth()));i.activeDate.setDate(n)},i.refreshView()}}}]).directive("monthpicker",["dateFilter",function(e){return{restrict:"EA",replace:!0,templateUrl:"template/datepicker/month.html",require:"^datepicker",link:function(t,n,r,i){i.step={years:1},i.element=n,i._refreshView=function(){for(var n=new Array(12),r=i.activeDate.getFullYear(),o=0;o<12;o++)n[o]=angular.extend(i.createDateObject(new Date(r,o,1),i.formatMonth),{uid:t.uniqueId+"-"+o});t.title=e(i.activeDate,i.formatMonthTitle),t.rows=i.split(n,3)},i.compare=function(e,t){return new Date(e.getFullYear(),e.getMonth())-new Date(t.getFullYear(),t.getMonth())},i.handleKeyDown=function(e,t){var n=i.activeDate.getMonth();if("left"===e)n-=1;else if("up"===e)n-=3;else if("right"===e)n+=1;else if("down"===e)n+=3;else if("pageup"===e||"pagedown"===e){var r=i.activeDate.getFullYear()+("pageup"===e?-1:1);i.activeDate.setFullYear(r)}else"home"===e?n=0:"end"===e&&(n=11);i.activeDate.setMonth(n)},i.refreshView()}}}]).directive("yearpicker",["dateFilter",function(e){return{restrict:"EA",replace:!0,templateUrl:"template/datepicker/year.html",require:"^datepicker",link:function(e,t,n,r){var i=r.yearRange;function o(e){return parseInt((e-1)/i,10)*i+1}r.step={years:i},r.element=t,r._refreshView=function(){for(var t=new Array(i),n=0,a=o(r.activeDate.getFullYear());n<i;n++)t[n]=angular.extend(r.createDateObject(new Date(a+n,0,1),r.formatYear),{uid:e.uniqueId+"-"+n});e.title=[t[0].label,t[i-1].label].join(" - "),e.rows=r.split(t,5)},r.compare=function(e,t){return e.getFullYear()-t.getFullYear()},r.handleKeyDown=function(e,t){var n=r.activeDate.getFullYear();"left"===e?n-=1:"up"===e?n-=5:"right"===e?n+=1:"down"===e?n+=5:"pageup"===e||"pagedown"===e?n+=("pageup"===e?-1:1)*r.step.years:"home"===e?n=o(r.activeDate.getFullYear()):"end"===e&&(n=o(r.activeDate.getFullYear())+i-1),r.activeDate.setFullYear(n)},r.refreshView()}}}]).constant("datepickerPopupConfig",{datepickerPopup:"yyyy-MM-dd",currentText:"Today",clearText:"Clear",closeText:"Done",closeOnDateSelection:!0,appendToBody:!1,showButtonBar:!0}).directive("datepickerPopup",["$compile","$parse","$document","$position","dateFilter","dateParser","datepickerPopupConfig",function(e,t,n,r,i,o,a){return{restrict:"EA",require:"ngModel",scope:{isOpen:"=?",currentText:"@",clearText:"@",closeText:"@",dateDisabled:"&"},link:function(s,c,u,l){var d,h=angular.isDefined(u.closeOnDateSelection)?s.$parent.$eval(u.closeOnDateSelection):a.closeOnDateSelection,p=angular.isDefined(u.datepickerAppendToBody)?s.$parent.$eval(u.datepickerAppendToBody):a.appendToBody;s.showButtonBar=angular.isDefined(u.showButtonBar)?s.$parent.$eval(u.showButtonBar):a.showButtonBar,s.getText=function(e){return s[e+"Text"]||a[e+"Text"]},u.$observe("datepickerPopup",function(e){d=e||a.datepickerPopup,l.$render()});var f=angular.element("<div datepicker-popup-wrap><div datepicker></div></div>");function m(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}f.attr({"ng-model":"date","ng-change":"dateSelection()"});var g=angular.element(f.children()[0]);function v(e){if(!e)return l.$setValidity("date",!0),null;if(angular.isDate(e)&&!isNaN(e))return l.$setValidity("date",!0),e;if(angular.isString(e)){var t=o.parse(e,d)||new Date(e);return isNaN(t)?void l.$setValidity("date",!1):(l.$setValidity("date",!0),t)}l.$setValidity("date",!1)}u.datepickerOptions&&angular.forEach(s.$parent.$eval(u.datepickerOptions),function(e,t){g.attr(m(t),e)}),s.watchData={},angular.forEach(["minDate","maxDate","datepickerMode"],function(e){if(u[e]){var n=t(u[e]);if(s.$parent.$watch(n,function(t){s.watchData[e]=t}),g.attr(m(e),"watchData."+e),"datepickerMode"===e){var r=n.assign;s.$watch("watchData."+e,function(e,t){e!==t&&r(s.$parent,e)})}}}),u.dateDisabled&&g.attr("date-disabled","dateDisabled({ date: date, mode: mode })"),l.$parsers.unshift(v),s.dateSelection=function(e){angular.isDefined(e)&&(s.date=e),l.$setViewValue(s.date),l.$render(),h&&(s.isOpen=!1,c[0].focus())},c.bind("input change keyup",function(){s.$apply(function(){s.date=l.$modelValue})}),l.$render=function(){var e=l.$viewValue?i(l.$viewValue,d):"";c.val(e),s.date=v(l.$modelValue)};var y=function(e){s.isOpen&&e.target!==c[0]&&s.$apply(function(){s.isOpen=!1})},b=function(e,t){s.keydown(e)};c.bind("keydown",b),s.keydown=function(e){27===e.which?(e.preventDefault(),e.stopPropagation(),s.close()):40!==e.which||s.isOpen||(s.isOpen=!0)},s.$watch("isOpen",function(e){e?(s.$broadcast("datepicker.focus"),s.position=p?r.offset(c):r.position(c),s.position.top=s.position.top+c.prop("offsetHeight"),n.bind("click",y)):n.unbind("click",y)}),s.select=function(e){if("today"===e){var t=new Date;angular.isDate(l.$modelValue)?(e=new Date(l.$modelValue)).setFullYear(t.getFullYear(),t.getMonth(),t.getDate()):e=new Date(t.setHours(0,0,0,0))}s.dateSelection(e)},s.close=function(){s.isOpen=!1,c[0].focus()};var A=e(f)(s);f.remove(),p?n.find("body").append(A):c.after(A),s.$on("$destroy",function(){A.remove(),c.unbind("keydown",b),n.unbind("click",y)})}}}]).directive("datepickerPopupWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"template/datepicker/popup.html",link:function(e,t,n){t.bind("click",function(e){e.preventDefault(),e.stopPropagation()})}}}).directive("popmoneydatepicker",function(){return{restrict:"EA",replace:!0,templateUrl:"template/popmoneydatepicker/datepicker.html",scope:{datepickerMode:"=?",dateDisabled:"&"},require:["popmoneydatepicker","?^ngModel"],controller:"PopupmoneyDatepickerController",link:function(e,t,n,r){var i=r[0],o=r[1];o&&i.init(o)}}}).directive("popmoneydaypicker",["dateFilter",function(e){return{restrict:"EA",replace:!0,templateUrl:"template/popmoneydatepicker/day.html",require:"^popmoneydatepicker",link:function(t,n,r,i){t.showWeeks=i.showWeeks,i.step={months:1},i.element=n;var o=[31,28,31,30,31,30,31,31,30,31,30,31];function a(e,t){return 1!==t||e%4!=0||e%100==0&&e%400!=0?o[t]:29}i._refreshView=function(){var n=i.activeDate.getFullYear(),r=i.activeDate.getMonth(),o=new Date(n,r,1),a=i.startingDay-o.getDay(),s=a>0?7-a:-a,c=new Date(o);s>0&&c.setDate(1-s);for(var u=function(e,t){var n=new Array(t),r=new Date(e),i=0;for(r.setHours(12);i<t;)n[i++]=new Date(r),r.setDate(r.getDate()+1);return n}(c,42),l=0;l<42;l++)u[l]=angular.extend(i.createDateObject(u[l],i.formatDay),{secondary:u[l].getMonth()!==r,uid:t.uniqueId+"-"+l});t.labels=new Array(7);for(var d=0;d<7;d++)t.labels[d]={abbr:e(u[d].date,i.formatDayHeader),full:e(u[d].date,"EEEE")};if(t.title=e(i.activeDate,i.formatDayTitle),t.rows=i.split(u,7),t.showWeeks){t.weekNumbers=[];for(var h=function(e){var t=new Date(e);t.setDate(t.getDate()+4-(t.getDay()||7));var n=t.getTime();return t.setMonth(0),t.setDate(1),Math.floor(Math.round((n-t)/864e5)/7)+1}(t.rows[0][0].date),p=t.rows.length;t.weekNumbers.push(h++)<p;);}},i.compare=function(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate())-new Date(t.getFullYear(),t.getMonth(),t.getDate())},i.handleKeyDown=function(e,t){var n=i.activeDate.getDate();if("left"===e)n-=1;else if("up"===e)n-=7;else if("right"===e)n+=1;else if("down"===e)n+=7;else if("pageup"===e||"pagedown"===e){var r=i.activeDate.getMonth()+("pageup"===e?-1:1);i.activeDate.setMonth(r,1),n=Math.min(a(i.activeDate.getFullYear(),i.activeDate.getMonth()),n)}else"home"===e?n=1:"end"===e&&(n=a(i.activeDate.getFullYear(),i.activeDate.getMonth()));i.activeDate.setDate(n)},i.refreshView()}}}]).directive("popmoneymonthpicker",["dateFilter",function(e){return{restrict:"EA",replace:!0,templateUrl:"template/popmoneydatepicker/month.html",require:"^popmoneydatepicker",link:function(t,n,r,i){i.step={years:1},i.element=n,i._refreshView=function(){for(var n=new Array(12),r=i.activeDate.getFullYear(),o=0;o<12;o++)n[o]=angular.extend(i.createDateObject(new Date(r,o,1),i.formatMonth),{uid:t.uniqueId+"-"+o});t.title=e(i.activeDate,i.formatMonthTitle),t.rows=i.split(n,3)},i.compare=function(e,t){return new Date(e.getFullYear(),e.getMonth())-new Date(t.getFullYear(),t.getMonth())},i.handleKeyDown=function(e,t){var n=i.activeDate.getMonth();if("left"===e)n-=1;else if("up"===e)n-=3;else if("right"===e)n+=1;else if("down"===e)n+=3;else if("pageup"===e||"pagedown"===e){var r=i.activeDate.getFullYear()+("pageup"===e?-1:1);i.activeDate.setFullYear(r)}else"home"===e?n=0:"end"===e&&(n=11);i.activeDate.setMonth(n)},i.refreshView()}}}]).directive("popmoneyyearpicker",["dateFilter",function(e){return{restrict:"EA",replace:!0,templateUrl:"template/popmoneydatepicker/year.html",require:"^popmoneydatepicker",link:function(e,t,n,r){var i=r.yearRange;function o(e){return parseInt((e-1)/i,10)*i+1}r.step={years:i},r.element=t,r._refreshView=function(){for(var t=new Array(i),n=0,a=o(r.activeDate.getFullYear());n<i;n++)t[n]=angular.extend(r.createDateObject(new Date(a+n,0,1),r.formatYear),{uid:e.uniqueId+"-"+n});e.title=[t[0].label,t[i-1].label].join(" - "),e.rows=r.split(t,5)},r.compare=function(e,t){return e.getFullYear()-t.getFullYear()},r.handleKeyDown=function(e,t){var n=r.activeDate.getFullYear();"left"===e?n-=1:"up"===e?n-=5:"right"===e?n+=1:"down"===e?n+=5:"pageup"===e||"pagedown"===e?n+=("pageup"===e?-1:1)*r.step.years:"home"===e?n=o(r.activeDate.getFullYear()):"end"===e&&(n=o(r.activeDate.getFullYear())+i-1),r.activeDate.setFullYear(n)},r.refreshView()}}}]).constant("popmoneydatepickerPopupConfig",{popmoneydatepickerPopup:"yyyy-MM-dd",currentText:"Today",clearText:"Clear",closeText:"Done",closeOnDateSelection:!1,appendToBody:!1,showButtonBar:!0}).directive("popmoneydatepickerPopup",["$compile","$parse","$document","$position","dateFilter","dateParser","popmoneydatepickerPopupConfig",function(e,t,n,r,i,o,a){return{restrict:"EA",require:"ngModel",scope:{isOpen:"=?",currentText:"@",clearText:"@",closeText:"@",dateDisabled:"&"},link:function(s,c,u,l){var d,h=angular.isDefined(u.closeOnDateSelection)?s.$parent.$eval(u.closeOnDateSelection):a.closeOnDateSelection,p=angular.isDefined(u.datepickerAppendToBody)?s.$parent.$eval(u.datepickerAppendToBody):a.appendToBody;s.showButtonBar=angular.isDefined(u.showButtonBar)?s.$parent.$eval(u.showButtonBar):a.showButtonBar,s.getText=function(e){return s[e+"Text"]||a[e+"Text"]},u.$observe("popmoneydatepickerPopup",function(e){d=e||a.datepickerPopup,l.$render()});var f=angular.element("<div popmoney-datepicker-popup-wrap><div popmoneydatepicker></div></div>");function m(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}f.attr({"ng-model":"date","ng-change":"dateSelection()"});var g=angular.element(f.children()[0]);function v(e){if(!e)return l.$setValidity("date",!0),null;if(angular.isDate(e)&&!isNaN(e))return l.$setValidity("date",!0),e;if(angular.isString(e)){var t=o.parse(e,d)||new Date(e);return isNaN(t)?void l.$setValidity("date",!1):(l.$setValidity("date",!0),t)}l.$setValidity("date",!1)}u.datepickerOptions&&angular.forEach(s.$parent.$eval(u.datepickerOptions),function(e,t){g.attr(m(t),e)}),s.watchData={},angular.forEach(["minDate","maxDate","datepickerMode"],function(e){if(u[e]){var n=t(u[e]);if(s.$parent.$watch(n,function(t){s.watchData[e]=t}),g.attr(m(e),"watchData."+e),"datepickerMode"===e){var r=n.assign;s.$watch("watchData."+e,function(e,t){e!==t&&r(s.$parent,e)})}}}),u.dateDisabled&&g.attr("date-disabled","dateDisabled({ date: date, mode: mode })"),l.$parsers.unshift(v),s.dateSelection=function(e){angular.isDefined(e)&&(s.date=e),l.$setViewValue(s.date),l.$render(),h&&(s.isOpen=!0,c[0].focus())},c.bind("input change keyup",function(){s.$apply(function(){s.date=l.$modelValue})}),l.$render=function(){var e=l.$viewValue?i(l.$viewValue,d):"";c.val(e),s.date=v(l.$modelValue)};var y=function(e){s.isOpen&&e.target!==c[0]&&s.$apply(function(){s.isOpen=!1})},b=function(e,t){s.keydown(e)};c.bind("keydown",b),s.keydown=function(e){27===e.which?(e.preventDefault(),e.stopPropagation()):40!==e.which||s.isOpen||(s.isOpen=!0)},s.$watch("isOpen",function(e){e?(s.$broadcast("popmoneydatepicker.focus"),s.position=p?r.offset(c):r.position(c),s.position.top=s.position.top+c.prop("offsetHeight"),n.bind("click",y)):n.unbind("click",y)}),s.select=function(e){if("today"===e){var t=new Date;angular.isDate(l.$modelValue)?(e=new Date(l.$modelValue)).setFullYear(t.getFullYear(),t.getMonth(),t.getDate()):e=new Date(t.setHours(0,0,0,0))}s.dateSelection(e)},s.close=function(){s.isOpen=!1,c[0].focus()};var A=e(f)(s);f.remove(),p?n.find("body").append(A):c.after(A),s.$on("$destroy",function(){A.remove(),c.unbind("keydown",b),n.unbind("click",y)})}}}]).directive("popmoneydatepickerPopupWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"template/popmoneydatepicker/popup.html",link:function(e,t,n){t.bind("click",function(e){e.preventDefault(),e.stopPropagation()})}}}),angular.module("ui.bootstrap.dropdown",[]).constant("dropdownConfig",{openClass:"open"}).service("dropdownService",["$document",function(e){var t=null;this.open=function(i){t||(e.bind("click",n),e.bind("keydown",r)),t&&t!==i&&(t.isOpen=!1),t=i},this.close=function(i){t===i&&(t=null,e.unbind("click",n),e.unbind("keydown",r))};var n=function(e){if(t){var n=t.getToggleElement();e&&n&&n[0].contains(e.target)||t.$apply(function(){t.isOpen=!1})}},r=function(e){27===e.which&&(t.focusToggleElement(),n())}}]).controller("DropdownController",["$scope","$attrs","$parse","dropdownConfig","dropdownService","$animate",function(e,t,n,r,i,o){var a,s=this,c=e.$new(),u=r.openClass,l=angular.noop,d=t.onToggle?n(t.onToggle):angular.noop;this.init=function(r){s.$element=r,t.isOpen&&(a=n(t.isOpen),l=a.assign,e.$watch(a,function(e){c.isOpen=!!e}))},this.toggle=function(e){return c.isOpen=arguments.length?!!e:!c.isOpen},this.isOpen=function(){return c.isOpen},c.getToggleElement=function(){return s.toggleElement},c.focusToggleElement=function(){s.toggleElement&&s.toggleElement[0].focus()},c.$watch("isOpen",function(t,n){o[t?"addClass":"removeClass"](s.$element,u),t?(c.focusToggleElement(),i.open(c)):i.close(c),l(e,t),angular.isDefined(t)&&t!==n&&d(e,{open:!!t})}),e.$on("$locationChangeSuccess",function(){c.isOpen=!1}),e.$on("$destroy",function(){c.$destroy()})}]).directive("dropdown",function(){return{controller:"DropdownController",link:function(e,t,n,r){r.init(t)}}}).directive("dropdownToggle",function(){return{require:"?^dropdown",link:function(e,t,n,r){if(r){r.toggleElement=t;var i=function(i){i.preventDefault(),t.hasClass("disabled")||n.disabled||e.$apply(function(){r.toggle()})};t.bind("click",i),t.attr({"aria-haspopup":!0,"aria-expanded":!1}),e.$watch(r.isOpen,function(e){t.attr("aria-expanded",!!e)}),e.$on("$destroy",function(){t.unbind("click",i)})}}}}),angular.module("ui.bootstrap.modal",["ui.bootstrap.transition"]).factory("$$stackedMap",function(){return{createNew:function(){var e=[];return{add:function(t,n){e.push({key:t,value:n})},get:function(t){for(var n=0;n<e.length;n++)if(t==e[n].key)return e[n]},keys:function(){for(var t=[],n=0;n<e.length;n++)t.push(e[n].key);return t},top:function(){return e[e.length-1]},remove:function(t){for(var n=-1,r=0;r<e.length;r++)if(t==e[r].key){n=r;break}return e.splice(n,1)[0]},removeTop:function(){return e.splice(e.length-1,1)[0]},length:function(){return e.length}}}}}).directive("modalBackdrop",["$timeout",function(e){return{restrict:"EA",replace:!0,templateUrl:"template/modal/backdrop.html",link:function(t,n,r){t.backdropClass=r.backdropClass||"",t.animate=!1,e(function(){t.animate=!0})}}}]).directive("modalWindow",["$modalStack","$timeout",function(e,t){return{restrict:"EA",scope:{index:"@",animate:"="},replace:!0,transclude:!0,templateUrl:function(e,t){return t.templateUrl||"template/modal/window.html"},link:function(n,r,i){r.addClass(i.windowClass||""),n.size=i.size,t(function(){n.animate=!0,r[0].querySelectorAll("[autofocus]").length||r[0].focus()}),n.close=function(t){var n=e.getTop();n&&n.value.backdrop&&"static"!=n.value.backdrop&&t.target===t.currentTarget&&(t.preventDefault(),t.stopPropagation(),e.dismiss(n.key,"backdrop click"))}}}}]).directive("modalTransclude",function(){return{link:function(e,t,n,r,i){i(e.$parent,function(e){t.empty(),t.append(e)})}}}).factory("$modalStack",["$transition","$timeout","$document","$compile","$rootScope","$$stackedMap",function(e,t,n,r,i,o){var a,s,c="usb-module__modal modal-open",u=o.createNew(),l={};function d(){for(var e=-1,t=u.keys(),n=0;n<t.length;n++)u.get(t[n]).value.backdrop&&(e=n);return e}function h(e){var t=n.find("body").eq(0),r=u.get(e).value;u.remove(e),p(r.modalDomEl,r.modalScope,300,function(){r.modalScope.$destroy(),t.toggleClass(c,u.length()>0),function(){if(a&&-1==d()){var e=s;p(a,s,150,function(){e.$destroy(),e=null}),a=void 0,s=void 0}}()})}function p(n,r,i,o){r.animate=!1;var a=e.transitionEndEventName;if(a){var s=t(c,i);n.bind(a,function(){t.cancel(s),c(),r.$apply()})}else t(c);function c(){c.done||(c.done=!0,n.remove(),o&&o())}}return i.$watch(d,function(e){s&&(s.index=e)}),n.bind("keydown",function(e){var t;27===e.which&&(t=u.top())&&t.value.keyboard&&(e.preventDefault(),i.$apply(function(){l.dismiss(t.key,"escape key press")}))}),l.open=function(e,t){u.add(e,{deferred:t.deferred,modalScope:t.scope,backdrop:t.backdrop,keyboard:t.keyboard});var o=n.find("body").eq(0),l=d();if(l>=0&&!a){(s=i.$new(!0)).index=l;var h=angular.element("<div modal-backdrop></div>");h.attr("backdrop-class",t.backdropClass),a=r(h)(s),o.append(a)}var p=angular.element("<div modal-window></div>");p.attr({"template-url":t.windowTemplateUrl,"window-class":t.windowClass,size:t.size,index:u.length()-1,animate:"animate"}).html(t.content);var f=r(p)(t.scope);u.top().value.modalDomEl=f,o.append(f),o.addClass(c)},l.close=function(e,t){var n=u.get(e);n&&(n.value.deferred.resolve(t),h(e))},l.dismiss=function(e,t){var n=u.get(e);n&&(n.value.deferred.reject(t),h(e))},l.dismissAll=function(e){for(var t=this.getTop();t;)this.dismiss(t.key,e),t=this.getTop()},l.getTop=function(){return u.top()},l}]).provider("$modal",function(){var e={options:{backdrop:!0,keyboard:!0},$get:["$injector","$rootScope","$q","$http","$templateCache","$controller","$modalStack",function(t,n,r,i,o,a,s){var c={};return c.open=function(c){var u=r.defer(),l=r.defer(),d={result:u.promise,opened:l.promise,close:function(e){s.close(d,e)},dismiss:function(e){s.dismiss(d,e)}};if((c=angular.extend({},e.options,c)).resolve=c.resolve||{},!c.template&&!c.templateUrl)throw new Error("One of template or templateUrl options is required.");var h,p,f,m=r.all([(f=c,f.template?r.when(f.template):i.get(angular.isFunction(f.templateUrl)?f.templateUrl():f.templateUrl,{cache:o}).then(function(e){return e.data}))].concat((h=c.resolve,p=[],angular.forEach(h,function(e){(angular.isFunction(e)||angular.isArray(e))&&p.push(r.when(t.invoke(e)))}),p)));return m.then(function(e){var t=(c.scope||n).$new();t.$close=d.close,t.$dismiss=d.dismiss;var r,i={},o=1;c.controller&&(i.$scope=t,i.$modalInstance=d,angular.forEach(c.resolve,function(t,n){i[n]=e[o++]}),r=a(c.controller,i),c.controllerAs&&(t[c.controllerAs]=r)),s.open(d,{scope:t,deferred:u,content:e[0],backdrop:c.backdrop,keyboard:c.keyboard,backdropClass:c.backdropClass,windowClass:c.windowClass,windowTemplateUrl:c.windowTemplateUrl,size:c.size})},function(e){u.reject(e)}),m.then(function(){l.resolve(!0)},function(){l.reject(!1)}),d},c}]};return e}),angular.module("ui.bootstrap.pagination",[]).controller("PaginationController",["$scope","$attrs","$parse",function(e,t,n){var r=this,i={$setViewValue:angular.noop},o=t.numPages?n(t.numPages).assign:angular.noop;this.init=function(o,a){i=o,this.config=a,i.$render=function(){r.render()},t.itemsPerPage?e.$parent.$watch(n(t.itemsPerPage),function(t){r.itemsPerPage=parseInt(t,10),e.totalPages=r.calculateTotalPages()}):this.itemsPerPage=a.itemsPerPage},this.calculateTotalPages=function(){var t=this.itemsPerPage<1?1:Math.ceil(e.totalItems/this.itemsPerPage);return Math.max(t||0,1)},this.render=function(){e.page=parseInt(i.$viewValue,10)||1},e.selectPage=function(t,n){e.page!==t&&t>0&&t<=e.totalPages&&(n&&n.target&&n.target.blur(),i.$setViewValue(t),i.$render())},e.getText=function(t){return e[t+"Text"]||r.config[t+"Text"]},e.noPrevious=function(){return 1===e.page},e.noNext=function(){return e.page===e.totalPages},e.$watch("totalItems",function(){e.totalPages=r.calculateTotalPages()}),e.$watch("totalPages",function(t){o(e.$parent,t),e.page>t?e.selectPage(t):i.$render()})}]).constant("paginationConfig",{itemsPerPage:10,boundaryLinks:!1,boundaryLinkNumbers:!1,directionLinks:!0,firstText:"First",previousText:"Previous",nextText:"Next",lastText:"Last",rotate:!0,forceEllipses:!1}).directive("pagination",["$parse","paginationConfig",function(e,t){return{restrict:"EA",scope:{totalItems:"=",firstText:"@",previousText:"@",nextText:"@",lastText:"@"},require:["pagination","?ngModel"],controller:"PaginationController",templateUrl:"template/pagination/pagination.html",replace:!0,link:function(n,r,i,o){var a=o[0],s=o[1];if(s){var c=angular.isDefined(i.maxSize)?n.$parent.$eval(i.maxSize):t.maxSize,u=angular.isDefined(i.rotate)?n.$parent.$eval(i.rotate):t.rotate,l=angular.isDefined(i.forceEllipses)?n.$parent.$eval(i.forceEllipses):t.forceEllipses,d=angular.isDefined(i.boundaryLinkNumbers)?n.$parent.$eval(i.boundaryLinkNumbers):t.boundaryLinkNumbers;n.boundaryLinks=angular.isDefined(i.boundaryLinks)?n.$parent.$eval(i.boundaryLinks):t.boundaryLinks,n.directionLinks=angular.isDefined(i.directionLinks)?n.$parent.$eval(i.directionLinks):t.directionLinks,a.init(s,t),i.maxSize&&n.$parent.$watch(e(i.maxSize),function(e){c=parseInt(e,10),a.render()});var h=a.render;a.render=function(){h(),n.page>0&&n.page<=n.totalPages&&(n.pages=function(e,t){var n=[],r=1,i=t,o=angular.isDefined(c)&&c<t;o&&(u?(i=(r=Math.max(e-Math.floor(c/2),1))+c-1)>t&&(r=(i=t)-c+1):(r=(Math.ceil(e/c)-1)*c+1,i=Math.min(r+c-1,t)));for(var a=r;a<=i;a++){var s=p(a,a,a===e);n.push(s)}if(o&&c>0&&(!u||l||d)){if(r>1){if(!d||r>3){var h=p(r-1,"...",!1);n.unshift(h)}if(d){if(3===r){var f=p(2,"2",!1);n.unshift(f)}var m=p(1,"1",!1);n.unshift(m)}}if(i<t){if(!d||i<t-2){var g=p(i+1,"...",!1);n.push(g)}if(d){if(i===t-2){var v=p(t-1,t-1,!1);n.push(v)}var y=p(t,t,!1);n.push(y)}}}return n}(n.page,n.totalPages))}}function p(e,t,n){return{number:e,text:t,active:n}}}}}]).constant("pagerConfig",{itemsPerPage:10,previousText:"� Previous",nextText:"Next �",align:!0}).directive("pager",["pagerConfig",function(e){return{restrict:"EA",scope:{totalItems:"=",previousText:"@",nextText:"@"},require:["pager","?ngModel"],controller:"PaginationController",templateUrl:"template/pagination/pager.html",replace:!0,link:function(t,n,r,i){var o=i[0],a=i[1];a&&(t.align=angular.isDefined(r.align)?t.$parent.$eval(r.align):e.align,o.init(a,e))}}}]),angular.module("ui.bootstrap.tooltip",["ui.bootstrap.position","ui.bootstrap.bindHtml"]).provider("$tooltip",function(){var e={placement:"top",animation:!0,popupDelay:0},t={mouseenter:"mouseleave",click:"click",focus:"blur"},n={};this.options=function(e){angular.extend(n,e)},this.setTriggers=function(e){angular.extend(t,e)},this.$get=["$window","$compile","$timeout","$document","$position","$interpolate",function(r,i,o,a,s,c){return function(r,u,l){var d=angular.extend({},e,n);function h(e){var n=e||d.trigger||l;return{show:n,hide:t[n]||n}}var p=r.replace(/[A-Z]/g,function(e,t){return(t?"-":"")+e.toLowerCase()}),f=c.startSymbol(),m=c.endSymbol(),g="<div "+p+'-popup title="'+f+"title"+m+'" content="'+f+"content"+m+'" placement="'+f+"placement"+m+'" animation="animation" is-open="isOpen"></div>';return{restrict:"EA",compile:function(e,t){var n=i(g);return function(e,t,i){var c,l,p,f,m=!!angular.isDefined(d.appendToBody)&&d.appendToBody,g=h(void 0),v=angular.isDefined(i[u+"Enable"]),y=e.$new(!0),b=function(){var e=s.positionElements(t,c,y.placement,m);e.top+="px",e.left+="px",c.css(e)};function A(){y.isOpen?S():_()}function _(){var t;v&&!e.$eval(i[u+"Enable"])||(t=i[u+"Placement"],y.placement=angular.isDefined(t)?t:d.placement,function(){var e=i[u+"PopupDelay"],t=parseInt(e,10);y.popupDelay=isNaN(t)?d.popupDelay:t}(),y.popupDelay?f||(f=o(I,y.popupDelay,!1)).then(function(e){e()}):I()())}function S(){e.$apply(function(){w()})}function I(){return f=null,p&&(o.cancel(p),p=null),y.content?(function(){c&&k();l=y.$new(),c=n(l,function(e){m?a.find("body").append(e):t.after(e),y.$emit("TooltipOpened")})}(),c.css({top:0,left:0,display:"block"}),y.$digest(),b(),y.isOpen=!0,y.$digest(),b):angular.noop}function w(){y.isOpen=!1,y.$emit("TooltipClosed"),o.cancel(f),f=null,y.animation?p||(p=o(k,500)):k()}function k(){p=null,c&&(c.remove(),c=null),l&&(l.$destroy(),l=null)}y.isOpen=!1,i.$observe(r,function(e){y.content=e,!e&&y.isOpen&&w()}),i.$observe(u+"Title",function(e){y.title=e});var C,E=function(){t.unbind(g.show,_),t.unbind(g.hide,S)};C=i[u+"Trigger"],E(),(g=h(C)).show===g.hide?t.bind(g.show,A):(t.bind(g.show,_),t.bind(g.hide,S));var P=e.$eval(i[u+"Animation"]);y.animation=angular.isDefined(P)?!!P:d.animation;var T=e.$eval(i[u+"AppendToBody"]);(m=angular.isDefined(T)?T:m)&&e.$on("$locationChangeSuccess",function(){y.isOpen&&w()}),e.$on("$destroy",function(){o.cancel(p),o.cancel(f),E(),k(),y=null})}}}}}]}).directive("tooltipPopup",function(){return{restrict:"EA",replace:!0,scope:{content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-popup.html"}}).directive("tooltip",["$tooltip",function(e){return e("tooltip","tooltip","mouseenter")}]).directive("tooltipHtmlUnsafePopup",function(){return{restrict:"EA",replace:!0,scope:{content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-html-unsafe-popup.html"}}).directive("tooltipHtmlUnsafe",["$tooltip",function(e){return e("tooltipHtmlUnsafe","tooltip","mouseenter")}]),angular.module("ui.bootstrap.popover",["ui.bootstrap.tooltip"]).directive("popoverPopup",function(){return{restrict:"EA",replace:!0,scope:{title:"@",content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/popover/popover.html"}}).directive("popover",["$tooltip",function(e){return e("popover","popover","click")}]),angular.module("ui.bootstrap.progressbar",[]).constant("progressConfig",{animate:!0,max:100}).controller("ProgressController",["$scope","$attrs","progressConfig",function(e,t,n){var r=this,i=angular.isDefined(t.animate)?e.$parent.$eval(t.animate):n.animate;this.bars=[],e.max=angular.isDefined(t.max)?e.$parent.$eval(t.max):n.max,this.addBar=function(t,n){i||n.css({transition:"none"}),this.bars.push(t),t.$watch("value",function(n){t.percent=+(100*n/e.max).toFixed(2)}),t.$on("$destroy",function(){n=null,r.removeBar(t)})},this.removeBar=function(e){this.bars.splice(this.bars.indexOf(e),1)}}]).directive("progress",function(){return{restrict:"EA",replace:!0,transclude:!0,controller:"ProgressController",require:"progress",scope:{},templateUrl:"template/progressbar/progress.html"}}).directive("bar",function(){return{restrict:"EA",replace:!0,transclude:!0,require:"^progress",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/bar.html",link:function(e,t,n,r){r.addBar(e,t)}}}).directive("progressbar",function(){return{restrict:"EA",replace:!0,transclude:!0,controller:"ProgressController",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/progressbar.html",link:function(e,t,n,r){r.addBar(e,angular.element(t.children()[0]))}}}),angular.module("ui.bootstrap.rating",[]).constant("ratingConfig",{max:5,stateOn:null,stateOff:null}).controller("RatingController",["$scope","$attrs","ratingConfig",function(e,t,n){var r={$setViewValue:angular.noop};this.init=function(i){(r=i).$render=this.render,this.stateOn=angular.isDefined(t.stateOn)?e.$parent.$eval(t.stateOn):n.stateOn,this.stateOff=angular.isDefined(t.stateOff)?e.$parent.$eval(t.stateOff):n.stateOff;var o=angular.isDefined(t.ratingStates)?e.$parent.$eval(t.ratingStates):new Array(angular.isDefined(t.max)?e.$parent.$eval(t.max):n.max);e.range=this.buildTemplateObjects(o)},this.buildTemplateObjects=function(e){for(var t=0,n=e.length;t<n;t++)e[t]=angular.extend({index:t},{stateOn:this.stateOn,stateOff:this.stateOff},e[t]);return e},e.rate=function(t){!e.readonly&&t>=0&&t<=e.range.length&&(r.$setViewValue(t),r.$render())},e.enter=function(t){e.readonly||(e.value=t),e.onHover({value:t})},e.reset=function(){e.value=r.$viewValue,e.onLeave()},e.onKeydown=function(t){/(37|38|39|40)/.test(t.which)&&(t.preventDefault(),t.stopPropagation(),e.rate(e.value+(38===t.which||39===t.which?1:-1)))},this.render=function(){e.value=r.$viewValue}}]).directive("rating",function(){return{restrict:"EA",require:["rating","ngModel"],scope:{readonly:"=?",onHover:"&",onLeave:"&"},controller:"RatingController",templateUrl:"template/rating/rating.html",replace:!0,link:function(e,t,n,r){var i=r[0],o=r[1];o&&i.init(o)}}}),angular.module("ui.bootstrap.tabs",[]).controller("TabsetController",["$scope",function(e){var t,n=this,r=n.tabs=e.tabs=[];n.select=function(e){angular.forEach(r,function(t){t.active&&t!==e&&(t.active=!1,t.onDeselect())}),e.active=!0,e.onSelect()},n.addTab=function(e){r.push(e),1===r.length?e.active=!0:e.active&&n.select(e)},n.removeTab=function(e){var i=r.indexOf(e);if(e.active&&r.length>1&&!t){var o=i==r.length-1?i-1:i+1;n.select(r[o])}r.splice(i,1)},e.$on("$destroy",function(){t=!0})}]).directive("tabset",function(){return{restrict:"EA",transclude:!0,replace:!0,scope:{type:"@"},controller:"TabsetController",templateUrl:"template/tabs/tabset.html",link:function(e,t,n){e.vertical=!!angular.isDefined(n.vertical)&&e.$parent.$eval(n.vertical),e.justified=!!angular.isDefined(n.justified)&&e.$parent.$eval(n.justified)}}}).directive("tab",["$parse",function(e){return{require:"^tabset",restrict:"EA",replace:!0,templateUrl:"template/tabs/tab.html",transclude:!0,scope:{active:"=?",heading:"@",onSelect:"&select",onDeselect:"&deselect"},controller:function(){},compile:function(t,n,r){return function(t,n,i,o){t.$watch("active",function(e){e&&o.select(t)}),t.disabled=!1,i.disabled&&t.$parent.$watch(e(i.disabled),function(e){t.disabled=!!e}),t.select=function(){t.disabled||(t.active=!0)},o.addTab(t),t.$on("$destroy",function(){o.removeTab(t)}),t.$transcludeFn=r}}}}]).directive("tabHeadingTransclude",[function(){return{restrict:"A",require:"^tab",link:function(e,t,n,r){e.$watch("headingElement",function(e){e&&(t.html(""),t.append(e))})}}}]).directive("tabContentTransclude",function(){return{restrict:"A",require:"^tabset",link:function(e,t,n){var r=e.$eval(n.tabContentTransclude);r.$transcludeFn(r.$parent,function(e){angular.forEach(e,function(e){!function(e){return e.tagName&&(e.hasAttribute("tab-heading")||e.hasAttribute("data-tab-heading")||"tab-heading"===e.tagName.toLowerCase()||"data-tab-heading"===e.tagName.toLowerCase())}(e)?t.append(e):r.headingElement=e})})}}}),angular.module("ui.bootstrap.timepicker",[]).constant("timepickerConfig",{hourStep:1,minuteStep:1,showMeridian:!0,meridians:null,readonlyInput:!1,mousewheel:!0}).controller("TimepickerController",["$scope","$attrs","$parse","$log","$locale","timepickerConfig",function(e,t,n,r,i,o){var a=new Date,s={$setViewValue:angular.noop},c=angular.isDefined(t.meridians)?e.$parent.$eval(t.meridians):o.meridians||i.DATETIME_FORMATS.AMPMS;this.init=function(n,r){(s=n).$render=this.render;var i=r.eq(0),a=r.eq(1);(angular.isDefined(t.mousewheel)?e.$parent.$eval(t.mousewheel):o.mousewheel)&&this.setupMousewheelEvents(i,a),e.readonlyInput=angular.isDefined(t.readonlyInput)?e.$parent.$eval(t.readonlyInput):o.readonlyInput,this.setupInputEvents(i,a)};var u=o.hourStep;t.hourStep&&e.$parent.$watch(n(t.hourStep),function(e){u=parseInt(e,10)});var l=o.minuteStep;function d(){var t=parseInt(e.hours,10);if(e.showMeridian?t>0&&t<13:t>=0&&t<24)return e.showMeridian&&(12===t&&(t=0),e.meridian===c[1]&&(t+=12)),t}function h(){var t=parseInt(e.minutes,10);return t>=0&&t<60?t:void 0}function p(e){return angular.isDefined(e)&&e.toString().length<2?"0"+e:e}function f(e){m(),s.$setViewValue(new Date(a)),g(e)}function m(){s.$setValidity("time",!0),e.invalidHours=!1,e.invalidMinutes=!1}function g(t){var n=a.getHours(),r=a.getMinutes();e.showMeridian&&(n=0===n||12===n?12:n%12),e.hours="h"===t?n:p(n),e.minutes="m"===t?r:p(r),e.meridian=a.getHours()<12?c[0]:c[1]}function v(e){var t=new Date(a.getTime()+6e4*e);a.setHours(t.getHours(),t.getMinutes()),f()}t.minuteStep&&e.$parent.$watch(n(t.minuteStep),function(e){l=parseInt(e,10)}),e.showMeridian=o.showMeridian,t.showMeridian&&e.$parent.$watch(n(t.showMeridian),function(t){if(e.showMeridian=!!t,s.$error.time){var n=d(),r=h();angular.isDefined(n)&&angular.isDefined(r)&&(a.setHours(n),f())}else g()}),this.setupMousewheelEvents=function(t,n){var r=function(e){e.originalEvent&&(e=e.originalEvent);var t=e.wheelDelta?e.wheelDelta:-e.deltaY;return e.detail||t>0};t.bind("mousewheel wheel",function(t){e.$apply(r(t)?e.incrementHours():e.decrementHours()),t.preventDefault()}),n.bind("mousewheel wheel",function(t){e.$apply(r(t)?e.incrementMinutes():e.decrementMinutes()),t.preventDefault()})},this.setupInputEvents=function(t,n){if(e.readonlyInput)return e.updateHours=angular.noop,void(e.updateMinutes=angular.noop);var r=function(t,n){s.$setViewValue(null),s.$setValidity("time",!1),angular.isDefined(t)&&(e.invalidHours=t),angular.isDefined(n)&&(e.invalidMinutes=n)};e.updateHours=function(){var e=d();angular.isDefined(e)?(a.setHours(e),f("h")):r(!0)},t.bind("blur",function(t){!e.invalidHours&&e.hours<10&&e.$apply(function(){e.hours=p(e.hours)})}),e.updateMinutes=function(){var e=h();angular.isDefined(e)?(a.setMinutes(e),f("m")):r(void 0,!0)},n.bind("blur",function(t){!e.invalidMinutes&&e.minutes<10&&e.$apply(function(){e.minutes=p(e.minutes)})})},this.render=function(){var e=s.$modelValue?new Date(s.$modelValue):null;isNaN(e)?(s.$setValidity("time",!1),r.error('Timepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.')):(e&&(a=e),m(),g())},e.incrementHours=function(){v(60*u)},e.decrementHours=function(){v(60*-u)},e.incrementMinutes=function(){v(l)},e.decrementMinutes=function(){v(-l)},e.toggleMeridian=function(){v(720*(a.getHours()<12?1:-1))}}]).directive("timepicker",function(){return{restrict:"EA",require:["timepicker","?^ngModel"],controller:"TimepickerController",replace:!0,scope:{},templateUrl:"template/timepicker/timepicker.html",link:function(e,t,n,r){var i=r[0],o=r[1];o&&i.init(o,t.find("input"))}}}),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.position","ui.bootstrap.bindHtml"]).factory("typeaheadParser",["$parse",function(e){var t=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(n){var r=n.match(t);if(!r)throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "'+n+'".');return{itemName:r[3],source:e(r[4]),viewMapper:e(r[2]||r[1]),modelMapper:e(r[1])}}}}]).directive("typeahead",["$compile","$parse","$q","$timeout","$document","$position","typeaheadParser",function(e,t,n,r,i,o,a){var s=[9,13,27,38,40];return{require:"ngModel",link:function(c,u,l,d){var h,p=c.$eval(l.typeaheadMinLength)||1,f=c.$eval(l.typeaheadWaitMs)||0,m=!1!==c.$eval(l.typeaheadEditable),g=t(l.typeaheadLoading).assign||angular.noop,v=t(l.typeaheadOnSelect),y=l.typeaheadInputFormatter?t(l.typeaheadInputFormatter):void 0,b=!!l.typeaheadAppendToBody&&c.$eval(l.typeaheadAppendToBody),A=!1!==c.$eval(l.typeaheadFocusFirst),_=t(l.ngModel).assign,S=a.parse(l.typeahead),I=c.$new();c.$on("$destroy",function(){I.$destroy()});var w="typeahead-"+I.$id+"-"+Math.floor(1e4*Math.random());u.attr({"aria-autocomplete":"list","aria-expanded":!1,"aria-owns":w});var k=angular.element("<div typeahead-popup></div>");k.attr({id:w,matches:"matches",active:"activeIdx",select:"select(activeIdx)",query:"query",position:"position"}),angular.isDefined(l.typeaheadTemplateUrl)&&k.attr("template-url",l.typeaheadTemplateUrl);var C=function(){I.matches=[],I.activeIdx=-1,u.attr("aria-expanded",!1)},E=function(e){return w+"-option-"+e};I.$watch("activeIdx",function(e){e<0?u.removeAttr("aria-activedescendant"):u.attr("aria-activedescendant",E(e))});var P,T=function(e){var t={$viewValue:e};g(c,!0),n.when(S.source(c,t)).then(function(n){var r=e===d.$viewValue;if(r&&h)if(n.length>0){I.activeIdx=A?0:-1,I.matches.length=0;for(var i=0;i<n.length;i++)t[S.itemName]=n[i],I.matches.push({id:E(i),label:S.viewMapper(I,t),model:n[i]});I.query=e,I.position=b?o.offset(u):o.position(u),I.position.top=I.position.top+u.prop("offsetHeight"),u.attr("aria-expanded",!0)}else C();r&&g(c,!1)},function(){C(),g(c,!1)})};C(),I.query=void 0;var R=function(){P&&r.cancel(P)};d.$parsers.unshift(function(e){return h=!0,e&&e.length>=p?f>0?(R(),function(e){P=r(function(){T(e)},f)}(e)):T(e):(g(c,!1),R(),C()),m?e:e?void d.$setValidity("editable",!1):(d.$setValidity("editable",!0),e)}),d.$formatters.push(function(e){var t,n={};return y?(n.$model=e,y(c,n)):(n[S.itemName]=e,t=S.viewMapper(c,n),n[S.itemName]=void 0,t!==S.viewMapper(c,n)?t:e)}),I.select=function(e){var t,n,i={};i[S.itemName]=n=I.matches[e].model,t=S.modelMapper(c,i),_(c,t),d.$setValidity("editable",!0),v(c,{$item:n,$model:t,$label:S.viewMapper(c,i)}),C(),r(function(){u[0].focus()},0,!1)},u.bind("keydown",function(e){0!==I.matches.length&&-1!==s.indexOf(e.which)&&(-1!=I.activeIdx||13!==e.which&&9!==e.which)&&(e.preventDefault(),40===e.which?(I.activeIdx=(I.activeIdx+1)%I.matches.length,I.$digest()):38===e.which?(I.activeIdx=(I.activeIdx>0?I.activeIdx:I.matches.length)-1,I.$digest()):13===e.which||9===e.which?I.$apply(function(){I.select(I.activeIdx)}):27===e.which&&(e.stopPropagation(),C(),I.$digest()))}),u.bind("blur",function(e){h=!1});var D=function(e){u[0]!==e.target&&(C(),I.$digest())};i.bind("click",D),c.$on("$destroy",function(){i.unbind("click",D),b&&x.remove()});var x=e(k)(I);b?i.find("body").append(x):u.after(x)}}}]).directive("typeaheadPopup",function(){return{restrict:"EA",scope:{matches:"=",query:"=",active:"=",position:"=",select:"&"},replace:!0,templateUrl:"template/typeahead/typeahead-popup.html",link:function(e,t,n){e.templateUrl=n.templateUrl,e.isOpen=function(){return e.matches.length>0},e.isActive=function(t){return e.active==t},e.selectActive=function(t){e.active=t},e.selectMatch=function(t){e.select({activeIdx:t})}}}}).directive("typeaheadMatch",["$http","$templateCache","$compile","$parse",function(e,t,n,r){return{restrict:"EA",scope:{index:"=",match:"=",query:"="},link:function(i,o,a){var s=r(a.templateUrl)(i.$parent)||"template/typeahead/typeahead-match.html";e.get(s,{cache:t}).success(function(e){o.replaceWith(n(e.trim())(i))})}}}]).filter("typeaheadHighlight",function(){return function(e,t){return t?(""+e).replace(new RegExp(t.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"gi"),"<strong>$&</strong>"):e}}),angular.module("template/accordion/accordion-group.html",[]).run(["$templateCache",function(e){e.put("template/accordion/accordion-group.html",'<div class="panel panel-default">\n  <div class="panel-heading" ng-class="{\'panel-headingSelected\' : isAccordionSelected()}">\n    <h4 class="panel-title">\n      <a href class="accordion-toggle" ng-click="toggleOpen()" accordion-transclude="heading"><span ng-class="{\'text-muted\': isDisabled}">{{heading}}</span></a>\n    </h4>\n  </div>\n  <div class="panel-collapse" collapse="!isOpen">\n\t  <div class="panel-body" ng-transclude></div>\n  </div>\n</div>\n')}]),angular.module("template/accordion/accordion.html",[]).run(["$templateCache",function(e){e.put("template/accordion/accordion.html",'<div class="panel-group" ng-transclude></div>')}]),angular.module("template/alert/alert.html",[]).run(["$templateCache",function(e){e.put("template/alert/alert.html",'<div class="alert" ng-class="[\'alert-\' + (type || \'warning\'), closeable ? \'alert-dismissable\' : null]" role="alert">\n    <button ng-show="closeable" type="button" class="close" ng-click="close()">\n        <span aria-hidden="true">&times;</span>\n        <span class="sr-only">Close</span>\n    </button>\n    <div ng-transclude></div>\n</div>\n')}]),angular.module("template/carousel/carousel.html",[]).run(["$templateCache",function(e){e.put("template/carousel/carousel.html",'<div ng-mouseenter="pause()" ng-mouseleave="play()" class="carousel" ng-swipe-right="prev()" ng-swipe-left="next()">\n    <ol class="carousel-indicators" ng-show="slides.length > 1">\n        <li ng-repeat="slide in slides track by $index" ng-class="{active: isActive(slide)}" ng-click="select(slide)"></li>\n    </ol>\n    <div class="carousel-inner" ng-transclude></div>\n    <a class="left carousel-control" ng-click="prev()" ng-show="slides.length > 1"><span class="glyphicon glyphicon-chevron-left"></span></a>\n    <a class="right carousel-control" ng-click="next()" ng-show="slides.length > 1"><span class="glyphicon glyphicon-chevron-right"></span></a>\n</div>\n')}]),angular.module("template/carousel/slide.html",[]).run(["$templateCache",function(e){e.put("template/carousel/slide.html","<div ng-class=\"{\n    'active': leaving || (active && !entering),\n    'prev': (next || active) && direction=='prev',\n    'next': (next || active) && direction=='next',\n    'right': direction=='prev',\n    'left': direction=='next'\n  }\" class=\"item text-center\" ng-transclude></div>\n")}]),angular.module("template/datepicker/datepicker.html",[]).run(["$templateCache",function(e){e.put("template/datepicker/datepicker.html",'<div ng-switch="datepickerMode" role="application" ng-keydown="keydown($event)">\n  <daypicker ng-switch-when="day" tabindex="0"></daypicker>\n  <monthpicker ng-switch-when="month" tabindex="0"></monthpicker>\n  <yearpicker ng-switch-when="year" tabindex="0"></yearpicker>\n</div>')}]),angular.module("template/datepicker/day.html",[]).run(["$templateCache",function(e){e.put("template/datepicker/day.html",'<table role="grid" aria-labelledby="{{uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n  <thead>\n    <tr>\n      <th><button type="button" class="btn btn-default btn-sm pull-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n      <th colspan="{{5 + showWeeks}}"><button id="{{uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm" ng-click="toggleMode()" tabindex="-1" style="width:100%;"><strong>{{title}}</strong></button></th>\n      <th><button type="button" class="btn btn-default btn-sm pull-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n    </tr>\n    <tr>\n      <th ng-show="showWeeks" class="text-center"></th>\n      <th ng-repeat="label in labels track by $index" class="text-center"><small aria-label="{{label.full}}">{{label.abbr}}</small></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr ng-repeat="row in rows track by $index">\n      <td ng-show="showWeeks" class="text-center h6"><em>{{ weekNumbers[$index] }}</em></td>\n      <td ng-repeat="dt in row track by dt.date" class="text-center" role="gridcell" id="{{dt.uid}}" aria-disabled="{{!!dt.disabled}}">\n        <button type="button" style="width:100%;" class="btn btn-default btn-sm" ng-class="{\'btn-info\': dt.selected, active: isActive(dt)}" ng-click="select(dt.date)" ng-disabled="dt.disabled" ng-hide="dt.secondary" tabindex="-1"><span ng-class="{\'text-muted\': dt.secondary, \'text-info\': dt.current}">{{dt.label}}</span></button>\n      </td>\n    </tr>\n  </tbody>\n</table>\n')}]),angular.module("template/datepicker/month.html",[]).run(["$templateCache",function(e){e.put("template/datepicker/month.html",'<table role="grid" aria-labelledby="{{uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n  <thead>\n    <tr>\n      <th><button type="button" class="btn btn-default btn-sm pull-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n      <th><button id="{{uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm" ng-click="toggleMode()" tabindex="-1" style="width:100%;"><strong>{{title}}</strong></button></th>\n      <th><button type="button" class="btn btn-default btn-sm pull-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr ng-repeat="row in rows track by $index">\n      <td ng-repeat="dt in row track by dt.date" class="text-center" role="gridcell" id="{{dt.uid}}" aria-disabled="{{!!dt.disabled}}">\n        <button type="button" style="width:100%;" class="btn btn-default" ng-class="{\'btn-info\': dt.selected, active: isActive(dt)}" ng-click="select(dt.date)" ng-disabled="dt.disabled" tabindex="-1"><span ng-class="{\'text-info\': dt.current}">{{dt.label}}</span></button>\n      </td>\n    </tr>\n  </tbody>\n</table>\n')}]),angular.module("template/datepicker/popup.html",[]).run(["$templateCache",function(e){e.put("template/datepicker/popup.html",'<ul class="dropdown-menu" ng-style="{display: (isOpen && \'block\') || \'none\', top: position.top+\'px\', left: position.left+\'px\'}" ng-keydown="keydown($event)">\n\t<li ng-transclude></li>\n\t<li ng-if="showButtonBar" style="padding:10px 9px 2px">\n\t\t<span class="btn-group pull-left">\n\t\t\t<button type="button" class="btn btn-sm btn-info" ng-click="select(\'today\')">{{ getText(\'current\') }}</button>\n\t\t\t<button type="button" class="btn btn-sm btn-danger" ng-click="select(null)">{{ getText(\'clear\') }}</button>\n\t\t</span>\n\t\t<button type="button" class="btn btn-sm btn-success pull-right" ng-click="close()">{{ getText(\'close\') }}</button>\n\t</li>\n</ul>\n')}]),angular.module("template/datepicker/year.html",[]).run(["$templateCache",function(e){e.put("template/datepicker/year.html",'<table role="grid" aria-labelledby="{{uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n  <thead>\n    <tr>\n      <th><button type="button" class="btn btn-default btn-sm pull-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n      <th colspan="3"><button id="{{uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm" ng-click="toggleMode()" tabindex="-1" style="width:100%;"><strong>{{title}}</strong></button></th>\n      <th><button type="button" class="btn btn-default btn-sm pull-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr ng-repeat="row in rows track by $index">\n      <td ng-repeat="dt in row track by dt.date" class="text-center" role="gridcell" id="{{dt.uid}}" aria-disabled="{{!!dt.disabled}}">\n        <button type="button" style="width:100%;" class="btn btn-default" ng-class="{\'btn-info\': dt.selected, active: isActive(dt)}" ng-click="select(dt.date)" ng-disabled="dt.disabled" tabindex="-1"><span ng-class="{\'text-info\': dt.current}">{{dt.label}}</span></button>\n      </td>\n    </tr>\n  </tbody>\n</table>\n')}]),angular.module("template/popmoneydatepicker/datepicker.html",[]).run(["$templateCache",function(e){e.put("template/popmoneydatepicker/datepicker.html",'<div ng-switch="datepickerMode" role="application" ng-keydown="keydown($event)">\n  <popmoneydaypicker ng-switch-when="day" tabindex="0"></popmoneydaypicker>\n  <popmoneymonthpicker ng-switch-when="month" tabindex="0"></popmoneymonthpicker>\n  <popmoneyyearpicker ng-switch-when="year" tabindex="0"></popmoneyyearpicker>\n   <div style="padding-left: 4%;    margin-top: -33px;margin-bottom: 4%;">\n    <br>\n    <hr style="margin-bottom: 6px;">\n   <span style=" float:left;width:50%;margin-bottom: 0%;">\n      <span style="width: 100%;float: left;margin-top: 2%;font-size: 14px;"><span style="float: left;background: #2b85bb;margin-top: 0px;margin-right: 1%;border-radius: 10px;padding: 9px;"></span>Withdrawal Date</span>\n      </span> <span  style="width: 50%;float: left;margin-top: 1%;font-size: 14px;"><span style="float: left;margin-top: 0px;margin-right: 1%;border-radius: 13px;padding: 8px;border: 2px solid #2b85bb;"></span>Expected Delivery Date</span>\n    </br>\n  </span>\n    <hr style="margin-bottom: 11px;">\n <span style=" float:left;width:100%; margin-bottom: 5%;">\n      <span style="width: 50%;float: left;"><a style="margin-top: 4%;float: left;font-size: 17px;text-decoration: none;" ng-click="select(null)">Cancel</a></span><span style="width: 50%;float: left;"><button type="button" class="btn btn-primary primary" style="width:95%" ng-click="SaveWithdrawalDate()">Done</button></span></span>\n </span>\n   </div>\n</div>')}]),angular.module("template/popmoneydatepicker/day.html",[]).run(["$templateCache",function(e){e.put("template/popmoneydatepicker/day.html",'<table id="tableDay" role="grid" aria-labelledby="{{uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n  <thead>\n    <tr>\n      <th><button type="button" class="btn btn-default btn-sm pull-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n      <th colspan="{{5 + showWeeks}}"><button id="{{uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm" ng-click="toggleMode()" tabindex="-1" style="width:100%;"><strong>{{title}}</strong></button></th>\n      <th><button type="button" class="btn btn-default btn-sm pull-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n    </tr>\n    <tr>\n      <th ng-show="showWeeks" class="text-center"></th>\n      <th ng-repeat="label in labels track by $index" class="text-center"><small aria-label="{{label.full}}">{{label.abbr}}</small></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr ng-repeat="row in rows track by $index">\n      <td ng-show="showWeeks" class="text-center h6"><em>{{ weekNumbers[$index] }}</em></td>\n      <td ng-repeat="dt in row track by dt.date" class="text-center" role="gridcell" id="{{dt.uid}}" aria-disabled="{{!!dt.disabled}}">\n        <button type="button" style="width:100%;" class="btn btn-default btn-sm" ng-class="{\'btn-info\': dt.selected, active: isActive(dt),\'btn-delivery\':isExpectedDelivery(dt)}" ng-click="select(dt.date)" ng-disabled="dt.disabled" ng-hide="dt.secondary" tabindex="-1"><span ng-class="{\'text-muted\': dt.secondary, \'text-info\': dt.current}">{{dt.label}}</span></button>\n      </td>\n    </tr>\n  </tbody>\n</table>\n')}]),angular.module("template/popmoneydatepicker/month.html",[]).run(["$templateCache",function(e){e.put("template/popmoneydatepicker/month.html",'<table role="grid" aria-labelledby="{{uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n  <thead>\n    <tr>\n      <th><button type="button" class="btn btn-default btn-sm pull-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n      <th><button id="{{uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm" ng-click="toggleMode()" tabindex="-1" style="width:100%;"><strong>{{title}}</strong></button></th>\n      <th><button type="button" class="btn btn-default btn-sm pull-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr ng-repeat="row in rows track by $index">\n      <td ng-repeat="dt in row track by dt.date" class="text-center" role="gridcell" id="{{dt.uid}}" aria-disabled="{{!!dt.disabled}}">\n        <button type="button" style="width:100%;" class="btn btn-default" ng-class="{\'btn-info\': dt.selected, active: isActive(dt)}" ng-click="select(dt.date)" ng-disabled="dt.disabled" tabindex="-1"><span ng-class="{\'text-info\': dt.current}">{{dt.label}}</span></button>\n      </td>\n    </tr>\n  </tbody>\n</table>\n')}]),angular.module("template/popmoneydatepicker/popup.html",[]).run(["$templateCache",function(e){e.put("template/popmoneydatepicker/popup.html",'<ul class="dropdown-menu" ng-style="{display: (isOpen && \'block\') || \'none\', top: position.top+\'px\', left: position.left+\'px\'}" ng-keydown="keydown($event)">\n\t<li ng-transclude></li>\n\t<li ng-if="showButtonBar" style="padding:10px 9px 2px">\n\t\t<span class="btn-group pull-left">\n\t\t\t<button type="button" class="btn btn-sm btn-info" ng-click="select(\'today\')">{{ getText(\'current\') }}</button>\n\t\t\t<button type="button" class="btn btn-sm btn-danger" ng-click="select(null)">{{ getText(\'clear\') }}</button>\n\t\t</span>\n\t\t<button type="button" class="btn btn-sm btn-success pull-right" ng-click="close()">{{ getText(\'close\') }}</button>\n\t</li>\n</ul>\n')}]),angular.module("template/popmoneydatepicker/year.html",[]).run(["$templateCache",function(e){e.put("template/popmoneydatepicker/year.html",'<table role="grid" aria-labelledby="{{uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n  <thead>\n    <tr>\n      <th><button type="button" class="btn btn-default btn-sm pull-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n      <th colspan="3"><button id="{{uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm" ng-click="toggleMode()" tabindex="-1" style="width:100%;"><strong>{{title}}</strong></button></th>\n      <th><button type="button" class="btn btn-default btn-sm pull-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr ng-repeat="row in rows track by $index">\n      <td ng-repeat="dt in row track by dt.date" class="text-center" role="gridcell" id="{{dt.uid}}" aria-disabled="{{!!dt.disabled}}">\n        <button type="button" style="width:100%;" class="btn btn-default" ng-class="{\'btn-info\': dt.selected, active: isActive(dt)}" ng-click="select(dt.date)" ng-disabled="dt.disabled" tabindex="-1"><span ng-class="{\'text-info\': dt.current}">{{dt.label}}</span></button>\n      </td>\n    </tr>\n  </tbody>\n</table>\n')}]),angular.module("template/modal/backdrop.html",[]).run(["$templateCache",function(e){e.put("template/modal/backdrop.html",'<div class="modal-backdrop fade {{ backdropClass }}"\n     ng-class="{in: animate}"\n     ng-style="{\'z-index\': 1040 + (index && 1 || 0) + index*10}"\n></div>\n')}]),angular.module("template/modal/window.html",[]).run(["$templateCache",function(e){e.put("template/modal/window.html",'<div class="modal fade" ng-class="{in: animate}" ng-style="{\'z-index\': 100000 + index*10, display: \'block\'}" ng-click="close($event)">\n    <div class="modal-dialog" ng-class="{\'modal-sm\': size == \'sm\', \'modal-lg\': size == \'lg\'}"><div class="modal-content" modal-transclude></div></div>\n</div>')}]),angular.module("template/pagination/pager.html",[]).run(["$templateCache",function(e){e.put("template/pagination/pager.html",'<ul class="pager">\n  <li ng-class="{disabled: noPrevious(), previous: align}"><a href ng-click="selectPage(page - 1)">{{getText(\'previous\')}}</a></li>\n  <li ng-class="{disabled: noNext(), next: align}"><a href ng-click="selectPage(page + 1)">{{getText(\'next\')}}</a></li>\n</ul>')}]),angular.module("template/pagination/pagination.html",[]).run(["$templateCache",function(e){e.put("template/pagination/pagination.html",'<ul class="pagination">\n  <li ng-if="boundaryLinks" ng-class="{disabled: noPrevious()}"><a href ng-click="selectPage(1)">{{getText(\'first\')}}</a></li>\n  <li ng-if="directionLinks" ng-class="{disabled: noPrevious()}"><a href ng-click="selectPage(page - 1)">{{getText(\'previous\')}}</a></li>\n  <li ng-repeat="page in pages track by $index" ng-class="{active: page.active}"><a href ng-click="selectPage(page.number)">{{page.text}}</a></li>\n  <li ng-if="directionLinks" ng-class="{disabled: noNext()}"><a href ng-click="selectPage(page + 1)">{{getText(\'next\')}}</a></li>\n  <li ng-if="boundaryLinks" ng-class="{disabled: noNext()}"><a href ng-click="selectPage(totalPages)">{{getText(\'last\')}}</a></li>\n</ul>')}]),angular.module("template/tooltip/tooltip-html-unsafe-popup.html",[]).run(["$templateCache",function(e){e.put("template/tooltip/tooltip-html-unsafe-popup.html",'<div class="tooltip {{placement}}" ng-class="{ in: isOpen(), fade: animation() }">\n  <div class="tooltip-arrow"></div>\n  <div class="tooltip-inner" bind-html-unsafe="content"></div>\n</div>\n')}]),angular.module("template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(e){e.put("template/tooltip/tooltip-popup.html",'<div class="tooltip {{placement}}" ng-class="{ in: isOpen(), fade: animation() }">\n  <div class="tooltip-arrow"></div>\n  <div class="tooltip-inner" ng-bind="content"></div>\n</div>\n')}]),angular.module("template/popover/popover.html",[]).run(["$templateCache",function(e){e.put("template/popover/popover.html",'<div class="popover {{placement}}" ng-class="{ in: isOpen(), fade: animation() }">\n  <div class="arrow"></div>\n\n  <div class="popover-inner">\n      <h3 class="popover-title" ng-bind="title" ng-show="title"></h3>\n      <div class="popover-content" ng-bind="content"></div>\n  </div>\n</div>\n')}]),angular.module("template/progressbar/bar.html",[]).run(["$templateCache",function(e){e.put("template/progressbar/bar.html",'<div class="progress-bar" ng-class="type && \'progress-bar-\' + type" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="{{max}}" ng-style="{width: percent + \'%\'}" aria-valuetext="{{percent | number:0}}%" ng-transclude></div>')}]),angular.module("template/progressbar/progress.html",[]).run(["$templateCache",function(e){e.put("template/progressbar/progress.html",'<div class="progress" ng-transclude></div>')}]),angular.module("template/progressbar/progressbar.html",[]).run(["$templateCache",function(e){e.put("template/progressbar/progressbar.html",'<div class="progress">\n  <div class="progress-bar" ng-class="type && \'progress-bar-\' + type" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="{{max}}" ng-style="{width: percent + \'%\'}" aria-valuetext="{{percent | number:0}}%" ng-transclude></div>\n</div>')}]),angular.module("template/rating/rating.html",[]).run(["$templateCache",function(e){e.put("template/rating/rating.html",'<span ng-mouseleave="reset()" ng-keydown="onKeydown($event)" tabindex="0" role="slider" aria-valuemin="0" aria-valuemax="{{range.length}}" aria-valuenow="{{value}}">\n    <i ng-repeat="r in range track by $index" ng-mouseenter="enter($index + 1)" ng-click="rate($index + 1)" class="glyphicon" ng-class="$index < value && (r.stateOn || \'glyphicon-star\') || (r.stateOff || \'glyphicon-star-empty\')">\n        <span class="sr-only">({{ $index < value ? \'*\' : \' \' }})</span>\n    </i>\n</span>')}]),angular.module("template/tabs/tab.html",[]).run(["$templateCache",function(e){e.put("template/tabs/tab.html",'<li ng-class="{active: active, disabled: disabled}">\n  <a href ng-click="select()" tab-heading-transclude>{{heading}}</a>\n</li>\n')}]),angular.module("template/tabs/tabset.html",[]).run(["$templateCache",function(e){e.put("template/tabs/tabset.html",'<div>\n  <ul class="nav nav-{{type || \'tabs\'}}" ng-class="{\'nav-stacked\': vertical, \'nav-justified\': justified}" ng-transclude></ul>\n  <div class="tab-content">\n    <div class="tab-pane" \n         ng-repeat="tab in tabs" \n         ng-class="{active: tab.active}"\n         tab-content-transclude="tab">\n    </div>\n  </div>\n</div>\n')}]),angular.module("template/timepicker/timepicker.html",[]).run(["$templateCache",function(e){e.put("template/timepicker/timepicker.html",'<table>\n\t<tbody>\n\t\t<tr class="text-center">\n\t\t\t<td><a ng-click="incrementHours()" class="btn btn-link"><span class="glyphicon glyphicon-chevron-up"></span></a></td>\n\t\t\t<td>&nbsp;</td>\n\t\t\t<td><a ng-click="incrementMinutes()" class="btn btn-link"><span class="glyphicon glyphicon-chevron-up"></span></a></td>\n\t\t\t<td ng-show="showMeridian"></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style="width:50px;" class="form-group" ng-class="{\'has-error\': invalidHours}">\n\t\t\t\t<input type="text" ng-model="hours" ng-change="updateHours()" class="form-control text-center" ng-mousewheel="incrementHours()" ng-readonly="readonlyInput" maxlength="2">\n\t\t\t</td>\n\t\t\t<td>:</td>\n\t\t\t<td style="width:50px;" class="form-group" ng-class="{\'has-error\': invalidMinutes}">\n\t\t\t\t<input type="text" ng-model="minutes" ng-change="updateMinutes()" class="form-control text-center" ng-readonly="readonlyInput" maxlength="2">\n\t\t\t</td>\n\t\t\t<td ng-show="showMeridian"><button type="button" class="btn btn-default text-center" ng-click="toggleMeridian()">{{meridian}}</button></td>\n\t\t</tr>\n\t\t<tr class="text-center">\n\t\t\t<td><a ng-click="decrementHours()" class="btn btn-link"><span class="glyphicon glyphicon-chevron-down"></span></a></td>\n\t\t\t<td>&nbsp;</td>\n\t\t\t<td><a ng-click="decrementMinutes()" class="btn btn-link"><span class="glyphicon glyphicon-chevron-down"></span></a></td>\n\t\t\t<td ng-show="showMeridian"></td>\n\t\t</tr>\n\t</tbody>\n</table>\n')}]),angular.module("template/typeahead/typeahead-match.html",[]).run(["$templateCache",function(e){e.put("template/typeahead/typeahead-match.html",'<a tabindex="-1" bind-html-unsafe="match.label | typeaheadHighlight:query"></a>')}]),angular.module("template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function(e){e.put("template/typeahead/typeahead-popup.html",'<ul class="dropdown-menu" ng-show="isOpen()" ng-style="{top: position.top+\'px\', left: position.left+\'px\'}" style="display: block;" role="listbox" aria-hidden="{{!isOpen()}}">\n    <li ng-repeat="match in matches track by $index" ng-class="{active: isActive($index) }" ng-mouseenter="selectActive($index)" ng-click="selectMatch($index)" role="option" id="{{match.id}}">\n        <div typeahead-match index="$index" match="match" query="query" template-url="templateUrl"></div>\n    </li>\n</ul>\n')}]),"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(e,t,n){"use strict";var r,i=t.isDefined,o=t.isFunction,a=t.isString,s=t.isObject,c=t.isArray,u=t.forEach,l=t.extend,d=t.copy;function h(e,t){return l(new(l(function(){},{prototype:e})),t)}function p(e){return u(arguments,function(t){t!==e&&u(t,function(t,n){e.hasOwnProperty(n)||(e[n]=t)})}),e}function f(e){if(Object.keys)return Object.keys(e);var t=[];return u(e,function(e,n){t.push(n)}),t}function m(e,t){if(Array.prototype.indexOf)return e.indexOf(t,Number(arguments[2])||0);var n=e.length>>>0,r=Number(arguments[2])||0;for((r=r<0?Math.ceil(r):Math.floor(r))<0&&(r+=n);r<n;r++)if(r in e&&e[r]===t)return r;return-1}function g(e,t,n,r){var i,o=function(e,t){var n=[];for(var r in e.path){if(e.path[r]!==t.path[r])break;n.push(e.path[r])}return n}(n,r),a={},s=[];for(var c in o)if(o[c].params&&(i=f(o[c].params)).length)for(var u in i)m(s,i[u])>=0||(s.push(i[u]),a[i[u]]=e[i[u]]);return l({},a,t)}function v(e,t,n){if(!n)for(var r in n=[],e)n.push(r);for(var i=0;i<n.length;i++){var o=n[i];if(e[o]!=t[o])return!1}return!0}function y(e,t){var n={};return u(e,function(e){n[e]=t[e]}),n}function b(e){var t={},n=Array.prototype.concat.apply(Array.prototype,Array.prototype.slice.call(arguments,1));for(var r in e)-1==m(n,r)&&(t[r]=e[r]);return t}function A(e,t){var n=c(e),r=n?[]:{};return u(e,function(e,i){t(e,i)&&(r[n?r.length:i]=e)}),r}function _(e,t){var n=c(e)?[]:{};return u(e,function(e,r){n[r]=t(e,r)}),n}function S(e,t){var r=1,o=2,c={},d=[],h=c,g=l(e.when(c),{$$promises:c,$$values:c});this.study=function(c){if(!s(c))throw new Error("'invocables' must be an object");var v=f(c||{}),y=[],A=[],_={};function S(e){return s(e)&&e.then&&e.$$promises}return u(c,function e(n,i){if(_[i]!==o){if(A.push(i),_[i]===r)throw A.splice(0,m(A,i)),new Error("Cyclic dependency: "+A.join(" -> "));if(_[i]=r,a(n))y.push(i,[function(){return t.get(n)}],d);else{var s=t.annotate(n);u(s,function(t){t!==i&&c.hasOwnProperty(t)&&e(c[t],t)}),y.push(i,n,s)}A.pop(),_[i]=o}}),c=A=_=null,function(r,o,a){if(S(r)&&a===n&&(a=o,o=r,r=null),r){if(!s(r))throw new Error("'locals' must be an object")}else r=h;if(o){if(!S(o))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else o=g;var c=e.defer(),d=c.promise,f=d.$$promises={},m=l({},r),A=1+y.length/3,_=!1;function I(){--A||(_||p(m,o.$$values),d.$$values=m,d.$$promises=d.$$promises||!0,delete d.$$inheritedValues,c.resolve(m))}function w(e){d.$$failure=e,c.reject(e)}if(i(o.$$failure))return w(o.$$failure),d;o.$$inheritedValues&&p(m,b(o.$$inheritedValues,v)),l(f,o.$$promises),o.$$values?(_=p(m,b(o.$$values,v)),d.$$inheritedValues=b(o.$$values,v),I()):(o.$$inheritedValues&&(d.$$inheritedValues=b(o.$$inheritedValues,v)),o.then(I,w));for(var k=0,C=y.length;k<C;k+=3)r.hasOwnProperty(y[k])?I():E(y[k],y[k+1],y[k+2]);function E(n,o,s){var c=e.defer(),l=0;function h(e){c.reject(e),w(e)}function p(){if(!i(d.$$failure))try{c.resolve(t.invoke(o,a,m)),c.promise.then(function(e){m[n]=e,I()},h)}catch(e){h(e)}}u(s,function(e){f.hasOwnProperty(e)&&!r.hasOwnProperty(e)&&(l++,f[e].then(function(t){m[e]=t,--l||p()},h))}),l||p(),f[n]=c.promise}return d}},this.resolve=function(e,t,n,r){return this.study(e)(t,n,r)}}function I(e,t,n){this.fromConfig=function(e,t,n){return i(e.template)?this.fromString(e.template,t):i(e.templateUrl)?this.fromUrl(e.templateUrl,t):i(e.templateProvider)?this.fromProvider(e.templateProvider,t,n):null},this.fromString=function(e,t){return o(e)?e(t):e},this.fromUrl=function(n,r){return o(n)&&(n=n(r)),null==n?null:e.get(n,{cache:t,headers:{Accept:"text/html"}}).then(function(e){return e.data})},this.fromProvider=function(e,t,r){return n.invoke(e,null,r||{params:t})}}function w(e,t,i){t=l({params:{}},s(t)?t:{});var o,a,c,u,d=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,p=/([:]?)([\w\[\]-]+)|\{([\w\[\]-]+)(?:\:((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,f="^",m=0,g=this.segments=[],v=i?i.params:{},y=this.params=i?i.params.$$new():new r.ParamSet,b=[];function A(t,n,i,o){if(b.push(t),v[t])return v[t];if(!/^\w+(-+\w+)*(?:\[\])?$/.test(t))throw new Error("Invalid parameter name '"+t+"' in pattern '"+e+"'");if(y[t])throw new Error("Duplicate parameter name '"+t+"' in pattern '"+e+"'");return y[t]=new r.Param(t,n,i,o),y[t]}function _(e,t,n,r){var i=["",""],o=e.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&");if(!t)return o;switch(n){case!1:i=["(",")"+(r?"?":"")];break;case!0:i=["?(",")?"];break;default:i=["("+n+"|",")?"]}return o+i[0]+t+i[1]}function S(i,o){var a,s,c,u;return a=i[2]||i[3],u=t.params[a],c=e.substring(m,i.index),{id:a,regexp:s=o?i[4]:i[4]||("*"==i[1]?".*":null),segment:c,type:r.type(s||"string")||h(r.type("string"),{pattern:new RegExp(s,t.caseInsensitive?"i":n)}),cfg:u}}for(this.source=e;(o=d.exec(e))&&!((a=S(o,!1)).segment.indexOf("?")>=0);)c=A(a.id,a.type,a.cfg,"path"),f+=_(a.segment,c.type.pattern.source,c.squash,c.isOptional),g.push(a.segment),m=d.lastIndex;var I=(u=e.substring(m)).indexOf("?");if(I>=0){var w=this.sourceSearch=u.substring(I);if(u=u.substring(0,I),this.sourcePath=e.substring(0,m+I),w.length>0)for(m=0;o=p.exec(w);)c=A((a=S(o,!0)).id,a.type,a.cfg,"search"),m=d.lastIndex}else this.sourcePath=e,this.sourceSearch="";f+=_(u)+(!1===t.strict?"/?":"")+"$",g.push(u),this.regexp=new RegExp(f,t.caseInsensitive?"i":n),this.prefix=g[0],this.$$paramNames=b}function k(e){l(this,e)}function C(e,r){var s,u=[],d=null,h=!1;function p(e,t,n){if(!n)return!1;var r=e.invoke(t,t,{$match:n});return!i(r)||r}function f(r,i,o,c){var l,p=c.baseHref(),f=r.url();function m(e){if(!e||!e.defaultPrevented){l&&r.url();l=n;var t,i=u.length;for(t=0;t<i;t++)if(s(u[t]))return;d&&s(d)}function s(e){var t=e(o,r);return!!t&&(a(t)&&r.replace().url(t),!0)}}function g(){return s=s||i.$on("$locationChangeSuccess",m)}return h||g(),{sync:function(){m()},listen:function(){return g()},update:function(e){e?f=r.url():r.url()!==f&&(r.url(f),r.replace())},push:function(e,t,i){var o=e.format(t||{});null!==o&&t&&t["#"]&&(o+="#"+t["#"]),r.url(o),l=i&&i.$$avoidResync?r.url():n,i&&i.replace&&r.replace()},href:function(n,i,o){if(!n.validates(i))return null;var a=e.html5Mode();t.isObject(a)&&(a=a.enabled);var s=n.format(i);if(o=o||{},a||null===s||(s="#"+e.hashPrefix()+s),null!==s&&i&&i["#"]&&(s+="#"+i["#"]),s=function(e,t,n){return"/"===p?e:t?p.slice(0,-1)+e:n?p.slice(1)+e:e}(s,a,o.absolute),!o.absolute||!s)return s;var c=!a&&s?"/":"",u=r.port();return u=80===u||443===u?"":":"+u,[r.protocol(),"://",r.host(),u,c,s].join("")}}}this.rule=function(e){if(!o(e))throw new Error("'rule' must be a function");return u.push(e),this},this.otherwise=function(e){if(a(e)){var t=e;e=function(){return t}}else if(!o(e))throw new Error("'rule' must be a function");return d=e,this},this.when=function(e,t){var n,i=a(t);if(a(e)&&(e=r.compile(e)),!i&&!o(t)&&!c(t))throw new Error("invalid 'handler' in when()");var s={matcher:function(e,t){return i&&(n=r.compile(t),t=["$match",function(e){return n.format(e)}]),l(function(n,r){return p(n,t,e.exec(r.path(),r.search()))},{prefix:a(e.prefix)?e.prefix:""})},regex:function(e,t){if(e.global||e.sticky)throw new Error("when() RegExp must not be global or sticky");return i&&(n=t,t=["$match",function(e){return t=e,n.replace(/\$(\$|\d{1,2})/,function(e,n){return t["$"===n?0:Number(n)]});var t}]),l(function(n,r){return p(n,t,e.exec(r.path()))},{prefix:(r=e,o=/^\^((?:\\[^a-zA-Z0-9]|[^\\\[\]\^$*+?.()|{}]+)*)/.exec(r.source),null!=o?o[1].replace(/\\(.)/g,"$1"):"")});var r,o}},u={matcher:r.isMatcher(e),regex:e instanceof RegExp};for(var d in u)if(u[d])return this.rule(s[d](e,t));throw new Error("invalid 'what' in when()")},this.deferIntercept=function(e){e===n&&(e=!0),h=e},this.$get=f,f.$inject=["$location","$rootScope","$injector","$browser"]}function E(e,p){var b,A,S={},I={},w="abstract",k={parent:function(e){if(i(e.parent)&&e.parent)return C(e.parent);var t=/^(.+)\.[^.]+$/.exec(e.name);return t?C(t[1]):b},data:function(e){return e.parent&&e.parent.data&&(e.data=e.self.data=l({},e.parent.data,e.data)),e.data},url:function(e){var t=e.url,n={params:e.params||{}};if(a(t))return"^"==t.charAt(0)?p.compile(t.substring(1),n):(e.parent.navigable||b).url.concat(t,n);if(!t||p.isMatcher(t))return t;throw new Error("Invalid url '"+t+"' in state '"+e+"'")},navigable:function(e){return e.url?e:e.parent?e.parent.navigable:null},ownParams:function(e){var t=e.url&&e.url.params||new r.ParamSet;return u(e.params||{},function(e,n){t[n]||(t[n]=new r.Param(n,null,e,"config"))}),t},params:function(e){return e.parent&&e.parent.params?l(e.parent.params.$$new(),e.ownParams):new r.ParamSet},views:function(e){var t={};return u(i(e.views)?e.views:{"":e},function(n,r){r.indexOf("@")<0&&(r+="@"+e.parent.name),t[r]=n}),t},path:function(e){return e.parent?e.parent.path.concat(e):[]},includes:function(e){var t=e.parent?l({},e.parent.includes):{};return t[e.name]=!0,t},$delegates:{}};function C(e,t){if(!e)return n;var r,i=a(e),o=i?e:e.name;if(0===(r=o).indexOf(".")||0===r.indexOf("^")){if(!t)throw new Error("No reference point given for path '"+o+"'");t=C(t);for(var s=o.split("."),c=0,u=s.length,l=t;c<u;c++)if(""!==s[c]||0!==c){if("^"!==s[c])break;if(!l.parent)throw new Error("Path '"+o+"' not valid for state '"+t.name+"'");l=l.parent}else l=t;s=s.slice(c).join("."),o=l.name+(l.name&&s?".":"")+s}var d=S[o];return!d||!i&&(i||d!==e&&d.self!==e)?n:d}function E(t){var n=(t=h(t,{self:t,resolve:t.resolve||{},toString:function(){return this.name}})).name;if(!a(n)||n.indexOf("@")>=0)throw new Error("State must have a valid name");if(S.hasOwnProperty(n))throw new Error("State '"+n+"'' is already defined");var r=-1!==n.indexOf(".")?n.substring(0,n.lastIndexOf(".")):a(t.parent)?t.parent:s(t.parent)&&a(t.parent.name)?t.parent.name:"";if(r&&!S[r])return function(e,t){I[e]||(I[e]=[]),I[e].push(t)}(r,t.self);for(var i in k)o(k[i])&&(t[i]=k[i](t,k.$delegates[i]));return S[n]=t,!t[w]&&t.url&&e.when(t.url,["$match","$stateParams",function(e,n){A.$current.navigable==t&&v(e,n)||A.transitionTo(t,e,{inherit:!0,location:!1})}]),function(e){for(var t=I[e]||[];t.length;)E(t.shift())}(n),t}function P(e,p,I,k,E,P,T,R,D){var x=p.reject(new Error("transition superseded")),L=p.reject(new Error("transition prevented")),M=p.reject(new Error("transition aborted")),F=p.reject(new Error("transition failed"));function O(e,n,r,i,a,s){var l=r?n:y(e.params.$$keys(),n),d={$stateParams:l};a.resolve=E.resolve(e.resolve,d,a.resolve,e);var h=[a.resolve.then(function(e){a.globals=e})];return i&&h.push(i),p.all(h).then(function(){var n=[];return u(e.views,function(r,i){var u=r.resolve&&r.resolve!==e.resolve?r.resolve:{};u.$template=[function(){return I.load(i,{view:r,locals:a.globals,params:l,notify:s.notify})||""}],n.push(E.resolve(u,a.globals,a.resolve,e).then(function(n){if(o(r.controllerProvider)||c(r.controllerProvider)){var s=t.extend({},u,a.globals);n.$$controller=k.invoke(r.controllerProvider,null,s)}else n.$$controller=r.controller;n.$$state=e,n.$$controllerAs=r.controllerAs,a[i]=n}))}),p.all(n).then(function(){return a.globals})}).then(function(e){return a})}return b.locals={resolve:null,globals:{$stateParams:{}}},(A={params:{},current:b.self,$current:b,transition:null}).reload=function(e){return A.transitionTo(A.current,P,{reload:e||!0,inherit:!1,notify:!0})},A.go=function(e,t,n){return A.transitionTo(e,t,l({inherit:!0,relative:A.$current},n))},A.transitionTo=function(t,n,o){n=n||{},o=l({location:!0,inherit:!1,relative:null,notify:!0,reload:!1,$retry:!1},o||{});var c=A.$current,f=A.params,m=c.path,v=C(t,o.relative),_=n["#"];if(!i(v)){var S={to:t,toParams:n,options:o},I=function(t,n,r,i){var o=e.$broadcast("$stateNotFound",t,n,r);if(o.defaultPrevented)return T.update(),M;if(!o.retry)return null;if(i.$retry)return T.update(),F;var a=A.transition=p.when(o.retry);return a.then(function(){return a!==A.transition?x:(t.options.$retry=!0,A.transitionTo(t.to,t.toParams,t.options))},function(){return M}),T.update(),a}(S,c.self,f,o);if(I)return I;if(n=S.toParams,v=C(t=S.to,(o=S.options).relative),!i(v)){if(!o.relative)throw new Error("No such state '"+t+"'");throw new Error("Could not resolve '"+t+"' from state '"+o.relative+"'")}}if(v[w])throw new Error("Cannot transition to abstract state '"+t+"'");if(o.inherit&&(n=g(P,n||{},A.$current,v)),!v.params.$$validates(n))return F;n=v.params.$$values(n);var E=(t=v).path,R=0,D=E[R],N=b.locals,H=[];if(o.reload){if(a(o.reload)||s(o.reload)){if(s(o.reload)&&!o.reload.name)throw new Error("Invalid reload state object");var B=!0===o.reload?m[0]:C(o.reload);if(o.reload&&!B)throw new Error("No such reload state '"+(a(o.reload)?o.reload:o.reload.name)+"'");for(;D&&D===m[R]&&D!==B;)N=H[R]=D.locals,D=E[++R]}}else for(;D&&D===m[R]&&D.ownParams.$$equals(n,f);)N=H[R]=D.locals,D=E[++R];if(function(e,t,n,i,o,a){if(!a.reload&&e===n&&(o===n.locals||!1===e.self.reloadOnSearch&&function(e,t,n){var i=e.params.$$keys().filter(function(t){return"search"!=e.params[t].location}),o=function(e){var t={},n=Array.prototype.concat.apply(Array.prototype,Array.prototype.slice.call(arguments,1));return u(n,function(n){n in e&&(t[n]=e[n])}),t}.apply({},[e.params].concat(i));return new r.ParamSet(o).$$equals(t,n)}(n,i,t)))return!0}(t,n,c,f,N,o))return _&&(n["#"]=_),A.params=n,d(A.params,P),o.location&&t.navigable&&t.navigable.url&&(T.push(t.navigable.url,n,{$$avoidResync:!0,replace:"replace"===o.location}),T.update(!0)),A.transition=null,p.when(A.current);if(n=y(t.params.$$keys(),n||{}),o.notify&&e.$broadcast("$stateChangeStart",t.self,n,c.self,f).defaultPrevented)return e.$broadcast("$stateChangeCancel",t.self,n,c.self,f),T.update(),L;for(var U=p.when(N),q=R;q<E.length;D=E[++q])N=H[q]=h(N),U=O(D,n,D===t,U,N,o);var K=A.transition=U.then(function(){var r,i,a;if(A.transition!==K)return x;for(r=m.length-1;r>=R;r--)(a=m[r]).self.onExit&&k.invoke(a.self.onExit,a.self,a.locals.globals),a.locals=null;for(r=R;r<E.length;r++)(i=E[r]).locals=H[r],i.self.onEnter&&k.invoke(i.self.onEnter,i.self,i.locals.globals);return _&&(n["#"]=_),A.transition!==K?x:(A.$current=t,A.current=t.self,A.params=n,d(A.params,P),A.transition=null,o.location&&t.navigable&&T.push(t.navigable.url,t.navigable.locals.globals.$stateParams,{$$avoidResync:!0,replace:"replace"===o.location}),o.notify&&e.$broadcast("$stateChangeSuccess",t.self,n,c.self,f),T.update(!0),A.current)},function(r){return A.transition!==K?x:(A.transition=null,e.$broadcast("$stateChangeError",t.self,n,c.self,f,r).defaultPrevented||T.update(),p.reject(r))});return K},A.is=function(e,t,r){var o=C(e,(r=l({relative:A.$current},r||{})).relative);return i(o)?A.$current===o&&(!t||v(o.params.$$values(t),P)):n},A.includes=function(e,t,r){if(r=l({relative:A.$current},r||{}),a(e)&&e.indexOf("*")>-1){if(!function(e){for(var t=e.split("."),n=A.$current.name.split("."),r=0,i=t.length;r<i;r++)"*"===t[r]&&(n[r]="*");return"**"===t[0]&&(n=n.slice(m(n,t[1]))).unshift("**"),"**"===t[t.length-1]&&(n.splice(m(n,t[t.length-2])+1,Number.MAX_VALUE),n.push("**")),t.length==n.length&&n.join("")===t.join("")}(e))return!1;e=A.$current.name}var o=C(e,r.relative);return i(o)?!!i(A.$current.includes[o.name])&&(!t||v(o.params.$$values(t),P,f(t))):n},A.href=function(e,t,r){var o=C(e,(r=l({lossy:!0,inherit:!0,absolute:!1,relative:A.$current},r||{})).relative);if(!i(o))return null;r.inherit&&(t=g(P,t||{},A.$current,o));var a=o&&r.lossy?o.navigable:o;return a&&a.url!==n&&null!==a.url?T.href(a.url,y(o.params.$$keys().concat("#"),t||{}),{absolute:r.absolute}):null},A.get=function(e,t){if(0===arguments.length)return _(f(S),function(e){return S[e].self});var n=C(e,t||A.$current);return n&&n.self?n.self:null},A}(b=E({name:"",url:"^",views:null,abstract:!0})).navigable=null,this.decorator=function(e,t){if(a(e)&&!i(t))return k[e];if(!o(t)||!a(e))return this;k[e]&&!k.$delegates[e]&&(k.$delegates[e]=k[e]);return k[e]=t,this},this.state=function(e,t){s(e)?t=e:t.name=e;return E(t),this},this.$get=P,P.$inject=["$rootScope","$q","$view","$injector","$resolve","$stateParams","$urlRouter","$location","$urlMatcherFactory"]}function P(){function e(e,t){return{load:function(n,r){var i;return(r=l({template:null,controller:null,view:null,locals:null,notify:!0,async:!0,params:{}},r)).view&&(i=t.fromConfig(r.view,r.params,r.locals)),i&&r.notify&&e.$broadcast("$viewContentLoading",r),i}}}this.$get=e,e.$inject=["$rootScope","$templateFactory"]}function T(e,n,r,i){var o=n.has?function(e){return n.has(e)?n.get(e):null}:function(e){try{return n.get(e)}catch(e){return null}},a=o("$animator"),s=o("$animate");return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(n,o,c){return function(n,o,u){var l,d,h,p,f=u.onload||"",m=u.autoscroll,g=function(e,t){if(s)return{enter:function(e,t,n){var r=s.enter(e,null,t,n);r&&r.then&&r.then(n)},leave:function(e,t){var n=s.leave(e,t);n&&n.then&&n.then(t)}};if(a){var n=a&&a(t,e);return{enter:function(e,t,r){n.enter(e,null,t),r()},leave:function(e,t){n.leave(e),t()}}}return{enter:function(e,t,n){t.after(e),n()},leave:function(e,t){e.remove(),t()}}}(u,n);function v(a){var s,v=D(n,u,o,i),y=v&&e.$current&&e.$current.locals[v];if(a||y!==p){s=n.$new(),p=e.$current.locals[v];var b=c(s,function(e){g.enter(e,o,function(){h&&h.$emit("$viewContentAnimationEnded"),(t.isDefined(m)&&!m||n.$eval(m))&&r(e)}),l&&(l.remove(),l=null),h&&(h.$destroy(),h=null),d&&(g.leave(d,function(){l=null}),l=d,d=null)});d=b,(h=s).$emit("$viewContentLoaded"),h.$eval(f)}}n.$on("$stateChangeSuccess",function(){v(!1)}),n.$on("$viewContentLoading",function(){v(!1)}),v(!0)}}}}function R(e,t,n,r){return{restrict:"ECA",priority:-400,compile:function(i){var o=i.html();return function(i,a,s){var c=n.$current,u=D(i,s,a,r),l=c&&c.locals[u];if(l){a.data("$uiView",{name:u,state:l.$$state}),a.html(l.$template?l.$template:o);var d=e(a.contents());if(l.$$controller){l.$scope=i,l.$element=a;var h=t(l.$$controller,l);l.$$controllerAs&&(i[l.$$controllerAs]=h),a.data("$ngControllerController",h),a.children().data("$ngControllerController",h)}d(i)}}}}}function D(e,t,n,r){var i=r(t.uiView||t.name||"")(e),o=n.inheritedData("$uiView");return i.indexOf("@")>=0?i:i+"@"+(o?o.state.name:"")}function x(e){var t=e.parent().inheritedData("$uiView");if(t&&t.state&&t.state.name)return t.state}function L(e,n){var r=["location","inherit","reload","absolute"];return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(i,o,a,s){var c=function(e,t){var n,r=e.match(/^\s*({[^}]*})\s*$/);if(r&&(e=t+"("+r[1]+")"),!(n=e.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/))||4!==n.length)throw new Error("Invalid state ref '"+e+"'");return{state:n[1],paramExpr:n[3]||null}}(a.uiSref,e.current.name),u=null,l=x(o)||e.$current,d="[object SVGAnimatedString]"===Object.prototype.toString.call(o.prop("href"))?"xlink:href":"href",h=null,p="A"===o.prop("tagName").toUpperCase(),f="FORM"===o[0].nodeName,m=f?"action":d,g=!0,v={relative:l,inherit:!0},y=i.$eval(a.uiSrefOpts)||{};t.forEach(r,function(e){e in y&&(v[e]=y[e])});var b=function(n){if(n&&(u=t.copy(n)),g){h=e.href(c.state,u,v);var r=s[1]||s[0];if(r&&r.$$addStateInfo(c.state,u),null===h)return g=!1,!1;a.$set(m,h)}};c.paramExpr&&(i.$watch(c.paramExpr,function(e,t){e!==u&&b(e)},!0),u=t.copy(i.$eval(c.paramExpr))),b(),f||o.bind("click",function(t){if(!((t.which||t.button)>1||t.ctrlKey||t.metaKey||t.shiftKey||o.attr("target"))){var r=n(function(){e.go(c.state,u,v)});t.preventDefault();var i=p&&!h?1:0;t.preventDefault=function(){i--<=0&&n.cancel(r)}}})}}}function M(e,t,n){return{restrict:"A",controller:["$scope","$element","$attrs",function(t,r,i){var o,a=[];function s(){!function(){for(var e=0;e<a.length;e++)if(c(a[e].state,a[e].params))return!0;return!1}()?r.removeClass(o):r.addClass(o)}function c(t,n){return void 0!==i.uiSrefActiveEq?e.is(t.name,n):e.includes(t.name,n)}o=n(i.uiSrefActiveEq||i.uiSrefActive||"",!1)(t),this.$$addStateInfo=function(t,n){var i=e.get(t,x(r));a.push({state:i||{name:t},params:n}),s()},t.$on("$stateChangeSuccess",s)}]}}function F(e){var t=function(t){return e.is(t)};return t.$stateful=!0,t}function O(e){var t=function(t){return e.includes(t)};return t.$stateful=!0,t}t.module("ui.router.util",["ng"]),t.module("ui.router.router",["ui.router.util"]),t.module("ui.router.state",["ui.router.router","ui.router.util"]),t.module("ui.router",["ui.router.state"]),t.module("ui.router.compat",["ui.router"]),S.$inject=["$q","$injector"],t.module("ui.router.util").service("$resolve",S),I.$inject=["$http","$templateCache","$injector"],t.module("ui.router.util").service("$templateFactory",I),w.prototype.concat=function(e,t){var n={caseInsensitive:r.caseInsensitive(),strict:r.strictMode(),squash:r.defaultSquashPolicy()};return new w(this.sourcePath+e+this.sourceSearch,l(n,t),this)},w.prototype.toString=function(){return this.source},w.prototype.exec=function(e,t){var n=this.regexp.exec(e);if(!n)return null;t=t||{};var r,i,o,a=this.parameters(),s=a.length,c=this.segments.length-1,u={};if(c!==n.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");function l(e){function t(e){return e.split("").reverse().join("")}return _(_(t(e).split(/-(?!\\)/),t),function(e){return e.replace(/\\-/g,"-")}).reverse()}for(r=0;r<c;r++){o=a[r];var d=this.params[o],h=n[r+1];for(i=0;i<d.replace;i++)d.replace[i].from===h&&(h=d.replace[i].to);h&&!0===d.array&&(h=l(h)),u[o]=d.value(h)}for(;r<s;r++)u[o=a[r]]=this.params[o].value(t[o]);return u},w.prototype.parameters=function(e){return i(e)?this.params[e]||null:this.$$paramNames},w.prototype.validates=function(e){return this.params.$$validates(e)},w.prototype.format=function(e){e=e||{};var t=this.segments,n=this.parameters(),r=this.params;if(!this.validates(e))return null;var i,o=!1,s=t.length-1,u=n.length,l=t[0];function d(e){return encodeURIComponent(e).replace(/-/g,function(e){return"%5C%"+e.charCodeAt(0).toString(16).toUpperCase()})}for(i=0;i<u;i++){var h=i<s,p=n[i],f=r[p],m=f.value(e[p]),g=f.isOptional&&f.type.equals(f.value(),m),v=!!g&&f.squash,y=f.type.encode(m);if(h){var b=t[i+1];if(!1===v)null!=y&&(c(y)?l+=_(y,d).join("-"):l+=encodeURIComponent(y)),l+=b;else if(!0===v){var A=l.match(/\/$/)?/\/?(.*)/:/(.*)/;l+=b.match(A)[1]}else a(v)&&(l+=v+b)}else{if(null==y||g&&!1!==v)continue;c(y)||(y=[y]),y=_(y,encodeURIComponent).join("&"+p+"="),l+=(o?"&":"?")+p+"="+y,o=!0}}return l},k.prototype.is=function(e,t){return!0},k.prototype.encode=function(e,t){return e},k.prototype.decode=function(e,t){return e},k.prototype.equals=function(e,t){return e==t},k.prototype.$subPattern=function(){var e=this.pattern.toString();return e.substr(1,e.length-2)},k.prototype.pattern=/.*/,k.prototype.toString=function(){return"{Type:"+this.name+"}"},k.prototype.$normalize=function(e){return this.is(e)?e:this.decode(e)},k.prototype.$asArray=function(e,t){if(!e)return this;if("auto"===e&&!t)throw new Error("'auto' array mode is for query parameters only");return new function(e,t){function r(e,t){return function(){return e[t].apply(e,arguments)}}function o(e){return c(e)?e:i(e)?[e]:[]}function a(e){return!e}function s(e,r){return function(i){var s=_(i=o(i),e);return!0===r?0===A(s,a).length:function(e){switch(e.length){case 0:return n;case 1:return"auto"===t?e[0]:e;default:return e}}(s)}}var u;this.encode=s(r(e,"encode")),this.decode=s(r(e,"decode")),this.is=s(r(e,"is"),!0),this.equals=(u=r(e,"equals"),function(e,t){var n=o(e),r=o(t);if(n.length!==r.length)return!1;for(var i=0;i<n.length;i++)if(!u(n[i],r[i]))return!1;return!0}),this.pattern=e.pattern,this.$normalize=s(r(e,"$normalize")),this.name=e.name,this.$arrayMode=t}(this,e)},t.module("ui.router.util").provider("$urlMatcherFactory",function e(){r=this;var d=!1,p=!0,g=!1;function v(e){return null!=e?e.toString().replace(/\//g,"%2F"):e}var y,b={},S=!0,I=[],C={string:{encode:v,decode:function(e){return null!=e?e.toString().replace(/%2F/g,"/"):e},is:function(e){return null==e||!i(e)||"string"==typeof e},pattern:/[^/]*/},int:{encode:v,decode:function(e){return parseInt(e,10)},is:function(e){return i(e)&&this.decode(e.toString())===e},pattern:/\d+/},bool:{encode:function(e){return e?1:0},decode:function(e){return 0!==parseInt(e,10)},is:function(e){return!0===e||!1===e},pattern:/0|1/},date:{encode:function(e){return this.is(e)?[e.getFullYear(),("0"+(e.getMonth()+1)).slice(-2),("0"+e.getDate()).slice(-2)].join("-"):n},decode:function(e){if(this.is(e))return e;var t=this.capture.exec(e);return t?new Date(t[1],t[2]-1,t[3]):n},is:function(e){return e instanceof Date&&!isNaN(e.valueOf())},equals:function(e,t){return this.is(e)&&this.is(t)&&e.toISOString()===t.toISOString()},pattern:/[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,capture:/([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/},json:{encode:t.toJson,decode:t.fromJson,is:t.isObject,equals:t.equals,pattern:/[^/]*/},any:{encode:t.identity,decode:t.identity,equals:t.equals,pattern:/.*/}};function E(e){return o(e)||c(e)&&o(e[e.length-1])}function P(){for(;I.length;){var e=I.shift();if(e.pattern)throw new Error("You cannot override a type's .pattern at runtime.");t.extend(b[e.name],y.invoke(e.def))}}function T(e){l(this,e||{})}e.$$getDefaultValue=function(e){if(!E(e.value))return e.value;if(!y)throw new Error("Injectable functions cannot be called at configuration time");return y.invoke(e.value)},this.caseInsensitive=function(e){return i(e)&&(d=e),d},this.strictMode=function(e){return i(e)&&(p=e),p},this.defaultSquashPolicy=function(e){if(!i(e))return g;if(!0!==e&&!1!==e&&!a(e))throw new Error("Invalid squash policy: "+e+". Valid policies: false, true, arbitrary-string");return g=e,e},this.compile=function(e,t){return new w(e,l({strict:p,caseInsensitive:d},t))},this.isMatcher=function(e){if(!s(e))return!1;var t=!0;return u(w.prototype,function(n,r){o(n)&&(t=t&&i(e[r])&&o(e[r]))}),t},this.type=function(e,t,n){if(!i(t))return b[e];if(b.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return b[e]=new k(l({name:e},t)),n&&(I.push({name:e,def:n}),S||P()),this},u(C,function(e,t){b[t]=new k(l({name:t},e))}),b=h(b,{}),this.$get=["$injector",function(e){return y=e,S=!1,P(),u(C,function(e,t){b[t]||(b[t]=new k(e))}),this}],this.Param=function(e,t,r,o){var u=this;r=function(e){var t=s(e)?f(e):[];return-1===m(t,"value")&&-1===m(t,"type")&&-1===m(t,"squash")&&-1===m(t,"array")&&(e={value:e}),e.$$fn=E(e.value)?e.value:function(){return e.value},e}(r),t=function(t,n,r){if(t.type&&n)throw new Error("Param '"+e+"' has two type configurations.");return n||(t.type?t.type instanceof k?t.type:new k(t.type):"config"===r?b.any:b.string)}(r,t,o);var d,h,p=(d={array:"search"===o&&"auto"},h=e.match(/\[\]$/)?{array:!0}:{},l(d,h,r).array);"string"!==(t=p?t.$asArray(p,"search"===o):t).name||p||"path"!==o||r.value!==n||(r.value="");var v=r.value!==n,S=function(e,t){var n=e.squash;if(!t||!1===n)return!1;if(!i(n)||null==n)return g;if(!0===n||a(n))return n;throw new Error("Invalid squash policy: '"+n+"'. Valid policies: false, true, or arbitrary string")}(r,v),I=function(e,t,r,i){var o,s,u=[{from:"",to:r||t?n:""},{from:null,to:r||t?n:""}];return o=c(e.replace)?e.replace:[],a(i)&&o.push({from:i,to:n}),s=_(o,function(e){return e.from}),A(u,function(e){return-1===m(s,e.from)}).concat(o)}(r,p,v,S);l(this,{id:e,type:t,location:o,array:p,squash:S,replace:I,isOptional:v,value:function(e){return e=function(e){var t,n=_(A(u.replace,(t=e,function(e){return e.from===t})),function(e){return e.to});return n.length?n[0]:e}(e),i(e)?u.type.$normalize(e):function(){if(!y)throw new Error("Injectable functions cannot be called at configuration time");var e=y.invoke(r.$$fn);if(null!==e&&e!==n&&!u.type.is(e))throw new Error("Default value ("+e+") for parameter '"+u.id+"' is not an instance of Type ("+u.type.name+")");return e}()},dynamic:n,config:r,toString:function(){return"{Param:"+e+" "+t+" squash: '"+S+"' optional: "+v+"}"}})},T.prototype={$$new:function(){return h(this,l(new T,{$$parent:this}))},$$keys:function(){for(var e=[],t=[],n=this,r=f(T.prototype);n;)t.push(n),n=n.$$parent;return t.reverse(),u(t,function(t){u(f(t),function(t){-1===m(e,t)&&-1===m(r,t)&&e.push(t)})}),e},$$values:function(e){var t={},n=this;return u(n.$$keys(),function(r){t[r]=n[r].value(e&&e[r])}),t},$$equals:function(e,t){var n=!0,r=this;return u(r.$$keys(),function(i){var o=e&&e[i],a=t&&t[i];r[i].type.equals(o,a)||(n=!1)}),n},$$validates:function(e){var r,i,o,a,s,c=this.$$keys();for(r=0;r<c.length&&(i=this[c[r]],(o=e[c[r]])!==n&&null!==o||!i.isOptional);r++){if(a=i.type.$normalize(o),!i.type.is(a))return!1;if(s=i.type.encode(a),t.isString(s)&&!i.type.pattern.exec(s))return!1}return!0},$$parent:n},this.ParamSet=T}),t.module("ui.router.util").run(["$urlMatcherFactory",function(e){}]),C.$inject=["$locationProvider","$urlMatcherFactoryProvider"],t.module("ui.router.router").provider("$urlRouter",C),E.$inject=["$urlRouterProvider","$urlMatcherFactoryProvider"],t.module("ui.router.state").value("$stateParams",{}).provider("$state",E),P.$inject=[],t.module("ui.router.state").provider("$view",P),t.module("ui.router.state").provider("$uiViewScroll",function(){var e=!1;this.useAnchorScroll=function(){e=!0},this.$get=["$anchorScroll","$timeout",function(t,n){return e?t:function(e){return n(function(){e[0].scrollIntoView()},0,!1)}}]}),T.$inject=["$state","$injector","$uiViewScroll","$interpolate"],R.$inject=["$compile","$controller","$state","$interpolate"],t.module("ui.router.state").directive("uiView",T),t.module("ui.router.state").directive("uiView",R),L.$inject=["$state","$timeout"],M.$inject=["$state","$stateParams","$interpolate"],t.module("ui.router.state").directive("uiSref",L).directive("uiSrefActive",M).directive("uiSrefActiveEq",M),F.$inject=["$state"],O.$inject=["$state"],t.module("ui.router.state").filter("isState",F).filter("includedByState",O)}(window,window.angular),function(e,t,n){"use strict";t.module("ngAria",["ng"]).provider("$aria",function(){var e={ariaHidden:!0,ariaChecked:!0,ariaDisabled:!0,ariaRequired:!0,ariaInvalid:!0,ariaMultiline:!0,ariaValue:!0,tabindex:!0,bindKeypress:!0};function n(t,n,r){return function(i,o,a){var s=a.$normalize(n);e[s]&&!a[s]&&i.$watch(a[t],function(e){r&&(e=!e),o.attr(n,e)})}}this.config=function(n){e=t.extend(e,n)},this.$get=function(){return{config:function(t){return e[t]},$$watchExpr:n}}}).directive("ngShow",["$aria",function(e){return e.$$watchExpr("ngShow","aria-hidden",!0)}]).directive("ngHide",["$aria",function(e){return e.$$watchExpr("ngHide","aria-hidden",!1)}]).directive("ngModel",["$aria",function(e){function t(t,n,r){return e.config(n)&&!r.attr(t)}function n(e,t){return!t.attr("role")&&t.attr("type")===e&&"INPUT"!==t[0].nodeName}return{restrict:"A",require:"?ngModel",priority:200,compile:function(r,i){var o=function(e,t){var n=e.type,r=e.role;return"checkbox"===(n||r)||"menuitemcheckbox"===r?"checkbox":"radio"===(n||r)||"menuitemradio"===r?"radio":"range"===n||"progressbar"===r||"slider"===r?"range":"textbox"===(n||r)||"TEXTAREA"===t[0].nodeName?"multiline":""}(i,r);return{pre:function(e,t,n,r){"checkbox"===o&&"checkbox"!==n.type&&(r.$isEmpty=function(e){return!1===e})},post:function(r,i,a,s){var c=t("tabindex","tabindex",i);function u(){return s.$modelValue}switch(o){case"radio":case"checkbox":n(o,i)&&i.attr("role",o),t("aria-checked","ariaChecked",i)&&r.$watch(u,"radio"===o?c?(c=!1,function(e){var t=a.value==s.$viewValue;i.attr("aria-checked",t),i.attr("tabindex",0-!t)}):function(e){i.attr("aria-checked",a.value==s.$viewValue)}:function(){i.attr("aria-checked",!s.$isEmpty(s.$viewValue))});break;case"range":n(o,i)&&i.attr("role","slider"),e.config("ariaValue")&&(a.min&&!i.attr("aria-valuemin")&&i.attr("aria-valuemin",a.min),a.max&&!i.attr("aria-valuemax")&&i.attr("aria-valuemax",a.max),i.attr("aria-valuenow")||r.$watch(u,function(e){i.attr("aria-valuenow",e)}));break;case"multiline":t("aria-multiline","ariaMultiline",i)&&i.attr("aria-multiline",!0)}c&&i.attr("tabindex",0),s&&s.$validators&&s.$validators.required&&t("aria-required","ariaRequired",i)&&r.$watch(function(){return s.$error.required},function(e){i.attr("aria-required",!!e)}),t("aria-invalid","ariaInvalid",i)&&r.$watch(function(){return s.$invalid},function(e){i.attr("aria-invalid",!!e)})}}}}}]).directive("ngDisabled",["$aria",function(e){return e.$$watchExpr("ngDisabled","aria-disabled")}]).directive("ngMessages",function(){return{restrict:"A",require:"?ngMessages",link:function(e,t,n,r){t.attr("aria-live")||t.attr("aria-live","assertive")}}}).directive("ngClick",["$aria","$parse",function(e,t){return{restrict:"A",compile:function(n,r){var i=t(r.ngClick,null,!0);return function(t,n,r){var o=["BUTTON","A","INPUT","TEXTAREA"];function a(e,t){if(-1!==t.indexOf(e[0].nodeName))return!0}n.attr("role")||a(n,o)||n.attr("role","button"),e.config("tabindex")&&!n.attr("tabindex")&&n.attr("tabindex",0),!e.config("bindKeypress")||r.ngKeypress||a(n,o)||n.on("keypress",function(e){var n=e.which||e.keyCode;32!==n&&13!==n||t.$apply(function(){i(t,{$event:e})})})}}}}]).directive("ngDblclick",["$aria",function(e){return function(t,n,r){e.config("tabindex")&&!n.attr("tabindex")&&n.attr("tabindex",0)}}])}(window,window.angular);var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t,n,r,i,o,a,s,c="",u=0;for(e=Base64._utf8_encode(e);u<e.length;)i=(t=e.charCodeAt(u++))>>2,o=(3&t)<<4|(n=e.charCodeAt(u++))>>4,a=(15&n)<<2|(r=e.charCodeAt(u++))>>6,s=63&r,isNaN(n)?a=s=64:isNaN(r)&&(s=64),c=c+this._keyStr.charAt(i)+this._keyStr.charAt(o)+this._keyStr.charAt(a)+this._keyStr.charAt(s);return c},decode:function(e){var t,n,r,i,o,a,s="",c=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");c<e.length;)t=this._keyStr.indexOf(e.charAt(c++))<<2|(i=this._keyStr.indexOf(e.charAt(c++)))>>4,n=(15&i)<<4|(o=this._keyStr.indexOf(e.charAt(c++)))>>2,r=(3&o)<<6|(a=this._keyStr.indexOf(e.charAt(c++))),s+=String.fromCharCode(t),64!=o&&(s+=String.fromCharCode(n)),64!=a&&(s+=String.fromCharCode(r));return Base64._utf8_decode(s)},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);128>r?t+=String.fromCharCode(r):r>127&&2048>r?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t},_utf8_decode:function(e){for(var t="",n=0,r=c1=c2=0;n<e.length;)128>(r=e.charCodeAt(n))?(t+=String.fromCharCode(r),n++):r>191&&224>r?(c2=e.charCodeAt(n+1),t+=String.fromCharCode((31&r)<<6|63&c2),n+=2):(c2=e.charCodeAt(n+1),c3=e.charCodeAt(n+2),t+=String.fromCharCode((15&r)<<12|(63&c2)<<6|63&c3),n+=3);return t}};function ShowSetpUpModal(){var e={success:function(){alert("Success and navigate to account dashboard")},failed:function(){alert("Failed")}};angular.element(document.getElementById("ctrlID")).scope().showServiceModal(e)}if(function(){angular.module("configuration",[]).service("configservice",function(){this.getConfiguration=function(e,t){var n={en:{tesla:{PERSONAL_ID_LABEL:"Enter Personal ID",REMEMBER_ME_LABEL:"Remember me?",PERSONAL_ID_BUTTON_LABEL:"Continue",ID_SHIELD_BUTTON_LABEL:"Log In",OTP_BUTTON_LABEL:"Log In",ACCOUNT_TYPE_LABEL:"Account Type",PASSWORD_LABEL:"Password",FORGOT_ID_LINK_LABEL:"Forgot ID?",FORGOT_PASSWORD_LINK_LABEL:"Forgot Password?",NEW_USER_LABEL:"New user? Set up online access",GO_BUTTON_LABEL:"GO",START_OVER_LABEL:"Start over",SELECT_AUTHENTICATION_HEADER:"Please select authentication method",ERROR_MESSAGE:"To use these features, you must have Push enabled on your device. You can manage Push Notifications in the Device Manager or in the My Profile section of the app.",CANCEL_LINK:"Cancel",ID_SHIELD_HEADER:"ID Shield Questions",ID_SHIELD_INCORRECT_ANS_MESSAGE:"Hmm. That information doesn't match what we have on file. To be sure your account is secure, we've locked it for now. ",ID_SHIELD_LOCK_ERROR_MSG:"Alas, that was your third try with the wrong code. For your security, we've locked your account. ",FORGOT_ANSWER_LINK:"Forgot answer?",CHANGE_AUTHENTICATION_METHOD_LINK:"Change authentication method",CHANGE_TARGET_LINK:"",MOBILE_PUSH_NOTIFICATION_HEADER:"Please select how you want us to deliver a push notification to authenticate you",MOBILE_PUSH_NOTIFICATION_HEADER_OAUTH:"Please select how you want us to deliver your push notification",PUSH_NOTIFICATION_MESSAGE:"To use these features, you must have Push enabled on your device. You can manage Push Notifications in the Device Manager or in the My Profile section of the app.",AUTHORIZATION_PENDING_HEADER:"Authorization Pending",AUTHENTICATION_EXPIRE_MSG:"A request for authorization has been sent. It will expire in 15 minutes.",OTP_HEADER:"One-Time Passcode",ACCOUNT_LOCKED_ERR_MSG:"Alas, that was your third try with the wrong code. For your security, we've locked your account. ",OTP_RESEND_BUTTON_LABEL:"Resend",NEED_HELP_LINK:"Need help?",SELECT_OTP_HEADER:"Please select how you want us to deliver a one-time passcode to you",OTP_FIRST_DISCLOSURE:"",OTP_SECOND_DISCLOSURE:"",OTP_SMS_MESSAGE:"By providing a cellular number, you expressly consent to receiving a one-time text message related to your authorization code. Message and data rates may apply and you are responsible for any such charges.",CANCEL_QUES_LABEL:"Are you sure you want to cancel?",YES_LABEL:"YES",NO_LABEL:"NO"},banker:{ACCOUNT_TYPE_LABEL:"Account Type",PERSONAL_ID_LABEL:"Personal ID",PASSWORD_LABEL:"Password",REMEMBER_ME_LABEL:"Remember my ID",FORGOT_ID_LINK_LABEL:"Forgot ID?",FORGOT_PASSWORD_LINK_LABEL:"Forgot Password?",NEW_USER_LABEL:"New user? Set up online access",GO_BUTTON_LABEL:"GO",PERSONAL_ID_BUTTON_LABEL:"Log In",ID_SHIELD_BUTTON_LABEL:"Continue",OTP_BUTTON_LABEL:"Continue",START_OVER_LABEL:"",SELECT_AUTHENTICATION_HEADER:"Please select authentication method",ERROR_MESSAGE:"To use these features, you must have Push enabled on your device. You can manage Push Notifications in the Device Manager or in the My Profile section of the app.",CANCEL_LINK:"Cancel",ID_SHIELD_HEADER:"ID Shield Questions",ID_SHIELD_INCORRECT_ANS_MESSAGE:"Hmm. That information doesn't match what we have on file. To be sure your account is secure, we've locked it for now. ",ID_SHIELD_LOCK_ERROR_MSG:"Alas, that was your third try with the wrong code. For your security, we've locked your account. ",FORGOT_ANSWER_LINK:"Forgot answer?",CHANGE_AUTHENTICATION_METHOD_LINK:"Change authentication method",CHANGE_TARGET_LINK:"Change delivery method",MOBILE_PUSH_NOTIFICATION_HEADER:"Please select how you want us to deliver a push notification to authenticate you",MOBILE_PUSH_NOTIFICATION_HEADER_OAUTH:"Please select how you want us to deliver your push notification",PUSH_NOTIFICATION_MESSAGE:"To use these features, you must have Push enabled on your device. You can manage Push Notifications in the Device Manager or in the My Profile section of the app.",AUTHORIZATION_PENDING_HEADER:"Authorization Pending",AUTHENTICATION_EXPIRE_MSG:"A request for authorization has been sent. It will expire in 15 minutes.",OTP_HEADER:"One-Time Passcode",ACCOUNT_LOCKED_ERR_MSG:"Alas, that was your third try with the wrong code. For your security, we've locked your account. ",OTP_RESEND_BUTTON_LABEL:"Resend",NEED_HELP_LINK:"Need help?",SELECT_OTP_HEADER:"Please select how the customer wants to receive their one-time passcode.",OTP_FIRST_DISCLOSURE:"Ask the customer the following, before sending them a one-time passcode:",OTP_SECOND_DISCLOSURE:"May we text you a one-time passcode? It's to help verify your identity.  Please note that standard text messaging charges may apply.",OTP_SMS_MESSAGE:"By providing a cellular number, you expressly consent to receiving a one-time text message related to your authorization code. Message and data rates may apply and you are responsible for any such charges.",CANCEL_QUES_LABEL:"Are you sure you want to cancel?",YES_LABEL:"YES",NO_LABEL:"NO"},default:{ACCOUNT_TYPE_LABEL:"Account Type",PERSONAL_ID_LABEL:"Personal ID",PASSWORD_LABEL:"Password",REMEMBER_ME_LABEL:"Remember my ID",FORGOT_ID_LINK_LABEL:"Forgot ID?",FORGOT_PASSWORD_LINK_LABEL:"Forgot Password?",NEW_USER_LABEL:"New user? Set up online access",NEW_SF_USER_LABEL:"State Farm customer? ",NEW_SF_USER_LINK:"Sign up",GO_BUTTON_LABEL:"GO",PERSONAL_ID_BUTTON_LABEL:"Log In",ID_SHIELD_BUTTON_LABEL:"Continue",OTP_BUTTON_LABEL:"Continue",START_OVER_LABEL:"Start over",SELECT_AUTHENTICATION_HEADER:"Please select authentication method",ERROR_MESSAGE:"To use these features, you must have Push enabled on your device. You can manage Push Notifications in the Device Manager or in the My Profile section of the app.",CANCEL_LINK:"Cancel",ID_SHIELD_HEADER:"ID Shield Questions",ID_SHIELD_INCORRECT_ANS_MESSAGE:"Hmm. That information doesn't match what we have on file. To be sure your account is secure, we've locked it for now. ",ID_SHIELD_LOCK_ERROR_MSG:"Alas, that was your third try with the wrong code. For your security, we've locked your account. ",FORGOT_ANSWER_LINK:"Forgot answer?",CHANGE_AUTHENTICATION_METHOD_LINK:"Change authentication method",CHANGE_TARGET_LINK:"",MOBILE_PUSH_NOTIFICATION_HEADER:"Please select how you want us to deliver a push notification to authenticate you",MOBILE_PUSH_NOTIFICATION_HEADER_OAUTH:"Please select how you want us to deliver your push notification",PUSH_NOTIFICATION_MESSAGE:"To use these features, you must have Push enabled on your device. You can manage Push Notifications in the Device Manager or in the My Profile section of the app.",AUTHORIZATION_PENDING_HEADER:"Authorization Pending",AUTHENTICATION_EXPIRE_MSG:"A request for authorization has been sent. It will expire in 15 minutes.",OTP_HEADER:"One-Time Passcode",ACCOUNT_LOCKED_ERR_MSG:"Alas, that was your third try with the wrong code. For your security, we've locked your account. ",OTP_RESEND_BUTTON_LABEL:"Resend",NEED_HELP_LINK:"Need help?",SELECT_OTP_HEADER:"Please select how you want us to deliver a one-time passcode to you",OTP_FIRST_DISCLOSURE:"",OTP_SECOND_DISCLOSURE:"",OTP_SMS_MESSAGE:"By providing a cellular number, you expressly consent to receiving a one-time text message related to your authorization code. Message and data rates may apply and you are responsible for any such charges.",CANCEL_QUES_LABEL:"Are you sure you want to cancel?",YES_LABEL:"YES",NO_LABEL:"NO"}},sp:{tesla:{},default:{}}},t=t||"",e=e||"";if("spanish"==t.toLowerCase()){var r=n.sp[e.toLowerCase()];return r||n.sp.default}var r=n.en[e.toLowerCase()];return r||n.en.default}})}(),!window.Promise){var setTimeoutFunc=setTimeout;function noop(){}function bind(e,t){return function(){e.apply(t,arguments)}}function handle(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,Promise._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var r;try{r=n(e._value)}catch(e){return void reject(t.promise,e)}resolve(t.promise,r)}else(1===e._state?resolve:reject)(t.promise,e._value)})):e._deferreds.push(t)}function resolve(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof Promise)return e._state=3,e._value=t,void finale(e);if("function"==typeof n)return void doResolve(bind(n,t),e)}e._state=1,e._value=t,finale(e)}catch(t){reject(e,t)}}function reject(e,t){e._state=2,e._value=t,finale(e)}function finale(e){2===e._state&&0===e._deferreds.length&&Promise._immediateFn(function(){e._handled||Promise._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)handle(e,e._deferreds[t]);e._deferreds=null}function Handler(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}function doResolve(e,t){var n=!1;try{e(function(e){n||(n=!0,resolve(t,e))},function(e){n||(n=!0,reject(t,e))})}catch(e){if(n)return;n=!0,reject(t,e)}}function dispatchUnhandledRejectionEvent(e,t){var n=document.createEvent("Event");Object.defineProperties(n,{promise:{value:e,writable:!1},reason:{value:t,writable:!1}}),n.initEvent("unhandledrejection",!1,!0),window.dispatchEvent(n)}Promise=function(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],doResolve(e,this)},Promise.prototype.catch=function(e){return this.then(null,e)},Promise.prototype.then=function(e,t){var n=new this.constructor(noop);return handle(this,new Handler(e,t,n)),n},Promise.all=function(e){var t=Array.prototype.slice.call(e);return new Promise(function(e,n){if(0===t.length)return e([]);var r=t.length;function i(o,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(e){i(o,e)},n)}t[o]=a,0==--r&&e(t)}catch(e){n(e)}}for(var o=0;o<t.length;o++)i(o,t[o])})},Promise.resolve=function(e){return e&&"object"==typeof e&&e.constructor===Promise?e:new Promise(function(t){t(e)})},Promise.reject=function(e){return new Promise(function(t,n){n(e)})},Promise.race=function(e){return new Promise(function(t,n){for(var r=0,i=e.length;r<i;r++)e[r].then(t,n)})},Promise._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){setTimeoutFunc(e,0)},Promise._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e),dispatchUnhandledRejectionEvent({},e)},Promise._setImmediateFn=function(e){Promise._immediateFn=e},Promise._setUnhandledRejectionFn=function(e){Promise._unhandledRejectionFn=e},window.Promise=Promise}"function"!=typeof Object.assign&&(Object.assign=function(e,t){"use strict";if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),r=1;r<arguments.length;r++){var i=arguments[r];if(null!=i)for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])}return n}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var r=arguments[1],i=0;i<n;){var o=t[i];if(e.call(r,o,i,t))return o;i++}}}),String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return this.substr(t||0,e.length)===e}),function(){var e="undefined"!=typeof exports?exports:"undefined"!=typeof self?self:$.global,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function n(e){this.message=e}n.prototype=new Error,n.prototype.name="InvalidCharacterError",e.btoa||(e.btoa=function(e){for(var r,i,o=String(e),a=0,s=t,c="";o.charAt(0|a)||(s="=",a%1);c+=s.charAt(63&r>>8-a%1*8)){if((i=o.charCodeAt(a+=.75))>255)throw new n("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");r=r<<8|i}return c}),e.atob||(e.atob=function(e){var r=String(e).replace(/[=]+$/,"");if(r.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,o,a=0,s=0,c="";o=r.charAt(s++);~o&&(i=a%4?64*i+o:o,a++%4)?c+=String.fromCharCode(255&i>>(-2*a&6)):0)o=t.indexOf(o);return c})}(),Array.prototype.find||(Array.prototype.find=function(e,t){"use strict";return function n(r,i,o){return e.call(t,r,i,o)?r:i<o.length?n(o[i],i+1,o):void 0}(this[0],0,this)}),Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(e){"use strict";if(void 0===e||null===e)throw new TypeError("Cannot convert first argument to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(void 0!==r&&null!==r){r=Object(r);for(var i=Object.keys(Object(r)),o=0,a=i.length;o<a;o++){var s=i[o],c=Object.getOwnPropertyDescriptor(r,s);void 0!==c&&c.enumerable&&(t[s]=r[s])}}}return t}}),("undefined"!=typeof global?global:"undefined"!=typeof window&&window.document?window:self).Promise.prototype.finally=function(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){throw n})})},function(){"use strict";function e(e,t){e.state("init",{name:"init",views:{auth:{template:""}}}).state("authOptions",{name:"authOptions",params:{transmitParams:null},views:{auth:{templateUrl:"ChildAuthOptionPage.html",controller:"AuthOptionController"}}}).state("ErrorPage",{name:"error",params:{transmitParams:null},views:{auth:{templateUrl:"ErrorPage.html",controller:"ErrorPageController"}}}).state("otpTarget",{name:"otpTarget",params:{transmitParams:null},views:{auth:{templateUrl:"ChildOTPSelectTarget.html",controller:"OTPTargetController"}}}).state("inputOTPCode",{name:"inputOTPCode",params:{transmitParams:null},views:{auth:{templateUrl:"ChildOTPInputCode.html",controller:"InputOTPController"}}}).state("mobApprove",{name:"mobApprove",params:{transmitParams:null},views:{auth:{templateUrl:"ChildMobileApprove.html",controller:"MobileApproveController"}}}).state("pendingApproval",{name:"pendingApproval",params:{transmitParams:null},views:{auth:{templateUrl:"PendingApproval.html",controller:"PendingApprovalController"}}}).state("idshield",{name:"idshield",params:{transmitParams:null},views:{auth:{templateUrl:"ChildIDShield.html",controller:"IDShieldController"}}}).state("password",{name:"password",params:{transmitParams:null},views:{auth:{templateUrl:"Password.html",controller:"PasswordController"}}}).state("cancelauth",{name:"cancelauth",params:{transmitParams:null},views:{auth:{templateUrl:"StepupCancellation.html",controller:"ConfirmPopController"}}}).state("inputOTPCodeMNC",{name:"inputOTPCodeMNC",params:{transmitParams:null},views:{auth:{templateUrl:"ChildOTPInputCodeMNC.html",controller:"InputOTPController"}}})}function t(e,t,n,r,i,o){var a=OmniDataUtil.getOmniData("transmitLoginParams");t.Username=a.Username,t.password=a.password,n.password=a.password,n.TransactionID=a.TransactionId,n.IDShieldBaseURL=a.IdshieldBaseUrl,n.PasswordBaseURL=a.PasswordBaseUrl,n.TransmitAppID=a.TransmitAppid,n.ImageBaseURL=a.ImageBaseURL,n.SoundBaseURL=a.SoundBaseURL,n.TransmitPolicy=a.TransmitPolicy,n.TransmitURL=a.TransmitUrl,n.RedirectToLogin=a.RedirectToLogin,n.RedirectToLoginWithError=a.RedirectToLoginWithError,n.IsOAMEnabled=a.isOAMEnabled,n.OAMPostUrl=a.OAMPostUrl,n.ActimizeData=a.ActimizeData,n.authBaseUrl=a.authBaseUrl,n.BlackBoxData=a.BlackBoxData,n.clientId=a.clientId,n.channelId=a.channelId,n.RedirectToResetOrChangePassword=function(e,t){var n=!0;e&&(n=!1),r.loginAssit(!0,!1,!0,"","",n,e,t)},n.SuccessHandler=function(e){a.TransmitCall(e)},n.ErrorHandler=function(e){e.userLockedQA?r.loginAssit(!0,!1,!0,""):e.isDeviceNotAvailable?a.ErrorCallBack():a.ErrorCallBack(e)},t.saSuccessHandler=function(e){a.TransmitCall(e)},t.saErrorHandler=function(e){e.userLockedQA?r.loginAssit(!0,!1,!0,""):e.isDeviceNotAvailable?a.ErrorCallBack():e.isMobileApprovalDenied?a.RedirectToLoginWithError("DenyErrorMessage"):a.ErrorCallBack(e)}}function n(e,t,n,a,s,c,u,l,d,h,p,f){var m;a.VersionNumber=l.VersionNumber;var g,v=a,y=!1,b=!0;function A(t){return v.dialogOpen=!0,g=s.open(v.opts),angular.element(document.getElementsByTagName("body")).toggleClass("sharedauth-modal-open"),setTimeout(function(){if("mbl"==t.TransmitAppID){var e=document.getElementsByClassName("modal fade ng-isolate-scope in")[0];void 0!=e&&""!=e&&(e.setAttribute("role","dialog"),e.setAttribute("aria-live","assertive"),e.removeAttribute("ng-click"))}var n=document.getElementsByClassName("modal-content")[0];void 0!=n&&""!=n&&(1==a.isKitkat?n.setAttribute("style","overflow:auto !important; max-height:100% !important; top:50% !important"):n.setAttribute("style","overflow:auto !important; max-height:100% !important;"),n.setAttribute("role","document"))},1e3),g.result.then(function(){},function(t){e.$$listeners.MBQASuccess=[],angular.element(document.getElementsByTagName("body")).toggleClass("sharedauth-modal-open"),"closedOnError"===t&&(v.dialogOpen=!1)}),g}v.dialogOpen=!1,v.showPlaceHolder=function(t){if(a.isKitkat=!1,navigator.userAgent.match(/Android/i)){var n=parseFloat(navigator.appVersion.split("Android ")[1].split(";")[0]);n>=4.4&&n<5&&(a.isKitkat=!0)}v.username=t.username,t.hasResumePlaceholder=!!t.resumePlaceholder,A(t),m=function(e,n){t.resumePlaceholder(n),g.dismiss()},e.$on("LoginAssistance",function(e,n){t.failed({error:"LoginAssitanceClicked",code:"1001"}),g.dismiss()}),e.$on("NotifySiteCat",function(e,n){t.notifySiteCat(n)}),v.navigatePage(t.defaultauth,t)},v.navigatePage=function(e,t){n.go(e,{transmitParams:t})},v.showServiceModal=function(t){v.successHandler=t.success,v.failureHandler=t.failed,v.TransmitURL=i(t.TransmitURL,c),v.username=t.username.toLowerCase(),v.TransmitAppID=t.TransmitAppID,v.TransmitPolicy=t.TransmitPolicy,v.requestParameter={resumePlaceHolder:!!t.resumePlaceHolder,username:t.username,TransactionID:t.TransactionID,IDShieldBaseURL:i(t.IDShieldBaseURL,c),PasswordBaseURL:i(t.PasswordBaseURL,c),ContextData:t.ContextData?t.ContextData:"",TransmitAppID:t.TransmitAppID?t.TransmitAppID:"web",stepupQuestion:t.stepupQuestion,policyID:t.TransmitPolicy,actimizeData:t.ActimizeData?t.ActimizeData:"",modelDialogOnClose:t.closeHandler||t.modalClose,showModalDialog:!t.StepupWithoutOverlay,ClientName:t.ClientName,showOtpFirstDisclosure:t.showOtpFirstDisclosure,showOtpSecondDisclosure:t.showOtpSecondDisclosure,authType:t.authType},t.additionalParams&&(v.additionalParams=t.additionalParams);t.closeHandler&&(v.closeHandler=t.closeHandler,e.authcncl=t.closeHandler);t.StepupWithoutOverlay&&(b=!1);t.LinksCustomizationFor24HBScreen&&(y=!0);t.isCEI&&(a.isCEI=!0);t.HideCloseButton?a.HideCloseButton=!0:a.HideCloseButton=!1;if(a.$on("lockoutUser",function(t,n){e.isUserLocked=!0}),a.$on("authCancel",function(e,t){m.dismiss("cancel")}),a.$on("ShowHideLinks",function(e,t){a.is24HBScreen=!!y}),e.dialogHeading="",e.transmitOTPParams=v.requestParameter,v.navigatePage("init"),"mbl"==v.TransmitAppID||null==window.currentPageID&&void 0===window.currentPageID){if("mbl"!=v.TransmitAppID){var r="a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]",s=document.getElementsByClassName("container")[0];void 0!=s&&""!=s&&(s.setAttribute("aria-hidden","true"),$(".container").find(r).attr("tabindex","-1"));var l=document.getElementById("footer");void 0!=l&&""!=l&&(l.setAttribute("aria-hidden","true"),$("#footer").find(r).attr("tabindex","-1"));var d=document.getElementById("gssUIWrapper");void 0!=d&&""!=d&&(d.setAttribute("aria-hidden","true"),$("#gssUIWrapper").find(r).attr("tabindex","-1")),sessionStorage.setItem("isDialogOpen",!0),$(document).keydown(function(e){var t=sessionStorage.getItem("isDialogOpen");"true"==t&&function(e){if(null==document.querySelector("div[saloginwidget]")||"undefined"==document.querySelector("div[saloginwidget]")){var t=document.getElementById("sharedAuthstepUpContainer");if(!t)return;var n=t.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]');if(!n||0==n.length)return;for(var r=[],i=0;i<n.length;i++){var o,a,s=n[i],c=n[i].parentElement;o=null!=s||void 0!=s?window.getComputedStyle(s):null,a=null!=c||void 0!=c?window.getComputedStyle(c):null,null!=o&&null!=a&&"none"!=o.display&&"hidden"!=o.visibility&&"none"!=a.display&&"hidden"!=a.visibility&&r.push(n[i])}var u=(r=Array.prototype.slice.call(r))[0],l=r[r.length-1];switch(e.keyCode){case 9:if(1===r.length){e.preventDefault();break}e.shiftKey?document.activeElement===u&&(e.preventDefault(),l.focus()):document.activeElement===l&&(e.preventDefault(),u.focus())}}}(e)})}}else{var r="a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]",h=window.currentPageID,p=document.getElementById(h);p.setAttribute("aria-hidden","true"),$("#"+h).find(r).attr("tabindex","-1"),e.toAuthCncl=v.TransmitAppID}var m;f.clearEventHandlers(),f.onAuthenticatorsChanged(function(e){b&&!v.dialogOpen&&(m=A(t),f.setModalInstance(m))}),f.onAuthenticatorFailure(function(e){b&&!v.dialogOpen&&(m=A(t),f.setModalInstance(m))}),f.onAuthenticatorCancelled(function(){m&&m.dismiss("cancel"),v.dialogOpen=!1,n.params.transmitParams&&"mbl"!==n.params.transmitParams.TransmitAppID&&(n.params.transmitParams&&"otp"==n.params.transmitParams.type?u.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationOTPCloseLink",null):u.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationCloseLink",null)),e.mainClose=!0,e.systemError&&e.$broadcast("authCancel",null),n.params.transmitParams&&n.params.transmitParams.hasResumePlaceholder&&n.params.transmitParams.failed&&n.params.transmitParams.failed({error:"cancelled",code:"105"})}),f.onAuthenticatorSuccess(function(){m&&m.dismiss("cancel"),v.dialogOpen=!1}),e.systemError=!1,o(m,null,v.username,v.successHandler,v.failureHandler,v.TransmitAppID,v.TransmitPolicy,v.TransmitURL,v.requestParameter,v,v.additionalParams,u,e,{},f),"mbl"==v.TransmitAppID||null==window.currentPageID&&void 0===window.currentPageID||a.updatePageScroll("MAscroller","#wrapperId","#scrollerId",10,null,100,!1,null)},v.showLogInAssistance=function(e){var t=e.BaseURL.split("/"),n=t[0],r=t[2],i=n+"//"+r;d.loginAssit(a.accountLocked,!1,!1,i)},v.transmitLogout=function(e){e.TransmitURL&&(e.TransmitURL=e.TransmitURL.replace("/api/v2/web/",""),require(["xmsdk"],function(t){var n=t.XmSdk(),r=com.ts.mobile.sdk.SDKConnectionSettings.create(e.TransmitURL,e.TransmitAppID);if(n.setConnectionSettings(r),t){var i=null;null!=JSON.parse(window.sessionStorage.getItem("currentSession"))&&(i=JSON.parse(window.sessionStorage.getItem("currentSession")).user_name),null!=i?1==window.sessionStorage.getItem("ts:provisionalSession:"+i)?console&&console.log("session is provisional"):n.initialize().then(function(){n.logout(i).then(function(t){e.success&&e.success(t)}).catch(function(t){e.failed&&e.failed(error)})}).catch(function(t){e.failed&&e.failed({status:"error",code:"-1"})}):e.failed&&e.failed({status:"error",code:"-1"})}else e.failed&&e.failed({status:"error",code:"-2"})}))},v.opts={backdrop:!0,keyboard:!0,templateUrl:"StepUpContainer.html",controller:r,resolve:{}},e.$on("MBQASuccess",function(e,t){m&&m(e,t)}),document.addEventListener("focus",function(e){var t=document.getElementById("sharedAuthstepUpContainer");null!=t&&v.dialogOpen&&!t.contains(e.target)&&(e.stopPropagation(),t.focus())},!0),a.updatePageScroll=function(e,t,n,r,i,o,a,s){var c=0;a?s?c=s:angular.element(n)&&(c=angular.element(n).outerHeight()):i&&(c+=i*r),o&&(c+=o),p.destroyParamterizedScroll(e),setTimeout(function(){p.updatePageWithScrollOmni(e,t,n,c),document.getElementById("wrapperId").setAttribute("style","height:400px;"),document.getElementById("scrollerId").style.height="700px"},500)}}function r(e,t,n,r,i,o,a,s){e.cancel=function(e){i&&i.params&&i.params.transmitParams&&i.params.transmitParams.hasResumePlaceholder&&i.params.transmitParams.failed&&i.params.transmitParams.failed({error:"cancelled",code:"105"}),i&&i.params&&i.params.transmitParams&&"mbl"==i.params.transmitParams.TransmitAppID||(a.iAuthenticationErrored()?n&&n.dismiss("closedOnError"):(s&&s.showAuthCancelConfirmation(),e&&e.preventDefault()))}}angular.module("stepupWidget",["ui.bootstrap","ui.router","ngBusy","ngAria","sharedWidgetOmniTemplateModule","configuration"]).config(e),e.$inject=["$stateProvider","$urlRouterProvider"],angular.module("stepupWidget").controller("TransmitLoginStepupController",t),t.$inject=["$rootScope","$scope","dataContainer","idShieldService","$state","transmitService"],angular.module("stepupWidget").controller("SharedAuthModalCtrl",n),n.$inject=["$rootScope","$injector","$state","$scope","$modal","$location","SASiteCatService","SharedAuthConstants","idShieldService","$compile","MMScrollService","transmitService"],angular.module("stepupWidget").controller("AuthModalInstanceCtrl",r),r.$inject=["$scope","$rootScope","$modalInstance","$modal","$state","SASiteCatService","transmitService","transmitEventsService"];var i=function(e,t){var n=t.port()?":"+t.port():"";return t.protocol()+"://"+t.host()+n+e};function o(e,t,n,r,i,o,a,s,c,u,l,d,h,p,f){f.showOptions(e,t,n,r,i,o,a,s,c,u,l,d,h,p)}window.showTransmitAuthOptions=o}(),function(){"use strict";angular.module("stepupWidget").factory("transmitService",["idShieldService","PasswordService","transmitEventsService","saLoggingService","saBusyService","$modal","$timeout",function(e,t,n,r,i,o,a){var s,c,u=[],l=[],d=[],h=[],p=!1,f=!1;function m(e){var t="",n=("; "+document.cookie).split("; ASP.NET_SessionId=");2==n.length&&(t=n.pop().split(";").shift()),""!=t&&(null!=e?e.sessionid=t:e={sessionid:t})}function g(e){if(!e)return{};var t={};if("string"==typeof e)try{var n=e.match(new RegExp("{.*}"));n&&n.length>0&&(t=JSON.parse(n[0]))}catch(e){}else t=e;return t}function v(e){if(!e)return{};var t={IsValidUID:!0,isDeviceNotAvailable:!1,userLockedQA:!1,isMobileApprovalDenied:!1},n=(((e._data||{}).failure_data||{}).reason||{}).data;return n&&9==n.code&&"reject"==n.action?(t.IsValidUID=!1,t.Reason=n.reason,t.ErrorMessage="Hmm. We don't recognize that ID. Please try again."):n&&3==n.code&&"reject"==n.action?(t.userLockedQA=!0,t.Reason=n.reason):e.data&&e.data.assertion_error_code&&"10"==e.data.assertion_error_code&&e.data.assertion_error_message.indexOf("MobileApprove")>0?(t.Reason=e&&e.xmapiError?e.xmapiError.name:null,t.isDeviceNotAvailable=!0):null!=e&&e.indexOf&&-1!==e.indexOf("failed to authenticate")?(t.isMobileApprovalDenied=!0,t.userLockedQA=!1):(t.Reason=e._message?e._message:null,"locked"==e&&(t.Reason="allauthenticatorslocked"),t.userLockedQA=e&&3==e._errorCode&&"All authenticators locked."==e._message),t.SessionExpired=function(e,t){return!!(e&&e._message&&e._message.toLowerCase().indexOf("auth session expired")>=0)||!(!e||4005!==e._errorCode)||e&&e._message&&e._message.toLowerCase().indexOf("session not found for device")>=0}(e,t.Reason),r.error(t.Reason),r.error("Locked: "+t.userLockedQA),t.transmitErrorResponse=e,t}function y(e,t){if(e){var n=document.getElementById(e);n&&(n.innerHTML=t)}}function b(e,t){if(e){var n=$(e);n&&(n.removeAttr("aria-hidden"),t&&$(e).find("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]").removeAttr("tabindex","-1"))}}function A(e){"mbl"==e||null==window.currentPageID&&void 0===window.currentPageID?"mbl"!=e&&(b(".container",!0),b("#footer",!0),b("#gssUIWrapper",!0),sessionStorage.setItem("isDialogOpen",!1),y("stepupLiveAnnouncement","")):b("#"+window.currentPageID)}function _(e,t,n,r,i,o,a,s,c,u){var l;A(),I(d,l);var h={Success:!0,result:"success"};h.token=n._token,h.resData=n._internalData?n._internalData.json_data:"",i.isQa&&(h.isQa=i.isQa),h.DeviceID=n._deviceId,r(h)}function S(t,n,o,s,u,d,m,b,_){r.error("TS Error"),r.error(o),d.$broadcast("busy.end",{remaining:0}),d.loading=!1;var S=document.getElementById("disablingDiv");if(S&&(S.style.display="none"),!o||"0"!=o._errorCode||"Input Error"!=o._message){if(o&&"7"==o._errorCode)return p=!0,f=!1,A(),n.modelDialogOnClose&&(i.busyBegin("cancelAction"),n.modelDialogOnClose()),void I(l,w);var w;if(function(e){I(h,e)}(o),o&&o.indexOf&&o.indexOf("failed to authenticate")>-1)s(v(o));else if("password_login"===n.TransmitPolicy){var k=(((o._data||{}).failure_data||{}).reason||{}).data;k&&1==k.locked?e.loginAssit(!0,!0,!0,""):s(v(g(o)))}else s(v(g(o)));if("mbl"!=b){var C={challengePolicy:u.transmitpolicy,loginFormat:u.VersionNumber};_.onTrackSATransmitLogin("LoginWidget","StepupAuthFailed",C,!0)}else C={challengePolicy:u.transmitpolicy,loginFormat:u.VersionNumber};_.onTrackSATransmitMobileLogin("Mobile","StepupAuthFailed",C),p=!1,f=!0,A(b),a(function(){!function(t,n){n.systemError=t.data&&t.data.assertion_error_code&&"13"==t.data.assertion_error_code;var r=(((t._data||{}).failure_data||{}).reason||{}).data,i=(((t._data||{}).failure_data||{}).reason||{}).type;if(t._data&&t._data.assertion_error_code&&"10"==t._data.assertion_error_code&&t._data.assertion_error_message&&t._data.assertion_error_message.indexOf("MobileApprove")>0)y("authenticatorheader",""),y("customUI","<div class='omni-modal-body'><p class='error general' role='alert' aria-live='assertive'>To use these features, you must have Push enabled on your device. You can manage Push Notifications in the Device Manager or in the My Profile section of the app.</p></div>"),n.systemError=!0;else if(t._data&&t._data.type&&"mobile_approve"==t._data.type)y("authenticatorheader",""),y("customUI","<div class='omni-modal-body'><p class='error general' role='alert' aria-live='assertive'>To use these features, you must have Push enabled on your device. You can manage Push Notifications in the Device Manager or in the My Profile section of the app.</p></div>"),n.systemError=!0;else if(r&&"locked"==r.reason)y("customUI","<div class='omni-modal-body'><p class='error general' role='alert' aria-live='assertive'>Hmm. Something you've entered isn't quite right, so we've locked your account to ensure your security. Login Assist can help.</p></div>"),y("authenticatorheader",""),n.systemError=!0;else if(r&&1==r.locked)e.isTuxLogin()?e.loginAssit(!0,!1,!0,""):(n.$broadcast("UserLocked"),document.getElementById("otpLockError").removeAttribute("style"),document.getElementById("changeAuth").setAttribute("disabled","true"),document.getElementById("changeAuth").style.visibility="hidden",n.$broadcast("lockoutUser",null));else if(t._data&&t._data.assertion_error_code&&6==t._data.assertion_error_code&&t._data.assertion_error_message&&t._data.assertion_error_message.indexOf("MobileApprove")>0)y("customUI","<div class='omni-modal-body'><p class='error general' role='alert' aria-live='assertive'>Hmm. Something you've entered isn't quite right, so we've locked your account to ensure your security. Login Assist can help.</p></div>"),y("authenticatorheader",""),n.systemError=!0;else if(r&&9==r.code&&"reject"==r.action&&"invalid uid"==r.reason)y("customUI","<div class='omni-modal-body'><p class='error general' role='alert' aria-live='assertive'>Hmm. We don't recognize that ID. Please try again.</p></div>"),y("authenticatorheader",""),n.systemError=!0;else if(r&&"reject"==r.action&&3==r.code||t._data&&t._data.xmapiError&&t._data.xmapiError.name&&"allAuthenticatorsLocked"==t._data.xmapiError.name||t._data&&3==t._errorCode&&"All authenticators locked."==t._message)y("customUI","<div class='omni-modal-body'><p class='error general' role='alert' aria-live='assertive'>Hmm. Something you've entered isn't quite right, so we've locked your account to ensure your security. Login Assist can help.</p></div>"),y("authenticatorheader",""),n.systemError=!0;else if(t._data&&t._data.name&&"Cancel"==t._data.name)n.systemError=!0;else if(t._message&&t._message.indexOf&&t._message.indexOf("failed to authenticate")>-1)y("customUI","<div class='omni-modal-body'><p class='error' role='alert' aria-live='assertive'>Authorization on mobile device was denied.</p></div>"),y("authenticatorheader",""),n.systemError=!0;else{if(r&&"reject"==r.action&&900==r.code&&i&&"VOIP"==i)return c&&c.dismiss(),void(n.systemError=!0);y("customUI","<div class='omni-modal-body'><p class='error' role='alert' aria-live='assertive'>We're sorry. We are having problems on our end. It shouldn't be too long, so please try again shortly.</p></div>"),y("authenticatorheader",""),n.systemError=!0}}(o,d)},0)}}function I(e,t){e&&0!=e.length&&e.forEach(function(e){e(t)})}function w(e){I(u,e)}window.addEventListener("unhandledrejection",function(e,t){s&&s(e)});return{showOptions:function(r,o,a,c,u,l,d,h,g,v,b,A,I,k){function C(e,t){if(e){var n="mbl"==l;switch(e._data.assertion_error_code){case 5:return n?t.onTrackSATransmitMobileLogin("Mobile","StepupEnterOTPUserError",null):void 0!==v.iswidget?t.onTrackSATransmitLogin("LoginWidget","StepupEnterOTPUserError",null,!0):t.onTrackCustomSharedStepUp("StepUpAuthentication","AuthenticationOTPIncorrectError"),void 0!==e._data.data&&void 0!==e._data.data.locked&&1==e._data.data.locked?"locked":I.IsTempAccessFlow?"Hmm. That code doesn't match our records. Please try again.":"That seems to be the wrong code. Please try again.";case 9:if(n)t.onTrackSATransmitMobileLogin("Mobile","StepupAuthSystemError",null);else var r={challengePolicy:v.transmitpolicy,loginFormat:v.VersionNumber};return t.onTrackSATransmitLogin("LoginWidget","StepupAuthSystemError",r,!0),"We're sorry. We are having problems on our end. It shouldn't be too long, so please try again shortly.";case 6:return n?t.onTrackSATransmitMobileLogin("Mobile","StepupEnterOTPUserLockedError",null):t.onTrackSATransmitLogin("LoginWidget","StepupEnterOTPUserLockedError",null,!0),"locked";case 12:return I.isUserLocked=!0,n?t.onTrackSATransmitMobileLogin("Mobile","StepupEnterOTPUserLockedError",null):r={challengePolicy:v.transmitpolicy,loginFormat:v.VersionNumber},t.onTrackSATransmitLogin("LoginWidget","StepupEnterOTPUserLockedError",null,!0),"locked";case 13:return n?t.onTrackSATransmitMobileLogin("Mobile","StepupMobileApprovePendingError",null):t.onTrackSATransmitLogin("LoginWidget","StepupMobileApprovePendingError",null,!0),"Your approval is still pending.";case 21:return n?t.onTrackSATransmitMobileLogin("Mobile","StepupMobileApproveExpiredError",null):t.onTrackSATransmitLogin("LoginWidget","StepupMobileApproveExpiredError",null,!0),"Approval is expired.";default:return n?t.onTrackSATransmitMobileLogin("Mobile","StepupAuthSystemError",null):r={challengePolicy:v.transmitpolicy,loginFormat:v.VersionNumber},t.onTrackSATransmitLogin("LoginWidget","StepupAuthSystemError",r,!0),"We're sorry. We are having problems on our end. It shouldn't be too long, so please try again shortly."}}}i.initiateBusy("transmitAuthentication",{busyElement:g.busyElement,busyClass:g.busyClass}),p=!1,f=!1,s=function(e){var t=e&&e.reason?e.reason:e,n=t&&t.message?t.message:"";("string"==typeof n||n instanceof String)&&-1!==n.indexOf("RTCPeerConnection")||S(0,g,t,u,v,I,0,l,A)},n.init(v,I),"mno_zelle"!=d&&"shared_access_invitation_third_party_delegate"!=d&&"zelle_ins_vs_std"!=d||I.$broadcast("busy.begin"),"shared_access_invitation_third_party_delegate"==d&&document.querySelector("#sharedAuthID").children[0].setAttribute("style","display:none"),m(b),require(["jquery","xmsdk","xmui"],function(r,o,s){b?(b.ActimizeData=g.actimizeData,null!=b.BlackBoxData&&""!=b.BlackBoxData||(b.BlackBoxData=g.blackBoxData)):b={ActimizeData:g.actimizeData,BlackBoxData:g.blackBoxData,OATR:1==g.OATR||null,clientId:g.clientId?g.clientId:null,channelId:g.channelId?g.channelId:null,visitorId:g.visitorId?g.visitorId:null};var p=o.XmSdk();function f(){s.XmUIHandler.call(this)}!function(e){var t=document.all("uiContainer");if(r("#customUI").html(""),r("#customUI").focus(),setTimeout(function(){var e=document.getElementsByClassName("modal fade ng-isolate-scope in")[0];void 0!=e&&""!=e&&(e.setAttribute("role","dialog"),e.removeAttribute("ng-click"),e.setAttribute("id","overlayModalContainer"),e.setAttribute("aria-labelledby","authenticatorheader"))},1e3),h){h=h.replace("/api/v2/web/","");var n=com.ts.mobile.sdk.SDKConnectionSettings.create(h,l);p.setConnectionSettings(n);var i=function(e){_(0,0,e,c,v)},o=function(e){S(0,g,e,u,v,I,0,l,A)};p.initialize().then(function(){var e=null;b&&"Anonymous"==b.authType?(b.SessionGUID&&(v.SessionGUID=b.SessionGUID,delete b.SessionGUID,delete b.authType),e=p.invokeAnonymousPolicy(d,b,t)):e="Authenticate"==g.authType?p.authenticate(a,d,b,t):p.invokePolicy(d,b,t),e.then(i,function(e){12===e.getErrorCode()&&"Operation requires an active session."===e.getMessage()?p.authenticate(a,d,b,t).then(i,o):o(e)})}).catch(o)}}(),f.prototype=Object.create(s.XmUIHandler.prototype),f.prototype.constructor=f;var m,k=new f;function E(e){return"most_recently_used"==e.strategy.type||"most_recently_registered"==e.strategy.type||"specific"==e.strategy.type&&null!==e.strategy.device_id&&""!==e.strategy.device_id&&"null"!==e.strategy.device_id||("group"==e.strategy.type||"all"==e.strategy.type)&&(1==e.strategy.user_selection&&e.selectable_devices.length>0||0==e.strategy.user_selection)}p.setUiHandler(k),f.prototype.startActivityIndicator=function(e,t){s.XmUIHandler.disablespinner||i.busyBegin("transmitAuthentication")},f.prototype.endActivityIndicator=function(e,t){s.XmUIHandler.disablespinner||i.busyEnd("transmitAuthentication",v,{},{})},function(e){e[e.RetryAuthenticator=0]="RetryAuthenticator",e[e.ChangeAuthenticator=1]="ChangeAuthenticator",e[e.SelectAuthenticator=2]="SelectAuthenticator",e[e.Fail=3]="Fail"}(m||(m={})),f.prototype.selectAuthenticator=function(e,t,r){for(var i=[],a=0;a<e.length;a++){var s=e[a]._authenticator._authenticatorMethodConfig;"mobile_approve"==s.type&&void 0!==s.strategy?(I.isSpecific="specific"==s.strategy.type,E(s)&&i.push(s)):i.push(s)}return I.authMethods=i,new Promise(function(t,r){n.stashContext(o,function(e){e.callbackType&&"Cancel"==e.callbackType?t(com.ts.mobile.sdk.AuthenticatorSelectionResult.createAbortRequest()):t(com.ts.mobile.sdk.AuthenticatorSelectionResult.createSelectionRequest(e))},function(e){r()},null,g,"METHODMENU",e);var a=document.getElementById("isCEI"),s=I.isCEIPilot;if("undefined"!=typeof isCEI&&null!==a&&1==a.value&&void 0!==s&&1==s||n.userChangingAuthenticator())i.ClientName=g.ClientName,v.methods=i,n.userChangingNavigation()||(w(n.getCurrentEventDetails()),v.navigatePage("authOptions",I.authMethods));else{var c=n.getOptionsForCurrentFlow(e);c&&t(com.ts.mobile.sdk.AuthenticatorSelectionResult.createSelectionRequest(c))}})},f.prototype.controlOptionForCancellationRequestInSession=function(e,t){return new Promise(function(t,n){return t(com.ts.mobile.sdk.ControlRequest.create(e[1]))})},f.prototype.createFormSession=function(e,t){function n(e,t,n){this.formId=e,this.payload=t,this.common=n}return s.XmUIHandler.disablespinner||i.busyEnd("transmitAuthentication",v,{},{}),document.getElementById("sharedAuthID")&&(document.getElementById("sharedAuthID").style.display="none"),I.$broadcast("onformdataflow",t),n.prototype.getContainer=function(e){return xmui.XmUIHandler.getContainer(e)},n.prototype.startSession=function(e,t){this.actionContext=t,this.clientContext=e},n.prototype.promiseFormInput=function(){return new Promise(function(e,t){I.$on("formUserIdSubmit",function(t,n){n={data:{UserId:n.userId,ESignAccepted:!0}};var r=com.ts.mobile.sdk.FormInput.createFormInputSubmissionRequest(n);e(r)})})},n.prototype.onContinue=function(e){},n.prototype.onError=function(e){I.$broadcast("ErrorMessageDisplay",e)},n.prototype.endSession=function(){},new n(e,t,this.common)},f.prototype.processJsonData=function(e,t,n){return void 0!==e&&(void 0!==e.dataType&&"mobileapprove"==e.dataType&&(void 0!==e.deviceInfo&&e.deviceInfo.length>0?(v.customDeviceListInfo=e.deviceInfo,I.customDeviceListInfo=e.deviceInfo):v.customDeviceListInfo=[]),void 0!==e.UserId&&(v.username=e.UserId,I.username=e.UserId),void 0!==e.isCEIPilot?I.isCEIPilot=e.isCEIPilot:I.isCEIPilot=!1),Promise.resolve(R)};var P,T,R={getContinueProcessing:function(){return!0}};function D(e,t,n,r,i,o,a){this.placeholderName=e,this.placeholderType=t,this.authenticatorConfiguredData=i,this.serverPayload=o,this.title=n,this.username=r,this.uiHandler=a}function x(e,t,n,r,i){this.title=e,this.username=t,this.possibleTargets=n,this.autoExecedTarget=r,this.uiHandler=i}function L(e,t,n,r){this.state=T.TargetSelection,this.pollingIntervalMillis=1e3,this.instructions=n,this.uiHandler=k}f.prototype.createPlaceholderAuthSession=function(e,t,n,r,i,o){return new D(e,t,n,r,i,o)},D.prototype.startSession=function(e,t,n,r){this.description=e,this.mode=t,this.actionContext=n,this.clientContext=r,s.XmUIHandler.getContainer(r).append("")},D.prototype.promiseInput=function(){var e=this;return"password_pld"==e.placeholderName?new Promise(function(r,i){var o=e.serverPayload;g.ContextData=o,n.stashContext(p,function(e){var t=com.ts.mobile.sdk.PlaceholderInputResponse.createSuccessResponse(e.token);r(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(t))},function(t){var n=com.ts.mobile.sdk.AuthenticationError.createApplicationGeneratedGeneralError();n._errorCode="0",n._message="Input Error";var i=com.ts.mobile.sdk.PlaceholderInputResponse.createdFailedResponse(e.description,n);r(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(i))},e,g,"PWD",null),t.submitPassword(g)}):"qa"==e.placeholderName?(v.isQa=!0,new Promise(function(t,r){var i=e.serverPayload;g.ContextData=i,n.stashContext(p,function(e){if(e.callbackType&&"Change"==e.callbackType){var n=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.SelectMethod);t(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(n))}else if(e.callbackType&&"Cancel"==e.callbackType)n=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.CancelAuthenticator),t(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(n));else if(e.callbackType&&"Retry"==e.callbackType)n=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.RetryAuthenticator),t(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(n));else{var r=com.ts.mobile.sdk.PlaceholderInputResponse.createSuccessResponse(e.token);t(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(r))}},function(e){var t=com.ts.mobile.sdk.PlaceholderInputResponse.createdFailedResponse(e);r(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(t))},e,g,"IDSHIELD",null),w(n.getCurrentEventDetails()),v.username&&(g.username=v.username),v.navigatePage("idshield",g),I.$broadcast("loadCompleted")})):void 0},D.prototype.promiseRecoveryForError=function(e,t,n){return Promise.resolve(t[0])},D.prototype.endSession=function(){},function(e){e[e.TargetSelection=0]="TargetSelection",e[e.Input=1]="Input"}(P||(P={})),f.prototype.createOtpAuthSession=function(e,t,n,r){return new x(e,t,n,r)},x.prototype.startSession=function(e,t,n,r){this.description=e,this.mode=t,this.actionContext=n,this.clientContext=r,this.state=P.TargetSelection,s.XmUIHandler.getContainer(r).append("")},x.prototype.setAvailableTargets=function(e){this.possibleTargets=e},x.prototype.setGeneratedOtp=function(e,t){this.generatedFormat=e,this.generatedForTarget=t,t||(this.state=P.TargetSelection),t&&"0"==t._targetIdentifier&&(this.state=P.Input)},x.prototype.promiseInput=function(){var e=this,t=e.description._authenticatorMethodConfig;switch(this.state){case P.TargetSelection:return e.state=P.Input,"mno_confidence"==g.policyID||"web_phone_register"==g.policyID||"verify_new_entitlee"==v.transmitpolicy?new Promise(function(t,n){var r=com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createTargetSelectionRequest(e.possibleTargets[0]);return t(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(r))}):new Promise(function(r,i){n.stashContext(p,function(e){if(e.callbackType&&"Change"==e.callbackType){var t=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.SelectMethod);r(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(t))}else if(e.callbackType&&"Cancel"==e.callbackType)t=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.CancelAuthenticator),r(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(t));else{if(!e.callbackType||"Retry"!=e.callbackType){var n=com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createTargetSelectionRequest(e);return r(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(n))}t=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.RetryAuthenticator),r(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(t))}},function(e){i()},e,g,"OTPTARGET",null),t.ClientName=g.ClientName,I.$broadcast("loadCompleted"),w(n.getCurrentEventDetails()),v.navigatePage("otpTarget",t)});case P.Input:return new Promise(function(r,i){n.stashContext(p,function(e){if(!e.callbackType||"Change"!=e.callbackType&&"Target"!=e.callbackType)if(e.callbackType&&"Cancel"==e.callbackType)o=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.CancelAuthenticator),r(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(o));else if(e.callbackType&&"Retry"==e.callbackType)o=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.RetryAuthenticator),r(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(o));else if(e.callbackType&&"resend"==e.callbackType){var t=com.ts.mobile.sdk.OtpInputRequestResend.createOtpResendRequest(),n=com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createAuthenticatorInput(t);r(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(n))}else{var i=com.ts.mobile.sdk.OtpInputOtpSubmission.createOtpSubmission(e);n=com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createAuthenticatorInput(i),r(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(n))}else{var o=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.SelectMethod);r(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(o))}},function(e){i()},e,g,"OTP",null),t.hideChangeAuth=g.hideChangeAuth,t.showCancel=g.showCancel,t.showOTPHeader=g.showOTPHeader,t.hideRule=g.hideRule,t.ClientName=g.ClientName,t.otp_format={length:e.generatedFormat._length},I.$broadcast("loadCompleted"),w(n.getCurrentEventDetails()),"MobileCapture"==g.TransactionID?v.navigatePage("inputOTPCodeMNC",t):v.navigatePage("inputOTPCode",t)})}},x.prototype.promiseRecoveryForError=function(t,n,r){var i=C(t,A);return"locked"==i?e.isTuxLogin()?e.loginAssit(!0,!1,!0,""):(I.$broadcast("UserLocked"),document.getElementById("otpLockError").removeAttribute("style"),document.getElementById("changeAuth").setAttribute("disabled","true"),document.getElementById("changeAuth").style.visibility="hidden",I.$broadcast("lockoutUser",null)):("mno_confidence"!==v.transmitpolicy&&"web_phone_register"!==v.transmitpolicy&&"verify_new_entitlee"!==v.transmitpolicy||document.getElementById("aw-otp-input").classList.toggle("la__error-field"),y("otpError",i),document.getElementById("aw-otp-input").value="",document.getElementById("aw-otp-input").focus()),Promise.resolve(r)},x.prototype.endSession=function(){},function(e){e[e.TargetSelection=0]="TargetSelection",e[e.PollingRequested=1]="PollingRequested",e[e.PollingStarted=2]="PollingStarted"}(T||(T={})),f.prototype.createMobileApproveAuthSession=function(e,t,n,r){return new L(e,t,n,r)},L.prototype.startSession=function(e,t,n,r){this.description=e,this.mode=t,this.actionContext=n,this.clientContext=r,s.XmUIHandler.getContainer(r).append("")},L.prototype.setPollingIntervalInMillis=function(e){this.pollingIntervalMillis=e},L.prototype.setAvailableTargets=function(e){this.availableTargets=e},L.prototype.setCreatedApprovalInfo=function(e,t){null!=e?(this.createdForTargets=e,this.otp=t,this.state=T.PollingRequested,s.XmUIHandler.disablespinner=!0):(this.createdForTargets=null,this.otp=null,this.state=T.TargetSelection,clearTimeout(this.pollingTimer))},L.prototype.promiseInput=function(){var e=this,t=e.description._authenticatorMethodConfig;n.userChangingNavigation()&&clearTimeout(e.pollingTimer),void 0===v.customDeviceListInfo&&(v.customDeviceListInfo=[]);var r=document.getElementById("resendPush");switch(r&&r.style.setProperty("display","block","important"),t.customDeviceListInfo=v.customDeviceListInfo,this.state){case T.TargetSelection:return new Promise(function(r,o){n.stashContext(p,function(e){if(e.callbackType&&"Change"==e.callbackType){var t=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.SelectMethod);r(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(t))}else if(e.callbackType&&"Cancel"==e.callbackType)t=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.CancelAuthenticator),r(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(t));else if(e.callbackType&&"Retry"==e.callbackType)t=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.RetryAuthenticator),r(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(t));else{var n=com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createTargetsSelectionRequest(e);r(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(n))}},function(e){o()},t,g,"PUSHTARGET",e),w(n.getCurrentEventDetails()),t.ClientName=g.ClientName,n.userChangingNavigation()||v.navigatePage("mobApprove",t),i.busyEnd("transmitAuthentication",v,{},{})});case T.PollingRequested:return v.customDeviceListInfo.user_selection=void 0===t.strategy||void 0===t.strategy.user_selection||t.strategy.user_selection,t.customDeviceListInfo=v.customDeviceListInfo,new Promise(function(r,i){n.stashContext(p,function(t){if(t.callbackType&&"Change"==t.callbackType){var n=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.SelectMethod);r(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(n))}else t.callbackType&&"Cancel"==t.callbackType?(n=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.CancelAuthenticator),r(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(n))):t.callbackType&&"Retry"==t.callbackType?(clearTimeout(e.pollingTimer),n=com.ts.mobile.sdk.ControlRequest.create(com.ts.mobile.sdk.ControlRequestType.RetryAuthenticator),r(com.ts.mobile.sdk.InputOrControlResponse.createControlResponse(n))):(com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createTargetsSelectionRequest(t),r(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createAuthenticatorInput(com.ts.mobile.sdk.MobileApproveInputRequestPolling.createRequestPollingInput()))))},function(e){i()},t,g,"PUSH",null),w(n.getCurrentEventDetails()),t.ClientName=g.ClientName,v.navigatePage("pendingApproval",t),n.userChangingNavigation()||(e.pollingTimer=setTimeout(function(){r(com.ts.mobile.sdk.InputOrControlResponse.createInputResponse(com.ts.mobile.sdk.TargetBasedAuthenticatorInput.createAuthenticatorInput(com.ts.mobile.sdk.MobileApproveInputRequestPolling.createRequestPollingInput())))},e.pollingIntervalMillis))})}},L.prototype.promiseRecoveryForError=function(e,t,r){var i=C(e,A);if(void 0!==e._errorCode&&19==e._errorCode){var o=document.getElementById("resendPush");o&&o.style.setProperty("display","none","important"),i="We’re unable to authenticate the customer. Please try a different method."}if(y("mobError",i),"locked"==i){var a=document.getElementById("changeAuth");a&&(a.setAttribute("disabled","true"),a.style.visibility="hidden"),I.$broadcast("lockoutUser",null)}return void 0!==e._message&&-1!==e._message.indexOf("MobileApprove")&&-1!==e._message.indexOf("No devices available for approval")?Promise.resolve(m.ChangeAuthenticator):void 0!==e._errorCode&&19==e._errorCode?(n.setUserChangeNavigation(),Promise.resolve(m.SelectAuthenticator)):void 0!==e._errorCode&&20==e._errorCode?(n.setUserChangeNavigation(),Promise.resolve(m.Fail)):Promise.resolve(r)},L.prototype.endSession=function(){clearTimeout(this.pollingTimer),s.XmUIHandler.disablespinner=!1}}),v.$on("redirectToTuxLogin",function(e,t){t.isError?1==t.errorCode?k.RedirectToLoginWithError("Case1"):2==t.errorCode?k.RedirectToLoginWithError("Case2"):567==t.errorCode?k.RedirectToLoginWithError("Case567"):k.RedirectToLoginWithError():k.RedirectToLogin()}),v.$on("redirectToResetPassword",function(e,t){var n=!1,r="";null!=t&&void 0!=t.isChangePassword&&t.isChangePassword&&(n=!0,r=t.existingPassword),k.RedirectToResetOrChangePassword(n,r)})},extendSession:function(){var e={};m(e);var t=document.all("customUI");TransmitURL&&(TransmitURL=TransmitURL.replace("/api/v2/web/",""),require(["xmsdk"],function(n){var r=n.XmSdk(),i=com.ts.mobile.sdk.SDKConnectionSettings.create(TransmitURL,TransmitAppID);r.setConnectionSettings(i),r.initialize().then(function(){r.invokePolicy("heartbeat",e,t).then(function(e){}).catch(function(e){})}).catch(function(e){})}))},onAuthenticatorsChanged:function(e){u.push(e)},onAuthenticatorCancelled:function(e){l.push(e)},onAuthenticatorSuccess:function(e){d.push(e)},onAuthenticatorFailure:function(e){h.push(e)},isAuthenticationCancelled:function(){return p},iAuthenticationErrored:function(){return f},setModalInstance:function(e){c=e},clearEventHandlers:function(){u=[],l=[],d=[],h=[]}}}])}(),function(){"use strict";angular.module("stepupWidget").factory("transmitEventsService",["SASiteCatService","$state","saLoggingService","idShieldService","saBusyService",function(e,t,n,r,i){var o,a,s,c,u,l,d=!1,h=!1,p=null,f=null,m=null,g=!1,v=!1,y=function(e,n){u.navigatePage?u.navigatePage(e,n):t.go(e,{transmitParams:n})},b=function(e){A()&&void 0!==l.isSpecific&&l.isSpecific&&"OTPTARGET"!==p?(v=!0,_(u,l.authMethods,"mobile_approve")):"PUSHTARGET"===p?function(e){var t=[];m.availableTargets.forEach(function(n){n._targetIdentifier==e&&(t.push(n),s.targetSelectedDevice=n)}),o(t),y("pendingApproval",s)}(e):function(e){if(s.possibleTargets&&s.possibleTargets.length>0){var t=null;s.possibleTargets.forEach(function(n){n._description==e&&(t=n)}),o(t)}}(e),n.debug("Selected target for authenticator: "+p)},A=function(){var e=document.getElementById("isCEI"),t=l.isCEIPilot;return"undefined"!=typeof isCEI&&null!==e&&1==e.value&&(void 0!==t&&1==t)},_=function(t,r,i){var s=function(e,t){var n=null;return e.map(function(e){e.type==t&&(n=e)}),n}(r,i),c=function(e){for(var t=0;t<e.length;t++)if(e[t]&&"mobile_approve"==e[t].type)return!!e[t].selectable_devices}(r);if(h=!1,A()&&void 0!==l.isSpecific&&l.isSpecific){if(!v&&"mobile_approve"==i){g=!0;var d=p(s);return d.selectable_devices=[],d.customDeviceListInfo=l.customDeviceListInfo,void y("mobApprove",d)}g=!1}if(u.trackedMethod!=s.type)switch(s.type){case"otp":void 0!==u.transmitappid&&"mbl"==u.transmitappid?e.onTrackSATransmitMobileLoginClickEvent("Mobile","ChangeAuthOTPLink"):void 0!==u.iswidget?e.onTrackSATransmitLoginClickEvent("LoginWidget","ChangeAuthOTPLink",u.iswidget,null):e.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationOTPLink"),u.trackedMethod="otp";break;case"placeholder_qa":void 0!==u.transmitappid&&"mbl"==u.transmitappid?e.onTrackSATransmitMobileLoginClickEvent("Mobile","ChangeAuthQALink"):void 0!==u.iswidget?e.onTrackSATransmitLoginClickEvent("LoginWidget","ChangeAuthQALink",u.iswidget,null):e.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationQALink",null),u.trackedMethod="placeholder_qa";break;case"mobile_approve":void 0!==u.transmitappid&&"mbl"==u.transmitappid?e.onTrackSATransmitMobileLoginClickEvent("Mobile","ChangeAuthMobApproveLink"):void 0!==u.iswidget?e.onTrackSATransmitLoginClickEvent("LoginWidget","ChangeAuthMobApproveLink",u.iswidget,null):e.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationApproveLink",null),u.trackedMethod="mobile_approve";break;case"placeholder_password_pld":e.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationPasswordLink",null),u.trackedMethod="placeholder_password_pld"}function p(e){return e?(m.forEach(function(n){n._authenticator._authenticatorMethodConfig.type==e.type&&(t=n._authenticator)}),t):null;var t}var f=p(s);"mobile_approve"!=s.type?o(f):c?o(f):a(f),n.debug("Displaying Auth Options")},S=function(e){return!0!==e&&!1!==e||(d=e),d};return{init:function(e,t){d=!1,h=!1,g=!1,v=!1,u=e,l=t},stashContext:function(e,t,r,i,u,l,d){o=t,a=r,e,s=i,u.hideChangeAuth=!S(),c=u,f=p,p=l,m=null!=d?d:m,"METHODMENU"===p?$(".close").hide():$(".close").show(),n.debug("Selected authenticator: "+p)},changeAuthenticator:function(){h=!0,v=!1,g?y("authOptions",l.authMethods):o&&o({callbackType:"Change"}),g=!1,n.debug("Changing from authenticator: "+p)},retryAuthenticator:function(){o&&o({callbackType:"Retry"}),"PUSH"===p&&y("mobApprove",s),$(".close").show(),n.debug("Retrying authenticator: "+p)},cancelAuthenticator:function(){o&&o({callbackType:"Cancel"}),n.debug("Cancelling authenticator: "+p)},hasMultipleAuthenticators:S,userChangingAuthenticator:function(){return h},userChangingNavigation:function(){return g},resendPush:function(e){i.forceStopBusyEnd(!0),i.busyBegin("transmitAuthentication"),g=!0,setTimeout(function(){g=!1,o&&o({callbackType:"Retry"}),i.forceStopBusyEnd(!1),i.busyEnd("transmitAuthentication")},1200),void 0===e||void 0===e.isSpecific||e.isSpecific||setTimeout(function(){b(e.device_id)},1500)},isCEIPilot:A,setUserChangeNavigation:function(){h=!0,g=!0},setMethodsForCurrentFlow:function(e){e},getMethodForCurrentFlow:function(e){if(!e)return null;e,d=e.length>1;var t=null,n=0;return e.forEach(function(e){!e.locked&&!e.expired&&e.last_used>n&&(t=e,n=e.last_used)}),t},selectedTarget:b,changeTarget:function(){h=!1,g=!1,o&&o({callbackType:"Target"})},displayAuthOptions:_,invokeSuccessHandler:function(e){o&&o(e)},invokeRejectHandler:function(e){a&&a(e)},verifyOTP:function(e){n.debug("Verifying OTP"),o&&o(e)},resendOTP:function(){n.debug("Resending OTP"),o&&o({callbackType:"resend"})},showAuthCancelConfirmation:function(){$(".close").hide(),y("cancelauth",c)},getOptionsForCurrentFlow:function(e){if(!e)return null;e,d=e.length>1;var t=null,n=0;return e.forEach(function(e){var r=e.getAuthenticator();!r._authenticatorMethodConfig.locked&&!r._authenticatorMethodConfig.expired&&r._authenticatorMethodConfig.last_used>n&&(t=r,n=r._authenticatorMethodConfig.last_used)}),t},getCurrentEventDetails:function(){return{requestParameter:c,previousAuthenticator:f,currentAuthenticator:p}}}}])}(),function(){"use strict";angular.module("stepupWidget").factory("saLoggingService",function(){return{error:function(e){try{window.console&&window.console.error(e)}catch(e){}},debug:function(e){try{window.console&&window.console.debug(e)}catch(e){}}}})}(),function(e,t,n){"use strict";t.module("stepupWidget").provider("sabusyInterceptor",function(){this.$get=["$rootScope","$q","saBusyService",function(e,t,n){var r=0,i=0;function o(e){n.busyEnd(),i>=r&&(r=i=0)}return{outstanding:function(){return r-i},request:function(e){return n.busyBegin(),e||t.when(e)},response:function(e){return o(),e},responseError:function(e){return o(),t.reject(e)}}}]}).config(["$httpProvider",function(e){e.interceptors.push("sabusyInterceptor")}]),t.module("stepupWidget").directive("saBusy",["$parse","$timeout","saBusyService",function(e,t,n){return{restrict:"A",tranclude:!0,scope:{},controller:["$scope",function(e){this.setBusyMessageElement=function(t){e.busyMessageElement=t}}],link:function(e,t,r){e.busyElementID=r.busyElement,e.busyElementClassName=r.busyClass,e.startAsBusy=r.startAsBusy,e.isWidget=!1,n.addLoadingTemplate(e.busyElementID,e.busyElementClassName,e.startAsBusy)}}}]),t.module("stepupWidget").factory("saBusyService",function(){var e,n,r="divLoading",i="sa__loader",o=!1,a=function(e,t){if(!t){if(n){var r=e===n;return r&&(n=void 0),r}return!0}return n&&e?e===n:!e||(n=e,!0)},s=function(n,o,s){o=o||{};var c=t.element($("#"+r));if(!e&&a(n,!0)){o.busyDisabled&&$timeout(function(){c.attr("disabled",!0)});var u=o.busyMessageElement?o.busyMessageElement.clone():null;(u||o.busyMessage)&&c.html("").append(u||scope.busyMessage),c.addClass(i),!0===o.isWidget&&t.forEach(document.querySelectorAll(".tabDisableOnBusy"),function(e){t.element(e).removeAttr("tabindex"),t.element(e).attr("tabindex","-1")}),$("body").css("user-select","none"),t.forEach(document.querySelectorAll("input"),function(e){t.element(e).removeAttr("tabindex"),t.element(e).attr("tabindex","-1")}),t.forEach(document.querySelectorAll("a"),function(e){t.element(e).removeAttr("tabindex"),t.element(e).attr("tabindex","-1")}),t.forEach(document.querySelectorAll("button"),function(e){t.element(e).removeAttr("tabindex"),t.element(e).attr("tabindex","-1")}),$("#spinerSpan").text("One moment, please…"),$(".contentHolder").removeClass("hide"),$(".loadingSpinner").attr("aria-busy","true"),e=!0}};function c(e,t){if(e&&!$("#"+r).length){var n=$("div[busy-add-classes]");if(n.length)n.attr("id",r);else{var o=function(){var e=-1,t=navigator.userAgent,n=(t.indexOf("MSIE")>-1?new RegExp("MSIE\\s([0-9]{1,}[\\.0-9]{0,})"):new RegExp("Trident/.*?rv:([0-9]{1,}[\\.0-9]{0,})")).exec(t);null!=n&&null!=n[1]&&(e=parseFloat(n[1]));return e}(),a=8==o||9==o?$("<div></div >"):$('<div><div class="loadingSpinner"><div class="holder"><div class="bar1"></div><div class="bar2"></div><div class="bar3"></div><div class="bar4"></div><div class="bar5"></div><div class="bar6"></div><div class="bar7"></div><div class="bar8"></div><div class="bar9"></div><div class="bar10"></div><div class="bar11"></div><div class="bar12"></div></div></div></div>');a&&(a.attr("id",r),t&&a.addClass(i),e.prepend(a))}}}return{busyBegin:s,busyEnd:function(n,s,c){s=s||{};var u=t.element($("#"+r));!o&&e&&a(n,!1)&&(u.attr("disabled",!0===s.notBusyDisabled),u.removeClass(i),!0===s.isWidget&&t.forEach(document.querySelectorAll(".tabDisableOnBusy"),function(e){t.element(e).removeAttr("tabindex"),t.element(e).attr("tabindex","0")}),$("body").css("user-select","auto"),t.forEach(document.querySelectorAll("input"),function(e){t.element(e).removeAttr("tabindex"),t.element(e).attr("tabindex","0")}),t.forEach(document.querySelectorAll("a"),function(e){t.element(e).removeAttr("tabindex"),t.element(e).attr("tabindex","0")}),t.forEach(document.querySelectorAll("button"),function(e){t.element(e).removeAttr("tabindex"),t.element(e).attr("tabindex","0")}),$("#spinerSpan").text(""),$(".loadingSpinner").attr("aria-busy","false"),e=!1)},forceStopBusyEnd:function(e){return o=e},initiateBusy:function(e,t,n){r=(t=t||{}).busyElement||r,i=t.busyClass||i,c($("body"),!0),s(e,t)},addLoadingTemplate:function(e,t,n){r=e||r,i=t||i,c($("body"),n)}}})}(window,window.angular),function(){"use strict";function e(e,t,n,r,i,o,a,s,c,u){if($(".sharedauth-loading").hasClass("sharedauth-complete")||($(".sharedauth-loading").attr("aria-busy",!1),$(".sharedauth-loading").attr("aria-hidden",!0),$(".sharedauth-loading").toggleClass("sharedauth-complete")),e.Settings=c.getConfiguration(n.params.transmitParams.ClientName),void 0!==e.transmitappid&&"mbl"==e.transmitappid)o.onTrackSATransmitMobileLogin("Mobile","StepupChangeAuthSuccess",null);else if(void 0!==e.iswidget){var l={loginFormat:e.VersionNumber};o.onTrackSATransmitLogin("LoginWidget","StepupChangeAuthSuccess",l,e.iswidget)}else{var d;n&&n.params&&n.params.transmitParams&&(d=n.params.transmitParams.policyID||n.params.transmitParams.TransmitPolicy),!d&&t&&t.transmitOTPParams&&(d=t.transmitOTPParams.policyID),d||(d=e.transmitpolicy),o.onTrackCustomSharedStepUp("StepUpAuthentication","AuthenticationType",d)}var h={otp:"One-time passcode",placeholder_qa:"ID Shield questions",placeholder_password_pld:"Password",mobile_approve:" Visual pattern, fingerprint scan or Face ID (iPhone X only)"},p={mobile_approve:" Mobile push notification (fingerprint scan or Face ID)"},f=document.getElementById("errortag");f&&(f.innerHTML=""),t.dialogHeading=null,t.dialogHeading="Please select authentication method",null!==document.getElementById("stepupLiveAnnouncement")&&(document.getElementById("stepupLiveAnnouncement").innerHTML="Please select authentication method, view loaded"),setTimeout(function(){null==window.currentPageID&&void 0===window.currentPageID||a.isTuxLogin()?a.isTuxLogin()||null!=document.getElementsByClassName("contain-stepup sharedauth authlogin")[0]&&void 0!=document.getElementsByClassName("contain-stepup sharedauth authlogin")[0]||(null!=document.getElementById("authenticatorheader")||"undefined"!=document.getElementById("authenticatorheader")?(document.getElementById("authenticatorheader").setAttribute("tabindex","-1"),document.getElementById("authenticatorheader").focus()):$("#goback").first().focus()):(document.getElementById("authenticatorheader").setAttribute("tabindex","-1"),document.getElementById("authenticatorheader").focus())},100),n.params.transmitParams&&(e.methods=n.params.transmitParams,e.methods,e.getAuthenticationTypeText=function(e){return s.isCEIPilot()&&"mobile_approve"==e?p[e]:h[e]},e.authenticationMethodClicked=function(t){s.displayAuthOptions(e,e.methods,t)}),e.cancelbuttonClick=function(e){e.stopPropagation(),s.cancelAuthenticator(),a.isTuxLogin()?t.$broadcast("redirectToTuxLogin",{isError:!1}):t.$broadcast("ResetLogin",{showError:!1})},e.ReturnResponsetoCEI=function(e){"enterotpcodescreen"===e&&o.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationSkipAuthOption"),u.open("http://event/?EventName=ReturnFromOTPToCustomerProfile&parm1=")}}angular.module("stepupWidget").controller("AuthOptionController",e),e.$inject=["$scope","$rootScope","$state","$location","$compile","SASiteCatService","idShieldService","transmitEventsService","configservice","$window"]}(),function(){"use strict";function e(e,t,n,r,i,o){n.systemError&&(i.cancel(),n.$broadcast("authCancel",null)),1!=n.mainClose&&r.onTrackCustomSharedStepUp("StepUpAuthentication","AuthenticationAYS"),n.dialogHeading=null,n.dialogHeading="Are you sure you want to cancel?",null!==document.getElementById("stepupLiveAnnouncement")&&(document.getElementById("stepupLiveAnnouncement").innerHTML="Are you sure you want to cancel?, view loaded"),t&&t.params&&t.params.transmitParams&&t.params.transmitParams.ClientName?e.Settings=o.getConfiguration(t.params.transmitParams.ClientName):e.Settings=o.getConfiguration(""),e.hideChangeAuth=t&&t.params&&t.params.transmitParams&&t.params.transmitParams.hideChangeAuth||n.isUserLocked,e.showCancel=t&&t.params&&t.params.transmitParams&&t.params.transmitParams.showCancel,null==window.currentPageID&&void 0===window.currentPageID||(document.getElementById("authenticatorheader").setAttribute("tabindex","-1"),document.getElementById("authenticatorheader").focus()),e.confirmCancel=function(){i.cancelAuthenticator(),r.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationAYSYesLink",null),n.$broadcast("authCancel",null),window.modelContent.IsMobileWeb&&n.$broadcast("ResetLogin",{showError:!1})},e.tryOnce=function(){i.retryAuthenticator(),r.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationAYSNoLink",null),n.$broadcast("authRetry",null)},e.changeAuth=function(){r.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationAYSChagneAuthLink",null),i.changeAuthenticator(),n.$broadcast("authChangeMethod",null)},e.navigateArrowKeys=function(e){40==e.keyCode&&(null!=document.activeElement.parentElement.nextElementSibling&&document.activeElement.parentElement.nextElementSibling.children.length>0?angular.element(document.activeElement.parentElement.nextElementSibling.children[0].focus()):angular.element(document.querySelector("#authenticatorheader").parentNode.focus())),38==e.keyCode&&(null!=document.activeElement.parentElement.previousElementSibling&&document.activeElement.parentElement.previousElementSibling.children.length>0?angular.element(document.activeElement.parentElement.previousElementSibling.children[0].focus()):angular.element(document.querySelector("#authenticatorheader").parentNode.focus()))}}angular.module("stepupWidget").controller("ConfirmPopController",e),e.$inject=["$scope","$state","$rootScope","SASiteCatService","transmitEventsService","configservice"]}(),function(){"use strict";function e(e,t,n,r,i,o,a,s,c,u){var l,d,h,p="initial",f=[{Value:0,Text:"12:00 AM"},{Value:1,Text:"01:00 AM"},{Value:2,Text:"02:00 AM"},{Value:3,Text:"03:00 AM"},{Value:4,Text:"04:00 AM"},{Value:5,Text:"05:00 AM"},{Value:6,Text:"06:00 AM"},{Value:7,Text:"07:00 AM"},{Value:8,Text:"08:00 AM"},{Value:9,Text:"09:00 AM"},{Value:10,Text:"10:00 AM"},{Value:11,Text:"11:00 AM"},{Value:12,Text:"12:00 PM"},{Value:13,Text:"01:00 PM"},{Value:14,Text:"02:00 PM"},{Value:15,Text:"03:00 PM"},{Value:16,Text:"04:00 PM"},{Value:17,Text:"05:00 PM"},{Value:18,Text:"06:00 PM"},{Value:19,Text:"07:00 PM"},{Value:20,Text:"08:00 PM"},{Value:21,Text:"09:00 PM"},{Value:22,Text:"10:00 PM"},{Value:23,Text:"11:00 PM"}];function m(t,n){e.showOTP=!1,v(),i(function(){p="conformation",l||(l=window.jQuery),l&&l("#btnSubmit").val("Done"),e.showConfirmation=!0,e.showQuietTimeSetup=!1,e.showMobileNumberSetup=!1,e.showFormSubmit=!0,e.success=t&&t.data&&t.data.Success,e.responseMessage=n?function(t){var n="Sorry, we cannot register your mobile preferences right now. You can do this on the My Profile page after completing enrollment.";if(!t||!t.data)return n;if(null!=t.data.Reason&&"authrejected"==t.data.Reason.toLowerCase()||null!=t.data.transmitErrorResponse&&null!=t.data.transmitErrorResponse._data&&null!=t.data.transmitErrorResponse._data.failure_data&&null!=t.data.transmitErrorResponse._data.failure_data.reason&&null!=t.data.transmitErrorResponse._data.failure_data.reason.data&&null!=t.data.transmitErrorResponse._data.failure_data.reason.data.code&&"900"==t.data.transmitErrorResponse._data.failure_data.reason.data.code)return e.displayRetry=!0,"We’re sorry. Please double-check the entry and try again with a valid mobile phone number.";return n}(t):function(t){var n="Sorry, we cannot register your mobile preferences right now. You can do this on the My Profile page after completing enrollment.";if(!t||!t.data)return n;if(t.data.otpAttemptsExceeded)return n;if(t.data.Success)return"Your mobile preferences have been added.";if(400==t.data.StatusCode)return e.displayRetry=!0,"This number has already been added and confirmed by another person. Please try a different number.";if(t.data.SessionExpired)return e.displayRetry=!0,"Your confirmation code has expired. If you don’t want to submit these preferences, Skip to do this later on the My Profile page or Retry a phone number.";return n}(t)},0)}function g(){e.showQuietTimeSetup=!1,e.showMobileNumberSetup=!0,e.showConfirmation=!1,e.showFormSubmit=!0,e.showOTP=!1,e.hideChangeAuth=!0,e.showCancel=!0,e.displayRetry=!1,p="initial"}function v(){u.busyEnd("addMobilePreference",e,{},{}),$(".sharedauth-loading").hasClass("sharedauth-complete")||$(".sharedauth-loading").toggleClass("sharedauth-complete")}Object.toparams=function(e){var t=[];for(var n in e)t.push(n+"="+encodeURIComponent(e[n]));return t.join("&")},e.previousPhoneNumber="",e.navigatePage=function(e,t){n.go(e,{transmitParams:t})},g(),e.startHour=-1,e.endHour=-1,e.timeZone="",e.timeZones=[{Text:"Time Zone",Value:""},{Text:"US/Eastern −05:00 −04:00 America/New_York",Value:"US/EASTERN"},{Text:"US/East-Indiana −05:00 −04:00 America/Indiana/Indianapolis",Value:"US/EAST-INDIANA"},{Text:"US/Michigan −05:00 −04:00 America/Detroit",Value:"US/MICHIGAN"},{Text:"US/Central −06:00 −05:00 America/Chicago",Value:"US/CENTRAL"},{Text:"US/Indiana-Starke −06:00 −05:00 America/Indiana/Knox",Value:"US/INDIANA-STARKE"},{Text:"US/Mountain −07:00 −06:00 America/Denver",Value:"US/MOUNTAIN"},{Text:"US/Arizona −07:00 −07:00 America/Phoenix",Value:"US/ARIZONA"},{Text:"US/Pacific −08:00 −07:00 America/Los_Angeles",Value:"US/PACIFIC"},{Text:"US/Alaska −09:00 −08:00 America/Anchorage",Value:"US/ALASKA"},{Text:"US/Hawaii −10:00 −10:00 Pacific/Honolulu",Value:"US/HAWAII"}],function(){if(!window.modelContent)return;e.phoneNumber=window.modelContent.MobilePhone,e.existingPhoneNumber=e.phoneNumber,e.confirmPhoneNumber=window.modelContent.MobilePhone,e.phoneNumber=window.modelContent.MobilePhone,e.isMobile=window.modelContent.IsMobileWeb,e.isEligibleForSubscribingOffers=window.modelContent.IsEligibleToSubscribeForOffers,e.isSubscribedForSpecialOffers=e.isEligibleForSubscribingOffers,e.isSubscribedForSecurityAlerts=!0,e.subscribeForSecurityAlerts=window.modelContent.SubscribeForSecurityAlerts,e.subscribeForSpecialOffers=window.modelContent.SubscribeForSpecialOffers,e.isBrokerageCustomer=window.modelContent.IsBrokerageCustomer,e.isBrokerageKillSwitchEnabled=window.modelContent.IsBrokerageKillSwitchEnabled,e.username=window.modelContent.UserID,e.firstName=window.modelContent.FirstName,e.middleName=window.modelContent.MiddleName,e.lastName=window.modelContent.LastName,e.address=window.modelContent.Address,e.city=window.modelContent.City,e.state=window.modelContent.State,e.zipCode=window.modelContent.ZipCode,e.country=window.modelContent.Country,e.email=window.modelContent.PrimaryEmailAddress,e.transactionid=window.modelContent.TransactionID,e.transmitappid=window.modelContent.TransmitAppID,e.transmitpolicy=window.modelContent.TransmitPolicy,e.transmiturl=window.modelContent.TransmitURL,e.nextStepUrl=window.modelContent.NextStepURL,e.postURL=window.modelContent.PostURL,d=e.username?e.username.toLowerCase():""}(),e.startHours=[{Value:-1,Text:"Start Hour"}].concat(f),e.endHours=[{Value:-1,Text:"End Hour"}].concat(f),e.retryMmobilePreference=function(e){g(),e&&e.preventDefault()},e.proceedToNextStep=function(t){t&&t.preventDefault(),(window.parent||window).location=e.nextStepUrl},e.onTransmitSuccess=function(t){if(h&&h.dismiss(),e.dialogOpen=!1,!t||!t.resData||"400"!==t.resData.status){var n={data:{}};return v(),void m(n,!1)}p="addMobilePreference",e.transmitResponse=t,e.transmitResponse.confidenceScore=t&&t.resData?t.resData.ConfidenceFlag:"",e.showMobileNumberSetup=!1,e.showQuietTimeSetup=!0,e.showOTP=!1,e.showFormSubmit=!0,i(function(){!function t(){l||(l=window.jQuery);if(!l)return;if(0==l("#selectStartHour").length)return void i(function(){t()},0);var n=e.isMobile?{}:{width:"100px",height:"24px"};l("#selectStartHour").selectFacade(n);l("#selectStartHour").attr("ValueChanged","false");var r=e.isMobile?{}:{width:"100px",height:"24px"};l("#selectEndHour").selectFacade(r);l("#selectEndHour").attr("ValueChanged","false");var o=e.isMobile?{}:{width:"300px",height:"24px"};l("#selectTimeZone").selectFacade(o);l("#selectTimeZone").attr("ValueChanged","false");e.isMobile||l(".menu-select").addClass("height20");l(".select-label").addClass("dropdown-selecteditem")}()},0)},e.onTransmitError=function(t){h&&h.dismiss(),e.dialogOpen=!1;var n={};n.data=t||{},v(),m(n,!0)},e.verifyPhoneNumber=function(){var n,r;if(function(){e.validationErrorMessagePhone="",e.validationErrorMessageConfirmPhone="";var t=/^((?!000)[0-9]{3})[-]?([0-9]{3})[-]?([0-9]{4})$/,n=!0;e.phoneNumber&&0!==e.phoneNumber.trim().length||(e.validationErrorMessagePhone="Please enter a mobile phone number",n=!1);e.confirmPhoneNumber&&0!==e.confirmPhoneNumber.trim().length||(e.validationErrorMessageConfirmPhone="Please re-enter your mobile phone number.",n=!1);e.phoneNumber.match(t)||(e.validationErrorMessagePhone="Please double-check what you entered for the mobile phone number, and make sure you are entering only numbers.",n=!1);e.confirmPhoneNumber.match(t)||(e.validationErrorMessageConfirmPhone="Please double-check what you entered for the confirm mobile phone number, and make sure you are entering only numbers.",n=!1);e.phoneNumber!==e.confirmPhoneNumber&&(e.validationErrorMessageConfirmPhone="Please double-check what you entered for confirm mobile number and make sure it matches what you entered for mobile number",n=!1);return n}())return"initial"===p?(n={number:e.phoneNumber,firstName:e.firstName,middleName:e.middleName,lastName:e.lastName,email:e.email,streetAddress:e.address,city:e.city,postalCode:e.zipCode,region:e.state,country:e.country,Token:sessionStorage.getItem("jwToken"),AnonUserID:sessionStorage.getItem("AnonUserID"),UserID:d,ChannelID:window.modelContent.IsMobileWeb?"MOBILE_WEB":"WEB"},r={username:d,TransactionID:e.transactionid,TransmitAppID:e.transmitappid,TransmitPolicy:e.transmitpolicy,ContextData:"",hideChangeAuth:!0,showCancel:!0,dismissModalOnError:!0,showOTPHeader:e.isMobile,hideRule:e.isMobile,policyID:e.transmitpolicy},void s.showOptions(h,null,d,e.onTransmitSuccess,e.onTransmitError,e.transmitappid,e.transmitpolicy,e.transmiturl,r,e,n,c,t,a)):void("addMobilePreference"!==p?"conformation"!==p||e.proceedToNextStep():function(){u.busyBegin("addMobilePreference",e,{},{});var t=!e.unSubscribeSecurityAlerts&&e.isSubscribedForSecurityAlerts,n=!e.unSubscribeSpecialOffers&&e.isSubscribedForSpecialOffers;o({method:"POST",url:e.postURL,withCredentials:!0,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=utf-8"},data:Object.toparams({MobilePhone:e.phoneNumber,IsSubscribedForSpecialOffers:n,IsSubscribedForSecurityAlerts:t,TransmitToken:e.transmitResponse.token,ConfidenceScore:e.transmitResponse.confidenceScore,QuietTimeStart:e.startHour,QuietTimeEnd:e.endHour,QuietTimeTimeZone:e.timeZone,DeviceID:e.transmitResponse.DeviceID,TransmitPolicy:e.transmitpolicy,TransmitAppID:e.transmitappid,UserID:d,IsBrokerageKillSwitchEnabled:e.isBrokerageKillSwitchEnabled,IsBrokerageCustomer:e.isBrokerageCustomer,ExistingMobilePhone:e.existingPhoneNumber})}).then(function(e){m(e)},function(e){m(e)})}())},e.$on("ResetLogin",function(t){e.showMobileNumberSetup=!0,e.showQuietTimeSetup=!1,e.showOTP=!1,e.showFormSubmit=!0}),e.$on("loadCompleted",function(){v()}),e.$on("authCancelled",function(){g()}),e.$on("UserLocked",function(e,t){var n={data:{}};n.data.Success=!1,n.data.otpAttemptsExceeded=!0,m(n,!1)}),s.onAuthenticatorsChanged(function(){if(!e.dialogOpen){e.isMobile&&(e.showMobileNumberSetup=!1),h=r.open({backdrop:"static",keyboard:!1,templateUrl:"StepUpContainer.html",controller:"AuthModalInstanceCtrl",resolve:{}}),e.dialogOpen=null!=h,e.showOTP=!0,e.showFormSubmit=!1}}),s.onAuthenticatorCancelled(function(){h&&h.dismiss("cancel"),e.dialogOpen=!1})}angular.module("stepupWidget").controller("PhoneNumberVerificationController",e),e.$inject=["$scope","$rootScope","$state","$modal","$timeout","$http","dataContainer","transmitService","SASiteCatService","saBusyService"]}(),function(){"use strict";function e(e,t,n,r,i,o,a,s,c,u,l,d){var h=!1,p=n.params.transmitParams;if(e.VersionNumber=c.VersionNumber,t.dialogHeading=null,t.dialogHeading="ID Shield Questions",null!==document.getElementById("stepupLiveAnnouncement")&&(document.getElementById("stepupLiveAnnouncement").innerHTML="ID Shield Questions, view loaded"),document.getElementById("sharedAuthID")&&document.getElementById("sharedAuthID").removeAttribute("style"),p){var f=p.TransactionID,m=p.IDShieldBaseURL,g=p.ContextData,v=p.hasResumePlaceholder,y=p.TransmitAppID,b=p.username?p.username:e.username,A=p.policyID||p.TransmitPolicy,_=p.actimizeData?p.actimizeData:"",S=p.blackBoxData?p.blackBoxData:"",I=p.SessionGUID?p.SessionGUID:e.SessionGUID;p.clientId&&p.clientId,p.channelId&&p.channelId;e.isMobileWeb="mbl"!=y,e.hideChangeAuth=p.hideChangeAuth,e.CancelUrl=p.cancelurl?p.cancelurl:p.CancelURL,e.ClientName=p.ClientName,e.clearErrorMessage=function(){e.errorMessage="",angular.element(document.querySelector("#aw-idshield-input")).removeAttr("aria-invalid")},e.Settings=d.getConfiguration(e.ClientName),$(".sharedauth-loading").toggleClass("sharedauth-complete"),$(".sharedauth-loading").attr("aria-busy",!0),$(".sharedauth-loading").attr("aria-hidden",!1);a.getIdshieldQuestions(m,f,b,I,e.ClientName).then(function(n){e.Settings.ID_SHIELD_LOCK_ERROR_MSG="",e.Settings.ID_SHIELD_INCORRECT_ANS_MESSAGE="",angular.element(document.querySelector("#aw-idshield-input")).removeAttr("aria-invalid"),e.isMobileWeb?(null==window.currentPageID&&void 0===window.currentPageID&&$(".sharedauth-loading").focus(),setTimeout(function(){null==window.currentPageID&&void 0===window.currentPageID||a.isTuxLogin()?a.isTuxLogin()||null!=document.getElementsByClassName("contain-stepup sharedauth authlogin")[0]&&void 0!=document.getElementsByClassName("contain-stepup sharedauth authlogin")[0]||$("#goback").first().focus():(document.getElementById("authenticatorheader").setAttribute("tabindex","-1"),document.getElementById("authenticatorheader").focus())},400)):setTimeout(function(){document.getElementById("sharedAuthstepUpContainer").setAttribute("role","dialog"),document.getElementById("authenticatorheader").focus()},300);var r=document.getElementById("disablingDiv");if(r&&(r.style.display="none"),n&&n.data&&0===n.data.ErrorCode&&n.data.QestionText)e.idShieldQuestion=n.data.QestionText,e.placeHolderText=a.getPlaceholderText(n.data.AnswerFormat),e.AnswerFormat=n.data.AnswerFormat,$(".sharedauth-loading").hasClass("sharedauth-complete")||$(".sharedauth-loading").toggleClass("sharedauth-complete"),t.$broadcast("StepUp",null),t.loading=!1,l.busyEnd("transmitAuthentication",e,{},{});else{if(n&&n.data&&203==n.data.ErrorCode)return t.isUserLocked=!0,e.lockErrorMessage=!0,$(".sharedauth-loading").hasClass("sharedauth-complete")||$(".sharedauth-loading").toggleClass("sharedauth-complete"),void("mbl"!=y?(e.isApp=!1,e.Settings.ID_SHIELD_INCORRECT_ANS_MESSAGE+='<a href="" ng-click="RedirectToLoginAssist(personid)">Click here</a> to reset.',s.onTrackCustomSharedStepUp("StepUpAuthentication","AuthenticationQALockout")):"mbl"==y&&(e.isApp=!0,t.$broadcast("NotifySiteCat","100"),$(".sharedauth-loading").hasClass("sharedauth-complete")||$(".sharedauth-loading").toggleClass("sharedauth-complete")));if("mbl"!=y&&void 0!==e.iswidget){var i={challengePolicy:e.transmitpolicy,loginFormat:e.VersionNumber};s.onTrackSATransmitLogin("LoginWidget","TransmitEmptyQA",i,e.iswidget)}t.$broadcast("ResetLogin",{showError:!0})}},function(t){var n=document.getElementById("disablingDiv");n&&(n.style.display="none"),l.busyEnd("transmitAuthentication",e,{},{}),u.invokeRejectHandler("Error: ID Questions retrieval failed.")});if("mbl"!=y)if(void 0!==e.iswidget){var w={challengePolicy:e.transmitpolicy,loginFormat:e.VersionNumber};s.onTrackSATransmitLogin("LoginWidget","StepupQuestion",w,e.iswidget)}else s.onTrackCustomSharedStepUp("StepUpAuthentication","AuthenticationIDShield",A||e.transmitpolicy);else{w={challengePolicy:e.transmitpolicy};s.onTrackSATransmitMobileLogin("Mobile","StepupQuestion",w)}var k=m.split("/"),C=k[0]+"//"+k[2];e.submitAns=function(n){if(!h)if(h=!0,a.answerValidation(n,e),e.showerror||e.lockErrorMessage){if("mbl"!=y){if(void 0!==e.iswidget){var r={loginFormat:e.VersionNumber,challengePolicy:e.transmitpolicy};s.onTrackSATransmitLogin("LoginWidget","StepupQAFormatError",r,e.iswidget)}}else s.onTrackSATransmitMobileLogin("Mobile","StepupQAFormatError",null);h=!1}else{e.showerror=!1,e.lockErrorMessage=!1,e.errorMessage="",e.errorMessageIdShieldpage=!1;a.validateAnswer(m,f,n,g,y,b,A,_,I,S,e.ClientName).then(function(n){if(t.loading=!1,0==n.data.IsSuccess){if(e.showerror=!0,0==n.data.ErrorCode)if(e.errorMessage="Hmm. That answer doesn’t match our records. Please try again.",e.errorMessageIdShieldpage=!0,"mbl"!=y)if(void 0!==e.iswidget){var r={challengePolicy:e.transmitpolicy,loginFormat:e.VersionNumber};s.onTrackSATransmitLogin("LoginWidget","StepupQAFailure",r,e.iswidget)}else s.onTrackCustomSharedStepUp("StepUpAuthentication","AuthenticationQAFailedError");else"mbl"==y&&(s.onTrackSATransmitMobileLogin("Mobile","StepupQAFailure",null),t.$broadcast("NotifySiteCat","100"));if(203==n.data.ErrorCode){if(a.isLoginStepup())return e.accountLocked=!0,void e.RedirectToLoginAssist(b);if(t.isUserLocked=!0,e.lockErrorMessage=!0,"mbl"!=y){if(t.isEnrollmentFlow&&b)return e.accountLocked=!0,void e.RedirectToLoginAssist(b);e.isApp=!1,e.negativeisAppErrormsg='<span class="error">Hmm. That information doesn\'t match what we have on file. To be sure your account is secure, we\'ve locked it for now. <a href="" ng-click="RedirectToLoginAssist(personid)">Click here</a> to reset.</span>';var i=angular.element("<div>");i.html(e.negativeisAppErrormsg);var c=o(i.contents())(e);$("#qaLockError").html(""),$("#qaLockError").append(c),s.onTrackCustomSharedStepUp("StepUpAuthentication","AuthenticationQALockout")}else"mbl"==y&&(e.isApp=!0,e.isAppErrormsg='Alas, that was your third try with the wrong code. For your security, we\'ve locked your account. <a href="" ng-click="RedirectToLoginAssist(personid)">Click here</a> to reset.',t.$broadcast("NotifySiteCat","100"))}503!=n.data.ErrorCode&&-1!=n.data.ErrorCode||(document.getElementById("qaError").innerHTML="Sorry, our system is currently unavailable. Please try again later.","mbl"!=y?void 0!==e.iswidget&&s.onTrackSATransmitLogin("LoginWidget","StepupQASystemError",null,e.iswidget):s.onTrackSATransmitMobileLogin("Mobile","StepupQASystemError",null)),e.answer=""}else p.InWidget&&n.data.IsSuccess&&t.$broadcast("busy.begin",{}),v?t.$broadcast("MBQASuccess",n):n&&n.data&&n.data.Token?u.invokeSuccessHandler({token:n.data.Token}):u.invokeRejectHandler("Error: ID Shield placeholder token is empty");h=!1})}},e.changeAuth=function(){"mbl"!=y?void 0!==e.iswidget?s.onTrackSATransmitLoginClickEvent("LoginWidget","StepupQAChangeAuth",e.iswidget,null):s.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationQAChangeAuthLink",null):s.onTrackSATransmitMobileLoginClickEvent("Mobile","StepupQAChangeAuth"),u.changeAuthenticator(),t.$broadcast("authChangeMethod",null)},e.revealAnswer=function(e){var t=(e=document.getElementById(e)).type;e.type="text",setTimeout(function(){e.type=t},3e3)},e.RedirectToLoginAssist=function(n){"mbl"!=y?(n?void 0!==e.iswidget?s.onTrackSATransmitLoginClickEvent("LoginWidget","StepupForgotAnswer",e.iswidget,null):s.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationForgotLink",null):s.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationQAHelpLink",null),t.isEnrollmentFlow&&(t.userName=e.username),a.loginAssit(e.accountLocked,!1,e.isMobileWeb,C,e.CancelUrl,!1,!1,!1,e.ClientName)):(n&&s.onTrackSATransmitMobileLoginClickEvent("Mobile","StepupForgotAnswer"),t.$broadcast("LoginAssistance",1001))},e.cancelbuttonClick=function(){u.cancelAuthenticator(),a.isTuxLogin()?t.$broadcast("redirectToTuxLogin",{isError:!1}):t.$broadcast("ResetLogin",{showError:!1})},e.$on("ResetLogin",function(){e.idShieldQuestion="",e.placeHolderText="",e.AnswerFormat="",e.isAppErrormsg="",e.negativeisAppErrormsg=""}),e.onBlur=function(e){"mbl"==y&&setTimeout(function(){document.getElementById("SubmitAns").focus()},300)},t.$broadcast("ShowHideLinks",null)}}angular.module("stepupWidget").controller("IDShieldController",e),e.$inject=["$scope","$rootScope","$state","$location","$http","$compile","idShieldService","SASiteCatService","SharedAuthConstants","transmitEventsService","saBusyService","configservice"]}(),function(){"use strict";var e=angular.module("stepupWidget");function t(e,t,n,r){var i=r.VersionNumber;return{getIdshieldQuestions:function(t,r,o,a,s){var c={TransactionId:r,SignOnId:o,TransactionGUID:a,ClientName:s,VersionNumber:i};Object.toparams=function(e){var t=[];for(var n in e)t.push(n+"="+encodeURIComponent(e[n]));return t.join("&")},n.loading=!0;var u=document.getElementById("disablingDiv");return u&&(u.style.display="block"),e({method:"POST",withCredentials:!0,headers:{"Content-Type":"application/x-www-form-urlencoded"},url:t+"getstepupquestion",data:Object.toparams(c)})},validateAnswer:function(t,r,o,a,s,c,u,l,d,h,p){var f={Answer:o,ContextData:a||"",TransmitApplicationId:s,SignOnId:c,PolicyID:u,ActimizeData:l||"",TransactionGUID:d,VersionNumber:i,ClientName:p,BlackBoxData:h||""};return Object.toparams=function(e){var t=[];for(var n in e)t.push(n+"="+encodeURIComponent(e[n]));return t.join("&")},n.loading=!0,e({method:"POST",url:t+"validatestepupquestion",withCredentials:!0,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=utf-8"},data:Object.toparams(f)})},loginAssit:function(e,t,i,o,a,c,u,l,d){var h=!1;void 0!=t&&null!=t&&t&&(h=!0);try{if("undefined"!=typeof OmniDataUtil)n.$broadcast("authCancel",null),require(["login_util","login_model"],function(t,n){var r="true";null!=$("#tuxloginwidget")&&void 0!=$("#tuxloginwidget")&&$("#tuxloginwidget").length>0&&(r="false"),void 0!=c&&null!=c&&c?t.LoginAssistanceUtil("URL_SUFFIX_LOGIN_ASSISTANT_RESET_PASSWORD",r,"True","resetPassword",h):void 0!=u&&null!=u&&u?t.LoginAssistanceUtil("URL_SUFFIX_LOGIN_ASSISTANT_CHANGE_PASSWORD",r,"false","changePassword",h,!1,"",l):e?t.LoginAssistanceUtil("URL_SUFFIX_LOGIN_ASSISTANT_RESET_ANSWERS",r,"true","resetQuestions",h):t.LoginAssistanceUtil("URL_SUFFIX_LOGIN_ASSISTANT_RESET_ANSWERS",r,"false","forgotAns",h),n.model.set("LoginAssistanceFlow",!1)});else{n.$broadcast("authCancel",null);var p=document.createElement("form");p.id="LAForm",p.method="post";var f="True";null!=$("div[saloginwidget]")&&void 0!=$("div[saloginwidget]")&&$("div[saloginwidget]").length>0&&(f="False"),n.isEnrollmentFlow&&(f="False");var m="",g=document.getElementById("dvLoginWidgetDir");null!=g&&void 0!=g&&(m=g.getAttribute("baseurl"));var v="True"===f?r.loginAssistantOldUrl:r.loginAssistantUrl;p.action=null!=m&&void 0!=m&&""!=m?m+v+"ResetAnswers":v+"ResetAnswers",window.parent&&(p.target="_parent");var y="";if("True"==f){y="OLB"!=s.contextData.appName_PERS||-1==window.location.pathname.indexOf("MobileNumberCapture")&&-1==window.location.pathname.indexOf("KycRefresh")?window.location.pathname:window.parent.location.pathname;var b=document.createElement("INPUT");b.type="HIDDEN",b.value=y,b.name="ReturnURL",p.appendChild(b),y="OLB"!=s.contextData.appName_PERS||-1==window.location.pathname.indexOf("MobileNumberCapture")&&-1==window.location.pathname.indexOf("KycRefresh")?window.location.pathname:window.parent.location.pathname}else y=a||"/Auth/Login";var A=document.createElement("INPUT"),_=document.createElement("INPUT"),S=document.createElement("INPUT"),I=document.createElement("INPUT"),w=document.createElement("INPUT");S.type="HIDDEN",S.value="true",S.name="IsOTP",A.type="HIDDEN",A.value=y,A.name="CancelURL",_.type="HIDDEN",_.value="OLB",_.name="AppName";var k="False";e&&(k="True"),I.type="HIDDEN",I.value=k,I.name="LockIndicator",w.type="HIDDEN",w.name="PersonalId",n.isEnrollmentFlow&&n.userName&&(w.value=n.userName,p.appendChild(w)),p.appendChild(A),p.appendChild(_),p.appendChild(I),h&&p.appendChild(S);var C=document.createElement("INPUT");C.type="HIDDEN",C.value=f,C.name="InSession",p.appendChild(C);var E=document.createElement("INPUT");E.type="HIDDEN",E.value=d,E.name="ClientName",p.appendChild(E),document.body.appendChild(p),p.submit()}}catch(e){}},answerValidation:function(e,t){if(!e)return t.showerror=!0,void(t.errorMessage="Please enter an answer.");if(t.showerror=!1,t.errorMessage="",t.placeHolderText){switch(t.AnswerFormat){case"MMYY":t.regFormat=/^(0?[1-9]|1[012])[\/]\d\d$/,t.errorText="Please enter the date in this format: MM/YY";break;case"DATE6":t.regFormat=/^(0?[1-9]|1[012])[\/](0?[1-9]|[12][0-9]|3[01])[\/]\d\d$/,t.errorText="Please enter the date in this format: MM/DD/YY";break;case"MMDD":t.regFormat=/^(0?[1-9]|1[012])[\/](0?[1-9]|[12][0-9]|3[01])$/,t.errorText="Please enter the date in this format: MM/DD"}if(!t.regFormat.test(e))return t.showerror=!0,void(t.errorMessage=t.errorText);t.showerror=!1,t.errorMessage=""}},getPlaceholderText:function(e){switch(e){case"MMYY":return"MM/YY";case"DATE6":return"MM/DD/YY";case"MMDD":return"MM/DD";default:return""}},isLoginStepup:function(){var e=!1;return null!=$("div[saloginwidget]")&&void 0!=$("div[saloginwidget]")&&$("div[saloginwidget]").length>0&&(e=!0),e},isTuxLogin:function(){var e=!1;return null!=$("#tuxloginwidget")&&void 0!=$("#tuxloginwidget")&&$("#tuxloginwidget").length>0&&(e=!0),e},isStepUpViaSharedAuthDirective:function(){var e=!1;return null!=document.querySelector("div[sastepup]")&&void 0!=document.querySelector("div[sastepup]")&&angular.element(document.querySelector("div[sastepup]")).length>0&&(e=!0),e}}}function n(e,t,n){var r=function(){var e=navigator.userAgent;e||(e="device unknown");var t="",n=e.match(/iPhone/),r=e.match(/iPad/),i=e.match(/Android/),o=e.match(/Windows Phone/),a=e.match(/BlackBerry|BB|playbook/i);t=i?"wap:android":r?"wap:ipad":n?"wap:iphone":o?"wap:windowsPhone":a?"wap:blackBerry":"wap:other",s.eVar71=s.prop30=t,"MBL"==s.contextData.appName_PERS&&(s.prop40="mobile")},i=function(){var e=!1;return null!=$("#tuxloginwidget")&&void 0!=$("#tuxloginwidget")&&$("#tuxloginwidget").length>0&&(e=!0),e},o=function(e,t){var n={subSiteSection:"",currentPageName:""};return i&&!0===i?(n.subSiteSection=Omniture.constants[e].subSiteSectionLoginTUX,n.currentPageName="usb:mobile:wap:waptouch:login:"+Omniture.constants[e][t]):(n.subSiteSection=Omniture.constants[e].subSiteSection,n.currentPageName="omni:"+Omniture.constants[e].pageType+":"+Omniture.constants[e][t]),n},a=function(e,t,n,r){for(var i in r)if(r.hasOwnProperty(i))switch(i){case"mobileEvent":cd.currentPage=Omniture.constants.MobilePrefix+":"+s.prop30.replace("wap:","")+":"+r[i];break;case"mblprop53":s.prop53=Omniture.constants.MobilePrefix+":"+s.prop30.replace("wap:","")+":"+r[i];break;case"eventname":cd.currentPage=Omniture.constants.OmniSitePrefix+":"+cd.siteSection+":"+r[i];break;case"loginMethod":cd.loginMethod=r[i];break;case"challengeStatus":cd.challengeStatus=r[i];break;case"subSiteSection":cd.subSiteSection=r[i];break;case"errorStatus":cd.errorStatus=r[i];break;case"prop53":s.prop53=Omniture.constants.OmniSitePrefix+":"+cd.siteSection+":"+r[i]}if(null!=n)for(var i in n)if(n.hasOwnProperty(i))switch(i){case"challengePolicy":cd.challengePolicy=n[i];break;case"loginFormat":cd.loginFormat="login combine username & password|"+n[i];break;case"responseStatusCode":cd.currentPage&&n[i]&&(cd.currentPage=cd.currentPage+" response status "+n[i]),cd.errorStatus&&n[i]&&(cd.errorStatus=cd.errorStatus+" response status "+n[i]);break;case"requestName":cd.currentPage&&n[i]&&(cd.currentPage=cd.currentPage+" for req "+n[i])}};return{onTrackCustomSharedStepUp:function(e,t,n){if(Omniture.constants[e]&&Omniture.constants[e].pageType){s.clearContext(),s.clearVars(),"MBL"==s.contextData.appName_PERS&&r();var i=o(e,t);cd.currentPage=i.currentPageName,cd.siteSection=Omniture.constants[e].siteSection,cd.subSiteSection=i.subSiteSection,n&&function(e){switch(cd.challengePolicy=e,e){case"full_number":cd.challengeStatus="full account number view";break;default:cd.challengeStatus=e?e.replace(/_/g," "):""}}(n),t.indexOf("Error")>1&&(cd.transactionerror=Omniture.constants[e][t]),s.pageName="",s.prop53=cd.currentPage,s.t()}else console&&console.log&&window.console.log("Missing omniture values")},onTrackSharedStepUpClickEvent:function(e,t,n){if(Omniture.constants[e]&&Omniture.constants[e][t]){s.clearVars(),"MBL"==s.contextData.appName_PERS&&r(),s.linkTrackVars="prop8,eVar8,contextData.appNameForSiteCat,contextData.uxNameForSiteCat,contextData.appName_PERS,contextData.uxName_PERS,prop4,eVar4,prop6,prop29,eVar90,contextData.loginFormat",null!=n&&(s.contextData.loginFormat=n.loginFormat),0!=t.indexOf("AuthenticationPushResendHelpLink")&&0!=t.indexOf("AuthenticationSkip")&&0!=t.indexOf("AuthenticationSkipAuthOption")&&0!=t.indexOf("AuthenticationSkipMobileList")||(s.linkTrackVars=s.linkTrackVars+",prop53");var i=o(e,t).currentPageName;s.prop53=i,s.tl(this,"o",i,null,"navigate")}else console&&console.log&&window.console.log("Missing omniture values for ",e,t)},onTrackSATransmitLogin:function(e,t,n,r){var i;Omniture.constants[e]&&Omniture.constants[e][t]?(s.clearContext(),s.clearVars(),cd.siteSection=Omniture.constants[e].siteSection,cd.subSiteSection=Omniture.constants[e].subSiteSection,i=r?Omniture.constants[e][t]:Omniture.constants[e]["Standalone"+t],a(0,0,n,i),s.t()):console&&console.log&&window.console.log("Missing omniture values for ",e,t)},onTrackSATransmitLoginClickEvent:function(e,t,n,r){var i;Omniture.constants[e]&&Omniture.constants[e][t]?(s.clearVars(),n?(s.linkTrackVars="prop8,eVar8,contextData.appNameForSiteCat,contextData.uxNameForSiteCat,contextData.appName_PERS,contextData.uxName_PERS,prop4,eVar4,prop6,prop29,eVar90,contextData.loginFormat",null!=r&&(s.contextData.loginFormat=r.loginFormat),i=Omniture.constants[e][t]):(s.linkTrackVars="prop8,eVar8,contextData.appNameForSiteCat,contextData.uxNameForSiteCat,contextData.appName_PERS,contextData.uxName_PERS,prop4,eVar4,prop6,prop29,eVar90,contextData.loginFormat",null!=r&&(s.contextData.loginFormat=r.loginFormat),i=Omniture.constants[e]["Standalone"+t]),a(0,0,null,i),s.tl(this,"o",s.prop53,null,"navigate")):console&&console.log&&window.console.log("Missing omniture values for ",e,t)},onTrackSATransmitMobileLogin:function(e,t,n){if(Omniture.constants[e]&&Omniture.constants[e][t]){s.clearContext(),s.clearVars(),r();var i=Omniture.constants[e][t];a(0,0,n,i),s.t()}else console&&console.log&&window.console.log("Missing omniture values for ",e,t)},onTrackSATransmitMobileLoginClickEvent:function(e,t){if(Omniture.constants[e]&&Omniture.constants[e][t]){s.clearVars(),r();var n=Omniture.constants[e][t];s.linkTrackVars=s.linkTrackVars+",prop53,contextData.cd.loginMethod",a(0,0,null,n),s.tl(this,"o",s.prop53,null,"navigate")}else console&&console.log&&window.console.log("Missing omniture values for ",e,t)}}}e.factory("idShieldService",t),t.$inject=["$http","$state","$rootScope","SharedAuthConstants"],e.factory("SASiteCatService",n),n.$inject=["$http","$state","$rootScope"],e.factory("MMScrollService",function(){var e={};function t(t,n,r,i,o,a){if(1==t.length){var s=0,c=null;if("inspectorScroll"==r)if($(t)[0].id.indexOf("-usboverlaywrapper")>-1)c=$("#"+$(t)[0].id.replace("-usboverlaywrapper",""))[0],s=$("#"+$(t)[0].id.replace("-usboverlaywrapper","")).outerHeight();else{c=$("#"+window.currentInspector).find('[data-id="page_content"]')[0],s=$("#"+window.currentInspector).outerHeight();var u=$(t).data("heightabovescroller");null==u&&void 0==u||(s-=u)}else{var u=$(t).data("heightabovescroller");s=$(window).outerHeight(),ApplicationContext.getContext().getChannel()!==ApplicationContext.getContext().ANDROID||ApplicationContext.getContext().ISMOBILEWEB||(moreThanWH=1.5*s,moreThanWH>screen.height&&(s=screen.height),"overlayScroll"==r&&(s-=35)),null==u&&void 0==u||(s-=u)}var l=n[0].scrollHeight;if("overlayScroll"==r){if(c=$("#"+$(t)[0].id.replace("-usboverlaywrapper",""))[0],l+=60,ApplicationContext.getContext().getChannel()===ApplicationContext.getContext().IPAD&&!ApplicationContext.getContext().ISMOBILEWEB){var d=Math.round(.27*s);l+=Math.round(d/2),s-=d}}else"myScroll"==r&&(ApplicationContext.getContext().getChannel()===ApplicationContext.getContext().ANDROID||ApplicationContext.getContext().getChannel()===ApplicationContext.getContext().IPAD?i=40:ApplicationContext.getContext().getChannel()===ApplicationContext.getContext().IPHONE&&(i=30),c=$("#"+window.currentPageID).find('[data-id="page_content"]')[0]);"inspectorScroll"==r?1==$(window.currentInspector).find(".header-layout").length?(l+=50,s-=40):(s-=40,l+=45):(l+=50,s-=40),1==$(c).find(".footer-buttons").length&&(console.log("Now there is a footer in this content, adding buffer"),l+=50,s-=80),null!=i?(l+=i,e.specialAdjustment=i):e.specialAdjustment=0,r.indexOf("customScroll")>-1&&ApplicationContext.getContext().getChannel()===ApplicationContext.getContext().IPAD&&(s=$(t).parent().outerHeight(),l=$(n).css("height","auto").outerHeight()),t.height(s),n.height(l),window[r]?setTimeout(function(){$("<style></style>").appendTo($(document.body)).remove(),null!=window[r]&&(window[r].refresh(),o?a&&window[r].scrollTo(0,a,100):window[r].scrollTo(0,0,100))},250):(window[r]=new IScroll("#"+t.prop("id"),{bounce:!1,preventDefault:!1,onBeforeScrollStart:function(e){for(var t=e.target;1!=t.nodeType;)t=t.parentNode;"SELECT"!=t.tagName&&"INPUT"!=t.tagName&&"TEXTAREA"!=t.tagName&&e.preventDefault()}}),setTimeout(function(){window[r]&&($("<style></style>").appendTo($(document.body)).remove(),window[r].refresh(),o?a&&window[r].scrollTo(0,a,100):window[r].scrollTo(0,0,100))},250))}else 1==$("#wrapper").length&&new IScroll("#wrapper")}return e.specialAdjustment=0,e.reInitPageWhenKeyboardComesUp=function(){if(window.orgPageWrapperHeight=$("#usbwrapper").height(),window.orgPageScrollerHeight=$("#usbscroller").height(),!$("#"+window.currentPageID).hasClass("overlayInAction")){var e=$("#usbwrapper").data("heightabovescroller");null==e||void 0==e?e=0:e-=70;var t=$(window).innerHeight()-70-e;if($("#usbwrapper").height(t),$("#usbscroller").height(window.orgPageScrollerHeight+t-50),void 0!=window.focussedItem||null!=window.focussedItem){var n=-(window.focussedItem.offset().top-window.myScroll.y-100);window.myScroll.scrollTo(0,n,100),window.focussedItem=void 0}window.myScroll.refresh()}},e.reInitPageWhenKeyboardGoesDown=function(){$("#usbwrapper").height(window.orgPageWrapperHeight),$("#usbscroller").height(window.orgPageScrollerHeight),window.myScroll.refresh()},e.reInitOverlayWhenKeyboardComesUp=function(e){window.orgOverlayWrapperHeight=$("#"+e+"-usboverlaywrapper").height(),window.orgOverlayScrollerHeight=$("#"+e+"-usboverlayscrollee").height();var t,n=$("#"+e+"-usboverlaywrapper").data("heightabovescroller");if(null==n||void 0==n?n=0:n-=70,ApplicationContext.getContext().ISMOBILEWEB?(window.myScroll.disable(),t=$(window).innerHeight()):t=$(window).innerHeight()-70-n,$("#"+e+"-usboverlaywrapper").height(t),$("#"+e+"-usboverlayscrollee").height(window.orgOverlayScrollerHeight+t-50),void 0!=window.focussedItem||null!=window.focussedItem){var r=100,i=$("#"+$("#"+e)[0].id.replace("-usboverlaywrapper",""))[0];1==$(i).find(".overlay-header").length&&(r=200);var o=-(window.focussedItem.offset().top-window.overlayScroll.y-r);window.overlayScroll.scrollTo(0,o,100),window.focussedItem=void 0}window.overlayScroll.refresh(),window.overlayScroll.enable()},e.reInitOverlayWhenKeyboardGoesDown=function(e){$("#"+e+"-usboverlaywrapper").height(window.orgOverlayWrapperHeight),$("#"+e+"-usboverlayscrollee").height(window.orgOverlayScrollerHeight),window.overlayScroll.refresh()},e.disableScrolls=function(){var e=["myScroll","overlayScroll","allBlockScroll","payPersonBlockScroll","payBillsScroll","transferBlockScroll","allBlockHistoryScroll","depositHistoryScroll","pendingHistoryScroll","rejectedHistoryScroll"];for(var t in e)window[e[t]]&&window[e[t]].disable()},e.enableScrolls=function(){var e=["myScroll","overlayScroll","allBlockScroll","payPersonBlockScroll","payBillsScroll","transferBlockScroll","allBlockHistoryScroll","depositHistoryScroll","pendingHistoryScroll","rejectedHistoryScroll"];for(var t in e)window[e[t]]&&window[e[t]].enable()},e.destroyScroll=function(){e.destroyParamterizedScroll("myScroll"),e.destroyParamterizedScroll("overlayScroll")},e.destroyParamterizedScroll=function(e){window[e]&&($(window[e].scroller).removeAttr("style"),$(window[e].wrapper).removeAttr("style"),window[e].destroy(),window[e]=null)},e.scrollMyAccounts=function(e,n,r,i){t(e,n,r,i,!1)},e.updatePageWithScrollOmni=function(t,n,r,i,o){!function(t,n,r,i,o,a,s){if(1==t.length){var c=0,u=null;if("inspectorScroll"==r)if($(t)[0].id.indexOf("-usboverlaywrapper")>-1)u=$("#"+$(t)[0].id.replace("-usboverlaywrapper",""))[0],c=$("#"+$(t)[0].id.replace("-usboverlaywrapper","")).outerHeight();else{u=$("#"+window.currentInspector).find('[data-id="page_content"]')[0],c=$("#"+window.currentInspector).outerHeight();var l=$(t).data("heightabovescroller");null==l&&void 0==l||(c-=l)}else{var l=$(t).data("heightabovescroller");c=$(window).outerHeight(),ApplicationContext.getContext().getChannel()!==ApplicationContext.getContext().ANDROID||ApplicationContext.getContext().ISMOBILEWEB||(moreThanWH=1.5*c,moreThanWH>screen.height&&(c=screen.height),"overlayScroll"==r&&(c-=35)),null==l&&void 0==l||(c-=l)}var d=n[0].scrollHeight;if("manageDelegatemyscroll"===r||"myScrollAddUser"===r||"myScrollAccountDetail"===r?(c-=$(t).offset().top,null==o&&void 0==o||(d=o)):null==o&&void 0==o||(d=o),"overlayScroll"==r){if(u=$("#"+$(t)[0].id.replace("-usboverlaywrapper",""))[0],d+=60,ApplicationContext.getContext().getChannel()===ApplicationContext.getContext().IPAD&&!ApplicationContext.getContext().ISMOBILEWEB){var h=Math.round(.27*c);d+=Math.round(h/2),c-=h}}else"myScroll"==r&&(ApplicationContext.getContext().getChannel()===ApplicationContext.getContext().ANDROID||ApplicationContext.getContext().getChannel()===ApplicationContext.getContext().IPAD?i=40:ApplicationContext.getContext().getChannel()===ApplicationContext.getContext().IPHONE&&(i=30),u=$("#"+window.currentPageID).find('[data-id="page_content"]')[0]);if("inspectorScroll"==r?1==$(window.currentInspector).find(".header-layout").length?(d+=50,c-=40):(c-=40,d+=45):(d+=50,c-=40),1==$(u).find(".footer-buttons").length&&(console.log("Now there is a footer in this content, adding buffer"),d+=50,c-=80),null!=i?(d+=i,e.specialAdjustment=i):e.specialAdjustment=0,r.indexOf("customScroll")>-1&&ApplicationContext.getContext().getChannel()===ApplicationContext.getContext().IPAD&&(c=$(t).parent().outerHeight(),d=$(n).css("height","auto").outerHeight()),t.height(c),n.height(d),window[r])setTimeout(function(){$("<style></style>").appendTo($(document.body)).remove(),window[r].refresh(),a?s&&window[r].scrollTo(0,s,100):window[r].scrollTo(0,0,100)},250);else{var p=OmniDataUtil.getOmniData("mobileChannel");"iPhone"!=p&&"ipad"!=p||"ent_tc_enroll"!=r?(window[r]=new IScroll("#"+t.prop("id"),{bounce:!1,preventDefault:!1,onBeforeScrollStart:function(e){for(var t=e.target;1!=t.nodeType;)t=t.parentNode;"SELECT"!=t.tagName&&"INPUT"!=t.tagName&&"TEXTAREA"!=t.tagName&&e.preventDefault()}}),setTimeout(function(){window[r]&&($("<style></style>").appendTo($(document.body)).remove(),window[r].refresh(),a?s&&window[r].scrollTo(0,s,100):window[r].scrollTo(0,0,100))},250)):$(t).css({"-webkit-overflow-scrolling":"touch","overflow-y":"scroll"})}}else 1==$("#wrapper").length&&new IScroll("#wrapper")}($(n),$(r),t,o,i,!1)},e.updatePageWithScroll=function(e){t($("#usbwrapper"),$("#usbscroller"),"myScroll",e,!1)},e.reinitializePageWithScroll=function(n){e.destroyParamterizedScroll("myScroll"),setTimeout(function(){t($("#usbwrapper"),$("#usbscroller"),"myScroll",n,!1)},200)},e.reinitializePageWithScrollOmni=function(n){e.destroyParamterizedScroll("myScrollOmni"),setTimeout(function(){t($("#usbwrapperOmni"),$("#usbscrollerOmni"),"myScrollOmni",100,!1)},200)},e.updatePageWithScrollAndStay=function(e){t($("#usbwrapper"),$("#usbscroller"),"myScroll",null,e)},e.updatePageWithScrollWithKeyboard=function(){e.destroyParamterizedScroll("myScroll"),setTimeout(function(){t($("#usbwrapper"),$("#usbscroller"),"myScroll",$(window).outerHeight(),!0)},200)},e.updateOverlayWithScroll=function(e,n){t($("#"+e+"-usboverlaywrapper"),$("#"+e+"-usboverlayscrollee"),"overlayScroll",n,!1)},e.reinitializeOverlayWithScroll=function(n,r){e.destroyParamterizedScroll("overlayScroll"),setTimeout(function(){t($("#"+n+"-usboverlaywrapper"),$("#"+n+"-usboverlayscrollee"),"overlayScroll",r,!1)},200)},e.updateOverlayWithScrollWithKeyboard=function(n,r){e.destroyParamterizedScroll("overlayScroll"),setTimeout(function(){t($("#"+n+"-usboverlaywrapper"),$("#"+n+"-usboverlayscrollee"),"overlayScroll",$(window).outerHeight(),!1)},200)},e.updateContentWithScrollAndAdjustedHeight=function(e,n,r,i){t($("#"+e),$("#"+n),r,i,!1)},e.updatePageWithScrollAndStay=function(e){t($("#usbwrapper"),$("#usbscroller"),"myScroll",e,!0)},e.updateOverlayWithScrollAndStay=function(e,n){t($("#"+e+"-usboverlaywrapper"),$("#"+e+"-usboverlayscrollee"),"overlayScroll",n,!0)},e.updateInspectorWithScroll=function(n,r){if(e.disableScrolls(),$("#"+n+" #usbwrapper").length)return $("#"+n+" #usbwrapper").attr("id","usbwrapper-inspector"),$("#"+n+" #usbscroller").attr("id","usbscroller-inspector"),void t($("#"+n+" #usbwrapper-inspector"),$("#"+n+" #usbscroller-inspector"),"inspectorScroll",r,!1);$("#"+n+"-usboverlaywrapper").length?t($("#"+n+"-usboverlaywrapper"),$("#"+n+"-usboverlayscrollee"),"inspectorScroll",r,!1):e.updateCalendarCustom(0)},e.reinitializeInspectorWithScroll=function(){e.disableScrolls(),$("#usbwrapper-inspector").length?t($("#usbwrapper-inspector"),$("#usbscroller-inspector"),"inspectorScroll",null,!1):$("#"+overlayDivId+"-usboverlaywrapper").length&&t($("#"+overlayDivId+"-usboverlaywrapper"),$("#"+overlayDivId+"-usboverlayscrollee"),"inspectorScroll",adjustedHeight,!1)},e.createCustomScroll=function(n){e.destroyParamterizedScroll("customScroll"+n),t($("#customusbwrapper"+n),$("#customusbscroller"+n),"customScroll"+n,0,!0)},e.updateCustomScroll=function(e){1==$("#customusbwrapper"+e).length&&($("#customusbscroller"+e).css("height","auto"),window["customScroll"+e].refresh())},e.updateCalendarCustom=function(n){e.destroyParamterizedScroll("dateScroll"),t($("#datepicker-usbwrapper"),$("#datepicker-usbscroller"),"dateScroll",n,!1)},e.reinitializeTimelineScroll=function(n,r,i,o){window.timelineWrapper=n,window.timelineScroller=r,window.timelineScrollkey=i,window.timelineScrollAdjustedHeight=o,e.destroyParamterizedScroll(i),t($("#"+n),$("#"+r),i,o,!1)},e.updateTimelineScroll=function(e,t,n,r,i){window.timelineWrapper=e,window.timelineScroller=t,window.timelineScrollkey=n,window.timelineScrollAdjustedHeight=r;var o=$(window).height()-$("header").height();$("#"+e).height(o),$("#"+t).css("height","auto"),ApplicationContext.getContext().getChannel()===ApplicationContext.getContext().IPAD?$("#"+t).height($("#"+t).height()+140):$("#"+t).height($("#"+t).height()+80),n&&window[n].refresh()},e.updatePageScroll=function(){var e=$(window).height()-$("header").height();$("#usbwrapper").height(e),$("#usbscroller").css("height","auto"),ApplicationContext.getContext().getChannel()===ApplicationContext.getContext().IPAD?$("#usbscroller").height($("#usbscroller").height()+140):$("#usbscroller").height($("#usbscroller").height()+80),window.myScroll&&window.myScroll.refresh()},e})}(),function(){function e(e,t,n,r,i,o,a){var s,c,u=a.VersionNumber;function l(t){var n;c=t,s.isOAMEnabled?(n=s,e({method:"GET",withCredentials:!0,url:n.authBaseUrl+"/auth/signon/signonvalidate"}).then(function(e){return v(e,n,"signon validate")},function(e){return!1})).then(h,p):A(t,s)}function d(e){y(e,s)}function h(e){e?A(c,s):g(s).then(f,m)}function p(e){403==e.status?A(c,s):g(s).then(f,m)}function f(e){v(e,s,"webgate")?e.data.Success?A(c,s):y(e,s):r.isTuxLogin()?t.$broadcast("redirectToTuxLogin",{isError:!0}):t.$broadcast("ResetLogin",{showError:!0})}function m(e){b(e,s,"TransmitWebgateReqErr")}function g(t){return e({method:"GET",withCredentials:!0,url:t.authBaseUrl+"/auth/login/protectedResource",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=utf-8"}}).then(function(n){return e({method:"POST",url:t.OAMPostUrl,withCredentials:!0,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=utf-8"},data:Object.toparams({UserId:t.username,Password:t.Password})})},function(e){b(e,t,"TransmitProtectedResourceReqErr")})}function v(e,t,r){if(!e||!e.headers()){var i={requestName:r,loginFormat:u,challengePolicy:t.TransmitPolicy};return n.onTrackSATransmitLogin("LoginWidget","TransmitUnExpectedContent",i,t.InWidget),!1}var o=e.headers()["content-type"];if(o&&o.indexOf("application/json")>=0)return!0;i={requestName:r,loginFormat:u,challengePolicy:this.TransmitPolicy};return n.onTrackSATransmitLogin("LoginWidget","TransmitUnExpectedContent",i,t.InWidget),!1}function y(e,o){switch(i.invokeRejectHandler(e),e.data.Status){case 1:if("mbl"!=o.AppId)if(void 0===o.InWidget||r.isTuxLogin())n.onTrackCustomSharedStepUp("StepUpAuthentication","StepUpPasswordFailure",o.TransmitPolicy);else{var a={loginFormat:u};n.onTrackSATransmitLogin("LoginWidget","EnterPasswordUserError",a,o.InWidget)}r.isTuxLogin()?t.$broadcast("redirectToTuxLogin",{isError:!0,errorCode:1}):t.$broadcast("ResetLogin",{showError:!0,errorCode:1});break;case 2:"mbl"!=o.AppId&&void 0!==o.InWidget&&n.onTrackSATransmitLogin("LoginWidget","EnterPasswordExpiredError",null,o.InWidget),r.isTuxLogin()?t.$broadcast("redirectToTuxLogin",{isError:!0,errorCode:2}):t.$broadcast("ResetLogin",{showError:!0,errorMsg:"Your temporary password expired. Please reset it below."});break;case 3:"mbl"!=o.AppId&&void 0!==o.InWidget&&n.onTrackSATransmitLogin("LoginWidget","EnterPasswordLockoutError",null,o.InWidget),r.isTuxLogin()?t.$broadcast("redirectToResetPassword",null):t.$broadcast("RedirectToLA",{ResetPwd:!0,Locked:!0});break;case 5:case 6:case 7:"mbl"!=o.AppId&&void 0!==o.InWidget&&n.onTrackSATransmitLogin("LoginWidget","EnterPasswordUserDisabledError",null,o.InWidget),r.isTuxLogin()||t.$broadcast("ResetSALogin",{showError:!0,errorMessage:"We're sorry; it looks like your personal ID has been disabled.  Please contact 800-987-7237 for help."}),r.isTuxLogin()&&t.$broadcast("redirectToTuxLogin",{isError:!0,errorCode:567});break;case 99:r.isTuxLogin()?t.$broadcast("redirectToResetPassword",{isChangePassword:!0,existingPassword:o.Password}):t.$broadcast("ChangePassword",{response:e,existingPwd:o.Password});break;default:"mbl"!=o.AppId&&void 0!==o.InWidget&&n.onTrackSATransmitLogin("LoginWidget","EnterPasswordSystemError",null,o.InWidget),r.isTuxLogin()?t.$broadcast("redirectToTuxLogin",{isError:!0}):t.$broadcast("ResetLogin",{showError:!0})}}function b(e,i,o){callInProgress=!1;var a={responseStatusCode:e&&e.status?e.status:"unknown",challengePolicy:i.TransmitPolicy};n.onTrackSATransmitLogin("LoginWidget",o,a,i.InWidget),r.isTuxLogin()?t.$broadcast("redirectToTuxLogin",{isError:!0}):t.$broadcast("ResetLogin",{showError:!0})}function A(e,n){v(e,"password validate api")?(t.$broadcast("busy.begin",{}),0==e.data.Success?y(e,n):(null!=e.data&&null!=e.data.OBSSOCookie&&(o.OBSSOCookieValue=e.data.OBSSOCookie.m_value),e&&e.data&&e.data.Token?i.invokeSuccessHandler({token:e.data.Token}):i.invokeRejectHandler("Error: Password placeholder token is empty"),t.$broadcast("PwdSuccess",e))):r.isTuxLogin()?t.$broadcast("redirectToTuxLogin",{isError:!0}):(t.$broadcast("busy.end",{remaining:0}),t.loading=!1,t.$broadcast("ResetLogin",{showError:!0}))}this.submitPassword=function(n){this.TransmitPolicy=n.TransmitPolicy,s=n,t.$broadcast("busy.begin",{}),function(n){t.loading=!0;var r={SignOnID:n.username,Password:n.Password,ContextData:n.ContextData?n.ContextData:"",TransmitApplicationId:n.TransmitAppID,TransactionGUID:n.SessionGUID,IsOLB:!1,ActimizeData:n.actimizeData,VersionNumber:u,ClientName:n.ClientName,BlackBoxData:n.blackBoxData,clientId:n.clientId,channelId:n.channelId};return e({method:"POST",url:n.PasswordBaseURL+"Validate",withCredentials:!0,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=utf-8"},data:Object.toparams(r)})}(n).then(l,d)},Object.toparams=function(e){var t=[];for(var n in e)t.push(n+"="+encodeURIComponent(e[n]));return t.join("&")}}angular.module("stepupWidget").service("PasswordService",e),e.$inject=["$http","$rootScope","SASiteCatService","idShieldService","transmitEventsService","dataContainer","SharedAuthConstants"]}(),function(){"use strict";function e(e,t,n,r,i,o,a,c,u,l){var d=n.params.transmitParams;if(e.VersionNumber=a.VersionNumber,e.hideChangeAuth=d.hideChangeAuth,e.IsTempAccessFlow=7==n.params.transmitParams.otp_format.length,e.Year=(new Date).getFullYear(),e.hideChangeAuth=n.params&&n.params.transmitParams&&n.params.transmitParams.hideChangeAuth||t.isUserLocked,e.showCancel=n.params&&n.params.transmitParams&&n.params.transmitParams.showCancel,e.showOTPHeader=n.params&&n.params.transmitParams&&n.params.transmitParams.showOTPHeader,e.hideRule=n.params&&n.params.transmitParams&&n.params.transmitParams.hideRule,e.ReturnResponsetoCEI=function(e){"enterotpcodescreen"===e&&(s.linkTrackVars=s.linkTrackVars+",prop53",s.prop53="omni:system:step up verify mobile enter otp return to cei link",s.tl(this,"o","omni:system:step up verify mobile enter otp return to cei link",null,"navigate")),s.tl(),l.open("http://event/?EventName=ReturnFromOTPToCustomerProfile&parm1=")},e.Settings=u.getConfiguration(d.ClientName),e.loginWigetDirective=t.loginWigetDirective,t.AccessFlowMessage=e.IsTempAccessFlow,e.IsTempAccessFlow)e.otplength=7,e.otpheading="Temporary access code",e.otpsubheading="Temporary access code",e.otpplaceholder="7-digit code",e.otpheadingmessage="After loging in with your banker provided Temporary Access Code, we highly recommend you navigate to Customer Service|My Profile and update your Login Preferences and Additional Authenticators, ex. Choose new ID Shield Questions.";else{if(e.otplength=6,e.otpheadingmessage="Please enter the code we sent to you. It will expire in 15 minutes.",e.isCEI||e.is24HBScreen){var h=t.number;e.otpheadingmessagefor24HB="Please enter the one-time passcode we sent to the phone number ending in "+h.substring(6,10)+". It will expire in 15 minutes."}e.otpheadingmessage_thirdparty="Please enter the code we sent to your mobile phone. It will expire in 15 minutes.",e.otpsubheading="6-digit code",e.otpplaceholder="6-digit code",e.otpheading="One-Time Passcode"}if(void 0!==e.transmitappid&&"mbl"==e.transmitappid)o.onTrackSATransmitMobileLogin("Mobile","StepupEnterOTPCode",null);else if(void 0!==e.iswidget){var p={loginFormat:e.VersionNumber};o.onTrackSATransmitLogin("LoginWidget","StepupEnterOTPCode",p,e.iswidget)}else{var f;n&&n.params&&n.params.transmitParams&&(f=n.params.transmitParams.policyID||n.params.transmitParams.TransmitPolicy),!f&&t&&t.transmitOTPParams&&(f=t.transmitOTPParams.policyID),f||(f=e.transmitpolicy),o.onTrackCustomSharedStepUp("StepUpAuthentication","AuthenticationTypeOTPVerify",f)}t.dialogHeading=null,t.dialogHeading="One-Time Passcode",t.dialogHeading24hbCEI="One-Time Passcode",null!==document.getElementById("stepupLiveAnnouncement")&&(document.getElementById("stepupLiveAnnouncement").innerHTML="One-Time Passcode, view loaded"),null==window.currentPageID&&void 0===window.currentPageID&&$(".sharedauth-loading").focus(),setTimeout(function(){null==window.currentPageID&&void 0===window.currentPageID||i.isTuxLogin()?i.isTuxLogin()||null!=document.getElementsByClassName("contain-stepup sharedauth authlogin")[0]&&void 0!=document.getElementsByClassName("contain-stepup sharedauth authlogin")[0]?(document.getElementById("authenticatorheader").setAttribute("tabindex","-1"),document.getElementById("authenticatorheader").focus()):$("#goback").first().focus():(document.getElementById("authenticatorheader").setAttribute("tabindex","-1"),document.getElementById("authenticatorheader").focus())},400),e.otpCode="";var m=t.transmitOTPParams?t.transmitOTPParams.TransmitAppID:"",g=t.transmitOTPParams?t.transmitOTPParams.IDShieldBaseURL:"";e.isMobileWeb="mbl"!=m;var v=g.split("/"),y=v[0]+"//"+v[2];e.otpLogin=function(){if(document.getElementById("aw-otp-input")&&""==document.getElementById("aw-otp-input").value){if(e.setOtpError("Please enter OTP code in the field."),"mbl"==m){var n={challengePolicy:e.transmitpolicy,loginFormat:e.VersionNumber};o.onTrackSATransmitMobileLogin("Mobile","StepupEnterOTPFormatError",n)}else if(void 0!==e.iswidget){n={challengePolicy:e.transmitpolicy,loginFormat:e.VersionNumber};o.onTrackSATransmitLogin("LoginWidget","StepupEnterOTPFormatError",n,e.iswidget)}}else if(document.getElementById("aw-otp-input")&&isNaN(document.getElementById("aw-otp-input").value)){if(e.IsTempAccessFlow?e.setOtpError("Please enter your 7-digit Temporary Access Code using numbers only."):e.setOtpError("Enter numbers only please, and no more than six digits."),"mbl"==m){n={challengePolicy:e.transmitpolicy,loginFormat:e.VersionNumber};o.onTrackSATransmitMobileLogin("Mobile","StepupEnterOTPFormatError",n)}else if(void 0!==e.iswidget){n={challengePolicy:e.transmitpolicy,loginFormat:e.VersionNumber};o.onTrackSATransmitLogin("LoginWidget","StepupEnterOTPFormatError",n,e.iswidget)}}else e.setOtpError(""),c.verifyOTP(e.otpCode),t.$broadcast("otpLogin",e.otpCode)},e.setOtpError=function(t){var n=document.getElementById("aw-otp-input");"mno_confidence"!==e.transmitpolicy&&"web_phone_register"!==e.transmitpolicy&&"verify_new_entitlee"!==e.transmitpolicy||(""===t||null===t||void 0===t?(t="",n.classList.remove("la__error-field")):n.classList.toggle("la__error-field"),n.value="",n.focus()),document.getElementById("otpError").innerHTML=t},e.otpResend=function(){e.setOtpError("");var n={loginFormat:e.VersionNumber};o.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationResendLink",n),c.resendOTP(),t.$broadcast("otpResend",null)},e.changeTarget=function(){if("mbl"!=m)if(void 0!==e.iswidget){var n={challengePolicy:e.transmitpolicy,loginFormat:e.VersionNumber};o.onTrackSATransmitLoginClickEvent("LoginWidget","StepupQAChangeAuth",e.iswidget,n)}else o.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationQAChangeAuthLink",null);else o.onTrackSATransmitMobileLoginClickEvent("Mobile","StepupQAChangeAuth");c.changeTarget(),t.$broadcast("authChangeMethod",null)},e.changeAuth=function(){if("mbl"!=m)if(void 0!==e.iswidget){var n={challengePolicy:e.transmitpolicy,loginFormat:e.VersionNumber};o.onTrackSATransmitLoginClickEvent("LoginWidget","StepupQAChangeAuth",e.iswidget,n)}else o.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationQAChangeAuthLink",null);else o.onTrackSATransmitMobileLoginClickEvent("Mobile","StepupQAChangeAuth");c.changeAuthenticator(),t.$broadcast("authChangeMethod",null)},e.RedirectToLoginAssist=function(n){t.isEnrollmentFlow&&(t.userName=e.username),o.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationOTPHelpLink",null),i.loginAssit(e.accountLocked,!0,e.isMobileWeb,y)},e.validateinput=function(e){return 0==e.charCode||e.charCode>=48&&e.charCode<=57},e.cancelbuttonClick=function(e){e.stopPropagation(),c.cancelAuthenticator(),i.isTuxLogin()?t.$broadcast("redirectToTuxLogin",{isError:!1}):t.$broadcast("ResetLogin",{showError:!1})},t.$broadcast("ShowHideLinks",null)}angular.module("stepupWidget").controller("InputOTPController",e),e.$inject=["$scope","$rootScope","$state","$location","idShieldService","SASiteCatService","SharedAuthConstants","transmitEventsService","configservice","$window"]}(),function(){"use strict";function e(e,t,n,r,i,o,a,s,c){var u=n.params.transmitParams;e.hideChangeAuth=u.hideChangeAuth;var l,d=u.TransmitAppID;(e.Settings=s.getConfiguration(u.ClientName),document.getElementById("sharedAuthID")&&document.getElementById("sharedAuthID").removeAttribute("style"),void 0!==e.transmitappid&&"mbl"==e.transmitappid)?o.onTrackSATransmitMobileLogin("Mobile","StepupMobApprove",null):void 0!==e.iswidget?o.onTrackSATransmitLogin("LoginWidget","StepupMobApprove",null,e.iswidget):(n&&n.params&&n.params.transmitParams&&(l=n.params.transmitParams.policyID||n.params.transmitParams.TransmitPolicy),!l&&t&&t.transmitOTPParams&&(l=t.transmitOTPParams.policyID),l||(l=e.transmitpolicy),o.onTrackCustomSharedStepUp("StepUpAuthentication","AuthenticationTypeMobileApprove",l));if(e.devices=[],t.dialogHeading=null,t.dialogHeading="Please select how you want us to deliver a push notification to authenticate you",null!==document.getElementById("stepupLiveAnnouncement")&&(document.getElementById("stepupLiveAnnouncement").innerHTML="Please select how you want us to deliver a push notification to authenticate you, view loaded"),null==window.currentPageID&&void 0===window.currentPageID&&$(".sharedauth-loading").focus(),setTimeout(function(){null==window.currentPageID&&void 0===window.currentPageID||i.isTuxLogin()?i.isTuxLogin()||null!=document.getElementsByClassName("contain-stepup sharedauth authlogin")[0]&&void 0!=document.getElementsByClassName("contain-stepup sharedauth authlogin")[0]?document.getElementById("authenticatorheader").focus():$("#goback").first().focus():document.getElementById("authenticatorheader").focus()},400),n.params.transmitParams){if(n.params.transmitParams.selectable_devices.constructor===Array)e.devices=n.params.transmitParams.selectable_devices,a.isCEIPilot()&&t.isSpecific&&(e.devices=n.params.transmitParams.customDeviceListInfo);else{var h=n.params.transmitParams.selectable_devices;a.isCEIPilot()&&t.isSpecific&&(h=n.params.transmitParams.customDeviceListInfo),e.devices=[h]}e.targetClick=function(e){a.selectedTarget(e.device_id),t.$broadcast("selectedDevice",e.device_id)}}e.hasDevices=e.devices.length>0,t.$broadcast("ShowHideLinks",null),e.changeAuth=function(){"mbl"!=d?void 0!==e.iswidget?o.onTrackSATransmitLoginClickEvent("LoginWidget","StepupQAChangeAuth",e.iswidget):o.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationQAChangeAuthLink",null):o.onTrackSATransmitMobileLoginClickEvent("Mobile","StepupQAChangeAuth"),a.changeAuthenticator(),t.$broadcast("authChangeMethod",null)},e.cancelbuttonClick=function(e){e.stopPropagation(),a.cancelAuthenticator(),i.isTuxLogin()?t.$broadcast("redirectToTuxLogin",{isError:!1}):t.$broadcast("ResetLogin",{showError:!1})},e.ReturnResponsetoCEI=function(e){"enterotpcodescreen"===e&&o.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationSkipMobileList"),c.open("http://event/?EventName=ReturnFromOTPToCustomerProfile&parm1=")}}function t(e,t,n,r,i,o){e.cancelbuttonClick=function(){i.isTuxLogin()?t.$broadcast("redirectToTuxLogin",{isError:!1}):t.$broadcast("ResetLogin",{showError:!1})}}angular.module("stepupWidget").controller("MobileApproveController",e),e.$inject=["$scope","$rootScope","$state","$location","idShieldService","SASiteCatService","transmitEventsService","configservice","$window"],angular.module("stepupWidget").controller("ErrorPageController",t),t.$inject=["$scope","$rootScope","$state","$location","idShieldService","SASiteCatService"]}(),function(){"use strict";function e(e,t,n,r,i,o,a,c,u,l){var d=n.params.transmitParams;e.hideChangeAuth=d.hideChangeAuth,e.VersionNumber=a.VersionNumber;var h=d.TransmitAppID;if(e.Settings=u.getConfiguration(d.ClientName),document.getElementById("sharedAuthID")&&document.getElementById("sharedAuthID").removeAttribute("style"),void 0!==e.transmitappid&&"mbl"==e.transmitappid)o.onTrackSATransmitMobileLogin("Mobile","StepupSelectOTPDevice",null);else if(void 0!==e.iswidget){var p={loginFormat:e.VersionNumber};o.onTrackSATransmitLogin("LoginWidget","StepupSelectOTPDevice",p,e.iswidget)}else{var f;n&&n.params&&n.params.transmitParams&&(f=n.params.transmitParams.policyID||n.params.transmitParams.TransmitPolicy),!f&&t&&t.transmitOTPParams&&(f=t.transmitOTPParams.policyID),f||(f=e.transmitpolicy),o.onTrackCustomSharedStepUp("StepUpAuthentication","AuthenticationTypeOTP",f)}t.dialogHeading=null,null!==document.getElementById("stepupLiveAnnouncement")&&(document.getElementById("stepupLiveAnnouncement").innerHTML="Please select how you want us to deliver a one-time passcode to you, view loaded"),null==window.currentPageID&&void 0===window.currentPageID&&$(".sharedauth-loading").focus(),setTimeout(function(){null==window.currentPageID&&void 0===window.currentPageID||i.isTuxLogin()?i.isTuxLogin()||null!=document.getElementsByClassName("contain-stepup sharedauth authlogin")[0]&&void 0!=document.getElementsByClassName("contain-stepup sharedauth authlogin")[0]||$("#goback").first().focus():(document.getElementById("authenticatorheader").setAttribute("tabindex","-1"),document.getElementById("authenticatorheader").focus())},400),n.params.transmitParams&&(e.targets=n.params.transmitParams.channels[0].targets,e.targetClick=function(e){c.selectedTarget(e),t.number=e,t.$broadcast("selectedTarget",e)},e.sendSMS=function(e){c.selectedTarget(e),t.$broadcast("selectedTarget",e)}),t.$broadcast("ShowHideLinks",null),e.ReturnResponsetoCEI=function(e){"selectotpenterscreen"===e&&(s.linkTrackVars=s.linkTrackVars+",prop53",s.prop53="omni:system:select mobile token for otp return to cei link",s.tl(this,"o","omni:system:select mobile token for otp return to cei link",null,"navigate")),s.tl(),l.open("http://event/?EventName=ReturnFromOTPToCustomerProfile&parm1=")},e.changeAuth=function(){if("mbl"!=h)if(void 0!==e.iswidget){var n={loginFormat:e.VersionNumber};o.onTrackSATransmitLoginClickEvent("LoginWidget","StepupQAChangeAuth",e.iswidget,n)}else o.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationQAChangeAuthLink",null);else o.onTrackSATransmitMobileLoginClickEvent("Mobile","StepupQAChangeAuth");c.changeAuthenticator(),t.$broadcast("authChangeMethod",null)},e.cancelbuttonClick=function(e){e.stopPropagation(),c.cancelAuthenticator(),i.isTuxLogin()?t.$broadcast("redirectToTuxLogin",{isError:!1}):t.$broadcast("ResetLogin",{showError:!1})}}angular.module("stepupWidget").controller("OTPTargetController",e).filter("formatetarget",function(){return function(e){return-1!==e.indexOf("@")?e:e.substring(6,10)}}),e.$inject=["$scope","$rootScope","$state","$location","idShieldService","SASiteCatService","SharedAuthConstants","transmitEventsService","configservice","$window"]}(),function(){"use strict";function e(e,t,n,r,i,o,a,s){var c;void 0!==e.transmitappid&&"mbl"==e.transmitappid?o.onTrackSATransmitMobileLogin("Mobile","StepupMobApprovePending",null):void 0!==e.iswidget?o.onTrackSATransmitLogin("LoginWidget","StepupMobApprovePending",null,e.iswidget):(n&&n.params&&n.params.transmitParams&&(c=n.params.transmitParams.policyID||n.params.transmitParams.TransmitPolicy),!c&&t&&t.transmitOTPParams&&(c=t.transmitOTPParams.policyID),c||(c=e.transmitpolicy),o.onTrackCustomSharedStepUp("StepUpAuthentication","AuthenticationTypeMobileApprovePending",c));var u=t.transmitOTPParams?t.transmitOTPParams.TransmitAppID:"",l=t.transmitOTPParams?t.transmitOTPParams.IDShieldBaseURL:"";e.isMobileWeb="mbl"!=u;var d=l.split("/"),h=d[0]+"//"+d[2];if(t.dialogHeading=null,t.dialogHeading="Authorization Pending",null!==document.getElementById("stepupLiveAnnouncement")&&(document.getElementById("stepupLiveAnnouncement").innerHTML="Authorization Pending, View loaded"),null==window.currentPageID&&void 0===window.currentPageID&&$(".sharedauth-loading").focus(),setTimeout(function(){null==window.currentPageID&&void 0===window.currentPageID||i.isTuxLogin()?i.isTuxLogin()||null!=document.getElementsByClassName("contain-stepup sharedauth authlogin")[0]&&void 0!=document.getElementsByClassName("contain-stepup sharedauth authlogin")[0]||$("#goback").first().focus():(document.getElementById("authenticatorheader").setAttribute("tabindex","-1"),document.getElementById("authenticatorheader").focus())},400),e.changeAuth=function(){o.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationPushChangeAuthLink",null),a.changeAuthenticator(),t.$broadcast("authChangeMethod",null)},e.tryOnce=function(){o.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationChangeDeviceLink",null),a.retryAuthenticator(),t.$broadcast("authRetry",null)},e.RedirectToLoginAssist=function(t){o.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationPushHelpLink",null),i.loginAssit(e.accountLocked,!1,e.isMobileWeb,h)},e.cancelbuttonClick=function(){a.cancelAuthenticator(),i.isTuxLogin()?t.$broadcast("redirectToTuxLogin",{isError:!1}):t.$broadcast("ResetLogin",{showError:!1})},e.ReturnResponsetoCEI=function(e){"enterotpcodescreen"===e&&o.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationSkip"),s.open("http://event/?EventName=ReturnFromOTPToCustomerProfile&parm1=")},e.resendPush=function(e){o.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationPushResendHelpLink"),a.resendPush(e)},e.navigateArrowKeys=function(e){40==e.keyCode&&(null!=document.activeElement.parentElement.nextElementSibling&&document.activeElement.parentElement.nextElementSibling.children.length>0?angular.element(document.activeElement.parentElement.nextElementSibling.children[0].focus()):angular.element(document.querySelector("#authenticatorheader").parentNode.focus())),38==e.keyCode&&(null!=document.activeElement.parentElement.previousElementSibling&&document.activeElement.parentElement.previousElementSibling.children.length>0?angular.element(document.activeElement.parentElement.previousElementSibling.children[0].focus()):angular.element(document.querySelector("#authenticatorheader").parentNode.focus()))},e.deviceList=[],e.selectedDeviceInfo={},n.params.transmitParams.selectable_devices.constructor===Array)if(e.deviceList=n.params.transmitParams.selectable_devices,e.selectedDeviceInfo.instructions=n.params.transmitParams.instructions,e.selectedDeviceInfo.isSpecific=void 0!==n.params.transmitParams.strategy&&"specific"==n.params.transmitParams.strategy.type,e.customDeviceListInfo=n.params.transmitParams.customDeviceListInfo,e.targetSelectedDevice=n.params.transmitParams.targetSelectedDevice,void 0!==n.params.transmitParams&&void 0!==e.customDeviceListInfo&&void 0!==e.targetSelectedDevice)if(e.deviceList.length>0&&e.customDeviceListInfo.length>0){for(var p=0;p<e.customDeviceListInfo.length;p++)if(e.customDeviceListInfo[p].device_id==e.targetSelectedDevice._targetIdentifier){m(e.customDeviceListInfo[p],e.selectedDeviceInfo);break}}else e.selectedDeviceInfo.model="";else void 0!==e.customDeviceListInfo&&e.customDeviceListInfo.length>0&&1==e.customDeviceListInfo.user_selection?m(e.customDeviceListInfo[0],e.selectedDeviceInfo):e.selectedDeviceInfo.model="";else{var f=n.params.transmitParams.selectable_devices;e.deviceList=[f]}function m(e,t){t.model=e.model,t.device_id=e.device_id}e.deviceList.length<2?$("#linkdiable").hide():$("#linkdiable").show(),t.$broadcast("ShowHideLinks",null)}angular.module("stepupWidget").controller("PendingApprovalController",e),e.$inject=["$scope","$rootScope","$state","$location","idShieldService","SASiteCatService","transmitEventsService","$window"]}(),function(){"use strict";angular.module("stepupWidget").directive("sastepup",["SASiteCatService","transmitService",function(e,t){return{restrict:"A",transclude:!0,replace:!1,templateUrl:"StepUpContainerOmni.html",scope:{username:"@",transmiturl:"@",idshieldbaseurl:"@",transactionid:"@",transmitappid:"@",authtype:"@",transmitpolicy:"@"},link:function(e,t,n){e.showServiceModal(),e.showAuthModal=!0},controller:["$scope","$state","$element","$rootScope",function(n,r,i,o){function a(){o.mainClose=!0,n.showAuthModal=!1,i.html(""),n.$parent.onStepUpClose&&(n.$parent.parentObj&&(n.$parent.parentObj.IsOTPSuccess=!1,o.isUserLocked?n.$parent.parentObj.IsOTPCanceled=!1:n.$parent.parentObj.IsOTPCanceled=!0),n.$parent.onStepUpClose())}var s={username:n.username?n.username.toLowerCase():n.username,TransactionID:n.transactionid,IDShieldBaseURL:n.idshieldbaseurl,ContextData:"",authType:n.authtype?n.authtype:"",TransmitAppID:n.transmitappid?n.transmitappid:"web"};function c(e,t){if(e){var n=document.getElementById(e);n&&(n.innerHTML=t)}}n.transmitOTPParams=s,n.qACxcObj={isQaSet:!1},n.isFromDirective=!0,n.dlgInstance=null,n.cancel=function(){t.iAuthenticationErrored()&&a(),n.navigatePage("cancelauth",null)},t.clearEventHandlers(),t.onAuthenticatorCancelled(function(){r.params.transmitParams&&"mbl"!==r.params.transmitParams.TransmitAppID&&(r.params.transmitParams&&"otp"==r.params.transmitParams.type?e.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationOTPCloseLink",null):e.onTrackSharedStepUpClickEvent("StepUpAuthentication","AuthenticationCloseLink",null)),o.systemError&&o.$broadcast("authCancel",null),r.params.transmitParams&&r.params.transmitParams.hasResumePlaceholder&&r.params.transmitParams.failed&&r.params.transmitParams.failed({error:"cancelled",code:"105"}),a()}),n.failed=function(e){o.systemError=!0,n.authOptions=!1,n.ChildIDShield=!1,n.ChildOTPInputCodeMNC=!1,n.ChildMobileApprove=!1,n.ChildOTPInputCode=!1,n.ChildOTPSelectTarget=!1,n.PendingApproval=!1,n.transmitCallInProgress=!1,n.CancelAuth=!1;var t=e?e.transmitErrorResponse:{};t&&t.data&&t.data.assertion_error_code&&"10"==t.data.assertion_error_code&&t.data.assertion_error_message.indexOf("MobileApprove")>0?(n.showAuthModal=!0,n.authOptions=!0,$(".authenticator-body").hide(),c("authenticatorheader","<div class='omni-modal-body'><p class='error' role='alert' aria-live='assertive'>To use these features, you must have Push enabled on your device. You can manage Push Notifications in the Device Manager or in the My Profile section of the app.</p></div>")):t&&t.type&&"mobile_approve"==t.type?(n.showAuthModal=!0,n.authOptions=!0,$(".authenticator-body").hide(),c("authenticatorheader","<div class='omni-modal-body'><p class='error' role='alert' aria-live='assertive'>To use these features, you must have Push enabled on your device. You can manage Push Notifications in the Device Manager or in the My Profile section of the app.</p></div>")):t&&t.failure_data&&"true"==t.failure_data.locked?(n.showAuthModal=!0,n.authOptions=!0,$(".authenticator-body").hide(),c("authenticatorheader","<div class='omni-modal-body'><p class='error' role='alert' aria-live='assertive'>Hmm. Something you've entered isn't quite right, so we've locked your account to ensure your security. Login Assist can help.</p></div>")):t&&t.failure_data&&"reject"==t.failure_data.action&&3==t.failure_data.code?(n.showAuthModal=!0,n.authOptions=!0,$(".authenticator-body").hide(),c("authenticatorheader","<div class='omni-modal-body'><p class='error' role='alert' aria-live='assertive'>Hmm. Something you've entered isn't quite right, so we've locked your account to ensure your security. Login Assist can help.</p></div>")):t&&t.name&&"Cancel"==t.name?(n.showAuthModal=!0,n.authOptions=!0,$(".authenticator-body").hide()):void 0!=n.$parent.OnSharedAuthFailure?(n.showAuthModal=!1,i.html(""),n.$parent.OnSharedAuthFailure(e)):(n.showAuthModal=!0,n.authOptions=!0,$(".authenticator-body").hide(),c("authenticatorheader","<div class='omni-modal-body'><p class='error' role='alert' aria-live='assertive'>We're sorry. We are having problems on our end. It shouldn't be too long, so please try again shortly.</p></div>"))},n.authOptions=!1,n.ChildIDShield=!1,n.ChildMobileApprove=!1,n.ChildOTPInputCode=!1,n.ChildOTPSelectTarget=!1,n.PendingApproval=!1,n.transmitCallInProgress=!0,n.CancelAuth=!1,n.SystemError=!1,n.ChildOTPInputCodeMNC=!1,n.navigatePage=function(e,t){n.authOptions=!1,n.ChildIDShield=!1,n.ChildOTPInputCodeMNC=!1,n.ChildMobileApprove=!1,n.ChildOTPInputCode=!1,n.ChildOTPSelectTarget=!1,n.PendingApproval=!1,n.transmitCallInProgress=!1,n.CancelAuth=!1,n.SystemError=!1,$(".xmuiProgressForm").hide(),"authOptions"===e&&(n.authOptions=!0),"otpTarget"===e&&(n.ChildOTPSelectTarget=!0),"inputOTPCode"===e&&(n.ChildOTPInputCode=!0),"mobApprove"===e&&(n.ChildMobileApprove=!0),"idshield"===e&&(n.ChildIDShield=!0),"pendingApproval"===e&&(n.PendingApproval=!0),"cancelauth"===e&&(n.CancelAuth=!0),"inputOTPCodeMNC"===e&&(n.ChildOTPInputCode=!0),"cancelauth"===e||"authOptions"===e?$(".close").hide():$(".close").show(),r.params.transmitParams=t,setTimeout(function(){n.$apply()},10)},n.$on("transmitTokenRecieved",function(e,t){n.showAuthModal=!1}),n.dirSuccessHandler=function(e){n.ChildOTPInputCodeMNC||(n.showAuthModal=!1,i.html("")),n.$parent.isQaObj&&e.isQa&&(n.$parent.isQaObj.isFromQa=!0),n.$parent.OnSharedAuthSuccess(e),n.ChildOTPInputCodeMNC&&(n.showAuthModal=!1,i.html(""))},n.showServiceModal=function(){var r=n.username?n.username.toLowerCase():n.username;t.showOptions(null,null,r,n.dirSuccessHandler,n.failed,n.transmitappid,n.transmitpolicy,n.transmiturl,s,n,null!=n&&null!=n.$parent&&null!=n.$parent.additionalTransmitParams?n.$parent.additionalTransmitParams:null,e,o)}}]}}])}(),function(){"use strict";angular.module("stepupWidget").constant("SharedAuthConstants",{loginAssistantUrl:"/OLS/LoginAssistant/",loginAssistantOldUrl:"/OLS/LoginAssist/",VersionNumber:"20.2.1"})}(),function(){"use strict";angular.module("stepupWidget").factory("dataContainer",function(){return{}})}(),function(e){try{e=angular.module("sharedWidgetOmniTemplateModule")}catch(t){e=angular.module("sharedWidgetOmniTemplateModule",[])}e.run(["$templateCache",function(e){"use strict";e.put("StepUpContainerOmni.html",'<div style="z-index: 100000;position:fixed;top:0;bottom:0;left:0;right:0; display: block;" class="modal fade ng-isolate-scope in" tabindex="-1"><div class="sr-only" id="stepupLiveAnnouncement" aria-live="assertive"></div><div class="sharedauth-omni modal-dialog modal-dialog-thirdpartyOTP" id="otpStepUp" role="modal"><div class="modal-content modal-content-thirdpartyOTP" style="top: 0; z-index: 1000; height: 100% !important; " ng-class="{\'modalAuto\': !ChildOTPInputCodeMNC, \'modalHidden\': ChildOTPInputCodeMNC}"><div class="contain-stepup sharedauth" id="sharedAuthstepUpContainer" ng-if="showAuthModal" aria-labelledby="authenticatorheader" tabindex="-1"><div class="authenticator-header-buttons"><button type="button" class="close" aria-label="close" data-dismiss="modal" id="goback" ng-click="cancel()"><img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzIgMzIiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGZpbGw9IiM1OTU5NWIiIGQ9Ik0xNy40MTQsMTZsNy4zMTQtNy4zMTRjMC4zOTEtMC4zOTEsMC4zOTEtMS4wMjMsMC0xLjQxNHMtMS4wMjMtMC4zOTEtMS40MTQsMEwxNiwxNC41ODZMOC42ODYsNy4yNzFjLTAuMzkxLTAuMzkxLTEuMDIzLTAuMzkxLTEuNDE0LDBzLTAuMzkxLDEuMDIzLDAsMS40MTRMMTQuNTg2LDE2bC03LjMxNCw3LjMxNGMtMC4zOTEsMC4zOTEtMC4zOTEsMS4wMjMsMCwxLjQxNGMwLjE5NSwwLjE5NSwwLjQ1MSwwLjI5MywwLjcwNywwLjI5M3MwLjUxMi0wLjA5OCwwLjcwNy0wLjI5M0wxNiwxNy40MTRsNy4zMTQsNy4zMTRjMC4xOTUsMC4xOTUsMC40NTEsMC4yOTMsMC43MDcsMC4yOTNzMC41MTItMC4wOTgsMC43MDctMC4yOTNjMC4zOTEtMC4zOTEsMC4zOTEtMS4wMjMsMC0xLjQxNEwxNy40MTQsMTZ6Ii8+PC9zdmc+" /></button></div><div ui-view="auth" id="customUI"></div><div ng-if="authOptions" ng-controller="AuthOptionController"><div class="authenticator-header" id="childauth"><h1 id="authenticatorheader">Please select authentication method</h1></div><div class="authenticator-body"><ul><li ng-repeat="authMethod in methods | orderBy:\'-type\'"><a href="" ng-click="authenticationMethodClicked(authMethod.type)">{{getAuthenticationTypeText(authMethod.type)}}</a></li></ul></div></div><div ng-if="ChildIDShield" ng-controller="IDShieldController"><div class="authenticator-header"><h2 id="authenticatorheader">ID Shield Questions</h2></div><div id="disablingDiv"></div><div class="authenticator-body"><form class="transmit-qa"><label for="ans">{{idShieldQuestion}} <span class="sr-only">{{placeHolderText}}</span></label><input id="ans" type="text" ng-model="answer" placeholder="{{placeHolderText}}" aria-required="true" autocomplete="off" aria-describedby="transmit-errors"/><div id="transmit-errors" class="transmit-error-contain" aria-live="assertive"><p class="error" id="qaLockError" ng-show="lockErrorMessage && isApp" role="alert">{{ isAppErrormsg }}</p><p class="error" id="qaLockError" ng-show="lockErrorMessage && !isApp" role="alert">{{negativeisAppErrormsg}}</p><p class="error" id="qaError" role="alert">{{errorMessage}}</p></div><div class="btn-wrap"><button type="submit" class="btn" id="SubmitAns" ng-click="submitAns(answer)">Continue</button><p><a href="" class="btn idshieldlink" id="ForgetAns" ng-model=personid ng-click=RedirectToLoginAssist(true)>Forgot Answer?</a></p></div><p class="login-transmit-show"><a href="" id="changeAuth" ng-click="changeAuth()" class="hideStepup">Change authentication method</a></p></form></div><div class="authenticator-footer"><p>If you would like to change your authentication method, close this window.</p></div><div ng-show="loading" class="stepup_load_spinner"></div></div><div ng-if="ChildMobileApprove" ng-controller="MobileApproveController"><div class="authenticator-header"><h1 id="authenticatorheader">Please select how you want us to deliver a push notification to authenticate you</h1></div><div class="authenticator-body"><ul class="mobile-list"><li ng-repeat="device in devices"><a href="" ng-click="targetClick(device)">{{device.model}}</a></li><li ng-if="!devices.length">To use these features, you must have Push enabled on your device. You can manage Push Notifications in the Device Manager or in the My Profile section of the app.</li></ul></div></div><div ng-if="PendingApproval" ng-controller="PendingApprovalController"><div class="authenticator-header"><h1 id="authenticatorheader">Authorization Pending</h1></div><div class="authenticator-body"><p>A request for authorization has been sent. It will expire in 15 minutes.</p><p class="error" role="alert" aria-live="assertive" id="mobError">{{errorMessage}}</p><ul><li><a href="" class="hideStepup" ng-click="changeAuth()" id="changeAuth">Change authentication method</a></li><li><a href="" class="HelpLink" ng-click=RedirectToLoginAssist(false)>Need help?</a></li></ul></div></div><div ng-if="ChildOTPInputCode" ng-controller="InputOTPController"><div class="authenticator-header"><h1 id="authenticatorheader" ng-hide="IsTempAccessFlow">One-Time Passcode</h1></div><div class="authenticator-body"><form><p> {{otpheadingmessage}}</p> <label for="aw-otp-input">{{otpsubheading}}</label><input ng-model="otpCode" autocomplete="off" aria-required="true" id="aw-otp-input" type="tel" maxlength="{{otplength}}" onkeypress="return event.charCode >= 48 && event.charCode <= 57"><p class="error" role="alert" aria-live="assertive" style="display:none" id="otpLockError">Alas, that was your third try with the wrong code. For your security, we\'ve locked your account. <a href="" ng-click="RedirectToLoginAssist(personid)">Click here</a> to reset.</p><p class="error" role="alert" aria-live="assertive" id="otpError">{{errorMessage}}</p><div class="btn-wrap"><button type="submit" class="btn thirtd_party_button" ng-click="otpLogin()" id="otpLogin">Continue</button><button type="button" class="btn secondary thirdparty-Secondary" ng-hide="IsTempAccessFlow" ng-click="otpResend()" id="otpResend">Resend</button></div><div class ="tempCancel hideStepup" ng-show="IsTempAccessFlow && loginWigetDirective"><p class="login-transmit-show"><a href="" ng-click="cancelbuttonClick();" tabindex="0">Start over</a></p></div></form><p ng-hide="IsTempAccessFlow"><a href="" class="hideStepup" id="changeAuth" ng-click="changeAuth()">Change authentication method</a></p><p ><a href="" class="HelpLink" id="helpLinkTarget" ng-click="RedirectToLoginAssist(personid)">Need help?</a></p></div></div><div ng-if="ChildOTPInputCodeMNC" ng-controller="InputOTPController"><div id="header" class="olb-shared-layout__header" role="banner">    <div id="divHeaderMC" class="marBot33">        \x3c!--<div class="customBackground"></div>--\x3e        <div class="la__header-container la__hide-when-xs">            <div class="la__header-container-rebranding">   <div class="headerSection_Logos la__header-logo-height " title="U.S Bank Logo">  <div class="la-header-logo-rebrand usBankLogo" alt=""></div>    </div>   </div>    <div class="headerClear"></div>  </div>  <div class="la__touchnav-container usb__hide-when-lg">    <div class="la_usbank-mob-logo-img usBankLogo" alt=""></div>  </div>   </div></div><div class="col-md-8 OtpContPadd"><div><h2 id="authenticatorheader" class="heading-newBrand">Please enter the one-time passcode we sent you. It will expire in 15 minutes.</h2></div><div class="OtpForm"><form><label class="mc-label" for="aw-otp-input">{{otpsubheading}}</label><input ng-model="otpCode"  class="mc-input la__textbox-newStyle-reBrand" autocomplete="off" aria-required="true" id="aw-otp-input" type="tel" maxlength="{{otplength}}" onkeypress="return event.charCode >= 48 && event.charCode <= 57"><p class="la__rebrand-inline-error-message mc-paragraph mc-padBot" role="alert" aria-live="assertive" id="otpError">{{errorMessage}}</p><input type="submit" class="la__rebrand_nextButton otpMNCtBtn" ng-click="otpLogin()" id="otpLogin" value="Continue"><input type="button" class="la__rebrand_resendButton otpMNCtBtn" ng-hide="IsTempAccessFlow" ng-click="otpResend()" id="otpResend" value="Resend" /><div  class="mncOtplnk"><p><a class="mc-link" href="" ng-click="cancelbuttonClick();" tabindex="0">Cancel</a></p></div></form></div></div><div id="footer" class="olb-shared-layout__footer" role="contentinfo">    <div class="la-footer-background-rebrand"><div><div class="copyright-rebranding OtpContPadd">  &copy; {{Year}}  U.S. Bank<br> </div><div class="footer-rebranding-image footerline" alt=""></div>        </div>    </div></div></div><div ng-if="ChildOTPSelectTarget" ng-controller="OTPTargetController"><div class="authenticator-header"><h1 id="authenticatorheader">Please select how you want us to deliver a one-time passcode to you</h1></div><div class="authenticator-body"><ul class="mobile-list"><li ng-repeat="number in targets"><a href="" class="linkDecoration" ng-click="targetClick(number)">Ending in {{number | formatetarget}}</a></li></ul></div><div class="authenticator-footer"><p class="otp-footer">By providing a cellular number, you expressly consent to receiving a one-time text message related to your authorization code. Message and data rates may apply and you are responsible for any such charges.</p></div></div><div ng-if="CancelAuth" ng-controller="ConfirmPopController"><div class="authenticator-header overlayayssheader"><h1 id="authenticatorheader">Are you sure you want to cancel?</h1></div><div class="authenticator-body overlayaysoption"><ul><li><a href="" ng-click="confirmCancel()" id="confirmCancel">Yes</a></li><li><a href="" ng-click="tryOnce()" id="tryOnce">No</a></li><li><a href="" ng-click="changeAuth()" id="changeAuth">Change authentication method</a></li></ul></div></div><span id="errortag" aria-live="assertive"></span></div></div></div></div>'),e.put("StepUpContainer.html",'<div class="sr-only" id="stepupLiveAnnouncement" aria-live="assertive"></div><div class="sharedauth-loading" aria-live="assertive" tabindex="-1"><div id="wrapperId" ><div id="scrollerId"><div class="contain-stepup sharedauth" id="sharedAuthstepUpContainer"><div ng-hide="HideCloseButton" class="authenticator-header-buttons"><button type="button" class="close" aria-label="close" data-dismiss="modal" id="goback" ng-click="cancel()"><img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzIgMzIiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGZpbGw9IiM1OTU5NWIiIGQ9Ik0xNy40MTQsMTZsNy4zMTQtNy4zMTRjMC4zOTEtMC4zOTEsMC4zOTEtMS4wMjMsMC0xLjQxNHMtMS4wMjMtMC4zOTEtMS40MTQsMEwxNiwxNC41ODZMOC42ODYsNy4yNzFjLTAuMzkxLTAuMzkxLTEuMDIzLTAuMzkxLTEuNDE0LDBzLTAuMzkxLDEuMDIzLDAsMS40MTRMMTQuNTg2LDE2bC03LjMxNCw3LjMxNGMtMC4zOTEsMC4zOTEtMC4zOTEsMS4wMjMsMCwxLjQxNGMwLjE5NSwwLjE5NSwwLjQ1MSwwLjI5MywwLjcwNywwLjI5M3MwLjUxMi0wLjA5OCwwLjcwNy0wLjI5M0wxNiwxNy40MTRsNy4zMTQsNy4zMTRjMC4xOTUsMC4xOTUsMC40NTEsMC4yOTMsMC43MDcsMC4yOTNzMC41MTItMC4wOTgsMC43MDctMC4yOTNjMC4zOTEtMC4zOTEsMC4zOTEtMS4wMjMsMC0xLjQxNEwxNy40MTQsMTZ6Ii8+PC9zdmc+" /> </button></div><div ui-view= "auth" id="customUI"></div><span id="errortag" aria-live="assertive"></span></div><div class="sr-only" aria-label="End of dialog"></div></div></div>'),e.put("ChildAuthOptionPage.html",' <h1 id="aw-log-in-to-your-accounts" class="Oauthheader_logintoccounts">Log in to your accounts</h1>  <h1 ng-if="!isCEI" id="authenticatorheader" class="Selectauth_header">{{Settings.SELECT_AUTHENTICATION_HEADER}}</h1>  <h1 ng-if="isCEI" id="authenticatorheader">How would you like to authenticate the customer?</h1> <ul> <li class="logindetails-authentication" ng-repeat="authMethod in methods | orderBy:\'-type\'" ng-if="!isCEI">  <a href="" ng-click="authenticationMethodClicked(authMethod.type)" aria-expanded="false">{{getAuthenticationTypeText(authMethod.type)}}<span aria-hidden="true" class="Oauth_Chevron"></span></a>  </li> <li ng-repeat="authMethod in methods" ng-if="isCEI">  <a href="" ng-click="authenticationMethodClicked(authMethod.type)">{{getAuthenticationTypeText(authMethod.type)}}<span aria-hidden="true" class="Oauth_Chevron"></span></a>  </li> <li ng-if="isCEI" style="margin-top:45px"> <a href="" ng-click="ReturnResponsetoCEI(\'enterotpcodescreen\')">Skip authentication and return to customer session</a> </li>  <li ng-if="!isCEI" class="logindetails-startover hideStepup startover"> <a href="" class="loginstart-auth" ng-click="cancelbuttonClick($event)" tabindex="0">{{Settings.START_OVER_LABEL}}</a>   </li> </ul>'),e.put("ErrorPage.html",'<div class="authenticator-body"><form><div class="omni-modal-body"><p class="device-error general" role="alert" aria-live="assertive">{{Settings.ERROR_MESSAGE}}</p></div></form></div><div class="authenticator-footer"><p><a href="" ng-click="cancelbuttonClick()">{{Settings.CANCEL_LINK}}</a></p></div>'),e.put("ChildIDShield.html",'<div id="disablingDiv"></div> <div class="aw-form-wrapper">   <h1 id="aw-log-in-to-your-accounts" class="Oauthheader_logintoccounts">Log in to your accounts</h1>   <h2  id="authenticatorheader" ng-class="{\'angular-widget-error-messages\':(ClientName == \'dotcom\' && (errorMessage || lockErrorMessage)),\'angular-widget-error-no-margin\':(ClientName == \'dotcom\' && !(errorMessage || lockErrorMessage))}" class="Shield_Questions">{{Settings.ID_SHIELD_HEADER}}</h2> <form novalidate> <label for="aw-idshield-input" class="textshield_question hideoauth">{{idShieldQuestion}}</label> <input ng-class="{\'error-on\':errorMessage}" aria-label="ID Shield Answer" type="text" id="aw-idshield-input"    ng-blur="onBlur($event)" ng-model="answer" class="form-control-oauth" ng-class="{\'aw-idshield-hover-pos\':(ClientName == \'dotcom\')}" ng-click="clearErrorMessage()" name="idshield-input"     placeholder="{{placeHolderText}}" required="required"   aria-required="true" autocomplete="off" aria-describedby="transmit-errors" /> <label for="aw-idshield-input" class="textshield_question form-control-lblplaceholder">{{idShieldQuestion}}</label> <div  ng-show="errorMessage || lockErrorMessage" aria-live="assertive" id="transmit-errors"> <div class="error-backdrop" ng-class="{\'error-msg-backdrop\':(ClientName == \'dotcom\')}" ng-show = "showerror || lockErrorMessage"> <p class="error" id="qaLockError" ng-show="lockErrorMessage">{{negativeisAppErrormsg}}</p>  <p class="error" id="qaError" role="alert">{{errorMessage}}</p>  </div> </div>   <ul>   <li class="forgetanswer_tesla">     <a href="" class="aw-secondary-link shieldforget-answer"   ng-click="RedirectToLoginAssist(true)">{{Settings.FORGOT_ANSWER_LINK}}</a>    </li> </ul>   <button class="aw-primary shield_button" type="submit" id="aw-submit-idshield"  ng-click="submitAns(answer)">{{Settings.ID_SHIELD_BUTTON_LABEL}}</button>    <ul>   <li class="forgetanswer_otherclients" ng-class="{\'aw-idshield-hover-pos\':(ClientName == \'dotcom\')}">     <a href="" class="aw-secondary-link"   ng-click="RedirectToLoginAssist(true)">{{Settings.FORGOT_ANSWER_LINK}}</a>    </li>   <li class="hideStepup startover">   <a href="" ng-click="cancelbuttonClick();">{{Settings.START_OVER_LABEL}}</a>    </li>   <li class="hideStepup" ng-hide="hideChangeAuth">   <a href="" class="aw-secondary-link"  ng-class="{\'aw-idshield-hover-pos\':(ClientName == \'dotcom\')}" ng-click="changeAuth()" id="changeAuth"   ng-if="!lockErrorMessage" aria-expanded="false">{{Settings.CHANGE_AUTHENTICATION_METHOD_LINK}}</a>   </li> </ul> </form>  <div ng-show="loading" class="stepup_load_spinner"/> </div> <form name="formSignOn" id="formSignOn"></form> '),e.put("TransmitStepup.html",'<div class = "aw-authenticate"><div ng-controller="TransmitLoginStepupController"><div busy busy-add-classes="lw__loader" not-busy-remove-classes="lw__loader" aria-live="assertive"><div class="spinner" aria-busy="false"><div class="holder"><div class="bar1"></div><div class="bar2"></div><div class="bar3"></div><div class="bar4"></div><div class="bar5"></div><div class="bar6"></div><div class="bar7"></div><div class="bar8"></div><div class="bar9"></div><div class="bar10"></div><div class="bar11"></div><div class="bar12"></div></div></div><div class="contentHolder hide" aria-live="assertive"><span id="spinerSpan" class ="opacity0"></span></div></div> <div saloginwidget id="tuxloginwidget" username="{{Username}}" widget="false" uxrefresh="false" istux="true" onsuccess="saSuccessHandler(response)" onerror="saErrorHandler(response)" password="{{password}}"</div> </div></div>'),e.put("Password.html",'<div class="authenticator-body transmit-password"><div ng-if="(uxrefresh && iswidget) || istux" class="lw-AuthLoginIcon">{{welcomeMessage}}</div><div class="form-group image-wrapper" ng-show="isPwdImageExists"><img id="imgSound" class="lw-passwordImage lw-floatLeft tux-Password-image tux-floatLeft" ng-src="{{ ImageUrl }}" alt="{{ ImangeName }}" data-sound= "{{DataSound}}" data-sounduri="{{SoundUrl}}" imgindex="0" ng-click="playSound();"/><div role="button" aria-label="Play Sound" ng-show="SoundUrl != null" id="imgSound" class="sound_img lw-passwordImageSound" data-sound= "{{DataSound}}" data-sounduri="{{SoundUrl}}" imgindex="0" ng-click="playSound();"></div><div class="lw-vs8 lw-passwordImagePhrase lw-floatLeft tux-Password-Phrase tux-floatLeft">{{ Phrase }}</div></div><form name="passwordForm" method="post" autocomplete="off" novalidate><div class="lw-vs20 lw-placeholderIe8 lw-marginBottom18 lw-floatLeft lw-passwordScreenHeight"><label for="txtPassword">Enter Password</label><input autofocus id="txtPassword" autocapitalize="none" name="password" handle-autofill="" focus-me="focusPassword" ng-keydown ="ProcessPassword($event)" ng-model="Password" aria-describedby="pwdError" type="password" maxlength="24" class="StepupPswTxt" aria-required="true" ng-required="true" ng-minlength="8" ng-maxlength="24" ng-class="{\'redborderTextbox\': invalidPassword, \'lw-marginBottom18\': !invalidPassword && IsAuth , \'lw-marginBottom8\': isErrorMessage && IsAuth, \'lw-AuthTextRoundCorner\': IsAuth}" /><button id="btnShow" type="button" class="showHideBtn" ng-click="showHidePwd();" aria-label="{{isHide?\'Hide Password\':\'Show Password\'}}" >{{isHide?\'Hide\':\'Show\'}}</button></div><div aria-live="assertive"><p class="error" id="pwdError" role="alert">{{errorMessage}}</p></div><div class="btn-wrap"><button type="submit" id="btnLogin" target="_top" class="btn lw-buttonwidth140 lw-marginRight10 lw-AuthbuttonSubmit lw-buttonwidth168" id="SubmitAns" ng-click="submitPassword()">Log In</button><a ng-class="{\'btn idshieldlink\': !uxrefresh && !istux}" class="login-transmit-show" href="" ng-click="cancelbuttonClick();" tabindex="0">{{Settings.START_OVER_LABEL}}</a><br /><a href="" id="ForgetAns" ng-click="RedirectToLoginAssist(true)">Forgot Password?</a></div></form></div><div ng-show="loading" class="stepup_load_spinner"/>'),e.put("ChildMobileApprove.html",' <h1 id="aw-log-in-to-your-accounts" class="Oauthheader_logintoccounts">Log in to your accounts</h1>   <h2 ng-if="!isCEI" id="authenticatorheader" class="stepupheader_global">{{Settings.MOBILE_PUSH_NOTIFICATION_HEADER}}</h2> <h2 ng-if="isCEI">Choose how to deliver the customer\'s push notification.</h2> <p ng-if="isCEI" style="font-weight: bold;margin-top: 15px;">Before sending a notification, ask the customer:</p> <p ng-if="isCEI">&quot;May we send a push notification to your mobile phone? It will help verify your identity.&quot;</p> <ul class="Onetimepasscode_devicelist">   <li ng-repeat="device in devices">    <a href="" class="notify_device" ng-click="targetClick(device)">{{device.model}}<span aria-hidden="true" class="Oauth_Chevron"></span></a>  </li>  <li class="device_differentiation hideStepup startover">   <a href="" class="device_differentiation" ng-click="cancelbuttonClick()">{{Settings.START_OVER_LABEL}}</a>   </li>   <li ng-if="!isCEI" class="hideStepup" ng-hide="hideChangeAuth">   <a href="" class="aw-secondary-link device_changeauth"  ng-class="{\'aw-idshield-hover-pos\':(ClientName == \'dotcom\')}" ng-click="changeAuth()" id="changeAuth" ng-hide="lockErrorMessage"  ng-if="!lockErrorMessage" aria-expanded="false">{{Settings.CHANGE_AUTHENTICATION_METHOD_LINK}}</a>   </li>   <li ng-if="isCEI" style="margin-top:45px">   <a href="" class="aw-secondary-link device_changeauth"  ng-class="{\'aw-idshield-hover-pos\':(ClientName == \'dotcom\')}" ng-click="changeAuth()" id="changeAuth" ng-hide="lockErrorMessage"  ng-if="!lockErrorMessage">{{Settings.CHANGE_AUTHENTICATION_METHOD_LINK}}</a>   </li> <li ng-if="isCEI"> <a href="" ng-click="ReturnResponsetoCEI(\'enterotpcodescreen\')">Skip authentication and return to customer session</a> </li>  <li ng-if="!devices.length">{{Settings.PUSH_NOTIFICATION_MESSAGE}}</li>   </ul>'),e.put("PendingApproval.html",' <h1 id="aw-log-in-to-your-accounts" class="Oauthheader_logintoccounts">Log in to your accounts</h1><h2 id="stepUpHeader" class="Shield_Questions" ng-if="!isCEI">Authorization Pending</h2><p class="requestauthorization_text" ng-if="!isCEI">A request for authorization has been sent. It will expire in 15 minutes.</p><h2 ng-if="isCEI">A push notification was sent to customer\'s {{selectedDeviceInfo.model}}.</h2><p ng-if="isCEI" style="padding-top :20px">{{selectedDeviceInfo.instructions}}</p> <p class="error" role="alert" aria-live="assertive" id="mobError">{{errorMessage}}</p> <ul> <li ng-if="isCEI"> <a href="" class="cust_btn" id="resendPush" ng-click="resendPush(selectedDeviceInfo)">Send new notification</a></li> <li> <a href="" class="hideStepup" ng-click="changeAuth()" id="changeAuth" ng-keydown="navigateArrowKeys($event)">Change authentication method</a></li> <li ng-if="!isCEI" class="hideStepup"> <a href="" ng-click="cancelbuttonClick()">Start over</a> </li> <li ng-if="isCEI"> <a href="" ng-click="ReturnResponsetoCEI(\'enterotpcodescreen\')">Skip authentication and return to customer session</a> </li>  <li ng-hide="(is24HBScreen || isCEI)">  <a href="" class="HelpLink" ng-click="RedirectToLoginAssist(personid)" ng-keydown="navigateArrowKeys($event)">Need help?</a> </li> </ul>'),e.put("ChildOTPInputCode.html",' <h1 id="aw-log-in-to-your-accounts" class="Oauthheader_logintoccounts">Log in to your accounts</h1><h1 id="authenticatorheader" class="otp_passcodetext">{{otpheading}}</h1><p ng-hide= "(is24HBScreen || isCEI)" class="enterpasscode_text">{{otpheadingmessage}}</p><p ng-show= "(is24HBScreen || isCEI)" class="enterpasscode_text">{{otpheadingmessagefor24HB}}</p> <label id="aw-six-digit-code" for="aw-otp-input" class="hideoauth">{{otpsubheading}}</label> <input  ng-model="otpCode"autofocus aria-required="true" class="form-control-oauth" autocomplete="off" id="aw-otp-input" type="tel" maxlength="{{otplength}}" ng-keypress="setOtpError(\'\')" placeholder="{{otpplaceholder}}" onkeypress="return validateinput(event)" required="required" /> <label id="aw-six-digit-code" for="aw-otp-input" class="form-control-pinplaceholder">{{otpsubheading}}</label> <p ng-show="isUserLocked"></p> <p class="error aw-otpError" role="alert" aria-live="assertive" style="display:none" id="otpLockError">{{Settings.ACCOUNT_LOCKED_ERR_MSG}} <a href="" ng-click="RedirectToLoginAssist()">Click here</a> to reset.</p> <p class="error" role="alert" aria-live="assertive" id="otpError">{{errorMessage}}</p> <button type="submit" class="aw-primary enterpasscode_button" id="aw-submit-otp" ng-click="otpLogin()">{{Settings.OTP_BUTTON_LABEL}}</button> <button type="button" class="aw-secondary resendpasscode_button" id="aw-resend-otp" ng-hide="IsTempAccessFlow" ng-click="otpResend()">{{Settings.OTP_RESEND_BUTTON_LABEL}}</button> <p ng-if="IsTempAccessFlow" style="display: inline;" class="login-transmit-show hideStepup"><a href="" ng-click="cancelbuttonClick();" tabindex="0">{{Settings.START_OVER_LABEL}}</a></p><ul> <li ng-if="!IsTempAccessFlow" class="hideStepup startover">   <a href="" ng-click="cancelbuttonClick($event);" tabindex="0">{{Settings.START_OVER_LABEL}}</a></li><li class="hideStepup" ng-hide="hideChangeAuth">   <a href="" class="aw-secondary-link" ng-class="{\'aw-idshield-hover-pos\':(ClientName == \'dotcom\')}" ng-click="changeAuth()" id="changeAuth" ng-hide="lockErrorMessage"  ng-if="!lockErrorMessage" aria-expanded="false">{{Settings.CHANGE_AUTHENTICATION_METHOD_LINK}}</a>   </li><li class="hideStepup" ng-show="is24HBScreen || isCEI">   <a href="" class="aw-secondary-link"  ng-click="changeTarget()" id="changeTarget" ng-hide="lockErrorMessage"  ng-if="!lockErrorMessage">{{Settings.CHANGE_TARGET_LINK}}</a>   </li> <li ng-hide="(is24HBScreen || isCEI)">  <a href="" class="HelpLink" ng-click="RedirectToLoginAssist()">{{Settings.NEED_HELP_LINK}}</a> </li> <li ng-show="isCEI">  <a href="" class="aw-secondary-link" ng-click="ReturnResponsetoCEI(\'enterotpcodescreen\')" id="CEI_RESPONSE">Return to customer session </a> </li> </ul>'),e.put("ChildOTPSelectTarget.html",'<h1 id="aw-log-in-to-your-accounts" class="Oauthheader_logintoccounts">Log in to your accounts</h1>  <h2 id="authenticatorheader" class="enterpasscode_text">{{Settings.SELECT_OTP_HEADER}}</h2><div id="otpFirstDisclosure"><p class="aw-disclosure ">{{Settings.OTP_FIRST_DISCLOSURE}}  {{showOtpFirstDisclosure}}</p></div><div id="otpSecondDisclosure"><p class="aw-disclosure ">{{Settings.OTP_SECOND_DISCLOSURE}} {{showSecondFirstDisclosure}}</p></div><ul class="Deliverotp_devicelist">  <li ng-repeat="number in targets">\t  <a href=""  ng-hide ="(is24HBScreen || isCEI)" class="target_number" ng-class="{\'aw-idshield-hover-pos\':(ClientName == \'dotcom\')}" ng-click="targetClick(number)" aria-expanded="false">Ending in {{number | formatetarget}}<span aria-hidden="true" class="Oauth_Chevron"></span></a>\t  <a href=""  ng-show ="(is24HBScreen || isCEI)" class="target_number" ng-class="{\'aw-idshield-hover-pos\':(ClientName == \'dotcom\')}" ng-click="targetClick(number)" aria-expanded="false">Phone number ending in {{number | formatetarget}}</a>  </li>  <div ng-hide="(is24HBScreen || isCEI)"  class="aw-authenticator-footer disclosure_Tesla"><p class="aw-disclosure aw-otp-footer">{{Settings.OTP_SMS_MESSAGE}}</p></div>  <li class="passcoderequest_startoverli hideStepup startover">\t  <a href="" class="passcoderequest_startover" ng-click="cancelbuttonClick($event)">{{Settings.START_OVER_LABEL}}</a>  </li>  <li class="hideStepup" ng-hide="hideChangeAuth || (is24HBScreen || isCEI)">     <a href="" class="aw-secondary-link passcoderequest_changeauth" ng-class="{\'aw-idshield-hover-pos\':(ClientName == \'dotcom\')}" ng-click="changeAuth()" id="changeAuth" ng-hide="lockErrorMessage"       ng-if="!lockErrorMessage" aria-expanded="false">{{Settings.CHANGE_AUTHENTICATION_METHOD_LINK}}</a>  </li>  <li class="hideStepup" ng-if="isCEI">     <a href="" class="aw-secondary-link passcoderequest_changeauth"  ng-click="ReturnResponsetoCEI(\'selectotpenterscreen\')" id="CEI_RESPONSE">Skip authentication and return to customer session</a>  </li>  <div ng-hide ="(is24HBScreen || isCEI)" class="aw-authenticator-footer disclosure_global">    <p class="aw-disclosure aw-otp-footer">{{Settings.OTP_SMS_MESSAGE}}</p>  </div></ul>'),e.put("StepupCancellation.html",'<h1 id="authenticatorheader">{{Settings.CANCEL_QUES_LABEL}}</h1> <ul>  <li>    <a href="" id="confirmCancel" ng-click="confirmCancel()" ng-keydown="navigateArrowKeys($event)">{{Settings.YES_LABEL}}</a>   </li> <li>  <a href="" id="tryOnce"  ng-click="tryOnce()"ng-keydown="navigateArrowKeys($event)">{{Settings.NO_LABEL}}</a>   </li> <li ng-hide="hideChangeAuth">  <a href="" id="changeAuth" ng-click="changeAuth()" ng-keydown="navigateArrowKeys($event)">{{Settings.CHANGE_AUTHENTICATION_METHOD_LINK}}</a>   </li> </ul>')}])}(),function(){"use strict";function e(e,n,r,i){return{restrict:"A",transclude:!1,replace:!1,template:'<div class="contain-stepup sharedauth" ng-class="{\'loginwidget\':uxrefresh && !istux,\'tuxlogin loginwidget\': istux , \'authlogin\':!uxrefresh && !iswidget && !istux, \'loginwidgetgray\':!uxrefresh && iswidget && !istux}" id="sharedAuthstepUpContainer" ><div class="lw-marBottom7"><div ng-if="!uxrefresh && !iswidget && !istux" class="lw-AuthLoginIcon" id="aw-welcomeMessage"><span id="aw-greetings">{{welcomeMessage}}</span><h1 id="aw-welcomeUserName">{{welcomeUserName}}</h1></div></div><div ui-view = "auth" id="customUI"></div></div>',scope:{username:"@",password:"@",iswidget:"=",uxrefresh:"=",istux:"=?",onsuccess:"&",onerror:"&"},link:t,controller:["$scope","$state","$element","$rootScope","$injector",function(t,o,a,s,c){t.navigatePage=function(e,t){o.go(e,{transmitParams:t})};var u=document.getElementById("ActimizeData");t.VersionNumber=i.VersionNumber,t.transmiturl=n.TransmitURL,t.idshieldbaseurl=n.IDShieldBaseURL,t.passwordbaseurl=n.PasswordBaseURL,t.transactionid=n.TransactionID,t.transmitappid=n.TransmitAppID,t.transmitpolicy=n.TransmitPolicy,t.imagebaseurl=n.ImageBaseURL,t.soundbaseurl=n.SoundBaseURL,t.transid=n.SessionGUID,t.istux=!!angular.isDefined(t.istux);var l=t.username?t.username.toLowerCase():t.username,d=t.istux?n.password:t.password,h={username:l,Password:d,TransactionID:n.TransactionID,IDShieldBaseURL:n.IDShieldBaseURL,PasswordBaseURL:n.PasswordBaseURL,TransmitAppID:n.TransmitAppID?n.TransmitAppID:"web",ImageBaseURL:n.ImageBaseURL,SoundBaseURL:n.SoundBaseURL,TransmitPolicy:n.TransmitPolicy,SessionGUID:n.SessionGUID,actimizeData:u?u.value:n.ActimizeData?n.ActimizeData:"",isOAMEnabled:n.IsOAMEnabled,OAMPostUrl:n.OAMPostUrl,ContextData:"",InWidget:!0,authBaseUrl:n.authBaseUrl,blackBoxData:n.BlackBoxData,authType:"Authenticate",clientId:n.clientId,channelId:n.channelId};s.loginWigetDirective=!0,t.welcomeMessage="Hi, ",t.welcomeUserName=t.username?t.username.substring(0,4)+"****":"",t.showServiceModal=function(){r.showOptions(null,null,l,n.SuccessHandler,n.ErrorHandler,t.transmitappid,t.transmitpolicy,t.transmiturl,h,t,null!=t&&null!=t.$parent&&null!=t.$parent.additionalTransmitParams?t.$parent.additionalTransmitParams:null,e,s,n)}}]}}function t(e,t,n){e.istux&&e.showServiceModal(),e.showAuthModal=!0,e.isSharedAuthModal=!0}angular.module("stepupWidget").directive("saloginwidget",e),e.$inject=["SASiteCatService","dataContainer","transmitService","SharedAuthConstants"]}();;
