(function(){"use strict";var v=function(){function o(c){this.lowercase=parseInt(c.lowercase,10)||0,this.uppercase=parseInt(c.uppercase,10)||0,this.numbers=parseInt(c.numbers,10)||0,this.special=parseInt(c.special,10)||0,this.length=parseInt(c.length,10)||12}var i=o.prototype;return i.getScore=function(s){var e=this,t=0,a=0,r=["lowercase","uppercase","numbers","special","length"];return r.forEach(function(n){e[n]>0&&(a+=1)}),t+=this.constructor.calc(s,/[a-z]/g,this.lowercase,a),t+=this.constructor.calc(s,/[A-Z]/g,this.uppercase,a),t+=this.constructor.calc(s,/[0-9]/g,this.numbers,a),t+=this.constructor.calc(s,/[$!#?=;:*\-_€%&()`´]/g,this.special,a),a===1?t+=s.length>this.length?100:100/this.length*s.length:t+=s.length>this.length?100/a:100/a/this.length*s.length,t},o.calc=function(s,e,t,a){var r=s.match(e);return r&&r.length>t&&t!==0?100/a:r&&t>0?100/a/t*r.length:0},o}();/**
 * @copyright  (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */(function(o,i){var c=function(e){var t=i.querySelector("meter"),a=e.getAttribute("data-min-length"),r=e.getAttribute("data-min-integers"),n=e.getAttribute("data-min-symbols"),u=e.getAttribute("data-min-uppercase"),l=e.getAttribute("data-min-lowercase"),h=new v({lowercase:l||0,uppercase:u||0,numbers:r||0,special:n||0,length:a||12}),g=h.getScore(e.value),b=t.getAttribute("id").replace(/^\D+/g,""),p=e.parentNode.parentNode.querySelector("#password-"+b);g===100?p.innerText=o.Text._("JFIELD_PASSWORD_INDICATE_COMPLETE"):p.innerText=o.Text._("JFIELD_PASSWORD_INDICATE_INCOMPLETE"),t.value=g,e.value.length||(p.innerText="",e.setAttribute("required",""))};i.addEventListener("DOMContentLoaded",function(){var s=[].slice.call(i.querySelectorAll(".js-password-strength"));s.forEach(function(e,t){var a="";e.value.length||(a=0);var r=i.createElement("meter");r.setAttribute("id","progress-"+t),r.setAttribute("min",0),r.setAttribute("max",100),r.setAttribute("low",40),r.setAttribute("high",99),r.setAttribute("optimum",100),r.value=a;var n=i.createElement("div");n.setAttribute("class","text-center"),n.setAttribute("id","password-"+t),n.setAttribute("aria-live","polite"),e.parentNode.insertAdjacentElement("afterEnd",n),e.parentNode.insertAdjacentElement("afterEnd",r),e.value.length>0&&e.setAttribute("required",!0),e.addEventListener("keyup",function(u){var l=u.target;c(l)})}),s[0]&&i.formvalidator.setHandler("password-strength",function(e){var t=i.querySelectorAll(".js-password-strength"),a=t[0].getAttribute("data-min-length"),r=t[0].getAttribute("data-min-integers"),n=t[0].getAttribute("data-min-symbols"),u=t[0].getAttribute("data-min-uppercase"),l=t[0].getAttribute("data-min-lowercase"),h=new v({lowercase:l||0,uppercase:u||0,numbers:r||0,special:n||0,length:a||12}),g=h.getScore(e);return g===100})})})(Joomla,document)})();
