7 lines
56 KiB
JavaScript
7 lines
56 KiB
JavaScript
/**
|
||
* @dn-sdk/minigame v1.5.4
|
||
* (c) 2024
|
||
* @license ISC
|
||
*/
|
||
function t(t,e,n){return(e=p(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function e(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}function r(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}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){if(e&&("object"===l(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return c(t)}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,p(r.key),r)}}function v(t,e,n){return e&&d(t.prototype,e),n&&d(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function p(t){var e=function(t,e){if("object"!==l(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!==l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===l(e)?e:String(e)}var h,y,_="LOCAL_ID",g="QUEUE_ACTIONS",m="CLICK_ID",A="QUEUE_LOST_MAP",R="REMOTE_CONFIG",k="REMOTE_COMMON_CONFIG",T="OPENID",S={init:"init",reporting:"reporting",fail:"fail"},E={maxSdkInstance:4,maxQueueLength:500,actionParamMaxLength:1e4,autoTrack:!0,reportThreshold:5,reportDelay:1,inspectDelay:30,cgiBatchSize:50,requestConcurrency:4,requestTimeout:1e4,signVersion:"1.0",realTimeActionList:["START_APP","REGISTER","PURCHASE"]},b={JS_RUN_ERROR:"JS_RUN_ERROR",REQUEST_ERROR:"REQUEST_ERROR",REQUEST_CONFIG_ERROR:"REQUEST_CONFIG_ERROR",JS_QUEUE_LOG:"JS_QUEUE_LOG",PROXY_ERROR:"PROXY_ERROR",PROXY_POLYFILL:"PROXY_POLYFILL",QUEUE_LOST_NUM:"QUEUE_LOST_NUM",REQ_TOTAL:"REQ_TOTAL",SIGN_ERROR:"SIGN_ERROR"},O="ANDROID",I="IOS",w="WINDOWS",C="OSX",x="UNKNOWN",N=1e3,L=100,P=10,M="START_APP",D="ENTER_FOREGROUND",U="ENTER_BACKGROUND",q="ADD_TO_WISHLIST",j="PURCHASE",F="APP_QUIT",B="REGISTER",V="CREATE_ROLE",K="TUTORIAL_FINISH",G="TRUE",Q="FALSE",Y="TENCENT",W="BYTEDANCE",J="KUAISHOU",H="ALIBABA",z="BAIDU",$="OTHERS",X="UNKNOWN",Z="TICKET_INTERVAL_CHANGE",tt=(y=function(t){return"".concat("@dn-sdk/minigame","_").concat("production","_").concat(t)},{getSync:function(t){var e;try{e=wx.getStorageSync(y(t))}catch(t){return console.error("storage get error",t),e}return e},setSync:function(t,e){try{wx.setStorageSync(y(t),e)}catch(t){return console.error("storage set error",t),!1}return!0}}),et=function(){if(h)return h;try{return h=wx.getSystemInfoSync()}catch(t){return{}}},nt=function(){var t;return function(){if(!t){var e=et(),n=e.system,r=void 0===n?"":n,o=(null==r?void 0:r.split(" "))||[],i=function(t){if(!t)return x;var e=(null==t?void 0:t.toUpperCase())||"";return e.indexOf("ANDROID")>-1?O:e.indexOf("IOS")>-1?I:e.indexOf("MAC")>-1?C:e.indexOf("WINDOWS")>-1?w:x}(o[0]),a=function(t){return!t||t.length<=0?"":2===t.length?t[1]:3===t.length&&"Windows"===t[0]?"".concat(t[1]," ").concat(t[2]):t[t.length-1]}(o);t={benchmark_level:e.benchmarkLevel,device_brand:e.brand,screen_height:Math.floor(e.screenHeight),screen_width:Math.floor(e.screenWidth),wx_lib_version:e.SDKVersion,wx_version:e.version,wx_platform:e.platform,device_model:e.model,os:i,os_version:a}}return t}}(),rt=function(){var t;return function(){try{if(t)return t;t||(t=tt.getSync(_)||""),t||(t=mt(),tt.setSync(_,t))}catch(t){}return t}}();var ot=function(){var t="unknown",e=!1;return function(){if(!e)try{wx.getNetworkType({success:function(e){t=e.networkType},fail:function(){t="unknown"}}),wx.onNetworkStatusChange((function(e){t=e.networkType})),e=!0}catch(t){}return t}}();ot();var it=function(){var t="";return function(){return t||(t=tt.getSync(T)||""),t}}(),at=function(){var t;return function(){if(t)return t;try{var e=wx.getAccountInfoSync();return ht(e.miniProgram)?t=e.miniProgram:{}}catch(e){return{}}}}();function ut(t){var e=null==t?void 0:t.query;if(!ht(e))return"";var n="";return e.gdt_vid||[1045,1046,1084].indexOf(null==t?void 0:t.scene)>-1?n=Y:e.clue_token||e.clickid&&e.item_id?n=W:e.callback&&"kuaishou"===e.ksChannel?n=J:e.bd_vid||e.ai&&e.d&&e.q&&e.c?n=z:e.uctrackid?n=H:(e.trackid||e.imp||[1065,1069,1194].indexOf(null==t?void 0:t.scene)>-1&&(e.callback||e.u))&&(n=$),n}function ct(t,e){try{var n=nt(),r={sdk_version:"1.5.4",sdk_name:"@dn-sdk/minigame",device_brand:null==n?void 0:n.device_brand,device_model:null==n?void 0:n.device_model,wx_version:null==n?void 0:n.wx_version,wx_lib_version:null==n?void 0:n.wx_lib_version,wx_platform:null==n?void 0:n.wx_platform,os:null==n?void 0:n.os,os_version:null==n?void 0:n.os_version,local_id:rt()},o=Object.assign(r,t);wx.request({url:"https://api.datanexus.qq.com/data-nexus-trace/log",data:o,method:"POST",timeout:E.requestTimeout,success:function(t){"function"==typeof e&&200===(null==t?void 0:t.statusCode)&&e()}})}catch(n){xt.error(n)}}var st=function(){function t(){f(this,t)}return v(t,null,[{key:"revise",value:function(t){t>0&&!this.isRevised&&(this.offsetTime=t-Date.now(),this.isRevised=!0)}},{key:"getRevisedcurrentTimeMillis",value:function(){return this.isRevised?Date.now()+this.offsetTime:-1}}]),t}();function lt(t){return new Promise((function(e,n){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/config/get",data:t,timeout:E.requestTimeout,success:function(t){ft(t,e,"config/get",n),vt(t)},fail:function(t){dt(t,"config/get",n)}})}))}function ft(t,e,n,r){var o,i,a,u,c=null==t?void 0:t.statusCode,s=null==(o=null==t?void 0:t.data)?void 0:o.code;if(200!==c||0!==s){var l=s;200!==c&&(l="number"==typeof c?-1*c:-888),ct({log_type:b.REQUEST_CONFIG_ERROR,message:"cgiName: ".concat(n,", statusCode: ").concat(c,", code: ").concat(s,", traceid: ").concat(null==(a=null==t?void 0:t.data)?void 0:a.trace_id),code:l}),null==r||r(null==(u=null==t?void 0:t.data)?void 0:u.data)}else e(null==(i=t.data)?void 0:i.data)}function dt(t,e,n){ct({log_type:b.REQUEST_CONFIG_ERROR,message:"cgiName: ".concat(e," , message: ").concat(null==t?void 0:t.errMsg," "),code:"number"==typeof(null==t?void 0:t.errno)?-1*t.errno:-999}),null==n||n(t)}function vt(t){var e,n=1*(null==(e=null==t?void 0:t.header)?void 0:e["Server-Time"]);n>17266752e5&&st.revise(n)}st.offsetTime=0,st.isRevised=!1;var pt=Object.prototype.toString,ht=function(t){return"[object Object]"===pt.call(t)},yt=function(t){return"[object Array]"===pt.call(t)},_t=function(t){return"[object Function]"===pt.call(t)},gt=(new Date).getTime();function mt(){var t=(new Date).getTime(),e=Math.abs(1e3*(t-gt));return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(n){var r=16*Math.random();return t>0?(r=(t+r)%16|0,t=Math.floor(t/16)):(r=(e+r)%16|0,e=Math.floor(e/16)),("x"===n?r:3&r|8).toString(16).replace(/-/g,"")}))}var At=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Rt=function(t){if("string"!=typeof t)throw new TypeError("Invalid argument expected string");if(!At.test(t))throw new Error("Invalid argument not valid semver ('".concat(t,"' received)"))},kt=function(t){return isNaN(Number(t))?t:Number(t)},Tt=function(t){var e=t.replace(/^v/,"").replace(/\+.*$/,""),n=function(t,e){return-1===t.indexOf(e)?t.length:t.indexOf(e)}(e,"-"),r=e.substring(0,n).split(".");return r.push(e.substring(n+1)),r},St=function(t,e){[t,e].forEach(Rt);for(var n=Tt(t),r=Tt(e),o=0;o<Math.max(n.length-1,r.length-1);o++){var i=parseInt(n[o]||"0",10),a=parseInt(r[o]||"0",10);if(i>a)return 1;if(a>i)return-1}var u=n[n.length-1],c=r[r.length-1];if(u&&c)for(var s=u.split(".").map(kt),l=c.split(".").map(kt),f=0;f<Math.max(s.length,l.length);f++){if(void 0===s[f]||"string"==typeof l[f]&&"number"==typeof s[f])return-1;if(void 0===l[f]||"string"==typeof s[f]&&"number"==typeof l[f]||s[f]>l[f])return 1;if(l[f]>s[f])return-1}else if(u||c)return u?-1:1;return 0},Et=function(t){return ht(t)?(function(t){var e=["user_action_set_id","secret_key","appid","openid","unionid","user_unique_id","auto_track","auto_attr"];for(var n in t)e.includes(n)||xt.warn("Invalid property '".concat(n,"' found in config"))}(t),"number"!=typeof t.user_action_set_id?"user_action_set_id 参数需为 number 类型":t.user_action_set_id<=0?"user_action_set_id 参数需大于 0":"string"!=typeof t.secret_key?"secret_key 参数需为 string 类型":""===t.secret_key.trim()?"缺少 secret_key 参数":32!==t.secret_key.length?"secret_key 参数需为 32 位字符串":"string"!=typeof t.appid?"appid 参数需为 string 类型":""!==t.appid.trim()||"缺少 appid"):"初始化参数需为 object 类型"};function bt(t){return Ot()[t]}function Ot(){return E}function It(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var wt=function(t){try{return t&&"string"==typeof t?-1===(t=t.replace(/\s/g,"")).indexOf(".")?t:t.split(".").slice(0,2).join("."):""}catch(e){return t}},Ct=function(){function t(){f(this,t)}return v(t,null,[{key:"error",value:function(t){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).error.apply(e,["".concat("[@dn-sdk/minigame v1.5.4]",": ").concat(t)].concat(r))}},{key:"info",value:function(e){for(var n,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];t.debug&&(n=console).info.apply(n,["".concat("[@dn-sdk/minigame v1.5.4]",": ").concat(e)].concat(o))}},{key:"log",value:function(e){for(var n,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];t.debug&&(n=console).log.apply(n,["".concat("[@dn-sdk/minigame v1.5.4]",": ").concat(e)].concat(o))}},{key:"warn",value:function(t){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).warn.apply(e,["".concat("[@dn-sdk/minigame v1.5.4]",": ").concat(t)].concat(r))}},{key:"devLog",value:function(e){for(var n,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];t.isDev&&(n=console).log.apply(n,["".concat("[@dn-sdk/minigame v1.5.4]",": ").concat(e)].concat(o))}}]),t}(),xt=Ct;xt.debug=!1,xt.isDev=!1;var Nt=function(){var t;return function(){if(!t)try{var e=wx.getLaunchOptionsSync(),n=e.query.gdt_vid||"";n?tt.setSync(m,n):n=tt.getSync(m)||"";var r=JSON.stringify(e);r.length>1e4&&(r=JSON.stringify({cut:1,scene:e.scene})),t={source_scene:e.scene,pkg_channel_id:e.query.wxgamepro||"",ad_trace_id:n,launch_options:r,channel:ut(e)}}catch(e){t={},xt.log("获取场景值和渠道号失败",e)}return t}}();function Lt(t,e,n){var r=n.value;return n.value=function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];try{return r.apply(this,o)}catch(n){try{xt.error.apply(xt,["calling ".concat(t.constructor.name,".").concat(e," error with arguments")].concat(o)),xt.error(n);var a={log_type:b.JS_RUN_ERROR,message:"[safeExcutable] ".concat(t.constructor.name,".").concat(e,": ").concat(null==n?void 0:n.message),err_stack:null==n?void 0:n.stack};_t(this.reportLog)?this.reportLog(a):ct(a)}catch(a){}}},n}var Pt=function(t,e,n){var r=n.value;return n.value=function(){if(this.inited){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r.apply(this,e)}xt.error("上报失败,请先完成初始化")},n},Mt=Object.defineProperty,Dt=Object.getOwnPropertyDescriptor,Ut=function(t,e,n,r){for(var o,i=r>1?void 0:r?Dt(e,n):e,a=t.length-1;a>=0;a--)(o=t[a])&&(i=(r?o(e,n,i):o(i))||i);return r&&i&&Mt(e,n,i),i},qt=function(){function t(e){var n=e.userActionSetId,r=e.maxLength,o=void 0===r?500:r;f(this,t),this.lostActionMaps={},this.stack=[],this.localStorageKey="",this.localStorageKey="".concat(g,"_").concat(null==n?void 0:n.toString()),this.maxLength=o,this.userActionSetId=n,this.setTimeStamp(),this.init()}return v(t,[{key:"getItems",value:function(){return this.stack}},{key:"getStorage",value:function(){var t,e=(null==(t=tt)?void 0:t.getSync(this.localStorageKey))||"[]";return JSON.parse(e)}},{key:"reportLostNum",value:function(){var t=this,e=Object.assign({},this.lostActionMaps),n=[];for(var r in e){var o=null==r?void 0:r.split("_");n.push({queue_lost_session_id:o[0],queue_lost_timestamp:o[1],queue_lost_num:e[r]})}n.length&&(this.setTimeStamp(),n.forEach((function(e){var n=Object.assign({},{user_action_set_id:t.userActionSetId,log_type:b.QUEUE_LOST_NUM},e),r=null==e?void 0:e.queue_lost_session_id,o=null==e?void 0:e.queue_lost_timestamp,i="".concat(r,"_").concat(o);ct(n,(function(){It(t.lostActionMaps,i)&&(delete t.lostActionMaps[i],tt.setSync(A,JSON.stringify(t.lostActionMaps)))}))})))}},{key:"getLostMaps",value:function(){return this.lostActionMaps}},{key:"init",value:function(){var t=this,e=this.getStorage(),n=null==e?void 0:e.map((function(t){var e,n;return t.inner_status===(null==(e=S)?void 0:e.reporting)?Object.assign({},t,{inner_status:null==(n=S)?void 0:n.fail,is_retry:!0,retry_count:t.retry_count+1}):t}));this.stack=n,this.lostActionMaps=JSON.parse(tt.getSync(A)||"{}"),setTimeout((function(){t.reportLostNum()}),1e3)}},{key:"addItem",value:function(t){var e;null==(e=null==this?void 0:this.stack)||e.push(t)}},{key:"removeItems",value:function(t){var e,n=null==(e=null==this?void 0:this.stack)?void 0:e.filter((function(e){return!(null!=t&&t.includes(null==e?void 0:e.action_id))}));this.stack=n}},{key:"updateForReportFail",value:function(t){var e;this.stack=null==(e=this.stack)?void 0:e.map((function(e){var n;return null!=t&&t.includes(null==e?void 0:e.action_id)?Object.assign({},e,{inner_status:null==(n=S)?void 0:n.fail,retry_count:e.retry_count+1,is_retry:!0}):e}))}},{key:"updateForReporting",value:function(t){var e;this.stack=null==(e=this.stack)?void 0:e.map((function(e){var n;return null!=t&&t.includes(null==e?void 0:e.action_id)?Object.assign({},e,{inner_status:null==(n=S)?void 0:n.reporting}):e}))}},{key:"updateAllStack",value:function(t){this.stack=t}},{key:"updateToStorage",value:function(){tt.setSync(this.localStorageKey,JSON.stringify(this.stack))}},{key:"updateLostAction",value:function(t){if(t){var e="".concat(t,"_").concat(this.timeStamp),n=this.lostActionMaps[e]||0;this.lostActionMaps[e]=n+1,tt.setSync(A,JSON.stringify(this.lostActionMaps))}}},{key:"setTimeStamp",value:function(){this.timeStamp=Date.now().toString()}}]),t}();Ut([Lt],qt.prototype,"getItems",1),Ut([Lt],qt.prototype,"getStorage",1),Ut([Lt],qt.prototype,"reportLostNum",1),Ut([Lt],qt.prototype,"getLostMaps",1),Ut([Lt],qt.prototype,"init",1),Ut([Lt],qt.prototype,"addItem",1),Ut([Lt],qt.prototype,"removeItems",1),Ut([Lt],qt.prototype,"updateForReportFail",1),Ut([Lt],qt.prototype,"updateForReporting",1),Ut([Lt],qt.prototype,"updateAllStack",1),Ut([Lt],qt.prototype,"updateToStorage",1),Ut([Lt],qt.prototype,"updateLostAction",1);var jt=Object.defineProperty,Ft=Object.getOwnPropertyDescriptor,Bt=function(t,e,n,r){for(var o,i=r>1?void 0:r?Ft(e,n):e,a=t.length-1;a>=0;a--)(o=t[a])&&(i=(r?o(e,n,i):o(i))||i);return r&&i&&jt(e,n,i),i},Vt=function(t){o(n,qt);var e=a(n);function n(t){var r,o=t.userActionSetId,i=t.maxLength,a=void 0===i?500:i,u=t.ogEvents,c=void 0===u?[]:u;return f(this,n),(r=e.call(this,{userActionSetId:o,maxLength:a})).ogEvents=c,r}return v(n,[{key:"getReportableActions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,e=this.getItems(),n=[];return null==e||e.forEach((function(e){var r;(null==n?void 0:n.length)<t&&(null==e?void 0:e.inner_status)!==(null==(r=S)?void 0:r.reporting)&&(null==n||n.push(e))})),n}},{key:"addAction",value:function(t){var e=this.getItems();if((null==e?void 0:e.length)>=this.maxLength){var n="队列长度超过最大限制".concat(this.maxLength,"条,SDK将按照行为优先级排序,丢弃优先级最低的行为事件");xt.warn(n),ct({user_action_set_id:this.userActionSetId,log_type:b.JS_QUEUE_LOG,message:n});var r=this.sortQueue(t,e);xt.debug&&xt.info("超过".concat(this.maxLength,"条按优先级排序的队列:"),r.concat([]));var o=r.pop();this.updateAllStack(r),this.updateLostAction((null==o?void 0:o.session_id)||"")}else this.addItem(t);this.updateToStorage()}},{key:"removeActions",value:function(t){this.removeItems(t),this.updateToStorage()}},{key:"updateActionsForReportFail",value:function(t){this.updateForReportFail(t),this.updateToStorage()}},{key:"updateActionsForReporting",value:function(t){this.updateForReporting(t),this.updateToStorage()}},{key:"getReportableActionsLength",value:function(){var t=this.getItems().filter((function(t){var e;return(null==t?void 0:t.inner_status)!==(null==(e=S)?void 0:e.reporting)}));return null==t?void 0:t.length}},{key:"sortQueue",value:function(t,e){var n=this,r={},o=null==t?void 0:t.action_time,i=e.concat([t]),a=function(t){return r[t.action_id]||(r[t.action_id]=n.caculateWeight(o,t)),r[t.action_id]};return i.sort((function(t,e){return a(e)-a(t)}))}},{key:"caculateWeight",value:function(t,e){var n,r=0,o=this.formatWeight(t,null==e?void 0:e.action_time),i=o.ogWeight,a=o.sdkWeight,u=o.userWeight;null!=(n=this.ogEvents)&&n.includes(null==e?void 0:e.action_type)&&(r+=i),null!=e&&e.is_sdk_auto_track?r+=a:r+=u;var c=t-(null==e?void 0:e.action_time)+1;return r=c>0?r+1/c:r}},{key:"formatWeight",value:function(t,e){var n=N,r=P,o=L;return t-e>2592e6&&(n/=100,r/=100,o/=100),{ogWeight:n,sdkWeight:r,userWeight:o}}}]),n}();Bt([Lt],Vt.prototype,"getReportableActions",1),Bt([Lt],Vt.prototype,"addAction",1),Bt([Lt],Vt.prototype,"removeActions",1),Bt([Lt],Vt.prototype,"updateActionsForReportFail",1),Bt([Lt],Vt.prototype,"updateActionsForReporting",1),Bt([Lt],Vt.prototype,"getReportableActionsLength",1),Bt([Lt],Vt.prototype,"sortQueue",1),Bt([Lt],Vt.prototype,"caculateWeight",1),Bt([Lt],Vt.prototype,"formatWeight",1);var Kt=function(){function t(){f(this,t),this.events={}}return v(t,[{key:"subscribe",value:function(e,n){t.checkCallback(n),yt(this.events[e])?this.events[e].push(n):this.events[e]=[n]}},{key:"once",value:function(e,n){t.checkCallback(n),this.subscribe(this.onceEventName(e),n)}},{key:"unsubscribe",value:function(e,n){t.checkCallback(n),yt(this.events[e])&&(this.events[e]=this.events[e].filter((function(t){return t!==n}))),yt(this.events[this.onceEventName(e)])&&(this.events[this.onceEventName(e)]=this.events[this.onceEventName(e)].filter((function(t){return t!==n})))}},{key:"publish",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var o=Date.now();yt(this.events[t])&&this.events[t].forEach((function(t){return t.apply(void 0,[o].concat(n))})),yt(this.events[this.onceEventName(t)])&&(this.events[this.onceEventName(t)].forEach((function(t){return t.apply(void 0,[o].concat(n))})),this.events[this.onceEventName(t)]=[])}},{key:"onceEventName",value:function(t){return"once_event_prefix_".concat(t)}}],[{key:"checkCallback",value:function(e){_t(e)||xt.error(t.ERROR_CALLBACK_IS_NOT_A_FUNCTION)}}]),t}(),Gt=Kt;Gt.ERROR_CALLBACK_IS_NOT_A_FUNCTION="callback 不是函数";var Qt=new Gt,Yt=["REGISTER","VIEW_CONTENT","ADD_TO_CART","PURCHASE","COMPLETE_ORDER","ADD_TO_WISHLIST","START_APP","CREATE_ROLE","AUTHORIZE","TUTORIAL_FINISH","START_PAY","FINISH_PAY"],Wt="START_APP",Jt="TICKET",Ht="ENTER_FOREGROUND",zt="ENTER_BACKGROUND",$t="LOGIN",Xt="SHARE",Zt="TAP_GAME_CLUB",te="CREATE_GAME_CLUB",ee="CREATE_GAME_ROOM",ne="JOIN_GAME_ROOM",re="FINISH_PAY",oe="START_PAY",ie="ADD_TO_WISHLIST",ae=["REGISTER","START_APP","RE_ACTIVE"],ue=["TICKET","ENTER_FOREGROUND","ENTER_BACKGROUND"],ce=function(){function t(){f(this,t),this.channelClaimActionList=ae,this.noClaimActionList=ue,this.realTimeActionList=E.realTimeActionList,this.ticketInterval=60,this.requestTimeout=E.requestTimeout,this.loadConfig()}return v(t,[{key:"getChannelClaimActionList",value:function(){return this.channelClaimActionList}},{key:"getNoClaimActionList",value:function(){return this.noClaimActionList}},{key:"getRealTimeActionList",value:function(){return this.realTimeActionList}},{key:"getTicketInterval",value:function(){return this.ticketInterval}},{key:"getRequestTimeout",value:function(){return this.requestTimeout}},{key:"loadConfig",value:function(){var t=this;try{if("undefined"==typeof wx)return;var e=tt.getSync(k);e&&this.updateConfig(e),lt({conf_name:"mini_game_sdk_common",conf_key:"config"}).then((function(e){e&&ht(e)&&(t.updateConfig(e),tt.setSync(k,e))}))}catch(e){console.error(e)}}},{key:"updateConfig",value:function(t){t.channelClaimActionList&&yt(t.channelClaimActionList)&&(this.channelClaimActionList=t.channelClaimActionList),t.noClaimActionList&&yt(t.noClaimActionList)&&(this.noClaimActionList=t.noClaimActionList),t.realTimeActionList&&yt(t.realTimeActionList)&&(this.realTimeActionList=t.realTimeActionList),t.ticketInterval&&"number"==typeof t.ticketInterval&&t.ticketInterval>1&&t.ticketInterval!==this.ticketInterval&&(this.ticketInterval=t.ticketInterval,Qt.publish(Z)),t.requestTimeout&&"number"==typeof t.requestTimeout&&t.requestTimeout>5e3&&(this.requestTimeout=t.requestTimeout)}}]),t}(),se=new ce,le=Wt,fe=Jt,de=Ht,ve=zt,pe=function(){var t=!1,e=!1,n=!0,r=!0,o=!0,i=!1;return function(){if(!i){i=!0;var a=tt.getSync(R);if((null==a?void 0:a.bg)===G?t=!0:(null==a?void 0:a.bg)===Q&&(t=!1),(null==a?void 0:a.fg)===G?e=!0:(null==a?void 0:a.fg)===Q&&(e=!1),(null==a?void 0:a.st)===G?n=!0:(null==a?void 0:a.st)===Q&&(n=!1),(null==a?void 0:a.ti)===G?r=!0:(null==a?void 0:a.ti)===Q&&(r=!1),xt.devLog("当前缓存开关 bgOn,fgOn,stOn,tiOn:",t,e,n,r),n&&Qt.publish(le),r){var u=function(){o&&Qt.publish(fe)},c=setInterval(u,1e3*se.getTicketInterval());Qt.subscribe(Z,(function(){c&&clearInterval(c),c=setInterval(u,1e3*se.getTicketInterval())}))}wx.onShow((function(t){if(o=!0,e){var n="";try{(n=JSON.stringify(t)).length>1e4&&(n=JSON.stringify({cut:1,scene:t.scene}))}catch(t){}Qt.publish(de,{enter_options:n})}})),wx.onHide((function(){o=!1,t&&Qt.publish(ve)}))}}}(),he="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ye(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _e,ge=ye((function(){var t,e=null;function n(t){return!!t&&("object"==l(t)||"function"==typeof t)}function r(t){if(null!==t&&!n(t))throw new TypeError("Object prototype may only be an Object or null: "+t)}var o=Object,i=!(!o.create&&{__proto__:null}instanceof o),a=o.create||(i?function(t){return r(t),{__proto__:t}}:function(t){if(r(t),null===t)throw new SyntaxError("Native Object.create is required to create objects with null prototype");var e=function(){};return e.prototype=t,new e}),u=function(){return null},c=o.getPrototypeOf||([].__proto__===Array.prototype?function(t){var e=t.__proto__;return n(e)?e:null}:u);return t=function(s,l){if(void 0===(this&&this instanceof t?this.constructor:void 0))throw new TypeError("Constructor Proxy requires 'new'");if(!n(s)||!n(l))throw new TypeError("Cannot create proxy with a non-object as target or handler");var f=function(){};e=function(){s=null,f=function(t){throw new TypeError("Cannot perform '".concat(t,"' on a proxy that has been revoked"))}},setTimeout((function(){e=null}),0);var d=l;for(var v in l={get:null,set:null,apply:null,construct:null},d){if(!(v in l))throw new TypeError("Proxy polyfill does not support trap '".concat(v,"'"));l[v]=d[v]}"function"==typeof d&&(l.apply=d.apply.bind(d));var p,h=c(s),y=!1,_=!1;"function"==typeof s?(p=function(){var t=this&&this.constructor===p,e=Array.prototype.slice.call(arguments);return f(t?"construct":"apply"),t&&l.construct?l.construct.call(this,s,e):!t&&l.apply?l.apply(s,this,e):t?(e.unshift(s),new(s.bind.apply(s,e))):s.apply(this,e)},y=!0):s instanceof Array?(p=[],_=!0):p=i||null!==h?a(h):{};var g=l.get?function(t){return f("get"),l.get(this,t,p)}:function(t){return f("get"),this[t]},m=l.set?function(t,e){f("set"),l.set(this,t,e,p)}:function(t,e){f("set"),this[t]=e},A=o.getOwnPropertyNames(s),R={};A.forEach((function(t){if(!y&&!_||!(t in p)){var e={enumerable:!!o.getOwnPropertyDescriptor(s,t).enumerable,get:g.bind(s,t),set:m.bind(s,t)};o.defineProperty(p,t,e),R[t]=!0}}));var k=!0;if(y||_){var T=o.setPrototypeOf||([].__proto__===Array.prototype?function(t,e){return r(e),t.__proto__=e,t}:u);h&&T(p,h)||(k=!1)}if(l.get||!k)for(var S in s)R[S]||o.defineProperty(p,S,{get:g.bind(s,S)});return o.seal(s),o.seal(p),p},t.revocable=function(n,r){return{proxy:new t(n,r),revoke:e}},t})),me={};try{_e||(_e=ge())}catch(h){Se(h)}function Ae(t,n,r,o){try{if(!_e||null==t||!t[n])return;t[n]=new _e(t[n],{apply:function(t,n,i){var a,u;o&&Te((function(){return o.apply(void 0,e(i))}));var c=!!(null!=(a=i[0])&&a.success||null!=(u=i[0])&&u.fail);c&&["success","fail"].forEach((function(t){if(i[0][t])try{i[0][t]=new _e(i[0][t],{apply:function(n,o,a){return Te((function(){return r.apply(void 0,[t,i[0]].concat(e(a)))})),n.apply(o,a)}})}catch(t){Se(t)}}));var s=t.apply(n,i);return!c&&s&&"[object Promise]"===Object.prototype.toString.call(s)?s.then((function(t){return Te((function(){return r("success",i[0],t)})),t})).catch((function(t){throw Te((function(){return r("fail",i[0],t)})),t})):s}})}catch(t){Se(t)}}function Re(t,n,r){try{if(!_e||null==t||!t[n])return;t[n]=new _e(t[n],{apply:function(t,n,o){var i="function"==typeof o[0];if(i)try{o[0]=new _e(o[0],{apply:function(t,n,o){var i=t.call.apply(t,[n].concat(e(o)));return Te((function(){return r(i)})),i}})}catch(t){Se(t)}var a=t.call.apply(t,[n].concat(e(o)));return i||Te((function(){return r(a)})),a}})}catch(t){Se(t)}}function ke(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4?arguments[4]:void 0;try{if(!_e||null==t||!t[n])return;t[n]=new _e(t[n],{apply:function(t,a,u){var c=t.call.apply(t,[a].concat(e(u)));return(!r||!me[n])&&(Te((function(){return null==i?void 0:i(c)})),o.forEach((function(t){var e=t.eventName,n=t.isAsync,r=t.proxyEvent;n?Ae(c,e,r):Re(c,e,r)}))),r&&(me[n]=!0),c}})}catch(t){Se(t)}}function Te(t){try{t()}catch(t){Se(t)}}function Se(t){ct({log_type:b.PROXY_ERROR,message:null==t?void 0:t.message,err_stack:null==t?void 0:t.stack})}var Ee=$t,be=ie,Oe=Xt,Ie=Zt,we=te,Ce=ne,xe=oe,Ne=re,Le=function(){var t=!1;return function(){t||(t=!0,Ae(wx,"login",(function(t){"success"===t&&Qt.publish(Ee)})),Re(wx,"onAddToFavorites",(function(){Qt.publish(be)})),Re(wx,"onShareTimeline",(function(){Qt.publish(Oe,{target:"TIME_LINE",trigger:"MENU"})})),Re(wx,"onShareAppMessage",(function(){Qt.publish(Oe,{target:"APP_MESSAGE",trigger:"MENU"})})),Re(wx,"shareAppMessage",(function(){Qt.publish(Oe,{target:"APP_MESSAGE",trigger:"BUTTON"})})),ke(wx,"createGameClubButton",!1,[{isAsync:!1,eventName:"onTap",proxyEvent:function(){Qt.publish(Ie)}}],(function(){Qt.publish(we)})),ke(wx,"getGameServerManager",!0,[{isAsync:!0,eventName:"createRoom",proxyEvent:function(t){"success"===t&&Qt.publish("CREATE_GAME_ROOM")}},{isAsync:!0,eventName:"joinRoom",proxyEvent:function(t){"success"===t&&Qt.publish(Ce)}}]),Ae(wx,"requestMidasPayment",(function(t,e){Qt.publish(Ne,{status:"success"===t?"SUCCESS":"FAIL",quantity:(null==e?void 0:e.buyQuantity)||0,mode:(null==e?void 0:e.mode)||"",platform:(null==e?void 0:e.platform)||"",no:(null==e?void 0:e.outTradeNo)||"",payType:"Midas"})}),(function(t){Qt.publish(xe,{quantity:(null==t?void 0:t.buyQuantity)||0,mode:(null==t?void 0:t.mode)||"",platform:(null==t?void 0:t.platform)||"",no:(null==t?void 0:t.outTradeNo)||"",payType:"Midas"})})),Ae(wx,"requestMidasPaymentGameItem",(function(t,e){var n=(e||{}).signData;Qt.publish(Ne,{status:"success"===t?"SUCCESS":"FAIL",quantity:(null==n?void 0:n.buyQuantity)||0,mode:(null==n?void 0:n.mode)||"",platform:(null==n?void 0:n.platform)||"",no:(null==n?void 0:n.outTradeNo)||"",p:(null==n?void 0:n.goodsPrice)||0,productId:(null==n?void 0:n.productId)||"",payType:"MidasGameItem"})}),(function(t){var e=(t||{}).signData;Qt.publish(xe,{quantity:(null==e?void 0:e.buyQuantity)||0,mode:(null==e?void 0:e.mode)||"",platform:(null==e?void 0:e.platform)||"",no:(null==e?void 0:e.outTradeNo)||"",p:(null==e?void 0:e.goodsPrice)||0,productId:(null==e?void 0:e.productId)||"",payType:"MidasGameItem"})})))}}(),Pe=function(){function t(){f(this,t)}return v(t,null,[{key:"isEmpty",value:function(t){return!t||""===t.trim()}},{key:"format",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return t.replace(/\${(\d+)}/g,(function(t,e){return n[e]}))}},{key:"customStringify",value:function(t){var e=[];try{return JSON.stringify(t,(function(t,n){if(void 0===n)return"undefined";if("object"==l(n)&&null!==n){if(-1!==e.indexOf(n))return"[Circular]";e.push(n)}return"bigint"==typeof n?n.toString():n}))}catch(t){return"[Param Error]"}}}]),t}(),Me=/^([a-zA-Z][a-zA-Z\d_]{0,63})$/i,De=/^ams_reserved_(.*)/i,Ue=function(){function t(){f(this,t)}return v(t,null,[{key:"validateActionType",value:function(e){return Pe.isEmpty(e)?(xt.error(t.ERROR_ACTION_TYPE_NULL),!1):!!Me.test(e)||(xt.error(t.ERROR_ACTION_TYPE_INVALID),!1)}},{key:"validateActionParam",value:function(e){if(!e)return!0;if(!ht(e))return xt.error(t.ERROR_ACTION_PARAM_IS_NOT_OBJECT),!1;for(var n in e){if(Pe.isEmpty(n))return xt.error(t.ERROR_ACTION_PARAM_KEY_NULL),!1;if(!Me.test(n))return xt.error(t.ERROR_ACTION_PARAM_KEY_INVALID),!1;De.test(n)&&xt.warn(t.WARN_ACTION_PARAM_KEY_RESERVED);var r=e[n];if(!t.isValidValue(r))return xt.error(Pe.format(t.ERROR_ACTION_PARAM_VALUE_INVALID,n,r)),!1;if(yt(r)){if(!t.isValidArrayValue(r)){for(var o=0;o<r.length;o++)xt.error(Pe.format(t.ERROR_ACTION_PARAM_VALUE_ARRAY_INVALID,n,Pe.customStringify(r),o,r[o]));return!1}if(!t.checkArrayElementTypes(r))return xt.error(t.ERROR_ACTION_PARAM_VALUE_ARRAY_TYPE_UNUNIQUE),!1}}return!0}},{key:"isValidValue",value:function(t){return null==t||("string"==typeof t||"number"==typeof t||"boolean"==typeof t||yt(t))}},{key:"isValidArrayValue",value:function(t){for(var e=0;e<t.length;e++){var n=t[e];if("string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n)return!1}return!0}},{key:"checkArrayElementTypes",value:function(t){if(!t||t.length<=1)return!0;for(var e=l(t[0]),n=1;n<t.length;n++)if(l(t[n])!==e)return!1;return!0}}]),t}(),qe=Ue;qe.ERROR_ACTION_TYPE_NULL="在track方法中,action_type参数不能为空!",qe.ERROR_ACTION_TYPE_INVALID="在track方法中,action_type参数只能包含字母、数字和下划线,且只能以字母开头,长度不能超过64个字符!",qe.ERROR_ACTION_PARAM_KEY_NULL="在track方法中,action_param参数的key不能为空!",qe.ERROR_ACTION_PARAM_KEY_INVALID="在track方法中,action_param参数的key只能包含字母、数字和下划线,且不能以数字开头,长度不能超过64个字符!",qe.WARN_ACTION_PARAM_KEY_RESERVED="SDK内部预留参数的key均以'ams_reserved_'开头,该参数的值会被SDK内部覆盖,请不要使用!",qe.ERROR_ACTION_PARAM_VALUE_INVALID="在track方法中,action_param参数的value必须是String/Number/Boolean/Array中的一种![key=${0}, value=${1}]",qe.ERROR_ACTION_PARAM_VALUE_ARRAY_INVALID="在track方法中,如果action_param参数中的某个元素的value是Array,那么这个Array中的每个元素必须是String/Number/Boolean中的一种![key=${0}, value=${1}, 数组的第${2}个元素为${3}]",qe.ERROR_ACTION_PARAM_VALUE_ARRAY_TYPE_UNUNIQUE="在track方法中,如果action_param参数中的某个元素的value是Array,那么这个Array中所有元素的类型必须是同一种!",qe.ERROR_ACTION_PARAM_IS_NOT_OBJECT="action_param 参数不是Object";var je={exports:{}};!function(t){!function(e){function n(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function r(t,e,r,o,i,a){return n(function(t,e){return t<<e|t>>>32-e}(n(n(e,t),n(o,a)),i),r)}function o(t,e,n,o,i,a,u){return r(e&n|~e&o,t,e,i,a,u)}function i(t,e,n,o,i,a,u){return r(e&o|n&~o,t,e,i,a,u)}function a(t,e,n,o,i,a,u){return r(e^n^o,t,e,i,a,u)}function u(t,e,n,o,i,a,u){return r(n^(e|~o),t,e,i,a,u)}function c(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;var r,c,s,l,f,d=1732584193,v=-271733879,p=-1732584194,h=271733878;for(r=0;r<t.length;r+=16)c=d,s=v,l=p,f=h,d=o(d,v,p,h,t[r],7,-680876936),h=o(h,d,v,p,t[r+1],12,-389564586),p=o(p,h,d,v,t[r+2],17,606105819),v=o(v,p,h,d,t[r+3],22,-1044525330),d=o(d,v,p,h,t[r+4],7,-176418897),h=o(h,d,v,p,t[r+5],12,1200080426),p=o(p,h,d,v,t[r+6],17,-1473231341),v=o(v,p,h,d,t[r+7],22,-45705983),d=o(d,v,p,h,t[r+8],7,1770035416),h=o(h,d,v,p,t[r+9],12,-1958414417),p=o(p,h,d,v,t[r+10],17,-42063),v=o(v,p,h,d,t[r+11],22,-1990404162),d=o(d,v,p,h,t[r+12],7,1804603682),h=o(h,d,v,p,t[r+13],12,-40341101),p=o(p,h,d,v,t[r+14],17,-1502002290),d=i(d,v=o(v,p,h,d,t[r+15],22,1236535329),p,h,t[r+1],5,-165796510),h=i(h,d,v,p,t[r+6],9,-1069501632),p=i(p,h,d,v,t[r+11],14,643717713),v=i(v,p,h,d,t[r],20,-373897302),d=i(d,v,p,h,t[r+5],5,-701558691),h=i(h,d,v,p,t[r+10],9,38016083),p=i(p,h,d,v,t[r+15],14,-660478335),v=i(v,p,h,d,t[r+4],20,-405537848),d=i(d,v,p,h,t[r+9],5,568446438),h=i(h,d,v,p,t[r+14],9,-1019803690),p=i(p,h,d,v,t[r+3],14,-187363961),v=i(v,p,h,d,t[r+8],20,1163531501),d=i(d,v,p,h,t[r+13],5,-1444681467),h=i(h,d,v,p,t[r+2],9,-51403784),p=i(p,h,d,v,t[r+7],14,1735328473),d=a(d,v=i(v,p,h,d,t[r+12],20,-1926607734),p,h,t[r+5],4,-378558),h=a(h,d,v,p,t[r+8],11,-2022574463),p=a(p,h,d,v,t[r+11],16,1839030562),v=a(v,p,h,d,t[r+14],23,-35309556),d=a(d,v,p,h,t[r+1],4,-1530992060),h=a(h,d,v,p,t[r+4],11,1272893353),p=a(p,h,d,v,t[r+7],16,-155497632),v=a(v,p,h,d,t[r+10],23,-1094730640),d=a(d,v,p,h,t[r+13],4,681279174),h=a(h,d,v,p,t[r],11,-358537222),p=a(p,h,d,v,t[r+3],16,-722521979),v=a(v,p,h,d,t[r+6],23,76029189),d=a(d,v,p,h,t[r+9],4,-640364487),h=a(h,d,v,p,t[r+12],11,-421815835),p=a(p,h,d,v,t[r+15],16,530742520),d=u(d,v=a(v,p,h,d,t[r+2],23,-995338651),p,h,t[r],6,-198630844),h=u(h,d,v,p,t[r+7],10,1126891415),p=u(p,h,d,v,t[r+14],15,-1416354905),v=u(v,p,h,d,t[r+5],21,-57434055),d=u(d,v,p,h,t[r+12],6,1700485571),h=u(h,d,v,p,t[r+3],10,-1894986606),p=u(p,h,d,v,t[r+10],15,-1051523),v=u(v,p,h,d,t[r+1],21,-2054922799),d=u(d,v,p,h,t[r+8],6,1873313359),h=u(h,d,v,p,t[r+15],10,-30611744),p=u(p,h,d,v,t[r+6],15,-1560198380),v=u(v,p,h,d,t[r+13],21,1309151649),d=u(d,v,p,h,t[r+4],6,-145523070),h=u(h,d,v,p,t[r+11],10,-1120210379),p=u(p,h,d,v,t[r+2],15,718787259),v=u(v,p,h,d,t[r+9],21,-343485551),d=n(d,c),v=n(v,s),p=n(p,l),h=n(h,f);return[d,v,p,h]}function s(t){var e,n="",r=32*t.length;for(e=0;e<r;e+=8)n+=String.fromCharCode(t[e>>5]>>>e%32&255);return n}function l(t){var e,n=[];for(n[(t.length>>2)-1]=void 0,e=0;e<n.length;e+=1)n[e]=0;var r=8*t.length;for(e=0;e<r;e+=8)n[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return n}function f(t){var e,n,r="0123456789abcdef",o="";for(n=0;n<t.length;n+=1)e=t.charCodeAt(n),o+=r.charAt(e>>>4&15)+r.charAt(15&e);return o}function d(t){return unescape(encodeURIComponent(t))}function v(t){return function(t){return s(c(l(t),8*t.length))}(d(t))}function p(t,e){return function(t,e){var n,r,o=l(t),i=[],a=[];for(i[15]=a[15]=void 0,o.length>16&&(o=c(o,8*t.length)),n=0;n<16;n+=1)i[n]=909522486^o[n],a[n]=1549556828^o[n];return r=c(i.concat(l(e)),512+8*e.length),s(c(a.concat(r),640))}(d(t),d(e))}function h(t,e,n){return e?n?p(e,t):function(t,e){return f(p(t,e))}(e,t):n?v(t):function(t){return f(v(t))}(t)}t.exports?t.exports=h:e.md5=h}(he)}(je);var Fe=ye(je.exports),Be="function"==typeof btoa,Ve="function"==typeof Buffer;"function"==typeof TextDecoder&&new TextDecoder;var Ke,Ge="function"==typeof TextEncoder?new TextEncoder:void 0,Qe=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");Ke={},Qe.forEach((function(t,e){return Ke[t]=e}));var Ye=String.fromCharCode.bind(String);"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array);var We=Be?function(t){return btoa(t)}:Ve?function(t){return Buffer.from(t,"binary").toString("base64")}:function(t){for(var e,n,r,o,i="",a=t.length%3,u=0;u<t.length;){if((n=t.charCodeAt(u++))>255||(r=t.charCodeAt(u++))>255||(o=t.charCodeAt(u++))>255)throw new TypeError("invalid character found");i+=Qe[(e=n<<16|r<<8|o)>>18&63]+Qe[e>>12&63]+Qe[e>>6&63]+Qe[63&e]}return a?i.slice(0,a-3)+"===".substring(a):i},Je=Ve?function(t){return Buffer.from(t).toString("base64")}:function(t){for(var e=[],n=0,r=t.length;n<r;n+=4096)e.push(Ye.apply(null,t.subarray(n,n+4096)));return We(e.join(""))},He=function(t){if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?Ye(192|e>>>6)+Ye(128|63&e):Ye(224|e>>>12&15)+Ye(128|e>>>6&63)+Ye(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return Ye(240|e>>>18&7)+Ye(128|e>>>12&63)+Ye(128|e>>>6&63)+Ye(128|63&e)},ze=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,$e=Ve?function(t){return Buffer.from(t,"utf8").toString("base64")}:Ge?function(t){return Je(Ge.encode(t))}:function(t){return We(function(t){return t.replace(ze,He)}(t))};var Xe=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,tn=function(t,e,n,r){for(var o,i=r>1?void 0:r?Ze(e,n):e,a=t.length-1;a>=0;a--)(o=t[a])&&(i=(r?o(e,n,i):o(i))||i);return r&&i&&Xe(e,n,i),i},en=function(){function t(e){var n=this;f(this,t),this.cgiBatchSize=E.cgiBatchSize,this.reportThreshold=E.reportThreshold,this.reportDelay=E.reportDelay,this.triggerExecuteSend=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[];return function(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return clearTimeout(e),e=setTimeout((function(){var e=t.apply(void 0,i);r.forEach((function(t){return t(e)})),r=[]}),n),new Promise((function(t){return r.push(t)}))}}((function(){n.executeSend()}),1e3*this.reportDelay),this.inspectDelay=E.inspectDelay,this.inspectTimer=void 0,this.isNeedContinueSend=!1,this.getBaseInfo=e.getBaseInfo,this.reportLog=e.reportLog,this.queueManager=e.queueManager,this.configManager=e.configManager,this.flushSend(),this.startInspectTimer()}return v(t,[{key:"batchSend",value:function(){var t,e=this.queueManager.getReportableActions(this.reportThreshold);if(e.length>=this.reportThreshold)this.executeSend();else{var n=(null==(t=this.configManager)?void 0:t.getRealTimeActionList())||E.realTimeActionList;e.some((function(t){return n.indexOf(t.action_type)>-1&&!t.is_retry}))?this.executeSend():this.triggerExecuteSend()}this.startInspectTimer()}},{key:"flushSend",value:function(){this.executeSend()}},{key:"executeSend",value:function(){var e=this;if(t.currentRequestCount>=t.requestConcurrency)this.isNeedContinueSend=!0;else{this.isNeedContinueSend=!1;var n=(t.requestConcurrency-t.currentRequestCount)*this.cgiBatchSize,r=this.queueManager.getReportableActions(n),o=this.getBaseInfo();if(!o.openid&&!o.unionid&&(xt.warn("请尽快调用 setOpenId 或 setUnionId 方法设置用户ID!"),r=r.filter((function(t){return null==t?void 0:t.ad_trace_id}))),!(r.length<=0)){n<this.queueManager.getReportableActionsLength()&&(this.isNeedContinueSend=!0),t.currentRequestCount+=Math.ceil(r.length/this.cgiBatchSize);for(var i=[],a=0;a<r.length;a+=this.cgiBatchSize){var u=this.generateActionReportParams(r.slice(a,a+this.cgiBatchSize));i.push(this.report(u))}Promise.all(i).then((function(t){var n=t.some((function(t){return t>=0}));e.isNeedContinueSend&&n&&e.executeSend()})).catch((function(t){xt.error(t),e.reportLog({message:"executeSend catch: ".concat(t.message),log_type:b.JS_RUN_ERROR,err_stack:t.stack})}))}}}},{key:"generateActionReportParams",value:function(t){var e=[],n=[],r=this.getBaseInfo();return t.forEach((function(t){n.push(t.action_id);var r=Object.assign({},t);delete r.inner_status,e.push(r)})),{data:{info:r,actions:e},actionIdList:n}}},{key:"dealSuccessData",value:function(t,e){[51001,51003].indexOf(null==t?void 0:t.code)>-1?this.queueManager.updateActionsForReportFail(e):this.queueManager.removeActions(e),0!==(null==t?void 0:t.code)&&(this.reportLog({log_type:b.REQUEST_ERROR,code:null==t?void 0:t.code,message:"trace_id: ".concat(null==t?void 0:t.trace_id,",msg: ").concat(null==t?void 0:t.message)}),xt.error("上报失败:",t))}},{key:"dealFailData",value:function(t,e){this.queueManager.updateActionsForReportFail(e),this.reportLog({log_type:b.REQUEST_ERROR,code:t.code,message:t.message}),xt.error("上报失败:",t)}},{key:"report",value:function(e){var n=this,r=e.data,o=e.actionIdList;return this.queueManager.updateActionsForReporting(o),xt.debug&&(xt.info("上报行为类型: ","【".concat(r.actions.map((function(t){return t.action_type})).join("、"),"】")),xt.info("上报请求参数: ",r)),new Promise((function(e){var i,a,u,c,s,f,d,v,p=Date.now();try{var h=function(t){var e="",n=null==t?void 0:t.appid,r=null==t?void 0:t.secret_key,o=null==t?void 0:t.sdk_version,i=null==t?void 0:t.timestamp;if(!(n&&r&&o&&i&&32===r.length))return e;for(var a=Fe(o+n+i),u=0;u<32;u++)e+=u%2==0?r[u]:a[u];return e}({appid:null==(i=null==r?void 0:r.info)?void 0:i.appid,secret_key:null==(a=null==r?void 0:r.info)?void 0:a.secret_key,sdk_version:null==(u=null==r?void 0:r.info)?void 0:u.sdk_version,timestamp:p}),y=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))}($e(t)):$e(t)}(JSON.stringify(r));d={"Client-Time":p,"Sign-Value":Fe(y+(null==(c=null==r?void 0:r.info)?void 0:c.user_action_set_id)+(null==(s=null==r?void 0:r.info)?void 0:s.secret_key)+h),"Sign-Version":E.signVersion,"content-type":"text/plain;charset=UTF-8"},v=y}catch(h){d={"Client-Time":p},v=r,n.reportLog({log_type:b.SIGN_ERROR,message:"sign error msg: ".concat(null==h?void 0:h.message),err_stack:null==h?void 0:h.stack}),xt.error(h)}wx.request({url:"https://api.datanexus.qq.com/data-nexus-cgi/miniprogram",method:"POST",timeout:(null==(f=n.configManager)?void 0:f.getRequestTimeout())||E.requestTimeout,header:d,data:v,success:function(r){var i,a;xt.devLog("上报接口返回码:",null==(i=null==r?void 0:r.data)?void 0:i.code);var u=(null==(a=null==r?void 0:r.header)?void 0:a["Server-Time"])||-1;if(st.revise(u),t.currentRequestCount-=1,200===(null==r?void 0:r.statusCode))return n.dealSuccessData(null==r?void 0:r.data,o),void e((null==r?void 0:r.data).code);var c="";try{c="object"==l(null==r?void 0:r.data)?JSON.stringify(null==r?void 0:r.data):null==r?void 0:r.data}catch(t){xt.error(t)}var s={code:"number"==typeof(null==r?void 0:r.statusCode)?-1*r.statusCode:-888,message:"statusCode: ".concat(null==r?void 0:r.statusCode,", data: ").concat(c)};n.dealFailData(s,o),e(s.code)},fail:function(r){xt.devLog("上报失败:",r),t.currentRequestCount-=1;var i={code:"number"==typeof(null==r?void 0:r.errno)?-1*r.errno:-999,message:null==r?void 0:r.errMsg};n.dealFailData(i,o),e(i.code)}})}))}},{key:"startInspectTimer",value:function(){var e=this;clearTimeout(this.inspectTimer),this.inspectTimer=setTimeout((function(){t.currentRequestCount>=t.requestConcurrency&&(t.currentRequestCount=t.requestConcurrency-1),e.executeSend(),e.startInspectTimer()}),1e3*this.inspectDelay)}}],[{key:"setRequestConcurrency",value:function(e){"number"==typeof e?e<1?xt.error("网络请求最大并发量不能小于1"):e>10?xt.error("网络请求最大并发量不能大于10"):t.requestConcurrency=e:xt.error("网络请求最大并发量需设置为数字")}}]),t}(),nn=en;nn.currentRequestCount=0,nn.requestConcurrency=E.requestConcurrency,tn([Lt],nn.prototype,"batchSend",1),tn([Lt],nn.prototype,"flushSend",1),tn([Lt],nn.prototype,"executeSend",1);var rn=Wt,on=Jt,an=Ht,un=zt,cn=$t,sn=ie,ln=Xt,fn=Zt,dn=te,vn=ne,pn=oe,hn=re,yn=ee,_n=function(){function e(){f(this,e)}return v(e,[{key:"install",value:function(e,n){var r=function(n){Qt.subscribe(n,function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(o){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.track(n,Object.assign(r||{},i,t(t({},wn,!0),Cn,o)))}}(n))};r(on),r(rn),r(an),r(un),"all"===n&&(r(cn),r(sn),r(ln),r(dn),r(fn),r(yn),r(vn),r(pn),r(hn))}}]),e}(),gn=function(){function e(){f(this,e),this.special_method_symbol=Symbol("special_method_symbol")}return v(e,[{key:"onPurchase",value:function(t){"number"!=typeof t&&xt.warn("付费金额需要为数字"),t<=0&&xt.warn("付费金额需要大于0"),this.wrapTrack(j,{value:t})}},{key:"onEnterForeground",value:function(){this.wrapTrack(D)}},{key:"onEnterBackground",value:function(){this.wrapTrack(U)}},{key:"onAppStart",value:function(){this.wrapTrack(M)}},{key:"onAppQuit",value:function(){this.wrapTrack(F)}},{key:"onAddToWishlist",value:function(){this.wrapTrack(q)}},{key:"wrapTrack",value:function(e,n){this.track(e,Object.assign(n||{},t({},this.special_method_symbol,1)))}}]),e}(),mn=function(t){o(n,gn);var e=a(n);function n(){return f(this,n),e.apply(this,arguments)}return v(n,[{key:"onRegister",value:function(){this.wrapTrack(B)}},{key:"onCreateRole",value:function(t){t&&"string"!=typeof t&&xt.warn("角色名称需要为字符串"),this.wrapTrack(V,t?{name:t}:{})}},{key:"onTutorialFinish",value:function(){this.wrapTrack(K)}}]),n}(),An="(如果确认无误,请忽略该提示)",Rn=function(){var t=[];return{requestActionList:function(){try{lt({conf_name:"data_nexus_common",conf_key:"action_types"}).then((function(e){yt(e)&&(t=e)}))}catch(t){xt.error(t)}},getActionList:function(){return t}}}();function kn(t,e){try{t.is_sdk_auto_track||(function(t){try{var e=Rn.getActionList();if(!e.includes(t)){var r,o=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=n(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;if(Tn(i,t)<=parseInt((.3*i.length).toString())){xt.warn("通过SDK上报的".concat(t,"行为名称可能有误,请检查该行为类型是否为腾讯广告提供的标准行为!").concat(An));break}}}catch(t){o.e(t)}finally{o.f()}}}catch(e){xt.error(e)}}(t.action_type),"minigame"===e?function(t,e){var n,r,o;try{["PURCHASE","ADD_TO_CART"].includes(t.action_type)&&t.action_param&&It(t.action_param,"value")&&("number"!=typeof(null==(n=t.action_param)?void 0:n.value)?xt.warn("通过SDK上报的".concat(t.action_type,"行为携带的金额参数需要为数字!")):(null==(r=t.action_param)?void 0:r.value)<=0?xt.warn("通过SDK上报的".concat(t.action_type,"行为携带的金额参数需要大于0!")):"minigame"===e&&(null==(o=t.action_param)?void 0:o.value)<100&&xt.warn("通过SDK上报的".concat(t.action_type,"行为携带的金额参数可能有误,金额的单位为‘分’,请检查金额是否正确!").concat(An)))}catch(t){xt.error(t)}}(t,e):"miniprogram"===e&&function(t){try{var e=null==t?void 0:t.action_type,n=(null==t?void 0:t.action_param)||{};"PURCHASE"===e&&It(n,"value")&&("number"!=typeof(null==n?void 0:n.value)?xt.warn("通过SDK上报的".concat(e,"行为携带的金额参数需要为数字!")):(null==n?void 0:n.value)<=0&&xt.warn("通过SDK上报的".concat(e,"行为携带的金额参数需要大于0!")))}catch(e){xt.error(e)}}(t))}catch(t){xt.error(t)}}function Tn(t,e){try{if(0===t.length)return e.length;if(0===e.length)return t.length;for(var n=[],r=0;r<=e.length;r++)n[r]=[r];for(var o=0;o<=t.length;o++)n[0][o]=o;for(var i=1;i<=e.length;i++)for(var a=1;a<=t.length;a++)e.charAt(i-1)===t.charAt(a-1)?n[i][a]=n[i-1][a-1]:n[i][a]=Math.min(n[i-1][a-1]+1,n[i][a-1]+1,n[i-1][a]+1);return n[e.length][t.length]}catch(n){xt.error(n)}}function Sn(t){try{t&&!/^[a-zA-Z0-9_\-]+$/.test(t)&&xt.warn("通过SDK上报的openid:".concat(t,"可能有误,请检查openid是否正确!").concat(An))}catch(t){xt.error(t)}}var En=Object.defineProperty,bn=Object.getOwnPropertyDescriptor,On=function(t,e,n,r){for(var o,i=r>1?void 0:r?bn(e,n):e,a=t.length-1;a>=0;a--)(o=t[a])&&(i=(r?o(e,n,i):o(i))||i);return r&&i&&En(e,n,i),i},In=Symbol("initializedInstance"),wn=Symbol("autoTrack"),Cn=Symbol("actionTime"),xn=function(e){o(r,mn);var n=a(r);function r(t){var e;if(f(this,r),(e=n.call(this)).env="production",e.sdk_version="1.5.4",e.sdk_name="@dn-sdk/minigame",e.deviceInfo={},e.gameInfo={},e.session_id="",e.log_id=0,e.inited=!1,null==wx||!wx.createCanvas)return xt.error("SDK只可以用在微信小游戏中使用"),u(e);var o=Ot();if(r[In].length>=o.maxSdkInstance)return xt.error("初始化超过上限"),u(e);var i=Et(t),a=at();if(!0!==i)return xt.error(i),u(e);var s=null==a?void 0:a.appId;if(s&&s!==t.appid)return xt.error("初始化失败,传入的appid与当前小游戏appid不一致"),u(e);e.config=t,It(t,"auto_track")||(e.config.auto_track=bt("autoTrack")),e.openid=t.openid,e.unionid=t.unionid,e.user_unique_id=t.user_unique_id,e.saveValidOpenidToStorage();var l=t.user_action_set_id;return r[In].includes(l)?(xt.error("请勿重复初始化SDK"),u(e)):(e.reportLog=e.reportLog.bind(c(e)),e.getTrackBaseInfo=e.getTrackBaseInfo.bind(c(e)),e.deviceInfo=nt(),e.gameInfo=Nt(),e.session_id=mt(),e.queueManage=new Vt({userActionSetId:l,maxLength:o.maxQueueLength,ogEvents:Yt}),e.actionReporter=new nn({getBaseInfo:e.getTrackBaseInfo,reportLog:e.reportLog,queueManager:e.queueManage,configManager:se}),e.inited=!0,r[In].push(l),e.useAutoTrack(),e.doReportOnEnterBackground(),"release"===(null==a?void 0:a.envVersion)?(xt.info("初始化成功"),u(e)):(function(t){var e=t.conf_name,n=t.conf_key,r=t.sdk_version,o=t.default_download_url,i=t.fail_handler;lt({conf_name:e,conf_key:n}).then((function(t){if(ht(t)){var e=null==t?void 0:t.blackVersions,n=null==t?void 0:t.minVersion,a=null==t?void 0:t.bestVersion,u=null==t?void 0:t.downloadUrl,c=o;return u&&/^https/.test(u)&&(c=u),yt(e)&&(null==e?void 0:e.indexOf(r))>-1?(null==i||i(),void xt.error("初始化失败!当前SDK版本存在兼容问题,请尽快升级至最新版!下载地址:".concat(c))):n&&St(r,n)<0?(null==i||i(),void xt.error("初始化失败!当前SDK版本过低,请尽快升级至最新版!下载地址:".concat(c))):(a&&St(r,a)<0&&xt.warn("新版本SDK已上线,强烈建议您升级至最新版,尽早享受新特性!下载地址:".concat(c)),void xt.info("初始化成功"))}xt.info("初始化成功")})).catch((function(){xt.info("初始化成功")}))}({conf_name:"mini_game_sdk_common",conf_key:"version",sdk_version:e.sdk_version,default_download_url:"https://sr-home-1257214331.cos.ap-guangzhou.myqcloud.com/sdk/dn-sdk-minigame/dn-sdk-minigame.zip",fail_handler:function(){e.inited=!1}}),Rn.requestActionList(),Sn(t.openid),u(e)))}return v(r,[{key:"track",value:function(t,e){var n,r,o,i=qe.validateActionType(t),a=qe.validateActionParam(e);if(i&&a){!this.openid&&!this.unionid&&xt.warn("缺少 openid 或 unionid");var u=bt("actionParamMaxLength");if(JSON.stringify(e||{}).length>u)return void xt.error("监测到超过".concat(u,"的上报日志:").concat(t," ").concat(e));var c=!(null==e||!e[wn]),s=this.createAction(t,e||{},c);"release"!==(null==(n=at())?void 0:n.envVersion)&&kn(s,"minigame"),null==(r=this.queueManage)||r.addAction(s),null==(o=this.actionReporter)||o.batchSend()}}},{key:"flush",value:function(){var t;null==(t=this.actionReporter)||t.flushSend()}},{key:"setOpenId",value:function(t){var e;t&&"string"==typeof t?(this.openid=t,this.gameInfo.ad_trace_id&&!tt.getSync(T)&&Qt.publish("START_APP"),this.flush(),this.saveValidOpenidToStorage(),"release"!==(null==(e=at())?void 0:e.envVersion)&&Sn(t)):xt.error("openid 格式错误")}},{key:"setUnionId",value:function(t){t&&"string"==typeof t?(this.unionid=t,this.flush()):xt.error("unionid 格式错误")}},{key:"setUserUniqueId",value:function(t){t&&"string"==typeof t?this.user_unique_id=t:xt.error("user_unique_id 格式错误")}},{key:"doReportOnEnterBackground",value:function(){var t=this;wx.onHide((function(){var e,n;null==(e=t.actionReporter)||e.flushSend(),null==(n=t.queueManage)||n.reportLostNum()}))}},{key:"getTrackBaseInfo",value:function(){var t=at();return Object.assign({},this.deviceInfo,function(t,e){var n={};return e.forEach((function(e){It(t,e)&&(n[e]=t[e])})),n}(this.config,["user_action_set_id","appid","openid","secret_key","user_unique_id","unionid"]),{local_id:rt(),sdk_name:this.sdk_name,sdk_version:this.sdk_version,openid:this.openid||it(),unionid:this.unionid,user_unique_id:this.user_unique_id,inner_param:{app_env_version:t.envVersion,app_version:t.version}})}},{key:"createAction",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];null!=e&&e[wn]&&delete e[wn];var r=Date.now();null!=e&&e[Cn]&&(r=null==e?void 0:e[Cn],delete e[Cn]);var o={action_id:mt(),action_param:e,action_time:r,action_type:t,is_retry:!1,is_sdk_auto_track:n,retry_count:0,revised_action_time:st.getRevisedcurrentTimeMillis(),log_id:++this.log_id,session_id:this.session_id,pkg_channel_id:this.gameInfo.pkg_channel_id,source_scene:this.gameInfo.source_scene,network_type:ot(),ad_trace_id:this.gameInfo.ad_trace_id,channel:this.getChannelByActionType(t)};return null!=e&&e[this.special_method_symbol]&&(this.addActionInnerParam(o,"is_special_method",!0),delete e[this.special_method_symbol]),se.getChannelClaimActionList().indexOf(t)>-1&&this.gameInfo.launch_options&&this.addActionInnerParam(o,"launch_options",this.gameInfo.launch_options),o}},{key:"addActionInnerParam",value:function(e,n,r){e.inner_param&&ht(e.inner_param)?e.inner_param[n]=r:e.inner_param=t({},n,r)}},{key:"getChannelByActionType",value:function(t){var e="";return se.getChannelClaimActionList().indexOf(t)>-1?e=this.gameInfo.channel||"":se.getNoClaimActionList().indexOf(t)>-1&&(e=X),e}},{key:"reportLog",value:function(t){var e,n,r={user_action_set_id:null==(e=this.config)?void 0:e.user_action_set_id,appid:null==(n=this.config)?void 0:n.appid,session_id:this.session_id};ct(Object.assign(r,t))}},{key:"useAutoTrack",value:function(){var t;if(null!=(t=this.config)&&t.auto_track){var e=!0,n=tt.getSync(R);(null==n?void 0:n.ap)===G?e=!0:(null==n?void 0:n.ap)===Q&&(e=!1),"devtools"===nt().wx_platform&&(e=!0),(new _n).install(this,e?"all":"lifecycle"),pe(),e&&Le(),this.getAutoProxyRemoteConfig()}}},{key:"getAutoProxyRemoteConfig",value:function(){var t,e,n=nt();n.os&&n.os_version&&null!=(t=this.config)&&t.user_action_set_id&&function(t){return new Promise((function(e){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/minigame/get",data:t,timeout:E.requestTimeout,success:function(t){ft(t,e,"minigame/get"),vt(t)},fail:function(t){dt(t,"minigame/get")}})}))}({conf_name:"MG",conf_param:{user_action_set_id:null==(e=this.config)?void 0:e.user_action_set_id,sdk_version:this.sdk_version,os_type:(null==n?void 0:n.os)||"",os_version:wt(n.os_version),device_brand:(null==n?void 0:n.device_brand)||"",weixin_lib_version:(null==n?void 0:n.wx_lib_version)||"",weixin_version:(null==n?void 0:n.wx_version)||""}}).then((function(t){ht(t)&&tt.setSync(R,t)}))}},{key:"saveValidOpenidToStorage",value:function(){this.openid&&function(t){return/^[a-zA-Z0-9_-]{28,30}$/.test(t)}(this.openid)&&tt.setSync(T,this.openid)}}],[{key:"setRequestConcurrency",value:function(t){nn.setRequestConcurrency(t)}},{key:"setDebug",value:function(t){xt.debug=t}}]),r}(),Nn=xn;Nn[In]=[],On([Lt,Pt],Nn.prototype,"track",1),On([Lt,Pt],Nn.prototype,"flush",1),On([Lt],Nn.prototype,"setOpenId",1),On([Lt],Nn.prototype,"setUnionId",1),On([Lt],Nn.prototype,"setUserUniqueId",1),On([Lt],Nn.prototype,"doReportOnEnterBackground",1),On([Lt],Nn.prototype,"getTrackBaseInfo",1),On([Lt],Nn.prototype,"useAutoTrack",1);export{Nn as SDK};
|