<commit_before>﻿/*! Fancy Validate v0.1 | Copyright 2012 <EMAIL> | MIT Licensed | Build 02/01/2012 */
(function(a,b){function q(a){this.event=a,this.type=a.type,this.target=a.target||a.srcElement}function r(){this.list=[]}function s(a){o.error("not implemented")}function t(a){if(this instanceof t)this.init(a);else return new t(a)}function u(a,b){if(this instanceof u)this.form=p.get(a),this.form||o.error("form not found"),this.init(b),o.extend(!0,this.settings,u.defaults,b),this.initForm();else return new u(a,b)}var c=a.document,d=/\S/,e=/^[\s\xA0]+/,f=/[\s\xA0]+$/,g=/\{(\d+)\}/,h={},i=Object.prototype.toString,j=Object.prototype.hasOwnProperty,k=Array.prototype.slice,l=Array.prototype.indexOf,m=String.prototype.trim,n=function(){var a={},b="Boolean Number String Function Array Date RegExp Object".split(" "),c=0,d=b.length;for(;c<d;)a["[object "+b[c]+"]"]=b[c++].toLowerCase();return a}(),o={trim:m?function(a){return a==null?"":m.call(a)}:function(a){return a==null?"":a.toString().replace(e,"").replace(f,"")},startsWith:function(a,b){return a.slice(0,b.length)==b},endsWith:function(a,b){return a.slice(-b.length)==b},makeArray:function(a){return k.call(a,0)},inArray:l?function(a,b,c){return l.call(a,b,c)}:function(a,b,c){var d=a.length;c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in a&&a[c]===b)return c;return-1},remove:function(a,b){return b>-1&&a.splice(b,1)},format:function(a,b){return arguments.length==1?function(){var b=o.makeArray(arguments);return b.unshift(a),o.format.apply(this,b)}:(arguments.length>2&&!o.isArray(b)&&(b=o.makeArray(arguments).slice(1)),o.isArray(b)||(b=[b]),o.each(b,function(b,c){a=a.replace(h[c]||(h[c]=new RegExp("\\{"+c+"\\}","g")),b)}),a)},hasFormat:function(a){return g.test(a)},parse:function(a){return!o.isString(a)||o.isEmpty(a)?null:(a=o.trim(a),(new Function("return "+a))())},each:function(a,c,d){var e,f=0,g=a.length,h=g===b;if(h){for(e in a)if(c.call(d||a[e],a[e],e)===!1)break}else for(;f<g;)if(c.call(d||a[f],a[f],f++)===!1)break;return a},getType:function(a){return a==null?String(a):n[i.call(a)]||"object"},isType:function(a,b){return o.getType(a)===b},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},isDigit:function(a){return o.isNumeric(a)&&a%1==0},isDate:function(a){return o.isType(a,"date")&&!isNaN(a)},isEmpty:function(a){return!d.test(a)},isEmptyObject:function(a){for(var b in a)return!1;return!0},isPlainObject:function(a){if(!a||!o.isObject(a)||a.nodeType)return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||j.call(a,d)},extend:function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!o.isFunction(h)&&(h={});for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)continue;k&&e&&(o.isPlainObject(e)||(f=o.isArray(e)))?(f?(f=!1,g=d&&o.isArray(d)?d:[]):g=d&&o.isPlainObject(d)?d:{},h[c]=o.extend(k,g,e)):e!==b&&(h[c]=e)}return h},error:function(a){var b=o.isObject(a)?a:new Error(a);throw b}};o.each("Boolean String Function Array RegExp Object".split(" "),function(a){o["is"+a]=function(b){return o.isType(b,a.toLowerCase())}});var p={ready:function(b){/in/.test(c.readyState)?a.setTimeout(function(){p.ready(b)},10):b()},get:function(a){return p.isElement(a)?a:c.getElementById(a)},isElement:function(a){return a&&a.nodeType===1},attr:function(a,c,d){if(p.isElement(a)){if(d===b)return a[c]||a.getAttribute(c);a.setAttribute(c,d)}return null},addClass:function(a,b){if(p.isElement(a)&&b)if(!a.className)a.className=b;else{var c=b.split(" ");c.length>1?o.each(c,function(b){p.addClass(a,b)}):o.inArray(a.className.split(" "),b)==-1&&(a.className+=" "+b)}},removeClass:function(a,b){if(p.isElement(a)&&a.className&&b){var c=a.className.split(" "),d=b.split(" ");d.length>1?o.each(d,function(b){p.removeClass(a,b)}):o.remove(c,o.inArray(c,b))&&(a.className=c.join(" "))}},toggle:function(a,b){a.style.display=b?"":"none"},offset:function(a){var b=0,c=0;do b+=a.offsetTop,c+=a.offsetLeft;while(a=a.offsetParent);return{top:b,left:c}},setRange:function(a,b,c){if(a.setSelectionRange)a.focus(),a.setSelectionRange(b,c);else if(a.createTextRange){var d=a.createTextRange();d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d.select()}},getRange:function(a){var b,d,e,f,g,h=a.value;return a.setSelectionRange?(b=a.selectionStart,d=a.selectionEnd):a.createTextRange&&(e=c.selection.createRange(),f=e.duplicate(),p.istextarea(a)?(f.moveToElementText(a),f.setEndPoint("EndToEnd",e),g=e.text.length,b=f.text.length-g,d=b+g):(g=h.length,f.moveEnd("character",g),b=f.text==""?g:h.lastIndexOf(f.text),f=e.duplicate(),f.moveStart("character",-g),d=f.text.length)),{start:b,end:d,text:h.substring(b,d),replace:function(c){return a.value.substring(0,b)+c+a.value.substring(d,a.value.length)}}},getRange2:function(a){var b,d,e;return a.setSelectionRange?(b=a.selectionStart,d=a.selectionEnd):(e=c.selection.createRange(),b=0-e.duplicate().moveStart("character",-1e5),d=b+e.text.length),{start:b,end:d,text:a.value.substring(b,d),replace:function(c){return a.value.substring(0,b)+c+a.value.substring(d,a.value.length)}}},focus:function(a){a.istext===b&&(a.istext=p.istextarea(a)||p.isItext(a));try{a.istext&&a.value?p.setRange(a,0,a.value.length):a.focus&&a.focus()}catch(c){}},log:function(){a.console&&console.log(o.makeArray(arguments).join(" "))}};o.each("radio checkbox text".split(" "),function(a){p["isI"+a]=function(b){return p.isElement(b)&&b.nodeName.toLowerCase()==="input"&&b.type===a}}),o.each("textarea select option label".split(" "),function(a){p["is"+a]=function(b){return p.isElement(b)&&b.nodeName.toLowerCase()===a}}),o.extend(q,{specials:{focusin:"focus",focusout:"blur"},add:c.addEventListener?function(a,b,c){var d=q.specials[b];a.addEventListener(d||b,c,!!d)}:function(b,c,d){c=="input"&&"onpropertychange"in b?b.onpropertychange=function(){a.event.propertyName=="value"&&d.call(this,a.event)}:b.attachEvent("on"+c,d)},remove:c.removeEventListener?function(a,b,c){var d=q.specials[b];a.removeEventListener(d||b,c,!!d)}:function(a,b,c){b=="input"&&"onpropertychange"in a?a.onpropertychange=null:a.detachEvent("on"+b,c)},fix:function(b){return new q(b||a.event)},prototype:{stopPropagation:function(){var a=this.event;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},preventDefault:function(){var a=this.event;a.preventDefault&&a.preventDefault(),a.returnValue=!1},stop:function(){this.preventDefault(),this.stopPropagation()}}}),o.extend(r.prototype,{first:function(){if(this.len())return this.list[0].key},len:function(){return this.list.length},each:function(a,b){o.each(this.list,a,b)},find:function(a){var b=-1;return this.each(function(c,d){if(c.key==a)return b=d,!1}),b},findEntry:function(a){var b=this.find(a);if(b>-1)return this.list[b]},remove:function(a){o.remove(this.list,this.find(a))},add:function(a,b){this.remove(a),this.list.push({key:a,message:b||""})},reset:function(){this.list.length=0}}),o.extend(t,{version:.1,build:new Date(13232736e5),core:o,dom:p,event:q,defaults:{rules:{},messages:{}},messages:{required:"\u6b64\u5b57\u6bb5\u662f\u5fc5\u9700\u7684",compareTo:"\u8bf7\u518d\u6b21\u8f93\u5165\u76f8\u540c\u7684\u503c",pattern:"\u8f93\u5165\u7684\u683c\u5f0f\u4e0d\u5339\u914d",fn:"\u8f93\u5165\u4e0d\u5339\u914d",minlength:o.format("\u8bf7\u8f93\u5165\u4e00\u4e2a\u957f\u5ea6\u6700\u5c11\u662f {0} \u7684\u5b57\u7b26\u4e32"),maxlength:o.format("\u8bf7\u8f93\u5165\u4e00\u4e2a\u957f\u5ea6\u6700\u591a\u662f {0} \u7684\u5b57\u7b26\u4e32"),rangelength:o.format("\u8bf7\u8f93\u5165\u4e00\u4e2a\u957f\u5ea6\u4ecb\u4e8e {0} \u548c {1} \u4e4b\u95f4\u7684\u5b57\u7b26\u4e32"),min:o.format("\u8bf7\u8f93\u5165\u4e00\u4e2a\u6700\u5c0f\u4e3a {0} \u7684\u503c"),max:o.format("\u8bf7\u8f93\u5165\u4e00\u4e2a\u6700\u5927\u4e3a {0} \u7684\u503c"),range:o.format("\u8bf7\u8f93\u5165\u4e00\u4e2a\u4ecb\u4e8e {0} \u548c {1} \u4e4b\u95f4\u7684\u503c"),digit:"\u8bf7\u53ea\u8f93\u5165\u6574\u6570",numeric:"\u8bf7\u8f93\u5165\u6709\u6548\u7684\u6570\u5b57",prefix:o.format("\u8bf7\u8f93\u5165\u4ee5 {0} \u5f00\u5934"),suffix:o.format("\u8bf7\u8f93\u5165\u4ee5 {0} \u7ed3\u5c3e"),equal:o.format("\u8bf7\u8f93\u5165\u4e0e {0} \u76f8\u7b49\u7684\u503c")},methods:{required:function(a,b){return this.getLen(a,b)>0},compareTo:function(a,b,c){var d=this.getElement(c);return this.optional(b)&&this.optional(d)||d&&a==this.getValue(d)},pattern:function(a,b,c){var d=o.isRegExp(c)?c:new RegExp(c);return this.optional(b)||d.test(a)},fn:function(a,b,c){var d=o.isFunction(c)?c:o.parse(c);return this.optional(b)||d.call(this,a,b)},minlength:function(a,b,c){return this.optional(b)||this.getLen(a,b)>=c},maxlength:function(a,b,c){return this.optional(b)||this.getLen(a,b)<=c},rangelength:function(a,b,c){var d=this.getLen(a,b);return this.optional(b)||d>=c[0]&&d<=c[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},numeric:function(a,b){return this.optional(b)||o.isNumeric(a)},digit:function(a,b){return this.optional(b)||o.isDigit(a)},prefix:function(a,b,c){return this.optional(b)||o.startsWith(a,c)},suffix:function(a,b,c){return this.optional(b)||o.endsWith(a,c)},equal:function(a,b,c){return this.optional(b)||a==c}},addMethod:function(a,b,c){o.isFunction(b)||o.error("method is not a function "+b),t.methods[a]=b,c&&(t.messages[a]=c)},patterns:{},addPattern:function(a,b,c){o.isRegExp(b)||o.error("argument is not a regular expression "+b),t.patterns[a]=b,t.addMethod(a,function(b,c,d){return this.optional(c)||t.patterns[a].test(b)},c)},prototype:{init:function(a){this.settings=o.extend(!0,{},t.defaults,a),this.elementList=[],this.mismatch="dependency-mismatch",this.valids=new r,this.errors=new r},register:function(){var a=arguments[0],b=1,c=arguments.length,d=this.getKey(a),e=this.settings.rules,f=this.settings.messages,g;if(!d||c<2)return!1;for(;b<c;)if(g=arguments[b++])e[d]=o.extend(e[d],g.rules),f[d]=o.extend(f[d],e[d].messages,g.messages),delete e[d].messages;return o.isEmptyObject(e[d])?(delete e[d],delete f[d],!1):(o.inArray(this.elements(),a)==-1&&this.elementList.push(a),!0)},optional:function(a){return!t.methods.required.call(this,this.getValue(a),a)&&this.mismatch},getKey:s,getValue:s,getLen:s,numOfErrors:function(){return this.errors.len()},valid:function(){return this.numOfErrors()==0},reset:function(){this.valids.reset(),this.errors.reset()},elements:function(){return this.elementList},checkAll:function(){var a=0,b=this.elements(),c=b.length;this.reset();for(;a<c;)this.check(b[a++]);return this.valid()},check:function(a){var b,c,d,e,f=this.getKey(a),g=this.settings.rules[f];if(!f||a.disabled||o.isEmptyObject(g))return;for(b in g){d=g[b],e=t.methods[b],e||o.error("method "+b+" not found");try{c=e.call(this,this.getValue(a),a,d);if(c==this.mismatch)continue;if(!c)return this.formatAndAdd(a,b,d),!1}catch(h){o.error(h)}}return this.addResult(c,a)},addResult:function(a,b,c){return a===!1?(this.valids.remove(b),this.errors.add(b,c),a):(this.errors.remove(b),a==this.mismatch?(this.valids.remove(b),a):(this.valids.add(b),!0))},formatAndAdd:function(a,b,c){var d=this.defaultMessage(a,b);o.isFunction(d)?d=d.call(this,c):o.hasFormat(d)&&(d=o.format(d,c)),this.addResult(!1,a,d)},defaultMessage:function(a,b){var c=this.getKey(a);return this.customMessage(c,b)||a.title||t.messages[b]||"<strong>Warning: No message defined for "+c+"</strong>"},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(o.isString(c)?c:c[b])}}}),o.extend(u,{appendNext:function(a,b){var c=this.attr(b).checkable,d=b.parentNode;do b=b.nextSibling;while(b&&c&&p.islabel(b));d.insertBefore(a,b)},findNext:function(a,b){do a=a.nextSibling;while(a&&(!p.isElement(a)||!this.isErrLabel(a,b)));return a},appendContainer:function(a,b){var d,e,f=c.body;do d=p.offset(b),e=b.offsetWidth;while(d.top==0&&(b=b.parentNode)&&b!==f);p.islabel(b.nextSibling)&&(e+=b.nextSibling.offsetWidth),a.style.top=d.top+"px",a.style.left=d.left+e+"px",this.settings.container.appendChild(a)},findContainer:function(a,b){var c;return o.each(this.settings.container.childNodes,function(a){if(this.isErrLabel(a,b))return c=a,!1},this),c},_parent:function(a){var b=this.attr(a);if(!b.offsetParent){var d=this.settings.findDepth||0,e=c.body;do a=a.parentNode;while(d-->0&&a&&a!==e);b.offsetParent=a}return b.offsetParent},findLast:function(a,b){var c=u._parent.call(this,a).lastChild;return this.isErrLabel(c,b)||(c=null),c},appendLast:function(a,b){u._parent.call(this,b).appendChild(a)},getListByKey:function(a){var b=o.isString(a)?a:this.getKey(a),c=[];return o.each(this.form.elements,function(a){this.getKey(a)===b&&c.push(a)},this),c},parseAttr:function(){var a=/[a-z]\w+\s*,|[a-z]\w+\s*$/i,b=/^[^:,]+$/,c=/,\s*messages\s*:/i,d=/,\s*([a-z]\w+)/ig,e=/([a-z]\w+)\s*,/ig,f=/:(?:(?:\d|true):)*/g;return function(g){if(!o.isEmpty(g)){var h;return b.test(g)?g+=":1":a.test(g)&&(g=g.split(c),g[0]=g[0].replace(d,",$1:1").replace(e,"$1:1,").replace(f,":"),g=g.join(",messages:")),g.charAt(0)!="{"&&(g="{"+g+"}"),h=o.parse(g),h.rules||(h={rules:h}),h}}}(),parseAttr5:function(a){if(!o.isBoolean(a.required)){var c={};o.each("required min max pattern".split(" "),function(d){var e=p.attr(a,d);e!=b&&e!=null&&(c[d]=o.isNumeric(e)?parseFloat(e):e||1)});if(!o.isEmptyObject(c))return{rules:c}}},ruleToAttr:function(a,b){var c=b.maxlength||b.rangelength;c&&(a.maxLength==-1||a.maxLength==2147483647)&&(o.isArray(c)&&(c=c[1]),a.maxLength=c)}}),o.extend(!0,u,t,{defaults:{ruleKey:"name",ruleAttr:"data-val",validCls:"valid",errorCls:"error",activeElCls:"fld-active",errorElCls:"fld-error",validElCls:"fld-valid",errorElement:"label",interceptInput:!0,interceptSubmit:!0,focusInvalid:!0,submitRandom:!0,highlight:function(a){this.elementCls(a,this.settings.errorElCls,this.settings.validElCls)},unhighlight:function(a){this.elementCls(a,this.settings.validElCls,this.settings.errorElCls)},labelText:function(a,b){a.innerHTML=b},showErrors:function(){this.errors.each(this.showLabel,this),this.valids.each(this.showLabel,this)},findLabel:u.findNext,appendLabel:u.appendNext},setDefaults:function(a){o.extend(u.defaults,a)}}),o.extend(!0,u.prototype,t.prototype,{initForm:function(a){this.time=+(new Date),this.uuid=0,this.uukey="fancy_expando",this.attrMap={},o.each(this.form.elements,this.parseRule,this),this.elements().length?(this.hideErrors(),this.reset(),this.bindEvents()):this.debug("no elements want to validate")},getKey:function(a){var b=this.settings,c=b.ruleKeyAlter,d=b.getKey;return c&&p.attr(a,c)||d&&d.call(this,a)||p.attr(a,b.ruleKey)},getValue:function(a){return a.value},getLen:function(a,b){var c=0,d=this.attr(b);return d.checkable||d.multisel?(o.each(d.chklist||b,function(a){(a.checked||a.selected)&&c++}),c):o.trim(a).length},getElement:function(a){return this.form[a]||p.get(a)||$f.getListByKey.call(this,a)[0]},debug:function(){this.settings.debug&&p.log.apply(null,arguments)},checkForm:function(){var a=this.checkAll();return this.showErrors(),a},parseRule:function(a){var b=this.getKey(a),c=this.settings,d=o.trim(p.attr(a,c.ruleAttr));if(b&&this.register(a,u.parseAttr5(a),u.parseAttr(d))){u.ruleToAttr(a,c.rules[b]);var e=this.attr(a);if(!e){var f=a[this.uukey]=b+this.uuid++;e=this.attrMap[f]={expando:f,key:b},this.defineAttr(a,e)}if(e.checkable&&a!=e.lastchk){var g=o.inArray(this.elements(),a);g>-1&&o.remove(this.elements(),g)}}},defineAttr:function(a,b){b.checkable=p.isIradio(a)||p.isIcheckbox(a),b.multisel=p.isselect(a)&&a.multiple===!0;if(b.checkable){var c=[],d=this.settings,e=this.uukey,f=d.getList&&d.getList.call(this,a)||this.getElement(a.name);f.length||(f=[f]),o.each(f,function(a){if(!a[e]||a[e]==b.expando)c.push(a),p.attr(a,d.ruleKey)||p.attr(a,d.ruleKey,b.key),a[e]=b.expando}),b.chklist=c,b.lastchk=c[c.length-1]}},attr:function(a){return this.attrMap[a[this.uukey]]},bindEvents:function(){this.settings.interceptInput&&o.each("focusin focusout input keyup click".split(" "),function(a){q.add(this.form,a,this.onInput())},this),this.settings.interceptSubmit&&q.add(this.form,"submit",this.onSubmit())},onInput:function(){var a=this,b=this.settings;return function(c){var d,e,f,g=q.fix(c),h=g.target;p.isoption(h)&&(h=h.parentNode),f=a.attr(h);if(f&&b.rules[f.key]){g.type=="focusin"||g.type=="focus"?p.addClass(h,b.activeElCls):(g.type=="focusout"||g.type=="blur")&&p.removeClass(h,b.activeElCls),d=a.getValue(h),e=a.getLen(d,h);if(f.prevVal!=d||f.prevLen!=e){f.prevVal=d,f.prevLen=e,f.checkable&&(h=f.lastchk);var i=a.errors.findEntry(h)||a.valids.findEntry(h);i&&a.hideLabel(i),a.check(h)===!0&&b.autoTab&&a.focusNext(h);var j=a.errors.findEntry(h)||a.valids.findEntry(h);j&&a.showLabel(j)}}}},onSubmit:function(){var a=this,b=this.settings;return function(c){var d=q.fix(c);if(!a.checkForm())return d.stop(),b.focusInvalid&&p.focus(a.errors.first()),!1;b.submitRandom&&a.addRandom();if(b.submitHandler)return d.stop(),b.submitHandler.call(a,a.form),!1}},addRandom:function(){var a=this;o.each({e:this.elements().length,d:+(new Date),t:this.time,r:Math.random()},function(b,d){var e=(a.getKey(this)||this.id)+"_"+d,f=a.getElement(e);f||(f=c.createElement("input"),f.type="hidden",this.insertBefore(f,this.firstChild)),f.name=e,f.value=b},this.form)},focusNext:function(a){var b=this.elements(),c=b.length,d=o.inArray(b,a)+1;d>0&&d<c&&p.focus(b[d])},showErrors:function(){this.settings.showErrors.call(this)},showLabel:function(a){var b=this.errorsFor(a.key),c=this.settings;p.removeClass(b,c.validCls),p.addClass(b,c.errorCls),c.labelText.call(this,b,a.message),(a.message||c.validCls)&&p.toggle(b,!0),a.message?c.highlight.call(this,a.key):(c.unhighlight.call(this,a.key),p.addClass(b,c.validCls))},hideLabel:function(a){p.toggle(this.errorsFor(a.key))},hideErrors:function(){this.errors.each(this.hideLabel,this),this.valids.each(this.hideLabel,this)},elementCls:function(a,b,c){var d=this.attr(a);d.checkable?o.each(d.chklist,function(a){p.removeClass(a,c),p.addClass(a,b)}):(p.removeClass(a,c),p.addClass(a,b))},errorsFor:function(a){var b=this.attr(a),d=b.errLabel;if(!d){var e=this.settings,f=a.id||b.key,g=this.uukey+"_for";d=e.findLabel.call(this,a,f);if(!d||d[g]&&d[g]!=expando)d=c.createElement(e.errorElement),p.attr(d,"for",f),p.attr(d,"fancy",f),e.appendLabel.call(this,d,a),b.errLabel=d,d[g]=b.expando}return d},isErrLabel:function(a,b){return p.attr(a,"for")==b&&p.attr(a,"fancy")==b}}),u.base=t,a.fancy=a.$f=u})(window)<commit_msg>bugfix for tips<commit_after>/*! Fancy Validate v0.1.1 | Copyright 2012 <EMAIL> | MIT Licensed | Build 03/28/2012 */
(function(a,b){function q(a){this.event=a,this.type=a.type,this.target=a.target||a.srcElement}function r(){this.list=[]}function s(a){o.error("not implemented")}function t(a){if(!(this instanceof t))return new t(a);this.init(a)}function u(a,b){if(!(this instanceof u))return new u(a,b);this.form=p.get(a),this.form||o.error("form not found"),this.init(b),o.extend(!0,this.settings,u.defaults,b),this.initForm()}var c=a.document,d=/\S/,e=/^[\s\xA0]+/,f=/[\s\xA0]+$/,g=/\{(\d+)\}/,h={},i=Object.prototype.toString,j=Object.prototype.hasOwnProperty,k=Array.prototype.slice,l=Array.prototype.indexOf,m=String.prototype.trim,n=function(){var a={},b="Boolean Number String Function Array Date RegExp Object".split(" "),c=0,d=b.length;for(;c<d;)a["[object "+b[c]+"]"]=b[c++].toLowerCase();return a}(),o={trim:m?function(a){return a==null?"":m.call(a)}:function(a){return a==null?"":a.toString().replace(e,"").replace(f,"")},startsWith:function(a,b){return a.slice(0,b.length)==b},endsWith:function(a,b){return a.slice(-b.length)==b},makeArray:function(a){return k.call(a,0)},inArray:l?function(a,b,c){return l.call(a,b,c)}:function(a,b,c){var d=a.length;c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in a&&a[c]===b)return c;return-1},remove:function(a,b){return b>-1&&a.splice(b,1)},format:function(a,b){return arguments.length==1?function(){var b=o.makeArray(arguments);return b.unshift(a),o.format.apply(this,b)}:(arguments.length>2&&!o.isArray(b)&&(b=o.makeArray(arguments).slice(1)),o.isArray(b)||(b=[b]),o.each(b,function(b,c){a=a.replace(h[c]||(h[c]=new RegExp("\\{"+c+"\\}","g")),b)}),a)},hasFormat:function(a){return g.test(a)},parse:function(a){return!o.isString(a)||o.isEmpty(a)?null:(a=o.trim(a),(new Function("return "+a))())},each:function(a,c,d){var e,f=0,g=a.length,h=g===b;if(h){for(e in a)if(c.call(d||a[e],a[e],e)===!1)break}else for(;f<g;)if(c.call(d||a[f],a[f],f++)===!1)break;return a},getType:function(a){return a==null?String(a):n[i.call(a)]||"object"},isType:function(a,b){return o.getType(a)===b},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},isDigit:function(a){return o.isNumeric(a)&&a%1==0},isDate:function(a){return o.isType(a,"date")&&!isNaN(a)},isEmpty:function(a){return!d.test(a)},isEmptyObject:function(a){for(var b in a)return!1;return!0},isPlainObject:function(a){if(!a||!o.isObject(a)||a.nodeType)return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||j.call(a,d)},extend:function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!o.isFunction(h)&&(h={});for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)continue;k&&e&&(o.isPlainObject(e)||(f=o.isArray(e)))?(f?(f=!1,g=d&&o.isArray(d)?d:[]):g=d&&o.isPlainObject(d)?d:{},h[c]=o.extend(k,g,e)):e!==b&&(h[c]=e)}return h},error:function(a){var b=o.isObject(a)?a:new Error(a);throw b}};o.each("Boolean String Function Array RegExp Object".split(" "),function(a){o["is"+a]=function(b){return o.isType(b,a.toLowerCase())}});var p={ready:function(b){/in/.test(c.readyState)?a.setTimeout(function(){p.ready(b)},10):b()},get:function(a){return p.isElement(a)?a:c.getElementById(a)},isElement:function(a){return a&&a.nodeType===1},attr:function(a,c,d){if(p.isElement(a)){if(d===b)return a[c]||a.getAttribute(c);a.setAttribute(c,d)}return null},addClass:function(a,b){if(p.isElement(a)&&b)if(!a.className)a.className=b;else{var c=b.split(" ");c.length>1?o.each(c,function(b){p.addClass(a,b)}):o.inArray(a.className.split(" "),b)==-1&&(a.className+=" "+b)}},removeClass:function(a,b){if(p.isElement(a)&&a.className&&b){var c=a.className.split(" "),d=b.split(" ");d.length>1?o.each(d,function(b){p.removeClass(a,b)}):o.remove(c,o.inArray(c,b))&&(a.className=c.join(" "))}},toggle:function(a,b){a.style.display=b?"":"none"},offset:function(a){var b=0,c=0;do b+=a.offsetTop,c+=a.offsetLeft;while(a=a.offsetParent);return{top:b,left:c}},setRange:function(a,b,c){if(a.setSelectionRange)a.focus(),a.setSelectionRange(b,c);else if(a.createTextRange){var d=a.createTextRange();d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d.select()}},getRange:function(a){var b,d,e,f,g,h=a.value;return a.setSelectionRange?(b=a.selectionStart,d=a.selectionEnd):a.createTextRange&&(e=c.selection.createRange(),f=e.duplicate(),p.istextarea(a)?(f.moveToElementText(a),f.setEndPoint("EndToEnd",e),g=e.text.length,b=f.text.length-g,d=b+g):(g=h.length,f.moveEnd("character",g),b=f.text==""?g:h.lastIndexOf(f.text),f=e.duplicate(),f.moveStart("character",-g),d=f.text.length)),{start:b,end:d,text:h.substring(b,d),replace:function(c){return a.value.substring(0,b)+c+a.value.substring(d,a.value.length)}}},getRange2:function(a){var b,d,e;return a.setSelectionRange?(b=a.selectionStart,d=a.selectionEnd):(e=c.selection.createRange(),b=0-e.duplicate().moveStart("character",-1e5),d=b+e.text.length),{start:b,end:d,text:a.value.substring(b,d),replace:function(c){return a.value.substring(0,b)+c+a.value.substring(d,a.value.length)}}},focus:function(a){a.istext===b&&(a.istext=p.istextarea(a)||p.isItext(a));try{a.istext&&a.value?p.setRange(a,0,a.value.length):a.focus&&a.focus()}catch(c){}},log:function(){a.console&&console.log(o.makeArray(arguments).join(" "))}};o.each("radio checkbox text".split(" "),function(a){p["isI"+a]=function(b){return p.isElement(b)&&b.nodeName.toLowerCase()==="input"&&b.type===a}}),o.each("textarea select option label".split(" "),function(a){p["is"+a]=function(b){return p.isElement(b)&&b.nodeName.toLowerCase()===a}}),o.extend(q,{specials:{focusin:"focus",focusout:"blur"},add:c.addEventListener?function(a,b,c){var d=q.specials[b];a.addEventListener(d||b,c,!!d)}:function(b,c,d){c=="input"&&"onpropertychange"in b?b.onpropertychange=function(){a.event.propertyName=="value"&&d.call(this,a.event)}:b.attachEvent("on"+c,d)},remove:c.removeEventListener?function(a,b,c){var d=q.specials[b];a.removeEventListener(d||b,c,!!d)}:function(a,b,c){b=="input"&&"onpropertychange"in a?a.onpropertychange=null:a.detachEvent("on"+b,c)},fix:function(b){return new q(b||a.event)},prototype:{stopPropagation:function(){var a=this.event;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},preventDefault:function(){var a=this.event;a.preventDefault&&a.preventDefault(),a.returnValue=!1},stop:function(){this.preventDefault(),this.stopPropagation()}}}),o.extend(r.prototype,{first:function(){if(this.len())return this.list[0].key},len:function(){return this.list.length},each:function(a,b){o.each(this.list,a,b)},find:function(a){var b=-1;return this.each(function(c,d){if(c.key==a)return b=d,!1}),b},findEntry:function(a){var b=this.find(a);if(b>-1)return this.list[b]},remove:function(a){o.remove(this.list,this.find(a))},add:function(a,b){this.remove(a),this.list.push({key:a,message:b||""})},reset:function(){this.list.length=0}}),o.extend(t,{version:.1,build:new Date(13232736e5),core:o,dom:p,event:q,defaults:{rules:{},messages:{}},messages:{required:"此字段是必需的",compareTo:"请再次输入相同的值",pattern:"输入的格式不匹配",fn:"输入不匹配",minlength:o.format("请输入一个长度最少是 {0} 的字符串"),maxlength:o.format("请输入一个长度最多是 {0} 的字符串"),rangelength:o.format("请输入一个长度介于 {0} 和 {1} 之间的字符串"),min:o.format("请输入一个最小为 {0} 的值"),max:o.format("请输入一个最大为 {0} 的值"),range:o.format("请输入一个介于 {0} 和 {1} 之间的值"),digit:"请只输入整数",numeric:"请输入有效的数字",prefix:o.format("请输入以 {0} 开头"),suffix:o.format("请输入以 {0} 结尾"),equal:o.format("请输入与 {0} 相等的值")},methods:{required:function(a,b){return this.getLen(a,b)>0},compareTo:function(a,b,c){var d=this.getElement(c);return this.optional(b)&&this.optional(d)||d&&a==this.getValue(d)},pattern:function(a,b,c){var d=o.isRegExp(c)?c:new RegExp(c);return this.optional(b)||d.test(a)},fn:function(a,b,c){var d=o.isFunction(c)?c:o.parse(c);return this.optional(b)||d.call(this,a,b)},minlength:function(a,b,c){return this.optional(b)||this.getLen(a,b)>=c},maxlength:function(a,b,c){return this.optional(b)||this.getLen(a,b)<=c},rangelength:function(a,b,c){var d=this.getLen(a,b);return this.optional(b)||d>=c[0]&&d<=c[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},numeric:function(a,b){return this.optional(b)||o.isNumeric(a)},digit:function(a,b){return this.optional(b)||o.isDigit(a)},prefix:function(a,b,c){return this.optional(b)||o.startsWith(a,c)},suffix:function(a,b,c){return this.optional(b)||o.endsWith(a,c)},equal:function(a,b,c){return this.optional(b)||a==c}},addMethod:function(a,b,c){o.isFunction(b)||o.error("method is not a function "+b),t.methods[a]=b,c&&(t.messages[a]=c)},patterns:{},addPattern:function(a,b,c){o.isRegExp(b)||o.error("argument is not a regular expression "+b),t.patterns[a]=b,t.addMethod(a,function(b,c,d){return this.optional(c)||t.patterns[a].test(b)},c)},prototype:{init:function(a){this.settings=o.extend(!0,{},t.defaults,a),this.elementList=[],this.mismatch="dependency-mismatch",this.valids=new r,this.errors=new r},register:function(){var a=arguments[0],b=1,c=arguments.length,d=this.getKey(a),e=this.settings.rules,f=this.settings.messages,g;if(!d||c<2)return!1;for(;b<c;)if(g=arguments[b++])e[d]=o.extend(e[d],g.rules),f[d]=o.extend(f[d],e[d].messages,g.messages),delete e[d].messages;return o.isEmptyObject(e[d])?(delete e[d],delete f[d],!1):(o.inArray(this.elements(),a)==-1&&this.elementList.push(a),!0)},optional:function(a){return!t.methods.required.call(this,this.getValue(a),a)&&this.mismatch},getKey:s,getValue:s,getLen:s,numOfErrors:function(){return this.errors.len()},valid:function(){return this.numOfErrors()==0},reset:function(){this.valids.reset(),this.errors.reset()},elements:function(){return this.elementList},checkAll:function(){var a=0,b=this.elements(),c=b.length;this.reset();for(;a<c;)this.check(b[a++]);return this.valid()},check:function(a){var b,c,d,e,f=this.getKey(a),g=this.settings.rules[f];if(!f||a.disabled||o.isEmptyObject(g))return;for(b in g){d=g[b],e=t.methods[b],e||o.error("method "+b+" not found");try{c=e.call(this,this.getValue(a),a,d);if(c==this.mismatch)continue;if(!c)return this.formatAndAdd(a,b,d),!1}catch(h){o.error(h)}}return this.addResult(c,a)},addResult:function(a,b,c){return a===!1?(this.valids.remove(b),this.errors.add(b,c),a):(this.errors.remove(b),a==this.mismatch?(this.valids.remove(b),a):(this.valids.add(b),!0))},formatAndAdd:function(a,b,c){var d=this.defaultMessage(a,b);o.isFunction(d)?d=d.call(this,c):o.hasFormat(d)&&(d=o.format(d,c)),this.addResult(!1,a,d)},defaultMessage:function(a,b){var c=this.getKey(a);return this.customMessage(c,b)||a.title||t.messages[b]||"<strong>Warning: No message defined for "+c+"</strong>"},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(o.isString(c)?c:c[b])}}}),o.extend(u,{appendNext:function(a,b){var c=this.attr(b).checkable,d=b.parentNode;do b=b.nextSibling;while(b&&c&&p.islabel(b));d.insertBefore(a,b)},findNext:function(a,b){do a=a.nextSibling;while(a&&(!p.isElement(a)||!this.isErrLabel(a,b)));return a},appendContainer:function(a,b){var d,e,f=c.body;do d=p.offset(b),e=b.offsetWidth;while(d.top==0&&(b=b.parentNode)&&b!==f);p.islabel(b.nextSibling)&&(e+=b.nextSibling.offsetWidth),a.style.top=d.top+"px",a.style.left=d.left+e+"px",this.settings.container.appendChild(a)},findContainer:function(a,b){var c;return o.each(this.settings.container.childNodes,function(a){if(this.isErrLabel(a,b))return c=a,!1},this),c},_parent:function(a){var b=this.attr(a);if(!b.offsetParent){var d=this.settings.findDepth||0,e=c.body;do a=a.parentNode;while(d-->0&&a&&a!==e);b.offsetParent=a}return b.offsetParent},findLast:function(a,b){var c=u._parent.call(this,a).lastChild;return this.isErrLabel(c,b)||(c=null),c},appendLast:function(a,b){u._parent.call(this,b).appendChild(a)},getListByKey:function(a){var b=o.isString(a)?a:this.getKey(a),c=[];return o.each(this.form.elements,function(a){this.getKey(a)===b&&c.push(a)},this),c},parseAttr:function(){var a=/[a-z]\w+\s*,|[a-z]\w+\s*$/i,b=/^[^:,]+$/,c=/,\s*messages\s*:/i,d=/,\s*([a-z]\w+)/ig,e=/([a-z]\w+)\s*,/ig,f=/:(?:(?:\d|true):)*/g;return function(g){if(!o.isEmpty(g)){var h;return b.test(g)?g+=":1":a.test(g)&&(g=g.split(c),g[0]=g[0].replace(d,",$1:1").replace(e,"$1:1,").replace(f,":"),g=g.join(",messages:")),g.charAt(0)!="{"&&(g="{"+g+"}"),h=o.parse(g),h.rules||(h={rules:h}),h}}}(),parseAttr5:function(a){if(!o.isBoolean(a.required)){var c={};o.each("required min max pattern".split(" "),function(d){var e=p.attr(a,d);e!=b&&e!=null&&(c[d]=o.isNumeric(e)?parseFloat(e):e||1)});if(!o.isEmptyObject(c))return{rules:c}}},ruleToAttr:function(a,b){var c=b.maxlength||b.rangelength;c&&(a.maxLength==-1||a.maxLength==2147483647)&&(o.isArray(c)&&(c=c[1]),a.maxLength=c)}}),o.extend(!0,u,t,{defaults:{ruleKey:"name",ruleAttr:"data-val",validCls:"valid",errorCls:"error",activeElCls:"fld-active",errorElCls:"fld-error",validElCls:"fld-valid",errorElement:"label",interceptInput:!0,interceptSubmit:!0,focusInvalid:!0,submitRandom:!0,highlight:function(a){this.elementCls(a,this.settings.errorElCls,this.settings.validElCls)},unhighlight:function(a){this.elementCls(a,this.settings.validElCls,this.settings.errorElCls)},labelText:function(a,b){a.innerHTML=b},showErrors:function(){this.errors.each(this.showLabel,this),this.valids.each(this.showLabel,this)},findLabel:u.findNext,appendLabel:u.appendNext},setDefaults:function(a){o.extend(u.defaults,a)}}),o.extend(!0,u.prototype,t.prototype,{initForm:function(a){this.time=+(new Date),this.uuid=0,this.uukey="fancy_expando",this.attrMap={},o.each(this.form.elements,this.parseRule,this),this.elements().length?(this.hideErrors(),this.reset(),this.bindEvents()):this.debug("no elements want to validate")},getKey:function(a){var b=this.settings,c=b.ruleKeyAlter,d=b.getKey;return c&&p.attr(a,c)||d&&d.call(this,a)||p.attr(a,b.ruleKey)},getValue:function(a){return a.value},getLen:function(a,b){var c=0,d=this.attr(b);return d.checkable||d.multisel?(o.each(d.chklist||b,function(a){(a.checked||a.selected)&&c++}),c):o.trim(a).length},getElement:function(a){return this.form[a]||p.get(a)||$f.getListByKey.call(this,a)[0]},debug:function(){this.settings.debug&&p.log.apply(null,arguments)},checkForm:function(){var a=this.checkAll();return this.showErrors(),a},parseRule:function(a){var b=this.getKey(a),c=this.settings,d=o.trim(p.attr(a,c.ruleAttr));if(b&&this.register(a,u.parseAttr5(a),u.parseAttr(d))){u.ruleToAttr(a,c.rules[b]);var e=this.attr(a);if(!e){var f=a[this.uukey]=b+this.uuid++;e=this.attrMap[f]={expando:f,key:b},this.defineAttr(a,e)}if(e.checkable&&a!=e.lastchk){var g=o.inArray(this.elements(),a);g>-1&&o.remove(this.elements(),g)}}},defineAttr:function(a,b){b.checkable=p.isIradio(a)||p.isIcheckbox(a),b.multisel=p.isselect(a)&&a.multiple===!0;if(b.checkable){var c=[],d=this.settings,e=this.uukey,f=d.getList&&d.getList.call(this,a)||this.getElement(a.name);f.length||(f=[f]),o.each(f,function(a){if(!a[e]||a[e]==b.expando)c.push(a),p.attr(a,d.ruleKey)||p.attr(a,d.ruleKey,b.key),a[e]=b.expando}),b.chklist=c,b.lastchk=c[c.length-1]}},attr:function(a){return this.attrMap[a[this.uukey]]},bindEvents:function(){this.settings.interceptInput&&o.each("focusin focusout input keyup click".split(" "),function(a){q.add(this.form,a,this.onInput())},this),this.settings.interceptSubmit&&q.add(this.form,"submit",this.onSubmit())},onInput:function(){var a=this,b=this.settings;return function(c){var d,e,f,g=q.fix(c),h=g.target;p.isoption(h)&&(h=h.parentNode),f=a.attr(h);if(f&&b.rules[f.key]){g.type=="focusin"||g.type=="focus"?p.addClass(h,b.activeElCls):(g.type=="focusout"||g.type=="blur")&&p.removeClass(h,b.activeElCls),d=a.getValue(h),e=a.getLen(d,h);if(f.prevVal!=d||f.prevLen!=e){f.prevVal=d,f.prevLen=e,f.checkable&&(h=f.lastchk);var i=a.errors.findEntry(h)||a.valids.findEntry(h);i&&a.hideLabel(i),a.check(h)===!0&&b.autoTab&&a.focusNext(h);var j=a.errors.findEntry(h)||a.valids.findEntry(h);j&&a.showLabel(j)}}}},onSubmit:function(){var a=this,b=this.settings;return function(c){var d=q.fix(c);if(!a.checkForm())return d.stop(),b.focusInvalid&&p.focus(a.errors.first()),!1;b.submitRandom&&a.addRandom();if(b.submitHandler)return d.stop(),b.submitHandler.call(a,a.form),!1}},addRandom:function(){var a=this;o.each({e:this.elements().length,d:+(new Date),t:this.time,r:Math.random()},function(b,d){var e=(a.getKey(this)||this.id)+"_"+d,f=a.getElement(e);f||(f=c.createElement("input"),f.type="hidden",this.insertBefore(f,this.firstChild)),f.name=e,f.value=b},this.form)},focusNext:function(a){var b=this.elements(),c=b.length,d=o.inArray(b,a)+1;d>0&&d<c&&p.focus(b[d])},showErrors:function(){this.settings.showErrors.call(this)},showLabel:function(a){var b=this.errorsFor(a.key),c=this.settings;p.removeClass(b,c.validCls),p.addClass(b,c.errorCls),c.labelText.call(this,b,a.message),(a.message||c.validCls)&&p.toggle(b,!0),a.message?c.highlight.call(this,a.key):(c.unhighlight.call(this,a.key),p.addClass(b,c.validCls))},hideLabel:function(a){p.toggle(this.errorsFor(a.key))},hideErrors:function(){var a=this;o.each(this.elements(),function(b){p.toggle(a.errorsFor(b),!1)})},elementCls:function(a,b,c){var d=this.attr(a);d.checkable?o.each(d.chklist,function(a){p.removeClass(a,c),p.addClass(a,b)}):(p.removeClass(a,c),p.addClass(a,b))},errorsFor:function(a){var b=this.attr(a),d=b.errLabel;if(!d){var e=this.settings,f=a.id||b.key,g=this.uukey+"_for";d=e.findLabel.call(this,a,f);if(!d||d[g]&&d[g]!=expando)d=c.createElement(e.errorElement),p.attr(d,"for",f),p.attr(d,"fancy",f),e.appendLabel.call(this,d,a),b.errLabel=d,d[g]=b.expando}return d},isErrLabel:function(a,b){return p.attr(a,"for")==b&&p.attr(a,"fancy")==b}}),u.base=t,a.fancy=a.$f=u})(window);
{'fraction_non_alphanumeric': 0.27645847632120796, 'fraction_numerical': 0.019794097460535346, 'mean_word_length': 14.487244897959183, 'pattern_counts': {'":': 12, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2716657', 'n_tokens_mistral': 15903, 'n_tokens_neox': 15788, 'n_words': 596}