forked from vitmalina/w2ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathw2ui-fields.min.js
5 lines (5 loc) · 121 KB
/
w2ui-fields.min.js
1
2
3
4
5
/* w2ui-fields.js 1.5.x (nightly), part of w2ui (c) http://w2ui.com, [email protected] */
var w2ui=w2ui||{},w2obj=w2obj||{},w2utils=function(a){function b(a){var b=/^[0-1]+$/;return b.test(a)}function c(a){var b=/^[-+]?[0-9]+$/;return b.test(a)}function d(a){return"string"==typeof a&&(a=a.replace(/\s+/g,"").replace(w2utils.settings.groupSymbol,"").replace(w2utils.settings.decimalSymbol,".")),("number"==typeof a||"string"==typeof a&&""!==a)&&!isNaN(Number(a))}function e(a){var b=w2utils.settings,c=new RegExp("^"+(b.currencyPrefix?"\\"+b.currencyPrefix+"?":"")+"[-+]?"+(b.currencyPrefix?"\\"+b.currencyPrefix+"?":"")+"[0-9]*[\\"+b.decimalSymbol+"]?[0-9]+"+(b.currencySuffix?"\\"+b.currencySuffix+"?":"")+"$","i");return"string"==typeof a&&(a=a.replace(new RegExp(b.groupSymbol,"g"),"")),"object"!=typeof a&&""!==a&&c.test(a)}function f(a){var b=/^[a-fA-F0-9]+$/;return b.test(a)}function g(a){var b=/^[a-zA-Z0-9_-]+$/;return b.test(a)}function h(a){var b=/^[a-zA-Z0-9._%-+]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return b.test(a)}function i(a,b,d){if(!a)return!1;var e,f,g,h="Invalid Date";if(null==b&&(b=w2utils.settings.dateFormat),"function"==typeof a.getUTCFullYear)g=a.getUTCFullYear(),e=a.getUTCMonth()+1,f=a.getUTCDate();else if(parseInt(a)==a&&parseInt(a)>0)a=new Date(parseInt(a)),g=a.getUTCFullYear(),e=a.getUTCMonth()+1,f=a.getUTCDate();else{if(a=String(a),new RegExp("mon","ig").test(b)){b=b.replace(/month/gi,"m").replace(/mon/gi,"m").replace(/dd/gi,"d").replace(/[, ]/gi,"/").replace(/\/\//g,"/").toLowerCase(),a=a.replace(/[, ]/gi,"/").replace(/\/\//g,"/").toLowerCase();for(var i=0,j=w2utils.settings.fullmonths.length;i<j;i++){var k=w2utils.settings.fullmonths[i];a=a.replace(new RegExp(k,"ig"),parseInt(i)+1).replace(new RegExp(k.substr(0,3),"ig"),parseInt(i)+1)}}var l=a.replace(/-/g,"/").replace(/\./g,"/").toLowerCase().split("/"),m=b.replace(/-/g,"/").replace(/\./g,"/").toLowerCase();"mm/dd/yyyy"===m&&(e=l[0],f=l[1],g=l[2]),"m/d/yyyy"===m&&(e=l[0],f=l[1],g=l[2]),"dd/mm/yyyy"===m&&(e=l[1],f=l[0],g=l[2]),"d/m/yyyy"===m&&(e=l[1],f=l[0],g=l[2]),"yyyy/dd/mm"===m&&(e=l[2],f=l[1],g=l[0]),"yyyy/d/m"===m&&(e=l[2],f=l[1],g=l[0]),"yyyy/mm/dd"===m&&(e=l[1],f=l[2],g=l[0]),"yyyy/m/d"===m&&(e=l[1],f=l[2],g=l[0]),"mm/dd/yy"===m&&(e=l[0],f=l[1],g=l[2]),"m/d/yy"===m&&(e=l[0],f=l[1],g=parseInt(l[2])+1900),"dd/mm/yy"===m&&(e=l[1],f=l[0],g=parseInt(l[2])+1900),"d/m/yy"===m&&(e=l[1],f=l[0],g=parseInt(l[2])+1900),"yy/dd/mm"===m&&(e=l[2],f=l[1],g=parseInt(l[0])+1900),"yy/d/m"===m&&(e=l[2],f=l[1],g=parseInt(l[0])+1900),"yy/mm/dd"===m&&(e=l[1],f=l[2],g=parseInt(l[0])+1900),"yy/m/d"===m&&(e=l[1],f=l[2],g=parseInt(l[0])+1900)}return!!c(g)&&(!!c(e)&&(!!c(f)&&(g=+g,e=+e,f=+f,h=new Date(g,e-1,f),null!=e&&("Invalid Date"!=String(h)&&(h.getMonth()+1===e&&h.getDate()===f&&h.getFullYear()===g&&(d!==!0||h))))))}function j(b,c){if(null==b)return!1;var d,e,f;b=String(b),b=b.toUpperCase(),e=b.indexOf("AM")>=0,f=b.indexOf("PM")>=0;var g=f||e;d=g?12:24,b=b.replace("AM","").replace("PM",""),b=a.trim(b);var h=b.split(":"),i=parseInt(h[0]||0),j=parseInt(h[1]||0),k=parseInt(h[2]||0);return!!(g&&1===h.length||2===h.length||3===h.length)&&(!(""===h[0]||i<0||i>d||!this.isInt(h[0])||h[0].length>2)&&(!(h.length>1&&(""===h[1]||j<0||j>59||!this.isInt(h[1])||2!==h[1].length))&&(!(h.length>2&&(""===h[2]||k<0||k>59||!this.isInt(h[2])||2!==h[2].length))&&(!!(g||d!==i||0===j&&0===k)&&((!g||1!==h.length||0!==i)&&(c!==!0||(f&&12!==i&&(i+=12),e&&12===i&&(i+=12),{hours:i,minutes:j,seconds:k})))))))}function k(a,b,c){null==b&&(b=w2utils.settings.datetimeFormat);var d=b.split("|");if("function"==typeof a.getUTCFullYear)return c!==!0||a;if(parseInt(a)==a&&parseInt(a)>0)return a=new Date(parseInt(a)),c!==!0||a;var e=String(a).indexOf(" "),f=[a.substr(0,e),a.substr(e).trim()];d[0]=d[0].trim(),d[1]&&(d[1]=d[1].trim());var g=w2utils.isDate(f[0],d[0],!0),h=w2utils.isTime(f[1],!0);return g!==!1&&h!==!1&&(c!==!0||(g.setHours(h.hours),g.setMinutes(h.minutes),g.setSeconds(h.seconds),g))}function l(a){var b;if(""===a||null==a)return"";if(b="function"==typeof a.getUTCFullYear?a:parseInt(a)==a&&parseInt(a)>0?new Date(parseInt(a)):new Date(a),"Invalid Date"==String(b))return"";var c=new Date,d=(c.getTime()-b.getTime())/1e3,e="",f="";return d<0?(e=0,f="sec"):d<60?(e=Math.floor(d),f="sec",d<0&&(e=0,f="sec")):d<3600?(e=Math.floor(d/60),f="min"):d<86400?(e=Math.floor(d/60/60),f="hour"):d<2592e3?(e=Math.floor(d/24/60/60),f="day"):d<31536e3?(e=Math.floor(d/30/24/60/60*10)/10,f="month"):d<126144e3?(e=Math.floor(d/365/24/60/60*10)/10,f="year"):d>=126144e3&&(e=Math.floor(d/365.25/24/60/60*10)/10,f="year"),e+" "+f+(e>1?"s":"")}function m(a){var b="";return b=a<1e3?"< 1 sec":a<6e4?Math.floor(a/1e3)+" secs":a<36e5?Math.floor(a/6e4)+" mins":a<864e5?Math.floor(a/36e5*10)/10+" hours":a<2628e6?Math.floor(a/864e5*10)/10+" days":a<31536e6?Math.floor(a/2628e6*10)/10+" months":Math.floor(a/31536e5)/10+" years"}function n(a){if(""===a||null==a||"object"==typeof a&&!a.getMonth)return"";var b=new Date(a);if(w2utils.isInt(a)&&(b=new Date(Number(a))),"Invalid Date"==String(b))return"";var c=w2utils.settings.shortmonths,d=new Date,e=new Date;e.setTime(e.getTime()-864e5);var f=c[b.getMonth()]+" "+b.getDate()+", "+b.getFullYear(),g=c[d.getMonth()]+" "+d.getDate()+", "+d.getFullYear(),h=c[e.getMonth()]+" "+e.getDate()+", "+e.getFullYear(),i=b.getHours()-(b.getHours()>12?12:0)+":"+(b.getMinutes()<10?"0":"")+b.getMinutes()+" "+(b.getHours()>=12?"pm":"am"),j=b.getHours()-(b.getHours()>12?12:0)+":"+(b.getMinutes()<10?"0":"")+b.getMinutes()+":"+(b.getSeconds()<10?"0":"")+b.getSeconds()+" "+(b.getHours()>=12?"pm":"am"),k=f;return f===g&&(k=i),f===h&&(k=w2utils.lang("Yesterday")),'<span title="'+f+" "+j+'">'+k+"</span>"}function o(a){if(!w2utils.isFloat(a)||""===a)return"";if(a=parseFloat(a),0===a)return 0;var b=["Bt","KB","MB","GB","TB","PB","EB","ZB"],c=parseInt(Math.floor(Math.log(a)/Math.log(1024)));return(Math.floor(a/Math.pow(1024,c)*10)/10).toFixed(0===c?0:1)+" "+(b[c]||"??")}function p(a,b,c){if(null==a||""===a||"object"==typeof a)return"";var d={minimumFractionDigits:b,maximumFractionDigits:b,useGrouping:c};return(null==b||b<0)&&(d.minimumFractionDigits=0,d.maximumFractionDigits=20),parseFloat(a).toLocaleString(w2utils.settings.locale,d)}function q(a,b){if(b||(b=this.settings.dateFormat),""===a||null==a||"object"==typeof a&&!a.getMonth)return"";var c=new Date(a);if(w2utils.isInt(a)&&(c=new Date(Number(a))),"Invalid Date"==String(c))return"";var d=c.getFullYear(),e=c.getMonth(),f=c.getDate();return b.toLowerCase().replace("month",w2utils.settings.fullmonths[e]).replace("mon",w2utils.settings.shortmonths[e]).replace(/yyyy/g,d).replace(/yyy/g,d).replace(/yy/g,d>2e3?100+parseInt(String(d).substr(2)):String(d).substr(2)).replace(/(^|[^a-z$])y/g,"$1"+d).replace(/mm/g,(e+1<10?"0":"")+(e+1)).replace(/dd/g,(f<10?"0":"")+f).replace(/th/g,1==f?"st":"th").replace(/th/g,2==f?"nd":"th").replace(/th/g,3==f?"rd":"th").replace(/(^|[^a-z$])m/g,"$1"+(e+1)).replace(/(^|[^a-z$])d/g,"$1"+f)}function r(a,b){w2utils.settings.shortmonths,w2utils.settings.fullmonths;if(b||(b=this.settings.timeFormat),""===a||null==a||"object"==typeof a&&!a.getMonth)return"";var c=new Date(a);if(w2utils.isInt(a)&&(c=new Date(Number(a))),w2utils.isTime(a)){var d=w2utils.isTime(a,!0);c=new Date,c.setHours(d.hours),c.setMinutes(d.minutes)}if("Invalid Date"==String(c))return"";var e="am",f=c.getHours(),g=c.getHours(),h=c.getMinutes(),i=c.getSeconds();return h<10&&(h="0"+h),i<10&&(i="0"+i),b.indexOf("am")===-1&&b.indexOf("pm")===-1||(f>=12&&(e="pm"),f>12&&(f-=12)),b.toLowerCase().replace("am",e).replace("pm",e).replace("hhh",f<10?"0"+f:f).replace("hh24",g<10?"0"+g:g).replace("h24",g).replace("hh",f).replace("mm",h).replace("mi",h).replace("ss",i).replace(/(^|[^a-z$])h/g,"$1"+f).replace(/(^|[^a-z$])m/g,"$1"+h).replace(/(^|[^a-z$])s/g,"$1"+i)}function s(a,b){var c;return""===a||null==a||"object"==typeof a&&!a.getMonth?"":("string"!=typeof b?c=[this.settings.dateFormat,this.settings.timeFormat]:(c=b.split("|"),c[0]=c[0].trim(),c[1]=c.length>1?c[1].trim():this.settings.timeFormat),"h12"==c[1]&&(c[1]="h:m pm"),"h24"==c[1]&&(c[1]="h24:m"),this.formatDate(a,c[0])+" "+this.formatTime(a,c[1]))}function t(b){if(null==b)return b;switch(typeof b){case"number":break;case"string":b=String(b).replace(/(<([^>]+)>)/gi,"");break;case"object":if(Array.isArray(b)){b=a.extend(!0,[],b);for(var c=0;c<b.length;c++)b[c]=this.stripTags(b[c])}else{b=a.extend(!0,{},b);for(var c in b)b[c]=this.stripTags(b[c])}}return b}function u(b){if(null==b)return b;switch(typeof b){case"number":break;case"string":b=String(b).replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""");break;case"object":if(Array.isArray(b)){b=a.extend(!0,[],b);for(var c=0;c<b.length;c++)b[c]=this.encodeTags(b[c])}else{b=a.extend(!0,{},b);for(var c in b)b[c]=this.encodeTags(b[c])}}return b}function v(b){if(null==b)return b;switch(typeof b){case"number":break;case"string":b=String(b).replace(/>/g,">").replace(/</g,"<").replace(/"/g,'"').replace(/&/g,"&");break;case"object":if(Array.isArray(b)){b=a.extend(!0,[],b);for(var c=0;c<b.length;c++)b[c]=this.decodeTags(b[c])}else{b=a.extend(!0,{},b);for(var c in b)b[c]=this.decodeTags(b[c])}}return b}function w(a){return""===a||null==a?"":String(a).replace(/([;&,\.\+\*\~'`:"\!\^#$%@\[\]\(\)=<>\|\/? {}\\])/g,"\\$1")}function x(a){function b(a){a=String(a).replace(/\r\n/g,"\n");for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);d<128?b+=String.fromCharCode(d):d>127&&d<2048?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b}var c,d,e,f,g,h,i,j="",k=0,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";for(a=b(a);k<a.length;)c=a.charCodeAt(k++),d=a.charCodeAt(k++),e=a.charCodeAt(k++),f=c>>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?h=i=64:isNaN(e)&&(i=64),j=j+l.charAt(f)+l.charAt(g)+l.charAt(h)+l.charAt(i);return j}function y(a){function b(a){for(var b,c,d="",e=0,f=0;e<a.length;)f=a.charCodeAt(e),f<128?(d+=String.fromCharCode(f),e++):f>191&&f<224?(b=a.charCodeAt(e+1),d+=String.fromCharCode((31&f)<<6|63&b),e+=2):(b=a.charCodeAt(e+1),c=a.charCodeAt(e+2),d+=String.fromCharCode((15&f)<<12|(63&b)<<6|63&c),e+=3);return d}var c,d,e,f,g,h,i,j="",k=0,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");k<a.length;)f=l.indexOf(a.charAt(k++)),g=l.indexOf(a.charAt(k++)),h=l.indexOf(a.charAt(k++)),i=l.indexOf(a.charAt(k++)),c=f<<2|g>>4,d=(15&g)<<4|h>>2,e=(3&h)<<6|i,j+=String.fromCharCode(c),64!==h&&(j+=String.fromCharCode(d)),64!==i&&(j+=String.fromCharCode(e));return j=b(j)}function z(a){function b(a){return d(c(e(a)))}function c(a){return g(h(f(a),8*a.length))}function d(a){try{}catch(a){p=0}for(var b,c=p?"0123456789ABCDEF":"0123456789abcdef",d="",e=0;e<a.length;e++)b=a.charCodeAt(e),d+=c.charAt(b>>>4&15)+c.charAt(15&b);return d}function e(a){for(var b,c,d="",e=-1;++e<a.length;)b=a.charCodeAt(e),c=e+1<a.length?a.charCodeAt(e+1):0,55296<=b&&b<=56319&&56320<=c&&c<=57343&&(b=65536+((1023&b)<<10)+(1023&c),e++),b<=127?d+=String.fromCharCode(b):b<=2047?d+=String.fromCharCode(192|b>>>6&31,128|63&b):b<=65535?d+=String.fromCharCode(224|b>>>12&15,128|b>>>6&63,128|63&b):b<=2097151&&(d+=String.fromCharCode(240|b>>>18&7,128|b>>>12&63,128|b>>>6&63,128|63&b));return d}function f(a){for(var b=Array(a.length>>2),c=0;c<b.length;c++)b[c]=0;for(var c=0;c<8*a.length;c+=8)b[c>>5]|=(255&a.charCodeAt(c/8))<<c%32;return b}function g(a){for(var b="",c=0;c<32*a.length;c+=8)b+=String.fromCharCode(a[c>>5]>>>c%32&255);return b}function h(a,b){a[b>>5]|=128<<b%32,a[(b+64>>>9<<4)+14]=b;for(var c=1732584193,d=-271733879,e=-1732584194,f=271733878,g=0;g<a.length;g+=16){var h=c,i=d,o=e,p=f;c=j(c,d,e,f,a[g+0],7,-680876936),f=j(f,c,d,e,a[g+1],12,-389564586),e=j(e,f,c,d,a[g+2],17,606105819),d=j(d,e,f,c,a[g+3],22,-1044525330),c=j(c,d,e,f,a[g+4],7,-176418897),f=j(f,c,d,e,a[g+5],12,1200080426),e=j(e,f,c,d,a[g+6],17,-1473231341),d=j(d,e,f,c,a[g+7],22,-45705983),c=j(c,d,e,f,a[g+8],7,1770035416),f=j(f,c,d,e,a[g+9],12,-1958414417),e=j(e,f,c,d,a[g+10],17,-42063),d=j(d,e,f,c,a[g+11],22,-1990404162),c=j(c,d,e,f,a[g+12],7,1804603682),f=j(f,c,d,e,a[g+13],12,-40341101),e=j(e,f,c,d,a[g+14],17,-1502002290),d=j(d,e,f,c,a[g+15],22,1236535329),c=k(c,d,e,f,a[g+1],5,-165796510),f=k(f,c,d,e,a[g+6],9,-1069501632),e=k(e,f,c,d,a[g+11],14,643717713),d=k(d,e,f,c,a[g+0],20,-373897302),c=k(c,d,e,f,a[g+5],5,-701558691),f=k(f,c,d,e,a[g+10],9,38016083),e=k(e,f,c,d,a[g+15],14,-660478335),d=k(d,e,f,c,a[g+4],20,-405537848),c=k(c,d,e,f,a[g+9],5,568446438),f=k(f,c,d,e,a[g+14],9,-1019803690),e=k(e,f,c,d,a[g+3],14,-187363961),d=k(d,e,f,c,a[g+8],20,1163531501),c=k(c,d,e,f,a[g+13],5,-1444681467),f=k(f,c,d,e,a[g+2],9,-51403784),e=k(e,f,c,d,a[g+7],14,1735328473),d=k(d,e,f,c,a[g+12],20,-1926607734),c=l(c,d,e,f,a[g+5],4,-378558),f=l(f,c,d,e,a[g+8],11,-2022574463),e=l(e,f,c,d,a[g+11],16,1839030562),d=l(d,e,f,c,a[g+14],23,-35309556),c=l(c,d,e,f,a[g+1],4,-1530992060),f=l(f,c,d,e,a[g+4],11,1272893353),e=l(e,f,c,d,a[g+7],16,-155497632),d=l(d,e,f,c,a[g+10],23,-1094730640),c=l(c,d,e,f,a[g+13],4,681279174),f=l(f,c,d,e,a[g+0],11,-358537222),e=l(e,f,c,d,a[g+3],16,-722521979),d=l(d,e,f,c,a[g+6],23,76029189),c=l(c,d,e,f,a[g+9],4,-640364487),f=l(f,c,d,e,a[g+12],11,-421815835),e=l(e,f,c,d,a[g+15],16,530742520),d=l(d,e,f,c,a[g+2],23,-995338651),c=m(c,d,e,f,a[g+0],6,-198630844),f=m(f,c,d,e,a[g+7],10,1126891415),e=m(e,f,c,d,a[g+14],15,-1416354905),d=m(d,e,f,c,a[g+5],21,-57434055),c=m(c,d,e,f,a[g+12],6,1700485571),f=m(f,c,d,e,a[g+3],10,-1894986606),e=m(e,f,c,d,a[g+10],15,-1051523),d=m(d,e,f,c,a[g+1],21,-2054922799),c=m(c,d,e,f,a[g+8],6,1873313359),f=m(f,c,d,e,a[g+15],10,-30611744),e=m(e,f,c,d,a[g+6],15,-1560198380),d=m(d,e,f,c,a[g+13],21,1309151649),c=m(c,d,e,f,a[g+4],6,-145523070),f=m(f,c,d,e,a[g+11],10,-1120210379),e=m(e,f,c,d,a[g+2],15,718787259),d=m(d,e,f,c,a[g+9],21,-343485551),c=n(c,h),d=n(d,i),e=n(e,o),f=n(f,p)}return Array(c,d,e,f)}function i(a,b,c,d,e,f){return n(o(n(n(b,a),n(d,f)),e),c)}function j(a,b,c,d,e,f,g){return i(b&c|~b&d,a,b,e,f,g)}function k(a,b,c,d,e,f,g){return i(b&d|c&~d,a,b,e,f,g)}function l(a,b,c,d,e,f,g){return i(b^c^d,a,b,e,f,g)}function m(a,b,c,d,e,f,g){return i(c^(b|~d),a,b,e,f,g)}function n(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}function o(a,b){return a<<b|a>>>32-b}var p=0;return b(a)}function A(b,c,d,e){var f=a(b).width(),g=a(b).height(),h=.5;if(!b||!c)return void console.log("ERROR: Cannot do transition when one of the divs is null");switch(b.parentNode.style.cssText+="perspective: 900px; overflow: hidden;",b.style.cssText+="; position: absolute; z-index: 1019; backface-visibility: hidden",c.style.cssText+="; position: absolute; z-index: 1020; backface-visibility: hidden",d){case"slide-left":b.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",c.style.cssText+="overflow: hidden; transform: translate3d("+f+"px, 0, 0)",a(c).show(),window.setTimeout(function(){c.style.cssText+="transition: "+h+"s; transform: translate3d(0, 0, 0)",b.style.cssText+="transition: "+h+"s; transform: translate3d(-"+f+"px, 0, 0)"},1);break;case"slide-right":b.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",c.style.cssText+="overflow: hidden; transform: translate3d(-"+f+"px, 0, 0)",a(c).show(),window.setTimeout(function(){c.style.cssText+="transition: "+h+"s; transform: translate3d(0px, 0, 0)",b.style.cssText+="transition: "+h+"s; transform: translate3d("+f+"px, 0, 0)"},1);break;case"slide-down":b.style.cssText+="overflow: hidden; z-index: 1; transform: translate3d(0, 0, 0)",c.style.cssText+="overflow: hidden; z-index: 0; transform: translate3d(0, 0, 0)",a(c).show(),window.setTimeout(function(){c.style.cssText+="transition: "+h+"s; transform: translate3d(0, 0, 0)",b.style.cssText+="transition: "+h+"s; transform: translate3d(0, "+g+"px, 0)"},1);break;case"slide-up":b.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",c.style.cssText+="overflow: hidden; transform: translate3d(0, "+g+"px, 0)",a(c).show(),window.setTimeout(function(){c.style.cssText+="transition: "+h+"s; transform: translate3d(0, 0, 0)",b.style.cssText+="transition: "+h+"s; transform: translate3d(0, 0, 0)"},1);break;case"flip-left":b.style.cssText+="overflow: hidden; transform: rotateY(0deg)",c.style.cssText+="overflow: hidden; transform: rotateY(-180deg)",a(c).show(),window.setTimeout(function(){c.style.cssText+="transition: "+h+"s; transform: rotateY(0deg)",b.style.cssText+="transition: "+h+"s; transform: rotateY(180deg)"},1);break;case"flip-right":b.style.cssText+="overflow: hidden; transform: rotateY(0deg)",c.style.cssText+="overflow: hidden; transform: rotateY(180deg)",a(c).show(),window.setTimeout(function(){c.style.cssText+="transition: "+h+"s; transform: rotateY(0deg)",b.style.cssText+="transition: "+h+"s; transform: rotateY(-180deg)"},1);break;case"flip-down":b.style.cssText+="overflow: hidden; transform: rotateX(0deg)",c.style.cssText+="overflow: hidden; transform: rotateX(180deg)",a(c).show(),window.setTimeout(function(){c.style.cssText+="transition: "+h+"s; transform: rotateX(0deg)",b.style.cssText+="transition: "+h+"s; transform: rotateX(-180deg)"},1);break;case"flip-up":b.style.cssText+="overflow: hidden; transform: rotateX(0deg)",c.style.cssText+="overflow: hidden; transform: rotateX(-180deg)",a(c).show(),window.setTimeout(function(){c.style.cssText+="transition: "+h+"s; transform: rotateX(0deg)",b.style.cssText+="transition: "+h+"s; transform: rotateX(180deg)"},1);break;case"pop-in":b.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",c.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(.8); opacity: 0;",a(c).show(),window.setTimeout(function(){c.style.cssText+="transition: "+h+"s; transform: scale(1); opacity: 1;",b.style.cssText+="transition: "+h+"s;"},1);break;case"pop-out":b.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(1); opacity: 1;",c.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); opacity: 0;",a(c).show(),window.setTimeout(function(){c.style.cssText+="transition: "+h+"s; opacity: 1;",b.style.cssText+="transition: "+h+"s; transform: scale(1.7); opacity: 0;"},1);break;default:b.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",c.style.cssText+="overflow: hidden; translate3d(0, 0, 0); opacity: 0;",a(c).show(),window.setTimeout(function(){c.style.cssText+="transition: "+h+"s; opacity: 1;",b.style.cssText+="transition: "+h+"s"},1)}setTimeout(function(){"slide-down"===d&&(a(b).css("z-index","1019"),a(c).css("z-index","1020")),c&&a(c).css({opacity:"1"}).css(w2utils.cssPrefix({transition:"",transform:""})),b&&a(b).css({opacity:"1"}).css(w2utils.cssPrefix({transition:"",transform:""})),"function"==typeof e&&e()},1e3*h)}function B(b,c,d){var e={};"object"==typeof c?e=c:(e.msg=c,e.spinner=d),e.msg||0===e.msg||(e.msg=""),w2utils.unlock(b),a(b).prepend('<div class="w2ui-lock"></div><div class="w2ui-lock-msg"></div>');var f=a(b).find(".w2ui-lock"),g=a(b).find(".w2ui-lock-msg");e.msg||g.css({"background-color":"transparent",border:"0px"}),e.spinner===!0&&(e.msg='<div class="w2ui-spinner" '+(e.msg?"":'style="width: 35px; height: 35px"')+"></div>"+e.msg),null!=e.opacity&&f.css("opacity",e.opacity),"function"==typeof f.fadeIn?(f.fadeIn(200),g.html(e.msg).fadeIn(200)):(f.show(),g.html(e.msg).show(0))}function C(b,d){c(d)?(a(b).find(".w2ui-lock").fadeOut(d),setTimeout(function(){a(b).find(".w2ui-lock").remove(),a(b).find(".w2ui-lock-msg").remove()},d)):(a(b).find(".w2ui-lock").remove(),a(b).find(".w2ui-lock-msg").remove())}function D(b,c){function d(c,d){if(null==f&&(f=d.trigger({phase:"before",type:"open",target:"self"}),f.isCancelled===!0))return l.css("z-index",l.data("old-z-index")),void a(b.box).find("#w2ui-message"+n).remove();var e=c.data("prev_focus");c.remove(),e&&e.length>0?e.focus():g&&g.focus&&g.focus(),l.css("z-index",l.data("old-z-index")),d.trigger(a.extend(f,{phase:"after"}))}var e,f,g=this;a().w2tag(),c||(c={width:200,height:100}),null==c.on&&a.extend(c,w2utils.event),null==c.width&&(c.width=200),null==c.height&&(c.height=100);var h=parseInt(a(b.box).width()),i=parseInt(a(b.box).height()),j=parseInt(a(b.box).find(b.title).css("height")||0);c.width>h&&(c.width=h-10),c.height>i-j&&(c.height=i-10-j),c.originalWidth=c.width,c.originalHeight=c.height,parseInt(c.width)<0&&(c.width=h+c.width),parseInt(c.width)<10&&(c.width=10),parseInt(c.height)<0&&(c.height=i+c.height-j),parseInt(c.height)<10&&(c.height=10),null==c.hideOnClick&&(c.hideOnClick=!1);var k=a(b.box).data("options")||{};(null==c.width||c.width>k.width-10)&&(c.width=k.width-10),(null==c.height||c.height>k.height-j-5)&&(c.height=k.height-j-5),c.originalHeight<0&&(c.height=i+c.originalHeight-j),c.originalWidth<0&&(c.width=h+2*c.originalWidth);var l=a(b.box).find(b.title),m=a(b.box).find(".w2ui-message.w2ui-closing");a(b.box).find(".w2ui-message.w2ui-closing").length>0&&(clearTimeout(e),d(m,m.data("options")||{}));var n=a(b.box).find(".w2ui-message").length;if(""===a.trim(c.html)&&""===a.trim(c.body)&&""===a.trim(c.buttons)){if(0===n)return;var o=a(b.box).find("#w2ui-message"+(n-1)),c=o.data("options")||{};if(f=c.trigger({phase:"before",type:"close",target:"self"}),f.isCancelled===!0)return;o.css(w2utils.cssPrefix({transition:"0.15s",transform:"translateY(-"+c.height+"px)"})).addClass("w2ui-closing"),1==n?this.unlock&&(b.param?this.unlock(b.param,150):this.unlock(150)):a(b.box).find("#w2ui-message"+(n-2)).css("z-index",1500),e=setTimeout(function(){d(o,c)},150)}else{""===a.trim(c.body)&&""===a.trim(c.buttons)||(c.html='<div class="w2ui-message-body">'+(c.body||"")+'</div><div class="w2ui-message-buttons">'+(c.buttons||"")+"</div>"),a(b.box).find(".w2ui-message").css("z-index",1390),l.data("old-z-index",l.css("z-index")),l.css("z-index",1501),a(b.box).find(b.body).before('<div id="w2ui-message'+n+'" onmousedown="event.stopPropagation();" class="w2ui-message" style="display: none; z-index: 1500; '+(0===l.length?"top: 0px;":"top: "+w2utils.getSize(l,"height")+"px;")+(null!=c.width?"width: "+c.width+"px; left: "+(h-c.width)/2+"px;":"left: 10px; right: 10px;")+(null!=c.height?"height: "+c.height+"px;":"bottom: 6px;")+w2utils.cssPrefix("transition",".3s",!0)+'"'+(c.hideOnClick===!0?b.param?'onclick="'+b.path+".message('"+b.param+"');\"":'onclick="'+b.path+'.message();"':"")+"></div>"),a(b.box).find("#w2ui-message"+n).data("options",c).data("prev_focus",a(":focus"));var p=a(b.box).find("#w2ui-message"+n).css("display");if(a(b.box).find("#w2ui-message"+n).css(w2utils.cssPrefix({transform:"none"==p?"translateY(-"+c.height+"px)":"translateY(0px)"})),"none"==p){if(a(b.box).find("#w2ui-message"+n).show().html(c.html),c.box=a(b.box).find("#w2ui-message"+n),f=c.trigger({phase:"before",type:"open",target:"self"}),f.isCancelled===!0)return l.css("z-index",l.data("old-z-index")),void a(b.box).find("#w2ui-message"+n).remove();setTimeout(function(){a(b.box).find("#w2ui-message"+n).css(w2utils.cssPrefix({transform:"none"==p?"translateY(0px)":"translateY(-"+c.height+"px)"}))},1),0===n&&this.lock&&(b.param?this.lock(b.param):this.lock()),setTimeout(function(){a(b.box).find("#w2ui-message"+n).css(w2utils.cssPrefix({transition:"0s"})),c.trigger(a.extend(f,{phase:"after"}))},350)}}}function E(b,c){var d=a(b),e={left:parseInt(d.css("border-left-width"))||0,right:parseInt(d.css("border-right-width"))||0,top:parseInt(d.css("border-top-width"))||0,bottom:parseInt(d.css("border-bottom-width"))||0},f={left:parseInt(d.css("margin-left"))||0,right:parseInt(d.css("margin-right"))||0,top:parseInt(d.css("margin-top"))||0,bottom:parseInt(d.css("margin-bottom"))||0},g={left:parseInt(d.css("padding-left"))||0,right:parseInt(d.css("padding-right"))||0,top:parseInt(d.css("padding-top"))||0,bottom:parseInt(d.css("padding-bottom"))||0};switch(c){case"top":return e.top+f.top+g.top;case"bottom":return e.bottom+f.bottom+g.bottom;case"left":return e.left+f.left+g.left;case"right":return e.right+f.right+g.right;case"width":return e.left+e.right+f.left+f.right+g.left+g.right+parseInt(d.width());case"height":return e.top+e.bottom+f.top+f.bottom+g.top+g.bottom+parseInt(d.height());case"+width":return e.left+e.right+f.left+f.right+g.left+g.right;case"+height":return e.top+e.bottom+f.top+f.bottom+g.top+g.bottom}return 0}function F(b,c){var d,e='<div id="_tmp_width" style="position: absolute; top: -900px;'+(c||"")+'">'+u(b)+"</div>";return a("body").append(e),d=a("#_tmp_width").width(),a("#_tmp_width").remove(),d}function G(a){var b=this.settings.phrases[a];return null==b?a:b}function H(b){return b||(b="en-us"),"string"!=typeof b?void(w2utils.settings=a.extend(!0,w2utils.settings,b)):(5===b.length&&(b="locale/"+b+".json"),w2utils.settings.phrases={},void a.ajax({url:b,type:"GET",dataType:"JSON",async:!1,success:function(b,c,d){w2utils.settings=a.extend(!0,w2utils.settings,b)},error:function(a,c,d){console.log("ERROR: Cannot load locale "+b)}}))}function I(){if(T.scrollBarSize)return T.scrollBarSize;var b='<div id="_scrollbar_width" style="position: absolute; top: -300px; width: 100px; height: 100px; overflow-y: scroll;"> <div style="height: 120px">1</div></div>';return a("body").append(b),T.scrollBarSize=100-a("#_scrollbar_width > div").width(),a("#_scrollbar_width").remove(),String(navigator.userAgent).indexOf("MSIE")>=0&&(T.scrollBarSize=T.scrollBarSize/2),T.scrollBarSize}function J(a,b){return a&&null!=a.name?null!=w2ui[a.name]?(console.log('ERROR: The parameter "name" is not unique. There are other objects already created with the same name (obj: '+a.name+")."),!1):!!w2utils.isAlphaNumeric(a.name)||(console.log('ERROR: The parameter "name" has to be alpha-numeric (a-z, 0-9, dash and underscore). '),!1):(console.log('ERROR: The parameter "name" is required but not supplied in $().'+b+"()."),!1)}function K(b,c,d,e){a.isArray(c)||(c=[c]);for(var f=0;f<c.length;f++)if(c[f].id===b)return console.log('ERROR: The parameter "id='+b+'" is not unique within the current '+d+". (obj: "+e+")"),!1;return!0}function L(a){var b=[],c=a.replace(/\/\(/g,"(?:/").replace(/\+/g,"__plus__").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,function(a,c,d,e,f,g){return b.push({name:e,optional:!!g}),c=c||"",""+(g?"":c)+"(?:"+(g?c:"")+(d||"")+(f||d&&"([^/.]+?)"||"([^/]+?)")+")"+(g||"")}).replace(/([\/.])/g,"\\$1").replace(/__plus__/g,"(.+)").replace(/\*/g,"(.*)");return{path:new RegExp("^"+c+"$","i"),keys:b}}function M(b,c,d){var e={},f={},g="";a.isPlainObject(b)?(e=b,c===!0&&(d=!0)):e[b]=c;for(var h in e)f[h]=e[h],f["-webkit-"+h]=e[h],f["-moz-"+h]=e[h].replace("-webkit-","-moz-"),f["-ms-"+h]=e[h].replace("-webkit-","-ms-"),f["-o-"+h]=e[h].replace("-webkit-","-o-");if(d===!0)for(var h in f)g+=h+": "+f[h]+"; ";else g=f;return g}function N(a){if(null==a)return null;var b,c=0,d=a.ownerDocument||a.document,e=d.defaultView||d.parentWindow;if(a.tagName&&"INPUT"==a.tagName.toUpperCase()&&a.selectionStart)c=a.selectionStart;else if(e.getSelection){if(b=e.getSelection(),b.rangeCount>0){var f=b.getRangeAt(0),g=f.cloneRange();g.selectNodeContents(a),g.setEnd(f.endContainer,f.endOffset),c=g.toString().length}}else if((b=d.selection)&&"Control"!=b.type){var h=b.createRange(),i=d.body.createTextRange();i.moveToElementText(a),i.setEndPoint("EndToEnd",h),c=i.text.length}return c}function O(b,c,d){var e,f=document.createRange(),g=window.getSelection();if(null!=b){for(var h=0;h<b.childNodes.length;h++){var i=a(b.childNodes[h]).text();if(b.childNodes[h].tagName&&(i=a(b.childNodes[h]).html(),i=i.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/ /g," ")),c<=i.length){e=b.childNodes[h],e.childNodes&&e.childNodes.length>0&&(e=e.childNodes[0]),e.childNodes&&e.childNodes.length>0&&(e=e.childNodes[0]);break}c-=i.length}null!=e&&(c>e.length&&(c=e.length),f.setStart(e,c),d?f.setEnd(e,d):f.collapse(!0),g.removeAllRanges(),g.addRange(f))}}function P(){var a="w2ui_test";try{return localStorage.setItem(a,a),localStorage.removeItem(a),!0}catch(a){return!1}}function Q(a){if("string"!=typeof a)return null;a=a.trim().toUpperCase(),"#"==a[0]&&(a=a.substr(1));var b={};if(3==a.length)b={r:parseInt(a[0]+a[0],16),g:parseInt(a[1]+a[1],16),b:parseInt(a[2]+a[2],16),a:1};else if(6==a.length)b={r:parseInt(a.substr(0,2),16),g:parseInt(a.substr(2,2),16),b:parseInt(a.substr(4,2),16),a:1};else if(a.length>4&&"RGB("==a.substr(0,4)){var c=a.replace("RGB","").replace(/\(/g,"").replace(/\)/g,"").split(",");b={r:parseInt(c[0],10),g:parseInt(c[1],10),b:parseInt(c[2],10),a:1}}else{if(!(a.length>5&&"RGBA("==a.substr(0,5)))return null;var c=a.replace("RGBA","").replace(/\(/g,"").replace(/\)/g,"").split(",");b={r:parseInt(c[0],10),g:parseInt(c[1],10),b:parseInt(c[2],10),a:parseFloat(c[3])}}return b}function R(a,b,c,d){var e,f,g,h,i,j,k,l;switch(1===arguments.length&&(b=a.s,c=a.v,d=a.a,a=a.h),a/=360,b/=100,c/=100,h=Math.floor(6*a),i=6*a-h,j=c*(1-b),k=c*(1-i*b),l=c*(1-(1-i)*b),h%6){case 0:e=c,f=l,g=j;break;case 1:e=k,f=c,g=j;break;case 2:e=j,f=c,g=l;break;case 3:e=j,f=k,g=c;break;case 4:e=l,f=j,g=c;break;case 5:e=c,f=j,g=k}return{r:Math.round(255*e),g:Math.round(255*f),b:Math.round(255*g),a:null!=d?d:1}}function S(a,b,c,d){1===arguments.length&&(b=a.g,c=a.b,d=a.a,a=a.r);var e,f=Math.max(a,b,c),g=Math.min(a,b,c),h=f-g,i=0===f?0:h/f,j=f/255;switch(f){case g:e=0;break;case a:e=b-c+h*(b<c?6:0),e/=6*h;break;case b:e=c-a+2*h,e/=6*h;break;case c:e=a-b+4*h,e/=6*h}return{h:Math.round(360*e),s:Math.round(100*i),v:Math.round(100*j),a:null!=d?d:1}}var T={},U={version:"1.5.x",settings:{locale:"en-us",dateFormat:"m/d/yyyy",timeFormat:"hh:mi pm",datetimeFormat:"m/d/yyyy|hh:mi pm",currencyPrefix:"$",currencySuffix:"",currencyPrecision:2,groupSymbol:",",decimalSymbol:".",shortmonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],fullmonths:["January","February","March","April","May","June","July","August","September","October","November","December"],shortdays:["M","T","W","T","F","S","S"],fulldays:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],weekStarts:"M",dataType:"HTTPJSON",phrases:{},dateStartYear:1950,dateEndYear:2020},isBin:b,isInt:c,isFloat:d,isMoney:e,isHex:f,isAlphaNumeric:g,isEmail:h,isDate:i,isTime:j,isDateTime:k,age:l,interval:m,date:n,formatSize:o,formatNumber:p,formatDate:q,formatTime:r,formatDateTime:s,stripTags:t,encodeTags:u,decodeTags:v,escapeId:w,base64encode:x,base64decode:y,md5:z,transition:A,lock:B,unlock:C,message:D,lang:G,locale:H,getSize:E,getStrWidth:F,scrollBarSize:I,checkName:J,checkUniqueId:K,parseRoute:L,cssPrefix:M,parseColor:Q,hsv2rgb:R,rgb2hsv:S,getCursorPosition:N,setCursorPosition:O,testLocalStorage:P,hasLocalStorage:P(),isIOS:navigator.userAgent.toLowerCase().indexOf("iphone")!=-1||navigator.userAgent.toLowerCase().indexOf("ipod")!=-1||navigator.userAgent.toLowerCase().indexOf("ipad")!=-1,isIE:navigator.userAgent.toLowerCase().indexOf("msie")!=-1||navigator.userAgent.toLowerCase().indexOf("trident")!=-1};return U}(jQuery);w2utils.formatters={number:function(a,b){return parseInt(b)>20&&(b=20),parseInt(b)<0&&(b=0),null==a||""===a?"":w2utils.formatNumber(parseFloat(a),b,!0)},float:function(a,b){return w2utils.formatters.number(a,b)},int:function(a,b){return w2utils.formatters.number(a,0)},money:function(a,b){if(null==a||""===a)return"";var c=w2utils.formatNumber(Number(a),w2utils.settings.currencyPrecision||2);return(w2utils.settings.currencyPrefix||"")+c+(w2utils.settings.currencySuffix||"")},currency:function(a,b){return w2utils.formatters.money(a,b)},percent:function(a,b){return null==a||""===a?"":w2utils.formatNumber(a,b||1)+"%"},size:function(a,b){return null==a||""===a?"":w2utils.formatSize(parseInt(a))},date:function(a,b){if(""===b&&(b=w2utils.settings.dateFormat),null==a||0===a||""===a)return"";var c=w2utils.isDateTime(a,b,!0);return c===!1&&(c=w2utils.isDate(a,b,!0)),'<span title="'+c+'">'+w2utils.formatDate(c,b)+"</span>"},datetime:function(a,b){if(""===b&&(b=w2utils.settings.datetimeFormat),
null==a||0===a||""===a)return"";var c=w2utils.isDateTime(a,b,!0);return c===!1&&(c=w2utils.isDate(a,b,!0)),'<span title="'+c+'">'+w2utils.formatDateTime(c,b)+"</span>"},time:function(a,b){if(""===b&&(b=w2utils.settings.timeFormat),"h12"===b&&(b="hh:mi pm"),"h24"===b&&(b="h24:mi"),null==a||0===a||""===a)return"";var c=w2utils.isDateTime(a,b,!0);return c===!1&&(c=w2utils.isDate(a,b,!0)),'<span title="'+c+'">'+w2utils.formatTime(a,b)+"</span>"},timestamp:function(a,b){if(""===b&&(b=w2utils.settings.datetimeFormat),null==a||0===a||""===a)return"";var c=w2utils.isDateTime(a,b,!0);return c===!1&&(c=w2utils.isDate(a,b,!0)),c.toString?c.toString():""},gmt:function(a,b){if(""===b&&(b=w2utils.settings.datetimeFormat),null==a||0===a||""===a)return"";var c=w2utils.isDateTime(a,b,!0);return c===!1&&(c=w2utils.isDate(a,b,!0)),c.toUTCString?c.toUTCString():""},age:function(a,b){if(null==a||0===a||""===a)return"";var c=w2utils.isDateTime(a,null,!0);return c===!1&&(c=w2utils.isDate(a,null,!0)),'<span title="'+c+'">'+w2utils.age(a)+(b?" "+b:"")+"</span>"},interval:function(a,b){return null==a||0===a||""===a?"":w2utils.interval(a)+(b?" "+b:"")},toggle:function(a,b){return a?"Yes":""},password:function(a,b){for(var c="",d=0;d<a.length;d++)c+="*";return c}},w2utils.event={on:function(a,b){var c,d=jQuery;if("string"==typeof a&&a.indexOf(".")!=-1){var e=a.split(".");a=e[0],c=e[1]}if("string"==typeof a&&a.indexOf(":")!=-1){var e=a.split(":");["complete","done"].indexOf(a[1])!=-1&&(a[1]="after"),a={type:e[0],execute:e[1]}}return d.isPlainObject(a)||(a={type:a,scope:c}),a=d.extend({type:null,execute:"before",target:null,onComplete:null},a),a.type?b?(d.isArray(this.handlers)||(this.handlers=[]),void this.handlers.push({edata:a,handler:b})):void console.log("ERROR: You must specify event handler function when calling .on() method of "+this.name):void console.log("ERROR: You must specify event type when calling .on() method of "+this.name)},off:function(a,b){var c,d=jQuery;if("string"==typeof a&&a.indexOf(".")!=-1){var e=a.split(".");a=e[0],c=e[1]}if("string"==typeof a&&a.indexOf(":")!=-1){var e=a.split(":");["complete","done"].indexOf(a[1])!=-1&&(a[1]="after"),a={type:e[0],execute:e[1]}}if(d.isPlainObject(a)||(a={type:a}),a=d.extend({},{type:null,execute:"before",target:null,onComplete:null},a),!a.type&&!c)return void console.log("ERROR: You must specify event type when calling .off() method of "+this.name);b||(b=null);for(var f=[],g=0,h=this.handlers.length;g<h;g++){var i=this.handlers[g];(i.edata.type!==a.type&&"*"!==a.type&&(null==i.edata.scope||""!=a.type)||i.edata.target!==a.target&&null!=a.target||i.edata.execute!==a.execute&&null!=a.execute||i.handler!==b&&null!=b&&(null==c||i.edata.scope!=c))&&f.push(i)}this.handlers=f},trigger:function(a){var b=jQuery,a=b.extend({type:null,phase:"before",target:null,doneHandlers:[]},a,{isStopped:!1,isCancelled:!1,done:function(a){this.doneHandlers.push(a)},preventDefault:function(){this.isCancelled=!0},stopPropagation:function(){this.isStopped=!0}});"before"===a.phase&&(a.onComplete=null);var c,d,e;null==a.target&&(a.target=null),b.isArray(this.handlers)||(this.handlers=[]);for(var f=this.handlers.length-1;f>=0;f--){var g=this.handlers[f];if(!(g.edata.type!==a.type&&"*"!==g.edata.type||g.edata.target!==a.target&&null!=g.edata.target||g.edata.execute!==a.phase&&"*"!==g.edata.execute&&"*"!==g.edata.phase)&&(a=b.extend({},g.edata,a),c=[],e=new RegExp(/\((.*?)\)/).exec(g.handler),e&&(c=e[1].split(/\s*,\s*/)),2===c.length?g.handler.call(this,a.target,a):g.handler.call(this,a),a.isStopped===!0||a.stop===!0))return a}var h="on"+a.type.substr(0,1).toUpperCase()+a.type.substr(1);if("before"===a.phase&&"function"==typeof this[h]&&(d=this[h],c=[],e=new RegExp(/\((.*?)\)/).exec(d),e&&(c=e[1].split(/\s*,\s*/)),2===c.length?d.call(this,a.target,a):d.call(this,a),a.isStopped===!0||a.stop===!0))return a;if(null!=a.object&&"before"===a.phase&&"function"==typeof a.object[h]&&(d=a.object[h],c=[],e=new RegExp(/\((.*?)\)/).exec(d),e&&(c=e[1].split(/\s*,\s*/)),2===c.length?d.call(this,a.target,a):d.call(this,a),a.isStopped===!0||a.stop===!0))return a;if("after"===a.phase){"function"==typeof a.onComplete&&a.onComplete.call(this,a);for(var i=0;i<a.doneHandlers.length;i++)"function"==typeof a.doneHandlers[i]&&a.doneHandlers[i].call(this,a)}return a}},function(a){a.fn.w2render=function(b){a(this).length>0&&("string"==typeof b&&w2ui[b]&&w2ui[b].render(a(this)[0]),"object"==typeof b&&b.render(a(this)[0]))},a.fn.w2destroy=function(a){!a&&this.length>0&&(a=this.attr("name")),"string"==typeof a&&w2ui[a]&&w2ui[a].destroy(),"object"==typeof a&&a.destroy()},a.fn.w2marker=function(){function b(a,b){for(;b.innerHTML.indexOf('<span class="w2ui-marker">')!=-1;)b.innerHTML=b.innerHTML.replace(/\<span class=\"w2ui\-marker\"\>((.|\n|\r)*)\<\/span\>/gi,"$1")}var c=Array.prototype.slice.call(arguments,0);return Array.isArray(c[0])&&(c=c[0]),0!==c.length&&c[0]?a(this).each(function(a,d){function e(a){return'<span class="w2ui-marker">'+a+"</span>"}b(a,d);for(var f=0;f<c.length;f++){var g=c[f];"string"!=typeof g&&(g=String(g)),g=g.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&").replace(/&/g,"&").replace(/</g,">").replace(/>/g,"<");var h=new RegExp(g+"(?!([^<]+)?>)","gi");d.innerHTML=d.innerHTML.replace(h,e)}}):a(this).each(b)},a.fn.w2tag=function(b,c){return 1==arguments.length&&"object"==typeof b&&(c=b,null!=c.html&&(b=c.html)),c=a.extend({id:null,html:b,position:"right|top",align:"none",left:0,top:0,style:"",css:{},className:"",inputClass:"",onShow:null,onHide:null,hideOnKeyPress:!0,hideOnBlur:!1,hideOnClick:!1,hideOnChange:!0},c),null!=c.name&&null==c.id&&(c.id=c.name),""!==c.class&&""===c.inputClass&&(c.inputClass=c.class),0===a(this).length?void a(".w2ui-tag").each(function(b,c){var d=a(c).data("w2tag");d&&d.hide()}):a(this).each(function(d,e){function f(){if(j.box.css("display","block"),j&&j.box&&a(j.attachedTo).offset()){var b=j.getPos();j.box.css({opacity:"1",left:b.left+"px",top:b.top+"px"}).data("w2tag",j).find(".w2ui-tag-body").addClass(b.posClass),j.tmp.pos=b.left+"x"+b.top,a(j.attachedTo).off(".w2tag").css(j.options.css).addClass(j.options.inputClass),j.options.hideOnKeyPress&&a(j.attachedTo).on("keypress.w2tag",j.hide),c.hideOnChange&&("INPUT"==e.nodeName?a(e).on("change.w2tag",j.hide):a(e).find("input").on("change.w2tag",j.hide)),j.options.hideOnBlur&&a(j.attachedTo).on("blur.w2tag",j.hide),j.options.hideOnClick&&a(document).on("click.w2tag",j.hide),"function"==typeof j.options.onShow&&j.options.onShow(),h()}}function g(){j.box.length<=0||(j.tmp.timer&&clearTimeout(j.tmp.timer),j.box.remove(),j.options.hideOnClick&&a(document).off(".w2tag"),a(j.attachedTo).off(".w2tag").removeClass(j.options.inputClass).removeData("w2tag"),a(j.attachedTo).length>0&&(a(j.attachedTo)[0].style.cssText=j.tmp.originalCSS),"function"==typeof j.options.onHide&&j.options.onHide())}function h(b){var c=a(j.attachedTo).offset();if(0===a(j.attachedTo).length||0===c.left&&0===c.top||0===j.box.find(".w2ui-tag-body").length)return void j.hide();var d=i();j.tmp.pos!==d.left+"x"+d.top&&(j.box.css(w2utils.cssPrefix({transition:b?"0s":".2s"})).css({left:d.left+"px",top:d.top+"px"}),j.tmp.pos=d.left+"x"+d.top),j.tmp.timer&&clearTimeout(j.tmp.timer),j.tmp.timer=setTimeout(h,100)}function i(){var b=a(j.attachedTo).offset(),c="w2ui-tag-right",d=parseInt(b.left+j.attachedTo.offsetWidth+(j.options.left?j.options.left:0)),e=parseInt(b.top+(j.options.top?j.options.top:0)),f=j.box.find(".w2ui-tag-body"),g=f[0].offsetWidth,h=f[0].offsetHeight;if("string"==typeof j.options.position&&j.options.position.indexOf("|")!=-1&&(j.options.position=j.options.position.split("|")),"top"==j.options.position)c="w2ui-tag-top",d=parseInt(b.left+(j.options.left?j.options.left:0))-14,e=parseInt(b.top+(j.options.top?j.options.top:0))-h-10;else if("bottom"==j.options.position)c="w2ui-tag-bottom",d=parseInt(b.left+(j.options.left?j.options.left:0))-14,e=parseInt(b.top+j.attachedTo.offsetHeight+(j.options.top?j.options.top:0))+10;else if("left"==j.options.position)c="w2ui-tag-left",d=parseInt(b.left+(j.options.left?j.options.left:0))-g-20,e=parseInt(b.top+(j.options.top?j.options.top:0));else if(Array.isArray(j.options.position)){for(var i=window.innerWidth,k=window.innerHeight,l=0;l<j.options.position.length;l++){var m=j.options.position[l];if("right"==m){if(c="w2ui-tag-right",d=parseInt(b.left+j.attachedTo.offsetWidth+(j.options.left?j.options.left:0)),e=parseInt(b.top+(j.options.top?j.options.top:0)),d+g<=i)break}else if("left"==m){if(c="w2ui-tag-left",d=parseInt(b.left+(j.options.left?j.options.left:0))-g-20,e=parseInt(b.top+(j.options.top?j.options.top:0)),d>=0)break}else if("top"==m){if(c="w2ui-tag-top",d=parseInt(b.left+(j.options.left?j.options.left:0))-14,e=parseInt(b.top+(j.options.top?j.options.top:0))-h-10,d+g<=i&&e>=0)break}else if("bottom"==m&&(c="w2ui-tag-bottom",d=parseInt(b.left+(j.options.left?j.options.left:0))-14,e=parseInt(b.top+j.attachedTo.offsetHeight+(j.options.top?j.options.top:0))+10,d+g<=i&&e+h<=k))break}f.data("posClass")!==c&&f.removeClass("w2ui-tag-right w2ui-tag-left w2ui-tag-top w2ui-tag-bottom").addClass(c).data("posClass",c)}return{left:d,top:e,posClass:c}}var j,k=c.id?c.id:e.id;""==k&&(k=a(e).find("input").attr("id")),k||(k="noid");var l=w2utils.escapeId(k);null!=a(this).data("w2tag")?(j=a(this).data("w2tag"),a.extend(j.options,c)):j={id:k,attachedTo:e,box:a("#w2ui-tag-"+l),options:a.extend({},c),init:f,hide:g,getPos:i,isMoved:h,tmp:{}},""===b||null==b?j.hide():0!==j.box.length?j.box.find(".w2ui-tag-body").css(j.options.css).attr("style",j.options.style).addClass(j.options.className).html(j.options.html):(j.tmp.originalCSS="",a(j.attachedTo).length>0&&(j.tmp.originalCSS=a(j.attachedTo)[0].style.cssText),a("body").append('<div onclick="event.stopPropagation()" style="display: none;" id="w2ui-tag-'+j.id+'" class="w2ui-tag '+(a(j.attachedTo).parents(".w2ui-popup, .w2ui-overlay-popup, .w2ui-message").length>0?"w2ui-tag-popup":"")+'"> <div style="margin: -2px 0px 0px -2px; white-space: nowrap;"> <div class="w2ui-tag-body '+j.options.className+'" style="'+(j.options.style||"")+'">'+b+"</div> </div></div>"),j.box=a("#w2ui-tag-"+l),a(j.attachedTo).data("w2tag",j),setTimeout(f,1))})},a.fn.w2overlay=function(b,c){function d(){var b=a("#w2ui-overlay"+h);if(b.data("element")===g[0]&&0!==b.length){var c=a(g).offset()||{},f=c.left+"x"+c.top;b.data("position")!==f?e():setTimeout(d,250)}}function e(b){if(!b||0===b.button){var d=a("#w2ui-overlay"+h);if(d.data("keepOpen")===!0)return void d.removeData("keepOpen");var e;"function"==typeof c.onHide&&(e=c.onHide()),e!==!1&&(d.remove(),a(document).off(".w2overlay"+h),clearInterval(d.data("timer")))}}function f(){var b=a("#w2ui-overlay"+h),d=b.find(" > div"),e=a("#w2ui-overlay"+h+" div.menu");if(e.css("overflow-y","hidden"),b.length>0){d.height("auto").width("auto");var i=!1,j=d.height(),k=d.width();c.width&&c.width<k&&(k=c.width),k<30&&(k=30),c.tmp.contentHeight&&(j=parseInt(c.tmp.contentHeight),d.height(j),setTimeout(function(){var a=d.find("div.menu");j>a.height()&&d.find("div.menu").css("overflow-y","hidden")},1),setTimeout(function(){var a=d.find("div.menu");"auto"!=a.css("overflow-y")&&a.css("overflow-y","auto")},10)),c.tmp.contentWidth&&"both"!=c.align&&(k=parseInt(c.tmp.contentWidth),d.width(k),setTimeout(function(){k>d.find("div.menu > table").width()&&d.find("div.menu > table").css("overflow-x","hidden")},1),setTimeout(function(){d.find("div.menu > table").css("overflow-x","auto")},10));var l=c.left,m=c.width,n=c.tipLeft;switch(c.align){case"both":l=17,0===c.width&&(c.width=w2utils.getSize(a(g),"width")),c.maxWidth&&c.width>c.maxWidth&&(c.width=c.maxWidth);break;case"left":l=17;break;case"right":l=w2utils.getSize(a(g),"width")-k+10,n=k-40}m=30!==k||m?c.width?c.width:"auto":30;var o=(k-17)/2;"auto"!=m&&(o=(m-17)/2),o<25&&(l=25-o,n=Math.floor(o));var p,q,r;if(c.contextMenu)p=c.pageX+8,q=c.pageY-0,r=c.pageY;else{var s=g.offset()||{};p=(s.left>25?s.left:25)+l,q=s.top+w2utils.getSize(g,"height")+c.top+7,r=s.top}b.css({left:p+"px",top:q+"px","min-width":m,"min-height":c.height?c.height:"auto"});var s=d.offset()||{},t=window.innerHeight+a(document).scrollTop()-s.top-7,u=window.innerWidth+a(document).scrollLeft()-s.left-7;if(c.contextMenu&&(t=window.innerHeight+a(document).scrollTop()-c.pageY-15,u=window.innerWidth+a(document).scrollLeft()-c.pageX),t>-50&&t<210||c.openAbove===!0){var v;c.contextMenu?(t=c.pageY-7,v=5):(t=s.top-a(document).scrollTop()-7,v=24),c.maxHeight&&t>c.maxHeight&&(t=c.maxHeight),j>t&&(i=!0,d.height(t).width(k).css({"overflow-y":"auto"}),j=t),b.addClass("bottom-arrow"),b.css("top",r-j-v+c.top+"px"),b.find(">style").html("#w2ui-overlay"+h+":before { margin-left: "+parseInt(n)+"px; }#w2ui-overlay"+h+":after { margin-left: "+parseInt(n)+"px; }")}else c.maxHeight&&t>c.maxHeight&&(t=c.maxHeight),j>t&&(i=!0,d.height(t).width(k).css({"overflow-y":"auto"})),b.addClass("top-arrow"),b.find(">style").html("#w2ui-overlay"+h+":before { margin-left: "+parseInt(n)+"px; }#w2ui-overlay"+h+":after { margin-left: "+parseInt(n)+"px; }");k=d.width(),u=window.innerWidth+a(document).scrollLeft()-s.left-7,c.maxWidth&&u>c.maxWidth&&(u=c.maxWidth),k>u&&"both"!==c.align&&(c.align="right",setTimeout(function(){f()},1)),(c.contextMenu||c.noTip)&&b.find(">style").html("#w2ui-overlay"+h+":before { display: none; }#w2ui-overlay"+h+":after { display: none; }"),i&&"both"!=c.align&&d.width(k+w2utils.scrollBarSize()+2)}e.css("overflow-y","auto")}var g=this,h="",i={name:null,html:"",align:"none",left:0,top:0,tipLeft:30,noTip:!1,selectable:!1,width:0,height:0,maxWidth:null,maxHeight:null,contextMenu:!1,pageX:null,pageY:null,originalEvent:null,style:"",class:"",overlayStyle:"",onShow:null,onHide:null,openAbove:!1,tmp:{}};1==arguments.length&&(c="object"==typeof b?b:{html:b}),2==arguments.length&&(c.html=b),a.isPlainObject(c)||(c={}),c=a.extend({},i,c),c.name&&(h="-"+c.name);var j;if(0===this.length||""===c.html||null==c.html)return a("#w2ui-overlay"+h).length>0?(j=a("#w2ui-overlay"+h)[0].hide,"function"==typeof j&&j()):a("#w2ui-overlay"+h).remove(),a(this);a("#w2ui-overlay"+h).length>0&&(j=a("#w2ui-overlay"+h)[0].hide,a(document).off(".w2overlay"+h),"function"==typeof j&&j()),g.length>0&&(null==g[0].tagName||"BODY"==g[0].tagName.toUpperCase())&&(c.contextMenu=!0),c.contextMenu&&c.originalEvent&&(c.pageX=c.originalEvent.pageX,c.pageY=c.originalEvent.pageY),!c.contextMenu||null!=c.pageX&&null!=c.pageY||console.log("ERROR: to display menu at mouse location, pass options.pageX and options.pageY."),a("body").append('<div id="w2ui-overlay'+h+'" style="display: none; left: 0px; top: 0px; '+c.overlayStyle+'" class="w2ui-reset w2ui-overlay '+(a(this).parents(".w2ui-popup, .w2ui-overlay-popup, .w2ui-message").length>0?"w2ui-overlay-popup":"")+'"> <style></style> <div style="min-width: 100%; '+c.style+'" class="'+c.class+'"></div></div>');var k=a("#w2ui-overlay"+h),l=k.find(" > div");l.html(c.html);var m=l.css("background-color");null!=m&&"rgba(0, 0, 0, 0)"!==m&&"transparent"!==m&&k.css({"background-color":m,"border-color":m});var n=a(g).offset()||{};return k.data("element",g.length>0?g[0]:null).data("options",c).data("position",n.left+"x"+n.top).fadeIn("fast").on("click",function(b){a("#w2ui-overlay"+h).data("keepOpen",!0),"LABEL"==b.target.tagName.toUpperCase()&&b.stopPropagation()}).on("mousedown",function(a){var b=a.target.tagName.toUpperCase();["INPUT","TEXTAREA","SELECT"].indexOf(b)!=-1||c.selectable||a.preventDefault()}),k[0].hide=e,k[0].resize=f,setTimeout(function(){f(),a(document).off(".w2overlay"+h).on("click.w2overlay"+h,e),"function"==typeof c.onShow&&c.onShow()},10),d(),a(this)},a.fn.w2menu=function(b,c){function d(){setTimeout(function(){a("#w2ui-overlay"+i+" tr.w2ui-selected").removeClass("w2ui-selected");var b=a("#w2ui-overlay"+i+" tr[index="+c.index+"]"),d=a("#w2ui-overlay"+i+" div.menu").scrollTop();if(b.addClass("w2ui-selected"),c.tmp&&(c.tmp.contentHeight=a("#w2ui-overlay"+i+" table").height()+(c.search?50:10)),c.tmp&&(c.tmp.contentWidth=a("#w2ui-overlay"+i+" table").width()),a("#w2ui-overlay"+i).length>0&&a("#w2ui-overlay"+i)[0].resize(),b.length>0){var e=b[0].offsetTop-5,f=a("#w2ui-overlay"+i+" div.menu"),g=f.height();a("#w2ui-overlay"+i+" div.menu").scrollTop(d),(e<d||e+b.height()>d+g)&&a("#w2ui-overlay"+i+" div.menu").animate({scrollTop:e-(g-2*b.height())/2},200,"linear")}},1)}function e(b){var e=this.value,f=b.keyCode,g=!1;switch(f){case 13:a("#w2ui-overlay"+i).remove(),a.fn.w2menuClick(b,c.index);break;case 9:case 27:a("#w2ui-overlay"+i).remove(),a.fn.w2menuClick(b,-1);break;case 38:for(c.index=w2utils.isInt(c.index)?parseInt(c.index):0,c.index--;c.index>0&&c.items[c.index].hidden;)c.index--;if(0===c.index&&c.items[c.index].hidden)for(;c.items[c.index]&&c.items[c.index].hidden;)c.index++;c.index<0&&(c.index=0),g=!0;break;case 40:for(c.index=w2utils.isInt(c.index)?parseInt(c.index):0,c.index++;c.index<c.items.length-1&&c.items[c.index].hidden;)c.index++;if(c.index===c.items.length-1&&c.items[c.index].hidden)for(;c.items[c.index]&&c.items[c.index].hidden;)c.index--;c.index>=c.items.length&&(c.index=c.items.length-1),g=!0}if(!g){for(var j=0,k=0;k<c.items.length;k++){var l=c.items[k],m="",n="";["is","begins with"].indexOf(c.match)!==-1&&(m="^"),["is","ends with"].indexOf(c.match)!==-1&&(n="$");try{var o=new RegExp(m+e+n,"i");o.test(l.text)||"..."===l.text?l.hidden=!1:l.hidden=!0}catch(a){}"enum"===h.type&&a.inArray(l.id,ids)!==-1&&(l.hidden=!0),l.hidden!==!0&&j++}for(c.index=0;c.index<c.items.length-1&&c.items[c.index].hidden;)c.index++;j<=0&&(c.index=-1)}a(h).w2menu("refresh",c),d()}function f(){if(c.spinner)return'<table class="w2ui-drop-menu"><tbody><tr><td style="padding: 5px 10px 10px 10px; text-align: center"> <div class="w2ui-spinner" style="width: 18px; height: 18px; position: relative; top: 5px;"></div> <div style="display: inline-block; padding: 3px; color: #999;">'+w2utils.lang("Loading...")+"</div></td></tr></tbody></table>";for(var a=0,b='<table cellspacing="0" cellpadding="0" class="w2ui-drop-menu"><tbody>',d=null,e=null,f=0;f<c.items.length;f++){var g=c.items[f];if("string"==typeof g?g={id:g,text:g}:(null!=g.text&&null==g.id&&(g.id=g.text),null==g.text&&null!=g.id&&(g.text=g.id),null!=g.caption&&(g.text=g.caption),d=g.img,e=g.icon,null==d&&(d=null),null==e&&(e=null)),["radio","check"].indexOf(c.type)!=-1&&(e=g.checked===!0?"w2ui-icon-check":"w2ui-icon-empty"),g.hidden!==!0){var h="",i=g.text;if("function"==typeof c.render&&(i=c.render(g,c)),d&&(h='<td class="menu-icon"><div class="w2ui-tb-image w2ui-icon '+d+'"></div></td>'),e&&(h='<td class="menu-icon" align="center"><span class="w2ui-icon '+e+'"></span></td>'),null==i||""===i||/^-+$/.test(i))b+='<tr><td colspan="3" style="padding: 6px; pointer-events: none"><div style="border-top: 1px solid silver;"></div></td></tr>';else{var j=a%2===0?"w2ui-item-even":"w2ui-item-odd";c.altRows!==!0&&(j="");var k=1;""===h&&k++,null==g.count&&null==g.hotkey&&k++,null==g.tooltip&&null!=g.hint&&(g.tooltip=g.hint),b+='<tr index="'+f+'" style="'+(g.style?g.style:"")+'" '+(g.tooltip?'title="'+w2utils.lang(g.tooltip)+'"':"")+' class="'+j+" "+(c.index===f?"w2ui-selected":"")+" "+(g.disabled===!0?"w2ui-disabled":"")+'" onmousedown="if ('+(g.disabled===!0?"true":"false")+") return; jQuery.fn.w2menuDown(event, '"+f+'\');" onclick="event.stopPropagation(); if ('+(g.disabled===!0?"true":"false")+") return; jQuery.fn.w2menuClick(event, '"+f+"');\">"+h+' <td class="menu-text" colspan="'+k+'">'+w2utils.lang(i)+'</td> <td class="menu-count">'+(null!=g.count?"<span>"+g.count+"</span>":"")+(null!=g.hotkey?'<span class="hotkey">'+g.hotkey+"</span>":"")+"</td></tr>",a++}}c.items[f]=g}return 0===a&&(b+='<tr><td style="padding: 13px; color: #999; text-align: center">'+c.msgNoItems+"</div></td></tr>"),b+="</tbody></table>"}c&&"function"==typeof c.items&&(c.items=c.items());var g={type:"normal",index:null,items:[],render:null,msgNoItems:"No items",onSelect:null,tmp:{}},h=this,i="";if("refresh"===b)if(a("#w2ui-overlay"+i).length>0){c=a.extend(a.fn.w2menuOptions,c);var j=a("#w2ui-overlay"+i+" div.menu").scrollTop();a("#w2ui-overlay"+i+" div.menu").html(f()),a("#w2ui-overlay"+i+" div.menu").scrollTop(j),d()}else a(this).w2menu(c);else{if("refresh-index"!==b){1===arguments.length?c=b:c.items=b,"object"!=typeof c&&(c={}),c=a.extend({},g,c),a.fn.w2menuOptions=c,c.name&&(i="-"+c.name),"function"==typeof c.select&&"function"!=typeof c.onSelect&&(c.onSelect=c.select),"function"==typeof c.onRender&&"function"!=typeof c.render&&(c.render=c.onRender),a.fn.w2menuClick=function(b,d){var e=!1;["radio","check"].indexOf(c.type)!=-1&&(b.shiftKey||b.metaKey||b.ctrlKey)&&(e=!0),"function"==typeof c.onSelect&&setTimeout(function(){c.onSelect({index:d,item:c.items[d],keepOpen:e,originalEvent:b})},10);var f=a("#w2ui-overlay"+i);f.removeData("keepOpen"),"function"!=typeof f[0].hide||e||f[0].hide()},a.fn.w2menuDown=function(b,d){var e=a(b.target).parents("tr"),f=e.find(".w2ui-icon");if("check"==c.type||"radio"==c.type){var g=c.items[d];g.checked=!g.checked,g.checked?("radio"==c.type&&f.parents("table").find(".w2ui-icon").removeClass("w2ui-icon-check").addClass("w2ui-icon-empty"),"check"==c.type&&null!=g.group&&c.items.forEach(function(a,b){a.group===g.group&&a.checked&&(f.parents("table").find("tr[index="+b+"] .w2ui-icon").removeClass("w2ui-icon-check").addClass("w2ui-icon-empty"),a.checked=!1)}),f.removeClass("w2ui-icon-empty").addClass("w2ui-icon-check")):"check"==c.type&&null==g.group&&f.removeClass("w2ui-icon-check").addClass("w2ui-icon-empty")}e.parent().find("tr").removeClass("w2ui-selected"),e.addClass("w2ui-selected")};var k="";if(c.search){k+='<div style="position: absolute; top: 0px; height: 40px; left: 0px; right: 0px; border-bottom: 1px solid silver; background-color: #ECECEC; padding: 8px 5px;"> <div class="w2ui-icon icon-search" style="position: absolute; margin-top: 4px; margin-left: 6px; width: 11px; background-position: left !important;"></div> <input id="menu-search" type="text" style="width: 100%; outline: none; padding-left: 20px;" onclick="event.stopPropagation();"/></div>',c.style+=";background-color: #ECECEC",c.index=0;for(var l=0;l<c.items.length;l++)c.items[l].hidden=!1}k+='<div class="menu" style="position: absolute; top: '+(c.search?40:0)+'px; bottom: 0px; width: 100%;">'+f()+"</div>";var m=a(this).w2overlay(k,c);return setTimeout(function(){if(a("#w2ui-overlay"+i+" #menu-search").on("keyup",e).on("keydown",function(a){9===a.keyCode&&(a.stopPropagation(),a.preventDefault())}),c.search){if(["text","password"].indexOf(a(h)[0].type)!=-1||"TEXTAREA"==a(h)[0].tagName.toUpperCase())return;a("#w2ui-overlay"+i+" #menu-search").focus()}d()},200),d(),m}var n=a("#w2ui-overlay"+i+" div.menu"),o=n.find("tr[index="+c.index+"]"),j=n.scrollTop();if(n.find("tr.w2ui-selected").removeClass("w2ui-selected"),o.addClass("w2ui-selected"),o.length>0){var p=o[0].offsetTop-5,q=n.height();n.scrollTop(j),(p<j||p+o.height()>j+q)&&n.animate({scrollTop:p-(q-2*o.height())/2},200,"linear")}d()}},a.fn.w2color=function(b,c){function d(a){for(var b,c=(a.color,'<div class="w2ui-color" onmousedown="jQuery(this).parents(\'.w2ui-overlay\').data(\'keepOpen\', true)"><div class="w2ui-color-palette"><table cellspacing="5"><tbody>'),d=0;d<h.length;d++){c+="<tr>";for(var e=0;e<h[d].length;e++)b="FFFFFF"==h[d][e]?";border: 1px solid #efefef":"",c+='<td> <div class="color '+(""===h[d][e]?"no-color":"")+'" style="background-color: #'+h[d][e]+b+';" name="'+h[d][e]+'" index="'+d+":"+e+'">'+(a.color==h[d][e]?"•":" ")+" </div></td>",a.color==h[d][e]&&(g=[d,e]);c+="</tr>",d<2&&(c+='<tr><td style="height: 8px" colspan="8"></td></tr>')}return c+="</tbody></table></div>",c+='<div class="w2ui-color-advanced" style="display: none"> <div class="color-info"> <div class="color-preview-bg"><div class="color-preview"></div><div class="color-original"></div></div> <div class="color-part"> <span>H</span> <input name="h" maxlength="3" max="360" tabindex="101"> <span>R</span> <input name="r" maxlength="3" max="255" tabindex="104"> </div> <div class="color-part"> <span>S</span> <input name="s" maxlength="3" max="100" tabindex="102"> <span>G</span> <input name="g" maxlength="3" max="255" tabindex="105"> </div> <div class="color-part"> <span>V</span> <input name="v" maxlength="3" max="100" tabindex="103"> <span>B</span> <input name="b" maxlength="3" max="255" tabindex="106"> </div> <div class="color-part" style="margin: 30px 0px 0px 2px"> <span style="width: 40px">Opacity</span> <input name="a" maxlength="5" max="1" style="width: 32px !important" tabindex="107"> </div> </div> <div class="palette" name="palette"> <div class="palette-bg"></div> <div class="value1 move-x move-y"></div> </div> <div class="rainbow" name="rainbow"> <div class="value2 move-x"></div> </div> <div class="alpha" name="alpha"> <div class="alpha-bg"></div> <div class="value2 move-x"></div> </div></div>',c+="<div class=\"w2ui-color-tabs\"> <div class=\"w2ui-color-tab selected\" onclick=\"jQuery(this).addClass('selected').next().removeClass('selected').parents('.w2ui-overlay').find('.w2ui-color-advanced').hide().parent().find('.w2ui-color-palette').show(); jQuery.fn._colorAdvanced = false; jQuery('#w2ui-overlay')[0].resize()\"><span class=\"w2ui-icon w2ui-icon-colors\"></span></div> <div class=\"w2ui-color-tab\" onclick=\"jQuery(this).addClass('selected').prev().removeClass('selected').parents('.w2ui-overlay').find('.w2ui-color-advanced').show().parent().find('.w2ui-color-palette').hide(); jQuery.fn._colorAdvanced = true; jQuery('#w2ui-overlay')[0].resize()\"><span class=\"w2ui-icon w2ui-icon-settings\"></span></div></div></div><div style=\"clear: both; height: 0\"></div>"}var e=a(this),f=e[0];if(e.data("skipInit"))return void e.removeData("skipInit");var g=[-1,-1];null==a.fn.w2colorPalette&&(a.fn.w2colorPalette=[["000000","333333","555555","777777","888888","999999","AAAAAA","CCCCCC","DDDDDD","EEEEEE","F7F7F7","FFFFFF"],["FF011B","FF9838","FFC300","FFFD59","86FF14","14FF7A","2EFFFC","2693FF","006CE7","9B24F4","FF21F5","FF0099"],["FFEAEA","FCEFE1","FCF4DC","FFFECF","EBFFD9","D9FFE9","E0FFFF","E8F4FF","ECF4FC","EAE6F4","FFF5FE","FCF0F7"],["F4CCCC","FCE5CD","FFF1C2","FFFDA1","D5FCB1","B5F7D0","BFFFFF","D6ECFF","CFE2F3","D9D1E9","FFE3FD","FFD9F0"],["EA9899","F9CB9C","FFE48C","F7F56F","B9F77E","84F0B1","83F7F7","B5DAFF","9FC5E8","B4A7D6","FAB9F6","FFADDE"],["E06666","F6B26B","DEB737","E0DE51","8FDB48","52D189","4EDEDB","76ACE3","6FA8DC","8E7CC3","E07EDA","F26DBD"],["CC0814","E69138","AB8816","B5B20E","6BAB30","27A85F","1BA8A6","3C81C7","3D85C6","674EA7","A14F9D","BF4990"],["99050C","B45F17","80650E","737103","395E14","10783D","13615E","094785","0A5394","351C75","780172","782C5A"]]);var h=a.fn.w2colorPalette;"string"==typeof b&&(b={color:b,transparent:!0}),null==b.onSelect&&null!=c&&(b.onSelect=c),b.transparent&&"333333"==h[0][1]&&(h[0].splice(1,1),h[0].push("")),b.transparent||"333333"==h[0][1]||(h[0].splice(1,0,"333333"),h[0].pop()),b.color&&(b.color=String(b.color).toUpperCase()),"#"==b.color.substr(0,1)&&(b.color=b.color.substr(1)),null==b.fireChange&&(b.fireChange=!0),0===a("#w2ui-overlay").length?a(f).w2overlay(d(b),b):a("#w2ui-overlay .w2ui-color").parent().html(d(b)),a("#w2ui-overlay .color").off(".w2color").on("mousedown.w2color",function(c){var d="#"+a(c.originalEvent.target).attr("name");"#"==d&&(d=""),g=a(c.originalEvent.target).attr("index").split(":"),"INPUT"==f.tagName?(a(f).val(d).data("skipInit",!0),b.fireChange&&a(f).change(),a(f).next().find(">div").css("background-color",d)):a(f).data("_color",d),"function"==typeof b.onSelect&&b.onSelect(d)}).on("mouseup.w2color",function(){setTimeout(function(){a("#w2ui-overlay").length>0&&a("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)}),a("#w2ui-overlay .color-original").off(".w2color").on("click.w2color",function(b){var c=w2utils.parseColor(a(b.target).css("background-color"));null!=c&&(k=c,j=w2utils.rgb2hsv(k),l(j),m(),n())}),a("#w2ui-overlay input").off(".w2color").on("mousedown.w2color",function(b){a("#w2ui-overlay").data("keepOpen",!0),setTimeout(function(){a("#w2ui-overlay").data("keepOpen",!0)},10),b.stopPropagation()}).on("change.w2color",function(){var b=a(this),c=parseFloat(b.val()),d=parseFloat(b.attr("max"));isNaN(c)&&(c=0),d>1&&(c=parseInt(c)),d>0&&c>d&&(b.val(d),c=d),c<0&&(b.val(0),c=0);var e=b.attr("name"),f={};["r","g","b","a"].indexOf(e)!=-1?(k[e]=c,j=w2utils.rgb2hsv(k)):["h","s","v"].indexOf(e)!=-1&&(f[e]=c),l(f),m(),n()});var i,j,k=w2utils.parseColor(b.color);null==k&&(k={r:140,g:150,b:160,a:1},j=w2utils.rgb2hsv(k)),j=w2utils.rgb2hsv(k);var l=function(c,d){null!=c.h&&(j.h=c.h),null!=c.s&&(j.s=c.s),null!=c.v&&(j.v=c.v),null!=c.a&&(k.a=c.a,j.a=c.a),k=w2utils.hsv2rgb(j);var e="rgba("+k.r+","+k.g+","+k.b+","+k.a+")",g=[Number(k.r).toString(16).toUpperCase(),Number(k.g).toString(16).toUpperCase(),Number(k.b).toString(16).toUpperCase()];g.forEach(function(a,b){1==a.length&&(g[b]="0"+a)}),1==k.a&&(e="#"+g[0]+g[1]+g[2]),a("#w2ui-overlay .color-preview").css("background-color",e),a("#w2ui-overlay input").each(function(a,b){b.name&&(null!=k[b.name]&&(b.value=k[b.name]),null!=j[b.name]&&(b.value=j[b.name]),"a"==b.name&&(b.value=k.a))}),d?a("#w2ui-overlay .color-original").css("background-color",e):("INPUT"==f.tagName?(a(f).val(e).data("skipInit",!0),b.fireChange&&a(f).change(),a(f).next().find(">div").css("background-color",e)):a(f).data("_color",e),"function"==typeof b.onSelect&&b.onSelect(e))},m=function(){var b=a("#w2ui-overlay .palette .value1"),c=a("#w2ui-overlay .rainbow .value2"),d=a("#w2ui-overlay .alpha .value2"),e=parseInt(b.width())/2,f=parseInt(c.width())/2;b.css({left:150*j.s/100-e,top:125*(100-j.v)/100-e}),c.css("left",j.h/2.4-f),d.css("left",150*k.a-f)},n=function(){var b=w2utils.hsv2rgb(j.h,100,100),c=b.r+","+b.g+","+b.b;a("#w2ui-overlay .palette").css("background-image","linear-gradient(90deg, rgba("+c+",0) 0%, rgba("+c+",1) 100%)")},o=function(b){var c=a(this).find(".value1, .value2"),d=parseInt(c.width())/2;c.hasClass("move-x")&&c.css({left:b.offsetX-d+"px"}),c.hasClass("move-y")&&c.css({top:b.offsetY-d+"px"}),i={$el:c,x:b.pageX,y:b.pageY,width:c.parent().width(),height:c.parent().height(),left:parseInt(c.css("left")),top:parseInt(c.css("top"))},q(b),a("body").off(".w2color").on(t,q).on(s,p)},p=function(b){a("body").off(".w2color")},q=function(a){var b=i.$el,c=a.pageX-i.x,d=a.pageY-i.y,e=i.left+c,f=i.top+d,g=parseInt(b.width())/2;e<-g&&(e=-g),f<-g&&(f=-g),e>i.width-g&&(e=i.width-g),f>i.height-g&&(f=i.height-g),b.hasClass("move-x")&&b.css({left:e+"px"}),b.hasClass("move-y")&&b.css({top:f+"px"});var h=parseInt(b.css("left"))+g,j=parseInt(b.css("top"))+g,k=b.parent().attr("name");if("palette"==k&&l({s:Math.round(h/b.parent().width()*100),v:Math.round(100-j/b.parent().height()*100)}),"rainbow"==k){var m=Math.round(2.4*h);l({h:m}),n()}"alpha"==k&&l({a:parseFloat(Number(h/150).toFixed(2))})};a.fn._colorAdvanced!==!0&&b.advanced!==!0||a("#w2ui-overlay .w2ui-color-tabs :nth-child(2)").click(),l({},!0),n(),m();var r="mousedown.w2color",s="mouseup.w2color",t="mousemove.w2color";w2utils.isIOS&&(r="touchstart.w2color",s="touchend.w2color",t="touchmove.w2color "),a("#w2ui-overlay .palette").off(".w2color").on("mousedown.w2color",o),a("#w2ui-overlay .rainbow").off(".w2color").on("mousedown.w2color",o),a("#w2ui-overlay .alpha").off(".w2color").on("mousedown.w2color",o),f.nav=function(b){switch(b){case"up":g[0]--;break;case"down":g[0]++;break;case"right":g[1]++;break;case"left":g[1]--}return g[0]<0&&(g[0]=0),g[0]>h.length-2&&(g[0]=h.length-2),g[1]<0&&(g[1]=0),g[1]>h[0].length-1&&(g[1]=h[0].length-1),color=h[g[0]][g[1]],a(f).data("_color",color),color}}}(jQuery),function(a,b){if("function"==typeof define&&define.amd)return define(function(){
return b});if("undefined"!=typeof exports){if("undefined"!=typeof module&&module.exports)return exports=module.exports=b;a=exports}for(var c in b)a[c]=b[c]}(this,{w2ui:w2ui,w2obj:w2obj,w2utils:w2utils}),function(a){var b=function(b){this.el=null,this.helpers={},this.type=b.type||"text",this.options=a.extend(!0,{},b),this.onSearch=b.onSearch||null,this.onRequest=b.onRequest||null,this.onLoad=b.onLoad||null,this.onError=b.onError||null,this.onClick=b.onClick||null,this.onAdd=b.onAdd||null,this.onNew=b.onNew||null,this.onRemove=b.onRemove||null,this.onMouseOver=b.onMouseOver||null,this.onMouseOut=b.onMouseOut||null,this.onIconClick=b.onIconClick||null,this.onScroll=b.onScroll||null,this.tmp={},delete this.options.type,delete this.options.onSearch,delete this.options.onRequest,delete this.options.onLoad,delete this.options.onError,delete this.options.onClick,delete this.options.onMouseOver,delete this.options.onMouseOut,delete this.options.onIconClick,delete this.options.onScroll,a.extend(!0,this,w2obj.field)};a.fn.w2field=function(c,d){if(0!==this.length){if(0===arguments.length){var e=a(this).data("w2field");return e}return"string"==typeof c&&"object"==typeof d&&(c=a.extend(!0,{},d,{type:c})),"string"==typeof c&&null==d&&(c={type:c}),c&&(c.type=String(c.type).toLowerCase()),this.each(function(d,e){var f=a(e).data("w2field");if(null==f){var f=new b(c);return a.extend(f,{handlers:[]}),e&&(f.el=a(e)[0]),f.init(),a(e).data("w2field",f),f}if(f.clear(),"clear"!=c.type){var f=new b(c);return a.extend(f,{handlers:[]}),e&&(f.el=a(e)[0]),f.init(),a(e).data("w2field",f),f}})}var f=b.prototype;if(f[c])return f[c].apply(f,Array.prototype.slice.call(arguments,1))},b.prototype={custom:{},addType:function(a,b){return a=String(a).toLowerCase(),this.custom[a]=b,!0},removeType:function(a){return a=String(a).toLowerCase(),!!this.custom[a]&&(delete this.custom[a],!0)},init:function(){var b,c=this,d=this.options;if("function"==typeof this.custom[this.type])return void this.custom[this.type].call(this,d);if(["INPUT","TEXTAREA"].indexOf(this.el.tagName.toUpperCase())==-1)return void console.log("ERROR: w2field could only be applied to INPUT or TEXTAREA.",this.el);switch(this.type){case"text":case"int":case"float":case"money":case"currency":case"percent":case"alphanumeric":case"bin":case"hex":b={min:null,max:null,step:1,autoFormat:!0,currencyPrefix:w2utils.settings.currencyPrefix,currencySuffix:w2utils.settings.currencySuffix,currencyPrecision:w2utils.settings.currencyPrecision,decimalSymbol:w2utils.settings.decimalSymbol,groupSymbol:w2utils.settings.groupSymbol,arrows:!1,keyboard:!0,precision:null,silent:!0,prefix:"",suffix:""},this.options=a.extend(!0,{},b,d),d=this.options,d.numberRE=new RegExp("["+d.groupSymbol+"]","g"),d.moneyRE=new RegExp("["+d.currencyPrefix+d.currencySuffix+d.groupSymbol+"]","g"),d.percentRE=new RegExp("["+d.groupSymbol+"%]","g"),["text","alphanumeric","hex","bin"].indexOf(this.type)!=-1&&(d.arrows=!1,d.keyboard=!1),this.addPrefix(),this.addSuffix();break;case"color":b={prefix:"",suffix:'<div style="width: '+(parseInt(a(this.el).css("font-size"))||12)+'px"> </div>',arrows:!1,keyboard:!1,advanced:null,transparent:!0},a.extend(d,b),this.addPrefix(),this.addSuffix(),""!==a(this.el).val()&&setTimeout(function(){c.change()},1);break;case"date":b={format:w2utils.settings.dateFormat,keyboard:!0,silent:!0,start:"",end:"",blocked:{},colored:{},blockWeekDays:null},this.options=a.extend(!0,{},b,d),d=this.options,null==a(this.el).attr("placeholder")&&a(this.el).attr("placeholder",d.format);break;case"time":b={format:w2utils.settings.timeFormat,keyboard:!0,silent:!0,start:"",end:"",noMinutes:!1},this.options=a.extend(!0,{},b,d),d=this.options,null==a(this.el).attr("placeholder")&&a(this.el).attr("placeholder",d.format);break;case"datetime":b={format:w2utils.settings.dateFormat+" | "+w2utils.settings.timeFormat,keyboard:!0,silent:!0,start:"",end:"",blocked:[],colored:{},placeholder:null,btn_now:!0,noMinutes:!1},this.options=a.extend(!0,{},b,d),d=this.options,null==a(this.el).attr("placeholder")&&a(this.el).attr("placeholder",d.placeholder||d.format);break;case"list":case"combo":if(b={items:[],selected:{},url:null,recId:null,recText:null,method:null,interval:350,postData:{},minLength:1,cacheMax:250,maxDropHeight:350,maxDropWidth:null,match:"begins",silent:!0,icon:null,iconStyle:"",onSearch:null,onRequest:null,onLoad:null,onError:null,onIconClick:null,renderDrop:null,compare:null,filter:!0,prefix:"",suffix:"",openOnFocus:!1,markSearch:!1},d.items=this.normMenu(d.items),"list"==this.type){if(b.openOnFocus=!0,a(this.el).addClass("w2ui-select"),!a.isPlainObject(d.selected)&&d.items)for(var e=0;e<d.items.length;e++){var f=d.items[e];if(f&&f.id==d.selected){d.selected=a.extend(!0,{},f);break}}this.watchSize()}d=a.extend({},b,d,{align:"both",altRows:!0}),this.options=d,a.isPlainObject(d.selected)||(d.selected={}),a(this.el).data("selected",d.selected),d.url&&(d.items=[],this.request(0)),"list"==this.type&&this.addFocus(),this.addPrefix(),this.addSuffix(),setTimeout(function(){c.refresh()},10),a(this.el).attr("autocomplete","off"),null!=d.selected.text&&a(this.el).val(d.selected.text);break;case"enum":b={items:[],selected:[],max:0,url:null,recId:null,recText:null,interval:350,method:null,postData:{},minLength:1,cacheMax:250,maxWidth:250,maxHeight:350,maxDropHeight:350,maxDropWidth:null,match:"contains",silent:!0,openOnFocus:!1,markSearch:!0,renderDrop:null,renderItem:null,compare:null,filter:!0,style:"",onSearch:null,onRequest:null,onLoad:null,onError:null,onClick:null,onAdd:null,onNew:null,onRemove:null,onMouseOver:null,onMouseOut:null,onScroll:null},d=a.extend({},b,d,{align:"both",suffix:"",altRows:!0}),d.items=this.normMenu(d.items),d.selected=this.normMenu(d.selected),this.options=d,a.isArray(d.selected)||(d.selected=[]),a(this.el).data("selected",d.selected),d.url&&(d.items=[],this.request(0)),this.addSuffix(),this.addMulti(),this.watchSize();break;case"file":b={selected:[],max:0,maxSize:0,maxFileSize:0,maxWidth:250,maxHeight:350,maxDropHeight:350,maxDropWidth:null,readContent:!0,silent:!0,renderItem:null,style:"",onClick:null,onAdd:null,onRemove:null,onMouseOver:null,onMouseOut:null},d=a.extend({},b,d,{align:"both",altRows:!0}),this.options=d,a.isArray(d.selected)||(d.selected=[]),a(this.el).data("selected",d.selected),null==a(this.el).attr("placeholder")&&a(this.el).attr("placeholder",w2utils.lang("Attach files by dragging and dropping or Click to Select")),this.addMulti(),this.watchSize()}this.tmp={onChange:function(a){c.change.call(c,a)},onClick:function(a){c.click.call(c,a)},onFocus:function(a){c.focus.call(c,a)},onBlur:function(a){c.blur.call(c,a)},onKeydown:function(a){c.keyDown.call(c,a)},onKeyup:function(a){c.keyUp.call(c,a)},onKeypress:function(a){c.keyPress.call(c,a)}},a(this.el).addClass("w2field w2ui-input").data("w2field",this).on("change.w2field",this.tmp.onChange).on("click.w2field",this.tmp.onClick).on("focus.w2field",this.tmp.onFocus).on("blur.w2field",this.tmp.onBlur).on("keydown.w2field",this.tmp.onKeydown).on("keyup.w2field",this.tmp.onKeyup).on("keypress.w2field",this.tmp.onKeypress).css(w2utils.cssPrefix("box-sizing","border-box")),this.change(a.Event("change"))},watchSize:function(){var b=this,c=a(b.el).data("tmp")||{};c.sizeTimer=setInterval(function(){a(b.el).parents("body").length>0?b.resize():clearInterval(c.sizeTimer)},200),a(b.el).data("tmp",c)},get:function(){var b;return b=["list","enum","file"].indexOf(this.type)!=-1?a(this.el).data("selected"):a(this.el).val()},set:function(b,c){if(["list","enum","file"].indexOf(this.type)!=-1){if("list"!=this.type&&c)null==a(this.el).data("selected")&&a(this.el).data("selected",[]),a(this.el).data("selected").push(b),a(this.el).change();else{var d="enum"==this.type?[b]:b;a(this.el).data("selected",d).change()}this.refresh()}else a(this.el).val(b)},setIndex:function(b,c){if(["list","enum"].indexOf(this.type)!=-1){var d=this.options.items;if(d&&d[b]){if("list"!=this.type&&c)null==a(this.el).data("selected")&&a(this.el).data("selected",[]),a(this.el).data("selected").push(d[b]),a(this.el).change();else{var e="enum"==this.type?[d[b]]:d[b];a(this.el).data("selected",e).change()}return this.refresh(),!0}}return!1},clear:function(){var b=this.options;["money","currency"].indexOf(this.type)!=-1&&a(this.el).val(a(this.el).val().replace(b.moneyRE,"")),"percent"==this.type&&a(this.el).val(a(this.el).val().replace(/%/g,"")),"list"==this.type&&a(this.el).removeClass("w2ui-select"),this.type="clear";var c=a(this.el).data("tmp");if(this.tmp){null!=c&&(a(this.el).height("auto"),c&&c["old-padding-left"]&&a(this.el).css("padding-left",c["old-padding-left"]),c&&c["old-padding-right"]&&a(this.el).css("padding-right",c["old-padding-right"]),c&&c["old-background-color"]&&a(this.el).css("background-color",c["old-background-color"]),c&&c["old-border-color"]&&a(this.el).css("border-color",c["old-border-color"]),clearInterval(c.sizeTimer)),a(this.el).val(this.clean(a(this.el).val())).removeClass("w2field").removeData().off(".w2field");for(var d in this.helpers)a(this.helpers[d]).remove();this.helpers={}}},refresh:function(){var b=this,c=this.options,d=a(this.el).data("selected"),e=(new Date).getTime();if(["list"].indexOf(this.type)!=-1&&(a(b.el).parent().css("white-space","nowrap"),b.helpers.prefix&&b.helpers.prefix.hide(),setTimeout(function(){if(b.helpers.focus){!a.isEmptyObject(d)&&c.icon?(c.prefix='<span class="w2ui-icon '+c.icon+'"style="cursor: pointer; font-size: 14px; display: inline-block; margin-top: -1px; color: #7F98AD;'+c.iconStyle+'"></span>',b.addPrefix()):(c.prefix="",b.addPrefix());var e=b.helpers.focus.find("input");""===a(e).val()?(a(e).css("text-indent","-9999em").prev().css("opacity",0),a(b.el).val(d&&null!=d.text?w2utils.lang(d.text):"")):(a(e).css("text-indent",0).prev().css("opacity",1),a(b.el).val(""),setTimeout(function(){b.helpers.prefix&&b.helpers.prefix.hide();var d="position: absolute; opacity: 0; margin: 4px 0px 0px 2px; background-position: left !important;";c.icon?(a(e).css("margin-left","17px"),a(b.helpers.focus).find(".icon-search").attr("style",d+"width: 11px !important; opacity: 1; display: block")):(a(e).css("margin-left","0px"),a(b.helpers.focus).find(".icon-search").attr("style",d+"width: 0px !important; opacity: 0; display: none"))},1)),a(b.el).prop("readonly")||a(b.el).prop("disabled")?setTimeout(function(){a(b.helpers.prefix).css("opacity","0.6"),a(b.helpers.suffix).css("opacity","0.6")},1):setTimeout(function(){a(b.helpers.prefix).css("opacity","1"),a(b.helpers.suffix).css("opacity","1")},1)}},1)),["enum","file"].indexOf(this.type)!=-1){var f="";if(d)for(var g=0;g<d.length;g++){var h=d[g],i="";i="function"==typeof c.renderItem?c.renderItem(h,g,'<div class="w2ui-list-remove" title="'+w2utils.lang("Remove")+'" index="'+g+'">  </div>'):'<div class="w2ui-list-remove" title="'+w2utils.lang("Remove")+'" index="'+g+'">  </div>'+("enum"==b.type?h.text:h.name+'<span class="file-size"> - '+w2utils.formatSize(h.size)+"</span>"),f+='<li index="'+g+'" style="max-width: '+parseInt(c.maxWidth)+"px; "+(h.style?h.style:"")+'">'+i+"</li>"}var j=b.helpers.multi,k=j.find("ul");if(j.attr("style",j.attr("style")+";"+c.style),a(b.el).css("z-index","-1"),a(b.el).prop("readonly")||a(b.el).prop("disabled")?setTimeout(function(){j[0].scrollTop=0,j.addClass("w2ui-readonly").find("li").css("opacity","0.9").parent().find("li.nomouse").hide().find("input").prop("readonly",!0).parents("ul").find(".w2ui-list-remove").hide()},1):setTimeout(function(){j.removeClass("w2ui-readonly").find("li").css("opacity","1").parent().find("li.nomouse").show().find("input").prop("readonly",!1).parents("ul").find(".w2ui-list-remove").show()},1),j.find(".w2ui-enum-placeholder").remove(),k.find("li").not("li.nomouse").remove(),""!==f)k.prepend(f);else if(null!=a(b.el).attr("placeholder")&&""===j.find("input").val()){var l="padding-top: "+a(this.el).css("padding-top")+";padding-left: "+a(this.el).css("padding-left")+"; box-sizing: "+a(this.el).css("box-sizing")+"; line-height: "+a(this.el).css("line-height")+"; font-size: "+a(this.el).css("font-size")+"; font-family: "+a(this.el).css("font-family")+"; ";j.prepend('<div class="w2ui-enum-placeholder" style="'+l+'">'+a(b.el).attr("placeholder")+"</div>")}j.off("scroll.w2field").on("scroll.w2field",function(c){var d=b.trigger({phase:"before",type:"scroll",target:b.el,originalEvent:c});d.isCancelled!==!0&&b.trigger(a.extend(d,{phase:"after"}))}).find("li").data("mouse","out").on("click",function(c){var e="LI"==c.target.tagName.toUpperCase()?c.target:a(c.target).parents("LI"),f=d[a(e).attr("index")];if(!a(e).hasClass("nomouse"))if(c.stopPropagation(),a(c.target).hasClass("w2ui-list-remove")){if(a(b.el).prop("readonly")||a(b.el).prop("disabled"))return;var g=b.trigger({phase:"before",type:"remove",target:b.el,originalEvent:c.originalEvent,item:f});if(g.isCancelled===!0)return;a().w2overlay(),d.splice(a(c.target).attr("index"),1),a(b.el).trigger("change"),a(c.target).parent().fadeOut("fast"),setTimeout(function(){b.refresh(),b.trigger(a.extend(g,{phase:"after"}))},300)}else{var g=b.trigger({phase:"before",type:"click",target:b.el,originalEvent:c.originalEvent,item:f});if(g.isCancelled===!0)return;if("file"==b.type){var h="";/image/i.test(f.type)&&(h='<div style="padding: 3px;"> <img src="'+(f.content?"data:"+f.type+";base64,"+f.content:"")+'" style="max-width: 300px;" onload="var w = jQuery(this).width(); var h = jQuery(this).height(); if (w < 300 & h < 300) return; if (w >= h && w > 300) jQuery(this).width(300); if (w < h && h > 300) jQuery(this).height(300);" onerror="this.style.display = \'none\'" ></div>');var i='style="padding: 3px; text-align: right; color: #777;"',j='style="padding: 3px"';h+='<div style="padding: 8px;"> <table cellpadding="2"><tbody> <tr><td '+i+">"+w2utils.lang("Name")+":</td><td "+j+">"+f.name+"</td></tr> <tr><td "+i+">"+w2utils.lang("Size")+":</td><td "+j+">"+w2utils.formatSize(f.size)+"</td></tr> <tr><td "+i+">"+w2utils.lang("Type")+":</td><td "+j+'> <span style="width: 200px; display: block-inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap="nowrap";">'+f.type+"</span> </td></tr> <tr><td "+i+">"+w2utils.lang("Modified")+":</td><td "+j+">"+w2utils.date(f.modified)+"</td></tr> </tbody></table></div>",a("#w2ui-overlay").remove(),a(e).w2overlay(h)}b.trigger(a.extend(g,{phase:"after"}))}}).on("mouseover",function(c){var e="LI"==c.target.tagName.toUpperCase()?c.target:a(c.target).parents("LI");if(!a(e).hasClass("nomouse")){if("out"==a(e).data("mouse")){var f=d[a(c.target).attr("index")],g=b.trigger({phase:"before",type:"mouseOver",target:b.el,originalEvent:c.originalEvent,item:f});if(g.isCancelled===!0)return;b.trigger(a.extend(g,{phase:"after"}))}a(e).data("mouse","over")}}).on("mouseout",function(c){var e="LI"==c.target.tagName.toUpperCase()?c.target:a(c.target).parents("LI");a(e).hasClass("nomouse")||(a(e).data("mouse","leaving"),setTimeout(function(){if("leaving"==a(e).data("mouse")){a(e).data("mouse","out");var f=d[a(c.target).attr("index")],g=b.trigger({phase:"before",type:"mouseOut",target:b.el,originalEvent:c.originalEvent,item:f});if(g.isCancelled===!0)return;b.trigger(a.extend(g,{phase:"after"}))}},0))}),a(this.el).height("auto");var m=a(j).find("> div.w2ui-multi-items").height()+2*w2utils.getSize(j,"+height");m<26&&(m=26),m>c.maxHeight&&(m=c.maxHeight),j.length>0&&(j[0].scrollTop=1e3);var n=w2utils.getSize(a(this.el),"height")-2;if(n>m&&(m=n),a(j).css({height:m+"px",overflow:m==c.maxHeight?"auto":"hidden"}),m<c.maxHeight&&a(j).prop("scrollTop",0),a(this.el).css({height:m+2+"px"}),"enum"==b.type){var o=b.helpers.multi.find("input");o.width(8*(o.val().length+2)+"px")}}return(new Date).getTime()-e},reset:function(){var a=this.type;this.clear(),this.type=a,this.init()},resize:function(){var b=this,c=a(b.el).width(),d=a(b.el).height();if(!(b.tmp.current_width==c&&d>0)){var e=this.helpers.focus,f=this.helpers.multi,g=this.helpers.suffix,h=this.helpers.prefix;if(e&&e.width(a(b.el).width()),f){var i=w2utils.getSize(b.el,"width")-parseInt(a(b.el).css("margin-left"),10)-parseInt(a(b.el).css("margin-right"),10);a(f).width(i)}g&&(b.options.suffix='<div class="arrow-down" style="margin-top: '+(parseInt(a(b.el).height())-6)/2+'px;"></div>',b.addSuffix()),h&&b.addPrefix(),b.tmp.current_width=c}},clean:function(b){if("number"==typeof b)return b;var c=this.options;return b=String(b).trim(),["int","float","money","currency","percent"].indexOf(this.type)!=-1&&("string"==typeof b&&(c.autoFormat&&["money","currency"].indexOf(this.type)!=-1&&(b=String(b).replace(c.moneyRE,"")),c.autoFormat&&"percent"==this.type&&(b=String(b).replace(c.percentRE,"")),c.autoFormat&&["int","float"].indexOf(this.type)!=-1&&(b=String(b).replace(c.numberRE,"")),b=b.replace(/\s+/g,"").replace(w2utils.settings.groupSymbol,"").replace(w2utils.settings.decimalSymbol,".")),parseFloat(b)==b&&(null!=c.min&&b<c.min&&(b=c.min,a(this.el).val(c.min)),null!=c.max&&b>c.max&&(b=c.max,a(this.el).val(c.max))),b=""!==b&&w2utils.isFloat(b)?Number(b):""),b},format:function(a){var b=this.options;if(b.autoFormat&&""!==a)switch(this.type){case"money":case"currency":a=w2utils.formatNumber(a,b.currencyPrecision,b.groupSymbol),""!==a&&(a=b.currencyPrefix+a+b.currencySuffix);break;case"percent":a=w2utils.formatNumber(a,b.precision,b.groupSymbol),""!==a&&(a+="%");break;case"float":a=w2utils.formatNumber(a,b.precision,b.groupSymbol);break;case"int":a=w2utils.formatNumber(a,0,b.groupSymbol)}return a},change:function(b){var c=this,d=c.options;if(["int","float","money","currency","percent"].indexOf(this.type)!=-1){var e=a(this.el).val(),f=this.format(this.clean(a(this.el).val()));if(""!==e&&e!=f)return a(this.el).val(f).change(),b.stopPropagation(),b.preventDefault(),!1}if("color"==this.type){var g="#"+a(this.el).val();6!=a(this.el).val().length&&3!=a(this.el).val().length&&(g=""),a(this.el).next().find("div").css("background-color",g),a(c.el).is(":focus")&&this.updateOverlay()}if(["list","enum","file"].indexOf(this.type)!=-1&&(c.refresh(),setTimeout(function(){c.refresh()},5)),["date","time","datetime"].indexOf(this.type)!=-1){var h=parseInt(c.el.value);w2utils.isInt(c.el.value)&&h>3e3&&("time"==this.type&&a(c.el).val(w2utils.formatTime(new Date(h),d.format)).change(),"date"==this.type&&a(c.el).val(w2utils.formatDate(new Date(h),d.format)).change(),"datetime"==this.type&&a(c.el).val(w2utils.formatDateTime(new Date(h),d.format)).change())}},click:function(b){b.stopPropagation(),["list","combo","enum"].indexOf(this.type)!=-1&&(a(this.el).is(":focus")||this.focus(b)),["date","time","color","datetime"].indexOf(this.type)!=-1&&this.updateOverlay()},focus:function(b){var c=this;this.options;if(["color","date","time","datetime"].indexOf(c.type)!==-1){if(a(c.el).prop("readonly")||a(c.el).prop("disabled"))return;a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),setTimeout(function(){c.updateOverlay()},150)}if(["list","combo","enum"].indexOf(c.type)!=-1){if(a(c.el).prop("readonly")||a(c.el).prop("disabled"))return;a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),c.resize(),setTimeout(function(){return"list"==c.type&&a(c.el).is(":focus")?void a(c.helpers.focus).find("input").focus():(c.search(),void setTimeout(function(){c.updateOverlay()},1))},1)}"file"==c.type&&a(c.helpers.multi).css({outline:"auto 5px #7DB4F3","outline-offset":"-2px"})},blur:function(b){var c=this,d=c.options,e=a(c.el).val().trim();["color","date","time","list","combo","enum","datetime"].indexOf(c.type)!=-1&&a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),["int","float","money","currency","percent"].indexOf(c.type)!=-1&&(""===e||c.checkType(e)||(a(c.el).val("").change(),d.silent===!1&&(a(c.el).w2tag("Not a valid number"),setTimeout(function(){a(c.el).w2tag("")},3e3)))),["date","time","datetime"].indexOf(c.type)!=-1&&(""===e||c.inRange(c.el.value)?"date"!=c.type||""===e||w2utils.isDate(c.el.value,d.format)?"time"!=c.type||""===e||w2utils.isTime(c.el.value)?"datetime"!=c.type||""===e||w2utils.isDateTime(c.el.value,d.format)||(a(c.el).val("").removeData("selected").change(),d.silent===!1&&(a(c.el).w2tag("Not a valid date"),setTimeout(function(){a(c.el).w2tag("")},3e3))):(a(c.el).val("").removeData("selected").change(),d.silent===!1&&(a(c.el).w2tag("Not a valid time"),setTimeout(function(){a(c.el).w2tag("")},3e3))):(a(c.el).val("").removeData("selected").change(),d.silent===!1&&(a(c.el).w2tag("Not a valid date"),setTimeout(function(){a(c.el).w2tag("")},3e3))):(a(c.el).val("").removeData("selected").change(),d.silent===!1&&(a(c.el).w2tag("Not in range"),setTimeout(function(){a(c.el).w2tag("")},3e3)))),"enum"==c.type&&a(c.helpers.multi).find("input").val("").width(20),"file"==c.type&&a(c.helpers.multi).css({outline:"none"})},keyPress:function(a){var b=this;b.options;if(["int","float","money","currency","percent","hex","bin","color","alphanumeric"].indexOf(b.type)!=-1){if(a.metaKey||a.ctrlKey||a.altKey||a.charCode!=a.keyCode&&a.keyCode>0)return;var c=String.fromCharCode(a.charCode);if(!b.checkType(c,!0)&&13!=a.keyCode)return a.preventDefault(),a.stopPropagation?a.stopPropagation():a.cancelBubble=!0,!1}["date","time","datetime"].indexOf(b.type)!=-1&&9!==a.keyCode&&setTimeout(function(){b.updateOverlay()},1)},keyDown:function(b,c){var d=this,e=d.options,f=b.keyCode||c&&c.keyCode;if(["int","float","money","currency","percent"].indexOf(d.type)!=-1){if(!e.keyboard||a(d.el).prop("readonly")||a(d.el).prop("disabled"))return;var g=!1,h=parseFloat(a(d.el).val().replace(e.moneyRE,""))||0,i=e.step;switch((b.ctrlKey||b.metaKey)&&(i=10),f){case 38:if(b.shiftKey)break;a(d.el).val(h+i<=e.max||null==e.max?Number((h+i).toFixed(12)):e.max).change(),g=!0;break;case 40:if(b.shiftKey)break;a(d.el).val(h-i>=e.min||null==e.min?Number((h-i).toFixed(12)):e.min).change(),g=!0}g&&(b.preventDefault(),setTimeout(function(){d.el.setSelectionRange(d.el.value.length,d.el.value.length)},0))}if("date"==d.type){if(!e.keyboard||a(d.el).prop("readonly")||a(d.el).prop("disabled"))return;var g=!1,j=864e5,i=1;(b.ctrlKey||b.metaKey)&&(i=10);var k=w2utils.isDate(a(d.el).val(),e.format,!0);switch(k||(k=new Date,j=0),f){case 38:if(b.shiftKey)break;var l=w2utils.formatDate(k.getTime()+j,e.format);10==i&&(l=w2utils.formatDate(new Date(k.getFullYear(),k.getMonth()+1,k.getDate()),e.format)),a(d.el).val(l).change(),g=!0;break;case 40:if(b.shiftKey)break;var l=w2utils.formatDate(k.getTime()-j,e.format);10==i&&(l=w2utils.formatDate(new Date(k.getFullYear(),k.getMonth()-1,k.getDate()),e.format)),a(d.el).val(l).change(),g=!0}g&&(b.preventDefault(),setTimeout(function(){d.el.setSelectionRange(d.el.value.length,d.el.value.length),d.updateOverlay()},0))}if("time"==d.type){if(!e.keyboard||a(d.el).prop("readonly")||a(d.el).prop("disabled"))return;var g=!1,i=b.ctrlKey||b.metaKey?60:1,h=a(d.el).val(),m=d.toMin(h)||d.toMin((new Date).getHours()+":"+((new Date).getMinutes()-1));switch(f){case 38:if(b.shiftKey)break;m+=i,g=!0;break;case 40:if(b.shiftKey)break;m-=i,g=!0}g&&(a(d.el).val(d.fromMin(m)).change(),b.preventDefault(),setTimeout(function(){d.el.setSelectionRange(d.el.value.length,d.el.value.length)},0))}if("datetime"==d.type){if(!e.keyboard||a(d.el).prop("readonly")||a(d.el).prop("disabled"))return;var g=!1,j=864e5,i=1;(b.ctrlKey||b.metaKey)&&(i=10);var n=a(d.el).val(),k=w2utils.isDateTime(n,this.options.format,!0);switch(k||(k=new Date,j=0),f){case 38:if(b.shiftKey)break;var l=w2utils.formatDateTime(k.getTime()+j,e.format);10==i&&(l=w2utils.formatDateTime(new Date(k.getFullYear(),k.getMonth()+1,k.getDate()),e.format)),a(d.el).val(l).change(),g=!0;break;case 40:if(b.shiftKey)break;var l=w2utils.formatDateTime(k.getTime()-j,e.format);10==i&&(l=w2utils.formatDateTime(new Date(k.getFullYear(),k.getMonth()-1,k.getDate()),e.format)),a(d.el).val(l).change(),g=!0}g&&(b.preventDefault(),setTimeout(function(){d.el.setSelectionRange(d.el.value.length,d.el.value.length),d.updateOverlay()},0))}if("color"==d.type){if(a(d.el).prop("readonly")||a(d.el).prop("disabled"))return;if((b.ctrlKey||b.metaKey)&&!b.shiftKey){var o=null,p=null;switch(f){case 38:o="up";break;case 40:o="down";break;case 39:o="right";break;case 37:o="left"}d.el.nav&&null!=o&&(p=d.el.nav(o),a(d.el).val(p).change(),b.preventDefault())}}if(["list","combo","enum"].indexOf(d.type)!=-1){if(a(d.el).prop("readonly")||a(d.el).prop("disabled"))return;var q=a(d.el).data("selected"),r=a(d.el),s=!1;switch(["list","enum"].indexOf(d.type)!=-1&&("list"==d.type&&(r=a(d.helpers.focus).find("input")),"enum"==d.type&&(r=a(d.helpers.multi).find("input")),[37,38,39,40].indexOf(f)==-1&&setTimeout(function(){d.refresh()},1),86==b.keyCode&&(b.ctrlKey||b.metaKey)&&setTimeout(function(){d.refresh(),d.search(),d.request()},50)),f){case 27:"list"==d.type&&(""!==r.val()&&r.val(""),b.stopPropagation());break;case 37:case 39:break;case 13:if(0===a("#w2ui-overlay").length)break;var t=e.items[e.index];if("enum"==d.type)if(null!=t){var u=d.trigger({phase:"before",type:"add",target:d.el,originalEvent:b.originalEvent,item:t});if(u.isCancelled===!0)return;t=u.item,q.length>=e.max&&e.max>0&&q.pop(),delete t.hidden,delete d.tmp.force_open,q.push(t),a(d.el).change(),r.val("").width(20),d.refresh(),d.trigger(a.extend(u,{phase:"after"}))}else{t={id:r.val(),text:r.val()};var u=d.trigger({phase:"before",type:"new",target:d.el,originalEvent:b.originalEvent,item:t});if(u.isCancelled===!0)return;t=u.item,"function"==typeof d.onNew&&(q.length>=e.max&&e.max>0&&q.pop(),delete d.tmp.force_open,q.push(t),a(d.el).change(),r.val("").width(20),d.refresh()),d.trigger(a.extend(u,{phase:"after"}))}else t&&a(d.el).data("selected",t).val(t.text).change(),""===a(d.el).val()&&a(d.el).data("selected")&&a(d.el).removeData("selected").val("").change(),"list"==d.type&&(r.val(""),d.refresh()),d.tmp.force_hide=!0;break;case 8:case 46:if("enum"==d.type&&8==f&&""===r.val()&&q.length>0){var t=q[q.length-1],u=d.trigger({phase:"before",type:"remove",target:d.el,originalEvent:b.originalEvent,item:t});if(u.isCancelled===!0)return;q.pop(),a(d.el).trigger("change"),d.refresh(),d.trigger(a.extend(u,{phase:"after"}))}"list"==d.type&&""===r.val()&&(a(d.el).data("selected",{}).change(),d.refresh());break;case 38:for(e.index=w2utils.isInt(e.index)?parseInt(e.index):0,e.index--;e.index>0&&e.items[e.index].hidden;)e.index--;if(0===e.index&&e.items[e.index].hidden)for(;e.items[e.index]&&e.items[e.index].hidden;)e.index++;s=!0;break;case 40:for(e.index=w2utils.isInt(e.index)?parseInt(e.index):-1,e.index++;e.index<e.items.length-1&&e.items[e.index].hidden;)e.index++;if(e.index==e.items.length-1&&e.items[e.index].hidden)for(;e.items[e.index]&&e.items[e.index].hidden;)e.index--;""===r.val()&&0===a("#w2ui-overlay").length?d.tmp.force_open=!0:s=!0}if(s)return e.index<0&&(e.index=0),e.index>=e.items.length&&(e.index=e.items.length-1),d.updateOverlay(s),b.preventDefault(),void setTimeout(function(){if("enum"==d.type){var a=r.get(0);a.setSelectionRange(a.value.length,a.value.length)}else if("list"==d.type){var a=r.get(0);a.setSelectionRange(a.value.length,a.value.length)}else d.el.setSelectionRange(d.el.value.length,d.el.value.length)},0);"enum"==d.type&&r.width(8*(r.val().length+2)+"px")}},keyUp:function(b){var c=this;if(["list","combo","enum"].indexOf(this.type)!=-1){if(a(c.el).prop("readonly")||a(c.el).prop("disabled"))return;if([16,17,18,20,37,39,91].indexOf(b.keyCode)==-1){var d=a(this.helpers.focus).find("input");0===d.length&&(d=a(this.el));var e=this.trigger({phase:"before",type:"search",originalEvent:b,target:d,search:d.val()});if(e.isCancelled===!0)return;this.tmp.force_hide||this.request(),1==d.val().length&&this.refresh(),0!==a("#w2ui-overlay").length&&[38,40].indexOf(b.keyCode)!=-1||this.search(),this.trigger(a.extend(e,{phase:"after"}))}}},clearCache:function(){var a=this.options;a.items=[],this.tmp.xhr_loading=!1,this.tmp.xhr_search="",this.tmp.xhr_total=-1},request:function(b){var c=this,d=this.options,e=a(c.el).val()||"";if(d.url){if("enum"==c.type){var f=a(c.helpers.multi).find("input");e=0===f.length?"":f.val()}if("list"==c.type){var f=a(c.helpers.focus).find("input");e=0===f.length?"":f.val()}if(0!==d.minLength&&e.length<d.minLength)return d.items=[],void this.updateOverlay();null==b&&(b=d.interval),null==c.tmp.xhr_search&&(c.tmp.xhr_search=""),null==c.tmp.xhr_total&&(c.tmp.xhr_total=-1),d.url&&a(c.el).prop("readonly")!==!0&&a(c.el).prop("disabled")!==!0&&(0===d.items.length&&0!==c.tmp.xhr_total||c.tmp.xhr_total==d.cacheMax&&e.length>c.tmp.xhr_search.length||e.length>=c.tmp.xhr_search.length&&e.substr(0,c.tmp.xhr_search.length)!=c.tmp.xhr_search||e.length<c.tmp.xhr_search.length)&&(c.tmp.xhr&&c.tmp.xhr.abort(),c.tmp.xhr_loading=!0,c.search(),clearTimeout(c.tmp.timeout),c.tmp.timeout=setTimeout(function(){var b=d.url,f={search:e,max:d.cacheMax};a.extend(f,d.postData);var g=c.trigger({phase:"before",type:"request",search:e,target:c.el,url:b,postData:f});if(g.isCancelled!==!0){b=g.url,f=g.postData;var h={type:"GET",url:b,data:f,dataType:"JSON"};d.method&&(h.type=d.method),"JSON"==w2utils.settings.dataType&&(h.type="POST",h.data=JSON.stringify(h.data),h.contentType="application/json"),"HTTPJSON"==w2utils.settings.dataType&&(h.data={request:JSON.stringify(h.data)}),null!=d.method&&(h.type=d.method),c.tmp.xhr=a.ajax(h).done(function(b,g,h){var i=c.trigger({phase:"before",type:"load",target:c.el,search:f.search,data:b,xhr:h});if(i.isCancelled!==!0){if(b=i.data,"string"==typeof b&&(b=JSON.parse(b)),null==b.records&&null!=b.items&&(b.records=b.items,delete b.items),"success"!=b.status||!Array.isArray(b.records))return void console.log("ERROR: server did not return proper structure. It should return",{status:"success",records:[{id:1,text:"item"}]});b.records.length>d.cacheMax&&b.records.splice(d.cacheMax,1e5),null==d.recId&&null!=d.recid&&(d.recId=d.recid),(d.recId||d.recText)&&b.records.forEach(function(a){"string"==typeof d.recId&&(a.id=a[d.recId]),"function"==typeof d.recId&&(a.id=d.recId(a)),"string"==typeof d.recText&&(a.text=a[d.recText]),"function"==typeof d.recText&&(a.text=d.recText(a))}),c.tmp.xhr_loading=!1,c.tmp.xhr_search=e,c.tmp.xhr_total=b.records.length,d.items=c.normMenu(b.records),""===e&&0===b.records.length?c.tmp.emptySet=!0:c.tmp.emptySet=!1,c.search(),c.trigger(a.extend(i,{phase:"after"}))}}).fail(function(b,d,f){var g={status:d,error:f,rawResponseText:b.responseText},h=c.trigger({phase:"before",type:"error",target:c.el,search:e,error:g,xhr:b});if(h.isCancelled!==!0){if("abort"!=d){var i;try{i=a.parseJSON(b.responseText)}catch(a){}console.log("ERROR: Server communication failed.","\n EXPECTED:",{status:"success",records:[{id:1,text:"item"}]},"\n OR:",{status:"error",message:"error message"},"\n RECEIVED:","object"==typeof i?i:b.responseText)}c.clearCache(),c.search(),c.trigger(a.extend(h,{phase:"after"}))}}),c.trigger(a.extend(g,{phase:"after"}))}},b))}},search:function(){var b=this,c=this.options,d=a(b.el).val(),e=b.el,f=[],g=a(b.el).data("selected");if("enum"==b.type){e=a(b.helpers.multi).find("input"),d=e.val();for(var h in g)g[h]&&f.push(g[h].id)}else if("list"==b.type){e=a(b.helpers.focus).find("input"),d=e.val();for(var h in g)g[h]&&f.push(g[h].id)}if(b.tmp.xhr_loading!==!0){for(var i=0,j=0;j<c.items.length;j++){var k=c.items[j];if(null!=c.compare)"function"==typeof c.compare&&(k.hidden=c.compare.call(this,k,d)===!1);else{var l="",m="";["is","begins"].indexOf(c.match)!=-1&&(l="^"),["is","ends"].indexOf(c.match)!=-1&&(m="$");try{var n=new RegExp(l+d+m,"i");n.test(k.text)||"..."==k.text?k.hidden=!1:k.hidden=!0}catch(a){}}c.filter===!1&&(k.hidden=!1),"enum"==b.type&&a.inArray(k.id,f)!=-1&&(k.hidden=!0),k.hidden!==!0&&(i++,delete k.hidden)}for(c.index=-1;c.items[c.index]&&c.items[c.index].hidden;)c.index++;i<=0&&(c.index=-1),c.spinner=!1,b.updateOverlay(),setTimeout(function(){var b=a("#w2ui-overlay").html()||"";c.markSearch&&b.indexOf("$.fn.w2menuHandler")!=-1&&a("#w2ui-overlay").w2marker(d)},1)}else c.items.splice(0,c.cacheMax),
c.spinner=!0,b.updateOverlay()},updateOverlay:function(b){var c=this,d=this.options;if("color"==this.type){if(a(c.el).prop("readonly")||a(c.el).prop("disabled"))return;a(this.el).w2color({color:a(this.el).val(),transparent:d.transparent,advanced:d.advanced},function(b){null!=b&&a(c.el).val(b).change()})}if("date"==this.type){if(a(c.el).prop("readonly")||a(c.el).prop("disabled"))return;0===a("#w2ui-overlay").length&&a(c.el).w2overlay('<div class="w2ui-reset w2ui-calendar"></div>',{css:{"background-color":"#f5f5f5"},onShow:function(b){w2utils.isIE&&(console.log("IE"),a(".w2ui-calendar").on("mousedown",function(b){var c=a(b.target);1==c.length&&"w2ui-jump-year"==c[0].id&&a("#w2ui-overlay").data("keepOpen",!0)}))}});var e,f,g=w2utils.isDate(a(c.el).val(),c.options.format,!0);g&&(e=g.getMonth()+1,f=g.getFullYear()),function b(d,e){a("#w2ui-overlay > div > div").html(c.getMonthHTML(d,e,a(c.el).val())),a("#w2ui-overlay .w2ui-calendar-title").on("mousedown",function(){if(a(this).next().hasClass("w2ui-calendar-jump"))a(this).next().remove();else{var d,e;a(this).after('<div class="w2ui-calendar-jump" style=""></div>'),a(this).next().hide().html(c.getYearHTML()).fadeIn(200),setTimeout(function(){a("#w2ui-overlay .w2ui-calendar-jump").find(".w2ui-jump-month, .w2ui-jump-year").on("click",function(){a(this).hasClass("w2ui-jump-month")&&(a(this).parent().find(".w2ui-jump-month").removeClass("selected"),a(this).addClass("selected"),e=a(this).attr("name")),a(this).hasClass("w2ui-jump-year")&&(a(this).parent().find(".w2ui-jump-year").removeClass("selected"),a(this).addClass("selected"),d=a(this).attr("name")),null!=d&&null!=e&&(a("#w2ui-overlay .w2ui-calendar-jump").fadeOut(100),setTimeout(function(){b(parseInt(e)+1,d)},100))}),a("#w2ui-overlay .w2ui-calendar-jump >:last-child").prop("scrollTop",2e3)},1)}}),a("#w2ui-overlay .w2ui-date").on("mousedown",function(){var b=a(this).attr("date");a(c.el).val(b).change(),a(this).css({"background-color":"#B6D5FB","border-color":"#aaa"})}).on("mouseup",function(){setTimeout(function(){a("#w2ui-overlay").length>0&&a("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)}),a("#w2ui-overlay .previous").on("mousedown",function(){var a=c.options.current.split("/");a[0]=parseInt(a[0])-1,b(a[0],a[1])}),a("#w2ui-overlay .next").on("mousedown",function(){var a=c.options.current.split("/");a[0]=parseInt(a[0])+1,b(a[0],a[1])})}(e,f)}if("time"==this.type){if(a(c.el).prop("readonly")||a(c.el).prop("disabled"))return;0===a("#w2ui-overlay").length&&a(c.el).w2overlay('<div class="w2ui-reset w2ui-calendar-time" onclick="event.stopPropagation();"></div>',{css:{"background-color":"#fff"}});var h="h24"==this.options.format;a("#w2ui-overlay > div").html(c.getHourHTML()),a("#w2ui-overlay .w2ui-time").on("mousedown",function(b){a(this).css({"background-color":"#B6D5FB","border-color":"#aaa"});var d=a(this).attr("hour");a(c.el).val((d>12&&!h?d-12:d)+":00"+(h?"":d<12?" am":" pm")).change()}),null==this.options.noMinutes||this.options.noMinutes===!1?a("#w2ui-overlay .w2ui-time").on("mouseup",function(){var b=a(this).attr("hour");a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),a(c.el).w2overlay('<div class="w2ui-reset w2ui-calendar-time"></div>',{css:{"background-color":"#fff"}}),a("#w2ui-overlay > div").html(c.getMinHTML(b)),a("#w2ui-overlay .w2ui-time").on("mousedown",function(){a(this).css({"background-color":"#B6D5FB","border-color":"#aaa"});var d=a(this).attr("min");a(c.el).val((b>12&&!h?b-12:b)+":"+(d<10?0:"")+d+(h?"":b<12?" am":" pm")).change()}).on("mouseup",function(){setTimeout(function(){a("#w2ui-overlay").length>0&&a("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)})}):a("#w2ui-overlay .w2ui-time").on("mouseup",function(){setTimeout(function(){a("#w2ui-overlay").length>0&&a("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)})}if("datetime"==this.type){if(a(c.el).prop("readonly")||a(c.el).prop("disabled"))return;a("#w2ui-overlay .w2ui-time").length>0&&a("#w2ui-overlay")[0].hide(),0===a("#w2ui-overlay").length&&a(c.el).w2overlay('<div class="w2ui-reset w2ui-calendar" onclick="event.stopPropagation();"></div>',{css:{"background-color":"#f5f5f5"},onShow:function(b){w2utils.isIE&&(console.log("IE"),a(".w2ui-calendar").on("mousedown",function(b){var c=a(b.target);1==c.length&&"w2ui-jump-year"==c[0].id&&a("#w2ui-overlay").data("keepOpen",!0)}))}});var e,f,g=w2utils.isDateTime(a(c.el).val(),c.options.format,!0);g&&(e=g.getMonth()+1,f=g.getFullYear());var i=null;!function b(e,f){a("#w2ui-overlay > div > div").html(c.getMonthHTML(e,f,a(c.el).val())+(d.btn_now?'<div class="w2ui-calendar-now now">'+w2utils.lang("Current Date & Time")+"</div>":"")),a("#w2ui-overlay .w2ui-calendar-title").on("mousedown",function(){if(a(this).next().hasClass("w2ui-calendar-jump"))a(this).next().remove();else{var d,e;a(this).after('<div class="w2ui-calendar-jump" style=""></div>'),a(this).next().hide().html(c.getYearHTML()).fadeIn(200),setTimeout(function(){a("#w2ui-overlay .w2ui-calendar-jump").find(".w2ui-jump-month, .w2ui-jump-year").on("click",function(){a(this).hasClass("w2ui-jump-month")&&(a(this).parent().find(".w2ui-jump-month").removeClass("selected"),a(this).addClass("selected"),e=a(this).attr("name")),a(this).hasClass("w2ui-jump-year")&&(a(this).parent().find(".w2ui-jump-year").removeClass("selected"),a(this).addClass("selected"),d=a(this).attr("name")),null!=d&&null!=e&&(a("#w2ui-overlay .w2ui-calendar-jump").fadeOut(100),setTimeout(function(){b(parseInt(e)+1,d)},100))}),a("#w2ui-overlay .w2ui-calendar-jump >:last-child").prop("scrollTop",2e3)},1)}}),a("#w2ui-overlay .w2ui-date").on("mousedown",function(){var b=a(this).attr("date");a(c.el).val(b).change(),a(this).css({"background-color":"#B6D5FB","border-color":"#aaa"}),i=new Date(a(this).attr("data-date"))}).on("mouseup",function(){var b,d;a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),a(c.el).w2overlay('<div class="w2ui-reset w2ui-calendar-time"></div>',{css:{"background-color":"#fff"}});"h24"==c.options.format;a("#w2ui-overlay > div").html(c.getHourHTML()),a("#w2ui-overlay .w2ui-time").on("mousedown",function(d){a(this).css({"background-color":"#B6D5FB","border-color":"#aaa"}),b=a(this).attr("hour"),i.setHours(b);var e=w2utils.formatDateTime(i,c.options.format);a(c.el).val(e).change()}),null==c.options.noMinutes||c.options.noMinutes===!1?a("#w2ui-overlay .w2ui-time").on("mouseup",function(){var e=a(this).attr("hour");a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),a(c.el).w2overlay('<div class="w2ui-reset w2ui-calendar-time"></div>',{css:{"background-color":"#fff"}}),a("#w2ui-overlay > div").html(c.getMinHTML(e)),a("#w2ui-overlay .w2ui-time").on("mousedown",function(){a(this).css({"background-color":"#B6D5FB","border-color":"#aaa"}),d=a(this).attr("min"),i.setHours(b,d);var e=w2utils.formatDateTime(i,c.options.format);a(c.el).val(e).change()}).on("mouseup",function(){setTimeout(function(){a("#w2ui-overlay").length>0&&a("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)})}):a("#w2ui-overlay .w2ui-time").on("mouseup",function(){setTimeout(function(){a("#w2ui-overlay").length>0&&a("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)})}),a("#w2ui-overlay .previous").on("mousedown",function(){var a=c.options.current.split("/");a[0]=parseInt(a[0])-1,b(a[0],a[1])}),a("#w2ui-overlay .next").on("mousedown",function(){var a=c.options.current.split("/");a[0]=parseInt(a[0])+1,b(a[0],a[1])}),a("#w2ui-overlay .now").on("mousedown",function(){var b=w2utils.formatDateTime(new Date,c.options.format);return a(c.el).val(b).change(),!1}).on("mouseup",function(){setTimeout(function(){a("#w2ui-overlay").length>0&&a("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)})}(e,f)}if(["list","combo","enum"].indexOf(this.type)!=-1){var j=this.el,k=this.el;if("enum"==this.type&&(j=a(this.helpers.multi),k=a(j).find("input")),"list"==this.type){var l=a(k).data("selected");a.isPlainObject(l)&&!a.isEmptyObject(l)&&d.index==-1&&d.items.forEach(function(a,b){a.id==l.id&&(d.index=b)}),k=a(this.helpers.focus).find("input")}if(a(k).is(":focus")){if(d.openOnFocus===!1&&""===a(k).val()&&c.tmp.force_open!==!0)return void a().w2overlay();if(c.tmp.force_hide)return a().w2overlay(),void setTimeout(function(){delete c.tmp.force_hide},1);""!==a(k).val()&&delete c.tmp.force_open;var m=w2utils.lang("No matches");null!=d.url&&a(k).val().length<d.minLength&&c.tmp.emptySet!==!0&&(m=d.minLength+" "+w2utils.lang("letters or more...")),null!=d.url&&""===a(k).val()&&c.tmp.emptySet!==!0&&(m=w2utils.lang("Type to search...")),null==d.url&&0===d.items.length&&(m=w2utils.lang("Empty list")),null!=d.msgNoItems&&(m=d.msgNoItems),"function"==m&&(m=m(d)),a(j).w2menu(b?"refresh-index":"refresh",a.extend(!0,{},d,{search:!1,render:d.renderDrop,maxHeight:d.maxDropHeight,maxWidth:d.maxDropWidth,msgNoItems:m,onSelect:function(b){if("enum"==c.type){var e=a(c.el).data("selected");if(b.item){var f=c.trigger({phase:"before",type:"add",target:c.el,originalEvent:b.originalEvent,item:b.item});if(f.isCancelled===!0)return;e.length>=d.max&&d.max>0&&e.pop(),delete b.item.hidden,e.push(b.item),a(c.el).data("selected",e).change(),a(c.helpers.multi).find("input").val("").width(20),c.refresh(),a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),c.trigger(a.extend(f,{phase:"after"}))}}else a(c.el).data("selected",b.item).val(b.item.text).change(),c.helpers.focus&&c.helpers.focus.find("input").val("")}}))}}},inRange:function(b,c){var d=!1;if("date"==this.type){var e=w2utils.isDate(b,this.options.format,!0);if(e){if(this.options.start||this.options.end){var f="string"==typeof this.options.start?this.options.start:a(this.options.start).val(),g="string"==typeof this.options.end?this.options.end:a(this.options.end).val(),h=w2utils.isDate(f,this.options.format,!0),i=w2utils.isDate(g,this.options.format,!0),j=new Date(e);h||(h=j),i||(i=j),j>=h&&j<=i&&(d=!0)}else d=!0;if(this.options.blocked&&a.inArray(b,this.options.blocked)!=-1&&(d=!1),null!=this.options.blockWeekDays&&void 0!=this.options.blockWeekDays&&void 0!=this.options.blockWeekDays.length)for(var k=this.options.blockWeekDays.length,l=0;l<k;l++)e.getDay()==this.options.blockWeekDays[l]&&(d=!1)}}else if("time"==this.type)if(this.options.start||this.options.end){var m=this.toMin(b),n=this.toMin(this.options.start),o=this.toMin(this.options.end);n||(n=m),o||(o=m),m>=n&&m<=o&&(d=!0)}else d=!0;else if("datetime"==this.type){var e=w2utils.isDateTime(b,this.options.format,!0);if(e){if(this.options.start||this.options.end){var h,i;if("object"==typeof this.options.start&&this.options.start instanceof Date)h=this.options.start;else{var f="string"==typeof this.options.start?this.options.start:a(this.options.start).val();h=""!==f.trim()?w2utils.isDateTime(f,this.options.format,!0):""}if("object"==typeof this.options.end&&this.options.end instanceof Date)i=this.options.end;else{var g="string"==typeof this.options.end?this.options.end:a(this.options.end).val();i=""!==g.trim()?w2utils.isDateTime(g,this.options.format,!0):""}var j=e;h||(h=j),i||(i=j),c&&h instanceof Date&&(h.setHours(0),h.setMinutes(0),h.setSeconds(0)),j>=h&&j<=i&&(d=!0)}else d=!0;if(d&&this.options.blocked)for(var l=0;l<this.options.blocked.length;l++){var p=this.options.blocked[l];if("string"==typeof p&&(p=w2utils.isDateTime(p,this.options.format,!0)),"object"==typeof p&&p instanceof Date&&p.getFullYear()==e.getFullYear()&&p.getMonth()==e.getMonth()&&p.getDate()==e.getDate()){d=!1;break}}}}return d},checkType:function(a,b){var c=this;switch(c.type){case"int":return!(!b||["-",c.options.groupSymbol].indexOf(a)==-1)||w2utils.isInt(a.replace(c.options.numberRE,""));case"percent":a=a.replace(/%/g,"");case"float":return!(!b||["-",w2utils.settings.decimalSymbol,c.options.groupSymbol].indexOf(a)==-1)||w2utils.isFloat(a.replace(c.options.numberRE,""));case"money":case"currency":return!(!b||["-",c.options.decimalSymbol,c.options.groupSymbol,c.options.currencyPrefix,c.options.currencySuffix].indexOf(a)==-1)||w2utils.isFloat(a.replace(c.options.moneyRE,""));case"bin":return w2utils.isBin(a);case"hex":return w2utils.isHex(a);case"alphanumeric":return w2utils.isAlphaNumeric(a)}return!0},addPrefix:function(){var b=this;setTimeout(function(){if("clear"!==b.type){var c,d=a(b.el).data("tmp")||{};d["old-padding-left"]&&a(b.el).css("padding-left",d["old-padding-left"]),d["old-padding-left"]=a(b.el).css("padding-left"),a(b.el).data("tmp",d),b.helpers.prefix&&a(b.helpers.prefix).remove(),""!==b.options.prefix&&(a(b.el).before('<div class="w2ui-field-helper">'+b.options.prefix+"</div>"),c=a(b.el).prev(),c.css({color:a(b.el).css("color"),"font-family":a(b.el).css("font-family"),"font-size":a(b.el).css("font-size"),"padding-top":a(b.el).css("padding-top"),"padding-bottom":a(b.el).css("padding-bottom"),"padding-left":a(b.el).css("padding-left"),"padding-right":0,"margin-top":parseInt(a(b.el).css("margin-top"),10)+2+"px","margin-bottom":parseInt(a(b.el).css("margin-bottom"),10)+1+"px","margin-left":a(b.el).css("margin-left"),"margin-right":0}).on("click",function(c){if(b.options.icon&&"function"==typeof b.onIconClick){var d=b.trigger({phase:"before",type:"iconClick",target:b.el,el:a(this).find("span.w2ui-icon")[0]});if(d.isCancelled===!0)return;b.trigger(a.extend(d,{phase:"after"}))}else"list"==b.type?a(b.helpers.focus).find("input").focus():a(b.el).focus()}),a(b.el).css("padding-left",c.width()+parseInt(a(b.el).css("padding-left"),10)+"px"),b.helpers.prefix=c)}},1)},addSuffix:function(){var b,c,d=this;setTimeout(function(){if("clear"!==d.type){var e=a(d.el).data("tmp")||{};if(e["old-padding-right"]&&a(d.el).css("padding-right",e["old-padding-right"]),e["old-padding-right"]=a(d.el).css("padding-right"),a(d.el).data("tmp",e),c=parseInt(a(d.el).css("padding-right"),10),d.options.arrows){d.helpers.arrows&&a(d.helpers.arrows).remove(),a(d.el).after('<div class="w2ui-field-helper" style="border: 1px solid transparent">  <div class="w2ui-field-up" type="up"> <div class="arrow-up" type="up"></div> </div> <div class="w2ui-field-down" type="down"> <div class="arrow-down" type="down"></div> </div></div>');w2utils.getSize(d.el,"height");b=a(d.el).next(),b.css({color:a(d.el).css("color"),"font-family":a(d.el).css("font-family"),"font-size":a(d.el).css("font-size"),height:a(d.el).height()+parseInt(a(d.el).css("padding-top"),10)+parseInt(a(d.el).css("padding-bottom"),10)+"px",padding:0,"margin-top":parseInt(a(d.el).css("margin-top"),10)+1+"px","margin-bottom":0,"border-left":"1px solid silver"}).css("margin-left","-"+(b.width()+parseInt(a(d.el).css("margin-right"),10)+12)+"px").on("mousedown",function(b){function c(){clearTimeout(f.data("_field_update_timer")),f.off("mouseup",c)}function e(c){a(d.el).focus(),d.keyDown(a.Event("keydown"),{keyCode:"up"==a(b.target).attr("type")?38:40}),c!==!1&&a("body").data("_field_update_timer",setTimeout(e,60))}var f=a("body");f.on("mouseup",c),f.data("_field_update_timer",setTimeout(e,700)),e(!1)}),c+=b.width()+12,a(d.el).css("padding-right",c+"px"),d.helpers.arrows=b}""!==d.options.suffix&&(d.helpers.suffix&&a(d.helpers.suffix).remove(),a(d.el).after('<div class="w2ui-field-helper">'+d.options.suffix+"</div>"),b=a(d.el).next(),b.css({color:a(d.el).css("color"),"font-family":a(d.el).css("font-family"),"font-size":a(d.el).css("font-size"),"padding-top":a(d.el).css("padding-top"),"padding-bottom":a(d.el).css("padding-bottom"),"padding-left":"3px","padding-right":a(d.el).css("padding-right"),"margin-top":parseInt(a(d.el).css("margin-top"),10)+2+"px","margin-bottom":parseInt(a(d.el).css("margin-bottom"),10)+1+"px"}).on("click",function(b){"list"==d.type?a(d.helpers.focus).find("input").focus():a(d.el).focus()}),b.css("margin-left","-"+(w2utils.getSize(b,"width")+parseInt(a(d.el).css("margin-right"),10)+2)+"px"),c+=b.width()+3,a(d.el).css("padding-right",c+"px"),d.helpers.suffix=b)}},1)},addFocus:function(){var b,c=this,d=(this.options,0);a(c.helpers.focus).remove();var e=a(c.el).attr("tabIndex");e&&e!=-1&&(c.el._tabIndex=e),c.el._tabIndex&&(e=c.el._tabIndex),null==e&&(e=-1);var f='<div class="w2ui-field-helper"> <div class="w2ui-icon icon-search" style="opacity: 0; display: none"></div> <input type="text" autocomplete="off" tabIndex="'+e+'"/></div>';a(c.el).attr("tabindex",-1).before(f);var g=a(c.el).prev();c.helpers.focus=g,g.css({width:a(c.el).width(),"margin-top":a(c.el).css("margin-top"),"margin-left":parseInt(a(c.el).css("margin-left"))+parseInt(a(c.el).css("padding-left"))+"px","margin-bottom":a(c.el).css("margin-bottom"),"margin-right":a(c.el).css("margin-right")}).find("input").css({cursor:"default",width:"100%",outline:"none",opacity:1,margin:0,border:"1px solid transparent",padding:a(c.el).css("padding-top"),"padding-left":0,"margin-left":d>0?d+6:0,"background-color":"transparent"}),g.find("input").on("click",function(b){0===a("#w2ui-overlay").length&&c.focus(b),b.stopPropagation()}).on("focus",function(d){b=a(c.el).attr("placeholder"),a(c.el).css({outline:"auto 5px #7DB4F3","outline-offset":"-2px"}),a(this).val(""),a(c.el).triggerHandler("focus"),d.stopPropagation?d.stopPropagation():d.cancelBubble=!0}).on("blur",function(d){a(c.el).css("outline","none"),a(this).val(""),c.refresh(),a(c.el).triggerHandler("blur"),d.stopPropagation?d.stopPropagation():d.cancelBubble=!0,null!=b&&a(c.el).attr("placeholder",b)}).on("keydown",function(d){var e=this;c.keyDown(d),setTimeout(function(){""===e.value?a(c.el).attr("placeholder",b):a(c.el).attr("placeholder","")},10)}).on("keyup",function(a){c.keyUp(a)}).on("keypress",function(a){c.keyPress(a)}),g.on("click",function(b){a(this).find("input").focus()}),c.refresh()},addMulti:function(){var b=this;this.options;a(b.helpers.multi).remove();var c="",d="margin-top : 0px; margin-bottom : 0px; margin-left : "+a(b.el).css("margin-left")+"; margin-right : "+a(b.el).css("margin-right")+"; width : "+(w2utils.getSize(b.el,"width")-parseInt(a(b.el).css("margin-left"),10)-parseInt(a(b.el).css("margin-right"),10))+"px;";if("enum"==b.type){var e=a(b.el).attr("tabIndex");e&&e!=-1&&(b.el._tabIndex=e),b.el._tabIndex&&(e=b.el._tabIndex),null==e&&(e=-1),c='<div class="w2ui-field-helper w2ui-list" style="'+d+'; box-sizing: border-box"> <div style="padding: 0px; margin: 0px; display: inline-block" class="w2ui-multi-items"> <ul> <li style="padding-left: 0px; padding-right: 0px" class="nomouse"> <input type="text" style="width: 20px; margin: -3px 0 0; padding: 2px 0; border-color: white" autocomplete="off"'+(a(b.el).prop("readonly")?' readonly="readonly"':"")+(a(b.el).prop("disabled")?' disabled="disabled"':"")+' tabindex="'+e+'"/> </li> </ul> </div></div>'}"file"==b.type&&(c='<div class="w2ui-field-helper w2ui-list" style="'+d+'; box-sizing: border-box"> <div style="position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px;"> <input class="file-input" type="file" style="width: 100%; height: 100%; opacity: 0;" name="attachment" multiple tabindex="-1"'+(a(b.el).prop("readonly")?' readonly="readonly"':"")+(a(b.el).prop("disabled")?' disabled="disabled"':"")+(a(b.el).attr("accept")?' accept="'+a(b.el).attr("accept")+'"':"")+'/> </div> <div style="position: absolute; padding: 0px; margin: 0px; display: inline-block" class="w2ui-multi-items"> <ul><li style="padding-left: 0px; padding-right: 0px" class="nomouse"></li></ul> </div></div>');var f=a(b.el).data("tmp")||{};f["old-background-color"]=a(b.el).css("background-color"),f["old-border-color"]=a(b.el).css("border-color"),a(b.el).data("tmp",f),a(b.el).before(c).css({"background-color":"transparent","border-color":"transparent"});var g=a(b.el).prev();b.helpers.multi=g,"enum"==b.type&&(a(b.el).attr("tabindex",-1),g.find("input").on("click",function(c){0===a("#w2ui-overlay").length&&b.focus(c),a(b.el).triggerHandler("click")}).on("focus",function(c){a(g).css({outline:"auto 5px #7DB4F3","outline-offset":"-2px"}),a(b.el).triggerHandler("focus"),c.stopPropagation?c.stopPropagation():c.cancelBubble=!0}).on("blur",function(c){a(g).css("outline","none"),a(b.el).triggerHandler("blur"),c.stopPropagation?c.stopPropagation():c.cancelBubble=!0}).on("keyup",function(a){b.keyUp(a)}).on("keydown",function(a){b.keyDown(a)}).on("keypress",function(a){b.keyPress(a)}),g.on("click",function(b){a(this).find("input").focus()})),"file"==b.type&&(a(b.el).css("outline","none"),g.on("click",function(c){a(b.el).focus(),a(b.el).prop("readonly")||a(b.el).prop("disabled")||(b.blur(c),b.resize(),setTimeout(function(){g.find("input").click()},10))}).on("dragenter",function(c){a(b.el).prop("readonly")||a(b.el).prop("disabled")||a(g).addClass("w2ui-file-dragover")}).on("dragleave",function(c){if(!a(b.el).prop("readonly")&&!a(b.el).prop("disabled")){var d=a(c.target).parents(".w2ui-field-helper");0===d.length&&a(g).removeClass("w2ui-file-dragover")}}).on("drop",function(c){if(!a(b.el).prop("readonly")&&!a(b.el).prop("disabled")){a(g).removeClass("w2ui-file-dragover");for(var d=c.originalEvent.dataTransfer.files,e=0,f=d.length;e<f;e++)b.addFile.call(b,d[e]);c.preventDefault(),c.stopPropagation()}}).on("dragover",function(a){a.preventDefault(),a.stopPropagation()}),g.find("input").on("click",function(a){a.stopPropagation()}).on("change",function(){if("undefined"!=typeof this.files)for(var a=0,c=this.files.length;a<c;a++)b.addFile.call(b,this.files[a])})),b.refresh()},addFile:function(b){var c,d=this,e=this.options,f=a(d.el).data("selected"),g={name:b.name,type:b.type,modified:b.lastModifiedDate,size:b.size,content:null,file:b},h=0,i=0;if(f)for(var j=0;j<f.length;j++){if(f[j].name==b.name&&f[j].size==b.size)return;h+=f[j].size,i++}var k=d.trigger({phase:"before",type:"add",target:d.el,file:g,total:i,totalSize:h});if(k.isCancelled!==!0){if(0!==e.maxFileSize&&g.size>e.maxFileSize)return c="Maximum file size is "+w2utils.formatSize(e.maxFileSize),e.silent===!1&&a(d.el).w2tag(c),void console.log("ERROR: "+c);if(0!==e.maxSize&&h+g.size>e.maxSize)return c=w2utils.lang("Maximum total size is")+" "+w2utils.formatSize(e.maxSize),void(e.silent===!1?a(d.el).w2tag(c):console.log("ERROR: "+c));if(0!==e.max&&i>=e.max)return c=w2utils.lang("Maximum number of files is")+" "+e.max,void(e.silent===!1?a(d.el).w2tag(c):console.log("ERROR: "+c));if(f.push(g),"undefined"!=typeof FileReader&&e.readContent===!0){var l=new FileReader;l.onload=function(){return function(b){var c=b.target.result,e=c.indexOf(",");g.content=c.substr(e+1),d.refresh(),a(d.el).trigger("change"),d.trigger(a.extend(k,{phase:"after"}))}}(),l.readAsDataURL(b)}else d.refresh(),a(d.el).trigger("change"),d.trigger(a.extend(k,{phase:"after"}))}},normMenu:function(b){if(a.isArray(b)){for(var c=0;c<b.length;c++)"string"==typeof b[c]?b[c]={id:b[c],text:b[c]}:(null!=b[c].text&&null==b[c].id&&(b[c].id=b[c].text),null==b[c].text&&null!=b[c].id&&(b[c].text=b[c].id),null!=b[c].caption&&(b[c].text=b[c].caption));return b}if("function"==typeof b)return this.normMenu(b());if("object"==typeof b){var d=[];for(var c in b)d.push({id:c,text:b[c]});return d}},getMonthHTML:function(a,b,c){var d=new Date,e=w2utils.settings.fullmonths,f=["31","28","31","30","31","30","31","31","30","31","30","31"],g=d.getFullYear()+"/"+(Number(d.getMonth())+1)+"/"+d.getDate(),h=w2utils.settings.fulldays.slice(),i=w2utils.settings.shortdays.slice();"M"!=w2utils.settings.weekStarts&&(h.unshift(h.pop()),i.unshift(i.pop()));var j=this.options;null==j&&(j={}),b=w2utils.isInt(b)?parseInt(b):d.getFullYear(),a=w2utils.isInt(a)?parseInt(a):d.getMonth()+1,a>12&&(a-=12,b++),(a<1||0===a)&&(a+=12,b--),b/4==Math.floor(b/4)?f[1]="29":f[1]="28",j.current=a+"/"+b,d=new Date(b,a-1,1);for(var k=d.getDay(),l="",m=0;m<i.length;m++)l+='<td title="'+h[m]+'">'+i[m]+"</td>";var n='<div class="w2ui-calendar-title title"> <div class="w2ui-calendar-previous previous"> <div></div> </div> <div class="w2ui-calendar-next next"> <div></div> </div> '+e[a-1]+", "+b+'</div><table class="w2ui-calendar-days" cellspacing="0"><tbody> <tr class="w2ui-day-title">'+l+"</tr> <tr>",o=1;if("M"!=w2utils.settings.weekStarts&&k++,"datetime"===this.type){var p=w2utils.isDateTime(c,j.format,!0);c=w2utils.formatDate(p,w2utils.settings.dateFormat)}for(var q=1;q<43;q++){if(0===k&&1==q){for(var r=0;r<6;r++)n+='<td class="w2ui-day-empty"> </td>';q+=6}else if(q<k||o>f[a-1]){n+='<td class="w2ui-day-empty"> </td>',q%7===0&&(n+="</tr><tr>");continue}var s=b+"/"+a+"/"+o,t=new Date(s),u="";6===t.getDay()&&(u=" w2ui-saturday"),0===t.getDay()&&(u=" w2ui-sunday"),s==g&&(u+=" w2ui-today");var v,w,x=o,y="",z="";if("datetime"===this.type?(v=w2utils.formatDateTime(s,j.format),w=w2utils.formatDate(s,w2utils.settings.dateFormat)):(v=w2utils.formatDate(s,j.format),w=v),j.colored&&void 0!==j.colored[w]){var A=j.colored[w].split(":");z="background-color: "+A[0]+";",y="color: "+A[1]+";"}n+='<td class="'+(this.inRange(v,!0)?"w2ui-date "+(w==c?"w2ui-date-selected":""):"w2ui-blocked")+u+'" style="'+y+z+'" date="'+v+'" data-date="'+t+'">'+x+"</td>",(q%7===0||0===k&&1==q)&&(n+="</tr><tr>"),o++}return n+="</tr></tbody></table>"},getYearHTML:function(){for(var a=w2utils.settings.shortmonths,b=w2utils.settings.dateStartYear,c=w2utils.settings.dateEndYear,d="",e="",f=0;f<a.length;f++)d+='<div class="w2ui-jump-month" name="'+f+'">'+a[f]+"</div>";for(var g=b;g<=c;g++)e+='<div class="w2ui-jump-year" name="'+g+'">'+g+"</div>";return'<div id="w2ui-jump-month">'+d+'</div><div id="w2ui-jump-year">'+e+"</div>"},getHourHTML:function(){var a=[],b=this.options;null==b&&(b={format:w2utils.settings.timeFormat});for(var c=b.format.indexOf("h24")>-1,d=0;d<24;d++){var e=(d>=12&&!c?d-12:d)+":00"+(c?"":d<12?" am":" pm");12!=d||c||(e="12:00 pm"),a[Math.floor(d/8)]||(a[Math.floor(d/8)]="");var f=this.fromMin(this.toMin(e)),g=this.fromMin(this.toMin(e)+59);if("datetime"===this.type){var h=w2utils.isDateTime(this.el.value,b.format,!0),i=b.format.split("|")[0].trim();f=w2utils.formatDate(h,i)+" "+f,g=w2utils.formatDate(h,i)+" "+g}a[Math.floor(d/8)]+='<div class="'+(this.inRange(f)||this.inRange(g)?"w2ui-time ":"w2ui-blocked")+'" hour="'+d+'">'+e+"</div>"}var j='<div class="w2ui-calendar"> <div class="w2ui-calendar-title">'+w2utils.lang("Select Hour")+'</div> <div class="w2ui-calendar-time"><table><tbody><tr> <td>'+a[0]+"</td> <td>"+a[1]+"</td> <td>"+a[2]+"</td> </tr></tbody></table></div></div>";return j},getMinHTML:function(a){null==a&&(a=0);var b=this.options;null==b&&(b={format:w2utils.settings.timeFormat});for(var c=b.format.indexOf("h24")>-1,d=[],e=0;e<60;e+=5){var f=(a>12&&!c?a-12:a)+":"+(e<10?0:"")+e+" "+(c?"":a<12?"am":"pm"),g=f,h=e<20?0:e<40?1:2;if(d[h]||(d[h]=""),"datetime"===this.type){var i=w2utils.isDateTime(this.el.value,b.format,!0),j=b.format.split("|")[0].trim();g=w2utils.formatDate(i,j)+" "+g}d[h]+='<div class="'+(this.inRange(g)?"w2ui-time ":"w2ui-blocked")+'" min="'+e+'">'+f+"</div>"}var k='<div class="w2ui-calendar"> <div class="w2ui-calendar-title">'+w2utils.lang("Select Minute")+'</div> <div class="w2ui-calendar-time"><table><tbody><tr> <td>'+d[0]+"</td> <td>"+d[1]+"</td> <td>"+d[2]+"</td> </tr></tbody></table></div></div>";return k},toMin:function(a){if("string"!=typeof a)return null;var b=a.split(":");return 2!==b.length?null:(b[0]=parseInt(b[0]),b[1]=parseInt(b[1]),a.indexOf("pm")!=-1&&12!=b[0]&&(b[0]+=12),60*b[0]+b[1])},fromMin:function(a){var b="";a>=1440&&(a%=1440),a<0&&(a=1440+a);var c=Math.floor(a/60),d=(a%60<10?"0":"")+a%60,e=this.options;return null==e&&(e={format:w2utils.settings.timeFormat}),b=e.format.indexOf("h24")!=-1?c+":"+d:(c<=12?c:c-12)+":"+d+" "+(c>=12?"pm":"am")}},a.extend(b.prototype,w2utils.event),w2obj.field=b}(jQuery);