sa-sdk-javascript
Version:
official sensorsdata javascript sdk
1 lines • 205 kB
JavaScript
var logFn,sd={};function isFunction(e){if(!e)return!1;var t=Object.prototype.toString.call(e);return"[object Function]"==t||"[object AsyncFunction]"==t}function now(){return Date.now&&isFunction(Date.now)?Date.now():(new Date).getTime()}sd.DEFAULT_SEND_TYPE="image",function(){var e={"function":!0,object:!0},t=e[typeof window]&&window||this,r=t.JSON,n=t.JSON3,i=!1,a=function s(r,n){r||(r=t.Object()),n||(n=t.Object());var i=r.Number||t.Number,a=r.String||t.String,o=r.Object||t.Object,l=r.Date||t.Date,d=r.SyntaxError||t.SyntaxError,c=r.TypeError||t.TypeError,u=r.Math||t.Math,p=r.JSON||t.JSON;if("object"==typeof p&&p)return n.stringify=p.stringify,n.parse=p.parse,n.runInContext=s,n;var g,f=o.prototype,_=f.toString,h=f.hasOwnProperty;function m(e,t){try{e()}catch(r){t&&t()}}var v=new l(-0xc782b5b800cec);function y(e){if(null!=y[e])return y[e];var t;if("bug-string-char-index"==e)t="a"!="a"[0];else if("json"==e)t=y("json-stringify")&&y("date-serialization")&&y("json-parse");else if("date-serialization"==e){if(t=y("json-stringify")&&v){var r=n.stringify;m(function(){t='"-271821-04-20T00:00:00.000Z"'==r(new l(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==r(new l(864e13))&&'"-000001-01-01T00:00:00.000Z"'==r(new l(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==r(new l(-1))})}}else{var s,o='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==e){var d="function"==typeof(r=n.stringify);d&&((s=function(){return 1}).toJSON=s,m(function(){d="0"===r(0)&&"0"===r(new i)&&'""'==r(new a)&&r(_)===g&&r(g)===g&&r()===g&&"1"===r(s)&&"[1]"==r([s])&&"[null]"==r([g])&&"null"==r(null)&&"[null,null,null]"==r([g,_,null])&&r({a:[s,!0,!1,null,"\0\b\n\f\r\t"]})==o&&"1"===r(null,s)&&"[\n 1,\n 2\n]"==r([1,2],null,1)},function(){d=!1})),t=d}if("json-parse"==e){var c,u=n.parse;"function"==typeof u&&m(function(){0!==u("0")||u(!1)||(s=u(o),(c=5==s.a.length&&1===s.a[0])&&(m(function(){c=!u('"\t"')}),c&&m(function(){c=1!==u("01")}),c&&m(function(){c=1!==u("1.")})))},function(){c=!1}),t=c}}return y[e]=!!t}if(m(function(){v=-109252==v.getUTCFullYear()&&0===v.getUTCMonth()&&1===v.getUTCDate()&&10==v.getUTCHours()&&37==v.getUTCMinutes()&&6==v.getUTCSeconds()&&708==v.getUTCMilliseconds()}),y["bug-string-char-index"]=y["date-serialization"]=y.json=y["json-stringify"]=y["json-parse"]=null,!y("json")){var b=y("bug-string-char-index"),S=function(t,r){var n,i,a,s=0;for(a in(n=function(){this.valueOf=0}).prototype.valueOf=0,i=new n)h.call(i,a)&&s++;return n=i=null,s?S=function(e,t){var r,n,i="[object Function]"==_.call(e);for(r in e)i&&"prototype"==r||!h.call(e,r)||(n="constructor"===r)||t(r);(n||h.call(e,r="constructor"))&&t(r)}:(i=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],S=function(t,r){var n,a,s="[object Function]"==_.call(t),o=!s&&"function"!=typeof t.constructor&&e[typeof t.hasOwnProperty]&&t.hasOwnProperty||h;for(n in t)s&&"prototype"==n||!o.call(t,n)||r(n);for(a=i.length;n=i[--a];)o.call(t,n)&&r(n)}),S(t,r)};if(!y("json-stringify")&&!y("date-serialization")){var $={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},w=function(e,t){return("000000"+(t||0)).slice(-e)},k=function(e){var t,r,n,i,a,s,o,l,d;if(v)t=function(e){r=e.getUTCFullYear(),n=e.getUTCMonth(),i=e.getUTCDate(),s=e.getUTCHours(),o=e.getUTCMinutes(),l=e.getUTCSeconds(),d=e.getUTCMilliseconds()};else{var c=u.floor,p=[0,31,59,90,120,151,181,212,243,273,304,334],g=function(e,t){return p[t]+365*(e-1970)+c((e-1969+(t=+(t>1)))/4)-c((e-1901+t)/100)+c((e-1601+t)/400)};t=function(e){for(i=c(e/864e5),r=c(i/365.2425)+1970-1;g(r+1,0)<=i;r++);for(n=c((i-g(r,0))/30.42);g(r,n+1)<=i;n++);i=1+i-g(r,n),s=c((a=(e%864e5+864e5)%864e5)/36e5)%24,o=c(a/6e4)%60,l=c(a/1e3)%60,d=a%1e3}}return(k=function(e){return e>-1/0&&e<1/0?(t(e),e=(r<=0||r>=1e4?(r<0?"-":"+")+w(6,r<0?-r:r):w(4,r))+"-"+w(2,n+1)+"-"+w(2,i)+"T"+w(2,s)+":"+w(2,o)+":"+w(2,l)+"."+w(3,d)+"Z",r=n=i=s=o=l=d=null):e=null,e})(e)};if(y("json-stringify")&&!y("date-serialization")){function P(e){return k(this)}var O=n.stringify;n.stringify=function(e,t,r){var n=l.prototype.toJSON;l.prototype.toJSON=P;var i=O(e,t,r);return l.prototype.toJSON=n,i}}else{var I=function(e){var t=e.charCodeAt(0);return $[t]||"\\u00"+w(2,t.toString(16))},j=/[\x00-\x1f\x22\x5c]/g,L=function(e){return j.lastIndex=0,'"'+(j.test(e)?e.replace(j,I):e)+'"'},C=function(e,t,r,n,i,a,s){var o,d,u,p,f,h,v,y,b;if(m(function(){o=t[e]}),"object"==typeof o&&o&&(o.getUTCFullYear&&"[object Date]"==_.call(o)&&o.toJSON===l.prototype.toJSON?o=k(o):"function"==typeof o.toJSON&&(o=o.toJSON(e))),r&&(o=r.call(t,e,o)),o==g)return o===g?o:"null";switch("object"==(d=typeof o)&&(u=_.call(o)),u||d){case"boolean":case"[object Boolean]":return""+o;case"number":case"[object Number]":return o>-1/0&&o<1/0?""+o:"null";case"string":case"[object String]":return L(""+o)}if("object"==typeof o){for(v=s.length;v--;)if(s[v]===o)throw c();if(s.push(o),p=[],y=a,a+=i,"[object Array]"==u){for(h=0,v=o.length;h<v;h++)f=C(h,o,r,n,i,a,s),p.push(f===g?"null":f);b=p.length?i?"[\n"+a+p.join(",\n"+a)+"\n"+y+"]":"["+p.join(",")+"]":"[]"}else S(n||o,function(e){var t=C(e,o,r,n,i,a,s);t!==g&&p.push(L(e)+":"+(i?" ":"")+t)}),b=p.length?i?"{\n"+a+p.join(",\n"+a)+"\n"+y+"}":"{"+p.join(",")+"}":"{}";return s.pop(),b}};n.stringify=function(t,r,n){var i,a,s,o;if(e[typeof r]&&r)if("[object Function]"==(o=_.call(r)))a=r;else if("[object Array]"==o){s={};for(var l,d=0,c=r.length;d<c;)l=r[d++],"[object String]"!=(o=_.call(l))&&"[object Number]"!=o||(s[l]=1)}if(n)if("[object Number]"==(o=_.call(n))){if((n-=n%1)>0)for(n>10&&(n=10),i="";i.length<n;)i+=" "}else"[object String]"==o&&(i=n.length<=10?n:n.slice(0,10));return C("",((l={})[""]=t,l),a,s,i,"",[])}}}if(!y("json-parse")){var D,E,x=a.fromCharCode,A={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},N=function(){throw D=E=null,d()},T=function(){for(var e,t,r,n,i,a=E,s=a.length;D<s;)switch(i=a.charCodeAt(D)){case 9:case 10:case 13:case 32:D++;break;case 123:case 125:case 91:case 93:case 58:case 44:return e=b?a.charAt(D):a[D],D++,e;case 34:for(e="@",D++;D<s;)if((i=a.charCodeAt(D))<32)N();else if(92==i)switch(i=a.charCodeAt(++D)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:e+=A[i],D++;break;case 117:for(t=++D,r=D+4;D<r;D++)(i=a.charCodeAt(D))>=48&&i<=57||i>=97&&i<=102||i>=65&&i<=70||N();e+=x("0x"+a.slice(t,D));break;default:N()}else{if(34==i)break;for(i=a.charCodeAt(D),t=D;i>=32&&92!=i&&34!=i;)i=a.charCodeAt(++D);e+=a.slice(t,D)}if(34==a.charCodeAt(D))return D++,e;N();default:if(t=D,45==i&&(n=!0,i=a.charCodeAt(++D)),i>=48&&i<=57){for(48==i&&(i=a.charCodeAt(D+1))>=48&&i<=57&&N(),n=!1;D<s&&(i=a.charCodeAt(D))>=48&&i<=57;D++);if(46==a.charCodeAt(D)){for(r=++D;r<s&&!((i=a.charCodeAt(r))<48||i>57);r++);r==D&&N(),D=r}if(101==(i=a.charCodeAt(D))||69==i){for(43!=(i=a.charCodeAt(++D))&&45!=i||D++,r=D;r<s&&!((i=a.charCodeAt(r))<48||i>57);r++);r==D&&N(),D=r}return+a.slice(t,D)}n&&N();var o=a.slice(D,D+4);if("true"==o)return D+=4,!0;if("fals"==o&&101==a.charCodeAt(D+4))return D+=5,!1;if("null"==o)return D+=4,null;N()}return"$"},U=function(e){var t,r;if("$"==e&&N(),"string"==typeof e){if("@"==(b?e.charAt(0):e[0]))return e.slice(1);if("["==e){for(t=[];"]"!=(e=T());)r?","==e?"]"==(e=T())&&N():N():r=!0,","==e&&N(),t.push(U(e));return t}if("{"==e){for(t={};"}"!=(e=T());)r?","==e?"}"==(e=T())&&N():N():r=!0,","!=e&&"string"==typeof e&&"@"==(b?e.charAt(0):e[0])&&":"==T()||N(),t[e.slice(1)]=U(T());return t}N()}return e},R=function(e,t,r){var n=B(e,t,r);n===g?delete e[t]:e[t]=n},B=function(e,t,r){var n,i=e[t];if("object"==typeof i&&i)if("[object Array]"==_.call(i))for(n=i.length;n--;)R(_,S,i);else S(i,function(e){R(i,e,r)});return r.call(e,t,i)};n.parse=function(e,t){var r,n;return D=0,E=""+e,r=U(T()),"$"!=T()&&N(),D=E=null,t&&"[object Function]"==_.call(t)?B(((n={})[""]=r,n),"",t):r}}}return n.runInContext=s,n}(t,t.JSON3={noConflict:function(){return i||(i=!0,t.JSON=r,t.JSON3=n,r=n=null),a}});t.JSON?(t.JSON.parse=a.parse,t.JSON.stringify=a.stringify):t.JSON={parse:a.parse,stringify:a.stringify}}.call(window),function(e){if(e.atob)try{e.atob(" ")}catch(a){e.atob=(t=e.atob,(r=function(e){return t(String(e).replace(/[\t\n\f\r ]+/g,""))}).original=t,r)}else{var t,r,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;e.btoa=function(e){for(var t,r,i,a,s="",o=0,l=(e=String(e)).length%3;o<e.length;){if((r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255||(a=e.charCodeAt(o++))>255)return"";s+=n.charAt((t=r<<16|i<<8|a)>>18&63)+n.charAt(t>>12&63)+n.charAt(t>>6&63)+n.charAt(63&t)}return l?s.slice(0,l-3)+"===".substring(l):s},e.atob=function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!i.test(e))return"";e+="==".slice(2-(3&e.length));for(var t,r,a,s="",o=0;o<e.length;)t=n.indexOf(e.charAt(o++))<<18|n.indexOf(e.charAt(o++))<<12|(r=n.indexOf(e.charAt(o++)))<<6|(a=n.indexOf(e.charAt(o++))),s+=64===r?String.fromCharCode(t>>16&255):64===a?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return s}}}(window);var logger={setup:function(e){logFn=e},log:function(){(logFn||console&&console.log||function(){}).apply(null,arguments)}},_localStorage={get:function(e){return window.localStorage.getItem(e)},parse:function(e){var t;try{t=JSON.parse(_localStorage.get(e))||null}catch(r){logger.log(r)}return t},set:function(e,t){try{window.localStorage.setItem(e,t)}catch(r){logger.log(r)}},remove:function(e){window.localStorage.removeItem(e)},isSupport:function(){var e=!0;try{var t="__local_store_support__",r="testIsSupportStorage";_localStorage.set(t,r),_localStorage.get(t)!==r&&(e=!1),_localStorage.remove(t)}catch(n){e=!1}return e}};function isObject(e){return null!=e&&"[object Object]"==Object.prototype.toString.call(e)}var getRandomBasic=function(){var e=(new Date).getTime();return function(t){return Math.ceil((e=(9301*e+49297)%233280)/233280*t)}}();function getRandom(){if("function"==typeof Uint32Array){var e="";if("undefined"!=typeof crypto?e=crypto:"undefined"!=typeof msCrypto&&(e=msCrypto),isObject(e)&&e.getRandomValues){var t=new Uint32Array(1);return e.getRandomValues(t)[0]/Math.pow(2,32)}}return getRandomBasic(1e19)/1e19}function safeJSONParse(e){var t=null;try{t=JSON.parse(e)}catch(r){}return t}function ConcurrentStorage(e,t){this.lockGetPrefix=e||"lock-get-prefix",this.lockSetPrefix=t||"lock-set-prefix"}function isValidListener(e){return"function"==typeof e||!(!e||"object"!=typeof e)&&isValidListener(e.listener)}function EventEmitter(){this._events={}}function _decodeURIComponent(e){var t=e;try{t=decodeURIComponent(e)}catch(r){t=e}return t}function getNullObj(){function e(){}return"function"!=typeof Object.create?(e.prototype=null,new e):Object.create(null)}function getURLSearchParams(e){e=e||"";for(var t=getNullObj(),r=e.substring(1).split("&"),n=0;n<r.length;n++){var i=r[n].indexOf("=");if(-1!==i){var a=r[n].substring(0,i),s=r[n].substring(i+1);a=_decodeURIComponent(a),s=_decodeURIComponent(s),"__proto__"!==a&&"constructor"!==a&&"prototype"!==a&&(t[a]=s)}}return t}function isString(e){return"[object String]"==Object.prototype.toString.call(e)}function trim(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}function urlParse(e){var t=function(e){this._fields={Username:4,Password:5,Port:7,Protocol:2,Host:6,Path:8,URL:0,QueryString:9,Fragment:10},this._values={},this._regex=/^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/,void 0!==e&&this._parse(e)};return t.prototype.setUrl=function(e){this._parse(e)},t.prototype._initValues=function(){for(var e in this._fields)this._values[e]=""},t.prototype.addQueryString=function(e){if("object"!=typeof e)return!1;var t=this._values.QueryString||"";for(var r in e)t=new RegExp(r+"[^&]+").test(t)?t.replace(new RegExp(r+"[^&]+"),r+"="+e[r]):"&"===t.slice(-1)?t+r+"="+e[r]:""===t?r+"="+e[r]:t+"&"+r+"="+e[r];this._values.QueryString=t},t.prototype.getUrl=function(){var e="";return e+=this._values.Origin,e+=this._values.Port?":"+this._values.Port:"",e+=this._values.Path,(e+=this._values.QueryString?"?"+this._values.QueryString:"")+(this._values.Fragment?"#"+this._values.Fragment:"")},t.prototype._parse=function(e){this._initValues();var t=this._regex.exec(e);t||logger.log("URLParser::_parse -> Invalid URL");var r=e.split("#"),n=r[0],i=r.slice(1).join("#");for(var a in t=this._regex.exec(n),this._fields)"undefined"!=typeof t[this._fields[a]]&&(this._values[a]=t[this._fields[a]]);this._values.Hostname=this._values.Host.replace(/:\d+$/,""),this._values.Origin=this._values.Protocol+"://"+this._values.Hostname,this._values.Fragment=i},new t(e)}function _URL(e){var t,r={};if("function"==typeof window.URL&&function(){try{return"http://modernizr.com/"===new URL("http://modernizr.com/").href}catch(e){return!1}}())(r=new URL(e)).searchParams||(r.searchParams=(t=getURLSearchParams(r.search),{get:function(e){return t[e]}}));else{if(isString(e)||(e=String(e)),e=trim(e),!1===/^https?:\/\/.+/.test(e))return void logger.log("Invalid URL");var n=urlParse(e);r.hash=n._values.Fragment,r.host=n._values.Host?n._values.Host+(n._values.Port?":"+n._values.Port:""):"",r.href=n._values.URL,r.password=n._values.Password,r.pathname=n._values.Path,r.port=n._values.Port,r.search=n._values.QueryString?"?"+n._values.QueryString:"",r.username=n._values.Username,r.hostname=n._values.Hostname,r.protocol=n._values.Protocol?n._values.Protocol+":":"",r.origin=n._values.Origin?n._values.Origin+(n._values.Port?":"+n._values.Port:""):"",r.searchParams=function(){var e=getURLSearchParams("?"+n._values.QueryString);return{get:function(t){return e[t]}}}()}return r}ConcurrentStorage.prototype.get=function(e,t,r,n){if(!e)throw new Error("key is must");t=t||1e4,r=r||1e3,n=n||function(){};var i=this.lockGetPrefix+e,a=_localStorage.get(i),s=String(getRandom());if(a&&(a=safeJSONParse(a)||{randomNum:0,expireTime:0}).expireTime>now())return n(null);_localStorage.set(i,JSON.stringify({randomNum:s,expireTime:now()+t})),setTimeout(function(){(a=safeJSONParse(_localStorage.get(i))||{randomNum:0,expireTime:0})&&a.randomNum===s?(n(_localStorage.get(e)),_localStorage.remove(e),_localStorage.remove(i)):n(null)},r)},ConcurrentStorage.prototype.set=function(e,t,r,n,i){if(!e||!t)throw new Error("key and val is must");r=r||1e4,n=n||1e3,i=i||function(){};var a=this.lockSetPrefix+e,s=_localStorage.get(a),o=String(getRandom());if(s&&(s=safeJSONParse(s)||{randomNum:0,expireTime:0}).expireTime>now())return i({status:"fail",reason:"This key is locked"});_localStorage.set(a,JSON.stringify({randomNum:o,expireTime:now()+r})),setTimeout(function(){(s=safeJSONParse(_localStorage.get(a))||{randomNum:0,expireTime:0}).randomNum===o?_localStorage.set(e,t)&&i({status:"success"}):i({status:"fail",reason:"This key is locked"})},n)},EventEmitter.prototype.on=function(e,t){if(!e||!t)return!1;if(!isValidListener(t))throw new Error("listener must be a function");this._events[e]=this._events[e]||[];var r="object"==typeof t;return this._events[e].push(r?t:{listener:t,once:!1}),this},EventEmitter.prototype.prepend=function(e,t){if(!e||!t)return!1;if(!isValidListener(t))throw new Error("listener must be a function");this._events[e]=this._events[e]||[];var r="object"==typeof t;return this._events[e].unshift(r?t:{listener:t,once:!1}),this},EventEmitter.prototype.prependOnce=function(e,t){return this.prepend(e,{listener:t,once:!0})},EventEmitter.prototype.once=function(e,t){return this.on(e,{listener:t,once:!0})},EventEmitter.prototype.off=function(e,t){var r=this._events[e];if(!r)return!1;if("number"==typeof t)r.splice(t,1);else if("function"==typeof t)for(var n=0,i=r.length;n<i;n++)r[n]&&r[n].listener===t&&r.splice(n,1);return this},EventEmitter.prototype.emit=function(e,t){var r=this._events[e];if(!r)return!1;for(var n=0;n<r.length;n++){var i=r[n];i&&(i.listener.call(this,t||{}),i.once&&this.off(e,n))}return this},EventEmitter.prototype.removeAllListeners=function(e){e&&this._events[e]?this._events[e]=[]:this._events={}},EventEmitter.prototype.listeners=function(e){return e&&"string"==typeof e?this._events[e]:this._events};var UUID=function(){var e=function(){for(var e=1*new Date,t=0;e==1*new Date;)t++;return e.toString(16)+t.toString(16)};return function(){var t=String(screen.height*screen.width);return t=t&&/\d{5,}/.test(t)?t.toString(16):String(31242*getRandom()).replace(".","").slice(0,8),e()+"-"+getRandom().toString(16).replace(".","")+"-"+function(){var e,t,r=navigator.userAgent,n=[],i=0;function a(e,t){var r,i=0;for(r=0;r<t.length;r++)i|=n[r]<<8*r;return e^i}for(e=0;e<r.length;e++)t=r.charCodeAt(e),n.unshift(255&t),n.length>=4&&(i=a(i,n),n=[]);return n.length>0&&(i=a(i,n)),i.toString(16)}()+"-"+t+"-"+e()||(String(getRandom())+String(getRandom())+String(getRandom())).slice(2,15)}}();function isElement(e){return!(!e||1!==e.nodeType)}function isUndefined(e){return void 0===e}function isArray(e){return Array.isArray&&isFunction(isArray)?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function ry(e){return new DomElementInfo(e)}var DomElementInfo=function(e){this.ele=e},siblings=function(e,t){for(var r=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&r.push(e);return r};function addEvent(e,t,r,n){function i(e){return e&&(e.preventDefault=i.preventDefault,e.stopPropagation=i.stopPropagation,e._getPath=i._getPath),e}i._getPath=function(){return this.path||this.composedPath&&this.composedPath()||ry(this.target).getParents()},i.preventDefault=function(){this.returnValue=!1},i.stopPropagation=function(){this.cancelBubble=!0},function(e,t,r){if(n===undefined&&"click"===t&&(n=!0),e&&e.addEventListener)e.addEventListener(t,function(e){e._getPath=i._getPath,r.call(this,e)},n);else{var a="on"+t,s=e[a];e[a]=function(e,t,r,n){return function(a){if(!(a=a||i(window.event)))return undefined;a.target=a.srcElement;var s,o,l=!0;return"function"==typeof r&&(s=r(a)),o=t.call(e,a),"beforeunload"!==n?(!1!==s&&!1!==o||(l=!1),l):void 0}}(e,r,s,t)}}.apply(null,arguments)}function addHashEvent(e){var t="pushState"in window.history?"popstate":"hashchange";addEvent(window,t,e)}function xhr(e){if(e)return"undefined"!=typeof window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:null;if("undefined"!=typeof window.XMLHttpRequest)return new XMLHttpRequest;if(window.ActiveXObject)try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){logger.log(t)}}}function each(e,t,r){if("object"==typeof e&&"number"==typeof e.length&&e.length>0)if(Array.prototype.forEach&&e.forEach)e.forEach(t,r);else for(var n=0;n<e.length;n++)t.call(r,e[n],n,e);else if("[object Object]"===Object.prototype.toString.call(e))for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(r,e[i],i,e)}function extend(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];if("[object Object]"===Object.prototype.toString.call(r))for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&void 0!==r[n]&&(e[n]=r[n])}return e}function ajax(e){function t(e){if(!e)return"";try{return JSON.parse(e)}catch(t){return{}}}e.timeout=e.timeout||2e4,e.credentials="undefined"==typeof e.credentials||e.credentials;var r=xhr(e.cors);if(!r)return!1;e.type||(e.type=e.data?"POST":"GET");var n,i=(e=extend({success:function(){},error:function(){}},e)).success,a=e.error;e.success=function(e){i(e),n&&(clearTimeout(n),n=null)},e.error=function(e){a(e),n&&(clearTimeout(n),n=null)},n=setTimeout(function(){!function(){try{r&&"object"==typeof r&&r.abort&&r.abort()}catch(t){logger.log(t)}n&&(clearTimeout(n),n=null,e.error&&e.error(),r.onreadystatechange=null,r.onload=null,r.onerror=null)}()},e.timeout),"undefined"!=typeof XDomainRequest&&r instanceof XDomainRequest&&(r.onload=function(){e.success&&e.success(t(r.responseText)),r.onreadystatechange=null,r.onload=null,r.onerror=null},r.onerror=function(){e.error&&e.error(t(r.responseText),r.status),r.onreadystatechange=null,r.onerror=null,r.onload=null}),r.onreadystatechange=function(){try{4==r.readyState&&(r.status>=200&&r.status<300||304==r.status?e.success(t(r.responseText)):e.error(t(r.responseText),r.status),r.onreadystatechange=null,r.onload=null)}catch(n){r.onreadystatechange=null,r.onload=null}},r.open(e.type,e.url,!0);try{e.credentials&&(r.withCredentials=!0),isObject(e.header)&&each(e.header,function(e,t){r.setRequestHeader&&r.setRequestHeader(t,e)}),e.data&&(e.cors||r.setRequestHeader&&r.setRequestHeader("X-Requested-With","XMLHttpRequest"),"application/json"===e.contentType?r.setRequestHeader&&r.setRequestHeader("Content-type","application/json; charset=UTF-8"):r.setRequestHeader&&r.setRequestHeader("Content-type","application/x-www-form-urlencoded"))}catch(s){logger.log(s)}r.send(e.data||null)}function map(e,t){var r=[];return null==e?r:Array.prototype.map&&e.map===Array.prototype.map?e.map(t):(each(e,function(e,n,i){r.push(t(e,n,i))}),r)}function base64Decode(e){var t=[];try{t=map(atob(e).split(""),function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})}catch(r){t=[]}try{return decodeURIComponent(t.join(""))}catch(r){return t.join("")}}function base64Encode(e){var t="";try{t=btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))}catch(r){t=e}return t}function bindReady(e,t){t=t||window;var r=!1,n=!0,i=t.document,a=i.documentElement,s=i.addEventListener,o=s?"addEventListener":"attachEvent",l=s?"removeEventListener":"detachEvent",d=s?"":"on",c=function(n){"readystatechange"==n.type&&"complete"!=i.readyState||(("load"==n.type?t:i)[l](d+n.type,c,!1),!r&&(r=!0)&&e.call(t,n.type||n))},u=function(){try{a.doScroll("left")}catch(e){return void setTimeout(u,50)}c("poll")};if("complete"==i.readyState)e.call(t,"lazy");else{if(!s&&a.doScroll){try{n=!t.frameElement}catch(p){logger.log(p)}n&&u()}i[o](d+"DOMContentLoaded",c,!1),i[o](d+"readystatechange",c,!1),t[o](d+"load",c,!1)}}DomElementInfo.prototype={addClass:function(e){return-1===(" "+this.ele.className+" ").indexOf(" "+e+" ")&&(this.ele.className=this.ele.className+(""===this.ele.className?"":" ")+e),this},removeClass:function(e){var t=" "+this.ele.className+" ";return-1!==t.indexOf(" "+e+" ")&&(this.ele.className=t.replace(" "+e+" "," ").slice(1,-1)),this},hasClass:function(e){return-1!==(" "+this.ele.className+" ").indexOf(" "+e+" ")},attr:function(e,t){return"string"==typeof e&&isUndefined(t)?this.ele.getAttribute(e):("string"==typeof e&&(t=String(t),this.ele.setAttribute(e,t)),this)},offset:function(){var e=this.ele.getBoundingClientRect();if(e.width||e.height){var t=this.ele.ownerDocument.documentElement;return{top:e.top+window.pageYOffset-t.clientTop,left:e.left+window.pageXOffset-t.clientLeft}}return{top:0,left:0}},getSize:function(){if(!window.getComputedStyle)return{width:this.ele.offsetWidth,height:this.ele.offsetHeight};try{var e=this.ele.getBoundingClientRect();return{width:e.width,height:e.height}}catch(t){return{width:0,height:0}}},getStyle:function(e){return this.ele.currentStyle?this.ele.currentStyle[e]:this.ele.ownerDocument.defaultView.getComputedStyle(this.ele,null).getPropertyValue(e)},wrap:function(e){var t=document.createElement(e);return this.ele.parentNode.insertBefore(t,this.ele),t.appendChild(this.ele),ry(t)},getCssStyle:function(e){var t=this.ele.style.getPropertyValue(e);if(t)return t;var r=null;if("function"==typeof window.getMatchedCSSRules&&(r=window.getMatchedCSSRules(this.ele)),!r||!isArray(r))return null;for(var n=r.length-1;n>=0;n--)if(t=r[n].style.getPropertyValue(e))return t},sibling:function(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e},next:function(){return this.sibling(this.ele,"nextSibling")},prev:function(){return this.sibling(this.ele,"previousSibling")},siblings:function(){return siblings((this.ele.parentNode||{}).firstChild,this.ele)},children:function(){return siblings(this.ele.firstChild)},parent:function(){var e=this.ele.parentNode;return ry(e=e&&11!==e.nodeType?e:null)},previousElementSibling:function(){var e=this.ele;if("previousElementSibling"in document.documentElement)return ry(e.previousElementSibling);for(;e=e.previousSibling;)if(1===e.nodeType)return ry(e);return ry(null)},getSameTypeSiblings:function(){for(var e=this.ele,t=e.parentNode,r=e.tagName.toLowerCase(),n=[],i=0;i<t.children.length;i++){var a=t.children[i];1===a.nodeType&&a.tagName.toLowerCase()===r&&n.push(t.children[i])}return n},getParents:function(){try{var e=this.ele;if(!isElement(e))return[];var t=[e];if(null===e||null===e.parentElement)return[];for(;null!==e.parentElement;)e=e.parentElement,t.push(e);return t}catch(r){return[]}}};var cookie={get:function(e){for(var t=e+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var i=r[n];" "==i.charAt(0);)i=i.substring(1,i.length);if(0==i.indexOf(t))return _decodeURIComponent(i.substring(t.length,i.length))}return null},set:function(e,t,r,n,i,a){var s=a,o="",l="",d="";if(0!==(r=null==r?73e3:r)){var c=new Date;"s"===String(r).slice(-1)?c.setTime(c.getTime()+1e3*Number(String(r).slice(0,-1))):c.setTime(c.getTime()+24*r*60*60*1e3),o="; expires="+c.toGMTString()}function u(e){return!!e&&e.replace(/\r\n/g,"")}n&&""!==n&&(d="; SameSite="+n),i&&(l="; secure");var p="",g="",f="";e&&(p=u(e)),t&&(g=u(t)),s&&(f=u(s)),p&&g&&(document.cookie=p+"="+encodeURIComponent(g)+o+"; path=/"+f+d+l)},remove:function(e,t){this.set(e,"1",-1,t)},isSupport:function(e,t,r,n,i){e=e||"cookie_support_test",t=t||"1";var a=this;return navigator.cookieEnabled&&(a.set(e,t,r,n,i),a.get(e)===t&&(a.remove(e),!0))}};function coverExtend(e){return each(Array.prototype.slice.call(arguments,1),function(t){for(var r in t)void 0!==t[r]&&void 0===e[r]&&(e[r]=t[r])}),e}function _decodeURI(e){var t=e;try{t=decodeURI(e)}catch(r){t=e}return t}function dfmapping(e){var t="t6KJCZa5pDdQ9khoEM3Tj70fbP2eLSyc4BrsYugARqFIw1mzlGNVXOHiWvxUn8",r=t.length-1,n={},i=0;for(i=0;i<t.length;i++)n[t.charAt(i)]=t.charAt(r-i);var a="";for(i=0;i<e.length;i++)e.charAt(i)in n?a+=n[e.charAt(i)]:a+=e.charAt(i);return a}function isDate(e){return"[object Date]"==Object.prototype.toString.call(e)}function formatDate(e){function t(e){return e<10?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+" "+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+"."+t(e.getMilliseconds())}function encodeDates(e){return each(e,function(t,r){isDate(t)?e[r]=formatDate(t):isObject(t)&&(e[r]=encodeDates(t))}),e}function extend2Lev(e){return each(Array.prototype.slice.call(arguments,1),function(t){for(var r in t)void 0!==t[r]&&(isObject(t[r])&&isObject(e[r])?extend(e[r],t[r]):e[r]=t[r])}),e}function filter(e,t,r){var n=Object.prototype.hasOwnProperty;if(e.filter)return e.filter(t);for(var i=[],a=0;a<e.length;a++)if(n.call(e,a)){var s=e[a];t.call(r,s,a,e)&&i.push(s)}return i}function formatJsonString(e){try{return JSON.stringify(e,null," ")}catch(t){return JSON.stringify(e)}}function getSafeHostname(e){return"string"==typeof e&&e.match(/^[a-zA-Z0-9\u4e00-\u9fa5\-\.]+$/)?e:""}function getCookieTopLevelDomain(e,t,r){t=t||"domain_test";var n=getSafeHostname(e=e||location.hostname),i=n.split(".");if(isArray(i)&&i.length>=2&&!/^(\d+\.)+\d+$/.test(n))for(var a="."+i.splice(i.length-1,1);i.length>0;)if(a="."+i.splice(i.length-1,1)+a,cookie.set(t,"true",0,null,r,"; domain="+a),-1!==document.cookie.indexOf(t+"=true"))return cookie.set(t,"true","-1s",null,r,"; domain="+a),a;return""}function getDomBySelector(e){if(!isString(e))return null;var t,r=e.split(">");return(t=function n(e){var t,i=r.shift();if(!i)return e;try{t=function(e,t){var r;if("body"===(e=trim(e)))return document.getElementsByTagName("body")[0];if(0===e.indexOf("#"))e=e.slice(1),r=document.getElementById(e);else if(e.indexOf(":nth-of-type")>-1){var n=e.split(":nth-of-type");if(!n[0]||!n[1])return null;var i=n[0],a=n[1].match(/\(([0-9]+)\)/);if(!a||!a[1])return null;var s=Number(a[1]);if(!(isElement(t)&&t.children&&t.children.length>0))return null;for(var o=t.children,l=0;l<o.length;l++)if(isElement(o[l])&&o[l].tagName.toLowerCase()===i&&0==--s){r=o[l];break}if(s>0)return null}return r||null}(i,e)}catch(a){logger.log(a)}return t&&isElement(t)?n(t):null}())&&isElement(t)?t:null}function getElementContent(e,t){var r="",n="";return e.textContent?r=trim(e.textContent):e.innerText&&(r=trim(e.innerText)),r&&(r=r.replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)),n=r||"","input"!==t&&"INPUT"!==t||(n=e.value||""),n}function getHostname(e,t){t&&"string"==typeof t||(t="hostname\u89e3\u6790\u5f02\u5e38");var r=null;try{r=_URL(e).hostname}catch(n){logger.log("getHostname\u4f20\u5165\u7684url\u53c2\u6570\u4e0d\u5408\u6cd5\uff01")}return r||t}function getIOSVersion(){try{var e=navigator.appVersion.match(/OS (\d+)[._](\d+)[._]?(\d+)?/);return e&&e[1]?Number.parseInt(e[1],10):""}catch(t){return""}}function getQueryParam(e,t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),e=_decodeURIComponent(e);var r=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null===r||r&&"string"!=typeof r[1]&&r[1].length?"":_decodeURIComponent(r[1])}function getQueryParamsFromUrl(e){var t={},r=e.split("?")[1]||"";return r&&(t=getURLSearchParams("?"+r)),t}function mediaQueriesSupported(){return"undefined"!=typeof window.matchMedia||"undefined"!=typeof window.msMatchMedia}function getScreenOrientation(){var e=screen.msOrientation||screen.mozOrientation||(screen.orientation||{}).type,t="\u672a\u53d6\u5230\u503c";if(e)t=e.indexOf("landscape")>-1?"landscape":"portrait";else if(mediaQueriesSupported()){var r=window.matchMedia||window.msMatchMedia;r("(orientation: landscape)").matches?t="landscape":r("(orientation: portrait)").matches&&(t="portrait")}return t}function getUA(){var e,t={},r=navigator.userAgent.toLowerCase();return(e=r.match(/ qq\/([\d.]+)/))?t.qqBuildinBrowser=Number(e[1].split(".")[0]):(e=r.match(/mqqbrowser\/([\d.]+)/))?t.qqBrowser=Number(e[1].split(".")[0]):(e=r.match(/opera.([\d.]+)/))?t.opera=Number(e[1].split(".")[0]):(e=r.match(/msie ([\d.]+)/))?t.ie=Number(e[1].split(".")[0]):(e=r.match(/edge.([\d.]+)/))?t.edge=Number(e[1].split(".")[0]):(e=r.match(/firefox\/([\d.]+)/))?t.firefox=Number(e[1].split(".")[0]):(e=r.match(/chrome\/([\d.]+)/))?t.chrome=Number(e[1].split(".")[0]):(e=r.match(/version\/([\d.]+).*safari/))?t.safari=Number(e[1].match(/^\d*.\d*/)):(e=r.match(/trident\/([\d.]+)/))&&(t.ie=11),t}function getURL(e){return isString(e)?_decodeURI(e=trim(e)):_decodeURI(location.href)}function getURLPath(e){return isString(e)?_decodeURI(e=trim(e)):_decodeURI(location.pathname)}function hasAttribute(e,t){return e.hasAttribute?e.hasAttribute(t):e.attributes?!(!e.attributes[t]||!e.attributes[t].specified):void 0}function hasAttributes(e,t){if("string"==typeof t)return hasAttribute(e,t);if(isArray(t)){for(var r=!1,n=0;n<t.length;n++)if(hasAttribute(e,t[n])){r=!0;break}return r}}function hashCode(e){if("string"!=typeof e)return 0;var t=0;if(0==e.length)return t;for(var r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t}function hashCode53(e){var t=9007199254740992,r=-9007199254740992,n=0;if(e.length>0)for(var i=e.split(""),a=0;a<i.length;a++){var s=i[a].charCodeAt(),o=31*n+s;if(o>t)for(n=r+n;(o=31*n+s)<r;)n=n/2+s;if(o<r)for(n=t+n;(o=31*n+s)>t;)n=n/2+s;n=31*n+s}return n}function indexOf(e,t){var r=e.indexOf;if(r)return r.call(e,t);for(var n=0;n<e.length;n++)if(t===e[n])return n;return-1}function inherit(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e}var hasOwnProperty=Object.prototype.hasOwnProperty;function isArguments(e){return!(!e||!hasOwnProperty.call(e,"callee"))}function isBoolean(e){return"[object Boolean]"==Object.prototype.toString.call(e)}function isEmptyObject(e){if(isObject(e)){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return!1}function isHttpUrl(e){return"string"==typeof e&&(!1!==/^https?:\/\/.+/.test(e)||(logger.log("Invalid URL"),!1))}function isIOS(){return!!navigator.userAgent.match(/iPhone|iPad|iPod/i)}function isJSONString(e){try{JSON.parse(e)}catch(t){return!1}return!0}function isNumber(e){return"[object Number]"==Object.prototype.toString.call(e)&&/[\d\.]+/.test(String(e))}function isSupportBeaconSend(){var e=!1;if("object"!=typeof navigator||"function"!=typeof navigator.sendBeacon)return e;var t=getUA(),r=navigator.userAgent.toLowerCase();if(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)){var n=(r.match(/os [\d._]*/gi)+"").replace(/[^0-9|_.]/gi,"").replace(/_/gi,".").split(".");"undefined"==typeof t.safari&&(t.safari=n[0]),n[0]&&(t.qqBuildinBrowser||t.qqBrowser)?e=!1:n[0]&&n[0]<13?(t.chrome>41||t.firefox>30||t.opera>25||t.safari>12)&&(e=!0):(t.chrome>41||t.firefox>30||t.opera>25||t.safari>11.3)&&(e=!0)}else(t.chrome>38||t.edge>13||t.firefox>30||t.opera>25||t.safari>11)&&(e=!0);return e}function isSupportCors(){return"undefined"!=typeof window.XMLHttpRequest&&("withCredentials"in new XMLHttpRequest||"undefined"!=typeof XDomainRequest)}function jsonp(e){if(!isObject(e)||!isString(e.callbackName))return logger.log("JSONP \u8bf7\u6c42\u7f3a\u5c11 callbackName"),!1;e.success=isFunction(e.success)?e.success:function(){},e.error=isFunction(e.error)?e.error:function(){},e.data=e.data||"";var t=document.createElement("script"),r=document.getElementsByTagName("head")[0],n=null,i=!1;r.appendChild(t),isNumber(e.timeout)&&(n=setTimeout(function(){if(i)return!1;e.error("timeout"),window[e.callbackName]=function(){logger.log("call jsonp error")},n=null,r.removeChild(t),i=!0},Math.min(e.timeout,3e4))),window[e.callbackName]=function(){clearTimeout(n),n=null,e.success.apply(null,arguments),window[e.callbackName]=function(){logger.log("call jsonp error")},r.removeChild(t)};var a=encodeURIComponent(e.callbackName),s="";if(e.url.indexOf("?")>-1?e.url+="&callbackName="+a:e.url+="?callbackName="+a,isObject(e.data)){var o=[];each(e.data,function(e,t){o.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}),(s=o.join("&"))&&(e.url+="&"+s)}t.onerror=function(a){if(i)return!1;window[e.callbackName]=function(){logger.log("call jsonp error")},clearTimeout(n),n=null,r.removeChild(t),e.error(a),i=!0},t.src=e.url}function listenPageState(e){({visibleHandler:isFunction(e.visible)?e.visible:function(){},hiddenHandler:isFunction(e.hidden)?e.hidden:function(){},visibilityChange:null,hidden:null,isSupport:function(){return"undefined"!=typeof document[this.hidden]},init:function(){"undefined"!=typeof document.hidden?(this.hidden="hidden",this.visibilityChange="visibilitychange"):"undefined"!=typeof document.mozHidden?(this.hidden="mozHidden",this.visibilityChange="mozvisibilitychange"):"undefined"!=typeof document.msHidden?(this.hidden="msHidden",this.visibilityChange="msvisibilitychange"):"undefined"!=typeof document.webkitHidden&&(this.hidden="webkitHidden",this.visibilityChange="webkitvisibilitychange"),this.listen()},listen:function(){if(this.isSupport()){var e=this;addEvent(document,this.visibilityChange,function(){document[e.hidden]?e.hiddenHandler():e.visibleHandler()},1)}else addEvent(window,"focus",this.visibleHandler),addEvent(window,"blur",this.hiddenHandler)}}).init()}function loadScript(e){e=extend({success:function(){},error:function(){},appendCall:function(e){document.getElementsByTagName("head")[0].appendChild(e)}},e);var t=null;"css"===e.type&&((t=document.createElement("link")).rel="stylesheet",t.href=e.url),"js"===e.type&&((t=document.createElement("script")).async="async",t.setAttribute("charset","UTF-8"),t.src=e.url,t.type="text/javascript"),t.onload=t.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(e.success(),t.onload=t.onreadystatechange=null)},t.onerror=function(){e.error(),t.onerror=null},e.appendCall(t)}function removeScriptProtocol(e){if("string"!=typeof e)return"";for(var t=/^\s*javascript/i;t.test(e);)e=e.replace(t,"");return e}function rot13obfs(e,t){t="number"==typeof t?t:13;for(var r=(e=String(e)).split(""),n=0;n<r.length;n++)r[n].charCodeAt(0)<126&&(r[n]=String.fromCharCode((r[n].charCodeAt(0)+t)%126));return r.join("")}function rot13defs(e){return rot13obfs(e=String(e),113)}function searchObjDate(e){isObject(e)&&each(e,function(t,r){isObject(t)?searchObjDate(e[r]):isDate(t)&&(e[r]=formatDate(t))})}var _sessionStorage={isSupport:function(){var e=!0,t="testIsSupportStorage";try{sessionStorage&&sessionStorage.setItem?(sessionStorage.setItem("__session_storage_support__",t),sessionStorage.removeItem("__session_storage_support__",t),e=!0):e=!1}catch(r){e=!1}return e}};function setCssStyle(e){var t=document.createElement("style");t.type="text/css";try{t.appendChild(document.createTextNode(e))}catch(i){t.styleSheet.cssText=e}var r=document.getElementsByTagName("head")[0],n=document.getElementsByTagName("script")[0];r?r.children.length?r.insertBefore(t,r.children[0]):r.appendChild(t):n.parentNode.insertBefore(t,n)}function strToUnicode(e){if("string"!=typeof e)return logger.log("\u8f6c\u6362unicode\u9519\u8bef",e),e;for(var t="",r=0;r<e.length;r++)t+="\\"+e.charCodeAt(r).toString(16);return t}function throttle(e,t,r){var n,i,a,s=null,o=0;r||(r={});var l=function(){o=!1===r.leading?0:now(),s=null,a=e.apply(n,i),s||(n=i=null)};return function(){var d=now();o||!1!==r.leading||(o=d);var c=t-(d-o);return n=this,i=arguments,c<=0||c>t?(s&&(clearTimeout(s),s=null),o=d,a=e.apply(n,i),s||(n=i=null)):s||!1===r.trailing||(s=setTimeout(l,c)),a}}function values(e){var t=[];return null==e?t:(each(e,function(e){t[t.length]=e}),t)}function toArray(e){return e?e.toArray?e.toArray():isArray(e)||isArguments(e)?Array.prototype.slice.call(e):values(e):[]}function unique(e){for(var t,r=[],n={},i=0;i<e.length;i++)(t=e[i])in n||(n[t]=!0,r.push(t));return r}var ENC={"+":"-","/":"_","=":"."},DEC={"-":"+",_:"/",".":"="},urlSafeBase64={encode:function(e){return e.replace(/[+\/=]/g,function(e){return ENC[e]})},decode:function(e){return e.replace(/[-_.]/g,function(e){return DEC[e]})},trim:function(e){return e.replace(/[.=]{1,2}$/,"")},isBase64:function(e){return/^[A-Za-z0-9+\/]*[=]{0,2}$/.test(e)},isUrlSafeBase64:function(e){return/^[A-Za-z0-9_-]*[.]{0,2}$/.test(e)}};function startsWith(e,t,r){return r=r||0,e.substr(r,t.length)===t}function noPrototypePollution(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e}var W={__proto__:null,noPrototypePollution:noPrototypePollution,ConcurrentStorage:ConcurrentStorage,EventEmitter:EventEmitter,URL:_URL,UUID:UUID,addEvent:addEvent,addHashEvent:addHashEvent,ajax:ajax,base64Decode:base64Decode,base64Encode:base64Encode,bindReady:bindReady,cookie:cookie,coverExtend:coverExtend,decodeURI:_decodeURI,decodeURIComponent:_decodeURIComponent,dfmapping:dfmapping,each:each,encodeDates:encodeDates,extend:extend,extend2Lev:extend2Lev,filter:filter,formatDate:formatDate,formatJsonString:formatJsonString,getCookieTopLevelDomain:getCookieTopLevelDomain,getDomBySelector:getDomBySelector,getElementContent:getElementContent,getHostname:getHostname,getIOSVersion:getIOSVersion,getQueryParam:getQueryParam,getQueryParamsFromUrl:getQueryParamsFromUrl,getRandom:getRandom,getRandomBasic:getRandomBasic,getScreenOrientation:getScreenOrientation,getUA:getUA,getURL:getURL,getURLPath:getURLPath,getURLSearchParams:getURLSearchParams,hasAttribute:hasAttribute,hasAttributes:hasAttributes,hashCode:hashCode,hashCode53:hashCode53,indexOf:indexOf,inherit:inherit,isArguments:isArguments,isArray:isArray,isBoolean:isBoolean,isDate:isDate,isElement:isElement,isEmptyObject:isEmptyObject,isFunction:isFunction,isHttpUrl:isHttpUrl,isIOS:isIOS,isJSONString:isJSONString,isNumber:isNumber,isObject:isObject,isString:isString,isSupportBeaconSend:isSupportBeaconSend,isSupportCors:isSupportCors,isUndefined:isUndefined,jsonp:jsonp,listenPageState:listenPageState,loadScript:loadScript,localStorage:_localStorage,logger:logger,map:map,mediaQueriesSupported:mediaQueriesSupported,now:now,removeScriptProtocol:removeScriptProtocol,rot13defs:rot13defs,rot13obfs:rot13obfs,ry:ry,safeJSONParse:safeJSONParse,searchObjDate:searchObjDate,sessionStorage:_sessionStorage,setCssStyle:setCssStyle,strToUnicode:strToUnicode,throttle:throttle,toArray:toArray,trim:trim,unique:unique,urlParse:urlParse,urlSafeBase64:urlSafeBase64,values:values,xhr:xhr,startsWith:startsWith},logWriters=[],saLogger={appendWriter:function(e){logWriters.push(e)},msg:function(){var e={module:"",level:"log",brand:"web-sdk",content:null};return e.content=Array.prototype.slice.call(arguments),{module:function(t){return isString(t)&&(e.module=t),this},level:function(t){return isString(t)&&(e.level=t),this},brand:function(t){return isString(t)&&(e.brand=t),this},log:function(){if(e.content&&e.content.length)for(var t=0;t<logWriters.length;t++)if("function"==typeof logWriters[t])try{logWriters[t].call(null,e)}catch(r){}return this}}}};function sdLog(){saLogger.msg.apply(saLogger,arguments).log()}function sdWarn(){saLogger.msg.apply(saLogger,arguments).level("warn").log()}function sdError(){saLogger.msg.apply(saLogger,arguments).level("error").log()}var sdPara={},defaultPara={preset_properties:{search_keyword_baidu:!1,latest_utm:!0,latest_traffic_source_type:!0,latest_search_keyword:!0,latest_referrer:!0,latest_referrer_host:!1,latest_landing_page:!1,latest_wx_ad_click_id:undefined,url:!0,title:!0},encrypt_cookie:!1,enc_cookie:!1,img_use_crossorigin:!1,name:"sa",max_referrer_string_length:200,max_string_length:1024,max_id_length:255,max_key_length:100,cross_subdomain:!0,show_log:!1,is_debug:!1,source_channel:[],sdk_id:"",auto_init:!0,is_track_single_page:!1,is_single_page:!1,batch_send:!1,custom_server_url:"",source_type:{},callback_timeout:200,datasend_timeout:8e3,is_track_device_id:!1,ignore_oom:!0,app_js_bridge:!1,white_list:{}};defaultPara.white_list[location.host]=_URL(location.href).hostname;var source_channel_standard="utm_source utm_medium utm_campaign utm_content utm_term",sdkversion_placeholder="1.27.11",domain_test_key="sensorsdata_domain_test",IDENTITY_KEY={EMAIL:"$identity_email",MOBILE:"$identity_mobile",LOGIN:"$identity_login_id"};function getCurrentDomain(e){var t=sdPara.current_domain;switch(typeof t){case"function":var r=t();return""===r||""===trim(r)?"url\u89e3\u6790\u5931\u8d25":-1!==r.indexOf(".")?r:"url\u89e3\u6790\u5931\u8d25";case"string":return""===t||""===trim(t)?"url\u89e3\u6790\u5931\u8d25":-1!==t.indexOf(".")?t:"url\u89e3\u6790\u5931\u8d25";default:var n=getCookieTopLevelDomain(null,domain_test_key,sdPara.is_secure_cookie);return""===e?"url\u89e3\u6790\u5931\u8d25":""===n?"url\u89e3\u6790\u5931\u8d25":n}}var saCookie={get:function(e){return cookie.get(e)},set:function(e,t,r,n){var i="";if(n=isUndefined(n)?sdPara.cross_subdomain:n){var a=getCurrentDomain(location.href);"url\u89e3\u6790\u5931\u8d25"===a&&(a=""),i=a?"; domain="+a:""}return cookie.set(e,t,r,sdPara.set_cookie_samesite,sdPara.is_secure_cookie,i)},remove:function(e,t){return t=isUndefined(t)?sdPara.cross_subdomain:t,cookie.remove(e,t)},isSupport:function(e,t){return e=e||"sajssdk_2015_cookie_access_test",t=t||"1",cookie.isSupport(e,t,0,null,sdPara.is_secure_cookie)}};function getNewUserFlagKey(e,t){var r="";if(!1===sdPara.cross_subdomain){try{if(t)r=_URL(t).hostname;else{var n=location.host;isUndefined(sd.para.white_list[n])||(r=sd.para.white_list[n])}}catch(i){sdError(i)}r="string"==typeof r&&""!==r?"sajssdk_2015_"+sdPara.sdk_id+e+"_"+r.replace(/\./g,"_"):"sajssdk_2015_root_"+sdPara.sdk_id+e}else r="sajssdk_2015_cross_"+sdPara.sdk_id+e;return r}function isNewUser(){return saCookie.isSupport()?null!==saCookie.get("sensorsdata_is_new_user")||null!==saCookie.get(getNewUserFlagKey("new_user")):null!==memory.get(memory.getNewUserFlagMemoryKey("new_user"))}saCookie.getNewUser=isNewUser;var memory={data:{},get:function(e){var t=this.data[e];return t===undefined?null:t._expirationTimestamp_!==undefined?(new Date).getTime()>t._expirationTimestamp_?null:t.value:t},set:function(e,t,r){if(r){var n=new Date;t={value:t,_expirationTimestamp_:"s"===String(r).slice(-1)?n.getTime()+1e3*Number(String(r).slice(0,-1)):n.getTime()+24*r*60*60*1e3}}this.data[e]=t},getNewUserFlagMemoryKey:function(e){return"sajssdk_2015_"+sdPara.sdk_id+e}},saNewUser={checkIsAddSign:function(e){"track"===e.type&&(isNewUser()?e.properties.$is_first_day=!0:e.properties.$is_first_day=!1)},is_first_visit_time:!1,is_page_first_visited:!1,checkIsFirstTime:function(e){"track"===e.type&&"$pageview"===e.event&&(this.is_first_visit_time?(e.properties.$is_first_time=!0,this.is_first_visit_time=!1):e.properties.$is_first_time=!1)},setDeviceId:function(){},storeInitCheck:function(){if(sd.is_first_visitor){var e=new Date,t={h:23-e.getHours(),m:59-e.getMinutes(),s:59-e.getSeconds()};saCookie.isSupport()?saCookie.set(getNewUserFlagKey("new_user"),"1",3600*t.h+60*t.m+t.s+"s"):memory.set(memory.getNewUserFlagMemoryKey("new_user"),"1",3600*t.h+60*t.m+t.s+"s"),this.is_first_visit_time=!0,this.is_page_first_visited=!0}else isNewUser()||(this.checkIsAddSign=function(e){"track"===e.type&&(e.properties.$is_first_day=!1)}),this.checkIsFirstTime=function(e){"track"===e.type&&"$pageview"===e.event&&(e.properties.$is_first_time=!1)}}};function saAddEvent(e,t,r){var n=!(!isObject(sdPara.heatmap)||!sdPara.heatmap.useCapture);return isObject(sdPara.heatmap)&&isUndefined(sdPara.heatmap.useCapture)&&"click"===t&&(n=!0),addEvent(e,t,r,n)}var EventEmitterSa=function(){this._events=[],this.pendingEvents=[]};function isBaiduTraffic(){var e=document.referrer;if(!e)return!1;try{var t=_URL(e).hostname;return t&&"baidu.com"===t.substring(t.length-"baidu.com".length)}catch(r){return!1}}EventEmitterSa.prototype={emit:function(e){var t=[].slice.call(arguments,1);each(this._events,function(r){r.type===e&&r.callback.apply(r.context,t)}),this.pendingEvents.push({type:e,data:t}),this.pendingEvents.length>20&&this.pendingEvents.shift()},on:function(e,t,r,n){isFunction(t)&&(this._events.push({type:e,callback:t,context:r||this}),n=!1!==n,this.pendingEvents.length>0&&n&&each(this.pendingEvents,function(n){n.type===e&&t.apply(r,n.data)}))},tempAdd:function(e,t){if(t&&e)return this.emit(e,t)},isReady:function(){}};var getBaiduKeyword={data:{},id:function(){return this.data.id?this.data.id:(this.data.id=getReferrerEqid(),this.data.id)},type:function(){return this.data.type?this.data.type:(this.data.type=getReferrerEqidType(),this.data.type)}};function getReferrerEqidType(){var e=getQueryParamsFromUrl(document.referrer);if(isEmptyObject(e)||!e.eqid){var t=getQueryParamsFromUrl(location.href);return e.ck||t.utm_source?"baidu_sem_keyword_id":"baidu_other_keyword_id"}return"baidu_seo_keyword_id"}function getReferrerEqid(){var e=getQueryParamsFromUrl(document.referrer);return isEmptyObject(e)||!e.eqid?UUID().replace(/-/g,""):e.eqid}function getReferrer(e,t){return isString(e=e||document.referrer)?(0!==(e=_decodeURI(e=trim(e))).indexOf("https://www.baidu.com/")||t||(e=e.split("?")[0]),isString(e=e.slice(0,sdPara.max_referrer_string_length))?e:""):"\u53d6\u503c\u5f02\u5e38_referrer\u5f02\u5e38_"+String(e)}function isReferralTraffic(e){if(""===(e=e||document.referrer))return!0;var t=getCookieTopLevelDomain(null,domain_test_key,sdPara.is_secure_cookie),r=getHostname(e);return-1===(r="."+r).indexOf(t)&&""!==t}function getKeywordFromReferrer(e,t){e=e||document.referrer;var r=sdPara.source_type.keyword;if(document&&isString(e)){if(0===e.indexOf("http")){var n=getReferSearchEngine(e),i=getQueryParamsFromUrl(e);if(isEmptyObject(i))return sdPara.preset_properties.search_keyword_baidu&&isBaiduTraffic()?void 0:"\u672a\u53d6\u5230\u503c";var a=null;for(var s in r)if(n===s&&isObject(i))if(isArray(a=r[s]))for(s=0;s<a.length;s++){var o=i[a[s]];if(o)return t?{active:o}:o}else if(i[a])return t?{active:i[a]}:i[a];return sdPara.preset_properties.search_keyword_baidu&&isBaiduTraffic()?void 0:"\u672a\u53d6\u5230\u503c"}return""===e?"\u672a\u53d6\u5230\u503c_\u76f4\u63a5\u6253\u5f00":"\u672a\u53d6\u5230\u503c_\u975ehttp\u7684url"}return"\u53d6\u503c\u5f02\u5e38_referrer\u5f02\u5e38_"+String(e)}function getReferSearchEngine(e){var t=getHostname(e);if(!t||"hostname\u89e3\u6790\u5f02\u5e38"===t)return"";var r={baidu:[/^.*\.baidu\.com$/],bing:[/^.*\.bing\.com$/],google:[/^www\.google\.com$/,/^www\.google\.com\.[a-z]{2}$/,/^www\.google\.[a-z]{2}$/],sm:[/^m\.sm\.cn$/],so:[/^.+\.so\.com$/],sogou:[/^.*\.sogou\.com$/],yahoo:[/^.*\.yahoo\.com$/]};for(var n in r)for(var i=r[n],a=0,s=i.length;a<s;a++)if(i[a].test(t))return n;return"\u672a\u77e5\u641c\u7d22\u5f15\u64ce"}var debug={distinct_id:function(){},jssdkDebug:function(){},_sendDebug:function(e){},apph5:function(e){var t="app_h5\u6253\u901a\u5931\u8d25-",r={1:t+"use_app_track\u4e3afalse",2:t+"Android\u6216\u8005iOS\uff0c\u6ca1\u6709\u66b4\u9732\u76f8\u5e94\u65b9\u6cd5",3.1:t+"Android\u6821\u9a8cserver_url\u5931\u8d25",3.2:t+"iOS\u6821\u9a8cserver_url\u5931\u8d25",4.1:t+"H5 \u6821\u9a8c iOS server_url \u5931\u8d25",4.2:t+"H5 \u6821\u9a8c Android server_url \u5931\u8d25"},n=e.output,i=e.step,a=e.data||"";"all"!==n&&"console"!==n||sdLog(r[i]),("all"===n||"code"===n)&&isObject(sdPara.is_debug)&&sdPara.is_debug.apph5&&(a.type&&"profile"===a.type.slice(0,7)||(a.properties._jssdk_debug_info="apph5-"+String(i)))},defineMode:function(e){var t={1:{title:"\u5f53\u524d\u9875\u9762\u65e0\u6cd5\u8fdb\u884c\u53ef\u89c6\u5316\u5168\u57cb\u70b9",message:"App SDK \u4e0e Web JS SDK \u6ca1\u6709\u8fdb\u884c\u6253\u901a\uff0c\u8bf7\u8054\u7cfb\u8d35\u65b9\u6280\u672f\u4eba\u5458\u4fee\u6b63 App SDK \u7684\u914d\u7f6e\uff0c\u8be6\u7ec6\u4fe1\u606f\u8bf7\u67e5\u770b\u6587\u6863\u3002",link_text:"",link_url:""},2:{title:"\u5f53\u524d\u9875\u9762\u65e0\u6cd5\u8fdb\u884c\u53ef\u89c6\u5316\u5168\u57cb\u70b9",message:"App SDK \u4e0e Web JS SDK \u6ca1\u6709\u8fdb\u884c\u6253\u901a\uff0c\u8bf7\u8054\u7cfb\u8d35\u65b9\u6280\u672f\u4eba\u5458\u4fee\u6b63 Web JS SDK \u7684\u914d\u7f6e\uff0c\u8be6\u7ec6\u4fe1\u606f\u8bf7\u67e5\u770b\u6587\u6863\u3002",link_text:"",link_url:""},3:{title:"\u5f53\u524d\u9875\u9762\u65e0\u6cd5\u8fdb\u884c\u53ef\u89c6\u5316\u5168\u57cb\u70b9",message:"Web JS