jf-gamekit 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/umd/wxSdk.umd.js CHANGED
@@ -1,7 +1,7 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jfGamekitSDK={})}(this,function(e){"use strict";function t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(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 r(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach(function(n){t(e,n,o[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function o(e){return o="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},o(e)}var i,a,u=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e3,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;wx.showToast({title:e,icon:t,duration:n,mask:!0,success:r})},c="POST";function s(e,t,n){return new Promise(function(r,o){wx.request({url:"https://page.hurricanegame.cn"+t,method:e,data:e===c?JSON.stringify(n):n,header:{"content-type":"application/json"},success:function(e){200===e.statusCode?e.data.state?r(e.data):o("request interface error"):console.error("Network Error!")}})})}var l=(a||(a=1,i={md5:function(e){function t(e,t){return e<<t|e>>>32-t}function n(e,t){var n,r,o,i,a;return o=2147483648&e,i=2147483648&t,a=(1073741823&e)+(1073741823&t),(n=1073741824&e)&(r=1073741824&t)?2147483648^a^o^i:n|r?1073741824&a?3221225472^a^o^i:1073741824^a^o^i:a^o^i}function r(e,r,o,i,a,u,c){return e=n(e,n(n(function(e,t,n){return e&t|~e&n}(r,o,i),a),c)),n(t(e,u),r)}function o(e,r,o,i,a,u,c){return e=n(e,n(n(function(e,t,n){return e&n|t&~n}(r,o,i),a),c)),n(t(e,u),r)}function i(e,r,o,i,a,u,c){return e=n(e,n(n(function(e,t,n){return e^t^n}(r,o,i),a),c)),n(t(e,u),r)}function a(e,r,o,i,a,u,c){return e=n(e,n(n(function(e,t,n){return t^(e|~n)}(r,o,i),a),c)),n(t(e,u),r)}function u(e){var t,n="",r="";for(t=0;t<=3;t++)n+=(r="0"+(e>>>8*t&255).toString(16)).substr(r.length-2,2);return n}var c,s,l,f,d,p,v,h,g,y=Array();for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}(e),y=function(e){for(var t,n=e.length,r=n+8,o=16*((r-r%64)/64+1),i=Array(o-1),a=0,u=0;u<n;)a=u%4*8,i[t=(u-u%4)/4]=i[t]|e.charCodeAt(u)<<a,u++;return a=u%4*8,i[t=(u-u%4)/4]=i[t]|128<<a,i[o-2]=n<<3,i[o-1]=n>>>29,i}(e),p=1732584193,v=4023233417,h=2562383102,g=271733878,c=0;c<y.length;c+=16)s=p,l=v,f=h,d=g,p=r(p,v,h,g,y[c+0],7,3614090360),g=r(g,p,v,h,y[c+1],12,3905402710),h=r(h,g,p,v,y[c+2],17,606105819),v=r(v,h,g,p,y[c+3],22,3250441966),p=r(p,v,h,g,y[c+4],7,4118548399),g=r(g,p,v,h,y[c+5],12,1200080426),h=r(h,g,p,v,y[c+6],17,2821735955),v=r(v,h,g,p,y[c+7],22,4249261313),p=r(p,v,h,g,y[c+8],7,1770035416),g=r(g,p,v,h,y[c+9],12,2336552879),h=r(h,g,p,v,y[c+10],17,4294925233),v=r(v,h,g,p,y[c+11],22,2304563134),p=r(p,v,h,g,y[c+12],7,1804603682),g=r(g,p,v,h,y[c+13],12,4254626195),h=r(h,g,p,v,y[c+14],17,2792965006),p=o(p,v=r(v,h,g,p,y[c+15],22,1236535329),h,g,y[c+1],5,4129170786),g=o(g,p,v,h,y[c+6],9,3225465664),h=o(h,g,p,v,y[c+11],14,643717713),v=o(v,h,g,p,y[c+0],20,3921069994),p=o(p,v,h,g,y[c+5],5,3593408605),g=o(g,p,v,h,y[c+10],9,38016083),h=o(h,g,p,v,y[c+15],14,3634488961),v=o(v,h,g,p,y[c+4],20,3889429448),p=o(p,v,h,g,y[c+9],5,568446438),g=o(g,p,v,h,y[c+14],9,3275163606),h=o(h,g,p,v,y[c+3],14,4107603335),v=o(v,h,g,p,y[c+8],20,1163531501),p=o(p,v,h,g,y[c+13],5,2850285829),g=o(g,p,v,h,y[c+2],9,4243563512),h=o(h,g,p,v,y[c+7],14,1735328473),p=i(p,v=o(v,h,g,p,y[c+12],20,2368359562),h,g,y[c+5],4,4294588738),g=i(g,p,v,h,y[c+8],11,2272392833),h=i(h,g,p,v,y[c+11],16,1839030562),v=i(v,h,g,p,y[c+14],23,4259657740),p=i(p,v,h,g,y[c+1],4,2763975236),g=i(g,p,v,h,y[c+4],11,1272893353),h=i(h,g,p,v,y[c+7],16,4139469664),v=i(v,h,g,p,y[c+10],23,3200236656),p=i(p,v,h,g,y[c+13],4,681279174),g=i(g,p,v,h,y[c+0],11,3936430074),h=i(h,g,p,v,y[c+3],16,3572445317),v=i(v,h,g,p,y[c+6],23,76029189),p=i(p,v,h,g,y[c+9],4,3654602809),g=i(g,p,v,h,y[c+12],11,3873151461),h=i(h,g,p,v,y[c+15],16,530742520),p=a(p,v=i(v,h,g,p,y[c+2],23,3299628645),h,g,y[c+0],6,4096336452),g=a(g,p,v,h,y[c+7],10,1126891415),h=a(h,g,p,v,y[c+14],15,2878612391),v=a(v,h,g,p,y[c+5],21,4237533241),p=a(p,v,h,g,y[c+12],6,1700485571),g=a(g,p,v,h,y[c+3],10,2399980690),h=a(h,g,p,v,y[c+10],15,4293915773),v=a(v,h,g,p,y[c+1],21,2240044497),p=a(p,v,h,g,y[c+8],6,1873313359),g=a(g,p,v,h,y[c+15],10,4264355552),h=a(h,g,p,v,y[c+6],15,2734768916),v=a(v,h,g,p,y[c+13],21,1309151649),p=a(p,v,h,g,y[c+4],6,4149444226),g=a(g,p,v,h,y[c+11],10,3174756917),h=a(h,g,p,v,y[c+2],15,718787259),v=a(v,h,g,p,y[c+9],21,3951481745),p=n(p,s),v=n(v,l),h=n(h,f),g=n(g,d);return(u(p)+u(v)+u(h)+u(g)).toLowerCase()}}),i);function f(e){e.time=parseInt(Date.parse(new Date)/1e3);var t=function(e){for(var t=Object.keys(e).sort(),n={},r=0;r<t.length;r++){var o=t[r];n[o]=e[o]}return n}(e);return e.sign||(e.sign=l.md5(function(e){var t="";for(var n in e){var r="";null!=e[n]?r=e[n]:e[n]="",t+=n+"="+r+"&"}return t.slice(0,t.length-1)}(t)+"WvgAUx8i0JeG5aaF")),e}function d(e){var t;if("object"===o(e))if(Array.isArray(e))for(var n in t=[],e)t.push(d(e[n]));else if(null===e)t=null;else if(e.constructor===RegExp)t=e;else for(var r in t={},e)t[r]=d(e[r]);else t=e;return t}var p={mac:"",imei:"",oaid:"",androidid:"",idfa:"",idfv:"",sdkver:"1.0"},v=0,h=function(){var e={duid:""},t=wx.getStorageSync("duid");if(t)e.duid=t,v=0;else{console.log(v);var n=function(){for(var e="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",t="",n=0;n<32;n++)t+=e.charAt(Math.floor(48*Math.random()));return t}();wx.setStorageSync("duid",n),e.duid=n,v=1}return e},g=function(){var e={client:"",brand:"",resolution:"",model:"",sysver:""};try{var t=wx.getSystemInfoSync();e.sysver=t.system,e.resolution=t.screenWidth+"*"+t.screenHeight,e.model=t.model,e.client=t.platform,e.brand=t.brand}catch(e){console.log("【获取设备系统信息失败】",e)}return e},y=function(){return r(r(r(r({},h()),g()),p),{},{install:v,ntype:""})};
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jfGamekitSDK={})}(this,function(e){"use strict";function t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(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 r(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach(function(n){t(e,n,o[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function o(e){return o="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},o(e)}var i,a,u=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e3,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;wx.showToast({title:e,icon:t,duration:n,mask:!0,success:r})},c="POST";function s(e,t,n){return new Promise(function(r,o){wx.request({url:"https://page.hurricanegame.cn"+t,method:e,data:e===c?JSON.stringify(n):n,header:{"content-type":"application/json"},success:function(e){200===e.statusCode?e.data.state?r(e.data):o("request interface error"):console.error("Network Error!")}})})}function l(e,t,n){return new Promise(function(r,o){var i=wx.getStorageSync("jfGamekitSSToken");wx.request({url:"https://common-set-api.topspinup.com"+t,method:e,data:e===c?JSON.stringify(n):n,header:{"content-type":"application/json",Authorization:"Bearer ".concat(i)},success:function(e){200===e.statusCode?0==e.data.code?r(e.data):o("request interface error"):console.error("Network Error!")}})})}var f=(a||(a=1,i={md5:function(e){function t(e,t){return e<<t|e>>>32-t}function n(e,t){var n,r,o,i,a;return o=2147483648&e,i=2147483648&t,a=(1073741823&e)+(1073741823&t),(n=1073741824&e)&(r=1073741824&t)?2147483648^a^o^i:n|r?1073741824&a?3221225472^a^o^i:1073741824^a^o^i:a^o^i}function r(e,r,o,i,a,u,c){return e=n(e,n(n(function(e,t,n){return e&t|~e&n}(r,o,i),a),c)),n(t(e,u),r)}function o(e,r,o,i,a,u,c){return e=n(e,n(n(function(e,t,n){return e&n|t&~n}(r,o,i),a),c)),n(t(e,u),r)}function i(e,r,o,i,a,u,c){return e=n(e,n(n(function(e,t,n){return e^t^n}(r,o,i),a),c)),n(t(e,u),r)}function a(e,r,o,i,a,u,c){return e=n(e,n(n(function(e,t,n){return t^(e|~n)}(r,o,i),a),c)),n(t(e,u),r)}function u(e){var t,n="",r="";for(t=0;t<=3;t++)n+=(r="0"+(e>>>8*t&255).toString(16)).substr(r.length-2,2);return n}var c,s,l,f,d,p,v,h,g,y=Array();for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}(e),y=function(e){for(var t,n=e.length,r=n+8,o=16*((r-r%64)/64+1),i=Array(o-1),a=0,u=0;u<n;)a=u%4*8,i[t=(u-u%4)/4]=i[t]|e.charCodeAt(u)<<a,u++;return a=u%4*8,i[t=(u-u%4)/4]=i[t]|128<<a,i[o-2]=n<<3,i[o-1]=n>>>29,i}(e),p=1732584193,v=4023233417,h=2562383102,g=271733878,c=0;c<y.length;c+=16)s=p,l=v,f=h,d=g,p=r(p,v,h,g,y[c+0],7,3614090360),g=r(g,p,v,h,y[c+1],12,3905402710),h=r(h,g,p,v,y[c+2],17,606105819),v=r(v,h,g,p,y[c+3],22,3250441966),p=r(p,v,h,g,y[c+4],7,4118548399),g=r(g,p,v,h,y[c+5],12,1200080426),h=r(h,g,p,v,y[c+6],17,2821735955),v=r(v,h,g,p,y[c+7],22,4249261313),p=r(p,v,h,g,y[c+8],7,1770035416),g=r(g,p,v,h,y[c+9],12,2336552879),h=r(h,g,p,v,y[c+10],17,4294925233),v=r(v,h,g,p,y[c+11],22,2304563134),p=r(p,v,h,g,y[c+12],7,1804603682),g=r(g,p,v,h,y[c+13],12,4254626195),h=r(h,g,p,v,y[c+14],17,2792965006),p=o(p,v=r(v,h,g,p,y[c+15],22,1236535329),h,g,y[c+1],5,4129170786),g=o(g,p,v,h,y[c+6],9,3225465664),h=o(h,g,p,v,y[c+11],14,643717713),v=o(v,h,g,p,y[c+0],20,3921069994),p=o(p,v,h,g,y[c+5],5,3593408605),g=o(g,p,v,h,y[c+10],9,38016083),h=o(h,g,p,v,y[c+15],14,3634488961),v=o(v,h,g,p,y[c+4],20,3889429448),p=o(p,v,h,g,y[c+9],5,568446438),g=o(g,p,v,h,y[c+14],9,3275163606),h=o(h,g,p,v,y[c+3],14,4107603335),v=o(v,h,g,p,y[c+8],20,1163531501),p=o(p,v,h,g,y[c+13],5,2850285829),g=o(g,p,v,h,y[c+2],9,4243563512),h=o(h,g,p,v,y[c+7],14,1735328473),p=i(p,v=o(v,h,g,p,y[c+12],20,2368359562),h,g,y[c+5],4,4294588738),g=i(g,p,v,h,y[c+8],11,2272392833),h=i(h,g,p,v,y[c+11],16,1839030562),v=i(v,h,g,p,y[c+14],23,4259657740),p=i(p,v,h,g,y[c+1],4,2763975236),g=i(g,p,v,h,y[c+4],11,1272893353),h=i(h,g,p,v,y[c+7],16,4139469664),v=i(v,h,g,p,y[c+10],23,3200236656),p=i(p,v,h,g,y[c+13],4,681279174),g=i(g,p,v,h,y[c+0],11,3936430074),h=i(h,g,p,v,y[c+3],16,3572445317),v=i(v,h,g,p,y[c+6],23,76029189),p=i(p,v,h,g,y[c+9],4,3654602809),g=i(g,p,v,h,y[c+12],11,3873151461),h=i(h,g,p,v,y[c+15],16,530742520),p=a(p,v=i(v,h,g,p,y[c+2],23,3299628645),h,g,y[c+0],6,4096336452),g=a(g,p,v,h,y[c+7],10,1126891415),h=a(h,g,p,v,y[c+14],15,2878612391),v=a(v,h,g,p,y[c+5],21,4237533241),p=a(p,v,h,g,y[c+12],6,1700485571),g=a(g,p,v,h,y[c+3],10,2399980690),h=a(h,g,p,v,y[c+10],15,4293915773),v=a(v,h,g,p,y[c+1],21,2240044497),p=a(p,v,h,g,y[c+8],6,1873313359),g=a(g,p,v,h,y[c+15],10,4264355552),h=a(h,g,p,v,y[c+6],15,2734768916),v=a(v,h,g,p,y[c+13],21,1309151649),p=a(p,v,h,g,y[c+4],6,4149444226),g=a(g,p,v,h,y[c+11],10,3174756917),h=a(h,g,p,v,y[c+2],15,718787259),v=a(v,h,g,p,y[c+9],21,3951481745),p=n(p,s),v=n(v,l),h=n(h,f),g=n(g,d);return(u(p)+u(v)+u(h)+u(g)).toLowerCase()}}),i);function d(e){e.time=parseInt(Date.parse(new Date)/1e3);var t=function(e){for(var t=Object.keys(e).sort(),n={},r=0;r<t.length;r++){var o=t[r];n[o]=e[o]}return n}(e);return e.sign||(e.sign=f.md5(function(e){var t="";for(var n in e){var r="";null!=e[n]?r=e[n]:e[n]="",t+=n+"="+r+"&"}return t.slice(0,t.length-1)}(t)+"WvgAUx8i0JeG5aaF")),e}function p(e){var t;if("object"===o(e))if(Array.isArray(e))for(var n in t=[],e)t.push(p(e[n]));else if(null===e)t=null;else if(e.constructor===RegExp)t=e;else for(var r in t={},e)t[r]=p(e[r]);else t=e;return t}var v={mac:"",imei:"",oaid:"",androidid:"",idfa:"",idfv:"",sdkver:"1.0"},h=0,g=function(){var e={duid:""},t=wx.getStorageSync("duid");if(t)e.duid=t,h=0;else{console.log(h);var n=function(){for(var e="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",t="",n=0;n<32;n++)t+=e.charAt(Math.floor(48*Math.random()));return t}();wx.setStorageSync("duid",n),e.duid=n,h=1}return e},y=function(){var e={client:"",brand:"",resolution:"",model:"",sysver:""};try{var t=wx.getSystemInfoSync();e.sysver=t.system,e.resolution=t.screenWidth+"*"+t.screenHeight,e.model=t.model,e.client=t.platform,e.brand=t.brand}catch(e){console.log("【获取设备系统信息失败】",e)}return e},m=function(){return r(r(r(r({},g()),y()),v),{},{install:h,ntype:""})};
2
2
  /**
3
3
  * @dn-sdk/minigame v1.5.5
4
4
  * (c) 2025
5
5
  * @license ISC
6
6
  */
7
- function m(e,t,n){return(t=N(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||A(e)||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 A(e,t){if(e){if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function S(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function T(e){var t=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(e){return!1}}();return function(){var n,r=E(e);if(t){var o=E(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){if(t&&("object"===O(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return R(e)}function R(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function O(e){return O="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},O(e)}function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x(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,N(r.key),r)}}function C(e,t,n){return t&&x(e.prototype,t),n&&x(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function N(e){var t=function(e){if("object"!==O(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==O(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===O(t)?t:String(t)}var P,L,M="LOCAL_ID",D="CLICK_ID",q="QUEUE_LOST_MAP",j="REMOTE_CONFIG",U="REMOTE_COMMON_CONFIG",F="OPENID",V={init:"init",reporting:"reporting",fail:"fail"},B={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"]},K="JS_RUN_ERROR",G="REQUEST_ERROR",W="REQUEST_CONFIG_ERROR",J="JS_QUEUE_LOG",H="PROXY_ERROR",Y="QUEUE_LOST_NUM",Q="SIGN_ERROR",z="UNKNOWN",$="TRUE",Z="FALSE",X="TICKET_INTERVAL_CHANGE",ee=(L=function(e){return"".concat("@dn-sdk/minigame","_").concat("production","_").concat(e)},{getSync:function(e){var t;try{t=wx.getStorageSync(L(e))}catch(e){return console.error("storage get error",e),t}return t},setSync:function(e,t){try{wx.setStorageSync(L(e),t)}catch(e){return console.error("storage set error",e),!1}return!0}}),te=function(){var e;return function(){if(!e){var t=function(){if(P)return P;try{return P=wx.getSystemInfoSync()}catch(e){return{}}}(),n=t.system,r=void 0===n?"":n,o=(null==r?void 0:r.split(" "))||[],i=function(e){if(!e)return z;var t=(null==e?void 0:e.toUpperCase())||"";return t.indexOf("ANDROID")>-1?"ANDROID":t.indexOf("IOS")>-1?"IOS":t.indexOf("MAC")>-1?"OSX":t.indexOf("WINDOWS")>-1?"WINDOWS":z}(o[0]),a=function(e){return!e||e.length<=0?"":2===e.length?e[1]:3===e.length&&"Windows"===e[0]?"".concat(e[1]," ").concat(e[2]):e[e.length-1]}(o);e={benchmark_level:t.benchmarkLevel,device_brand:t.brand,screen_height:Math.floor(t.screenHeight),screen_width:Math.floor(t.screenWidth),wx_lib_version:t.SDKVersion,wx_version:t.version,wx_platform:t.platform,device_model:t.model,os:i,os_version:a}}return e}}(),ne=function(){var e;return function(){try{if(e)return e;e||(e=ee.getSync(M)||""),e||(e=me(),ee.setSync(M,e))}catch(e){}return e}}(),re=function(){var e="unknown",t=!1;return function(){if(!t)try{wx.getNetworkType({success:function(t){e=t.networkType},fail:function(){e="unknown"}}),wx.onNetworkStatusChange(function(t){e=t.networkType}),t=!0}catch(e){}return e}}();re();var oe=function(){var e="";return function(){return e||(e=ee.getSync(F)||""),e}}(),ie=function(){var e;return function(){if(e)return e;try{var t=wx.getAccountInfoSync();return ve(t.miniProgram)?e=t.miniProgram:{}}catch(t){return{}}}}();function ae(e){var t=null==e?void 0:e.query;if(!ve(t))return"";var n="";return t.gdt_vid||[1045,1046,1084].indexOf(null==e?void 0:e.scene)>-1?n="TENCENT":t.clue_token||t.clickid&&t.item_id?n="BYTEDANCE":t.callback&&"kuaishou"===t.ksChannel?n="KUAISHOU":t.bd_vid||t.ai&&t.d&&t.q&&t.c?n="BAIDU":t.uctrackid?n="ALIBABA":(t.trackid||t.imp||[1065,1069,1194].indexOf(null==e?void 0:e.scene)>-1&&(t.callback||t.u))&&(n="OTHERS"),n}function ue(e,t){try{var n=te(),r=ie(),o={sdk_version:"1.5.5",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:ne(),env_version:null==r?void 0:r.envVersion,appid:null==r?void 0:r.appId},i=Object.assign(o,e);wx.request({url:"https://api.datanexus.qq.com/data-nexus-trace/log",data:i,method:"POST",timeout:B.requestTimeout,success:function(e){"function"==typeof t&&200===(null==e?void 0:e.statusCode)&&t()}})}catch(n){Ie.error(n)}}var ce=function(){function e(){I(this,e)}return C(e,null,[{key:"revise",value:function(e){e>0&&!this.isRevised&&(this.offsetTime=e-Date.now(),this.isRevised=!0)}},{key:"getRevisedcurrentTimeMillis",value:function(){return this.isRevised?Date.now()+this.offsetTime:-1}}]),e}();function se(e){return new Promise(function(t,n){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/config/get",data:e,timeout:B.requestTimeout,success:function(e){le(e,t,"config/get",n),de(e)},fail:function(e){fe(e,"config/get",n)}})})}function le(e,t,n,r){var o,i,a,u,c=null==e?void 0:e.statusCode,s=null==(o=null==e?void 0:e.data)?void 0:o.code;if(200!==c||0!==s){var l=s;200!==c&&(l="number"==typeof c?-1*c:-888),ue({log_type:W,message:"cgiName: ".concat(n,", statusCode: ").concat(c,", code: ").concat(s,", traceid: ").concat(null==(a=null==e?void 0:e.data)?void 0:a.trace_id),code:l}),null==r||r(null==(u=null==e?void 0:e.data)?void 0:u.data)}else t(null==(i=e.data)?void 0:i.data)}function fe(e,t,n){ue({log_type:W,message:"cgiName: ".concat(t," , message: ").concat(null==e?void 0:e.errMsg," "),code:"number"==typeof(null==e?void 0:e.errno)?-1*e.errno:-999}),null==n||n(e)}function de(e){var t,n=1*(null==(t=null==e?void 0:e.header)?void 0:t["Server-Time"]);n>17266752e5&&ce.revise(n)}ce.offsetTime=0,ce.isRevised=!1;var pe=Object.prototype.toString,ve=function(e){return"[object Object]"===pe.call(e)},he=function(e){return"[object Array]"===pe.call(e)},ge=function(e){return"[object Function]"===pe.call(e)},ye=(new Date).getTime();function me(){var e=(new Date).getTime(),t=Math.abs(1e3*(e-ye));return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(n){var r=16*Math.random();return e>0?(r=(e+r)%16|0,e=Math.floor(e/16)):(r=(t+r)%16|0,t=Math.floor(t/16)),("x"===n?r:3&r|8).toString(16).replace(/-/g,"")})}var _e=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Ae=function(e){if("string"!=typeof e)throw new TypeError("Invalid argument expected string");if(!_e.test(e))throw new Error("Invalid argument not valid semver ('".concat(e,"' received)"))},ke=function(e){return isNaN(Number(e))?e:Number(e)},Se=function(e){var t=e.replace(/^v/,"").replace(/\+.*$/,""),n=function(e){return-1===e.indexOf("-")?e.length:e.indexOf("-")}(t),r=t.substring(0,n).split(".");return r.push(t.substring(n+1)),r},be=function(e,t){[e,t].forEach(Ae);for(var n=Se(e),r=Se(t),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(ke),l=c.split(".").map(ke),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};function Te(e){return we()[e]}function we(){return B}function Re(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ee=function(e){try{return e&&"string"==typeof e?-1===(e=e.replace(/\s/g,"")).indexOf(".")?e:e.split(".").slice(0,2).join("."):""}catch(t){return e}},Oe=function(){function e(){I(this,e)}return C(e,null,[{key:"error",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=console).error.apply(t,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(e)].concat(r))}},{key:"info",value:function(t){for(var n,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];e.debug&&(n=console).info.apply(n,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(t)].concat(o))}},{key:"log",value:function(t){for(var n,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];e.debug&&(n=console).log.apply(n,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(t)].concat(o))}},{key:"warn",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=console).warn.apply(t,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(e)].concat(r))}},{key:"devLog",value:function(t){for(var n,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];e.isDev&&(n=console).log.apply(n,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(t)].concat(o))}}]),e}(),Ie=Oe;Ie.debug=!1,Ie.isDev=!1;var xe=function(){var e;return function(){if(!e)try{var t=wx.getLaunchOptionsSync(),n=t.query.gdt_vid||"";n?ee.setSync(D,n):n=ee.getSync(D)||"";var r=JSON.stringify(t);r.length>1e4&&(r=JSON.stringify({cut:1,scene:t.scene})),e={source_scene:t.scene,pkg_channel_id:t.query.wxgamepro||"",ad_trace_id:n,launch_options:r,channel:ae(t)}}catch(t){e={},Ie.log("获取场景值和渠道号失败",t)}return e}}();function Ce(e,t,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{Ie.error.apply(Ie,["calling ".concat(e.constructor.name,".").concat(t," error with arguments")].concat(o)),Ie.error(n);var a={log_type:K,message:"[safeExcutable] ".concat(e.constructor.name,".").concat(t,": ").concat(null==n?void 0:n.message),err_stack:null==n?void 0:n.stack};ge(this.reportLog)?this.reportLog(a):ue(a)}catch(a){}}},n}var Ne=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,Le=function(e,t,n,r){for(var o,i=r>1?void 0:r?Pe(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Ne(t,n,i),i},Me=function(){function e(t){var n=t.userActionSetId,r=t.maxLength,o=void 0===r?500:r;I(this,e),this.lostActionMaps={},this.stack=[],this.localStorageKey="",this.localStorageKey="".concat("QUEUE_ACTIONS","_").concat(null==n?void 0:n.toString()),this.maxLength=o,this.userActionSetId=n,this.setTimeStamp(),this.init()}return C(e,[{key:"getItems",value:function(){return this.stack}},{key:"getStorage",value:function(){var e,t=(null==(e=ee)?void 0:e.getSync(this.localStorageKey))||"[]";return JSON.parse(t)}},{key:"reportLostNum",value:function(){var e=this,t=Object.assign({},this.lostActionMaps),n=[];for(var r in t){var o=null==r?void 0:r.split("_");n.push({queue_lost_session_id:o[0],queue_lost_timestamp:o[1],queue_lost_num:t[r]})}n.length&&(this.setTimeStamp(),n.forEach(function(t){var n=Object.assign({},{user_action_set_id:e.userActionSetId,log_type:Y},t),r=null==t?void 0:t.queue_lost_session_id,o=null==t?void 0:t.queue_lost_timestamp,i="".concat(r,"_").concat(o);ue(n,function(){Re(e.lostActionMaps,i)&&(delete e.lostActionMaps[i],ee.setSync(q,JSON.stringify(e.lostActionMaps)))})}))}},{key:"getLostMaps",value:function(){return this.lostActionMaps}},{key:"init",value:function(){var e=this,t=this.getStorage(),n=null==t?void 0:t.map(function(e){var t,n;return e.inner_status===(null==(t=V)?void 0:t.reporting)?Object.assign({},e,{inner_status:null==(n=V)?void 0:n.fail,is_retry:!0,retry_count:e.retry_count+1}):e});this.stack=n,this.lostActionMaps=JSON.parse(ee.getSync(q)||"{}"),setTimeout(function(){e.reportLostNum()},1e3)}},{key:"addItem",value:function(e){var t;null==(t=null==this?void 0:this.stack)||t.push(e)}},{key:"removeItems",value:function(e){var t,n=null==(t=null==this?void 0:this.stack)?void 0:t.filter(function(t){return!(null!=e&&e.includes(null==t?void 0:t.action_id))});this.stack=n}},{key:"updateForReportFail",value:function(e){var t;this.stack=null==(t=this.stack)?void 0:t.map(function(t){var n;return null!=e&&e.includes(null==t?void 0:t.action_id)?Object.assign({},t,{inner_status:null==(n=V)?void 0:n.fail,retry_count:t.retry_count+1,is_retry:!0}):t})}},{key:"updateForReporting",value:function(e){var t;this.stack=null==(t=this.stack)?void 0:t.map(function(t){var n;return null!=e&&e.includes(null==t?void 0:t.action_id)?Object.assign({},t,{inner_status:null==(n=V)?void 0:n.reporting}):t})}},{key:"updateAllStack",value:function(e){this.stack=e}},{key:"updateToStorage",value:function(){ee.setSync(this.localStorageKey,JSON.stringify(this.stack))}},{key:"updateLostAction",value:function(e){if(e){var t="".concat(e,"_").concat(this.timeStamp),n=this.lostActionMaps[t]||0;this.lostActionMaps[t]=n+1,ee.setSync(q,JSON.stringify(this.lostActionMaps))}}},{key:"setTimeStamp",value:function(){this.timeStamp=Date.now().toString()}}]),e}();Le([Ce],Me.prototype,"getItems",1),Le([Ce],Me.prototype,"getStorage",1),Le([Ce],Me.prototype,"reportLostNum",1),Le([Ce],Me.prototype,"getLostMaps",1),Le([Ce],Me.prototype,"init",1),Le([Ce],Me.prototype,"addItem",1),Le([Ce],Me.prototype,"removeItems",1),Le([Ce],Me.prototype,"updateForReportFail",1),Le([Ce],Me.prototype,"updateForReporting",1),Le([Ce],Me.prototype,"updateAllStack",1),Le([Ce],Me.prototype,"updateToStorage",1),Le([Ce],Me.prototype,"updateLostAction",1);var De=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,je=function(e,t,n,r){for(var o,i=r>1?void 0:r?qe(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&De(t,n,i),i},Ue=function(){S(t,Me);var e=T(t);function t(n){var r,o=n.userActionSetId,i=n.maxLength,a=void 0===i?500:i,u=n.ogEvents,c=void 0===u?[]:u;return I(this,t),(r=e.call(this,{userActionSetId:o,maxLength:a})).ogEvents=c,r}return C(t,[{key:"getReportableActions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,t=this.getItems(),n=[];return null==t||t.forEach(function(t){var r;(null==n?void 0:n.length)<e&&(null==t?void 0:t.inner_status)!==(null==(r=V)?void 0:r.reporting)&&(null==n||n.push(t))}),n}},{key:"addAction",value:function(e){var t={code:0,message:"成功",actionId:e.action_id},n=this.getItems();if((null==n?void 0:n.length)>=this.maxLength){var r="队列长度超过最大限制".concat(this.maxLength,"条,SDK将按照行为优先级排序,丢弃优先级最低的行为事件");Ie.warn(r),ue({user_action_set_id:this.userActionSetId,log_type:J,message:"队列长度超过限制"});var o=this.sortQueue(e,n);Ie.debug&&Ie.info("超过".concat(this.maxLength,"条按优先级排序的队列:"),o.concat([]));var i=o.pop();this.updateAllStack(o),this.updateLostAction((null==i?void 0:i.session_id)||""),(null==i?void 0:i.action_id)===e.action_id&&(t={code:103,message:"缓存队列已满,主动丢弃行为"})}else this.addItem(e);return this.updateToStorage(),t}},{key:"removeActions",value:function(e){this.removeItems(e),this.updateToStorage()}},{key:"updateActionsForReportFail",value:function(e){this.updateForReportFail(e),this.updateToStorage()}},{key:"updateActionsForReporting",value:function(e){this.updateForReporting(e),this.updateToStorage()}},{key:"getReportableActionsLength",value:function(){var e=this.getItems().filter(function(e){var t;return(null==e?void 0:e.inner_status)!==(null==(t=V)?void 0:t.reporting)});return null==e?void 0:e.length}},{key:"sortQueue",value:function(e,t){var n=this,r={},o=null==e?void 0:e.action_time,i=t.concat([e]),a=function(e){return r[e.action_id]||(r[e.action_id]=n.caculateWeight(o,e)),r[e.action_id]};return i.sort(function(e,t){return a(t)-a(e)})}},{key:"caculateWeight",value:function(e,t){var n,r=0,o=this.formatWeight(e,null==t?void 0:t.action_time),i=o.ogWeight,a=o.sdkWeight,u=o.userWeight;null!=(n=this.ogEvents)&&n.includes(null==t?void 0:t.action_type)&&(r+=i),null!=t&&t.is_sdk_auto_track?r+=a:r+=u;var c=e-(null==t?void 0:t.action_time)+1;return c>0?r+1/c:r}},{key:"formatWeight",value:function(e,t){var n=1e3,r=10,o=100;return e-t>2592e6&&(n/=100,r/=100,o/=100),{ogWeight:n,sdkWeight:r,userWeight:o}}}]),t}();je([Ce],Ue.prototype,"getReportableActions",1),je([Ce],Ue.prototype,"addAction",1),je([Ce],Ue.prototype,"removeActions",1),je([Ce],Ue.prototype,"updateActionsForReportFail",1),je([Ce],Ue.prototype,"updateActionsForReporting",1),je([Ce],Ue.prototype,"getReportableActionsLength",1),je([Ce],Ue.prototype,"sortQueue",1),je([Ce],Ue.prototype,"caculateWeight",1),je([Ce],Ue.prototype,"formatWeight",1);var Fe=function(){function e(){I(this,e),this.events={}}return C(e,[{key:"subscribe",value:function(t,n){e.checkCallback(n),he(this.events[t])?this.events[t].push(n):this.events[t]=[n]}},{key:"once",value:function(t,n){e.checkCallback(n),this.subscribe(this.onceEventName(t),n)}},{key:"unsubscribe",value:function(t,n){e.checkCallback(n),he(this.events[t])&&(this.events[t]=this.events[t].filter(function(e){return e!==n})),he(this.events[this.onceEventName(t)])&&(this.events[this.onceEventName(t)]=this.events[this.onceEventName(t)].filter(function(e){return e!==n}))}},{key:"publish",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=Date.now();he(this.events[e])&&this.events[e].forEach(function(e){return e.apply(void 0,[o].concat(n))}),he(this.events[this.onceEventName(e)])&&(this.events[this.onceEventName(e)].forEach(function(e){return e.apply(void 0,[o].concat(n))}),this.events[this.onceEventName(e)]=[])}},{key:"onceEventName",value:function(e){return"once_event_prefix_".concat(e)}}],[{key:"checkCallback",value:function(t){ge(t)||Ie.error(e.ERROR_CALLBACK_IS_NOT_A_FUNCTION)}}]),e}(),Ve=Fe;Ve.ERROR_CALLBACK_IS_NOT_A_FUNCTION="callback 不是函数";var Be=new Ve,Ke=["REGISTER","VIEW_CONTENT","ADD_TO_CART","PURCHASE","COMPLETE_ORDER","ADD_TO_WISHLIST","START_APP","CREATE_ROLE","AUTHORIZE","TUTORIAL_FINISH","START_PAY","FINISH_PAY"],Ge="START_APP",We="TICKET",Je="ENTER_FOREGROUND",He="ENTER_BACKGROUND",Ye="LOGIN",Qe="SHARE",ze="TAP_GAME_CLUB",$e="CREATE_GAME_CLUB",Ze="JOIN_GAME_ROOM",Xe="FINISH_PAY",et="START_PAY",tt="ADD_TO_WISHLIST",nt=["REGISTER","START_APP","RE_ACTIVE"],rt=["TICKET","ENTER_FOREGROUND","ENTER_BACKGROUND"],ot=function(){function e(){I(this,e),this.channelClaimActionList=nt,this.noClaimActionList=rt,this.realTimeActionList=B.realTimeActionList,this.ticketInterval=60,this.requestTimeout=B.requestTimeout,this.loadConfig()}return C(e,[{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 e=this;try{if("undefined"==typeof wx)return;var t=ee.getSync(U);t&&this.updateConfig(t),se({conf_name:"mini_game_sdk_common",conf_key:"config"}).then(function(t){t&&ve(t)&&(e.updateConfig(t),ee.setSync(U,t))})}catch(t){console.error(t)}}},{key:"updateConfig",value:function(e){e.channelClaimActionList&&he(e.channelClaimActionList)&&(this.channelClaimActionList=e.channelClaimActionList),e.noClaimActionList&&he(e.noClaimActionList)&&(this.noClaimActionList=e.noClaimActionList),e.realTimeActionList&&he(e.realTimeActionList)&&(this.realTimeActionList=e.realTimeActionList),e.ticketInterval&&"number"==typeof e.ticketInterval&&e.ticketInterval>1&&e.ticketInterval!==this.ticketInterval&&(this.ticketInterval=e.ticketInterval,Be.publish(X)),e.requestTimeout&&"number"==typeof e.requestTimeout&&e.requestTimeout>5e3&&(this.requestTimeout=e.requestTimeout)}}]),e}(),it=new ot,at=Ge,ut=We,ct=Je,st=He,lt=function(){var e=!1,t=!1,n=!0,r=!0,o=!0,i=!1;return function(){if(!i){i=!0;var a=ee.getSync(j);if((null==a?void 0:a.bg)===$?e=!0:(null==a?void 0:a.bg)===Z&&(e=!1),(null==a?void 0:a.fg)===$?t=!0:(null==a?void 0:a.fg)===Z&&(t=!1),(null==a?void 0:a.st)===$?n=!0:(null==a?void 0:a.st)===Z&&(n=!1),(null==a?void 0:a.ti)===$?r=!0:(null==a?void 0:a.ti)===Z&&(r=!1),Ie.devLog("当前缓存开关 bgOn,fgOn,stOn,tiOn:",e,t,n,r),n&&Be.publish(at),r){var u=function(){o&&Be.publish(ut)},c=setInterval(u,1e3*it.getTicketInterval());Be.subscribe(X,function(){c&&clearInterval(c),c=setInterval(u,1e3*it.getTicketInterval())})}wx.onShow(function(e){if(o=!0,t){var n="";try{(n=JSON.stringify(e)).length>1e4&&(n=JSON.stringify({cut:1,scene:e.scene}))}catch(e){}Be.publish(ct,{enter_options:n})}}),wx.onHide(function(){o=!1,e&&Be.publish(st)})}}}(),ft="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function dt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pt,vt=dt(function(){var e,t=null;function n(e){return!!e&&("object"==O(e)||"function"==typeof e)}function r(e){if(null!==e&&!n(e))throw new TypeError("Object prototype may only be an Object or null: "+e)}var o=Object,i=!(!o.create&&{__proto__:null}instanceof o),a=o.create||(i?function(e){return r(e),{__proto__:e}}:function(e){if(r(e),null===e)throw new SyntaxError("Native Object.create is required to create objects with null prototype");var t=function(){};return t.prototype=e,new t}),u=function(){return null},c=o.getPrototypeOf||([].__proto__===Array.prototype?function(e){var t=e.__proto__;return n(t)?t:null}:u);return e=function(s,l){if(void 0===(this&&this instanceof e?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(){};t=function(){s=null,f=function(e){throw new TypeError("Cannot perform '".concat(e,"' on a proxy that has been revoked"))}},setTimeout(function(){t=null},0);var d=l;for(var p in l={get:null,set:null,apply:null,construct:null},d){if(!(p in l))throw new TypeError("Proxy polyfill does not support trap '".concat(p,"'"));l[p]=d[p]}"function"==typeof d&&(l.apply=d.apply.bind(d));var v,h=c(s),g=!1,y=!1;"function"==typeof s?(v=function(){var e=this&&this.constructor===v,t=Array.prototype.slice.call(arguments);return f(e?"construct":"apply"),e&&l.construct?l.construct.call(this,s,t):!e&&l.apply?l.apply(s,this,t):e?(t.unshift(s),new(s.bind.apply(s,t))):s.apply(this,t)},g=!0):s instanceof Array?(v=[],y=!0):v=i||null!==h?a(h):{};var m=l.get?function(e){return f("get"),l.get(this,e,v)}:function(e){return f("get"),this[e]},_=l.set?function(e,t){f("set"),l.set(this,e,t,v)}:function(e,t){f("set"),this[e]=t},A=o.getOwnPropertyNames(s),k={};A.forEach(function(e){if(!g&&!y||!(e in v)){var t={enumerable:!!o.getOwnPropertyDescriptor(s,e).enumerable,get:m.bind(s,e),set:_.bind(s,e)};o.defineProperty(v,e,t),k[e]=!0}});var S=!0;if(g||y){var b=o.setPrototypeOf||([].__proto__===Array.prototype?function(e,t){return r(t),e.__proto__=t,e}:u);h&&b(v,h)||(S=!1)}if(l.get||!S)for(var T in s)k[T]||o.defineProperty(v,T,{get:m.bind(s,T)});return o.seal(s),o.seal(v),v},e.revocable=function(n,r){return{proxy:new e(n,r),revoke:t}},e}),ht={};try{pt||(pt=vt())}catch(P){At(P)}function gt(e,t,n,r){try{if(!pt||null==e||!e[t])return;e[t]=new pt(e[t],{apply:function(e,t,o){var i,a;r&&_t(function(){return r.apply(void 0,_(o))});var u=!!(null!=(i=o[0])&&i.success||null!=(a=o[0])&&a.fail);u&&["success","fail"].forEach(function(e){if(o[0][e])try{o[0][e]=new pt(o[0][e],{apply:function(t,r,i){return _t(function(){return n.apply(void 0,[e,o[0]].concat(_(i)))}),t.apply(r,i)}})}catch(e){At(e)}});var c=e.apply(t,o);return!u&&c&&"[object Promise]"===Object.prototype.toString.call(c)?c.then(function(e){return _t(function(){return n("success",o[0],e)}),e}).catch(function(e){throw _t(function(){return n("fail",o[0],e)}),e}):c}})}catch(e){At(e)}}function yt(e,t,n){try{if(!pt||null==e||!e[t])return;e[t]=new pt(e[t],{apply:function(e,t,r){var o="function"==typeof r[0];if(o)try{r[0]=new pt(r[0],{apply:function(e,t,r){var o=e.call.apply(e,[t].concat(_(r)));return _t(function(){return n(o)}),o}})}catch(e){At(e)}var i=e.call.apply(e,[t].concat(_(r)));return o||_t(function(){return n(i)}),i}})}catch(e){At(e)}}function mt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4?arguments[4]:void 0;try{if(!pt||null==e||!e[t])return;e[t]=new pt(e[t],{apply:function(e,i,a){var u=e.call.apply(e,[i].concat(_(a)));return(!n||!ht[t])&&(_t(function(){return null==o?void 0:o(u)}),r.forEach(function(e){var t=e.eventName,n=e.isAsync,r=e.proxyEvent;n?gt(u,t,r):yt(u,t,r)})),n&&(ht[t]=!0),u}})}catch(e){At(e)}}function _t(e){try{e()}catch(e){At(e)}}function At(e){ue({log_type:H,message:null==e?void 0:e.message,err_stack:null==e?void 0:e.stack})}var kt=Ye,St=tt,bt=Qe,Tt=ze,wt=$e,Rt=Ze,Et=et,Ot=Xe,It=function(){var e=!1;return function(){e||(e=!0,gt(wx,"login",function(e){"success"===e&&Be.publish(kt)}),yt(wx,"onAddToFavorites",function(){Be.publish(St)}),yt(wx,"onShareTimeline",function(){Be.publish(bt,{target:"TIME_LINE",trigger:"MENU"})}),yt(wx,"onShareAppMessage",function(){Be.publish(bt,{target:"APP_MESSAGE",trigger:"MENU"})}),yt(wx,"shareAppMessage",function(){Be.publish(bt,{target:"APP_MESSAGE",trigger:"BUTTON"})}),mt(wx,"createGameClubButton",!1,[{isAsync:!1,eventName:"onTap",proxyEvent:function(){Be.publish(Tt)}}],function(){Be.publish(wt)}),mt(wx,"getGameServerManager",!0,[{isAsync:!0,eventName:"createRoom",proxyEvent:function(e){"success"===e&&Be.publish("CREATE_GAME_ROOM")}},{isAsync:!0,eventName:"joinRoom",proxyEvent:function(e){"success"===e&&Be.publish(Rt)}}]),gt(wx,"requestMidasPayment",function(e,t){Be.publish(Ot,{status:"success"===e?"SUCCESS":"FAIL",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"})},function(e){Be.publish(Et,{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"})}),gt(wx,"requestMidasPaymentGameItem",function(e,t){var n=(t||{}).signData;Be.publish(Ot,{status:"success"===e?"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(e){var t=(e||{}).signData;Be.publish(Et,{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)||"",p:(null==t?void 0:t.goodsPrice)||0,productId:(null==t?void 0:t.productId)||"",payType:"MidasGameItem"})}))}}(),xt=function(){function e(){I(this,e)}return C(e,null,[{key:"isEmpty",value:function(e){return null==e||"string"==typeof e&&""===e.trim()}},{key:"format",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.replace(/\${(\d+)}/g,function(e,t){return n[t]})}},{key:"customStringify",value:function(e){var t=[];try{return JSON.stringify(e,function(e,n){if(void 0===n)return"undefined";if("object"==O(n)&&null!==n){if(-1!==t.indexOf(n))return"[Circular]";t.push(n)}return"bigint"==typeof n?n.toString():n})}catch(e){return"[Param Error]"}}}]),e}(),Ct=/^([a-zA-Z][a-zA-Z\d_]{0,63})$/i,Nt=/^ams_reserved_(.*)/i,Pt=function(){function e(){I(this,e)}return C(e,null,[{key:"validateActionType",value:function(t){return xt.isEmpty(t)?(Ie.error(e.ERROR_ACTION_TYPE_NULL),!1):!!Ct.test(t)||(Ie.error(e.ERROR_ACTION_TYPE_INVALID),!1)}},{key:"validateActionParam",value:function(t){if(!t)return!0;if(!ve(t))return Ie.error(e.ERROR_ACTION_PARAM_IS_NOT_OBJECT),!1;for(var n in t){if(xt.isEmpty(n))return Ie.error(e.ERROR_ACTION_PARAM_KEY_NULL),!1;if(!Ct.test(n))return Ie.error(e.ERROR_ACTION_PARAM_KEY_INVALID),!1;Nt.test(n)&&Ie.warn(e.WARN_ACTION_PARAM_KEY_RESERVED);var r=t[n];if(!e.isValidValue(r))return Ie.error(xt.format(e.ERROR_ACTION_PARAM_VALUE_INVALID,n,r)),!1;if(he(r)){if(!e.isValidArrayValue(r)){for(var o=0;o<r.length;o++)Ie.error(xt.format(e.ERROR_ACTION_PARAM_VALUE_ARRAY_INVALID,n,xt.customStringify(r),o,r[o]));return!1}if(!e.checkArrayElementTypes(r))return Ie.error(e.ERROR_ACTION_PARAM_VALUE_ARRAY_TYPE_UNUNIQUE),!1}}return!0}},{key:"isValidValue",value:function(e){return null==e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e||he(e)}},{key:"isValidArrayValue",value:function(e){for(var t=0;t<e.length;t++){var n=e[t];if("string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n)return!1}return!0}},{key:"checkArrayElementTypes",value:function(e){if(!e||e.length<=1)return!0;for(var t=O(e[0]),n=1;n<e.length;n++)if(O(e[n])!==t)return!1;return!0}}]),e}(),Lt=Pt;Lt.ERROR_ACTION_TYPE_NULL="在track方法中,action_type参数不能为空!",Lt.ERROR_ACTION_TYPE_INVALID="在track方法中,action_type参数只能包含字母、数字和下划线,且只能以字母开头,长度不能超过64个字符!",Lt.ERROR_ACTION_PARAM_KEY_NULL="在track方法中,action_param参数的key不能为空!",Lt.ERROR_ACTION_PARAM_KEY_INVALID="在track方法中,action_param参数的key只能包含字母、数字和下划线,且不能以数字开头,长度不能超过64个字符!",Lt.WARN_ACTION_PARAM_KEY_RESERVED="SDK内部预留参数的key均以'ams_reserved_'开头,该参数的值会被SDK内部覆盖,请不要使用!",Lt.ERROR_ACTION_PARAM_VALUE_INVALID="在track方法中,action_param参数的value必须是String/Number/Boolean/Array中的一种![key=${0}, value=${1}]",Lt.ERROR_ACTION_PARAM_VALUE_ARRAY_INVALID="在track方法中,如果action_param参数中的某个元素的value是Array,那么这个Array中的每个元素必须是String/Number/Boolean中的一种![key=${0}, value=${1}, 数组的第${2}个元素为${3}]",Lt.ERROR_ACTION_PARAM_VALUE_ARRAY_TYPE_UNUNIQUE="在track方法中,如果action_param参数中的某个元素的value是Array,那么这个Array中所有元素的类型必须是同一种!",Lt.ERROR_ACTION_PARAM_IS_NOT_OBJECT="action_param 参数不是Object";var Mt={exports:{}};!function(e){!function(t){function n(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function r(e,t,r,o,i,a){return n(function(e,t){return e<<t|e>>>32-t}(n(n(t,e),n(o,a)),i),r)}function o(e,t,n,o,i,a,u){return r(t&n|~t&o,e,t,i,a,u)}function i(e,t,n,o,i,a,u){return r(t&o|n&~o,e,t,i,a,u)}function a(e,t,n,o,i,a,u){return r(t^n^o,e,t,i,a,u)}function u(e,t,n,o,i,a,u){return r(n^(t|~o),e,t,i,a,u)}function c(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var r,c,s,l,f,d=1732584193,p=-271733879,v=-1732584194,h=271733878;for(r=0;r<e.length;r+=16)c=d,s=p,l=v,f=h,d=o(d,p,v,h,e[r],7,-680876936),h=o(h,d,p,v,e[r+1],12,-389564586),v=o(v,h,d,p,e[r+2],17,606105819),p=o(p,v,h,d,e[r+3],22,-1044525330),d=o(d,p,v,h,e[r+4],7,-176418897),h=o(h,d,p,v,e[r+5],12,1200080426),v=o(v,h,d,p,e[r+6],17,-1473231341),p=o(p,v,h,d,e[r+7],22,-45705983),d=o(d,p,v,h,e[r+8],7,1770035416),h=o(h,d,p,v,e[r+9],12,-1958414417),v=o(v,h,d,p,e[r+10],17,-42063),p=o(p,v,h,d,e[r+11],22,-1990404162),d=o(d,p,v,h,e[r+12],7,1804603682),h=o(h,d,p,v,e[r+13],12,-40341101),v=o(v,h,d,p,e[r+14],17,-1502002290),d=i(d,p=o(p,v,h,d,e[r+15],22,1236535329),v,h,e[r+1],5,-165796510),h=i(h,d,p,v,e[r+6],9,-1069501632),v=i(v,h,d,p,e[r+11],14,643717713),p=i(p,v,h,d,e[r],20,-373897302),d=i(d,p,v,h,e[r+5],5,-701558691),h=i(h,d,p,v,e[r+10],9,38016083),v=i(v,h,d,p,e[r+15],14,-660478335),p=i(p,v,h,d,e[r+4],20,-405537848),d=i(d,p,v,h,e[r+9],5,568446438),h=i(h,d,p,v,e[r+14],9,-1019803690),v=i(v,h,d,p,e[r+3],14,-187363961),p=i(p,v,h,d,e[r+8],20,1163531501),d=i(d,p,v,h,e[r+13],5,-1444681467),h=i(h,d,p,v,e[r+2],9,-51403784),v=i(v,h,d,p,e[r+7],14,1735328473),d=a(d,p=i(p,v,h,d,e[r+12],20,-1926607734),v,h,e[r+5],4,-378558),h=a(h,d,p,v,e[r+8],11,-2022574463),v=a(v,h,d,p,e[r+11],16,1839030562),p=a(p,v,h,d,e[r+14],23,-35309556),d=a(d,p,v,h,e[r+1],4,-1530992060),h=a(h,d,p,v,e[r+4],11,1272893353),v=a(v,h,d,p,e[r+7],16,-155497632),p=a(p,v,h,d,e[r+10],23,-1094730640),d=a(d,p,v,h,e[r+13],4,681279174),h=a(h,d,p,v,e[r],11,-358537222),v=a(v,h,d,p,e[r+3],16,-722521979),p=a(p,v,h,d,e[r+6],23,76029189),d=a(d,p,v,h,e[r+9],4,-640364487),h=a(h,d,p,v,e[r+12],11,-421815835),v=a(v,h,d,p,e[r+15],16,530742520),d=u(d,p=a(p,v,h,d,e[r+2],23,-995338651),v,h,e[r],6,-198630844),h=u(h,d,p,v,e[r+7],10,1126891415),v=u(v,h,d,p,e[r+14],15,-1416354905),p=u(p,v,h,d,e[r+5],21,-57434055),d=u(d,p,v,h,e[r+12],6,1700485571),h=u(h,d,p,v,e[r+3],10,-1894986606),v=u(v,h,d,p,e[r+10],15,-1051523),p=u(p,v,h,d,e[r+1],21,-2054922799),d=u(d,p,v,h,e[r+8],6,1873313359),h=u(h,d,p,v,e[r+15],10,-30611744),v=u(v,h,d,p,e[r+6],15,-1560198380),p=u(p,v,h,d,e[r+13],21,1309151649),d=u(d,p,v,h,e[r+4],6,-145523070),h=u(h,d,p,v,e[r+11],10,-1120210379),v=u(v,h,d,p,e[r+2],15,718787259),p=u(p,v,h,d,e[r+9],21,-343485551),d=n(d,c),p=n(p,s),v=n(v,l),h=n(h,f);return[d,p,v,h]}function s(e){var t,n="",r=32*e.length;for(t=0;t<r;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function l(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function f(e){var t,n,r="0123456789abcdef",o="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),o+=r.charAt(t>>>4&15)+r.charAt(15&t);return o}function d(e){return unescape(encodeURIComponent(e))}function p(e){return function(e){return s(c(l(e),8*e.length))}(d(e))}function v(e,t){return function(e,t){var n,r,o=l(e),i=[],a=[];for(i[15]=a[15]=void 0,o.length>16&&(o=c(o,8*e.length)),n=0;n<16;n+=1)i[n]=909522486^o[n],a[n]=1549556828^o[n];return r=c(i.concat(l(t)),512+8*t.length),s(c(a.concat(r),640))}(d(e),d(t))}function h(e,t,n){return t?n?v(t,e):function(e,t){return f(v(e,t))}(t,e):n?p(e):function(e){return f(p(e))}(e)}e.exports?e.exports=h:t.md5=h}(ft)}(Mt);var Dt=dt(Mt.exports),qt="function"==typeof btoa,jt="function"==typeof Buffer;"function"==typeof TextDecoder&&new TextDecoder;var Ut,Ft="function"==typeof TextEncoder?new TextEncoder:void 0,Vt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");Ut={},Vt.forEach(function(e,t){return Ut[e]=t});var Bt=String.fromCharCode.bind(String);"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array);var Kt=qt?function(e){return btoa(e)}:jt?function(e){return Buffer.from(e,"binary").toString("base64")}:function(e){for(var t,n,r,o,i="",a=e.length%3,u=0;u<e.length;){if((n=e.charCodeAt(u++))>255||(r=e.charCodeAt(u++))>255||(o=e.charCodeAt(u++))>255)throw new TypeError("invalid character found");i+=Vt[(t=n<<16|r<<8|o)>>18&63]+Vt[t>>12&63]+Vt[t>>6&63]+Vt[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},Gt=jt?function(e){return Buffer.from(e).toString("base64")}:function(e){for(var t=[],n=0,r=e.length;n<r;n+=4096)t.push(Bt.apply(null,e.subarray(n,n+4096)));return Kt(t.join(""))},Wt=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?Bt(192|t>>>6)+Bt(128|63&t):Bt(224|t>>>12&15)+Bt(128|t>>>6&63)+Bt(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return Bt(240|t>>>18&7)+Bt(128|t>>>12&63)+Bt(128|t>>>6&63)+Bt(128|63&t)},Jt=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Ht=jt?function(e){return Buffer.from(e,"utf8").toString("base64")}:Ft?function(e){return Gt(Ft.encode(e))}:function(e){return Kt(function(e){return e.replace(Jt,Wt)}(e))},Yt=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,zt=function(e,t,n,r){for(var o,i=r>1?void 0:r?Qt(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Yt(t,n,i),i},$t=function(){function e(t){var n=this;I(this,e),this.cgiBatchSize=B.cgiBatchSize,this.reportThreshold=B.reportThreshold,this.reportDelay=B.reportDelay,this.triggerExecuteSend=function(e){var t,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(t),t=setTimeout(function(){var t=e.apply(void 0,i);r.forEach(function(e){return e(t)}),r=[]},n),new Promise(function(e){return r.push(e)})}}(function(){n.executeSend()},1e3*this.reportDelay),this.inspectDelay=B.inspectDelay,this.inspectTimer=void 0,this.isNeedContinueSend=!1,this.getBaseInfo=t.getBaseInfo,this.reportLog=t.reportLog,this.queueManager=t.queueManager,this.configManager=t.configManager,this.onReportComplete=t.onReportComplete,this.onReportFail=t.onReportFail,this.flushSend(),this.startInspectTimer()}return C(e,[{key:"batchSend",value:function(){var e,t=this.queueManager.getReportableActions(this.reportThreshold);if(t.length>=this.reportThreshold)this.executeSend();else{var n=(null==(e=this.configManager)?void 0:e.getRealTimeActionList())||B.realTimeActionList;t.some(function(e){return n.indexOf(e.action_type)>-1&&!e.is_retry})?this.executeSend():this.triggerExecuteSend()}this.startInspectTimer()}},{key:"flushSend",value:function(){this.executeSend()}},{key:"executeSend",value:function(){var t=this;if(e.currentRequestCount>=e.requestConcurrency)this.isNeedContinueSend=!0;else{this.isNeedContinueSend=!1;var n=(e.requestConcurrency-e.currentRequestCount)*this.cgiBatchSize,r=this.queueManager.getReportableActions(n),o=this.getBaseInfo();if(!o.openid&&!o.unionid&&(Ie.warn("请尽快调用 setOpenId 或 setUnionId 方法设置用户ID!"),r=r.filter(function(e){return null==e?void 0:e.ad_trace_id})),!(r.length<=0)){n<this.queueManager.getReportableActionsLength()&&(this.isNeedContinueSend=!0),e.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(e){var n=e.some(function(e){return e>=0});t.isNeedContinueSend&&n&&t.executeSend()}).catch(function(e){Ie.error(e),t.reportLog({message:"executeSend catch: ".concat(e.message),log_type:K,err_stack:e.stack})})}}}},{key:"generateActionReportParams",value:function(e){var t=[],n=[],r=this.getBaseInfo();return e.forEach(function(e){n.push(e.action_id);var r=Object.assign({},e);delete r.inner_status,t.push(r)}),{data:{info:r,actions:t},actionIdList:n}}},{key:"dealSuccessData",value:function(e,t,n){[51001,51003].indexOf(null==e?void 0:e.code)>-1?this.queueManager.updateActionsForReportFail(t):this.queueManager.removeActions(t),0!==(null==e?void 0:e.code)&&(this.reportLog({log_type:G,code:null==e?void 0:e.code,message:"trace_id: ".concat(null==e?void 0:e.trace_id,",msg: ").concat(null==e?void 0:e.message)}),Ie.error("上报失败:",e)),this.doTrackCallbackFn(this.onReportComplete,e,n),-1===[0,51001,51003].indexOf(null==e?void 0:e.code)&&this.doTrackCallbackFn(this.onReportFail,e,n)}},{key:"dealFailData",value:function(e,t,n){this.queueManager.updateActionsForReportFail(t),this.reportLog({log_type:G,code:e.code,message:e.message}),Ie.error("上报失败:",e),this.doTrackCallbackFn(this.onReportComplete,e,n)}},{key:"report",value:function(t){var n=this,r=t.data,o=t.actionIdList;return this.queueManager.updateActionsForReporting(o),Ie.debug&&(Ie.info("上报行为类型: ","【".concat(r.actions.map(function(e){return e.action_type}).join("、"),"】")),Ie.info("上报请求参数: ",r)),new Promise(function(t){var i,a,u,c,s,l,f,d,p=Date.now();try{var v=function(e){var t="",n=null==e?void 0:e.appid,r=null==e?void 0:e.secret_key,o=null==e?void 0:e.sdk_version,i=null==e?void 0:e.timestamp;if(!(n&&r&&o&&i&&32===r.length))return t;for(var a=Dt(o+n+i),u=0;u<32;u++)t+=u%2==0?r[u]:a[u];return t}({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}),h=function(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?function(e){return e.replace(/=/g,"").replace(/[+\/]/g,function(e){return"+"==e?"-":"_"})}(Ht(e)):Ht(e)}(JSON.stringify(r));f={"Client-Time":p,"Sign-Value":Dt(h+(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)+v),"Sign-Version":B.signVersion,"content-type":"text/plain;charset=UTF-8"},d=h}catch(v){f={"Client-Time":p},d=r,n.reportLog({log_type:Q,message:"sign error msg: ".concat(null==v?void 0:v.message),err_stack:null==v?void 0:v.stack}),Ie.error(v)}wx.request({url:"https://api.datanexus.qq.com/data-nexus-cgi/miniprogram",method:"POST",timeout:(null==(l=n.configManager)?void 0:l.getRequestTimeout())||B.requestTimeout,header:f,data:d,success:function(i){var a,u;Ie.devLog("上报接口返回码:",null==(a=null==i?void 0:i.data)?void 0:a.code);var c=(null==(u=null==i?void 0:i.header)?void 0:u["Server-Time"])||-1;if(ce.revise(c),e.currentRequestCount-=1,200===(null==i?void 0:i.statusCode))return n.dealSuccessData(null==i?void 0:i.data,o,r),void t((null==i?void 0:i.data).code);var s="";try{s="object"==O(null==i?void 0:i.data)?JSON.stringify(null==i?void 0:i.data):null==i?void 0:i.data}catch(e){Ie.error(e)}var l={code:"number"==typeof(null==i?void 0:i.statusCode)?-1*i.statusCode:-888,message:"statusCode: ".concat(null==i?void 0:i.statusCode,", data: ").concat(s)};n.dealFailData(l,o,r),t(l.code)},fail:function(i){Ie.devLog("上报失败:",i),e.currentRequestCount-=1;var a={code:"number"==typeof(null==i?void 0:i.errno)?-1*i.errno:-999,message:null==i?void 0:i.errMsg};n.dealFailData(a,o,r),t(a.code)}})})}},{key:"startInspectTimer",value:function(){var t=this;clearTimeout(this.inspectTimer),this.inspectTimer=setTimeout(function(){e.currentRequestCount>=e.requestConcurrency&&(e.currentRequestCount=e.requestConcurrency-1),t.executeSend(),t.startInspectTimer()},1e3*this.inspectDelay)}},{key:"doTrackCallbackFn",value:function(e,t,n){if("function"==typeof e)try{for(var r=[],o=0;o<n.actions.length;o++)if(!n.actions[o].is_sdk_auto_track){var i=n.actions[o],a=i.action_type,u=i.action_param,c=i.action_id,s=i.action_time;r.push({action_type:a,action_param:u,action_id:c,action_time:s})}if(r.length){var l=n.info,f=l.user_action_set_id,d=l.appid,p=l.openid,v=l.unionid,h=l.user_unique_id;e({code:null==t?void 0:t.code,message:null==t?void 0:t.message,data:{actions:r,info:{user_action_set_id:f,appid:d,openid:p,unionid:v,user_unique_id:h}}})}}catch(r){Ie.error("返回上报回调数据异常:",r)}}}],[{key:"setRequestConcurrency",value:function(t){"number"==typeof t?t<1?Ie.error("网络请求最大并发量不能小于1"):t>10?Ie.error("网络请求最大并发量不能大于10"):e.requestConcurrency=t:Ie.error("网络请求最大并发量需设置为数字")}}]),e}(),Zt=$t;Zt.currentRequestCount=0,Zt.requestConcurrency=B.requestConcurrency,zt([Ce],Zt.prototype,"batchSend",1),zt([Ce],Zt.prototype,"flushSend",1),zt([Ce],Zt.prototype,"executeSend",1);var Xt=Ge,en=We,tn=Je,nn=He,rn=Ye,on=tt,an=Qe,un=ze,cn=$e,sn=Ze,ln=et,fn=Xe,dn=function(){function e(){I(this,e)}return C(e,[{key:"install",value:function(e,t){var n=function(t){Be.subscribe(t,function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.track(t,Object.assign(n||{},o,m(m({},wn,!0),Rn,r)))}}(t))};n(en),n(Xt),n(tn),n(nn),"all"===t&&(n(rn),n(on),n(an),n(cn),n(un),n("CREATE_GAME_ROOM"),n(sn),n(ln),n(fn))}}]),e}(),pn=function(){function e(){I(this,e),this.special_method_symbol=Symbol("special_method_symbol")}return C(e,[{key:"onPurchase",value:function(e){return"number"!=typeof e&&Ie.warn("付费金额需要为数字"),e<=0&&Ie.warn("付费金额需要大于0"),this.wrapTrack("PURCHASE",{value:e})}},{key:"onEnterForeground",value:function(){return this.wrapTrack("ENTER_FOREGROUND")}},{key:"onEnterBackground",value:function(){return this.wrapTrack("ENTER_BACKGROUND")}},{key:"onAppStart",value:function(){return this.wrapTrack("START_APP")}},{key:"onAppQuit",value:function(){return this.wrapTrack("APP_QUIT")}},{key:"onAddToWishlist",value:function(){return this.wrapTrack("ADD_TO_WISHLIST")}},{key:"wrapTrack",value:function(e,t){return this.track(e,Object.assign(t||{},m({},this.special_method_symbol,1)))}}]),e}(),vn=function(){S(t,pn);var e=T(t);function t(){return I(this,t),e.apply(this,arguments)}return C(t,[{key:"onRegister",value:function(){return this.wrapTrack("REGISTER")}},{key:"onCreateRole",value:function(e){return e&&"string"!=typeof e&&Ie.warn("角色名称需要为字符串"),this.wrapTrack("CREATE_ROLE",e?{name:e}:{})}},{key:"onTutorialFinish",value:function(){return this.wrapTrack("TUTORIAL_FINISH")}}]),t}(),hn="(如果确认无误,请忽略该提示)",gn=function(){var e=[];return{requestActionList:function(){try{se({conf_name:"data_nexus_common",conf_key:"action_types"}).then(function(t){he(t)&&(e=t)})}catch(e){Ie.error(e)}},getActionList:function(){return e}}}();function yn(e,t){try{e.is_sdk_auto_track||(function(e){try{var t=gn.getActionList();if(!t.includes(e)){var n,r=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=A(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}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 o,i=!0,a=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(a)throw o}}}}(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(mn(o,e)<=parseInt((.3*o.length).toString())){Ie.warn("通过SDK上报的".concat(e,"行为名称可能有误,请检查该行为类型是否为腾讯广告提供的标准行为!").concat(hn));break}}}catch(e){r.e(e)}finally{r.f()}}}catch(t){Ie.error(t)}}(e.action_type),"minigame"===t?function(e,t){var n,r,o;try{["PURCHASE","ADD_TO_CART"].includes(e.action_type)&&e.action_param&&Re(e.action_param,"value")&&("number"!=typeof(null==(n=e.action_param)?void 0:n.value)?Ie.warn("通过SDK上报的".concat(e.action_type,"行为携带的金额参数需要为数字!")):(null==(r=e.action_param)?void 0:r.value)<=0?Ie.warn("通过SDK上报的".concat(e.action_type,"行为携带的金额参数需要大于0!")):"minigame"===t&&(null==(o=e.action_param)?void 0:o.value)<100&&Ie.warn("通过SDK上报的".concat(e.action_type,"行为携带的金额参数可能有误,金额的单位为‘分’,请检查金额是否正确!").concat(hn)))}catch(e){Ie.error(e)}}(e,t):"miniprogram"===t&&function(e){try{var t=null==e?void 0:e.action_type,n=(null==e?void 0:e.action_param)||{};"PURCHASE"===t&&Re(n,"value")&&("number"!=typeof(null==n?void 0:n.value)?Ie.warn("通过SDK上报的".concat(t,"行为携带的金额参数需要为数字!")):(null==n?void 0:n.value)<=0&&Ie.warn("通过SDK上报的".concat(t,"行为携带的金额参数需要大于0!")))}catch(t){Ie.error(t)}}(e))}catch(e){Ie.error(e)}}function mn(e,t){try{if(0===e.length)return t.length;if(0===t.length)return e.length;for(var n=[],r=0;r<=t.length;r++)n[r]=[r];for(var o=0;o<=e.length;o++)n[0][o]=o;for(var i=1;i<=t.length;i++)for(var a=1;a<=e.length;a++)t.charAt(i-1)===e.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[t.length][e.length]}catch(n){Ie.error(n)}}function _n(e){try{e&&!/^[a-zA-Z0-9_\-]+$/.test(e)&&Ie.warn("通过SDK上报的openid:".concat(e,"可能有误,请检查openid是否正确!").concat(hn))}catch(e){Ie.error(e)}}var An,kn=Object.defineProperty,Sn=Object.getOwnPropertyDescriptor,bn=function(e,t,n,r){for(var o,i=r>1?void 0:r?Sn(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&kn(t,n,i),i},Tn=Symbol("initializedInstance"),wn=Symbol("autoTrack"),Rn=Symbol("actionTime"),En=function(){S(t,vn);var e=T(t);function t(n){var r;if(I(this,t),(r=e.call(this)).env="production",r.sdk_version="1.5.5",r.sdk_name="@dn-sdk/minigame",r.deviceInfo={},r.gameInfo={},r.session_id="",r.log_id=0,r.inited=!1,r.initErrMsg="",null==wx||!wx.createCanvas)return r.initErrMsg="不支持非微信小游戏中使用",Ie.error(r.initErrMsg),w(r);var o=we();if(t[Tn].length>=o.maxSdkInstance)return r.initErrMsg="初始化超过上限",Ie.error(r.initErrMsg),w(r);var i=function(e){return ve(e)?(function(e){var t=["user_action_set_id","secret_key","appid","openid","unionid","user_unique_id","auto_track","auto_attr","on_report_fail","on_report_complete"];for(var n in e)t.includes(n)||Ie.warn("Invalid property '".concat(n,"' found in config"))}(e),"number"!=typeof e.user_action_set_id?"user_action_set_id 参数需为 number 类型":e.user_action_set_id<=0?"user_action_set_id 参数需大于 0":"string"!=typeof e.secret_key?"secret_key 参数需为 string 类型":""===e.secret_key.trim()?"缺少 secret_key 参数":32!==e.secret_key.length?"secret_key 参数需为 32 位字符串":"string"!=typeof e.appid?"appid 参数需为 string 类型":""!==e.appid.trim()||"缺少 appid"):"初始化参数需为 object 类型"}(n),a=ie();if(!0!==i)return r.initErrMsg=i,Ie.error(i),w(r);var u=null==a?void 0:a.appId;if(u&&u!==n.appid)return r.initErrMsg="初始化传入的appid与当前小游戏appid不一致",Ie.error(r.initErrMsg),w(r);r.config=n,Re(n,"auto_track")||(r.config.auto_track=Te("autoTrack")),r.openid=n.openid,r.unionid=n.unionid,r.user_unique_id=n.user_unique_id,r.onReportComplete=n.on_report_complete,r.onReportFail=n.on_report_fail,r.saveValidOpenidToStorage();var c=n.user_action_set_id;return t[Tn].includes(c)?(r.initErrMsg="同个数据源[".concat(c,"]只能初始化一次"),Ie.error(r.initErrMsg),r.reportLog({log_type:K,message:r.initErrMsg}),w(r)):(r.reportLog=r.reportLog.bind(R(r)),r.getTrackBaseInfo=r.getTrackBaseInfo.bind(R(r)),r.deviceInfo=te(),r.gameInfo=xe(),r.session_id=me(),r.queueManage=new Ue({userActionSetId:c,maxLength:o.maxQueueLength,ogEvents:Ke}),r.actionReporter=new Zt({getBaseInfo:r.getTrackBaseInfo,reportLog:r.reportLog,queueManager:r.queueManage,configManager:it,onReportComplete:r.onReportComplete,onReportFail:r.onReportFail}),r.inited=!0,t[Tn].push(c),r.useAutoTrack(),r.doReportOnEnterBackground(),"release"===(null==a?void 0:a.envVersion)?(Ie.info("初始化成功"),w(r)):(function(e){var t=e.sdk_version,n=e.default_download_url,r=e.fail_handler;se({conf_name:e.conf_name,conf_key:e.conf_key}).then(function(e){if(ve(e)){var o=null==e?void 0:e.blackVersions,i=null==e?void 0:e.minVersion,a=null==e?void 0:e.bestVersion,u=null==e?void 0:e.downloadUrl,c=n;return u&&/^https/.test(u)&&(c=u),he(o)&&(null==o?void 0:o.indexOf(t))>-1?(null==r||r(),void Ie.error("初始化失败!当前SDK版本存在兼容问题,请尽快升级至最新版!下载地址:".concat(c))):i&&be(t,i)<0?(null==r||r(),void Ie.error("初始化失败!当前SDK版本过低,请尽快升级至最新版!下载地址:".concat(c))):(a&&be(t,a)<0&&Ie.warn("新版本SDK已上线,强烈建议您升级至最新版,尽早享受新特性!下载地址:".concat(c)),void Ie.info("初始化成功"))}Ie.info("初始化成功")}).catch(function(){Ie.info("初始化成功")})}({conf_name:"mini_game_sdk_common",conf_key:"version",sdk_version:r.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(){r.inited=!1}}),gn.requestActionList(),_n(n.openid),w(r)))}return C(t,[{key:"getInitResult",value:function(){return{inited:this.inited,initErrMsg:this.initErrMsg}}},{key:"track",value:function(e,t){var n,r;if(!this.inited||!this.queueManage)return Ie.error("上报失败,请先完成初始化"),{code:100,message:"未完成初始化或重复初始化导致初始化失败,请先完成初始化"};var o=Lt.validateActionType(e),i=Lt.validateActionParam(t);if(o&&i){!this.openid&&!this.unionid&&Ie.warn("缺少 openid 或 unionid");var a=Te("actionParamMaxLength");if(JSON.stringify(t||{}).length>a)return Ie.error("监测到超过".concat(a,"的上报日志:").concat(e," ").concat(t)),{code:102,message:"action_param 参数过大,不能超过 ".concat(a," 字符")};var u=!(null==t||!t[wn]),c=this.createAction(e,t||{},u);"release"!==(null==(n=ie())?void 0:n.envVersion)&&yn(c,"minigame");var s=this.queueManage.addAction(c);return null==(r=this.actionReporter)||r.batchSend(),s}return{code:101,message:"action_type 或 action_param 参数错误"}}},{key:"flush",value:function(){var e;null==(e=this.actionReporter)||e.flushSend()}},{key:"setOpenId",value:function(e){var t;if(e&&"string"==typeof e)return this.openid=e,this.gameInfo.ad_trace_id&&!ee.getSync(F)&&Be.publish("START_APP"),this.flush(),this.saveValidOpenidToStorage(),"release"!==(null==(t=ie())?void 0:t.envVersion)&&_n(e),{code:0,message:"成功"};var n="openid 格式错误";return Ie.error(n),{code:101,message:n}}},{key:"setUnionId",value:function(e){if(e&&"string"==typeof e)return this.unionid=e,this.flush(),{code:0,message:"成功"};var t="unionid 格式错误";return Ie.error(t),{code:101,message:t}}},{key:"setUserUniqueId",value:function(e){if(e&&"string"==typeof e)return this.user_unique_id=e,{code:0,message:"成功"};var t="user_unique_id 格式错误";return Ie.error(t),{code:101,message:t}}},{key:"doReportOnEnterBackground",value:function(){var e=this;wx.onHide(function(){var t,n;null==(t=e.actionReporter)||t.flushSend(),null==(n=e.queueManage)||n.reportLostNum()})}},{key:"getTrackBaseInfo",value:function(){var e=ie();return Object.assign({},this.deviceInfo,function(e){var t={};return["user_action_set_id","appid","openid","secret_key","user_unique_id","unionid"].forEach(function(n){Re(e,n)&&(t[n]=e[n])}),t}(this.config),{local_id:ne(),sdk_name:this.sdk_name,sdk_version:this.sdk_version,openid:this.openid||oe(),unionid:this.unionid,user_unique_id:this.user_unique_id,inner_param:{app_env_version:e.envVersion,app_version:e.version}})}},{key:"createAction",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];null!=t&&t[wn]&&delete t[wn];var r=Date.now();null!=t&&t[Rn]&&(r=null==t?void 0:t[Rn],delete t[Rn]);var o={action_id:me(),action_param:t,action_time:r,action_type:e,is_retry:!1,is_sdk_auto_track:n,retry_count:0,revised_action_time:ce.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:re(),ad_trace_id:this.gameInfo.ad_trace_id,channel:this.getChannelByActionType(e)};return null!=t&&t[this.special_method_symbol]&&(this.addActionInnerParam(o,"is_special_method",!0),delete t[this.special_method_symbol]),it.getChannelClaimActionList().indexOf(e)>-1&&this.gameInfo.launch_options&&this.addActionInnerParam(o,"launch_options",this.gameInfo.launch_options),o}},{key:"addActionInnerParam",value:function(e,t,n){e.inner_param&&ve(e.inner_param)?e.inner_param[t]=n:e.inner_param=m({},t,n)}},{key:"getChannelByActionType",value:function(e){var t="";return it.getChannelClaimActionList().indexOf(e)>-1?t=this.gameInfo.channel||"":it.getNoClaimActionList().indexOf(e)>-1&&(t="UNKNOWN"),t}},{key:"reportLog",value:function(e){var t,n,r={user_action_set_id:null==(t=this.config)?void 0:t.user_action_set_id,appid:null==(n=this.config)?void 0:n.appid,session_id:this.session_id};ue(Object.assign(r,e))}},{key:"useAutoTrack",value:function(){var e;if(null!=(e=this.config)&&e.auto_track){var t=!0,n=ee.getSync(j);(null==n?void 0:n.ap)===$?t=!0:(null==n?void 0:n.ap)===Z&&(t=!1),"devtools"===te().wx_platform&&(t=!0),(new dn).install(this,t?"all":"lifecycle"),lt(),t&&It(),this.getAutoProxyRemoteConfig()}}},{key:"getAutoProxyRemoteConfig",value:function(){var e,t,n=te();n.os&&n.os_version&&null!=(e=this.config)&&e.user_action_set_id&&function(e){return new Promise(function(t){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/minigame/get",data:e,timeout:B.requestTimeout,success:function(e){le(e,t,"minigame/get"),de(e)},fail:function(e){fe(e,"minigame/get")}})})}({conf_name:"MG",conf_param:{user_action_set_id:null==(t=this.config)?void 0:t.user_action_set_id,sdk_version:this.sdk_version,os_type:(null==n?void 0:n.os)||"",os_version:Ee(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(e){ve(e)&&ee.setSync(j,e)})}},{key:"saveValidOpenidToStorage",value:function(){this.openid&&function(e){return/^[a-zA-Z0-9_-]{28,30}$/.test(e)}(this.openid)&&ee.setSync(F,this.openid)}}],[{key:"setRequestConcurrency",value:function(e){Zt.setRequestConcurrency(e)}},{key:"setDebug",value:function(e){Ie.debug=e}}]),t}(),On=En;On[Tn]=[],bn([Ce],On.prototype,"track",1),bn([Ce,function(e,t,n){var r=n.value;return n.value=function(){if(this.inited){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.apply(this,t)}Ie.error("上报失败,请先完成初始化")},n}],On.prototype,"flush",1),bn([Ce],On.prototype,"setOpenId",1),bn([Ce],On.prototype,"setUnionId",1),bn([Ce],On.prototype,"setUserUniqueId",1),bn([Ce],On.prototype,"doReportOnEnterBackground",1),bn([Ce],On.prototype,"getTrackBaseInfo",1),bn([Ce],On.prototype,"useAutoTrack",1);var In=0,xn={moid:""},Cn=!1,Nn=JSON.stringify(wx.getLaunchOptionsSync()||""),Pn={token:"",uid:"",uname:"",openid:""},Ln={partner_id:"",game_id:"",pkg_name:"",version:""},Mn={doid:"",dsid:"",dsname:"",dext:"",drid:"",drname:"",drlevel:"",dmoney:"",money:""},Dn="wx-adapter sdk >>>>>>>:";wx.hideShareMenu(),wx.onShow(function(e){e.query&&(Nn=JSON.stringify(e))});var qn=function(e){var t=r(r({},h()),p),n=f(r(r(r(r(r({},Mn),Pn),Ln),t),{},{launchoption:Nn,onshow:Nn}));s(c,"/wxgamemds/index/",n).then(function(t){t.state&&(t.data.balance>=e?Un(""):jn(t.data,e))}).catch(function(e){console.log(e)})},jn=function(e,t){wx.requestMidasPayment({mode:"game",env:e.env,offerId:e.offerId,currencyType:e.currencyType,platform:e.platform,buyQuantity:e.buyQuantity,outTradeNo:xn.moid,success:function(e){An&&An.onPurchase(100*t),Un(e)},fail:function(e){console.log(e)}})},Un=function(e){var t;In++;var n=r(r({},h()),p);t=f(e?r(r(r(r(r(r({},Mn),Ln),Pn),n),xn),{},{res:JSON.stringify(e),launchoption:Nn,onshow:Nn}):r(r(r(r(r(r({},Mn),Ln),Pn),xn),n),{},{launchoption:Nn,onshow:Nn})),s(c,"/wxgamemds/send/",t).then(function(e){console.log(e)}).catch(function(t){console.log(t),In<3&&setTimeout(function(){Un(e)},1e3)})},Fn=function(e){return new Promise(function(t,n){var o=Pn||{},i=o.token,a=o.uid,l=o.uname;if(!(Cn&&i&&a&&l))return u("未激活或未登录,请重新进入游戏"),n({state:100001,msg:"未激活或未登录,请检查"});var d=f(r(r(r(r(r({},e),Pn),Ln),r(r({},h()),p)),{},{launchoption:Nn,onshow:Nn}));s(c,"/wxgameevent/index/",d).then(function(){t(),An&&("create"===d.event&&An.onCreateRole(d.drname),"levelup"===d.event&&An.track("UPDATE_LEVEL",{level:d.drlevel,power:0}))}).catch(function(e){console.log(e),n({state:100002,msg:"角色上报失败"})})})},Vn=null,Bn=!1,Kn=!1;e.jf_active=function(e){return new Promise(function(t,n){if(!e)return n({state:100001,msg:"激活入参缺失"});if(null==e||!e.wx)return n({state:100002,msg:"激活入参 wx 属性缺失"});var r=e.wx,o=r.game_id,i=r.version,a=r.dn_sdk_id,u=r.dn_secret_key;if(!o)return n({state:100003,msg:"激活入参 game_id 属性缺失"});Ln.game_id=o,Ln.version=i,Ln.pkg_name="wxgame",Ln.partner_id=4,Cn=!0,console.log("active 激活成功!"),a&&u&&function(e){var t=e.dn_sdk_id,n=e.dn_secret_key,r=e.app_id,o=(An=new On({appid:r,secret_key:n,user_action_set_id:t})).getInitResult();null!=o&&o.inited||console.error("dnSdk init failed: ",o.initErrMsg),An.onAppStart(),wx.onAddToFavorites(function(e){console.log(Dn+"click onAddToFavorites"),An&&An.track("DD_TO_WISHLIST",{type:"default"})}),wx.onShareAppMessage(function(){console.log(Dn+"click onShareAppMessage"),An&&An.track("SHARE",{target:"APP_MESSAGE"})}),wx.onShareTimeline(function(){console.log(Dn+"click onShareTimeline"),An&&An.track("SHARE",{target:"TIME_LINE"})}),console.log(Dn+"广点通初始化成功!")}(wx),t()})},e.jf_createRewardedVideoAd=function(e){var t=function(){return new Promise(function(t,n){if(Bn)return t();Vn&&(Vn=null),(Vn=wx.createRewardedVideoAd({adUnitId:e})).onError(function(e){Bn=!1,Vn=null,n({state:100004,msg:"广告平台异常",originalErr:e})}),Vn.load().then(function(){console.log("激励视频广告预加载成功"),Bn=!0,t()}).catch(function(e){console.error("激励视频广告预加载失败:",e),Bn=!1,Vn=null,n(e)})})},n=function(){return Kn?Promise.reject({state:100004,msg:"广告正在展示中,请稍后再试"}):Bn?Vn?(Kn=!0,new Promise(function(e,t){Vn.onClose(function(t){console.log("激励视频广告关闭,是否看完:",t.isEnded),e({isEnded:t.isEnded}),Kn=!1,Vn.offClose()}),Vn.show().then(function(){console.log("激励视频广告展示成功")}).catch(function(e){Bn=!1,Kn=!1,t({state:100003,msg:JSON.stringify(e)})})})):Promise.reject({state:100002,msg:"广告实例不存在"}):t().then(n).catch(function(e){return Promise.reject({state:100001,msg:JSON.stringify(e)})})};return{preload:t,show:n}},e.jf_customerService=function(e){wx.openCustomerServiceConversation({success:function(){Fn(r(r({},d(e)),{},{event:"kfclick"}))}})},e.jf_getUserInfo=function(){return new Promise(function(e,t){wx.getSetting({success:function(n){n.authSetting["scope.userInfo"]?wx.getUserInfo({success:function(t){return e(t.userInfo)},fail:function(e){return t({state:100001,msg:JSON.stringify(e)})}}):wx.getUserProfile({desc:"获取用户信息",success:function(t){return e(t.userInfo)},fail:function(e){return t({state:100002,msg:JSON.stringify(e)})}})}})})},e.jf_login=function(){return new Promise(function(e,t){if(!Cn)return t({state:100003,msg:"登录前请先激活"});wx.login({success:function(n){var o=f(r(r(r({code:n.code},Ln),y()),{},{launchoption:Nn,onshow:Nn}));s(c,"/wxgamelogin/initlogin/",o).then(function(n){if(1==n.state){var r=n.data,o=r.token,i=r.uid,a=r.uname,c=r.openid,s=r.show_page;if(Pn.token=o,Pn.uid=i,Pn.uname=a,Pn.openid=c,e({token:o,uid:i,uname:a,partner_id:4,show_page:s}),console.log(Dn+"登录成功"),c&&An){var l=n||{},f=l.backFlowDay,d=l.isRegisterUser;!function(e){var t=e.openid,n=e.nsSdk,r=e.backFlowDay,o=e.isRegisterUser;n.setOpenId(t),o?n.onRegister():r&&r>=30&&n.track("RE_ACTIVE",{backFlowDay:30})}({openid:c,nsSdk:An,backFlowDay:f,isRegisterUser:d})}}else u(n.msg),t({state:n.state,msg:n.msg})}).catch(function(e){u(e),t({state:100001,msg:e})})},fail:function(e){t({state:100002,msg:e})}})})},e.jf_pay=function(e){return new Promise(function(t,n){var o=Pn||{},i=o.token,a=o.uid,l=o.uname;if(!(Cn&&i&&a&&l))return u("失败!请先激活登录"),n({state:100001,msg:"未激活或未登录,请重新进入游戏"});wx.showLoading({title:"加载中"});var v=e.dmoney;(Mn=d(e)||{}).money=v;var m=f(r(r(r(r(r({},e),Ln),Pn),r(r(r({},h()),g()),p)),{},{money:v,launchoption:Nn,onshow:Nn}));s(c,"/wxgameorder/index/",m).then(function(e){var r=e||{},o=r.state,i=r.msg,a=r.data,l=void 0===a?{}:a;if(1==o){var d=l.aid,p=l.moid,h=l.thumb_url;xn.moid=p,1==d?(qn(v),t({msg:"ok"})):2==d?wx.showModal({title:"支付提示",content:"即将打开充值入口,输入“充值”或点击右下角卡片即可充值。",showCancel:!1,confirmText:"点我充值",success:function(e){e.confirm?wx.openCustomerServiceConversation({sessionFrom:p,sendMessagePath:"/path/index/index?moid="+p,showMessageCard:!0,sendMessageImg:h,success:function(e){console.log("openCustomerServiceConversation success",e),t()},fail:function(e){console.error("openCustomerServiceConversation fail ",e),n({state:100003,msg:"支付失败"})},complete:function(e){console.log("openCustomerServiceConversation compelte: ",p),function(e){var t=y(),n=f({partner_id:Ln.partner_id,pkg_name:Ln.pkg_name,game_id:Ln.game_id,uid:Pn.uid,openid:Pn.openid,token:Pn.token,uname:Pn.uname,duid:t.duid,moid:e});s(c,"/wxgameorder/get/",n).then(function(e){1==e.data.status&&An.onPurchase(100*e.data.money)})}(p)}}):(u("用户取消支付"),n({state:100005,msg:"取消支付"}))},fail:function(){u("用户取消支付"),n({state:100006,msg:"支付失败"})}}):(u("失败!设备未识别"),n({state:100004,msg:"支付失败"}))}else u(i),n({state:o,msg:i});wx.hideLoading()}).catch(function(e){u(e),n({state:100002,msg:"支付失败"}),wx.hideLoading()})})},e.jf_profanityCheck=function(e){return new Promise(function(t,n){var o=f(r(r(r(r(r({},e),Ln),Pn),y()),{},{launchoption:Nn,onshow:Nn,partner_id:4}));s(c,"/wxgamesafe/verify/",o).then(function(e){var r=e.data,o=r.code,i=r.msg;1==o?t():n({state:100001,msg:i})}).catch(function(e){n({state:100002,msg:e})})})},e.jf_share=function(e){wx.shareAppMessage(),Fn(r(r({},d(e)),{},{event:"fxclick"}))},e.jf_showInterstitialAd=function(e){return new Promise(function(t,n){var r=!1,o=wx.createInterstitialAd({adUnitId:e});o.onError(function(e){r=!0}),o.load().then(function(){if(!r)return o.show();n({state:100001,msg:"广告加载后发生错误"})}).then(t).catch(function(e){return n({state:100002,msg:JSON.stringify(e)})}),o.onClose(function(e){console.log("广告关闭:",e.isEnded?"正常播放完成":"用户提前关闭")})})},e.jf_trace=Fn,e.jf_tracePageView=function(e){return new Promise(function(t,n){An?(An.track("VIEW_CONTENT",{item:e}),t()):n({state:100001,msg:"上报失败!广点通 sdk 未初始化"})})},Object.defineProperty(e,"__esModule",{value:!0})});
7
+ function _(e,t,n){return(t=P(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e){return function(e){if(Array.isArray(e))return S(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||k(e)||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 k(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}function w(e,t){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},w(e,t)}function T(e){var t=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(e){return!1}}();return function(){var n,r=E(e);if(t){var o=E(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return R(this,n)}}function R(e,t){if(t&&("object"===I(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function I(e){return I="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},I(e)}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(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,P(r.key),r)}}function N(e,t,n){return t&&C(e.prototype,t),n&&C(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function P(e){var t=function(e){if("object"!==I(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==I(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===I(t)?t:String(t)}var L,M,D="LOCAL_ID",j="CLICK_ID",q="QUEUE_LOST_MAP",U="REMOTE_CONFIG",F="REMOTE_COMMON_CONFIG",B="OPENID",V={init:"init",reporting:"reporting",fail:"fail"},K={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"]},G="JS_RUN_ERROR",J="REQUEST_ERROR",W="REQUEST_CONFIG_ERROR",H="JS_QUEUE_LOG",Y="PROXY_ERROR",Q="QUEUE_LOST_NUM",z="SIGN_ERROR",$="UNKNOWN",Z="TRUE",X="FALSE",ee="TICKET_INTERVAL_CHANGE",te=(M=function(e){return"".concat("@dn-sdk/minigame","_").concat("production","_").concat(e)},{getSync:function(e){var t;try{t=wx.getStorageSync(M(e))}catch(e){return console.error("storage get error",e),t}return t},setSync:function(e,t){try{wx.setStorageSync(M(e),t)}catch(e){return console.error("storage set error",e),!1}return!0}}),ne=function(){var e;return function(){if(!e){var t=function(){if(L)return L;try{return L=wx.getSystemInfoSync()}catch(e){return{}}}(),n=t.system,r=void 0===n?"":n,o=(null==r?void 0:r.split(" "))||[],i=function(e){if(!e)return $;var t=(null==e?void 0:e.toUpperCase())||"";return t.indexOf("ANDROID")>-1?"ANDROID":t.indexOf("IOS")>-1?"IOS":t.indexOf("MAC")>-1?"OSX":t.indexOf("WINDOWS")>-1?"WINDOWS":$}(o[0]),a=function(e){return!e||e.length<=0?"":2===e.length?e[1]:3===e.length&&"Windows"===e[0]?"".concat(e[1]," ").concat(e[2]):e[e.length-1]}(o);e={benchmark_level:t.benchmarkLevel,device_brand:t.brand,screen_height:Math.floor(t.screenHeight),screen_width:Math.floor(t.screenWidth),wx_lib_version:t.SDKVersion,wx_version:t.version,wx_platform:t.platform,device_model:t.model,os:i,os_version:a}}return e}}(),re=function(){var e;return function(){try{if(e)return e;e||(e=te.getSync(D)||""),e||(e=_e(),te.setSync(D,e))}catch(e){}return e}}(),oe=function(){var e="unknown",t=!1;return function(){if(!t)try{wx.getNetworkType({success:function(t){e=t.networkType},fail:function(){e="unknown"}}),wx.onNetworkStatusChange(function(t){e=t.networkType}),t=!0}catch(e){}return e}}();oe();var ie=function(){var e="";return function(){return e||(e=te.getSync(B)||""),e}}(),ae=function(){var e;return function(){if(e)return e;try{var t=wx.getAccountInfoSync();return he(t.miniProgram)?e=t.miniProgram:{}}catch(t){return{}}}}();function ue(e){var t=null==e?void 0:e.query;if(!he(t))return"";var n="";return t.gdt_vid||[1045,1046,1084].indexOf(null==e?void 0:e.scene)>-1?n="TENCENT":t.clue_token||t.clickid&&t.item_id?n="BYTEDANCE":t.callback&&"kuaishou"===t.ksChannel?n="KUAISHOU":t.bd_vid||t.ai&&t.d&&t.q&&t.c?n="BAIDU":t.uctrackid?n="ALIBABA":(t.trackid||t.imp||[1065,1069,1194].indexOf(null==e?void 0:e.scene)>-1&&(t.callback||t.u))&&(n="OTHERS"),n}function ce(e,t){try{var n=ne(),r=ae(),o={sdk_version:"1.5.5",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:re(),env_version:null==r?void 0:r.envVersion,appid:null==r?void 0:r.appId},i=Object.assign(o,e);wx.request({url:"https://api.datanexus.qq.com/data-nexus-trace/log",data:i,method:"POST",timeout:K.requestTimeout,success:function(e){"function"==typeof t&&200===(null==e?void 0:e.statusCode)&&t()}})}catch(n){xe.error(n)}}var se=function(){function e(){x(this,e)}return N(e,null,[{key:"revise",value:function(e){e>0&&!this.isRevised&&(this.offsetTime=e-Date.now(),this.isRevised=!0)}},{key:"getRevisedcurrentTimeMillis",value:function(){return this.isRevised?Date.now()+this.offsetTime:-1}}]),e}();function le(e){return new Promise(function(t,n){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/config/get",data:e,timeout:K.requestTimeout,success:function(e){fe(e,t,"config/get",n),pe(e)},fail:function(e){de(e,"config/get",n)}})})}function fe(e,t,n,r){var o,i,a,u,c=null==e?void 0:e.statusCode,s=null==(o=null==e?void 0:e.data)?void 0:o.code;if(200!==c||0!==s){var l=s;200!==c&&(l="number"==typeof c?-1*c:-888),ce({log_type:W,message:"cgiName: ".concat(n,", statusCode: ").concat(c,", code: ").concat(s,", traceid: ").concat(null==(a=null==e?void 0:e.data)?void 0:a.trace_id),code:l}),null==r||r(null==(u=null==e?void 0:e.data)?void 0:u.data)}else t(null==(i=e.data)?void 0:i.data)}function de(e,t,n){ce({log_type:W,message:"cgiName: ".concat(t," , message: ").concat(null==e?void 0:e.errMsg," "),code:"number"==typeof(null==e?void 0:e.errno)?-1*e.errno:-999}),null==n||n(e)}function pe(e){var t,n=1*(null==(t=null==e?void 0:e.header)?void 0:t["Server-Time"]);n>17266752e5&&se.revise(n)}se.offsetTime=0,se.isRevised=!1;var ve=Object.prototype.toString,he=function(e){return"[object Object]"===ve.call(e)},ge=function(e){return"[object Array]"===ve.call(e)},ye=function(e){return"[object Function]"===ve.call(e)},me=(new Date).getTime();function _e(){var e=(new Date).getTime(),t=Math.abs(1e3*(e-me));return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(n){var r=16*Math.random();return e>0?(r=(e+r)%16|0,e=Math.floor(e/16)):(r=(t+r)%16|0,t=Math.floor(t/16)),("x"===n?r:3&r|8).toString(16).replace(/-/g,"")})}var Ae=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,ke=function(e){if("string"!=typeof e)throw new TypeError("Invalid argument expected string");if(!Ae.test(e))throw new Error("Invalid argument not valid semver ('".concat(e,"' received)"))},Se=function(e){return isNaN(Number(e))?e:Number(e)},be=function(e){var t=e.replace(/^v/,"").replace(/\+.*$/,""),n=function(e){return-1===e.indexOf("-")?e.length:e.indexOf("-")}(t),r=t.substring(0,n).split(".");return r.push(t.substring(n+1)),r},we=function(e,t){[e,t].forEach(ke);for(var n=be(e),r=be(t),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(Se),l=c.split(".").map(Se),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};function Te(e){return Re()[e]}function Re(){return K}function Oe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ee=function(e){try{return e&&"string"==typeof e?-1===(e=e.replace(/\s/g,"")).indexOf(".")?e:e.split(".").slice(0,2).join("."):""}catch(t){return e}},Ie=function(){function e(){x(this,e)}return N(e,null,[{key:"error",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=console).error.apply(t,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(e)].concat(r))}},{key:"info",value:function(t){for(var n,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];e.debug&&(n=console).info.apply(n,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(t)].concat(o))}},{key:"log",value:function(t){for(var n,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];e.debug&&(n=console).log.apply(n,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(t)].concat(o))}},{key:"warn",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=console).warn.apply(t,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(e)].concat(r))}},{key:"devLog",value:function(t){for(var n,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];e.isDev&&(n=console).log.apply(n,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(t)].concat(o))}}]),e}(),xe=Ie;xe.debug=!1,xe.isDev=!1;var Ce=function(){var e;return function(){if(!e)try{var t=wx.getLaunchOptionsSync(),n=t.query.gdt_vid||"";n?te.setSync(j,n):n=te.getSync(j)||"";var r=JSON.stringify(t);r.length>1e4&&(r=JSON.stringify({cut:1,scene:t.scene})),e={source_scene:t.scene,pkg_channel_id:t.query.wxgamepro||"",ad_trace_id:n,launch_options:r,channel:ue(t)}}catch(t){e={},xe.log("获取场景值和渠道号失败",t)}return e}}();function Ne(e,t,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{xe.error.apply(xe,["calling ".concat(e.constructor.name,".").concat(t," error with arguments")].concat(o)),xe.error(n);var a={log_type:G,message:"[safeExcutable] ".concat(e.constructor.name,".").concat(t,": ").concat(null==n?void 0:n.message),err_stack:null==n?void 0:n.stack};ye(this.reportLog)?this.reportLog(a):ce(a)}catch(a){}}},n}var Pe=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,Me=function(e,t,n,r){for(var o,i=r>1?void 0:r?Le(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Pe(t,n,i),i},De=function(){function e(t){var n=t.userActionSetId,r=t.maxLength,o=void 0===r?500:r;x(this,e),this.lostActionMaps={},this.stack=[],this.localStorageKey="",this.localStorageKey="".concat("QUEUE_ACTIONS","_").concat(null==n?void 0:n.toString()),this.maxLength=o,this.userActionSetId=n,this.setTimeStamp(),this.init()}return N(e,[{key:"getItems",value:function(){return this.stack}},{key:"getStorage",value:function(){var e,t=(null==(e=te)?void 0:e.getSync(this.localStorageKey))||"[]";return JSON.parse(t)}},{key:"reportLostNum",value:function(){var e=this,t=Object.assign({},this.lostActionMaps),n=[];for(var r in t){var o=null==r?void 0:r.split("_");n.push({queue_lost_session_id:o[0],queue_lost_timestamp:o[1],queue_lost_num:t[r]})}n.length&&(this.setTimeStamp(),n.forEach(function(t){var n=Object.assign({},{user_action_set_id:e.userActionSetId,log_type:Q},t),r=null==t?void 0:t.queue_lost_session_id,o=null==t?void 0:t.queue_lost_timestamp,i="".concat(r,"_").concat(o);ce(n,function(){Oe(e.lostActionMaps,i)&&(delete e.lostActionMaps[i],te.setSync(q,JSON.stringify(e.lostActionMaps)))})}))}},{key:"getLostMaps",value:function(){return this.lostActionMaps}},{key:"init",value:function(){var e=this,t=this.getStorage(),n=null==t?void 0:t.map(function(e){var t,n;return e.inner_status===(null==(t=V)?void 0:t.reporting)?Object.assign({},e,{inner_status:null==(n=V)?void 0:n.fail,is_retry:!0,retry_count:e.retry_count+1}):e});this.stack=n,this.lostActionMaps=JSON.parse(te.getSync(q)||"{}"),setTimeout(function(){e.reportLostNum()},1e3)}},{key:"addItem",value:function(e){var t;null==(t=null==this?void 0:this.stack)||t.push(e)}},{key:"removeItems",value:function(e){var t,n=null==(t=null==this?void 0:this.stack)?void 0:t.filter(function(t){return!(null!=e&&e.includes(null==t?void 0:t.action_id))});this.stack=n}},{key:"updateForReportFail",value:function(e){var t;this.stack=null==(t=this.stack)?void 0:t.map(function(t){var n;return null!=e&&e.includes(null==t?void 0:t.action_id)?Object.assign({},t,{inner_status:null==(n=V)?void 0:n.fail,retry_count:t.retry_count+1,is_retry:!0}):t})}},{key:"updateForReporting",value:function(e){var t;this.stack=null==(t=this.stack)?void 0:t.map(function(t){var n;return null!=e&&e.includes(null==t?void 0:t.action_id)?Object.assign({},t,{inner_status:null==(n=V)?void 0:n.reporting}):t})}},{key:"updateAllStack",value:function(e){this.stack=e}},{key:"updateToStorage",value:function(){te.setSync(this.localStorageKey,JSON.stringify(this.stack))}},{key:"updateLostAction",value:function(e){if(e){var t="".concat(e,"_").concat(this.timeStamp),n=this.lostActionMaps[t]||0;this.lostActionMaps[t]=n+1,te.setSync(q,JSON.stringify(this.lostActionMaps))}}},{key:"setTimeStamp",value:function(){this.timeStamp=Date.now().toString()}}]),e}();Me([Ne],De.prototype,"getItems",1),Me([Ne],De.prototype,"getStorage",1),Me([Ne],De.prototype,"reportLostNum",1),Me([Ne],De.prototype,"getLostMaps",1),Me([Ne],De.prototype,"init",1),Me([Ne],De.prototype,"addItem",1),Me([Ne],De.prototype,"removeItems",1),Me([Ne],De.prototype,"updateForReportFail",1),Me([Ne],De.prototype,"updateForReporting",1),Me([Ne],De.prototype,"updateAllStack",1),Me([Ne],De.prototype,"updateToStorage",1),Me([Ne],De.prototype,"updateLostAction",1);var je=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,Ue=function(e,t,n,r){for(var o,i=r>1?void 0:r?qe(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&je(t,n,i),i},Fe=function(){b(t,De);var e=T(t);function t(n){var r,o=n.userActionSetId,i=n.maxLength,a=void 0===i?500:i,u=n.ogEvents,c=void 0===u?[]:u;return x(this,t),(r=e.call(this,{userActionSetId:o,maxLength:a})).ogEvents=c,r}return N(t,[{key:"getReportableActions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,t=this.getItems(),n=[];return null==t||t.forEach(function(t){var r;(null==n?void 0:n.length)<e&&(null==t?void 0:t.inner_status)!==(null==(r=V)?void 0:r.reporting)&&(null==n||n.push(t))}),n}},{key:"addAction",value:function(e){var t={code:0,message:"成功",actionId:e.action_id},n=this.getItems();if((null==n?void 0:n.length)>=this.maxLength){var r="队列长度超过最大限制".concat(this.maxLength,"条,SDK将按照行为优先级排序,丢弃优先级最低的行为事件");xe.warn(r),ce({user_action_set_id:this.userActionSetId,log_type:H,message:"队列长度超过限制"});var o=this.sortQueue(e,n);xe.debug&&xe.info("超过".concat(this.maxLength,"条按优先级排序的队列:"),o.concat([]));var i=o.pop();this.updateAllStack(o),this.updateLostAction((null==i?void 0:i.session_id)||""),(null==i?void 0:i.action_id)===e.action_id&&(t={code:103,message:"缓存队列已满,主动丢弃行为"})}else this.addItem(e);return this.updateToStorage(),t}},{key:"removeActions",value:function(e){this.removeItems(e),this.updateToStorage()}},{key:"updateActionsForReportFail",value:function(e){this.updateForReportFail(e),this.updateToStorage()}},{key:"updateActionsForReporting",value:function(e){this.updateForReporting(e),this.updateToStorage()}},{key:"getReportableActionsLength",value:function(){var e=this.getItems().filter(function(e){var t;return(null==e?void 0:e.inner_status)!==(null==(t=V)?void 0:t.reporting)});return null==e?void 0:e.length}},{key:"sortQueue",value:function(e,t){var n=this,r={},o=null==e?void 0:e.action_time,i=t.concat([e]),a=function(e){return r[e.action_id]||(r[e.action_id]=n.caculateWeight(o,e)),r[e.action_id]};return i.sort(function(e,t){return a(t)-a(e)})}},{key:"caculateWeight",value:function(e,t){var n,r=0,o=this.formatWeight(e,null==t?void 0:t.action_time),i=o.ogWeight,a=o.sdkWeight,u=o.userWeight;null!=(n=this.ogEvents)&&n.includes(null==t?void 0:t.action_type)&&(r+=i),null!=t&&t.is_sdk_auto_track?r+=a:r+=u;var c=e-(null==t?void 0:t.action_time)+1;return c>0?r+1/c:r}},{key:"formatWeight",value:function(e,t){var n=1e3,r=10,o=100;return e-t>2592e6&&(n/=100,r/=100,o/=100),{ogWeight:n,sdkWeight:r,userWeight:o}}}]),t}();Ue([Ne],Fe.prototype,"getReportableActions",1),Ue([Ne],Fe.prototype,"addAction",1),Ue([Ne],Fe.prototype,"removeActions",1),Ue([Ne],Fe.prototype,"updateActionsForReportFail",1),Ue([Ne],Fe.prototype,"updateActionsForReporting",1),Ue([Ne],Fe.prototype,"getReportableActionsLength",1),Ue([Ne],Fe.prototype,"sortQueue",1),Ue([Ne],Fe.prototype,"caculateWeight",1),Ue([Ne],Fe.prototype,"formatWeight",1);var Be=function(){function e(){x(this,e),this.events={}}return N(e,[{key:"subscribe",value:function(t,n){e.checkCallback(n),ge(this.events[t])?this.events[t].push(n):this.events[t]=[n]}},{key:"once",value:function(t,n){e.checkCallback(n),this.subscribe(this.onceEventName(t),n)}},{key:"unsubscribe",value:function(t,n){e.checkCallback(n),ge(this.events[t])&&(this.events[t]=this.events[t].filter(function(e){return e!==n})),ge(this.events[this.onceEventName(t)])&&(this.events[this.onceEventName(t)]=this.events[this.onceEventName(t)].filter(function(e){return e!==n}))}},{key:"publish",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=Date.now();ge(this.events[e])&&this.events[e].forEach(function(e){return e.apply(void 0,[o].concat(n))}),ge(this.events[this.onceEventName(e)])&&(this.events[this.onceEventName(e)].forEach(function(e){return e.apply(void 0,[o].concat(n))}),this.events[this.onceEventName(e)]=[])}},{key:"onceEventName",value:function(e){return"once_event_prefix_".concat(e)}}],[{key:"checkCallback",value:function(t){ye(t)||xe.error(e.ERROR_CALLBACK_IS_NOT_A_FUNCTION)}}]),e}(),Ve=Be;Ve.ERROR_CALLBACK_IS_NOT_A_FUNCTION="callback 不是函数";var Ke=new Ve,Ge=["REGISTER","VIEW_CONTENT","ADD_TO_CART","PURCHASE","COMPLETE_ORDER","ADD_TO_WISHLIST","START_APP","CREATE_ROLE","AUTHORIZE","TUTORIAL_FINISH","START_PAY","FINISH_PAY"],Je="START_APP",We="TICKET",He="ENTER_FOREGROUND",Ye="ENTER_BACKGROUND",Qe="LOGIN",ze="SHARE",$e="TAP_GAME_CLUB",Ze="CREATE_GAME_CLUB",Xe="JOIN_GAME_ROOM",et="FINISH_PAY",tt="START_PAY",nt="ADD_TO_WISHLIST",rt=["REGISTER","START_APP","RE_ACTIVE"],ot=["TICKET","ENTER_FOREGROUND","ENTER_BACKGROUND"],it=function(){function e(){x(this,e),this.channelClaimActionList=rt,this.noClaimActionList=ot,this.realTimeActionList=K.realTimeActionList,this.ticketInterval=60,this.requestTimeout=K.requestTimeout,this.loadConfig()}return N(e,[{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 e=this;try{if("undefined"==typeof wx)return;var t=te.getSync(F);t&&this.updateConfig(t),le({conf_name:"mini_game_sdk_common",conf_key:"config"}).then(function(t){t&&he(t)&&(e.updateConfig(t),te.setSync(F,t))})}catch(t){console.error(t)}}},{key:"updateConfig",value:function(e){e.channelClaimActionList&&ge(e.channelClaimActionList)&&(this.channelClaimActionList=e.channelClaimActionList),e.noClaimActionList&&ge(e.noClaimActionList)&&(this.noClaimActionList=e.noClaimActionList),e.realTimeActionList&&ge(e.realTimeActionList)&&(this.realTimeActionList=e.realTimeActionList),e.ticketInterval&&"number"==typeof e.ticketInterval&&e.ticketInterval>1&&e.ticketInterval!==this.ticketInterval&&(this.ticketInterval=e.ticketInterval,Ke.publish(ee)),e.requestTimeout&&"number"==typeof e.requestTimeout&&e.requestTimeout>5e3&&(this.requestTimeout=e.requestTimeout)}}]),e}(),at=new it,ut=Je,ct=We,st=He,lt=Ye,ft=function(){var e=!1,t=!1,n=!0,r=!0,o=!0,i=!1;return function(){if(!i){i=!0;var a=te.getSync(U);if((null==a?void 0:a.bg)===Z?e=!0:(null==a?void 0:a.bg)===X&&(e=!1),(null==a?void 0:a.fg)===Z?t=!0:(null==a?void 0:a.fg)===X&&(t=!1),(null==a?void 0:a.st)===Z?n=!0:(null==a?void 0:a.st)===X&&(n=!1),(null==a?void 0:a.ti)===Z?r=!0:(null==a?void 0:a.ti)===X&&(r=!1),xe.devLog("当前缓存开关 bgOn,fgOn,stOn,tiOn:",e,t,n,r),n&&Ke.publish(ut),r){var u=function(){o&&Ke.publish(ct)},c=setInterval(u,1e3*at.getTicketInterval());Ke.subscribe(ee,function(){c&&clearInterval(c),c=setInterval(u,1e3*at.getTicketInterval())})}wx.onShow(function(e){if(o=!0,t){var n="";try{(n=JSON.stringify(e)).length>1e4&&(n=JSON.stringify({cut:1,scene:e.scene}))}catch(e){}Ke.publish(st,{enter_options:n})}}),wx.onHide(function(){o=!1,e&&Ke.publish(lt)})}}}(),dt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function pt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vt,ht=pt(function(){var e,t=null;function n(e){return!!e&&("object"==I(e)||"function"==typeof e)}function r(e){if(null!==e&&!n(e))throw new TypeError("Object prototype may only be an Object or null: "+e)}var o=Object,i=!(!o.create&&{__proto__:null}instanceof o),a=o.create||(i?function(e){return r(e),{__proto__:e}}:function(e){if(r(e),null===e)throw new SyntaxError("Native Object.create is required to create objects with null prototype");var t=function(){};return t.prototype=e,new t}),u=function(){return null},c=o.getPrototypeOf||([].__proto__===Array.prototype?function(e){var t=e.__proto__;return n(t)?t:null}:u);return e=function(s,l){if(void 0===(this&&this instanceof e?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(){};t=function(){s=null,f=function(e){throw new TypeError("Cannot perform '".concat(e,"' on a proxy that has been revoked"))}},setTimeout(function(){t=null},0);var d=l;for(var p in l={get:null,set:null,apply:null,construct:null},d){if(!(p in l))throw new TypeError("Proxy polyfill does not support trap '".concat(p,"'"));l[p]=d[p]}"function"==typeof d&&(l.apply=d.apply.bind(d));var v,h=c(s),g=!1,y=!1;"function"==typeof s?(v=function(){var e=this&&this.constructor===v,t=Array.prototype.slice.call(arguments);return f(e?"construct":"apply"),e&&l.construct?l.construct.call(this,s,t):!e&&l.apply?l.apply(s,this,t):e?(t.unshift(s),new(s.bind.apply(s,t))):s.apply(this,t)},g=!0):s instanceof Array?(v=[],y=!0):v=i||null!==h?a(h):{};var m=l.get?function(e){return f("get"),l.get(this,e,v)}:function(e){return f("get"),this[e]},_=l.set?function(e,t){f("set"),l.set(this,e,t,v)}:function(e,t){f("set"),this[e]=t},A=o.getOwnPropertyNames(s),k={};A.forEach(function(e){if(!g&&!y||!(e in v)){var t={enumerable:!!o.getOwnPropertyDescriptor(s,e).enumerable,get:m.bind(s,e),set:_.bind(s,e)};o.defineProperty(v,e,t),k[e]=!0}});var S=!0;if(g||y){var b=o.setPrototypeOf||([].__proto__===Array.prototype?function(e,t){return r(t),e.__proto__=t,e}:u);h&&b(v,h)||(S=!1)}if(l.get||!S)for(var w in s)k[w]||o.defineProperty(v,w,{get:m.bind(s,w)});return o.seal(s),o.seal(v),v},e.revocable=function(n,r){return{proxy:new e(n,r),revoke:t}},e}),gt={};try{vt||(vt=ht())}catch(L){kt(L)}function yt(e,t,n,r){try{if(!vt||null==e||!e[t])return;e[t]=new vt(e[t],{apply:function(e,t,o){var i,a;r&&At(function(){return r.apply(void 0,A(o))});var u=!!(null!=(i=o[0])&&i.success||null!=(a=o[0])&&a.fail);u&&["success","fail"].forEach(function(e){if(o[0][e])try{o[0][e]=new vt(o[0][e],{apply:function(t,r,i){return At(function(){return n.apply(void 0,[e,o[0]].concat(A(i)))}),t.apply(r,i)}})}catch(e){kt(e)}});var c=e.apply(t,o);return!u&&c&&"[object Promise]"===Object.prototype.toString.call(c)?c.then(function(e){return At(function(){return n("success",o[0],e)}),e}).catch(function(e){throw At(function(){return n("fail",o[0],e)}),e}):c}})}catch(e){kt(e)}}function mt(e,t,n){try{if(!vt||null==e||!e[t])return;e[t]=new vt(e[t],{apply:function(e,t,r){var o="function"==typeof r[0];if(o)try{r[0]=new vt(r[0],{apply:function(e,t,r){var o=e.call.apply(e,[t].concat(A(r)));return At(function(){return n(o)}),o}})}catch(e){kt(e)}var i=e.call.apply(e,[t].concat(A(r)));return o||At(function(){return n(i)}),i}})}catch(e){kt(e)}}function _t(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4?arguments[4]:void 0;try{if(!vt||null==e||!e[t])return;e[t]=new vt(e[t],{apply:function(e,i,a){var u=e.call.apply(e,[i].concat(A(a)));return(!n||!gt[t])&&(At(function(){return null==o?void 0:o(u)}),r.forEach(function(e){var t=e.eventName,n=e.isAsync,r=e.proxyEvent;n?yt(u,t,r):mt(u,t,r)})),n&&(gt[t]=!0),u}})}catch(e){kt(e)}}function At(e){try{e()}catch(e){kt(e)}}function kt(e){ce({log_type:Y,message:null==e?void 0:e.message,err_stack:null==e?void 0:e.stack})}var St=Qe,bt=nt,wt=ze,Tt=$e,Rt=Ze,Ot=Xe,Et=tt,It=et,xt=function(){var e=!1;return function(){e||(e=!0,yt(wx,"login",function(e){"success"===e&&Ke.publish(St)}),mt(wx,"onAddToFavorites",function(){Ke.publish(bt)}),mt(wx,"onShareTimeline",function(){Ke.publish(wt,{target:"TIME_LINE",trigger:"MENU"})}),mt(wx,"onShareAppMessage",function(){Ke.publish(wt,{target:"APP_MESSAGE",trigger:"MENU"})}),mt(wx,"shareAppMessage",function(){Ke.publish(wt,{target:"APP_MESSAGE",trigger:"BUTTON"})}),_t(wx,"createGameClubButton",!1,[{isAsync:!1,eventName:"onTap",proxyEvent:function(){Ke.publish(Tt)}}],function(){Ke.publish(Rt)}),_t(wx,"getGameServerManager",!0,[{isAsync:!0,eventName:"createRoom",proxyEvent:function(e){"success"===e&&Ke.publish("CREATE_GAME_ROOM")}},{isAsync:!0,eventName:"joinRoom",proxyEvent:function(e){"success"===e&&Ke.publish(Ot)}}]),yt(wx,"requestMidasPayment",function(e,t){Ke.publish(It,{status:"success"===e?"SUCCESS":"FAIL",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"})},function(e){Ke.publish(Et,{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"})}),yt(wx,"requestMidasPaymentGameItem",function(e,t){var n=(t||{}).signData;Ke.publish(It,{status:"success"===e?"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(e){var t=(e||{}).signData;Ke.publish(Et,{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)||"",p:(null==t?void 0:t.goodsPrice)||0,productId:(null==t?void 0:t.productId)||"",payType:"MidasGameItem"})}))}}(),Ct=function(){function e(){x(this,e)}return N(e,null,[{key:"isEmpty",value:function(e){return null==e||"string"==typeof e&&""===e.trim()}},{key:"format",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.replace(/\${(\d+)}/g,function(e,t){return n[t]})}},{key:"customStringify",value:function(e){var t=[];try{return JSON.stringify(e,function(e,n){if(void 0===n)return"undefined";if("object"==I(n)&&null!==n){if(-1!==t.indexOf(n))return"[Circular]";t.push(n)}return"bigint"==typeof n?n.toString():n})}catch(e){return"[Param Error]"}}}]),e}(),Nt=/^([a-zA-Z][a-zA-Z\d_]{0,63})$/i,Pt=/^ams_reserved_(.*)/i,Lt=function(){function e(){x(this,e)}return N(e,null,[{key:"validateActionType",value:function(t){return Ct.isEmpty(t)?(xe.error(e.ERROR_ACTION_TYPE_NULL),!1):!!Nt.test(t)||(xe.error(e.ERROR_ACTION_TYPE_INVALID),!1)}},{key:"validateActionParam",value:function(t){if(!t)return!0;if(!he(t))return xe.error(e.ERROR_ACTION_PARAM_IS_NOT_OBJECT),!1;for(var n in t){if(Ct.isEmpty(n))return xe.error(e.ERROR_ACTION_PARAM_KEY_NULL),!1;if(!Nt.test(n))return xe.error(e.ERROR_ACTION_PARAM_KEY_INVALID),!1;Pt.test(n)&&xe.warn(e.WARN_ACTION_PARAM_KEY_RESERVED);var r=t[n];if(!e.isValidValue(r))return xe.error(Ct.format(e.ERROR_ACTION_PARAM_VALUE_INVALID,n,r)),!1;if(ge(r)){if(!e.isValidArrayValue(r)){for(var o=0;o<r.length;o++)xe.error(Ct.format(e.ERROR_ACTION_PARAM_VALUE_ARRAY_INVALID,n,Ct.customStringify(r),o,r[o]));return!1}if(!e.checkArrayElementTypes(r))return xe.error(e.ERROR_ACTION_PARAM_VALUE_ARRAY_TYPE_UNUNIQUE),!1}}return!0}},{key:"isValidValue",value:function(e){return null==e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e||ge(e)}},{key:"isValidArrayValue",value:function(e){for(var t=0;t<e.length;t++){var n=e[t];if("string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n)return!1}return!0}},{key:"checkArrayElementTypes",value:function(e){if(!e||e.length<=1)return!0;for(var t=I(e[0]),n=1;n<e.length;n++)if(I(e[n])!==t)return!1;return!0}}]),e}(),Mt=Lt;Mt.ERROR_ACTION_TYPE_NULL="在track方法中,action_type参数不能为空!",Mt.ERROR_ACTION_TYPE_INVALID="在track方法中,action_type参数只能包含字母、数字和下划线,且只能以字母开头,长度不能超过64个字符!",Mt.ERROR_ACTION_PARAM_KEY_NULL="在track方法中,action_param参数的key不能为空!",Mt.ERROR_ACTION_PARAM_KEY_INVALID="在track方法中,action_param参数的key只能包含字母、数字和下划线,且不能以数字开头,长度不能超过64个字符!",Mt.WARN_ACTION_PARAM_KEY_RESERVED="SDK内部预留参数的key均以'ams_reserved_'开头,该参数的值会被SDK内部覆盖,请不要使用!",Mt.ERROR_ACTION_PARAM_VALUE_INVALID="在track方法中,action_param参数的value必须是String/Number/Boolean/Array中的一种![key=${0}, value=${1}]",Mt.ERROR_ACTION_PARAM_VALUE_ARRAY_INVALID="在track方法中,如果action_param参数中的某个元素的value是Array,那么这个Array中的每个元素必须是String/Number/Boolean中的一种![key=${0}, value=${1}, 数组的第${2}个元素为${3}]",Mt.ERROR_ACTION_PARAM_VALUE_ARRAY_TYPE_UNUNIQUE="在track方法中,如果action_param参数中的某个元素的value是Array,那么这个Array中所有元素的类型必须是同一种!",Mt.ERROR_ACTION_PARAM_IS_NOT_OBJECT="action_param 参数不是Object";var Dt={exports:{}};!function(e){!function(t){function n(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function r(e,t,r,o,i,a){return n(function(e,t){return e<<t|e>>>32-t}(n(n(t,e),n(o,a)),i),r)}function o(e,t,n,o,i,a,u){return r(t&n|~t&o,e,t,i,a,u)}function i(e,t,n,o,i,a,u){return r(t&o|n&~o,e,t,i,a,u)}function a(e,t,n,o,i,a,u){return r(t^n^o,e,t,i,a,u)}function u(e,t,n,o,i,a,u){return r(n^(t|~o),e,t,i,a,u)}function c(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var r,c,s,l,f,d=1732584193,p=-271733879,v=-1732584194,h=271733878;for(r=0;r<e.length;r+=16)c=d,s=p,l=v,f=h,d=o(d,p,v,h,e[r],7,-680876936),h=o(h,d,p,v,e[r+1],12,-389564586),v=o(v,h,d,p,e[r+2],17,606105819),p=o(p,v,h,d,e[r+3],22,-1044525330),d=o(d,p,v,h,e[r+4],7,-176418897),h=o(h,d,p,v,e[r+5],12,1200080426),v=o(v,h,d,p,e[r+6],17,-1473231341),p=o(p,v,h,d,e[r+7],22,-45705983),d=o(d,p,v,h,e[r+8],7,1770035416),h=o(h,d,p,v,e[r+9],12,-1958414417),v=o(v,h,d,p,e[r+10],17,-42063),p=o(p,v,h,d,e[r+11],22,-1990404162),d=o(d,p,v,h,e[r+12],7,1804603682),h=o(h,d,p,v,e[r+13],12,-40341101),v=o(v,h,d,p,e[r+14],17,-1502002290),d=i(d,p=o(p,v,h,d,e[r+15],22,1236535329),v,h,e[r+1],5,-165796510),h=i(h,d,p,v,e[r+6],9,-1069501632),v=i(v,h,d,p,e[r+11],14,643717713),p=i(p,v,h,d,e[r],20,-373897302),d=i(d,p,v,h,e[r+5],5,-701558691),h=i(h,d,p,v,e[r+10],9,38016083),v=i(v,h,d,p,e[r+15],14,-660478335),p=i(p,v,h,d,e[r+4],20,-405537848),d=i(d,p,v,h,e[r+9],5,568446438),h=i(h,d,p,v,e[r+14],9,-1019803690),v=i(v,h,d,p,e[r+3],14,-187363961),p=i(p,v,h,d,e[r+8],20,1163531501),d=i(d,p,v,h,e[r+13],5,-1444681467),h=i(h,d,p,v,e[r+2],9,-51403784),v=i(v,h,d,p,e[r+7],14,1735328473),d=a(d,p=i(p,v,h,d,e[r+12],20,-1926607734),v,h,e[r+5],4,-378558),h=a(h,d,p,v,e[r+8],11,-2022574463),v=a(v,h,d,p,e[r+11],16,1839030562),p=a(p,v,h,d,e[r+14],23,-35309556),d=a(d,p,v,h,e[r+1],4,-1530992060),h=a(h,d,p,v,e[r+4],11,1272893353),v=a(v,h,d,p,e[r+7],16,-155497632),p=a(p,v,h,d,e[r+10],23,-1094730640),d=a(d,p,v,h,e[r+13],4,681279174),h=a(h,d,p,v,e[r],11,-358537222),v=a(v,h,d,p,e[r+3],16,-722521979),p=a(p,v,h,d,e[r+6],23,76029189),d=a(d,p,v,h,e[r+9],4,-640364487),h=a(h,d,p,v,e[r+12],11,-421815835),v=a(v,h,d,p,e[r+15],16,530742520),d=u(d,p=a(p,v,h,d,e[r+2],23,-995338651),v,h,e[r],6,-198630844),h=u(h,d,p,v,e[r+7],10,1126891415),v=u(v,h,d,p,e[r+14],15,-1416354905),p=u(p,v,h,d,e[r+5],21,-57434055),d=u(d,p,v,h,e[r+12],6,1700485571),h=u(h,d,p,v,e[r+3],10,-1894986606),v=u(v,h,d,p,e[r+10],15,-1051523),p=u(p,v,h,d,e[r+1],21,-2054922799),d=u(d,p,v,h,e[r+8],6,1873313359),h=u(h,d,p,v,e[r+15],10,-30611744),v=u(v,h,d,p,e[r+6],15,-1560198380),p=u(p,v,h,d,e[r+13],21,1309151649),d=u(d,p,v,h,e[r+4],6,-145523070),h=u(h,d,p,v,e[r+11],10,-1120210379),v=u(v,h,d,p,e[r+2],15,718787259),p=u(p,v,h,d,e[r+9],21,-343485551),d=n(d,c),p=n(p,s),v=n(v,l),h=n(h,f);return[d,p,v,h]}function s(e){var t,n="",r=32*e.length;for(t=0;t<r;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function l(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function f(e){var t,n,r="0123456789abcdef",o="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),o+=r.charAt(t>>>4&15)+r.charAt(15&t);return o}function d(e){return unescape(encodeURIComponent(e))}function p(e){return function(e){return s(c(l(e),8*e.length))}(d(e))}function v(e,t){return function(e,t){var n,r,o=l(e),i=[],a=[];for(i[15]=a[15]=void 0,o.length>16&&(o=c(o,8*e.length)),n=0;n<16;n+=1)i[n]=909522486^o[n],a[n]=1549556828^o[n];return r=c(i.concat(l(t)),512+8*t.length),s(c(a.concat(r),640))}(d(e),d(t))}function h(e,t,n){return t?n?v(t,e):function(e,t){return f(v(e,t))}(t,e):n?p(e):function(e){return f(p(e))}(e)}e.exports?e.exports=h:t.md5=h}(dt)}(Dt);var jt=pt(Dt.exports),qt="function"==typeof btoa,Ut="function"==typeof Buffer;"function"==typeof TextDecoder&&new TextDecoder;var Ft,Bt="function"==typeof TextEncoder?new TextEncoder:void 0,Vt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");Ft={},Vt.forEach(function(e,t){return Ft[e]=t});var Kt=String.fromCharCode.bind(String);"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array);var Gt=qt?function(e){return btoa(e)}:Ut?function(e){return Buffer.from(e,"binary").toString("base64")}:function(e){for(var t,n,r,o,i="",a=e.length%3,u=0;u<e.length;){if((n=e.charCodeAt(u++))>255||(r=e.charCodeAt(u++))>255||(o=e.charCodeAt(u++))>255)throw new TypeError("invalid character found");i+=Vt[(t=n<<16|r<<8|o)>>18&63]+Vt[t>>12&63]+Vt[t>>6&63]+Vt[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},Jt=Ut?function(e){return Buffer.from(e).toString("base64")}:function(e){for(var t=[],n=0,r=e.length;n<r;n+=4096)t.push(Kt.apply(null,e.subarray(n,n+4096)));return Gt(t.join(""))},Wt=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?Kt(192|t>>>6)+Kt(128|63&t):Kt(224|t>>>12&15)+Kt(128|t>>>6&63)+Kt(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return Kt(240|t>>>18&7)+Kt(128|t>>>12&63)+Kt(128|t>>>6&63)+Kt(128|63&t)},Ht=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Yt=Ut?function(e){return Buffer.from(e,"utf8").toString("base64")}:Bt?function(e){return Jt(Bt.encode(e))}:function(e){return Gt(function(e){return e.replace(Ht,Wt)}(e))},Qt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,$t=function(e,t,n,r){for(var o,i=r>1?void 0:r?zt(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Qt(t,n,i),i},Zt=function(){function e(t){var n=this;x(this,e),this.cgiBatchSize=K.cgiBatchSize,this.reportThreshold=K.reportThreshold,this.reportDelay=K.reportDelay,this.triggerExecuteSend=function(e){var t,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(t),t=setTimeout(function(){var t=e.apply(void 0,i);r.forEach(function(e){return e(t)}),r=[]},n),new Promise(function(e){return r.push(e)})}}(function(){n.executeSend()},1e3*this.reportDelay),this.inspectDelay=K.inspectDelay,this.inspectTimer=void 0,this.isNeedContinueSend=!1,this.getBaseInfo=t.getBaseInfo,this.reportLog=t.reportLog,this.queueManager=t.queueManager,this.configManager=t.configManager,this.onReportComplete=t.onReportComplete,this.onReportFail=t.onReportFail,this.flushSend(),this.startInspectTimer()}return N(e,[{key:"batchSend",value:function(){var e,t=this.queueManager.getReportableActions(this.reportThreshold);if(t.length>=this.reportThreshold)this.executeSend();else{var n=(null==(e=this.configManager)?void 0:e.getRealTimeActionList())||K.realTimeActionList;t.some(function(e){return n.indexOf(e.action_type)>-1&&!e.is_retry})?this.executeSend():this.triggerExecuteSend()}this.startInspectTimer()}},{key:"flushSend",value:function(){this.executeSend()}},{key:"executeSend",value:function(){var t=this;if(e.currentRequestCount>=e.requestConcurrency)this.isNeedContinueSend=!0;else{this.isNeedContinueSend=!1;var n=(e.requestConcurrency-e.currentRequestCount)*this.cgiBatchSize,r=this.queueManager.getReportableActions(n),o=this.getBaseInfo();if(!o.openid&&!o.unionid&&(xe.warn("请尽快调用 setOpenId 或 setUnionId 方法设置用户ID!"),r=r.filter(function(e){return null==e?void 0:e.ad_trace_id})),!(r.length<=0)){n<this.queueManager.getReportableActionsLength()&&(this.isNeedContinueSend=!0),e.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(e){var n=e.some(function(e){return e>=0});t.isNeedContinueSend&&n&&t.executeSend()}).catch(function(e){xe.error(e),t.reportLog({message:"executeSend catch: ".concat(e.message),log_type:G,err_stack:e.stack})})}}}},{key:"generateActionReportParams",value:function(e){var t=[],n=[],r=this.getBaseInfo();return e.forEach(function(e){n.push(e.action_id);var r=Object.assign({},e);delete r.inner_status,t.push(r)}),{data:{info:r,actions:t},actionIdList:n}}},{key:"dealSuccessData",value:function(e,t,n){[51001,51003].indexOf(null==e?void 0:e.code)>-1?this.queueManager.updateActionsForReportFail(t):this.queueManager.removeActions(t),0!==(null==e?void 0:e.code)&&(this.reportLog({log_type:J,code:null==e?void 0:e.code,message:"trace_id: ".concat(null==e?void 0:e.trace_id,",msg: ").concat(null==e?void 0:e.message)}),xe.error("上报失败:",e)),this.doTrackCallbackFn(this.onReportComplete,e,n),-1===[0,51001,51003].indexOf(null==e?void 0:e.code)&&this.doTrackCallbackFn(this.onReportFail,e,n)}},{key:"dealFailData",value:function(e,t,n){this.queueManager.updateActionsForReportFail(t),this.reportLog({log_type:J,code:e.code,message:e.message}),xe.error("上报失败:",e),this.doTrackCallbackFn(this.onReportComplete,e,n)}},{key:"report",value:function(t){var n=this,r=t.data,o=t.actionIdList;return this.queueManager.updateActionsForReporting(o),xe.debug&&(xe.info("上报行为类型: ","【".concat(r.actions.map(function(e){return e.action_type}).join("、"),"】")),xe.info("上报请求参数: ",r)),new Promise(function(t){var i,a,u,c,s,l,f,d,p=Date.now();try{var v=function(e){var t="",n=null==e?void 0:e.appid,r=null==e?void 0:e.secret_key,o=null==e?void 0:e.sdk_version,i=null==e?void 0:e.timestamp;if(!(n&&r&&o&&i&&32===r.length))return t;for(var a=jt(o+n+i),u=0;u<32;u++)t+=u%2==0?r[u]:a[u];return t}({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}),h=function(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?function(e){return e.replace(/=/g,"").replace(/[+\/]/g,function(e){return"+"==e?"-":"_"})}(Yt(e)):Yt(e)}(JSON.stringify(r));f={"Client-Time":p,"Sign-Value":jt(h+(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)+v),"Sign-Version":K.signVersion,"content-type":"text/plain;charset=UTF-8"},d=h}catch(v){f={"Client-Time":p},d=r,n.reportLog({log_type:z,message:"sign error msg: ".concat(null==v?void 0:v.message),err_stack:null==v?void 0:v.stack}),xe.error(v)}wx.request({url:"https://api.datanexus.qq.com/data-nexus-cgi/miniprogram",method:"POST",timeout:(null==(l=n.configManager)?void 0:l.getRequestTimeout())||K.requestTimeout,header:f,data:d,success:function(i){var a,u;xe.devLog("上报接口返回码:",null==(a=null==i?void 0:i.data)?void 0:a.code);var c=(null==(u=null==i?void 0:i.header)?void 0:u["Server-Time"])||-1;if(se.revise(c),e.currentRequestCount-=1,200===(null==i?void 0:i.statusCode))return n.dealSuccessData(null==i?void 0:i.data,o,r),void t((null==i?void 0:i.data).code);var s="";try{s="object"==I(null==i?void 0:i.data)?JSON.stringify(null==i?void 0:i.data):null==i?void 0:i.data}catch(e){xe.error(e)}var l={code:"number"==typeof(null==i?void 0:i.statusCode)?-1*i.statusCode:-888,message:"statusCode: ".concat(null==i?void 0:i.statusCode,", data: ").concat(s)};n.dealFailData(l,o,r),t(l.code)},fail:function(i){xe.devLog("上报失败:",i),e.currentRequestCount-=1;var a={code:"number"==typeof(null==i?void 0:i.errno)?-1*i.errno:-999,message:null==i?void 0:i.errMsg};n.dealFailData(a,o,r),t(a.code)}})})}},{key:"startInspectTimer",value:function(){var t=this;clearTimeout(this.inspectTimer),this.inspectTimer=setTimeout(function(){e.currentRequestCount>=e.requestConcurrency&&(e.currentRequestCount=e.requestConcurrency-1),t.executeSend(),t.startInspectTimer()},1e3*this.inspectDelay)}},{key:"doTrackCallbackFn",value:function(e,t,n){if("function"==typeof e)try{for(var r=[],o=0;o<n.actions.length;o++)if(!n.actions[o].is_sdk_auto_track){var i=n.actions[o],a=i.action_type,u=i.action_param,c=i.action_id,s=i.action_time;r.push({action_type:a,action_param:u,action_id:c,action_time:s})}if(r.length){var l=n.info,f=l.user_action_set_id,d=l.appid,p=l.openid,v=l.unionid,h=l.user_unique_id;e({code:null==t?void 0:t.code,message:null==t?void 0:t.message,data:{actions:r,info:{user_action_set_id:f,appid:d,openid:p,unionid:v,user_unique_id:h}}})}}catch(r){xe.error("返回上报回调数据异常:",r)}}}],[{key:"setRequestConcurrency",value:function(t){"number"==typeof t?t<1?xe.error("网络请求最大并发量不能小于1"):t>10?xe.error("网络请求最大并发量不能大于10"):e.requestConcurrency=t:xe.error("网络请求最大并发量需设置为数字")}}]),e}(),Xt=Zt;Xt.currentRequestCount=0,Xt.requestConcurrency=K.requestConcurrency,$t([Ne],Xt.prototype,"batchSend",1),$t([Ne],Xt.prototype,"flushSend",1),$t([Ne],Xt.prototype,"executeSend",1);var en=Je,tn=We,nn=He,rn=Ye,on=Qe,an=nt,un=ze,cn=$e,sn=Ze,ln=Xe,fn=tt,dn=et,pn=function(){function e(){x(this,e)}return N(e,[{key:"install",value:function(e,t){var n=function(t){Ke.subscribe(t,function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.track(t,Object.assign(n||{},o,_(_({},Rn,!0),On,r)))}}(t))};n(tn),n(en),n(nn),n(rn),"all"===t&&(n(on),n(an),n(un),n(sn),n(cn),n("CREATE_GAME_ROOM"),n(ln),n(fn),n(dn))}}]),e}(),vn=function(){function e(){x(this,e),this.special_method_symbol=Symbol("special_method_symbol")}return N(e,[{key:"onPurchase",value:function(e){return"number"!=typeof e&&xe.warn("付费金额需要为数字"),e<=0&&xe.warn("付费金额需要大于0"),this.wrapTrack("PURCHASE",{value:e})}},{key:"onEnterForeground",value:function(){return this.wrapTrack("ENTER_FOREGROUND")}},{key:"onEnterBackground",value:function(){return this.wrapTrack("ENTER_BACKGROUND")}},{key:"onAppStart",value:function(){return this.wrapTrack("START_APP")}},{key:"onAppQuit",value:function(){return this.wrapTrack("APP_QUIT")}},{key:"onAddToWishlist",value:function(){return this.wrapTrack("ADD_TO_WISHLIST")}},{key:"wrapTrack",value:function(e,t){return this.track(e,Object.assign(t||{},_({},this.special_method_symbol,1)))}}]),e}(),hn=function(){b(t,vn);var e=T(t);function t(){return x(this,t),e.apply(this,arguments)}return N(t,[{key:"onRegister",value:function(){return this.wrapTrack("REGISTER")}},{key:"onCreateRole",value:function(e){return e&&"string"!=typeof e&&xe.warn("角色名称需要为字符串"),this.wrapTrack("CREATE_ROLE",e?{name:e}:{})}},{key:"onTutorialFinish",value:function(){return this.wrapTrack("TUTORIAL_FINISH")}}]),t}(),gn="(如果确认无误,请忽略该提示)",yn=function(){var e=[];return{requestActionList:function(){try{le({conf_name:"data_nexus_common",conf_key:"action_types"}).then(function(t){ge(t)&&(e=t)})}catch(e){xe.error(e)}},getActionList:function(){return e}}}();function mn(e,t){try{e.is_sdk_auto_track||(function(e){try{var t=yn.getActionList();if(!t.includes(e)){var n,r=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=k(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}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 o,i=!0,a=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(a)throw o}}}}(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(_n(o,e)<=parseInt((.3*o.length).toString())){xe.warn("通过SDK上报的".concat(e,"行为名称可能有误,请检查该行为类型是否为腾讯广告提供的标准行为!").concat(gn));break}}}catch(e){r.e(e)}finally{r.f()}}}catch(t){xe.error(t)}}(e.action_type),"minigame"===t?function(e,t){var n,r,o;try{["PURCHASE","ADD_TO_CART"].includes(e.action_type)&&e.action_param&&Oe(e.action_param,"value")&&("number"!=typeof(null==(n=e.action_param)?void 0:n.value)?xe.warn("通过SDK上报的".concat(e.action_type,"行为携带的金额参数需要为数字!")):(null==(r=e.action_param)?void 0:r.value)<=0?xe.warn("通过SDK上报的".concat(e.action_type,"行为携带的金额参数需要大于0!")):"minigame"===t&&(null==(o=e.action_param)?void 0:o.value)<100&&xe.warn("通过SDK上报的".concat(e.action_type,"行为携带的金额参数可能有误,金额的单位为‘分’,请检查金额是否正确!").concat(gn)))}catch(e){xe.error(e)}}(e,t):"miniprogram"===t&&function(e){try{var t=null==e?void 0:e.action_type,n=(null==e?void 0:e.action_param)||{};"PURCHASE"===t&&Oe(n,"value")&&("number"!=typeof(null==n?void 0:n.value)?xe.warn("通过SDK上报的".concat(t,"行为携带的金额参数需要为数字!")):(null==n?void 0:n.value)<=0&&xe.warn("通过SDK上报的".concat(t,"行为携带的金额参数需要大于0!")))}catch(t){xe.error(t)}}(e))}catch(e){xe.error(e)}}function _n(e,t){try{if(0===e.length)return t.length;if(0===t.length)return e.length;for(var n=[],r=0;r<=t.length;r++)n[r]=[r];for(var o=0;o<=e.length;o++)n[0][o]=o;for(var i=1;i<=t.length;i++)for(var a=1;a<=e.length;a++)t.charAt(i-1)===e.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[t.length][e.length]}catch(n){xe.error(n)}}function An(e){try{e&&!/^[a-zA-Z0-9_\-]+$/.test(e)&&xe.warn("通过SDK上报的openid:".concat(e,"可能有误,请检查openid是否正确!").concat(gn))}catch(e){xe.error(e)}}var kn,Sn=Object.defineProperty,bn=Object.getOwnPropertyDescriptor,wn=function(e,t,n,r){for(var o,i=r>1?void 0:r?bn(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Sn(t,n,i),i},Tn=Symbol("initializedInstance"),Rn=Symbol("autoTrack"),On=Symbol("actionTime"),En=function(){b(t,hn);var e=T(t);function t(n){var r;if(x(this,t),(r=e.call(this)).env="production",r.sdk_version="1.5.5",r.sdk_name="@dn-sdk/minigame",r.deviceInfo={},r.gameInfo={},r.session_id="",r.log_id=0,r.inited=!1,r.initErrMsg="",null==wx||!wx.createCanvas)return r.initErrMsg="不支持非微信小游戏中使用",xe.error(r.initErrMsg),R(r);var o=Re();if(t[Tn].length>=o.maxSdkInstance)return r.initErrMsg="初始化超过上限",xe.error(r.initErrMsg),R(r);var i=function(e){return he(e)?(function(e){var t=["user_action_set_id","secret_key","appid","openid","unionid","user_unique_id","auto_track","auto_attr","on_report_fail","on_report_complete"];for(var n in e)t.includes(n)||xe.warn("Invalid property '".concat(n,"' found in config"))}(e),"number"!=typeof e.user_action_set_id?"user_action_set_id 参数需为 number 类型":e.user_action_set_id<=0?"user_action_set_id 参数需大于 0":"string"!=typeof e.secret_key?"secret_key 参数需为 string 类型":""===e.secret_key.trim()?"缺少 secret_key 参数":32!==e.secret_key.length?"secret_key 参数需为 32 位字符串":"string"!=typeof e.appid?"appid 参数需为 string 类型":""!==e.appid.trim()||"缺少 appid"):"初始化参数需为 object 类型"}(n),a=ae();if(!0!==i)return r.initErrMsg=i,xe.error(i),R(r);var u=null==a?void 0:a.appId;if(u&&u!==n.appid)return r.initErrMsg="初始化传入的appid与当前小游戏appid不一致",xe.error(r.initErrMsg),R(r);r.config=n,Oe(n,"auto_track")||(r.config.auto_track=Te("autoTrack")),r.openid=n.openid,r.unionid=n.unionid,r.user_unique_id=n.user_unique_id,r.onReportComplete=n.on_report_complete,r.onReportFail=n.on_report_fail,r.saveValidOpenidToStorage();var c=n.user_action_set_id;return t[Tn].includes(c)?(r.initErrMsg="同个数据源[".concat(c,"]只能初始化一次"),xe.error(r.initErrMsg),r.reportLog({log_type:G,message:r.initErrMsg}),R(r)):(r.reportLog=r.reportLog.bind(O(r)),r.getTrackBaseInfo=r.getTrackBaseInfo.bind(O(r)),r.deviceInfo=ne(),r.gameInfo=Ce(),r.session_id=_e(),r.queueManage=new Fe({userActionSetId:c,maxLength:o.maxQueueLength,ogEvents:Ge}),r.actionReporter=new Xt({getBaseInfo:r.getTrackBaseInfo,reportLog:r.reportLog,queueManager:r.queueManage,configManager:at,onReportComplete:r.onReportComplete,onReportFail:r.onReportFail}),r.inited=!0,t[Tn].push(c),r.useAutoTrack(),r.doReportOnEnterBackground(),"release"===(null==a?void 0:a.envVersion)?(xe.info("初始化成功"),R(r)):(function(e){var t=e.sdk_version,n=e.default_download_url,r=e.fail_handler;le({conf_name:e.conf_name,conf_key:e.conf_key}).then(function(e){if(he(e)){var o=null==e?void 0:e.blackVersions,i=null==e?void 0:e.minVersion,a=null==e?void 0:e.bestVersion,u=null==e?void 0:e.downloadUrl,c=n;return u&&/^https/.test(u)&&(c=u),ge(o)&&(null==o?void 0:o.indexOf(t))>-1?(null==r||r(),void xe.error("初始化失败!当前SDK版本存在兼容问题,请尽快升级至最新版!下载地址:".concat(c))):i&&we(t,i)<0?(null==r||r(),void xe.error("初始化失败!当前SDK版本过低,请尽快升级至最新版!下载地址:".concat(c))):(a&&we(t,a)<0&&xe.warn("新版本SDK已上线,强烈建议您升级至最新版,尽早享受新特性!下载地址:".concat(c)),void xe.info("初始化成功"))}xe.info("初始化成功")}).catch(function(){xe.info("初始化成功")})}({conf_name:"mini_game_sdk_common",conf_key:"version",sdk_version:r.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(){r.inited=!1}}),yn.requestActionList(),An(n.openid),R(r)))}return N(t,[{key:"getInitResult",value:function(){return{inited:this.inited,initErrMsg:this.initErrMsg}}},{key:"track",value:function(e,t){var n,r;if(!this.inited||!this.queueManage)return xe.error("上报失败,请先完成初始化"),{code:100,message:"未完成初始化或重复初始化导致初始化失败,请先完成初始化"};var o=Mt.validateActionType(e),i=Mt.validateActionParam(t);if(o&&i){!this.openid&&!this.unionid&&xe.warn("缺少 openid 或 unionid");var a=Te("actionParamMaxLength");if(JSON.stringify(t||{}).length>a)return xe.error("监测到超过".concat(a,"的上报日志:").concat(e," ").concat(t)),{code:102,message:"action_param 参数过大,不能超过 ".concat(a," 字符")};var u=!(null==t||!t[Rn]),c=this.createAction(e,t||{},u);"release"!==(null==(n=ae())?void 0:n.envVersion)&&mn(c,"minigame");var s=this.queueManage.addAction(c);return null==(r=this.actionReporter)||r.batchSend(),s}return{code:101,message:"action_type 或 action_param 参数错误"}}},{key:"flush",value:function(){var e;null==(e=this.actionReporter)||e.flushSend()}},{key:"setOpenId",value:function(e){var t;if(e&&"string"==typeof e)return this.openid=e,this.gameInfo.ad_trace_id&&!te.getSync(B)&&Ke.publish("START_APP"),this.flush(),this.saveValidOpenidToStorage(),"release"!==(null==(t=ae())?void 0:t.envVersion)&&An(e),{code:0,message:"成功"};var n="openid 格式错误";return xe.error(n),{code:101,message:n}}},{key:"setUnionId",value:function(e){if(e&&"string"==typeof e)return this.unionid=e,this.flush(),{code:0,message:"成功"};var t="unionid 格式错误";return xe.error(t),{code:101,message:t}}},{key:"setUserUniqueId",value:function(e){if(e&&"string"==typeof e)return this.user_unique_id=e,{code:0,message:"成功"};var t="user_unique_id 格式错误";return xe.error(t),{code:101,message:t}}},{key:"doReportOnEnterBackground",value:function(){var e=this;wx.onHide(function(){var t,n;null==(t=e.actionReporter)||t.flushSend(),null==(n=e.queueManage)||n.reportLostNum()})}},{key:"getTrackBaseInfo",value:function(){var e=ae();return Object.assign({},this.deviceInfo,function(e){var t={};return["user_action_set_id","appid","openid","secret_key","user_unique_id","unionid"].forEach(function(n){Oe(e,n)&&(t[n]=e[n])}),t}(this.config),{local_id:re(),sdk_name:this.sdk_name,sdk_version:this.sdk_version,openid:this.openid||ie(),unionid:this.unionid,user_unique_id:this.user_unique_id,inner_param:{app_env_version:e.envVersion,app_version:e.version}})}},{key:"createAction",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];null!=t&&t[Rn]&&delete t[Rn];var r=Date.now();null!=t&&t[On]&&(r=null==t?void 0:t[On],delete t[On]);var o={action_id:_e(),action_param:t,action_time:r,action_type:e,is_retry:!1,is_sdk_auto_track:n,retry_count:0,revised_action_time:se.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:oe(),ad_trace_id:this.gameInfo.ad_trace_id,channel:this.getChannelByActionType(e)};return null!=t&&t[this.special_method_symbol]&&(this.addActionInnerParam(o,"is_special_method",!0),delete t[this.special_method_symbol]),at.getChannelClaimActionList().indexOf(e)>-1&&this.gameInfo.launch_options&&this.addActionInnerParam(o,"launch_options",this.gameInfo.launch_options),o}},{key:"addActionInnerParam",value:function(e,t,n){e.inner_param&&he(e.inner_param)?e.inner_param[t]=n:e.inner_param=_({},t,n)}},{key:"getChannelByActionType",value:function(e){var t="";return at.getChannelClaimActionList().indexOf(e)>-1?t=this.gameInfo.channel||"":at.getNoClaimActionList().indexOf(e)>-1&&(t="UNKNOWN"),t}},{key:"reportLog",value:function(e){var t,n,r={user_action_set_id:null==(t=this.config)?void 0:t.user_action_set_id,appid:null==(n=this.config)?void 0:n.appid,session_id:this.session_id};ce(Object.assign(r,e))}},{key:"useAutoTrack",value:function(){var e;if(null!=(e=this.config)&&e.auto_track){var t=!0,n=te.getSync(U);(null==n?void 0:n.ap)===Z?t=!0:(null==n?void 0:n.ap)===X&&(t=!1),"devtools"===ne().wx_platform&&(t=!0),(new pn).install(this,t?"all":"lifecycle"),ft(),t&&xt(),this.getAutoProxyRemoteConfig()}}},{key:"getAutoProxyRemoteConfig",value:function(){var e,t,n=ne();n.os&&n.os_version&&null!=(e=this.config)&&e.user_action_set_id&&function(e){return new Promise(function(t){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/minigame/get",data:e,timeout:K.requestTimeout,success:function(e){fe(e,t,"minigame/get"),pe(e)},fail:function(e){de(e,"minigame/get")}})})}({conf_name:"MG",conf_param:{user_action_set_id:null==(t=this.config)?void 0:t.user_action_set_id,sdk_version:this.sdk_version,os_type:(null==n?void 0:n.os)||"",os_version:Ee(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(e){he(e)&&te.setSync(U,e)})}},{key:"saveValidOpenidToStorage",value:function(){this.openid&&function(e){return/^[a-zA-Z0-9_-]{28,30}$/.test(e)}(this.openid)&&te.setSync(B,this.openid)}}],[{key:"setRequestConcurrency",value:function(e){Xt.setRequestConcurrency(e)}},{key:"setDebug",value:function(e){xe.debug=e}}]),t}(),In=En;In[Tn]=[],wn([Ne],In.prototype,"track",1),wn([Ne,function(e,t,n){var r=n.value;return n.value=function(){if(this.inited){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.apply(this,t)}xe.error("上报失败,请先完成初始化")},n}],In.prototype,"flush",1),wn([Ne],In.prototype,"setOpenId",1),wn([Ne],In.prototype,"setUnionId",1),wn([Ne],In.prototype,"setUserUniqueId",1),wn([Ne],In.prototype,"doReportOnEnterBackground",1),wn([Ne],In.prototype,"getTrackBaseInfo",1),wn([Ne],In.prototype,"useAutoTrack",1);var xn=0,Cn={moid:""},Nn=!1,Pn=JSON.stringify(wx.getLaunchOptionsSync()||""),Ln={token:"",uid:"",uname:"",openid:""},Mn={partner_id:"",game_id:"",pkg_name:"",version:""},Dn={doid:"",dsid:"",dsname:"",dext:"",drid:"",drname:"",drlevel:"",dmoney:"",money:""},jn="wx-adapter sdk >>>>>>>:";wx.hideShareMenu(),wx.onShow(function(e){e.query&&(Pn=JSON.stringify(e))});var qn=function(e){var t=r(r({},g()),v),n=d(r(r(r(r(r({},Dn),Ln),Mn),t),{},{launchoption:Pn,onshow:Pn}));s(c,"/wxgamemds/index/",n).then(function(t){t.state&&(t.data.balance>=e?Fn(""):Un(t.data,e))}).catch(function(e){console.log(e)})},Un=function(e,t){wx.requestMidasPayment({mode:"game",env:e.env,offerId:e.offerId,currencyType:e.currencyType,platform:e.platform,buyQuantity:e.buyQuantity,outTradeNo:Cn.moid,success:function(e){kn&&kn.onPurchase(100*t),Fn(e)},fail:function(e){console.log(e)}})},Fn=function(e){var t;xn++;var n=r(r({},g()),v);t=d(e?r(r(r(r(r(r({},Dn),Mn),Ln),n),Cn),{},{res:JSON.stringify(e),launchoption:Pn,onshow:Pn}):r(r(r(r(r(r({},Dn),Mn),Ln),Cn),n),{},{launchoption:Pn,onshow:Pn})),s(c,"/wxgamemds/send/",t).then(function(e){console.log(e)}).catch(function(t){console.log(t),xn<3&&setTimeout(function(){Fn(e)},1e3)})},Bn=function(e){return new Promise(function(t,n){var o=Ln||{},i=o.token,a=o.uid,l=o.uname;if(!(Nn&&i&&a&&l))return u("未激活或未登录,请重新进入游戏"),n({state:100001,msg:"未激活或未登录,请检查"});var f=d(r(r(r(r(r({},e),Ln),Mn),r(r({},g()),v)),{},{launchoption:Pn,onshow:Pn}));s(c,"/wxgameevent/index/",f).then(function(){t(),kn&&("create"===f.event&&kn.onCreateRole(f.drname),"levelup"===f.event&&kn.track("UPDATE_LEVEL",{level:f.drlevel,power:0}))}).catch(function(e){console.log(e),n({state:100002,msg:"角色上报失败"})})})},Vn=null,Kn=!1,Gn=!1;e.jf_SSEventReport=function(e){return new Promise(function(t,n){var r=Ln||{},o=r.token,i=r.uid,a=r.uname;return Nn&&o&&i&&a?Array.isArray(e)?e.length?void l(c,"/report/batch/event",{body:e}).then(function(){t({state:0,msg:"上报成功!"})}).catch(function(e){n({state:100004,msg:JSON.stringify(e)})}):n({state:100003,msg:"入参不能为数组空,请检查"}):n({state:100002,msg:"入参需要数组,请检查"}):(u("请先激活登录"),n({state:100001,msg:"未激活或未登录,请重新进入游戏"}))})},e.jf_SSUserPropsReport=function(e){return new Promise(function(t,n){var r=Ln||{},o=r.token,i=r.uid,a=r.uname;return Nn&&o&&i&&a?Array.isArray(e)?e.length?void l(c,"/report/batch/attribute",{body:e}).then(function(){t({state:0,msg:"上报成功!"})}).catch(function(e){n({state:100004,msg:JSON.stringify(e)})}):n({state:100003,msg:"入参不能为数组空,请检查"}):n({state:100002,msg:"入参需要数组,请检查"}):(u("请先激活登录"),n({state:100001,msg:"未激活或未登录,请重新进入游戏"}))})},e.jf_active=function(e){return new Promise(function(t,n){if(!e)return n({state:100001,msg:"激活入参缺失"});if(null==e||!e.wx)return n({state:100002,msg:"激活入参 wx 属性缺失"});var r=e.wx,o=r.game_id,i=r.version,a=r.dn_sdk_id,u=r.dn_secret_key;if(!o)return n({state:100003,msg:"激活入参 game_id 属性缺失"});Mn.game_id=o,Mn.version=i,Mn.pkg_name="wxgame",Mn.partner_id=4,Nn=!0,console.log("active 激活成功!"),a&&u&&function(e){var t=e.dn_sdk_id,n=e.dn_secret_key,r=e.app_id,o=(kn=new In({appid:r,secret_key:n,user_action_set_id:t})).getInitResult();null!=o&&o.inited||console.error("dnSdk init failed: ",o.initErrMsg),kn.onAppStart(),wx.onAddToFavorites(function(e){console.log(jn+"click onAddToFavorites"),kn&&kn.track("DD_TO_WISHLIST",{type:"default"})}),wx.onShareAppMessage(function(){console.log(jn+"click onShareAppMessage"),kn&&kn.track("SHARE",{target:"APP_MESSAGE"})}),wx.onShareTimeline(function(){console.log(jn+"click onShareTimeline"),kn&&kn.track("SHARE",{target:"TIME_LINE"})}),console.log(jn+"广点通初始化成功!")}(wx),t()})},e.jf_createRewardedVideoAd=function(e){var t=function(){return new Promise(function(t,n){if(Kn)return t();Vn&&(Vn=null),(Vn=wx.createRewardedVideoAd({adUnitId:e})).onError(function(e){Kn=!1,Vn=null,n({state:100004,msg:"广告平台异常",originalErr:e})}),Vn.load().then(function(){console.log("激励视频广告预加载成功"),Kn=!0,t()}).catch(function(e){console.error("激励视频广告预加载失败:",e),Kn=!1,Vn=null,n(e)})})},n=function(){return Gn?Promise.reject({state:100004,msg:"广告正在展示中,请稍后再试"}):Kn?Vn?(Gn=!0,new Promise(function(e,t){Vn.onClose(function(t){console.log("激励视频广告关闭,是否看完:",t.isEnded),e({isEnded:t.isEnded}),Gn=!1,Vn.offClose()}),Vn.show().then(function(){console.log("激励视频广告展示成功")}).catch(function(e){Kn=!1,Gn=!1,t({state:100003,msg:JSON.stringify(e)})})})):Promise.reject({state:100002,msg:"广告实例不存在"}):t().then(n).catch(function(e){return Promise.reject({state:100001,msg:JSON.stringify(e)})})};return{preload:t,show:n}},e.jf_customerService=function(e){wx.openCustomerServiceConversation({success:function(){Bn(r(r({},p(e)),{},{event:"kfclick"}))}})},e.jf_getUserInfo=function(){return new Promise(function(e,t){wx.getSetting({success:function(n){n.authSetting["scope.userInfo"]?wx.getUserInfo({success:function(t){return e(t.userInfo)},fail:function(e){return t({state:100001,msg:JSON.stringify(e)})}}):wx.getUserProfile({desc:"获取用户信息",success:function(t){return e(t.userInfo)},fail:function(e){return t({state:100002,msg:JSON.stringify(e)})}})}})})},e.jf_login=function(){return new Promise(function(e,t){if(!Nn)return t({state:100003,msg:"登录前请先激活"});wx.login({success:function(n){var o=d(r(r(r({code:n.code},Mn),m()),{},{launchoption:Pn,onshow:Pn}));s(c,"/wxgamelogin/initlogin/",o).then(function(n){if(1==n.state){var r=n.data,o=r.token,i=r.uid,a=r.uname,c=r.openid,s=r.show_page;if(Ln.token=o,Ln.uid=i,Ln.uname=a,Ln.openid=c,wx.setStorageSync("jfGamekitSSToken",o),e({token:o,uid:i,uname:a,partner_id:4,show_page:s}),console.log(jn+"登录成功"),c&&kn){var l=n||{},f=l.backFlowDay,d=l.isRegisterUser;!function(e){var t=e.openid,n=e.nsSdk,r=e.backFlowDay,o=e.isRegisterUser;n.setOpenId(t),o?n.onRegister():r&&r>=30&&n.track("RE_ACTIVE",{backFlowDay:30})}({openid:c,nsSdk:kn,backFlowDay:f,isRegisterUser:d})}}else u(n.msg),t({state:n.state,msg:n.msg})}).catch(function(e){u(e),t({state:100001,msg:e})})},fail:function(e){t({state:100002,msg:e})}})})},e.jf_pay=function(e){return new Promise(function(t,n){var o=Ln||{},i=o.token,a=o.uid,l=o.uname;if(!(Nn&&i&&a&&l))return u("失败!请先激活登录"),n({state:100001,msg:"未激活或未登录,请重新进入游戏"});wx.showLoading({title:"加载中"});var f=e.dmoney;(Dn=p(e)||{}).money=f;var h=d(r(r(r(r(r({},e),Mn),Ln),r(r(r({},g()),y()),v)),{},{money:f,launchoption:Pn,onshow:Pn}));s(c,"/wxgameorder/index/",h).then(function(e){var r=e||{},o=r.state,i=r.msg,a=r.data,l=void 0===a?{}:a;if(1==o){var p=l.aid,v=l.moid,h=l.thumb_url;Cn.moid=v,1==p?(qn(f),t({msg:"ok"})):2==p?wx.showModal({title:"支付提示",content:"即将打开充值入口,输入“充值”或点击右下角卡片即可充值。",showCancel:!1,confirmText:"点我充值",success:function(e){e.confirm?wx.openCustomerServiceConversation({sessionFrom:v,sendMessagePath:"/path/index/index?moid="+v,showMessageCard:!0,sendMessageImg:h,success:function(e){console.log("openCustomerServiceConversation success",e),t()},fail:function(e){console.error("openCustomerServiceConversation fail ",e),n({state:100003,msg:"支付失败"})},complete:function(e){console.log("openCustomerServiceConversation compelte: ",v),function(e){var t=m(),n=d({partner_id:Mn.partner_id,pkg_name:Mn.pkg_name,game_id:Mn.game_id,uid:Ln.uid,openid:Ln.openid,token:Ln.token,uname:Ln.uname,duid:t.duid,moid:e});s(c,"/wxgameorder/get/",n).then(function(e){1==e.data.status&&kn.onPurchase(100*e.data.money)})}(v)}}):(u("用户取消支付"),n({state:100005,msg:"取消支付"}))},fail:function(){u("用户取消支付"),n({state:100006,msg:"支付失败"})}}):(u("失败!设备未识别"),n({state:100004,msg:"支付失败"}))}else u(i),n({state:o,msg:i});wx.hideLoading()}).catch(function(e){u(e),n({state:100002,msg:"支付失败"}),wx.hideLoading()})})},e.jf_profanityCheck=function(e){return new Promise(function(t,n){var o=d(r(r(r(r(r({},e),Mn),Ln),m()),{},{launchoption:Pn,onshow:Pn,partner_id:4}));s(c,"/wxgamesafe/verify/",o).then(function(e){var r=e.data,o=r.code,i=r.msg;1==o?t():n({state:100001,msg:i})}).catch(function(e){n({state:100002,msg:e})})})},e.jf_share=function(e){wx.shareAppMessage(),Bn(r(r({},p(e)),{},{event:"fxclick"}))},e.jf_showInterstitialAd=function(e){return new Promise(function(t,n){var r=!1,o=wx.createInterstitialAd({adUnitId:e});o.onError(function(e){r=!0}),o.load().then(function(){if(!r)return o.show();n({state:100001,msg:"广告加载后发生错误"})}).then(t).catch(function(e){return n({state:100002,msg:JSON.stringify(e)})}),o.onClose(function(e){console.log("广告关闭:",e.isEnded?"正常播放完成":"用户提前关闭")})})},e.jf_trace=Bn,e.jf_tracePageView=function(e){return new Promise(function(t,n){kn?(kn.track("VIEW_CONTENT",{item:e}),t()):n({state:100001,msg:"上报失败!广点通 sdk 未初始化"})})},Object.defineProperty(e,"__esModule",{value:!0})});