{"version":3,"sources":["wwwroot/lib/strengthify/jquery.strengthify.js","app/js/checkout-new/password-strength-model.js","app/js/common/utils.js","app/js/password-tooltip-validator.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3UA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"password-setter.js","sourcesContent":["/**\n * Strengthify - show the weakness of a password (uses zxcvbn for this)\n * https://github.com/MorrisJobke/strengthify\n *\n * Version: 0.5.8\n * Author: Morris Jobke (github.com/MorrisJobke) - original\n * Eve Ragins @ Eve Corp (github.com/eve-corp)\n *\n *\n * License:\n *\n * The MIT License (MIT)\n *\n * Copyright (c) 2013-2019 Morris Jobke \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/* global jQuery */\n(function($) {\n $.fn.strengthify = function(paramOptions) {\n \"use strict\";\n\n var defaults = {\n zxcvbn: 'zxcvbn/zxcvbn.js',\n userInputs: [],\n titles: [\n 'Weakest',\n 'Weak',\n 'So-so',\n 'Good',\n 'Perfect'\n ],\n tilesOptions:{\n tooltip: true,\n element: false\n },\n drawTitles: false,\n drawMessage: false,\n drawBars: true,\n $addAfter: null,\n nonce: null\n };\n\n return this.each(function() {\n var options = $.extend(defaults, paramOptions);\n\n if (!options.drawTitles\n && !options.drawMessage\n && !options.drawBars)\n console.warn(\"expect at least one of 'drawTitles', 'drawMessage', or 'drawBars' to be true\");\n\n function getWrapperFor(id) {\n return $('div[data-strengthifyFor=\"' + id + '\"]');\n };\n\n function drawStrengthify() {\n var password = $(this).val(),\n elemId = $(this).attr('id'),\n // hide strengthify if no input is provided\n opacity = (password === '') ? 0 : 1,\n // calculate result\n result = zxcvbn(password, options.userInputs),\n // setup some vars for later\n css = '',\n bsLevel = '',\n message = '',\n // cache jQuery selections\n $wrapper = getWrapperFor(elemId),\n $container = $wrapper.find('.strengthify-container'),\n $message = $wrapper.find('[data-strengthifyMessage]');\n\n\n $wrapper.children()\n .css('opacity', opacity)\n .css('-ms-filter',\n '\"progid:DXImageTransform.Microsoft.Alpha(Opacity=' + opacity * 100 + ')\"'\n );\n\n if (options.onResult) {\n options.onResult(result);\n }\n\n // style strengthify bar\n // possible scores: 0-4\n switch (result.score) {\n case 0:\n case 1:\n css = 'password-bad';\n bsLevel = 'danger';\n message = result.feedback ? result.feedback.suggestions.join('
') : \"\";\n break;\n case 2:\n bsLevel = 'warning';\n message = result.feedback ? result.feedback.suggestions.join('
') : \"\";\n css = 'password-medium';\n break;\n case 3:\n css = 'password-good';\n bsLevel = 'info';\n message = \"Getting better.\";\n break;\n case 4:\n css = 'password-good';\n bsLevel = 'success';\n message = \"Looks good.\";\n break;\n }\n\n if ($message) {\n $message.removeAttr('class');\n $message.addClass('bg-' + bsLevel);\n\n // reset state for empty string password\n if (password === '') {\n message = '';\n }\n $message.html(message);\n }\n if ($container) {\n $container\n .attr('class', css + ' strengthify-container')\n // possible scores: 0-4\n .css(\n 'width',\n // if score is '0' it will be changed to '1' to\n // not hide strengthify if the password is extremely weak\n ((result.score === 0 ? 1 : result.score) * 25) + '%'\n );\n\n // reset state for empty string password\n if (password === '') {\n $container.css('width', 0);\n }\n }\n\n if (options.drawTitles) {\n // set a title for the wrapper\n if(options.tilesOptions.tooltip){\n $wrapper.attr(\n 'title',\n options.titles[result.score]\n ).tooltip({\n placement: 'bottom',\n trigger: 'manual',\n }).tooltip(\n 'fixTitle'\n ).tooltip(\n 'show'\n );\n\n if (opacity === 0) {\n $wrapper.tooltip(\n 'hide'\n );\n }\n }\n\n if(options.tilesOptions.element){\n $wrapper.find(\".strengthify-tiles\").text(options.titles[result.score]);\n }\n }\n };\n\n function init() {\n var $elem = $(this),\n elemId = $elem.attr('id');\n var drawSelf = drawStrengthify.bind(this);\n\n var $addAfter = options.$addAfter;\n if (!$addAfter) {\n $addAfter = $elem;\n }\n\n // add elements\n $addAfter.after('
');\n\n if (options.drawBars) {\n getWrapperFor(elemId)\n .append('
')\n .append('
')\n .append('
')\n .append('
')\n .append('
');\n }\n\n if (options.drawMessage) {\n getWrapperFor(elemId).append('
');\n }\n\n if (options.drawTitles && options.tilesOptions) {\n getWrapperFor(elemId).append('
');\n }\n\n var script = document.createElement(\"script\");\n script.src = options.zxcvbn;\n if (options.nonce !== null) {\n script.setAttribute('nonce', options.nonce);\n }\n\n script.onload = function() {\n \t$elem.parent().on('scroll', drawSelf);\n $elem.bind('keyup input change', drawSelf);\n }\n\n document.head.appendChild(script);\n };\n\n init.call(this);\n\n //return me;\n });\n };\n\n} (jQuery));\n","var PES = PES || {};\r\nPES.PasswordStrengthModel = function (passwordId, loginOrRegister) {\r\n var self = this;\r\n self.passwordNotEmpty = ko.observable(false);\r\n self.passwordStrengthMessage = ko.observable(\"\");\r\n self.displayLoading = ko.observable(true);\r\n\r\n self.jqPassword = $('#' + passwordId);\r\n self.togglePasswordVisibility = function (model, e) {\r\n var passwordIsHidden = self.jqPassword.attr(\"type\") == \"text\";\r\n if (passwordIsHidden) {\r\n self.jqPassword.attr(\"type\", \"password\");\r\n $(e.target).removeClass('show-pass').addClass('hide-pass');\r\n } else {\r\n self.jqPassword.attr(\"type\", \"text\");\r\n $(e.target).removeClass('hide-pass').addClass('show-pass');\r\n }\r\n };\r\n self.displayStrengthify = function () {\r\n var strengthifyWrapper = $('.strengthify-wrapper');\r\n strengthifyWrapper.show();\r\n var strength = strengthifyWrapper.find('.strengthify-tiles').text();\r\n self.passwordStrengthMessage(strength);\r\n }\r\n\r\n self.registerEventListeners = function () {\r\n\r\n self.jqPassword.strengthify({\r\n zxcvbn: 'https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/4.3.0/zxcvbn.js',\r\n tilesOptions: {\r\n tooltip: false,\r\n element: true\r\n },\r\n drawTitles: true,\r\n drawMessage: false,\r\n drawBars: true\r\n });\r\n\r\n self.jqPassword.on('keyup', function (e) {\r\n var pass = $(e.target).val();\r\n self.passwordNotEmpty(pass !== '');\r\n \r\n if (!loginOrRegister || loginOrRegister.displayRegister()) {\r\n self.displayStrengthify();\r\n }\r\n });\r\n }\r\n\r\n self.registerEventListeners();\r\n}","jQuery.fn.putCursorAtEnd = function () {\r\n\r\n return this.each(function () {\r\n\r\n // Cache references\r\n var $el = $(this),\r\n el = this;\r\n\r\n // Only focus if input isn't already\r\n if (!$el.is(\":focus\")) {\r\n $el.focus();\r\n }\r\n\r\n // If this function exists... (IE 9+)\r\n if (el.setSelectionRange) {\r\n\r\n // Double the length because Opera is inconsistent about whether a carriage return is one character or two.\r\n var len = $el.val().length * 2;\r\n\r\n // Timeout seems to be required for Blink\r\n setTimeout(function () {\r\n el.setSelectionRange(len, len);\r\n }, 1);\r\n\r\n } else {\r\n\r\n // As a fallback, replace the contents with itself\r\n // Doesn't work in Chrome, but Chrome supports setSelectionRange\r\n $el.val($el.val());\r\n\r\n }\r\n\r\n // Scroll to the bottom, in case we're in a tall textarea\r\n // (Necessary for Firefox and Chrome)\r\n this.scrollTop = 999999;\r\n\r\n });\r\n\r\n};\r\n\r\njQuery.fn.copyToClipboard = function () {\r\n\r\n return this.each(function () {\r\n // is element selectable?\r\n if (this.select) {\r\n copySelect(this);\r\n } else {\r\n copyContent(this);\r\n }\r\n });\r\n};\r\n\r\njQuery.fn.slideFlexDown = function (force) {\r\n\r\n return this.each(function () {\r\n\r\n // Cache references\r\n var $el = $(this);\r\n\r\n $el.slideDown({\r\n start: function () {\r\n if (force === true) {\r\n // needed for Safari browser\r\n $el.css('display', 'block');\r\n setTimeout(function () { $el.css('display', 'flex'); }, 50)\r\n } else {\r\n $el.css('display', 'flex');\r\n }\r\n }\r\n });\r\n });\r\n};\r\n\r\njQuery.fn.showModal = function () {\r\n\r\n return this.each(function () {\r\n\r\n // Cache references\r\n var $el = $(this);\r\n var modalTimeout = 300;\r\n\r\n var jqModalElem = $el;\r\n var jqModalBox = jqModalElem.find(\".modal__box\");\r\n\r\n jqModalElem.fadeIn(modalTimeout);\r\n jqModalBox.fadeIn(300);\r\n\r\n // remove modal when clicking outside it\r\n $(document).bind('click', hideAnyModal);\r\n });\r\n};\r\n\r\njQuery.fn.isInViewport = function () {\r\n var $el = this;\r\n\r\n let elementTop = $el.offset().top;\r\n let elementHeight = $el.outerHeight();\r\n let elementBottom = elementTop + elementHeight;\r\n\r\n let viewportTop = $(window).scrollTop();\r\n let winHeight = $(window).height();\r\n let viewportBottom = viewportTop + winHeight;\r\n\r\n return elementBottom > viewportTop && elementTop < viewportBottom;\r\n};\r\n\r\njQuery.fn.isFullInViewport = function () {\r\n var $el = this;\r\n\r\n let elementTop = $el.offset().top;\r\n let elementHeight = $el.outerHeight();\r\n let elementBottom = elementTop + elementHeight;\r\n\r\n let viewportTop = $(window).scrollTop();\r\n let winHeight = $(window).height();\r\n let viewportBottom = viewportTop + winHeight;\r\n\r\n return viewportBottom <= elementBottom && elementTop <= (viewportTop + 50);\r\n};\r\n\r\njQuery.fn.scrollOnto = function (speed) {\r\n\r\n return this.each(function () {\r\n\r\n // Cache references\r\n var jqSelf = $(this);\r\n\r\n speed = isNaN(speed) ? 500 : speed, offset = -10;\r\n\r\n $('body,html').stop(false, false).animate({\r\n scrollTop: jqSelf.offset().top + offset\r\n }, speed, 'linear');\r\n });\r\n};\r\n\r\njQuery.fn.borderFocus = function () {\r\n return this.each(function () {\r\n $(this).addClass('border-animation').focus();\r\n });\r\n};\r\n\r\n$.fn.exists = function () {\r\n return this.length > 0;\r\n}\r\n\r\njQuery.fn.getZIndexOfNearestParent = function () {\r\n\r\n // Cache references\r\n var jqSelf = $(this);\r\n\r\n var recursiveZIndexSearch = function (element) {\r\n \r\n // Break on body.\r\n if (element[0] === $('body')[0]) {\r\n return 2;\r\n }\r\n\r\n // Get parent element\r\n var jqParent = element.parent();\r\n if (jqParent.length == 0) {\r\n return 0;\r\n }\r\n\r\n // Check if parent has z-index\r\n var zIndex = jqParent.css('z-index');\r\n if (zIndex.length > 0 && !(/\\D/).test(zIndex)) {\r\n\r\n // Return found z-index.\r\n return zIndex;\r\n }\r\n\r\n // Z-index not found, try again on next parent.\r\n return recursiveZIndexSearch(jqParent);\r\n };\r\n\r\n return parseFloat(recursiveZIndexSearch(jqSelf));\r\n};\r\n\r\njQuery.fn.visible = function () {\r\n return this.css('visibility', 'visible');\r\n};\r\n\r\njQuery.fn.invisible = function () {\r\n return this.css('visibility', 'hidden');\r\n};\r\n\r\n\r\nif (window.ko) {\r\n\r\n // Here's a custom Knockout binding that makes elements shown/hidden via jQuery's fadeIn() /fadeOut() methods\r\n ko.bindingHandlers.fadeVisible = {\r\n init: function (element, valueAccessor) {\r\n // Initially set the element to be instantly visible/hidden depending on the value\r\n var value = valueAccessor();\r\n $(element).toggle(ko.unwrap(value)); // Use \"unwrapObservable\" so we can handle values that may or may not be observable\r\n },\r\n update: function (element, valueAccessor) {\r\n // Whenever the value subsequently changes, slowly fade the element in or out\r\n var value = valueAccessor();\r\n ko.unwrap(value) ? $(element).fadeIn() : $(element).fadeOut();\r\n }\r\n };\r\n\r\n var alreadySlided = false;\r\n ko.bindingHandlers.oneTimeSlideVisible = {\r\n init: function (element, valueAccessor) {\r\n var value = valueAccessor();\r\n $(element).toggle(ko.unwrap(value));\r\n },\r\n update: function (element, valueAccessor) {\r\n var value = valueAccessor();\r\n if (ko.unwrap(value)) {\r\n var isHidden = $(element).is(':hidden');\r\n if (isHidden && !alreadySlided) {\r\n $(element).slideDown();\r\n alreadySlided = true;\r\n } else {\r\n $(element).show();\r\n }\r\n } else {\r\n $(element).hide();\r\n }\r\n }\r\n };\r\n}\r\n\r\n// Event that fires when an Element is changing its height\r\nfunction onElementHeightChange(elm, callback) {\r\n var lastHeight = elm.clientHeight, newHeight;\r\n (function run() {\r\n newHeight = elm.clientHeight;\r\n if (lastHeight != newHeight)\r\n callback(newHeight)\r\n lastHeight = newHeight\r\n\r\n if (elm.onElementHeightChangeTimer)\r\n clearTimeout(elm.onElementHeightChangeTimer)\r\n\r\n elm.onElementHeightChangeTimer = setTimeout(run, 200)\r\n })();\r\n}\r\n\r\n// Attach an event handler function for one or more events to the selected elements if the event was not triggered for a given interval. \r\n// Refer to https://github.com/yckart/jquery.unevent.js\r\n; (function ($) {\r\n var on = $.fn.on, timer;\r\n $.fn.on = function () {\r\n var args = Array.apply(null, arguments);\r\n var last = args[args.length - 1];\r\n\r\n if (isNaN(last) || (last === 1 && args.pop())) return on.apply(this, args);\r\n\r\n var delay = args.pop();\r\n var fn = args.pop();\r\n\r\n args.push(function () {\r\n var self = this, params = arguments;\r\n clearTimeout(timer);\r\n timer = setTimeout(function () {\r\n fn.apply(self, params);\r\n }, delay);\r\n });\r\n\r\n return on.apply(this, args);\r\n };\r\n}(this.jQuery || this.Zepto));\r\n\r\n// Detecting browsers by ducktyping\r\n; (function ($) {\r\n $.getBrowser = function () {\r\n // Opera 8.0+\r\n var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;\r\n\r\n // Firefox 1.0+\r\n var isFirefox = typeof InstallTrigger !== 'undefined';\r\n\r\n // Safari 3.0+ \"[object HTMLElementConstructor]\" \r\n var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === \"[object SafariRemoteNotification]\"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));\r\n\r\n // Internet Explorer 6-11\r\n var isIE = /*@cc_on!@*/false || !!document.documentMode;\r\n\r\n // Edge 20+\r\n var isEdge = !isIE && !!window.StyleMedia;\r\n\r\n // Chrome 1 - 79\r\n var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);\r\n\r\n // Edge (based on chromium) detection\r\n var isEdgeChromium = isChrome && (navigator.userAgent.indexOf(\"Edg\") != -1);\r\n\r\n // Blink engine detection\r\n var isBlink = (isChrome || isOpera) && !!window.CSS;\r\n\r\n if (isFirefox) return 'Firefox';\r\n if (isChrome) return 'Chrome';\r\n if (isSafari) return 'Safari';\r\n if (isOpera) return 'Opera';\r\n if (isIE) return 'IE';\r\n if (isEdgeChromium) return 'EdgeChromium';\r\n if (isBlink) return 'Blink';\r\n };\r\n}(jQuery));\r\n\r\nfunction copySelect(input) {\r\n input.select();\r\n input.setSelectionRange(0, 99999); /*For mobile devices*/\r\n\r\n try {\r\n document.execCommand('copy');\r\n input.blur();\r\n }\r\n catch (err) {\r\n console.log(err.message);\r\n }\r\n}\r\n\r\nfunction copyContent(element) {\r\n var range = document.createRange();\r\n range.selectNodeContents(element);\r\n var selection = window.getSelection();\r\n selection.removeAllRanges();\r\n selection.addRange(range);\r\n\r\n try {\r\n document.execCommand('copy');\r\n } catch (err) {\r\n console.log(err.message);\r\n }\r\n\r\n selection.removeAllRanges();\r\n}","PES = PES || {}\r\nPES.PasswordTooltipValidation = function () {\r\n\r\n function init(targetId) {\r\n let passwordInput = document.getElementById(targetId).value;\r\n\r\n function validateInputString(rawPassword) {\r\n let password = rawPassword.toLowerCase();\r\n let validityCriteria = {\r\n lengthRespected: password.length >= 8 && password.length <= 64,\r\n seriesRespected: false,\r\n repeatRespected: false\r\n };\r\n let lastChar = password[0];\r\n let foundAscendingSeries = false;\r\n let foundDesscendingSeries = false;\r\n\r\n for (let i = 1; i < password.length; i++) {\r\n if (password[i] !== lastChar) {\r\n validityCriteria.repeatRespected = true;\r\n }\r\n let charCodeDiff = password.charCodeAt(i) - lastChar.charCodeAt(0);\r\n foundAscendingSeries = foundAscendingSeries || charCodeDiff === 1;\r\n foundDesscendingSeries = foundDesscendingSeries || charCodeDiff === -1;\r\n\r\n if (Math.abs(charCodeDiff) !== 1 || (foundAscendingSeries && foundDesscendingSeries)) {\r\n validityCriteria.seriesRespected = true;\r\n }\r\n lastChar = password[i];\r\n }\r\n return validityCriteria;\r\n }\r\n\r\n\r\n function updateTooltipValidation() {\r\n let charLength = document.querySelector(\".criterion.checkCharLength span[data-purpose='status-indicator']\");\r\n let charRepeat = document.querySelector(\".criterion.checkRepeat span[data-purpose='status-indicator']\");\r\n let charSeries = document.querySelector(\".criterion.checkSeries span[data-purpose='status-indicator']\");\r\n\r\n let passwordStatus = validateInputString(passwordInput);\r\n\r\n if (passwordStatus.lengthRespected) {\r\n charLength.setAttribute(\"data-status\", \"ok\");\r\n } else {\r\n charLength.removeAttribute(\"data-status\");\r\n }\r\n\r\n if (passwordStatus.repeatRespected) {\r\n charRepeat.setAttribute(\"data-status\", \"ok\");\r\n } else {\r\n charRepeat.removeAttribute(\"data-status\");\r\n }\r\n\r\n if (passwordStatus.seriesRespected) {\r\n charSeries.setAttribute(\"data-status\", \"ok\");\r\n } else {\r\n charSeries.removeAttribute(\"data-status\");\r\n }\r\n\r\n removeAnimationClass();\r\n if (!passwordStatus.lengthRespected && !passwordStatus.repeatRespected && !passwordStatus.seriesRespected){\r\n removeAnimationClass(); \r\n } else if (!passwordStatus.lengthRespected || !passwordStatus.repeatRespected || !passwordStatus.seriesRespected) {\r\n addAnimationClass();\r\n } else {\r\n removeAnimationClass();\r\n };\r\n };\r\n function addAnimationClass() {\r\n document.querySelector(\".password-requirements-container\").classList.add(\"shake-container\");\r\n };\r\n\r\n function removeAnimationClass() {\r\n document.querySelector(\".password-requirements-container\").classList.remove(\"shake-container\");\r\n };\r\n\r\n function checkInputValueLength(passwordInput) {\r\n\r\n if (passwordInput.length < 1) {\r\n document.querySelector(\".strength-notifier\").classList.add(\"empty-field\");\r\n } else if (passwordInput.length > 0) {\r\n document.querySelector(\".strength-notifier\").classList.add(\"Weakest\");\r\n document.querySelector(\".strength-notifier\").classList.remove(\"empty-field\");\r\n } \r\n }\r\n\r\n (function () {\r\n validateInputString(passwordInput);\r\n checkInputValueLength(passwordInput);\r\n updateTooltipValidation();\r\n })();\r\n } \r\n return {\r\n init: init\r\n }\r\n \r\n}"]}