/** * EZMCOM User Behavior Analytics EzUBAnalytics - v1.1.2-b1603 - 2016-03-22 * http://www.ezmcom.com * Copyright (c) 2016 EZMCOM Inc. Licensed * * # STEP 1: Initialize * It is a must to call this to initialize the EzUBAnalytics script engine. * @param offsetFlag Optional. Only if provide true, it will offset the char code. * @param sessionId Optional. If not provided, it create internal session Id. * EzUBAnalytics.init(offsetFlag,sessionId) * * # STEP 2: Bind the DOM element * Call this to bind and register the EzUBAnalytics on textbox. * @param element Mandatory. It is the DOM element of textbox for which to run UBA evaluation. * EzUBAnalytics.bind(element) * * # STEP 3: Capture the analytics data. * Call this when you ready to capture the UBA JSON data. For an example: upon form submit or * on click event of form Submit button. * @param elEva Mandatory. It is the DOM element of textbox for which you would like to extract it * UBA JSON data. * @param elDes Optional. It is the DOM element of textbox or textarea for which you would like to * output the UBA JSON data. If not provided. The result will be returned * from this function only. * EzUBAnalytics.ubaJson(elEva, elDes) **/ "function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),function(){function a(b,d){function f(a,b){try{a()}catch(c){b&&b()}}function g(a){if(null!=g[a])return g[a];var b;if("bug-string-char-index"==a)b="a"!="a"[0];else if("json"==a)b=g("json-stringify")&&g("date-serialization")&&g("json-parse");else if("date-serialization"==a){if(b=g("json-stringify")&&u){var c=d.stringify;f(function(){b='"-271821-04-20T00:00:00.000Z"'==c(new l(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==c(new l(864e13))&&'"-000001-01-01T00:00:00.000Z"'==c(new l(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==c(new l(-1))})}}else{var e,h='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==a){var c=d.stringify,k="function"==typeof c;k&&((e=function(){return 1}).toJSON=e,f(function(){k="0"===c(0)&&"0"===c(new i)&&'""'==c(new j)&&c(s)===q&&c(q)===q&&c()===q&&"1"===c(e)&&"[1]"==c([e])&&"[null]"==c([q])&&"null"==c(null)&&"[null,null,null]"==c([q,s,null])&&c({a:[e,!0,!1,null,"\x00\b\n\f\r "]})==h&&"1"===c(null,e)&&"[\n 1,\n 2\n]"==c([1,2],null,1)},function(){k=!1})),b=k}if("json-parse"==a){var m,n=d.parse;"function"==typeof n&&f(function(){0!==n("0")||n(!1)||(e=n(h),m=5==e.a.length&&1===e.a[0],m&&(f(function(){m=!n('" "')}),m&&f(function(){m=1!==n("01")}),m&&f(function(){m=1!==n("1.")})))},function(){m=!1}),b=m}}return g[a]=!!b}function h(a){return G(this)}b||(b=e.Object()),d||(d=e.Object());var i=b.Number||e.Number,j=b.String||e.String,k=b.Object||e.Object,l=b.Date||e.Date,m=b.SyntaxError||e.SyntaxError,n=b.TypeError||e.TypeError,o=b.Math||e.Math,p=b.JSON||e.JSON;"object"==typeof p&&p&&(d.stringify=p.stringify,d.parse=p.parse);var q,r=k.prototype,s=r.toString,t=r.hasOwnProperty,u=new l(-0xc782b5b800cec);if(f(function(){u=-109252==u.getUTCFullYear()&&0===u.getUTCMonth()&&1===u.getUTCDate()&&10==u.getUTCHours()&&37==u.getUTCMinutes()&&6==u.getUTCSeconds()&&708==u.getUTCMilliseconds()}),g["bug-string-char-index"]=g["date-serialization"]=g.json=g["json-stringify"]=g["json-parse"]=null,!g("json")){var v="[object Function]",w="[object Date]",x="[object Number]",y="[object String]",z="[object Array]",A="[object Boolean]",B=g("bug-string-char-index"),C=function(a,b){var d,e,f,g=0;(d=function(){this.valueOf=0}).prototype.valueOf=0,e=new d;for(f in e)t.call(e,f)&&g++;return d=e=null,g?C=function(a,b){var c,d,e=s.call(a)==v;for(c in a)e&&"prototype"==c||!t.call(a,c)||(d="constructor"===c)||b(c);(d||t.call(a,c="constructor"))&&b(c)}:(e=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],C=function(a,b){var d,f,g=s.call(a)==v,h=!g&&"function"!=typeof a.constructor&&c[typeof a.hasOwnProperty]&&a.hasOwnProperty||t;for(d in a)g&&"prototype"==d||!h.call(a,d)||b(d);for(f=e.length;d=e[--f];h.call(a,d)&&b(d));}),C(a,b)};if(!g("json-stringify")&&!g("date-serialization")){var D={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},E="000000",F=function(a,b){return(E+(b||0)).slice(-a)},G=function(a){var b,c,d,e,f,g,h,i,j;if(u)b=function(a){c=a.getUTCFullYear(),d=a.getUTCMonth(),e=a.getUTCDate(),g=a.getUTCHours(),h=a.getUTCMinutes(),i=a.getUTCSeconds(),j=a.getUTCMilliseconds()};else{var k=o.floor,l=[0,31,59,90,120,151,181,212,243,273,304,334],m=function(a,b){return l[b]+365*(a-1970)+k((a-1969+(b=+(b>1)))/4)-k((a-1901+b)/100)+k((a-1601+b)/400)};b=function(a){for(e=k(a/864e5),c=k(e/365.2425)+1970-1;m(c+1,0)<=e;c++);for(d=k((e-m(c,0))/30.42);m(c,d+1)<=e;d++);e=1+e-m(c,d),f=(a%864e5+864e5)%864e5,g=k(f/36e5)%24,h=k(f/6e4)%60,i=k(f/1e3)%60,j=f%1e3}}return(G=function(a){return a>-1/0&&1/0>a?(b(a),a=(0>=c||c>=1e4?(0>c?"-":"+")+F(6,0>c?-c:c):F(4,c))+"-"+F(2,d+1)+"-"+F(2,e)+"T"+F(2,g)+":"+F(2,h)+":"+F(2,i)+"."+F(3,j)+"Z",c=d=e=g=h=i=j=null):a=null,a})(a)};if(g("json-stringify")&&!g("date-serialization")){var H=d.stringify;d.stringify=function(a,b,c){var d=l.prototype.toJSON;l.prototype.toJSON=h;var e=H(a,b,c);return l.prototype.toJSON=d,e}}else{var I="\\u00",J=function(a){var b=a.charCodeAt(0),c=D[b];return c?c:I+F(2,b.toString(16))},K=/[\x00-\x1f\x22\x5c]/g,L=function(a){return K.lastIndex=0,'"'+(K.test(a)?a.replace(K,J):a)+'"'},M=function(a,b,c,d,e,g,h){var i,j,k,m,o,p,r,t,u;if(f(function(){i=b[a]}),"object"==typeof i&&i&&(i.getUTCFullYear&&s.call(i)==w&&i.toJSON===l.prototype.toJSON?i=G(i):"function"==typeof i.toJSON&&(i=i.toJSON(a))),c&&(i=c.call(b,a,i)),i==q)return i===q?i:"null";switch(j=typeof i,"object"==j&&(k=s.call(i)),k||j){case"boolean":case A:return""+i;case"number":case x:return i>-1/0&&1/0>i?""+i:"null";case"string":case y:return L(""+i)}if("object"==typeof i){for(r=h.length;r--;)if(h[r]===i)throw n();if(h.push(i),m=[],t=g,g+=e,k==z){for(p=0,r=i.length;r>p;p++)o=M(p,i,c,d,e,g,h),m.push(o===q?"null":o);u=m.length?e?"[\n"+g+m.join(",\n"+g)+"\n"+t+"]":"["+m.join(",")+"]":"[]"}else C(d||i,function(a){var b=M(a,i,c,d,e,g,h);b!==q&&m.push(L(a)+":"+(e?" ":"")+b)}),u=m.length?e?"{\n"+g+m.join(",\n"+g)+"\n"+t+"}":"{"+m.join(",")+"}":"{}";return h.pop(),u}};d.stringify=function(a,b,d){var e,f,g,h;if(c[typeof b]&&b)if(h=s.call(b),h==v)f=b;else if(h==z){g={};for(var i,j=0,k=b.length;k>j;i=b[j++],h=s.call(i),(h==y||h==x)&&(g[i]=1));}if(d)if(h=s.call(d),h==x){if((d-=d%1)>0)for(e="",d>10&&(d=10);e.lengthN;)switch(e=f.charCodeAt(N)){case 9:case 10:case 13:case 32:N++;break;case 123:case 125:case 91:case 93:case 58:case 44:return a=B?f.charAt(N):f[N],N++,a;case 34:for(a="@",N++;g>N;)if(e=f.charCodeAt(N),32>e)R();else if(92==e)switch(e=f.charCodeAt(++N)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:a+=Q[e],N++;break;case 117:for(b=++N,c=N+4;c>N;N++)e=f.charCodeAt(N),e>=48&&57>=e||e>=97&&102>=e||e>=65&&70>=e||R();a+=P("0x"+f.slice(b,N));break;default:R()}else{if(34==e)break;for(e=f.charCodeAt(N),b=N;e>=32&&92!=e&&34!=e;)e=f.charCodeAt(++N);a+=f.slice(b,N)}if(34==f.charCodeAt(N))return N++,a;R();default:if(b=N,45==e&&(d=!0,e=f.charCodeAt(++N)),e>=48&&57>=e){for(48==e&&(e=f.charCodeAt(N+1),e>=48&&57>=e)&&R(),d=!1;g>N&&(e=f.charCodeAt(N),e>=48&&57>=e);N++);if(46==f.charCodeAt(N)){for(c=++N;g>c&&(e=f.charCodeAt(c),e>=48&&57>=e);c++);c==N&&R(),N=c}if(e=f.charCodeAt(N),101==e||69==e){for(e=f.charCodeAt(++N),(43==e||45==e)&&N++,c=N;g>c&&(e=f.charCodeAt(c),e>=48&&57>=e);c++);c==N&&R(),N=c}return+f.slice(b,N)}d&&R();var h=f.slice(N,N+4);if("true"==h)return N+=4,!0;if("fals"==h&&101==f.charCodeAt(N+4))return N+=5,!1;if("null"==h)return N+=4,null;R()}return"$"},T=function(a){var b,c;if("$"==a&&R(),"string"==typeof a){if("@"==(B?a.charAt(0):a[0]))return a.slice(1);if("["==a){for(b=[];a=S(),"]"!=a;)c?","==a?(a=S(),"]"==a&&R()):R():c=!0,","==a&&R(),b.push(T(a));return b}if("{"==a){for(b={};a=S(),"}"!=a;)c?","==a?(a=S(),"}"==a&&R()):R():c=!0,(","==a||"string"!=typeof a||"@"!=(B?a.charAt(0):a[0])||":"!=S())&&R(),b[a.slice(1)]=T(S());return b}R()}return a},U=function(a,b,c){var d=V(a,b,c);d===q?delete a[b]:a[b]=d},V=function(a,b,c){var d,e=a[b];if("object"==typeof e&&e)if(s.call(e)==z)for(d=e.length;d--;U(e,d,c));else C(e,function(a){U(e,a,c)});return c.call(a,b,e)};d.parse=function(a,b){var c,d;return N=0,O=""+a,c=T(S()),"$"!=S()&&R(),N=O=null,b&&s.call(b)==v?V((d={},d[""]=c,d),"",b):c}}}return d.runInContext=a,d}var b="function"==typeof define&&define.amd,c={"function":!0,object:!0},d=c[typeof exports]&&exports&&!exports.nodeType&&exports,e=c[typeof window]&&window||this,f=d&&c[typeof module]&&module&&!module.nodeType&&"object"==typeof global&&global;if(!f||f.global!==f&&f.window!==f&&f.self!==f||(e=f),d&&!b)a(e,d);else{var g=e.JSON,h=e.JSON3,i=!1,j=a(e,e.JSON3={noConflict:function(){return i||(i=!0,e.JSON=g,e.JSON3=h,g=h=null),j}});e.JSON={parse:j.parse,stringify:j.stringify}}b&&define(function(){return j})}.call(this);var Sha256={};Sha256.hash=function(a){a=a.utf8Encode();var b=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],c=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];a+=String.fromCharCode(128);for(var d=a.length/4+2,e=Math.ceil(d/16),f=new Array(e),g=0;e>g;g++){f[g]=new Array(16);for(var h=0;16>h;h++)f[g][h]=a.charCodeAt(64*g+4*h)<<24|a.charCodeAt(64*g+4*h+1)<<16|a.charCodeAt(64*g+4*h+2)<<8|a.charCodeAt(64*g+4*h+3)}f[e-1][14]=8*(a.length-1)/Math.pow(2,32),f[e-1][14]=Math.floor(f[e-1][14]),f[e-1][15]=8*(a.length-1)&4294967295;for(var i,j,k,l,m,n,o,p,q=new Array(64),g=0;e>g;g++){for(var r=0;16>r;r++)q[r]=f[g][r];for(var r=16;64>r;r++)q[r]=Sha256.sl1(q[r-2])+q[r-7]+Sha256.sl0(q[r-15])+q[r-16]&4294967295;i=c[0],j=c[1],k=c[2],l=c[3],m=c[4],n=c[5],o=c[6],p=c[7];for(var r=0;64>r;r++){var s=p+Sha256.su1(m)+Sha256.Ch(m,n,o)+b[r]+q[r],t=Sha256.su0(i)+Sha256.Maj(i,j,k);p=o,o=n,n=m,m=l+s&4294967295,l=k,k=j,j=i,i=s+t&4294967295}c[0]=c[0]+i&4294967295,c[1]=c[1]+j&4294967295,c[2]=c[2]+k&4294967295,c[3]=c[3]+l&4294967295,c[4]=c[4]+m&4294967295,c[5]=c[5]+n&4294967295,c[6]=c[6]+o&4294967295,c[7]=c[7]+p&4294967295}return Sha256.toHexStr(c[0])+Sha256.toHexStr(c[1])+Sha256.toHexStr(c[2])+Sha256.toHexStr(c[3])+Sha256.toHexStr(c[4])+Sha256.toHexStr(c[5])+Sha256.toHexStr(c[6])+Sha256.toHexStr(c[7])},Sha256.ROTR=function(a,b){return b>>>a|b<<32-a},Sha256.su0=function(a){return Sha256.ROTR(2,a)^Sha256.ROTR(13,a)^Sha256.ROTR(22,a)},Sha256.su1=function(a){return Sha256.ROTR(6,a)^Sha256.ROTR(11,a)^Sha256.ROTR(25,a)},Sha256.sl0=function(a){return Sha256.ROTR(7,a)^Sha256.ROTR(18,a)^a>>>3},Sha256.sl1=function(a){return Sha256.ROTR(17,a)^Sha256.ROTR(19,a)^a>>>10},Sha256.Ch=function(a,b,c){return a&b^~a&c},Sha256.Maj=function(a,b,c){return a&b^a&c^b&c},Sha256.toHexStr=function(a){for(var b,c="",d=7;d>=0;d--)b=a>>>4*d&15,c+=b.toString(16);return c},"undefined"==typeof String.prototype.utf8Encode&&(String.prototype.utf8Encode=function(){return unescape(encodeURIComponent(this))}),"undefined"==typeof String.prototype.utf8Decode&&(String.prototype.utf8Decode=function(){try{return decodeURIComponent(escape(this))}catch(a){return this}}),"undefined"!=typeof module&&module.exports&&(module.exports=Sha256),"function"==typeof define&&define.amd&&define([],function(){return Sha256});var EzUBAnalytics=function(){function a(){function a(a){var b=a.target||a.srcElement;if(!b||void 0===b||null===b)return!1;var c,d,e=[];for(i=0;i0)&&g.push(k)}return l[h]=f,m[h]=g,!1}function d(a){c(a)}function e(b){var c=b||window.event;if(!c||void 0===c||null===c)return!1;var d=a(c);if(d===!1)return!1;var e=d.element,f=d.ubaEvent,g=d.eIndex;return f=[],e.value="",l[g]=e,m[g]=f,!1}function f(a){var b=a;(!b||0>=b)&&(b=32);for(var c="";c.length<=b;)c+=Math.random().toString(36).substr(2);return c.substr(0,b)}var g=1,h=f(),j=Math.floor(100*Math.random()),k=!1,l=[],m={};this.init=function(a,b){a===!0?k=!0:(k=!1,j=0),b&&void 0!==b&&null!==b&&""!==b&&(h=b)},this.bind=function(a){if(a){a.addEventListener?(a.addEventListener("keydown",c,!1),a.addEventListener("keyup",c,!1),a.addEventListener("cut",b,!1),a.addEventListener("copy",b,!1),a.addEventListener("paste",b,!1),a.addEventListener("focus",e,!1)):a.attachEvent&&(a.attachEvent("onkeydown",d),a.attachEvent("onkeyup",c),a.attachEvent("oncut",b),a.attachEvent("oncopy",b),a.attachEvent("onpaste",b),a.attachEvent("onfocus",e));var f=!1;for(i=0;i