Spade

Mini Shell

Directory:~$ /home/lmsyaran/public_html/joomla5/media/system/js/fields/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ /home/lmsyaran/public_html/joomla5/media/system/js/fields/validate.min.js

const
maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexPunycode=/^xn--/,regexNonASCII=/[^\0-\x7F]/,regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g,errors={overflow:"Overflow:
input needs wider integers to
process","not-basic":"Illegal input >= 0x80 (not a
basic code point)","invalid-input":"Invalid
input"},baseMinusTMin=35,floor=Math.floor,stringFromCharCode=String.fromCharCode;function
error(o){throw new RangeError(errors[o])}function map(o,t){const s=[];let
e=o.length;for(;e--;)s[e]=t(o[e]);return s}function mapDomain(o,t){const
s=o.split("@");let
e="";s.length>1&&(e=s[0]+"@",o=s[1]),o=o.replace(regexSeparators,".");const
i=o.split("."),a=map(i,t).join(".");return e+a}function
ucs2decode(o){const t=[];let s=0;const e=o.length;for(;s<e;){const
i=o.charCodeAt(s++);if(i>=55296&&i<=56319&&s<e){const
a=o.charCodeAt(s++);(a&64512)==56320?t.push(((i&1023)<<10)+(a&1023)+65536):(t.push(i),s--)}else
t.push(i)}return t}const
ucs2encode=o=>String.fromCodePoint(...o),basicToDigit=function(t){return
t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:36},digitToBasic=function(t,s){return
t+22+75*(t<26)-((s!=0)<<5)},adapt=function(t,s,e){let
i=0;for(t=e?floor(t/700):t>>1,t+=floor(t/s);t>baseMinusTMin*26>>1;i+=36)t=floor(t/baseMinusTMin);return
floor(i+(baseMinusTMin+1)*t/(t+38))},decode=function(t){const
s=[],e=t.length;let
i=0,a=128,r=72,n=t.lastIndexOf(delimiter);n<0&&(n=0);for(let
c=0;c<n;++c)t.charCodeAt(c)>=128&&error("not-basic"),s.push(t.charCodeAt(c));for(let
c=n>0?n+1:0;c<e;){const l=i;for(let
u=1,d=36;;d+=36){c>=e&&error("invalid-input");const
f=basicToDigit(t.charCodeAt(c++));f>=36&&error("invalid-input"),f>floor((2147483647-i)/u)&&error("overflow"),i+=f*u;const
b=d<=r?1:d>=r+26?26:d-r;if(f<b)break;const
g=36-b;u>floor(2147483647/g)&&error("overflow"),u*=g}const
h=s.length+1;r=adapt(i-l,h,l==0),floor(i/h)>2147483647-a&&error("overflow"),a+=floor(i/h),i%=h,s.splice(i++,0,a)}return
String.fromCodePoint(...s)},encode=function(t){const
s=[];t=ucs2decode(t);const e=t.length;let i=128,a=0,r=72;for(const l of
t)l<128&&s.push(stringFromCharCode(l));const n=s.length;let
c=n;for(n&&s.push(delimiter);c<e;){let l=2147483647;for(const u
of t)u>=i&&u<l&&(l=u);const
h=c+1;l-i>floor((2147483647-a)/h)&&error("overflow"),a+=(l-i)*h,i=l;for(const
u of
t)if(u<i&&++a>2147483647&&error("overflow"),u===i){let
d=a;for(let f=36;;f+=36){const
b=f<=r?1:f>=r+26?26:f-r;if(d<b)break;const
g=d-b,v=36-b;s.push(stringFromCharCode(digitToBasic(b+g%v,0))),d=floor(g/v)}s.push(stringFromCharCode(digitToBasic(d,0))),r=adapt(a,h,c===n),a=0,++c}++a,++i}return
s.join("")},toUnicode=function(t){return
mapDomain(t,function(s){return
regexPunycode.test(s)?decode(s.slice(4).toLowerCase()):s})},toASCII=function(t){return
mapDomain(t,function(s){return
regexNonASCII.test(s)?"xn--"+encode(s):s})},punycode={version:"2.3.1",ucs2:{decode:ucs2decode,encode:ucs2encode},decode,encode,toASCII,toUnicode};/**
 * @copyright  (C) 2018 Open Source Matters, Inc.
<https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see
LICENSE.txt
 */class
JFormValidator{constructor(){this.customValidators={},this.handlers=[],this.handlers={},this.removeMarking=this.removeMarking.bind(this),this.inputEmail=()=>{const
s=document.createElement("input");return
s.setAttribute("type","email"),s.type!=="text"},this.setHandler("username",s=>!/[<|>|"|'|%|;|(|)|&]/i.test(s)),this.setHandler("password",s=>/^\S[\S
]{2,98}\S$/.test(s)),this.setHandler("numeric",s=>/^(\d|-)?(\d|,)*\.?\d*$/.test(s)),this.setHandler("email",s=>{const
e=punycode.toASCII(s);return/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(e)}),[].slice.call(document.querySelectorAll("form")).forEach(s=>{s.classList.contains("form-validate")&&this.attachToForm(s)})}get
custom(){return this.customValidators}set
custom(t){this.customValidators=t}setHandler(t,s,e){const
i=e===""?!0:e;this.handlers[t]={enabled:i,exec:s}}markValid(t){const
s=t.form.querySelector(`label[for="${t.id}"]`);let
e;(t.classList.contains("required")||t.getAttribute("required"))&&s&&(e=s.querySelector("span.form-control-feedback")),t.classList.remove("form-control-danger"),t.classList.remove("invalid"),t.classList.add("form-control-success"),t.parentNode.classList.remove("has-danger"),t.parentNode.classList.add("has-success"),t.setAttribute("aria-invalid","false"),e&&e.parentNode.removeChild(e),s&&s.classList.remove("invalid")}markInvalid(t,s){const
e=t.form.querySelector(`label[for="${t.id}"]`);t.classList.remove("form-control-success"),t.classList.remove("valid"),t.classList.add("form-control-danger"),t.classList.add("invalid"),t.parentNode.classList.remove("has-success"),t.parentNode.classList.add("has-danger"),t.setAttribute("aria-invalid","true");let
i;const
a=t.getAttribute("data-validation-text");if(e&&(i=e.querySelector("span.form-control-feedback")),!i){const
r=document.createElement("span");r.classList.add("form-control-feedback"),s&&s==="checkbox"?r.innerHTML=a!==null?Joomla.sanitizeHtml(a):Joomla.sanitizeHtml(Joomla.Text._("JLIB_FORM_FIELD_REQUIRED_CHECK")):s&&s==="value"?r.innerHTML=a!==null?Joomla.sanitizeHtml(a):Joomla.sanitizeHtml(Joomla.Text._("JLIB_FORM_FIELD_REQUIRED_VALUE")):r.innerHTML=a!==null?Joomla.sanitizeHtml(a):Joomla.sanitizeHtml(Joomla.Text._("JLIB_FORM_FIELD_INVALID_VALUE")),e&&e.appendChild(r)}e&&e.classList.add("invalid")}removeMarking(t){let
s;const
e=t.form.querySelector(`label[for="${t.id}"]`);e&&(s=e.querySelector("span.form-control-feedback")),t.classList.remove("form-control-danger"),t.classList.remove("form-control-success"),t.classList.remove("invalid"),t.classList.add("valid"),t.parentNode.classList.remove("has-danger"),t.parentNode.classList.remove("has-success"),s&&e&&e.removeChild(s),e&&e.classList.remove("invalid")}handleResponse(t,s,e){const
i=s.tagName.toLowerCase();(i!=="button"&&s.value!==void
0||i==="fieldset")&&(t===!1?this.markInvalid(s,e):this.markValid(s))}validate(t){let
s;if(t.getAttribute("disabled")==="disabled"||t.getAttribute("display")==="none")return
this.handleResponse(!0,t),!0;if(t.getAttribute("required")||t.classList.contains("required"))if(s=t.tagName.toLowerCase(),s==="fieldset"&&(t.classList.contains("radio")||t.classList.contains("checkboxes"))){if(t.querySelector("input:checked")===null)return
this.handleResponse(!1,t,"checkbox"),!1}else{if(t.getAttribute("type")==="checkbox"&&t.checked!==!0||s==="select"&&!t.value.length)return
this.handleResponse(!1,t,"checkbox"),!1;if(!t.value||t.classList.contains("placeholder"))return
this.handleResponse(!1,t,"value"),!1}const
e=t.getAttribute("class")&&t.getAttribute("class").match(/validate-([a-zA-Z0-9_-]+)/)?t.getAttribute("class").match(/validate-([a-zA-Z0-9_-]+)/)[1]:"";if(t.getAttribute("pattern")&&t.getAttribute("pattern")!==""){if(t.value.length){const
i=new
RegExp(`^${t.getAttribute("pattern")}$`).test(t.value);return
this.handleResponse(i,t,"empty"),i}return
t.hasAttribute("required")||t.classList.contains("required")?(this.handleResponse(!1,t,"empty"),!1):(this.handleResponse(!0,t),!0)}return
e===""?(this.handleResponse(!0,t),!0):e&&e!=="none"&&this.handlers[e]&&t.value&&this.handlers[e].exec(t.value,t)!==!0?(this.handleResponse(!1,t,"invalid_value"),!1):(this.handleResponse(!0,t),!0)}isValid(t){let
s=!0,e,i,a;const r=[];return
t.nodeName==="FORM"?a=[].slice.call(t.elements):a=[].slice.call(t.querySelectorAll("input,
textarea, select, button,
fieldset")),a.forEach(n=>{this.validate(n)===!1&&(s=!1,r.push(n))}),Object.keys(this.customValidators).length&&Object.keys(this.customValidators).foreach(n=>{this.customValidators[n].exec()!==!0&&(s=!1)}),!s&&r.length>0&&(t.getAttribute("data-validation-text")?e=t.getAttribute("data-validation-text"):e=Joomla.Text._("JLIB_FORM_CONTAINS_INVALID_FIELDS"),i={error:[e]},Joomla.renderMessages(i)),s}attachToForm(t){let
s;t.nodeName==="FORM"?s=[].slice.call(t.elements):s=[].slice.call(t.querySelectorAll("input,
textarea, select, button, fieldset")),s.forEach(e=>{const
i=e.tagName.toLowerCase();["input","textarea","select","fieldset"].indexOf(i)>-1&&e.classList.contains("required")&&e.setAttribute("required",""),(i==="input"||i==="button")&&(e.getAttribute("type")==="submit"||e.getAttribute("type")==="image")?e.classList.contains("validate")&&e.addEventListener("click",()=>this.isValid(t)):i!=="button"&&!(i==="input"&&e.getAttribute("type")==="button")&&i!=="fieldset"&&(e.addEventListener("blur",({target:a})=>this.validate(a)),e.addEventListener("focus",({target:a})=>this.removeMarking(a)),e.classList.contains("validate-email")&&this.inputEmail&&e.setAttribute("type","email"))})}}const
initialize=()=>{document.formvalidator=new
JFormValidator,document.removeEventListener("DOMContentLoaded",initialize)};document.addEventListener("DOMContentLoaded",initialize);