cttq-mc
Version:
cttqtest
1 lines • 177 kB
JavaScript
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";window.__JSSDK_VERSION__={SDKVersion:"2.2.1",SDKUpdateVersion:"2.2.1",CommitHash:""};var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var n=t((function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof g?t:g,i=Object.create(o.prototype),a=new L(r||[]);return i._invoke=function(e,t,n){var r=f;return function(o,i){if(r===p)throw new Error("Generator is already running");if(r===h){if("throw"===o)throw i;return I()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=T(a,n);if(s){if(s===v)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===f)throw r=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var c=l(e,t,n);if("normal"===c.type){if(r=n.done?h:d,c.arg===v)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=h,n.method="throw",n.arg=c.arg)}}}(e,n,a),i}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f="suspendedStart",d="suspendedYield",p="executing",h="completed",v={};function g(){}function m(){}function _(){}var y={};y[i]=function(){return this};var b=Object.getPrototypeOf,w=b&&b(b(A([])));w&&w!==n&&r.call(w,i)&&(y=w);var S=_.prototype=g.prototype=Object.create(y);function k(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(o,i,a,s){var c=l(e[o],e,i);if("throw"!==c.type){var u=c.arg,f=u.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,s)}))}s(c.arg)}var o;this._invoke=function(e,r){function i(){return new t((function(t,o){n(e,r,t,o)}))}return o=o?o.then(i,i):i()}}function T(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method))return v;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=l(r,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var i=o.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function A(e){if(e){var n=e[i];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}return{next:I}}function I(){return{value:t,done:!0}}return m.prototype=S.constructor=_,_.constructor=m,m.displayName=c(_,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,c(e,s,"GeneratorFunction")),e.prototype=Object.create(S),e},e.awrap=function(e){return{__await:e}},k(C.prototype),C.prototype[a]=function(){return this},e.AsyncIterator=C,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new C(u(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(S),c(S,s,"Generator"),S[i]=function(){return this},S.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=A,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:A(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}));function r(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}var o=function(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function s(e){r(a,o,i,s,c,"next",e)}function c(e){r(a,o,i,s,c,"throw",e)}s(void 0)}))}};var i,a,s,c=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o};!function(e){e.userCaptureScreenObserved="userCaptureScreenObserved",e.onWatermarkChangeObserved="onWatermarkChange",e.onDownloadTaskStateChange="onDownloadTaskStateChange",e.nfcFoundDevice="nfcFoundDevice"}(i||(i={})),function(e){e.IOS="ios",e.ANDROID="android",e.MAC="mac",e.WINDOWS="windows"}(a||(a={})),function(e){e.CDN="cdn",e.NPM="npm",e.DEV="dev"}(s||(s={}));var u,l,f,d,p,h,v,g=function(e){var t;if(e.includes("Lark")||e.includes("Feishu"))return null==(t=e.match(/(lark|feishu|lark-staging|feishu-staging|lark-prerelease|feishu-prerelease|lark-oversea)\/([\d.]+)/i))?void 0:t[2]},m={versions:(u=navigator.userAgent,l=navigator.platform,f=/(Android|iPhone|iPad|iPod|iOS)/i.test(u),d=g(u),p=u.includes("Lark")||u.includes("Feishu"),h=d&&w(d,"3.46.0")<0,v=d&&w(d,"3.46.0")>=0&&u.includes("WebApp"),{trident:u.includes("Trident"),presto:u.includes("Presto"),webKit:u.includes("AppleWebKit"),gecko:u.includes("Gecko")&&!u.includes("KHTML"),mobile:!!u.match(/AppleWebKit.*Mobile.*/)||!!u.match(/AppleWebKit/),ios:!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),android:u.includes("Android")||u.includes("Linux"),iPhone:u.includes("iPhone")||u.includes("Mac"),iPad:u.includes("iPad"),webApp:!u.includes("Safari"),PCFeishu:!f&&p&&(h||v),mobileFeishu:f&&p,larkVersion:g(u),mac:l.includes("Mac"),win:l.includes("Win")})};function _(){return new Promise((function(e){var t=0;!function n(){var r,o;(null==(r=window.webkit)||null==(o=r.messageHandlers)?void 0:o.invoke)||window.WebViewJavascriptBridge||t>100?e(0):(setTimeout(n,10+t),t++)}()}))}function y(e){return Object.prototype.toString.call(e).slice(8,-1)}function b(e,t){t?console.warn("【H5-JS-SDK】: "+e):console.error("【H5-JS-SDK】: "+e)}function w(e,t){for(var n=e.replace(/-\d*$/,"").split(".").map((function(e){return+e})),r=t.replace(/-\d*$/,"").split(".").map((function(e){return+e})),o=0;o<n.length;o++){if(n[o]>r[o])return 1;if(n[o]<r[o])return-1}return 0}function S(e){return{name:(e=e||{}).name,code:void 0!==e.code?e.code:e.errorCode,message:e.message||e.errorMessage||e.errorMsg,fileName:e.fileName,stack:e.stack,lineNumber:e.lineNumber,columnNumber:e.columnNumber}}var k="";function C(){return k}var T=function(e){var t=e.versions,n=t.ios,r=t.android,o=t.mac,i=t.win;return n?a.IOS:r?a.ANDROID:o?a.MAC:i?a.WINDOWS:null};var E,O=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t};!function(e){e[e.unknown=0]="unknown",e[e.android=1]="android",e[e.iOS=2]="iOS"}(E||(E={}));var L=0;var A=function(e){function t(){return e.apply(this,arguments)||this}return O(t,e),t.prototype.invoke=function(t,n,r){var o=n.params,i=void 0===o?{}:o;if(n.__v2__){var a=i.success,s=i.fail,u=i.cancel,l=i.complete,f=i.progress,d=i.eventName,p=i.isListener,h=void 0!==p&&p,v=c(i,["success","fail","cancel","complete","progress","eventName","isListener"]),g={method:t,params:Object.assign({},v,{__v2__:!0}),callbackConfig:{onSuccess:a,onFail:s,onProgress:f,onCancel:u,onComplete:l},eventName:d,isListener:h,isTT:!0};e.prototype.invokeNative.call(this,g)}else{var m=r.eventName,_=r.keep,y=void 0!==_&&_,b=r.onProgress,w=r.origialCallback;b&&(r.onProgress=function(e){e&&b(e.data)});var S={method:t,params:n,callbackConfig:r,eventName:m||t,isListener:y,isTT:!1,origialCallback:w};e.prototype.invokeNative.call(this,S)}},t}(function(){function e(){var e=this;this.callbackMapObj={},this.callbackMap=new WeakMap,this._invokeQueue=[],this._onBridgeReady=function(){var t=e.callbackMapObj;window.LarkWebViewJavaScriptBridge={nativeCallBack:function(e){var n;null==(n=t[e.callbackID])||n[0](e)}},e._invokeQueue.forEach((function(e){e()}))},this._invokeNative=function(t){var n=t.method,r=t.params,o=t.callbackConfig,i=t.eventName,a=t.isListener,s=t.isTT,c=t.origialCallback,u=o.onSuccess,l=o.onFail,f=o.onProgress,d=o.onCancel,p=o.onComplete,h=a?i:""+L++,v=function(t){var n=t.callbackType,r=t.data;if(r&&"string"==typeof r)try{r=JSON.parse(r)}catch(e){console.log("json parse error",e)}"cancel"===n?(null==d||d(r),null==p||p(r)):"failure"===n?(null==l||l(r),null==p||p(r)):"continued"===n?null==f||f(r):(null==u||u(r),null==p||p(r)),a||"continued"===n||delete e.callbackMapObj[h]};if(a&&e.callbackMapObj[h]?e.callbackMapObj[h].push(v):e.callbackMapObj[h]=[v],a&&(f||c)){var g=c||f;e.callbackMap.set(g,e.callbackMapObj[h])}var m={apiName:n,data:r,callbackID:h};if(!a||!s){var _=e._getSystemType();if(_===E.android)try{window.Lark_Bridge.invokeNative(JSON.stringify(m)||"")}catch(e){console.log("json parse error",e)}_===E.iOS&&window.webkit.messageHandlers.invokeNative.postMessage(m)}},window.addEventListener("WebViewJSBridgeReady",this._onBridgeReady.bind(this),!1)}var t=e.prototype;return t._getSystemType=function(){var e=navigator.userAgent;return/android/i.test(e)?E.android:/iPad|iPhone|iPod/.test(e)?E.iOS:E.unknown},t._stashTask=function(e){this._invokeQueue.push(e)},t.invokeNative=function(e){var t=this;this._isNativeReady()?this._invokeNative(e):this._stashTask((function(){return t._invokeNative(e)}))},t.removeListener=function(e,t){var n=this.callbackMapObj[e];if(n&&Array.isArray(n)&&!(n.length<=0))if(t)for(var r=this.callbackMap.get(t),o=0;o<r.length;o++){var i=r[o],a=n.indexOf(i);if(!~a)return;n.splice(a,1),0===n.length&&delete this.callbackMapObj[e]}else delete this.callbackMapObj[e]},t._isNativeReady=function(){var e=this._getSystemType(),t=!1;return e===E.android&&(t=!(!window.Lark_Bridge||!window.Lark_Bridge.invokeNative)),e===E.iOS&&(t=!!(window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.invokeNative&&window.webkit.messageHandlers.invokeNative.postMessage)),t},e}());function I(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var P,j,D,R,x=function(e,t,n){return t&&I(e.prototype,t),n&&I(e,n),e};!function(e){e[e.trace=1]="trace",e[e.normal=2]="normal",e[e.warn=3]="warn",e[e.error=4]="error",e[e.fatal=5]="fatal"}(P||(P={})),function(e){e.success="success",e.fail="fail",e.cancel="cancel",e.timeout="timeout"}(j||(j={})),function(e){e.traceId="trace_id",e.errorCode="error_code",e.errorMsg="error_msg",e.time="time",e.duration="duration",e.monitorLevel="monitor_level",e.monitorDomain="monitor_domain",e.monitorCode="monitor_code",e.monitorID="monitor_id",e.monitorMessage="monitor_message",e.monitorTags="monitor_tags",e.monitorFile="monitor_file",e.monitorFunction="monitor_function",e.monitorLine="monitor_line",e.monitorColumn="monitor_column",e.monitorStack="monitor_stack",e.resultType="result_type"}(D||(D={})),function(e){e[e.debug=1]="debug",e[e.info=2]="info",e[e.warn=3]="warn",e[e.error=4]="error",e[e.fatal=5]="fatal"}(R||(R={}));var F,M=",",B="op_monitor_event",N="op_monitor",z="event_name";!function(e){e.warn="warn",e.error="error"}(F||(F={}));var W,V={string:"string",number:1,func:function(){},object:{},set:new Set};function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function U(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?U(Object(n),!0).forEach((function(t){q(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}!function(e){e.sampleRate="sample_rate",e.traceSampleRate="trace_sample_rate",e.normalSampleRate="normal_sample_rate",e.warnSampleRate="warn_sample_rate",e.errorSampleRate="error_sample_rate",e.fatalSampleRate="fatal_sample_rate",e.rules="rules",e.priority="priority",e.filters="filters",e.key="key",e.values="values"}(W||(W={}));var K={debugLevel:F.warn};function H(e){return Object.prototype.toString.call(e).slice(8,-1)}var Q=function(){};function G(e){return"function"==typeof e}function X(e){return void 0===e}var $={string:function(e){return"string"==typeof e||"String"===H(e)},undefined:X,object:function(e){return null!==e&&"object"==typeof e},function:G,number:function(e){return"number"==typeof e&&!Number.isNaN(e)}};function Z(e,t){return t?Object.entries(e).filter((function(e){var n=e[0],r=e[1];return!t(r,n)})).reduce((function(e,t){var n,r=t[0],o=t[1];return Object.assign(e,((n={})[r]=o,n))}),{}):e}function Y(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Error(""),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:K.debugLevel;switch(t){case F.error:throw e;case F.warn:default:console.error(e)}}function ee(e,t,n,r){Object.defineProperty(e,t,{get:function(){return n},set:function(){G(r)?r(e,t):Y(function(e,t){return TypeError("Cannot assign to read only property ".concat(t," of ").concat(e.constructor))}(e,t))}})}function te(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"param",r=H(e),o=H(t);if(r!==o)return"".concat(n," should pass ").concat(o,", not ").concat(r);var i="";switch(o){case"Object":Object.entries(t).forEach((function(t){var r=t[0],o=t[1];i+=te(e[r],o,"".concat(n,".").concat(r))}));break;case"Array":if(e.length<t.length)return"".concat(n," should have more than ").concat(t.length," items, not ").concat(e.length," items");for(var a=0;a<t.length;a++)i+=te(e[a],t[a],"".concat(n,"[").concat(a,"]"))}return i}function ne(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"param",r=arguments.length>3?arguments[3]:void 0,o=te(e,t,n);return G(r)||(r=function(e){Y(TypeError(e))}),o&&G(r)&&r(o),!o}var re,oe,ie=function(){function e(e){var t=e.priority,n=e.sampleRate,r=e.filters;this.priority=0,this.filters=[],this.priority=t,this.sampleRate=n,this.filters=r}return e.prototype.match=function(e){return this.filters.every((function(t){return t.match(e)}))},e}(),ae=function(){function e(e){var t=e.key,n=e.values;this.key="",this.values=[],this.key=t,this.values=n}return e.prototype.match=function(e){var t="".concat(e[this.key]);return this.values.includes(t)},e}(),se=function(){function e(){this._defaultSampleRate=1,this._traceSampleRate=0,this._normalSampleRate=1,this._warnSampleRate=1,this._errorSampleRate=1,this._fatalSampleRate=1,this._orderedRules=[]}var t=e.prototype;return t.buildConfig=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e[W.sampleRate],n=e[W.traceSampleRate],r=e[W.normalSampleRate],o=e[W.warnSampleRate],i=e[W.errorSampleRate],a=e[W.fatalSampleRate],s=e[W.rules];$.number(t)&&(this._defaultSampleRate=t),$.number(n)&&(this._traceSampleRate=n),$.number(r)&&(this._normalSampleRate=r),$.number(o)&&(this._warnSampleRate=o),$.number(i)&&(this._errorSampleRate=i),$.number(a)&&(this._fatalSampleRate=a);var c=this._paserRules(s);this._orderedRules=c.sort((function(e,t){return t.priority-e.priority}))},t._getMatchedRuleInOrderedRules=function(e){return this._orderedRules.find((function(t){return t.match(e)}))},t.getSampleRate=function(e){var t=this._getMatchedRuleInOrderedRules(e),n=this._defaultSampleRate;switch(e[D.monitorLevel]){case P.trace:n=this._traceSampleRate;break;case P.normal:n=this._normalSampleRate;break;case P.warn:n=this._warnSampleRate;break;case P.error:n=this._errorSampleRate;break;case P.fatal:n=this._fatalSampleRate}return t&&!$.undefined(t.sampleRate)&&(n=t.sampleRate),n>=1?1:0},t._paserRules=function(e){return Array.isArray(e)?e=e.map((function(e){if($.object(e)){var t=e[W.priority],n=e[W.sampleRate],r=e[W.filters];return $.number(t)||(t=0),$.number(n)||(n=void 0),r=Array.isArray(r)?r.map((function(e){if($.object(e)){var t=e,n=t[W.key],r=t[W.values];if($.string(n)&&Array.isArray(r))return e=new ae({key:n,values:r})}})).filter((function(e){return e})):[],new ie({priority:t,sampleRate:n,filters:r})}})).filter((function(e){return e})):[]},e}(),ce=function(){var e=function(){function e(e){this._commonMetrics={},this._commonCategories={},this._commonTags=new Set;var t=e||{},n=t.defaultName,r=void 0===n?B:n,o=t.log,i=void 0===o?Q:o,a=t.report,s=void 0===a?Q:a;ne(r,V.string,"defaultName"),ne(i,V.func,"log"),ne(s,V.func,"report"),this.defaultName=String(r),this._logger=i,this._reporter=s}var t=e.prototype;return t.setRemoteConfig=function(e){this._remoteConfig=e},t.getRemoteConfig=function(){return this._remoteConfig?this._remoteConfig:this.constructor.globalRemoteConfig},t.log=function(){this._logger.apply(this,arguments)},t.report=function(){var e,t=this.getRemoteConfig(),n=arguments.length<=0?void 0:arguments[0],r=n.name,o=n.metrics,i=n.categories,a=J(J(((e={})[z]=r,e),o),i);t.getSampleRate(a)<1||this._reporter.apply(this,arguments)},x(e,[{key:"commonMetrics",get:function(){return this._commonMetrics},set:function(e){ne(e,V.object,"commonMetrics")&&(this._commonMetrics=e)}},{key:"commonCategories",get:function(){return this._commonCategories},set:function(e){ne(e,V.object,"commonCategories")&&(this._commonCategories=e)}},{key:"commonTags",get:function(){return this._commonTags},set:function(e){ne(e,V.set,"commonTags")&&(this._commonTags=e)}}]),e}();return e.globalRemoteConfig=new se,e}(),ue=function(){var e=function(){function e(){this.config={}}e.setup=function(e){this.default.setConfig(e)};var t=e.prototype;return t.setConfig=function(e){if(e instanceof ce)this.config=e;else{this.config=new ce(e);var t=e.commonMetrics,n=e.commonCategories,r=e.commonTags;t&&(this.config.commonMetrics=t),n&&(this.config.commonCategories=n),r&&(this.config.commonCategories=r)}},t.getConfig=function(){return this.config},t.log=function(e){if($.function(this.config.log)){var t=R.info;switch(e.getLevel()){case P.trace:case P.normal:t=R.info;break;case P.warn:t=R.warn;break;case P.error:t=R.error;break;case P.fatal:t=R.fatal;break;default:t=R.info}var n=N,r=e.getValue(D.monitorFile),o=e.getValue(D.monitorFunction),i=e.getValue(D.monitorLine),a="monitor_event : ".concat(e.getName()," ")+"".concat(JSON.stringify(e.getData()));this.invokeLog(Z({level:t,tag:n,file:r,functionName:o,line:i,content:a},X))}},t.invokeLog=function(e){$.function(this.config.log)&&this.config.log(e)},t.invokeReport=function(e){$.function(this.config.report)&&this.config.report(e)},t.flush=function(e){if($.function(this.config.report)){var t=e.getName()||this.config.defaultName,n=e.getMetrics(),r=e.getCategories();this.invokeReport(Z({name:t,metrics:n,categories:r},X))}},e}();return e.default=new e,e}(),le=function(){function e(e){var t=e||{},n=t.domain,r=t.code,o=t.level,i=t.message;ne(n,V.string,"domain"),ne(r,V.number,"code"),ne(o,V.number,"level"),ne(i,V.string,"message"),function(e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"param",r=arguments.length>4?arguments[4]:void 0;if(X((arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})[e])){var o="".concat(n," should pass ").concat(t,", not ").concat(e);return G(r)||(r=function(e){Y(TypeError(e))}),G(r)&&r(o),!1}}(o,P,"MonitorLevel","level"),ee(this,"version",1),ee(this,"domain",String(n)),ee(this,"code",Number(r)),ee(this,"ID",String(this.generateID())),ee(this,"level",o),ee(this,"message",String(i))}var t=e.prototype;return t.generateID=function(){return"".concat(this.version,"-").concat(this.domain,"-").concat(this.code)},t.equals=function(t){return t instanceof e&&t.ID===this.ID},e}(),fe=function(){function e(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.time=0,this.startTime=0,this.endTime=0,this.metrics={},this.categories={},this.tags=new Set;var t=e.service,n=void 0===t?ue.default:t,r=e.name,o=e.code;this.service=n,this.name=r,this.code=o,this.categories=J({},n.getConfig().commonCategories),this.metrics=J({},n.getConfig().commonMetrics),this.tags=new Set(n.getConfig().commonTags)}var t=e.prototype;return t.hasErrorInfo=function(){return!$.undefined(this.getValue(D.errorCode))||!$.undefined(this.getValue(D.errorMsg))},t.tagsInline=function(){return 0===this.tags.size?"":Array.from(this.tags).reduce((function(e,t){return"".concat(e).concat(t?M+t:"")}))},t.addMetricValue=function(e,t){return this.metrics[e]=t,this},t.addCategoryValue=function(e,t){return this.categories[e]=t,this},t.addTag=function(e){return this.tags.add(e),this},t.addMap=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.entries(t).forEach((function(t){var n=t[0],r=t[1];$.number(r)?e.addMetricValue(n,r):e.addCategoryValue(n,r)})),this},t.tracing=function(e){return this.addCategoryValue(D.traceId,e),this},t.flush=function(){var e=this.code||(this.hasErrorInfo()?this.codeIfError:void 0);$.undefined(this.level)&&e&&e.level&&this.setLevel(e.level),e&&(this.addCategoryValue(D.monitorDomain,e.domain),this.addMetricValue(D.monitorCode,e.code),this.addCategoryValue(D.monitorID,e.ID),this.addCategoryValue(D.monitorMessage,e.message)),this.tags&&this.addCategoryValue(D.monitorTags,this.tagsInline()),this.time<=0&&this.setTime(Date.now()),this.service.flush(this),this.service.log(this)},t.setMonitorCode=function(e){return this.code=e,this},t.setMonitorCodeIfError=function(e){return this.codeIfError=e,this},t.setLevel=function(e){return this.level=e,this.addMetricValue(D.monitorLevel,e),this},t.setErrorCode=function(e){return this.addCategoryValue(D.errorCode,String(e)),this},t.setErrorMessage=function(e){return this.addCategoryValue(D.errorMsg,String(e)),this},t.setError=function(e){var t=e.message,n=e.fileName,r=e.lineNumber,o=e.columnNumber,i=e.stack,a=e.code;return $.string(t)&&this.addCategoryValue(D.errorMsg,t),$.string(n)&&this.addCategoryValue(D.monitorFile,n),$.string(i)&&this.addCategoryValue(D.monitorStack,i),$.number(a)&&this.addMetricValue(D.errorCode,a),$.number(r)&&this.addMetricValue(D.monitorLine,r),$.number(o)&&this.addMetricValue(D.monitorColumn,o),this},t.setTime=function(e){return this.time=e,this.addMetricValue(D.time,e),this},t.timing=function(){var e=Date.now();return this.startTime>0?(this.endTime=e,this.setDuration(this.endTime-this.startTime)):this.startTime=e,this},t.setDuration=function(e){return this.addMetricValue(D.duration,e),this},t.getName=function(){return this.name},t.getLevel=function(){return this.level},t.getMetrics=function(){return this.metrics},t.getCategories=function(){return this.categories},t.getData=function(){return J(J({},this.metrics),this.categories)},t.getValue=function(e){return this.metrics[e]||this.categories[e]},t.setResultType=function(e){return this.addCategoryValue(D.resultType,e),this},t.setResultTypeSuccess=function(){return this.setResultType(j.success),this},t.setResultTypeFail=function(){return this.setResultType(j.fail),this},t.setResultTypeCancel=function(){return this.setResultType(j.cancel),this},t.setResultTypeTimeout=function(){return this.setResultType(j.timeout),this},e}();!function(e){e.getSdkConfigTimeout="h5jssdk_get_sdk_config_timeout",e.getSdkConfigError="h5jssdk_get_sdk_config_error",e.authenticationFailure="h5jssdk_authentication_failure"}(re||(re={})),function(e){e.success="success",e.fail="fail",e.cancel="cancel",e.timeout="timeout"}(oe||(oe={}));var de,pe="js.open_platform.web",he=((de={})[re.getSdkConfigTimeout]={domain:pe+".op_web_js_script_error",code:10001,level:P.error,message:"h5jssdk_get_sdk_config_timeout"},de[re.getSdkConfigError]={domain:pe+".op_web_js_script_error",code:10002,level:P.error,message:"h5jssdk_get_sdk_config_error"},de[re.authenticationFailure]={domain:pe+".op_web_js_script_error",code:10003,level:P.error,message:"h5jssdk_authentication_failure"},de[oe.success]={domain:pe+".api",code:1e4,level:P.normal,message:"api_success"},de[oe.fail]={domain:pe+".api",code:10002,level:P.error,message:"api_fail"},de[oe.cancel]={domain:pe+".api",code:10001,level:P.warn,message:"api_cancel"},de[oe.timeout]={domain:pe+".api",code:10003,level:P.error,message:"api_timeout"},de.DEFAULT={domain:pe,code:1e4,level:P.warn,message:"undefined_default_code"},de),ve="op_web_js_script_error",ge="op_web_api_invoke_result",me=[],_e=function(e,t){return void 0===e&&(e=""),void 0===t&&(t=he.DEFAULT),new fe(e?{name:e,code:new le(t)}:{name:"undefined_default_code",code:new le(he.DEFAULT)})},ye=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};var be=void 0,we=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.set=function(e,n){var r=e,o=n;if(null===o)return!1;var i="";if(r.indexOf(".")>-1){var a=r.split(".");i=a[0],r=a[1]}"os_version"===r&&(o=""+o),i?"user"===i||"header"===i?t.envInfo[i][r]=o:"headers"===i?t.envInfo.header.headers[r]=o:t.envInfo.header.headers.custom[r]=o:t.envInfo.user.hasOwnProperty(r)?["user_type","device_id","ip_addr_id"].indexOf(r)>-1?t.envInfo.user[r]=Number(o):["user_id","web_id","user_unique_id","ssid"].indexOf(r)>-1?t.envInfo.user[r]=String(o):["user_is_auth","user_is_login"].indexOf(r)>-1&&(t.envInfo.user[r]=Boolean(o)):t.envInfo.header.hasOwnProperty(r)?t.envInfo.header[r]=o:t.envInfo.header.headers.hasOwnProperty(r)?t.envInfo.header.headers[r]=o:t.envInfo.header.headers.custom[r]=o},this.get=function(){var e={user:{},header:{headers:{custom:{}}}},n=t.envInfo,r=n.user,o=Object.keys(r),i=Array.isArray(o),a=0;for(o=i?o:o[Symbol.iterator]();;){var s;if(i){if(a>=o.length)break;s=o[a++]}else{if((a=o.next()).done)break;s=a.value}var c=s;r[c]!==be&&(e.user[c]=r[c])}var u=n.header,l=Object.keys(u),f=Array.isArray(l),d=0;for(l=f?l:l[Symbol.iterator]();;){var p;if(f){if(d>=l.length)break;p=l[d++]}else{if((d=l.next()).done)break;p=d.value}var h=p;u[h]!==be&&"headers"!==h&&(e.header[h]=u[h])}var v=n.header.headers,g=Object.keys(v),m=Array.isArray(g),_=0;for(g=m?g:g[Symbol.iterator]();;){var y;if(m){if(_>=g.length)break;y=g[_++]}else{if((_=g.next()).done)break;y=_.value}var b=y;"custom"!==b&&v[b]!==be&&(e.header.headers[b]=v[b])}var w=n.header.headers.custom,S=Object.keys(w);if(S.length){var k=S,C=Array.isArray(k),T=0;for(k=C?k:k[Symbol.iterator]();;){var E;if(C){if(T>=k.length)break;E=k[T++]}else{if((T=k.next()).done)break;E=T.value}var O=E;e.header.headers.custom[O]=w[O]}}return{user:e.user,header:ye({},e.header,{headers:e.header.headers})}},this.envInfo={user:{user_unique_id:be,user_type:be,user_id:be,user_is_auth:be,user_is_login:be,device_id:be,web_id:be,ip_addr_id:be,ssid:be},header:{app_id:be,app_name:be,app_install_id:be,app_package:be,app_channel:be,app_version:be,os_name:be,os_version:be,device_model:be,ab_client:be,ab_version:be,traffic_type:be,utm_source:be,utm_medium:be,utm_campaign:be,client_ip:be,device_brand:be,os_api:be,access:be,language:be,region:be,app_language:be,app_region:be,creative_id:be,ad_id:be,campaign_id:be,log_type:be,rnd:be,platform:be,sdk_version:be,province:be,city:be,timezone:be,tz_offset:be,tz_name:be,sim_region:be,carrier:be,resolution:be,browser:be,browser_version:be,referrer:be,referrer_host:be,headers:{utm_term:be,utm_content:be,custom:{}}}}},Se=function(e){var t=document.createElement("a");return t.href=e,t},ke=screen.width||0,Ce=screen.height||0,Te=ke+" x "+Ce,Ee=navigator.appVersion,Oe=navigator.userAgent,Le=navigator.language,Ae=document.referrer,Ie=Se(Ae).hostname,Pe=function(e){var t=Se(e).search;t=t.slice(1);var n={};return t.split("&").forEach((function(e){var t=e.split("="),r=t[0],o=t[1];n[r]=decodeURIComponent(void 0===o?"":o)})),n}(location.href),je="",De="",Re="",xe=""+parseFloat(Ee),Fe=void 0,Me=void 0;-1!==(Fe=Oe.indexOf("Opera"))&&(Re="Opera",xe=Oe.substring(Fe+6),-1!==(Fe=Oe.indexOf("Version"))&&(xe=Oe.substring(Fe+8))),-1!==(Fe=Oe.indexOf("Edge"))?(Re="Microsoft Edge",xe=Oe.substring(Fe+5)):-1!==(Fe=Oe.indexOf("MSIE"))?(Re="Microsoft Internet Explorer",xe=Oe.substring(Fe+5)):-1!==(Fe=Oe.indexOf("Chrome"))?(Re="Chrome",xe=Oe.substring(Fe+7)):-1!==(Fe=Oe.indexOf("Safari"))?(Re="Safari",xe=Oe.substring(Fe+7),-1!==(Fe=Oe.indexOf("Version"))&&(xe=Oe.substring(Fe+8))):-1!==(Fe=Oe.indexOf("Firefox"))&&(Re="Firefox",xe=Oe.substring(Fe+8)),-1!==(Me=xe.indexOf(";"))&&(xe=xe.substring(0,Me)),-1!==(Me=xe.indexOf(" "))&&(xe=xe.substring(0,Me)),-1!==(Me=xe.indexOf(")"))&&(xe=xe.substring(0,Me));for(var Be,Ne,ze=/Mobile|htc|mini|Android|iP(ad|od|hone)/.test(Ee)?"wap":"web",We=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Android",r:/Android/},{s:"Sun OS",r:/SunOS/},{s:"Linux",r:/(Linux|X11)/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/}],Ve=0;Ve<We.length;Ve++){var qe=We[Ve];if(qe.r.test(Oe)){je=qe.s;break}}function Ue(e,t){var n=e.exec(t);return n&&n[1]?n[1]:""}switch(/Windows/.test(je)&&(De=Ue(/Windows (.*)/,je),je="windows"),je){case"Mac OS X":De=Ue(/Mac OS X (10[\.\_\d]+)/,Oe),je="mac";break;case"Android":(Ne=Ue(/Android ([\.\_\d]+)/,Be=Oe))||(Ne=Ue(/Android\/([\.\_\d]+)/,Be)),De=Ne,je="android";break;case"iOS":De=(De=/OS (\d+)_(\d+)_?(\d+)?/.exec(Ee))?De[1]+"."+De[2]+"."+(0|De[3]):"",je="ios"}var Je={screen_size:Te,browser:Re,browser_version:xe,platform:ze,os_name:je,os_version:De,userAgent:Oe,screen_width:ke,screen_height:Ce,device_model:je,language:Le,referrer:Ae,referrer_host:Ie,utm_source:Pe.utm_source,utm_medium:Pe.utm_medium,utm_campaign:Pe.utm_campaign,utm_term:Pe.utm_term,utm_content:Pe.utm_content},Ke={get:function(e){var t=localStorage.getItem(e),n=t;try{t&&"string"==typeof t&&(n=JSON.parse(t))}catch(e){}return n},set:function(e,t){try{var n="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(e,n)}catch(e){}}},He="[tea-sdk]",Qe=4001,Ge=4e3,Xe=4002,$e=4003,Ze=500,Ye=5001,et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function nt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var rt=function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";nt(this,e),this.init=function(e){t.isLog=e},this.info=function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var i;t.isLog&&(i=console).log.apply(i,[t.prefix+e].concat(r))},this.warn=function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var i;t.isLog&&(i=console).warn.apply(i,[t.prefix+e].concat(r))},this.error=function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var i;t.isLog&&(i=console).error.apply(i,[t.prefix+e].concat(r))},this.dir=function(){var e;t.isLog&&(e=console).dir.apply(e,arguments)},this.table=function(e){t.isLog&&console.table(e)},this.logJSON=function(e){"object"===(void 0===e?"undefined":et(e))&&t.isLog&&t.info("",JSON.stringify(e,null,2))},this.deprecated=function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];t.warn.apply(t,["[DEPRECATED]"+e].concat(r))},this.throw=function(e){throw t.error(t.prefix),new Error(e)};var r=n?"["+n+"]":"";this.prefix=He+r},ot=new rt,it=function(e,t,n,r){var o=new XMLHttpRequest;o.open("POST",e,!0),o.setRequestHeader("Content-Type","application/json; charset=utf-8"),o.onload=function(){try{var e=JSON.parse(o.responseText);n&&n(e)}catch(e){r&&r()}},o.onerror=function(){r&&r()},o.send(JSON.stringify(t))};var at=(new Date).getTimezoneOffset(),st=parseInt(-at/60,10),ct=60*at,ut=void 0;try{ut="3.2.7"}catch(e){ut="2.x"}var lt=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this));return n.initClientEnv=function(){n.set("os_name",Je.os_name),n.set("os_version",Je.os_version),n.set("device_model",Je.device_model),n.set("platform",Je.platform),n.set("sdk_version",ut),n.set("browser",Je.browser),n.set("browser_version",Je.browser_version),n.set("language",Je.language),n.set("timezone",st),n.set("tz_offset",ct),n.set("resolution",Je.screen_width+"x"+Je.screen_height),n.set("screen_width",Je.screen_width),n.set("screen_height",Je.screen_height),n.set("referrer",Je.referrer),n.set("referrer_host",Je.referrer_host),n.set("utm_source",Je.utm_source),n.set("utm_medium",Je.utm_medium),n.set("utm_campaign",Je.utm_campaign),n.set("utm_term",Je.utm_term),n.set("utm_content",Je.utm_content)},n.initClientEnv(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(we));var ft=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.prototype.isString=function(e){return"String"===Object.prototype.toString.call(e).slice(8,-1)},e.prototype.isNumber=function(e){return"Number"===Object.prototype.toString.call(e).slice(8,-1)},e.prototype.isBoolean=function(e){return"Boolean"===Object.prototype.toString.call(e).slice(8,-1)},e.prototype.isFunction=function(e){return"Function"===Object.prototype.toString.call(e).slice(8,-1)},e.prototype.isNull=function(e){return"Null"===Object.prototype.toString.call(e).slice(8,-1)},e.prototype.isUndefined=function(e){return"Undefined"===Object.prototype.toString.call(e).slice(8,-1)},e.prototype.isObj=function(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)},e.prototype.isArray=function(e){return"Array"===Object.prototype.toString.call(e).slice(8,-1)},e.prototype.isFalse=function(e){return""===e||null==e||"null"===e||"undefined"===e||0===e||!1===e||NaN===e},e.prototype.isTrue=function(e){return!this.isFalse(e)},e.prototype.isLowIE=function(){return window.XDomainRequest},e}());var dt=function(e){return function(e,t,n){if("string"==typeof e&&"number"==typeof t&&"number"==typeof n){var r,o=[];n=n<=25?n:n%25;var i=String.fromCharCode(n+97);r=e.split(i);for(var a=0;a<r.length;a++){var s=parseInt(r[a],n);s=1*s^t;var c=String.fromCharCode(s);o.push(c)}return o.join("")}}(e,64,25)};function pt(e){return e?(e^16*Math.random()>>e/4).toString(10):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,pt)}var ht=function(){return pt().replace(/-/g,"").slice(0,19)},vt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};var gt={cn:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az21z1lz21z21z1bz1iz4az1az1mz1k",sg:"1fz22z22z1nz21z4mz4bz4bz21z1ez18z1jz1gz49z1kz1az21z4az19z27z22z1cz1mz24z1cz20z21z1cz18z4az1az1mz1k",va:"1fz22z22z1nz21z4mz4bz4bz1kz18z1jz1gz24z18z49z1kz1az21z4az19z27z22z1cz1mz24z1cz20z21z1cz18z4az1az1mz1k"},mt=function(e){try{var t=document.cookie.match(new RegExp("(?:^|;)\\s*"+e+"=([^;]+)"));return decodeURIComponent(t?t[1]:"")}catch(e){return""}},_t=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this));return n.init=function(e){var t=e.app_id,r=e.channel,o=e.log,i=e.channel_domain,a=e.name;if("number"!=typeof t)throw new Error("app_id 必须是一个数字,注意检查是否是以`string`的方式传入的?");n.logger=new rt(a),n.logger.init(o),n.initConfigs(e),n.initUrls(r,i),n.setEnv("app_id",t)},n.initConfigs=function(e){var t=e.app_id,r=e.disable_ssid,o=e.disable_webid,i=e.disable_sdk_monitor;n.app_id=t,n.evtDataCacheKey="__tea_cache_events_"+t,r&&(n.logger.info("ssid已禁用,设置user_unique_id不会请求ssid接口。"),n.isSsidDisabled=!0),o&&(n.logger.info("webid服务已禁用,ssid同时被禁用。将本地生成webid。"),n.isWebidDisabled=!0,n.isSsidDisabled=!0),i&&(n.logger.info("SDK监控已禁用。"),n.isSdkMonitorDisabled=!0)},n.initUrls=function(e,t){if("internal"===e&&(n.logger.warn("channel 的值 internal 已被废弃,已自动改为 cn。"),e="cn"),!t&&!gt[e])throw new Error("channel 变量只能是 `cn`, `sg`,`va`");var r=t||dt(gt[e]);r=r.replace(/\/+$/,""),n.reportUrl=r+"/v1/list",n.userTokensPrefix=""+r},n.setEnv=function(e,t){if("app_id"===e&&n.checkUserToken(t),"user_unique_id"===e){if(n.blackUuid.some((function(e){return e===String(t)})))return void n.logger.warn('设置了无效的值 {user_unique_id:"%s"}。该操作已忽略。',t);n.verifyTokens(t)}if("web_id"===e){if(!t)return;(!n.envInfo.user.user_unique_id||n.envInfo.user.user_unique_id&&n.envInfo.user.user_unique_id===n.envInfo.user.web_id)&&n.set("user_unique_id",t)}n.set(e,t)},n.transferFromCookie=function(){var e=n.tokensCacheKey,t=mt("tt_webid"),r=mt("__tea_sdk__ssid"),o=mt("__tea_sdk__user_unique_id");if(ft.isLowIE()){if(t){var i={web_id:t,ssid:t,user_unique_id:t};Ke.set(e,JSON.stringify(i))}return!1}if(t&&r&&o){var a={web_id:t,ssid:r,user_unique_id:o};Ke.set(e,JSON.stringify(a))}},n.purifyBlackUuid=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.blackUuid.some((function(t){return t===e.user_unique_id}))){var t={};return n.setUserTokens(t),n.logger.warn('检测到无效的用户标识,已重置用户状态。{user_unique_id: "%s"}',e.user_unique_id),t}return e},n.getUserTokens=function(){return Ke.get(n.tokensCacheKey)||{}},n.setUserTokens=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ke.set(n.tokensCacheKey,e)},n.checkUserToken=function(e){var t="__tea_cache_tokens_"+e;n.tokensCacheKey=t,n.transferFromCookie();var r=n.purifyBlackUuid(n.getUserTokens());r.user_unique_id&&r.web_id?(n.envInfo.user.user_unique_id=r.user_unique_id,n.envInfo.user.web_id=r.web_id,n.envInfo.user.ssid=r.ssid||"",n.logger.info("初始化已经检测到了 webid user_unique_id,一般情况下不需要再次验证 id 了"),n.unlock()):n.requestWebId(e)},n.saveTokenToStorage=function(e){var t=e.web_id,r=e.ssid,o=e.user_unique_id;n.setUserTokens({web_id:t,ssid:r,user_unique_id:o})},n.requestWebId=function(){n.isRequestWebId=!0;var e,t=function(e){var t=n.envInfo.user.web_id||e.web_id,r=e.ssid;n.isRequestWebId=!1,n.envInfo.user.ssid=r,n.envInfo.user.web_id=t,n.envInfo.user.user_unique_id=t,n.saveTokenToStorage({web_id:t,ssid:r,user_unique_id:t}),n.waitForVerifyTokens?(n.lock(),n.verifyTokens(n.realUuid)):(n.unlock(),n.callback&&n.callback())};n.isWebidDisabled?t({web_id:ht(),ssid:""}):(e=n.userTokensPrefix+"/v1/user/webid",it(e,{app_id:n.app_id,url:location.href,user_agent:Je.userAgent,referer:Je.referrer,user_unique_id:""},(function(e){0!==e.e?n.logger.error("请求 webid 失败。请联系管理员。"):t(e)}),(function(){n.isRequestWebId=!1,n.logger.error("获取 webid 失败,数据将不会被上报")})))},n.verifyTokens=function(e){var t=n.tokensCacheKey;if(n.waitForVerifyTokens=!1,n.realUuid=""+e,n.isRequestWebId)return n.waitForVerifyTokens=!0,n.logger.info("正在请求 webid,requestSsid 将会在前者请求完毕之后被调用"),!1;var r=n.getUserTokens();if(r.user_unique_id===n.realUuid&&r.ssid&&r.web_id)n.logger.info("传入的 user_id/user_unique_id 与 缓存中的完全一致,无需再次请求"),n.unlock();else{n.lock(),n.envInfo.user.user_unique_id=n.realUuid;var o=vt({},n.getUserTokens(),{user_unique_id:n.realUuid});if(Ke.set(t,JSON.stringify(o)),ft.isLowIE())return n.unlock(),!1;n.isSsidDisabled?(n.unlock(),n.callback&&n.callback()):n.requestSsid()}},n.requestSsid=function(){var e=n.getUserTokens(),t=n.userTokensPrefix+"/v1/user/ssid";it(t,{app_id:n.app_id,web_id:e.web_id,user_unique_id:""+e.user_unique_id},(function(t){if(n.unlock(),0!==t.e)n.logger.error("请求 ssid 失败~");else{n.envInfo.user.ssid=t.ssid;var r=vt({},e,{ssid:t.ssid});n.setUserTokens(r),n.logger.info("根据 user_unique_id 更新 ssid 成功!注意:在这之前不应该有数据被发出去"),n.callback&&n.callback()}}),(function(){n.unlock(),n.logger.error("根据 user_unique_id 获取新 ssid 失败")}))},n.setEvtParams=function(e){var t=vt({},e);Object.keys(t).forEach((function(e){n.evtParams[e]=t[e]}))},n.mergeEnvToEvents=function(e){var t=n.mergeEnv(),r=[],o=0,i=void 0;return e.forEach((function(e){var t=!!e.params.__disable_storage__;void 0===i?i=t:(t!==i||r[o].length>=5)&&(o+=1,i=!i),r[o]=r[o]||[],r[o].push(e)})),r.map((function(e){return{events:e.map((function(e){var t=vt({},n.evtParams,e.params);return delete t.__disable_storage__,vt({},e,{params:JSON.stringify(t)})})),user:t.user,header:t.header,verbose:n.debugMode?1:void 0,__disable_storage__:e[0].params.__disable_storage__}}))},n.mergeEnv=function(){var e=n.get(),t=lt.get(),r=vt({},e.user),o=vt({},t.header.headers.custom,e.header.headers.custom),i=vt({},t.header.headers,e.header.headers,{custom:o}),a=vt({},t.header,e.header);return{user:r,header:vt({},a,{headers:JSON.stringify(i)})}},n.evtParams={},n.reportUrl="",n.userTokensPrefix="",n.isSsidDisabled=!1,n.isWebidDisabled=!1,n.isSdkMonitorDisabled=!1,n.debugMode=!1,n.blackUuid=["null","undefined","0","","None"],n.logger=function(){},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.lock=function(){this.isUserTokensReady=!1},t.prototype.unlock=function(){this.isUserTokensReady=!0},t.prototype.enableDebugMode=function(e){this.debugMode=e},t}(we);var yt=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.set=function(e,n){t.cache[e]=n},this.get=function(e){return t.cache[e]},this.clean=function(e){t.cache[e]=void 0},this.cache={}},bt=new yt;var wt=function(){function e(t){var n=t.disable_storage,r=void 0!==n&&n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._isPersistent=!r,this._storage=this._isPersistent?Ke:new yt,this._storageKey="",this._data=void 0}return e.prototype.setStorageKey=function(e){this._storageKey=e},e.prototype.getAllEvents=function(){var e=this.getData();Object.keys(e).reduce((function(t,n){return t.concat(e[n]||[])}),[])},e.prototype.getData=function(){return this._checkIsDataInit(),this._data},e.prototype.add=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this._checkIsDataInit(),0!==t.length&&(this._data[e]=t,this._save())},e.prototype.delete=function(e){this._checkIsDataInit(),this._data[e]&&(delete this._data[e],this._save())},e.prototype._checkIsDataInit=function(){if(void 0===this._data)try{var e,t=this._getDataFromStorage();if(ft.isArray(t))this._data=((e={})[ht()]=t,e),this._save();else this._data=t}catch(e){this._data={}}},e.prototype._checkStorageKey=function(){if(!this._storageKey)throw new Error("must call setStorageKey('xxx') first")},e.prototype._getDataFromStorage=function(){return this._checkStorageKey(),this._storage.get(this._storageKey)||{}},e.prototype._save=function(){this._checkStorageKey(),this._storage.set(this._storageKey,this._data)},e}(),St=function(e,t){try{var n=e.split("v1")[0];t.forEach((function(e){var t=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t+="&"+n+"="+encodeURIComponent(JSON.stringify(e[n])));return"&"===t[0]?t.slice(1):t}(e),r=new Image(1,1);r.onload=function(){r=null},r.onerror=function(){r=null},r.src=n+"/v1/gif?"+t}))}catch(e){}},kt=function(e,t){if(window.XDomainRequest)return St(e,t);var n=new XMLHttpRequest;n.open("POST",e+"?rdn="+Math.random(),!0),n.onload=function(){},n.onerror=function(){n.abort()},n.send(JSON.stringify(t))},Ct=function(e,t,n,r){try{var o=e.split("v1")[0];if(!o)return void r(e,t,Qe);t.forEach((function(i){var a=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t+="&"+n+"="+encodeURIComponent(JSON.stringify(e[n])));return"&"===t[0]?t.slice(1):t}(i),s=new Image(1,1);s.onload=function(){s=null,n()},s.onerror=function(){s=null,r(e,t,Ge)},s.src=o+"/v1/gif?"+a}))}catch(n){r(e,t,Xe,n.message)}};var Tt=function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.send=function(e){var t=e.url,r=e.data,o=e.success,i=e.fail,a=e.eventError;if(function(e){var t=e.url,n=e.data,r=e.success,o=e.fail,i=e.notSure,a=e.isUnload,s=n;if(window.XDomainRequest)Ct(t,s,r,o);else{if(a)return window.navigator&&window.navigator.sendBeacon?(i(),void(window.navigator.sendBeacon(t,JSON.stringify(s))?r():o(t,n,$e))):void Ct(t,s,r,o);var c=new XMLHttpRequest;c.open("POST",t+"?rdn="+Math.random(),!0),c.onload=function(){r(t,s,c.responseText)},c.onerror=function(){c.abort(),o(t,s,Ze)},c.send(JSON.stringify(s))}}({url:t,data:r,success:function(e,t,r){o();try{var i=JSON.parse(r).e;if(0!==i){var s="未知错误";-2===i&&(s="事件格式错误!请检查字段类型是否正确。"),n.logger.error("数据上报失败!","错误码:"+i+"。错误信息:"+s),a(t,i),Ot(e,t,i)}}catch(n){Ot(e,t,Ye)}},fail:function(e,t,r){n.logger.error("数据上报失败!","错误码:"+r),i(t,r),Ot(e,t,r)},notSure:e.notSure,isUnload:e.isUnload}),!n.isSdkMonitorDisabled&&!n.isSdkOnLoadEventReady){n.isSdkOnLoadEventReady=!0;try{var s=r[0].header,c=r[0].user;Et(t,{app_id:s.app_id,app_name:s.app_name,sdk_version:s.sdk_version,web_id:c.web_id})}catch(e){}}},this.logger=t.logger||ot,this.isSdkOnLoadEventReady=!1,this.isSdkMonitorDisabled=!1},Et=function(e,t){try{var n={events:[{event:"onload",params:JSON.stringify({app_id:t.app_id,app_name:t.app_name||"",sdk_version:t.sdk_version}),local_time_ms:Date.now()}],user:{user_unique_id:t.web_id},header:{app_id:1338}};setTimeout((function(){kt(e,[n])}),16)}catch(e){}},Ot=function(e,t,n){try{var r=t[0].user,o=t[0].header,i=[];t.forEach((function(e){e.events.forEach((function(e){i.push(e)}))}));var a={events:i.map((function(e){return{event:"on_error",params:JSON.stringify({error_code:n,app_id:o.app_id,app_name:o.app_name||"",error_event:e.event,local_time_ms:e.local_time_ms,tea_event_index:Date.now(),params:e.params,header:JSON.stringify(o),user:JSON.stringify(r)}),local_time_ms:Date.now()}})),user:{user_unique_id:r.user_unique_id},header:{app_id:1338}};setTimeout((function(){kt(e,[a])}),16)}catch(e){}};var Lt=function(e){function t(n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this));r.addListener=function(){window.addEventListener("unload",(function(){r.report(!0)}),!1),window.addEventListener("