You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
19 KiB
2 lines
19 KiB
1 year ago
|
var mtjwxsdk=function(t){"use strict";var e,n,r="1.10.23",o="https://hmma.baidu.com/mini.gif",a={app:["onShow","onHide","onError"],page:["onShow","onReady","onHide","onPageScroll"],share:["onShareAppMessage"],behavior:["tap"]},i="mtj_uuid",c="mtj_user",s="mtj_user_property",u="mtj_track_status",f="mtj_remote_config",l="mtj_ab_experiment_list",h="mtj_ab_active_experiment_ids",p={},d={type:1},g={aso:{}},m={},y=function(t){if(!1!==p.trackStatus){var n=t.data.et?{mtj_ii:t.data.uuid||"",mtj_et:t.data.et,mtj_en:t.data.en}:{};return e.request({url:t.url,data:t.data,header:Object.assign({"content-type":"application/json"},n,t.header),method:t.method||"POST",dataType:t.dataType||"json",success:function(e){t.success&&t.success(e)},fail:function(e){t.fail&&t.fail(e)}})}},v=function(){return"undefined"!=typeof crypto&&crypto.getRandomValues?crypto.getRandomValues(new Uint32Array(1))[0]:Math.floor(4294967295*Math.random())},b=function(t,e){return"[object "+e+"]"==={}.toString.call(t)},j=function(t,e,n){var r=(t=t.replace(new RegExp(e+"=[^&]*","g"),"").replace(/(\?|&)&/g,"$1").replace(/(\?|&)$/g,"")).indexOf("?")>0?"&":"?";return t+r+e+"="+encodeURIComponent(n)},S=function t(e){return b(e,"Object")||b(e,"Array")?(Object.keys(e).forEach((function(n){var r=e[n];b(r,"Object")||b(r,"Array")?e[n]=t(r):e[n]=""+r})),e):e},O=function(t){return b(t,"String")&&/^[a-z][a-z0-9_]{0,31}$/.test(t)},w=function(t){return b(t,"String")&&/^[a-z0-9_]{1,32}$/.test(t)},k=function(t){return b(t,"String")||b(t,"Number")},x=function(t){return b(t,"String")&&/^\d{11}$/.test(t)},P=function(t){return b(t,"String")&&28===t.length},_=0,T=function(t){return new Promise((function(e,n){return t.data=t.data||{},p.blacklist&&(p.blacklist.indexOf("all")>-1&&t.data.et||p.blacklist.indexOf("behavior")>-1&&"behavior"===t.data.et)?e():(t.data.v=r,t.data.rqc=++_,o=t.data,JSON.stringify(o).length<=204800?(t.success=function(t){return e(t)},t.fail=function(t){return n(t)},void y(t)):(_--,n(new Error("invalid data"))));var o}))},I=function(t,e){var n=b(e,"Object")?JSON.stringify(e):""+e;T({url:o,dataType:"string",data:Object.assign({},d,{et:"error",en:t,ep:{ex:n},rid:v()})})},A=function(t){t.rid=v(),t.aso=t.aso||{};var e={url:o,dataType:"string",data:Object.assign({},d,t)};T(e),(m.circleToken||m.circleByThreeFingers)&&("page"===t.et&&"show"===t.en||"behavior"===t.et&&"tap"===t.en)&&(e.url="https://hmma.baidu.com/mini.gif?circle=1",e.data.token=m.circleToken,T(e).catch((function(t){return console.error(t)})))};function E(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==n)return;var r,o,a=[],i=!0,c=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);i=!0);}catch(t){c=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(c)throw o}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return N(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return N(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var C=function(t){try{return e.getStorageSync(t)}catch(t){I("getStorageSync",t)}},q=function(t,n){try{e.setStorageSync(t,n)}catch(t){I("setStorageSync",t)}},U=function(t){try{e.removeStorageSync(t)}catch(t){I("removeStorageSync",t)}},D=function(){return Promise.resolve().then((function(){var t=C(i);return b(t,"String")&&32===t.length||(t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(function(t){return(t^("undefined"!=typeof crypto&&crypto.getRandomValues?crypto.getRandomValues(new Uint8Array(1))[0]:Math.floor(255*Math.random()))&15>>t/4).toString(16)})),q(i,t),p.hasABTest&&(U(l),U(h))),t}))},B=function(t){return new Promise((
|