const e={expireTime:null,enableCache:!0},t=/* @__PURE__ */new Map;function r(e){return null!==e.expireAt&&Date.now()>e.expireAt}function n(r,n,o){const i={...e,...o},a=function(e,t){const r=Date.now();return{data:e,expireAt:t?r+t:null,createAt:r}}(n,i.expireTime??null);try{return wx.setStorageSync(r,JSON.stringify(a)),i.enableCache&&t.set(r,a),!0}catch(s){return console.error(`[Storage] setStorage failed for key "${r}":`,s),!1}}function o(n,o,a){const s={...e,...a};if(s.enableCache&&t.has(n)){const e=t.get(n);return r(e)?(t.delete(n),i(n),o):e.data}try{const e=wx.getStorageSync(n);if(!e)return o;const a=function(e){try{return JSON.parse(e)}catch{return null}}(e);return a?r(a)?(i(n),o):(s.enableCache&&t.set(n,a),a.data):e}catch(c){return console.error(`[Storage] getStorage failed for key "${n}":`,c),o}}function i(e){try{return wx.removeStorageSync(e),t.delete(e),!0}catch(r){return console.error(`[Storage] removeStorage failed for key "${e}":`,r),!1}}const a="gameConfig",s={mini_program_id:"",version:"",game_id:0,game_name:""},c=class e{constructor(){this.data=o(a,s)??s}static getInstance(){return e.instance||(e.instance=new e),e.instance}get(){return this.data}save(e){return this.data=e,n(a,e)}clear(){return this.data={...s},i(a)}};c.instance=null;let u=c;var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function d(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function f(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){var r=!1;try{r=this instanceof e}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var h={exports:{}};var p={exports:{}};const v=/* @__PURE__ */f(/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var g;function _(){return g||(g=1,p.exports=(e=e||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==l&&l.crypto&&(r=l.crypto),!r)try{r=v}catch(_){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(_){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(_){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||/* @__PURE__ */function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),i={},a=i.lib={},s=a.Base=/* @__PURE__ */function(){return{extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),c=a.WordArray=s.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||d).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i>>2]>>>24-i%4*8&255;t[n+i>>>2]|=a<<24-(n+i)%4*8}else for(var s=0;s>>2]=r[s>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},f=u.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},h=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,o=n.words,i=n.sigBytes,a=this.blockSize,s=i/(4*a),u=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*u,i);if(u){for(var d=0;d>>2]|=e[o]<<24-o%4*8;r.call(this,n,t)}else r.apply(this,arguments)};n.prototype=t}}(),e.lib.WordArray)),x.exports;var e}var S,b={exports:{}};function T(){return S?b.exports:(S=1,b.exports=(e=_(),function(){var t=e,r=t.lib.WordArray,n=t.enc;function o(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o>>2]>>>16-o%4*8&65535;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o>>1]|=e.charCodeAt(o)<<16-o%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>16-i%4*8&65535);n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i>>1]|=o(e.charCodeAt(i)<<16-i%2*16);return r.create(n,2*t)}}}(),e.enc.Utf16));var e}var R,C={exports:{}};function E(){return R?C.exports:(R=1,C.exports=(e=_(),function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var o=[],i=0,a=0;a>>6-a%4*2;o[i>>>2]|=s<<24-i%4*8,i++}return r.create(o,i)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var o=[],i=0;i>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var i=0;i>>6-a%4*2;o[i>>>2]|=s<<24-i%4*8,i++}return r.create(o,i)}t.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,n=e.sigBytes,o=t?this._safe_map:this._map;e.clamp();for(var i=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,c=0;c<4&&a+.75*c>>6*(3-c)&63));var u=o.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,o=t?this._safe_map:this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(o<<24|o>>>8)}var i=this._hash.words,a=e[t+0],c=e[t+1],h=e[t+2],p=e[t+3],v=e[t+4],g=e[t+5],_=e[t+6],y=e[t+7],m=e[t+8],w=e[t+9],k=e[t+10],x=e[t+11],A=e[t+12],S=e[t+13],b=e[t+14],T=e[t+15],R=i[0],C=i[1],E=i[2],I=i[3];R=u(R,C,E,I,a,7,s[0]),I=u(I,R,C,E,c,12,s[1]),E=u(E,I,R,C,h,17,s[2]),C=u(C,E,I,R,p,22,s[3]),R=u(R,C,E,I,v,7,s[4]),I=u(I,R,C,E,g,12,s[5]),E=u(E,I,R,C,_,17,s[6]),C=u(C,E,I,R,y,22,s[7]),R=u(R,C,E,I,m,7,s[8]),I=u(I,R,C,E,w,12,s[9]),E=u(E,I,R,C,k,17,s[10]),C=u(C,E,I,R,x,22,s[11]),R=u(R,C,E,I,A,7,s[12]),I=u(I,R,C,E,S,12,s[13]),E=u(E,I,R,C,b,17,s[14]),R=l(R,C=u(C,E,I,R,T,22,s[15]),E,I,c,5,s[16]),I=l(I,R,C,E,_,9,s[17]),E=l(E,I,R,C,x,14,s[18]),C=l(C,E,I,R,a,20,s[19]),R=l(R,C,E,I,g,5,s[20]),I=l(I,R,C,E,k,9,s[21]),E=l(E,I,R,C,T,14,s[22]),C=l(C,E,I,R,v,20,s[23]),R=l(R,C,E,I,w,5,s[24]),I=l(I,R,C,E,b,9,s[25]),E=l(E,I,R,C,p,14,s[26]),C=l(C,E,I,R,m,20,s[27]),R=l(R,C,E,I,S,5,s[28]),I=l(I,R,C,E,h,9,s[29]),E=l(E,I,R,C,y,14,s[30]),R=d(R,C=l(C,E,I,R,A,20,s[31]),E,I,g,4,s[32]),I=d(I,R,C,E,m,11,s[33]),E=d(E,I,R,C,x,16,s[34]),C=d(C,E,I,R,b,23,s[35]),R=d(R,C,E,I,c,4,s[36]),I=d(I,R,C,E,v,11,s[37]),E=d(E,I,R,C,y,16,s[38]),C=d(C,E,I,R,k,23,s[39]),R=d(R,C,E,I,S,4,s[40]),I=d(I,R,C,E,a,11,s[41]),E=d(E,I,R,C,p,16,s[42]),C=d(C,E,I,R,_,23,s[43]),R=d(R,C,E,I,w,4,s[44]),I=d(I,R,C,E,A,11,s[45]),E=d(E,I,R,C,T,16,s[46]),R=f(R,C=d(C,E,I,R,h,23,s[47]),E,I,a,6,s[48]),I=f(I,R,C,E,y,10,s[49]),E=f(E,I,R,C,b,15,s[50]),C=f(C,E,I,R,g,21,s[51]),R=f(R,C,E,I,A,6,s[52]),I=f(I,R,C,E,p,10,s[53]),E=f(E,I,R,C,k,15,s[54]),C=f(C,E,I,R,c,21,s[55]),R=f(R,C,E,I,m,6,s[56]),I=f(I,R,C,E,T,10,s[57]),E=f(E,I,R,C,_,15,s[58]),C=f(C,E,I,R,S,21,s[59]),R=f(R,C,E,I,v,6,s[60]),I=f(I,R,C,E,x,10,s[61]),E=f(E,I,R,C,h,15,s[62]),C=f(C,E,I,R,w,21,s[63]),i[0]=i[0]+R|0,i[1]=i[1]+C|0,i[2]=i[2]+E|0,i[3]=i[3]+I|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;r[o>>>5]|=128<<24-o%32;var i=t.floor(n/4294967296),a=n;r[15+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),r[14+(o+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,o,i,a){var s=e+(t&r|~t&n)+o+a;return(s<>>32-i)+t}function l(e,t,r,n,o,i,a){var s=e+(t&n|r&~n)+o+a;return(s<>>32-i)+t}function d(e,t,r,n,o,i,a){var s=e+(t^r^n)+o+a;return(s<>>32-i)+t}function f(e,t,r,n,o,i,a){var s=e+(r^(t|~n))+o+a;return(s<>>32-i)+t}r.MD5=i._createHelper(c),r.HmacMD5=i._createHmacHelper(c)}(Math),e.MD5));var e}var D,L={exports:{}};function q(){return D?L.exports:(D=1,L.exports=(s=_(),t=(e=s).lib,r=t.WordArray,n=t.Hasher,o=e.algo,i=[],a=o.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],a=r[2],s=r[3],c=r[4],u=0;u<80;u++){if(u<16)i[u]=0|e[t+u];else{var l=i[u-3]^i[u-8]^i[u-14]^i[u-16];i[u]=l<<1|l>>>31}var d=(n<<5|n>>>27)+c+i[u];d+=u<20?1518500249+(o&a|~o&s):u<40?1859775393+(o^a^s):u<60?(o&a|o&s|a&s)-1894007588:(o^a^s)-899497514,c=s,s=a,a=o<<30|o>>>2,o=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+a|0,r[3]=r[3]+s|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),e.SHA1=n._createHelper(a),e.HmacSHA1=n._createHmacHelper(a),s.SHA1));var e,t,r,n,o,i,a,s}var H,z={exports:{}};function U(){return H?z.exports:(H=1,z.exports=(e=_(),function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)e(n)&&(o<8&&(s[o]=r(t.pow(n,.5))),c[o]=r(t.pow(n,1/3)),o++),n++}();var u=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],l=r[5],d=r[6],f=r[7],h=0;h<64;h++){if(h<16)u[h]=0|e[t+h];else{var p=u[h-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,g=u[h-2],_=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;u[h]=v+u[h-7]+_+u[h-16]}var y=n&o^n&i^o&i,m=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&d)+c[h]+u[h];f=d,d=l,l=s,s=a+w|0,a=i,i=o,o=n,n=w+(m+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+l|0,r[6]=r[6]+d|0,r[7]=r[7]+f|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=t.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=i._createHelper(l),r.HmacSHA256=i._createHmacHelper(l)}(Math),e.SHA256));var e}var F,j={exports:{}};var W,K={exports:{}};function V(){return W||(W=1,K.exports=(e=_(),w(),function(){var t=e,r=t.lib.Hasher,n=t.x64,o=n.Word,i=n.WordArray,a=t.algo;function s(){return o.create.apply(o,arguments)}var c=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=s()}();var l=a.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],l=r[5],d=r[6],f=r[7],h=n.high,p=n.low,v=o.high,g=o.low,_=i.high,y=i.low,m=a.high,w=a.low,k=s.high,x=s.low,A=l.high,S=l.low,b=d.high,T=d.low,R=f.high,C=f.low,E=h,I=p,O=v,B=g,P=_,M=y,N=m,D=w,L=k,q=x,H=A,z=S,U=b,F=T,j=R,W=C,K=0;K<80;K++){var V,G,J=u[K];if(K<16)G=J.high=0|e[t+2*K],V=J.low=0|e[t+2*K+1];else{var $=u[K-15],Y=$.high,Q=$.low,X=(Y>>>1|Q<<31)^(Y>>>8|Q<<24)^Y>>>7,Z=(Q>>>1|Y<<31)^(Q>>>8|Y<<24)^(Q>>>7|Y<<25),ee=u[K-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,oe=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ie=u[K-7],ae=ie.high,se=ie.low,ce=u[K-16],ue=ce.high,le=ce.low;G=(G=(G=X+ae+((V=Z+se)>>>0>>0?1:0))+ne+((V+=oe)>>>0>>0?1:0))+ue+((V+=le)>>>0>>0?1:0),J.high=G,J.low=V}var de,fe=L&H^~L&U,he=q&z^~q&F,pe=E&O^E&P^O&P,ve=I&B^I&M^B&M,ge=(E>>>28|I<<4)^(E<<30|I>>>2)^(E<<25|I>>>7),_e=(I>>>28|E<<4)^(I<<30|E>>>2)^(I<<25|E>>>7),ye=(L>>>14|q<<18)^(L>>>18|q<<14)^(L<<23|q>>>9),me=(q>>>14|L<<18)^(q>>>18|L<<14)^(q<<23|L>>>9),we=c[K],ke=we.high,xe=we.low,Ae=j+ye+((de=W+me)>>>0>>0?1:0),Se=_e+ve;j=U,W=F,U=H,F=z,H=L,z=q,L=N+(Ae=(Ae=(Ae=Ae+fe+((de+=he)>>>0>>0?1:0))+ke+((de+=xe)>>>0>>0?1:0))+G+((de+=V)>>>0>>0?1:0))+((q=D+de|0)>>>0>>0?1:0)|0,N=P,D=M,P=O,M=B,O=E,B=I,E=Ae+(ge+pe+(Se>>>0<_e>>>0?1:0))+((I=de+Se|0)>>>0>>0?1:0)|0}p=n.low=p+I,n.high=h+E+(p>>>0>>0?1:0),g=o.low=g+B,o.high=v+O+(g>>>0>>0?1:0),y=i.low=y+M,i.high=_+P+(y>>>0>>0?1:0),w=a.low=w+D,a.high=m+N+(w>>>0>>0?1:0),x=s.low=x+q,s.high=k+L+(x>>>0>>0?1:0),S=l.low=S+z,l.high=A+H+(S>>>0>>0?1:0),T=d.low=T+F,d.high=b+U+(T>>>0>>0?1:0),C=f.low=C+W,f.high=R+j+(C>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(l),t.HmacSHA512=r._createHmacHelper(l)}(),e.SHA512)),K.exports;var e}var G,J={exports:{}};var $,Y={exports:{}};function Q(){return $?Y.exports:($=1,Y.exports=(e=_(),w(),function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.x64.Word,s=r.algo,c=[],u=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var o=1,i=0;i<24;i++){for(var s=0,d=0,f=0;f<7;f++){if(1&o){var h=(1<>>24)|4278255360&(i<<24|i>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(C=r[o]).high^=a,C.low^=i}for(var s=0;s<24;s++){for(var f=0;f<5;f++){for(var h=0,p=0,v=0;v<5;v++)h^=(C=r[f+5*v]).high,p^=C.low;var g=d[f];g.high=h,g.low=p}for(f=0;f<5;f++){var _=d[(f+4)%5],y=d[(f+1)%5],m=y.high,w=y.low;for(h=_.high^(m<<1|w>>>31),p=_.low^(w<<1|m>>>31),v=0;v<5;v++)(C=r[f+5*v]).high^=h,C.low^=p}for(var k=1;k<25;k++){var x=(C=r[k]).high,A=C.low,S=c[k];S<32?(h=x<>>32-S,p=A<>>32-S):(h=A<>>64-S,p=x<>>64-S);var b=d[u[k]];b.high=h,b.low=p}var T=d[0],R=r[0];for(T.high=R.high,T.low=R.low,f=0;f<5;f++)for(v=0;v<5;v++){var C=r[k=f+5*v],E=d[k],I=d[(f+1)%5+5*v],O=d[(f+2)%5+5*v];C.high=E.high^~I.high&O.high,C.low=E.low^~I.low&O.low}C=r[0];var B=l[s];C.high^=B.high,C.low^=B.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var n=8*e.sigBytes,i=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/i)*i>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,c=s/8,u=[],l=0;l>>24)|4278255360&(f<<24|f>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),u.push(h),u.push(f)}return new o.init(u,s)},clone:function(){for(var e=i.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=i._createHelper(f),r.HmacSHA3=i._createHmacHelper(f)}(Math),e.SHA3));var e}var X,Z={exports:{}};var ee,te={exports:{}};function re(){return ee?te.exports:(ee=1,te.exports=(e=_(),r=(t=e).lib.Base,n=t.enc.Utf8,void(t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,o=4*r;t.sigBytes>o&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),a=this._iKey=t.clone(),s=i.words,c=a.words,u=0;u>>2];e.sigBytes-=t}};n.BlockCipher=l.extend({cfg:l.cfg.extend({mode:h,padding:p}),reset:function(){var e;l.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var v=n.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?i.create([1398893684,1701076831]).concat(r).concat(t):t).toString(c)},parse:function(e){var t,r=c.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=i.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),v.create({ciphertext:r,salt:t})}},_=n.SerializableCipher=o.extend({cfg:o.extend({format:g}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var o=e.createEncryptor(r,n),i=o.finalize(t),a=o.cfg;return v.create({ciphertext:i,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(r.kdf={}).OpenSSL={execute:function(e,t,r,n,o){if(n||(n=i.random(8)),o)a=u.create({keySize:t+r,hasher:o}).compute(e,n);else var a=u.create({keySize:t+r}).compute(e,n);var s=i.create(a.words.slice(t),4*r);return a.sigBytes=4*t,v.create({key:a,iv:s,salt:n})}},m=n.PasswordBasedCipher=_.extend({cfg:_.cfg.extend({kdf:y}),encrypt:function(e,t,r,n){var o=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize,n.salt,n.hasher);n.iv=o.iv;var i=_.encrypt.call(this,e,t,o.key,n);return i.mixIn(o),i},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var o=n.kdf.execute(r,e.keySize,e.ivSize,t.salt,n.hasher);return n.iv=o.iv,_.decrypt.call(this,e,t,o.key,n)}})}())));var e}var de,fe={exports:{}};var he,pe={exports:{}};var ve,ge={exports:{}};function _e(){return ve?ge.exports:(ve=1,ge.exports=(e=_(),le(),e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}return e}function n(e){return 0===(e[0]=r(e[0]))&&(e[1]=r(e[1])),e}var o=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0),n(a);var s=a.slice(0);r.encryptBlock(s,0);for(var c=0;c>>5]>>>31-n%32&1}for(var o=this._subKeys=[],i=0;i<16;i++){var u=o[i]=[],l=c[i];for(r=0;r<24;r++)u[r/6|0]|=t[(s[r]-1+l)%28]<<31-r%6,u[4+(r/6|0)]|=t[28+(s[r+24]-1+l)%28]<<31-r%6;for(u[0]=u[0]<<1|u[0]>>>31,r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}var d=this._invSubKeys=[];for(r=0;r<16;r++)d[r]=o[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],f.call(this,4,252645135),f.call(this,16,65535),h.call(this,2,858993459),h.call(this,8,16711935),f.call(this,1,1431655765);for(var n=0;n<16;n++){for(var o=r[n],i=this._lBlock,a=this._rBlock,s=0,c=0;c<8;c++)s|=u[c][((a^o[c])&l[c])>>>0];this._lBlock=a,this._rBlock=i^s}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,f.call(this,1,1431655765),h.call(this,8,16711935),h.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function f(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),o=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(n.create(t)),this._des2=d.createEncryptor(n.create(r)),this._des3=d.createEncryptor(n.create(o))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=o._createHelper(p)}(),e.TripleDES));var e}var He,ze={exports:{}};var Ue,Fe={exports:{}};var je,We={exports:{}};var Ke,Ve={exports:{}};function Ge(){return Ke?Ve.exports:(Ke=1,Ve.exports=(e=_(),E(),N(),se(),le(),function(){var t=e,r=t.lib.BlockCipher,n=t.algo;const o=16,i=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var s={pbox:[],sbox:[]};function c(e,t){let r=t>>24&255,n=t>>16&255,o=t>>8&255,i=255&t,a=e.sbox[0][r]+e.sbox[1][n];return a^=e.sbox[2][o],a+=e.sbox[3][i],a}function u(e,t,r){let n,i=t,a=r;for(let s=0;s1;--s)i^=e.pbox[s],a=c(e,i)^a,n=i,i=a,a=n;return n=i,i=a,a=n,a^=e.pbox[1],i^=e.pbox[0],{left:i,right:a}}function d(e,t,r){for(let o=0;o<4;o++){e.sbox[o]=[];for(let t=0;t<256;t++)e.sbox[o][t]=a[o][t]}let n=0;for(let a=0;a=r&&(n=0);let s=0,c=0,l=0;for(let i=0;i>>24)|4278255360&(o<<24|o>>>8)}var i,f,m,w,k,x,A,S,b,T,R,C=this._hash.words,E=l.words,I=d.words,O=a.words,B=s.words,P=c.words,M=u.words;for(x=i=C[0],A=f=C[1],S=m=C[2],b=w=C[3],T=k=C[4],r=0;r<80;r+=1)R=i+e[t+O[r]]|0,R+=r<16?h(f,m,w)+E[0]:r<32?p(f,m,w)+E[1]:r<48?v(f,m,w)+E[2]:r<64?g(f,m,w)+E[3]:_(f,m,w)+E[4],R=(R=y(R|=0,P[r]))+k|0,i=k,k=w,w=y(m,10),m=f,f=R,R=x+e[t+B[r]]|0,R+=r<16?_(A,S,b)+I[0]:r<32?g(A,S,b)+I[1]:r<48?v(A,S,b)+I[2]:r<64?p(A,S,b)+I[3]:h(A,S,b)+I[4],R=(R=y(R|=0,M[r]))+T|0,x=T,T=b,b=y(S,10),S=A,A=R;R=C[1]+m+b|0,C[1]=C[2]+w+T|0,C[2]=C[3]+k+x|0,C[3]=C[4]+i+A|0,C[4]=C[0]+f+S|0,C[0]=R},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,i=o.words,a=0;a<5;a++){var s=i[a];i[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return o},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function h(e,t,r){return e^t^r}function p(e,t,r){return e&t|~e&r}function v(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function _(e,t,r){return e^(t|~r)}function y(e,t){return e<>>32-t}t.RIPEMD160=o._createHelper(f),t.HmacRIPEMD160=o._createHmacHelper(f)}(),e.RIPEMD160));var e}(),re(),function(){return ne?oe.exports:(ne=1,oe.exports=(c=_(),U(),re(),t=(e=c).lib,r=t.Base,n=t.WordArray,o=e.algo,i=o.SHA256,a=o.HMAC,s=o.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:i,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,o=a.create(r.hasher,e),i=n.create(),s=n.create([1]),c=i.words,u=s.words,l=r.keySize,d=r.iterations;c.length>>2]|=o<<24-i%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923));var e}(),function(){return Se?be.exports:(Se=1,be.exports=(e=_(),le(),e.pad.Iso10126={pad:function(t,r){var n=4*r,o=n-t.sigBytes%n;t.concat(e.lib.WordArray.random(o-1)).concat(e.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126));var e}(),function(){return Te?Re.exports:(Te=1,Re.exports=(e=_(),le(),e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971));var e}(),function(){return Ce?Ee.exports:(Ce=1,Ee.exports=(e=_(),le(),e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding));var e}(),function(){return Ie?Oe.exports:(Ie=1,Oe.exports=(e=_(),le(),e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding));var e}(),function(){return Be?Pe.exports:(Be=1,Pe.exports=(n=_(),le(),t=(e=n).lib.CipherParams,r=e.enc.Hex,e.format.Hex={stringify:function(e){return e.ciphertext.toString(r)},parse:function(e){var n=r.parse(e);return t.create({ciphertext:n})}},n.format.Hex));var e,t,r,n}(),function(){return Me?Ne.exports:(Me=1,Ne.exports=(e=_(),E(),N(),se(),le(),function(){var t=e,r=t.lib.BlockCipher,n=t.algo,o=[],i=[],a=[],s=[],c=[],u=[],l=[],d=[],f=[],h=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var p=n^n<<1^n<<2^n<<3^n<<4;p=p>>>8^255&p^99,o[r]=p,i[p]=r;var v=e[r],g=e[v],_=e[g],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,s[r]=y<<16|y>>>16,c[r]=y<<8|y>>>24,u[r]=y,y=16843009*_^65537*g^257*v^16843008*r,l[p]=y<<24|y>>>8,d[p]=y<<16|y>>>16,f[p]=y<<8|y>>>24,h[p]=y,r?(r=v^e[e[e[_^v]]],n^=e[e[n]]):r=n=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],v=n.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),i=this._keySchedule=[],a=0;a6&&a%r==4&&(u=o[u>>>24]<<24|o[u>>>16&255]<<16|o[u>>>8&255]<<8|o[255&u]):(u=o[(u=u<<8|u>>>24)>>>24]<<24|o[u>>>16&255]<<16|o[u>>>8&255]<<8|o[255&u],u^=p[a/r|0]<<24),i[a]=i[a-r]^u);for(var s=this._invKeySchedule=[],c=0;c>>24]]^d[o[u>>>16&255]]^f[o[u>>>8&255]]^h[o[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,c,u,o)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,d,f,h,i),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,o,i,a,s){for(var c=this._nRounds,u=e[t]^r[0],l=e[t+1]^r[1],d=e[t+2]^r[2],f=e[t+3]^r[3],h=4,p=1;p>>24]^o[l>>>16&255]^i[d>>>8&255]^a[255&f]^r[h++],g=n[l>>>24]^o[d>>>16&255]^i[f>>>8&255]^a[255&u]^r[h++],_=n[d>>>24]^o[f>>>16&255]^i[u>>>8&255]^a[255&l]^r[h++],y=n[f>>>24]^o[u>>>16&255]^i[l>>>8&255]^a[255&d]^r[h++];u=v,l=g,d=_,f=y}v=(s[u>>>24]<<24|s[l>>>16&255]<<16|s[d>>>8&255]<<8|s[255&f])^r[h++],g=(s[l>>>24]<<24|s[d>>>16&255]<<16|s[f>>>8&255]<<8|s[255&u])^r[h++],_=(s[d>>>24]<<24|s[f>>>16&255]<<16|s[u>>>8&255]<<8|s[255&l])^r[h++],y=(s[f>>>24]<<24|s[u>>>16&255]<<16|s[l>>>8&255]<<8|s[255&d])^r[h++],e[t]=v,e[t+1]=g,e[t+2]=_,e[t+3]=y},keySize:8});t.AES=r._createHelper(v)}(),e.AES));var e}(),qe(),function(){return He?ze.exports:(He=1,ze.exports=(e=_(),E(),N(),se(),le(),function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=n.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],o=0;o<256;o++)n[o]=o;o=0;for(var i=0;o<256;o++){var a=o%r,s=t[a>>>2]>>>24-a%4*8&255;i=(i+n[o]+s)%256;var c=n[o];n[o]=n[i],n[i]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var e=this._S,t=this._i,r=this._j,n=0,o=0;o<4;o++){r=(r+e[t=(t+1)%256])%256;var i=e[t];e[t]=e[r],e[r]=i,n|=e[(e[t]+e[r])%256]<<24-8*o}return this._i=t,this._j=r,n}t.RC4=r._createHelper(o);var a=n.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)i.call(this)}});t.RC4Drop=r._createHelper(a)}(),e.RC4));var e}(),function(){return Ue?Fe.exports:(Ue=1,Fe.exports=(e=_(),E(),N(),se(),le(),function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=[],i=[],a=[],s=n.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)o[r]^=n[r+4&7];if(t){var i=t.words,a=i[0],s=i[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=u>>>16|4294901760&l,f=l<<16|65535&u;for(o[0]^=u,o[1]^=d,o[2]^=l,o[3]^=f,o[4]^=u,o[5]^=d,o[6]^=l,o[7]^=f,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^u}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=r._createHelper(s)}(),e.Rabbit));var e}(),function(){return je?We.exports:(je=1,We.exports=(e=_(),E(),N(),se(),le(),function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=[],i=[],a=[],s=n.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)n[o]^=r[o+4&7];if(t){var i=t.words,a=i[0],s=i[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=u>>>16|4294901760&l,f=l<<16|65535&u;for(n[0]^=u,n[1]^=d,n[2]^=l,n[3]^=f,n[4]^=u,n[5]^=d,n[6]^=l,n[7]^=f,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^u}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=r._createHelper(s)}(),e.RabbitLegacy));var e}(),Ge()));const rt=/* @__PURE__ */d(tt),nt=(e,t)=>{const r=[];return t.forEach(t=>{e[t]||r.push(t)}),r},ot=e=>e.then(e=>[null,e]).catch(e=>[e]),it=()=>Math.floor(Date.now()/1e3),at=e=>{e=JSON.stringify(e);let t=String.fromCharCode(e.charCodeAt(0)+e.length);for(let r=1;r{e=unescape(e);let t=String.fromCharCode(e.charCodeAt(0)-e.length);for(let r=1;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r-1?"ANDROID":t.indexOf("IOS")>-1?"IOS":t.indexOf("MAC")>-1?"OSX":t.indexOf("WINDOWS")>-1?"WINDOWS":zt}(o[0]),a=!(s=o)||s.length<=0?"":2===s.length?s[1]:3===s.length&&"Windows"===s[0]?"".concat(s[1]," ").concat(s[2]):s[s.length-1];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}}var s;return e}}(),Vt=/* @__PURE__ */function(){var e;return function(){try{if(e)return e;e||(e=Wt.getSync(bt)||""),e||(e=cr(),Wt.setSync(bt,e))}catch(t){}return e}}(),Gt=/* @__PURE__ */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(r){}return e}}();Gt();var Jt=/* @__PURE__ */function(){var e="";return function(){return e||(e=Wt.getSync(It)||""),e}}(),$t=/* @__PURE__ */function(){var e;return function(){if(e)return e;try{var t=wx.getAccountInfoSync();return or(t.miniProgram)?e=t.miniProgram:{}}catch(r){return{}}}}();function Yt(e){var t=null==e?void 0:e.query;if(!or(t))return"";var r="";return t.gdt_vid||[1045,1046,1084].indexOf(null==e?void 0:e.scene)>-1?r="TENCENT":t.clue_token||t.clickid&&t.item_id?r="BYTEDANCE":t.callback&&"kuaishou"===t.ksChannel?r="KUAISHOU":t.bd_vid||t.ai&&t.d&&t.q&&t.c?r="BAIDU":t.uctrackid?r="ALIBABA":(t.trackid||t.imp||[1065,1069,1194].indexOf(null==e?void 0:e.scene)>-1&&(t.callback||t.u))&&(r="OTHERS"),r}function Qt(e,t){try{var r=Kt(),n=$t(),o={sdk_version:"1.5.5",sdk_name:"@dn-sdk/minigame",device_brand:null==r?void 0:r.device_brand,device_model:null==r?void 0:r.device_model,wx_version:null==r?void 0:r.wx_version,wx_lib_version:null==r?void 0:r.wx_lib_version,wx_platform:null==r?void 0:r.wx_platform,os:null==r?void 0:r.os,os_version:null==r?void 0:r.os_version,local_id:Vt(),env_version:null==n?void 0:n.envVersion,appid:null==n?void 0:n.appId},i=Object.assign(o,e);wx.request({url:"https://api.datanexus.qq.com/data-nexus-trace/log",data:i,method:"POST",timeout:Bt.requestTimeout,success:function(e){"function"==typeof t&&200===(null==e?void 0:e.statusCode)&&t()}})}catch(a){mr.error(a)}}var Xt=function(){function e(){mt(this,e)}return kt(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 Zt(e){return new Promise(function(t,r){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/config/get",data:e,timeout:Bt.requestTimeout,success:function(e){er(e,t,"config/get",r),rr(e)},fail:function(e){tr(e,"config/get",r)}})})}function er(e,t,r,n){var o,i,a,s,c=null==e?void 0:e.statusCode,u=null==(o=null==e?void 0:e.data)?void 0:o.code;if(200!==c||0!==u){var l=u;200!==c&&(l="number"==typeof c?-1*c:-888),Qt({log_type:Nt,message:"cgiName: ".concat(r,", statusCode: ").concat(c,", code: ").concat(u,", traceid: ").concat(null==(a=null==e?void 0:e.data)?void 0:a.trace_id),code:l}),null==n||n(null==(s=null==e?void 0:e.data)?void 0:s.data)}else t(null==(i=e.data)?void 0:i.data)}function tr(e,t,r){Qt({log_type:Nt,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==r||r(e)}function rr(e){var t,r=1*(null==(t=null==e?void 0:e.header)?void 0:t["Server-Time"]);r>17266752e5&&Xt.revise(r)}Xt.offsetTime=0,Xt.isRevised=!1;var nr=Object.prototype.toString,or=function(e){return"[object Object]"===nr.call(e)},ir=function(e){return"[object Array]"===nr.call(e)},ar=function(e){return"[object Function]"===nr.call(e)},sr=/* @__PURE__ */(new Date).getTime();function cr(){var e=/* @__PURE__ */(new Date).getTime(),t=Math.abs(1e3*(e-sr));return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(r){var n=16*Math.random();return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),("x"===r?n:3&n|8).toString(16).replace(/-/g,"")})}var ur=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,lr=function(e){if("string"!=typeof e)throw new TypeError("Invalid argument expected string");if(!ur.test(e))throw new Error("Invalid argument not valid semver ('".concat(e,"' received)"))},dr=function(e){return isNaN(Number(e))?e:Number(e)},fr=function(e){var t,r=e.replace(/^v/,"").replace(/\+.*$/,""),n=-1===(t=r).indexOf("-")?t.length:t.indexOf("-"),o=r.substring(0,n).split(".");return o.push(r.substring(n+1)),o},hr=function(e,t){[e,t].forEach(lr);for(var r=fr(e),n=fr(t),o=0;oa)return 1;if(a>i)return-1}var s=r[r.length-1],c=n[n.length-1];if(s&&c)for(var u=s.split(".").map(dr),l=c.split(".").map(dr),d=0;dl[d])return 1;if(l[d]>u[d])return-1}else if(s||c)return s?-1:1;return 0};function pr(e){return vr()[e]}function vr(){return Bt}function gr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var _r=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}},yr=function(){function e(){mt(this,e)}return kt(e,null,[{key:"error",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o1?n-1:0),i=1;i1?n-1:0),i=1;i1?r-1:0),o=1;o1?n-1:0),i=1;i1e4&&(n=JSON.stringify({cut:1,scene:t.scene})),e={source_scene:t.scene,pkg_channel_id:t.query.wxgamepro||"",ad_trace_id:r,launch_options:n,channel:Yt(t)}}catch(o){e={},mr.log("获取场景值和渠道号失败",o)}return e}}();function kr(e,t,r){var n=r.value;return r.value=function(){for(var r=arguments.length,o=new Array(r),i=0;i=0;a--)(o=e[a])&&(i=o(t,r,i)||i);return i&&xr(t,r,i),i},br=function(){function e(t){var r=t.userActionSetId,n=t.maxLength,o=void 0===n?500:n;mt(this,e),this.lostActionMaps={},this.stack=[],this.localStorageKey="",this.localStorageKey="".concat("QUEUE_ACTIONS","_").concat(null==r?void 0:r.toString()),this.maxLength=o,this.userActionSetId=r,this.setTimeStamp(),this.init()}return kt(e,[{key:"getItems",value:function(){return this.stack}},{key:"getStorage",value:function(){var e,t=(null==(e=Wt)?void 0:e.getSync(this.localStorageKey))||"[]";return JSON.parse(t)}},{key:"reportLostNum",value:function(){var e=this,t=Object.assign({},this.lostActionMaps),r=[];for(var n in t){var o=null==n?void 0:n.split("_");r.push({queue_lost_session_id:o[0],queue_lost_timestamp:o[1],queue_lost_num:t[n]})}r.length&&(this.setTimeStamp(),r.forEach(function(t){var r=Object.assign({},{user_action_set_id:e.userActionSetId,log_type:qt},t),n=null==t?void 0:t.queue_lost_session_id,o=null==t?void 0:t.queue_lost_timestamp,i="".concat(n,"_").concat(o);Qt(r,function(){gr(e.lostActionMaps,i)&&(delete e.lostActionMaps[i],Wt.setSync(Rt,JSON.stringify(e.lostActionMaps)))})}))}},{key:"getLostMaps",value:function(){return this.lostActionMaps}},{key:"init",value:function(){var e=this,t=this.getStorage(),r=null==t?void 0:t.map(function(e){var t,r;return e.inner_status===(null==(t=Ot)?void 0:t.reporting)?Object.assign({},e,{inner_status:null==(r=Ot)?void 0:r.fail,is_retry:!0,retry_count:e.retry_count+1}):e});this.stack=r,this.lostActionMaps=JSON.parse(Wt.getSync(Rt)||"{}"),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,r=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=r}},{key:"updateForReportFail",value:function(e){var t;this.stack=null==(t=this.stack)?void 0:t.map(function(t){var r;return null!=e&&e.includes(null==t?void 0:t.action_id)?Object.assign({},t,{inner_status:null==(r=Ot)?void 0:r.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 r;return null!=e&&e.includes(null==t?void 0:t.action_id)?Object.assign({},t,{inner_status:null==(r=Ot)?void 0:r.reporting}):t})}},{key:"updateAllStack",value:function(e){this.stack=e}},{key:"updateToStorage",value:function(){Wt.setSync(this.localStorageKey,JSON.stringify(this.stack))}},{key:"updateLostAction",value:function(e){if(e){var t="".concat(e,"_").concat(this.timeStamp),r=this.lostActionMaps[t]||0;this.lostActionMaps[t]=r+1,Wt.setSync(Rt,JSON.stringify(this.lostActionMaps))}}},{key:"setTimeStamp",value:function(){this.timeStamp=Date.now().toString()}}]),e}();Sr([kr],br.prototype,"getItems"),Sr([kr],br.prototype,"getStorage"),Sr([kr],br.prototype,"reportLostNum"),Sr([kr],br.prototype,"getLostMaps"),Sr([kr],br.prototype,"init"),Sr([kr],br.prototype,"addItem"),Sr([kr],br.prototype,"removeItems"),Sr([kr],br.prototype,"updateForReportFail"),Sr([kr],br.prototype,"updateForReporting"),Sr([kr],br.prototype,"updateAllStack"),Sr([kr],br.prototype,"updateToStorage"),Sr([kr],br.prototype,"updateLostAction");var Tr=Object.defineProperty,Rr=Object.getOwnPropertyDescriptor,Cr=function(e,t,r,n){for(var o,i=Rr(t,r),a=e.length-1;a>=0;a--)(o=e[a])&&(i=o(t,r,i)||i);return i&&Tr(t,r,i),i},Er=function(){ft(t,br);var e=pt(t);function t(r){var n,o=r.userActionSetId,i=r.maxLength,a=void 0===i?500:i,s=r.ogEvents,c=void 0===s?[]:s;return mt(this,t),(n=e.call(this,{userActionSetId:o,maxLength:a})).ogEvents=c,n}return kt(t,[{key:"getReportableActions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,t=this.getItems(),r=[];return null==t||t.forEach(function(t){var n;(null==r?void 0:r.length)=this.maxLength){var n="队列长度超过最大限制".concat(this.maxLength,"条,SDK将按照行为优先级排序,丢弃优先级最低的行为事件");mr.warn(n),Qt({user_action_set_id:this.userActionSetId,log_type:Dt,message:"队列长度超过限制"});var o=this.sortQueue(e,r);mr.debug&&mr.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=Ot)?void 0:t.reporting)});return null==e?void 0:e.length}},{key:"sortQueue",value:function(e,t){var r=this,n={},o=null==e?void 0:e.action_time,i=t.concat([e]),a=function(e){return n[e.action_id]||(n[e.action_id]=r.caculateWeight(o,e)),n[e.action_id]};return i.sort(function(e,t){return a(t)-a(e)})}},{key:"caculateWeight",value:function(e,t){var r,n=0,o=this.formatWeight(e,null==t?void 0:t.action_time),i=o.ogWeight,a=o.sdkWeight,s=o.userWeight;null!=(r=this.ogEvents)&&r.includes(null==t?void 0:t.action_type)&&(n+=i),null!=t&&t.is_sdk_auto_track?n+=a:n+=s;var c=e-(null==t?void 0:t.action_time)+1;return c>0?n+1/c:n}},{key:"formatWeight",value:function(e,t){var r=1e3,n=10,o=100;return e-t>2592e6&&(r/=100,n/=100,o/=100),{ogWeight:r,sdkWeight:n,userWeight:o}}}]),t}();Cr([kr],Er.prototype,"getReportableActions"),Cr([kr],Er.prototype,"addAction"),Cr([kr],Er.prototype,"removeActions"),Cr([kr],Er.prototype,"updateActionsForReportFail"),Cr([kr],Er.prototype,"updateActionsForReporting"),Cr([kr],Er.prototype,"getReportableActionsLength"),Cr([kr],Er.prototype,"sortQueue"),Cr([kr],Er.prototype,"caculateWeight"),Cr([kr],Er.prototype,"formatWeight");var Ir=function(){function e(){mt(this,e),this.events={}}return kt(e,[{key:"subscribe",value:function(t,r){e.checkCallback(r),ir(this.events[t])?this.events[t].push(r):this.events[t]=[r]}},{key:"once",value:function(t,r){e.checkCallback(r),this.subscribe(this.onceEventName(t),r)}},{key:"unsubscribe",value:function(t,r){e.checkCallback(r),ir(this.events[t])&&(this.events[t]=this.events[t].filter(function(e){return e!==r})),ir(this.events[this.onceEventName(t)])&&(this.events[this.onceEventName(t)]=this.events[this.onceEventName(t)].filter(function(e){return e!==r}))}},{key:"publish",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n1&&e.ticketInterval!==this.ticketInterval&&(this.ticketInterval=e.ticketInterval,Br.publish(jt)),e.requestTimeout&&"number"==typeof e.requestTimeout&&e.requestTimeout>5e3&&(this.requestTimeout=e.requestTimeout)}}]),e}(),$r=new Jr,Yr=Mr,Qr=Nr,Xr=Dr,Zr=Lr,en=/* @__PURE__ */function(){var e=!1,t=!1,r=!0,n=!0,o=!0,i=!1;return function(){if(!i){i=!0;var a=Wt.getSync(Ct);if((null==a?void 0:a.bg)===Ut?e=!0:(null==a?void 0:a.bg)===Ft&&(e=!1),(null==a?void 0:a.fg)===Ut?t=!0:(null==a?void 0:a.fg)===Ft&&(t=!1),(null==a?void 0:a.st)===Ut?r=!0:(null==a?void 0:a.st)===Ft&&(r=!1),(null==a?void 0:a.ti)===Ut?n=!0:(null==a?void 0:a.ti)===Ft&&(n=!1),mr.devLog("当前缓存开关 bgOn,fgOn,stOn,tiOn:",e,t,r,n),r&&Br.publish(Yr),n){var s=function(){o&&Br.publish(Qr)},c=setInterval(s,1e3*$r.getTicketInterval());Br.subscribe(jt,function(){c&&clearInterval(c),c=setInterval(s,1e3*$r.getTicketInterval())})}wx.onShow(function(e){if(o=!0,t){var r="";try{(r=JSON.stringify(e)).length>1e4&&(r=JSON.stringify({cut:1,scene:e.scene}))}catch(n){}Br.publish(Xr,{enter_options:r})}}),wx.onHide(function(){o=!1,e&&Br.publish(Zr)})}}}(),tn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function rn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nn,on=rn(function(){var e,t=null;function r(e){return!!e&&("object"==yt(e)||"function"==typeof e)}function n(e){if(null!==e&&!r(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 n(e),{__proto__:e}}:function(e){if(n(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}),s=function(){return null},c=o.getPrototypeOf||([].__proto__===Array.prototype?function(e){var t=e.__proto__;return r(t)?t:null}:s);return e=function(u,l){if(void 0===(this&&this instanceof e?this.constructor:void 0))throw new TypeError("Constructor Proxy requires 'new'");if(!r(u)||!r(l))throw new TypeError("Cannot create proxy with a non-object as target or handler");var d=function(){};t=function(){u=null,d=function(e){throw new TypeError("Cannot perform '".concat(e,"' on a proxy that has been revoked"))}},setTimeout(function(){t=null},0);var f=l;for(var h in l={get:null,set:null,apply:null,construct:null},f){if(!(h in l))throw new TypeError("Proxy polyfill does not support trap '".concat(h,"'"));l[h]=f[h]}"function"==typeof f&&(l.apply=f.apply.bind(f));var p,v=c(u),g=!1,_=!1;"function"==typeof u?(p=function(){var e=this&&this.constructor===p,t=Array.prototype.slice.call(arguments);return d(e?"construct":"apply"),e&&l.construct?l.construct.call(this,u,t):!e&&l.apply?l.apply(u,this,t):e?(t.unshift(u),new(u.bind.apply(u,t))):u.apply(this,t)},g=!0):u instanceof Array?(p=[],_=!0):p=i||null!==v?a(v):{};var y=l.get?function(e){return d("get"),l.get(this,e,p)}:function(e){return d("get"),this[e]},m=l.set?function(e,t){d("set"),l.set(this,e,t,p)}:function(e,t){d("set"),this[e]=t},w=o.getOwnPropertyNames(u),k={};w.forEach(function(e){if(!g&&!_||!(e in p)){var t={enumerable:!!o.getOwnPropertyDescriptor(u,e).enumerable,get:y.bind(u,e),set:m.bind(u,e)};o.defineProperty(p,e,t),k[e]=!0}});var x=!0;if(g||_){var A=o.setPrototypeOf||([].__proto__===Array.prototype?function(e,t){return n(t),e.__proto__=t,e}:s);v&&A(p,v)||(x=!1)}if(l.get||!x)for(var S in u)k[S]||o.defineProperty(p,S,{get:y.bind(u,S)});return o.seal(u),o.seal(p),p},e.revocable=function(r,n){return{proxy:new e(r,n),revoke:t}},e}),an={};try{nn||(nn=on())}catch(bi){dn(bi)}function sn(e,t,r,n){try{if(!nn||null==e||!e[t])return;e[t]=new nn(e[t],{apply:function(e,t,o){var i,a;n&&ln(function(){return n.apply(void 0,ut(o))});var s=!!(null!=(i=o[0])&&i.success||null!=(a=o[0])&&a.fail);s&&["success","fail"].forEach(function(e){if(o[0][e])try{o[0][e]=new nn(o[0][e],{apply:function(t,n,i){return ln(function(){return r.apply(void 0,[e,o[0]].concat(ut(i)))}),t.apply(n,i)}})}catch(t){dn(t)}});var c=e.apply(t,o);return!s&&c&&"[object Promise]"===Object.prototype.toString.call(c)?c.then(function(e){return ln(function(){return r("success",o[0],e)}),e}).catch(function(e){throw ln(function(){return r("fail",o[0],e)}),e}):c}})}catch(o){dn(o)}}function cn(e,t,r){try{if(!nn||null==e||!e[t])return;e[t]=new nn(e[t],{apply:function(e,t,n){var o="function"==typeof n[0];if(o)try{n[0]=new nn(n[0],{apply:function(e,t,n){var o=e.call.apply(e,[t].concat(ut(n)));return ln(function(){return r(o)}),o}})}catch(a){dn(a)}var i=e.call.apply(e,[t].concat(ut(n)));return o||ln(function(){return r(i)}),i}})}catch(n){dn(n)}}function un(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4?arguments[4]:void 0;try{if(!nn||null==e||!e[t])return;e[t]=new nn(e[t],{apply:function(e,i,a){var s=e.call.apply(e,[i].concat(ut(a)));return(!r||!an[t])&&(ln(function(){return null==o?void 0:o(s)}),n.forEach(function(e){var t=e.eventName,r=e.isAsync,n=e.proxyEvent;r?sn(s,t,n):cn(s,t,n)})),r&&(an[t]=!0),s}})}catch(i){dn(i)}}function ln(e){try{e()}catch(t){dn(t)}}function dn(e){Qt({log_type:Lt,message:null==e?void 0:e.message,err_stack:null==e?void 0:e.stack})}var fn=qr,hn=Kr,pn=Hr,vn=zr,gn=Ur,_n=Fr,yn=Wr,mn=jr,wn=/* @__PURE__ */function(){var e=!1;return function(){e||(e=!0,sn(wx,"login",function(e){"success"===e&&Br.publish(fn)}),cn(wx,"onAddToFavorites",function(){Br.publish(hn)}),cn(wx,"onShareTimeline",function(){Br.publish(pn,{target:"TIME_LINE",trigger:"MENU"})}),cn(wx,"onShareAppMessage",function(){Br.publish(pn,{target:"APP_MESSAGE",trigger:"MENU"})}),cn(wx,"shareAppMessage",function(){Br.publish(pn,{target:"APP_MESSAGE",trigger:"BUTTON"})}),un(wx,"createGameClubButton",!1,[{isAsync:!1,eventName:"onTap",proxyEvent:function(){Br.publish(vn)}}],function(){Br.publish(gn)}),un(wx,"getGameServerManager",!0,[{isAsync:!0,eventName:"createRoom",proxyEvent:function(e){"success"===e&&Br.publish("CREATE_GAME_ROOM")}},{isAsync:!0,eventName:"joinRoom",proxyEvent:function(e){"success"===e&&Br.publish(_n)}}]),sn(wx,"requestMidasPayment",function(e,t){Br.publish(mn,{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){Br.publish(yn,{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"})}),sn(wx,"requestMidasPaymentGameItem",function(e,t){var r=(t||{}).signData;Br.publish(mn,{status:"success"===e?"SUCCESS":"FAIL",quantity:(null==r?void 0:r.buyQuantity)||0,mode:(null==r?void 0:r.mode)||"",platform:(null==r?void 0:r.platform)||"",no:(null==r?void 0:r.outTradeNo)||"",p:(null==r?void 0:r.goodsPrice)||0,productId:(null==r?void 0:r.productId)||"",payType:"MidasGameItem"})},function(e){var t=(e||{}).signData;Br.publish(yn,{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"})}))}}(),kn=function(){function e(){mt(this,e)}return kt(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,r=new Array(t>1?t-1:0),n=1;n>16)+(t>>16)+(r>>16)<<16|65535&r}function r(e,r,n,o,i,a){return t((s=t(t(r,e),t(o,a)))<<(c=i)|s>>>32-c,n);var s,c}function n(e,t,n,o,i,a,s){return r(t&n|~t&o,e,t,i,a,s)}function o(e,t,n,o,i,a,s){return r(t&o|n&~o,e,t,i,a,s)}function i(e,t,n,o,i,a,s){return r(t^n^o,e,t,i,a,s)}function a(e,t,n,o,i,a,s){return r(n^(t|~o),e,t,i,a,s)}function s(e,r){e[r>>5]|=128<>>9<<4)]=r;var s,c,u,l,d,f=1732584193,h=-271733879,p=-1732584194,v=271733878;for(s=0;s>5]>>>t%32&255);return r}function u(e){var t,r=[];for(r[(e.length>>2)-1]=void 0,t=0;t>5]|=(255&e.charCodeAt(t/8))<>>4&15)+n.charAt(15&t);return o}function d(e){return unescape(encodeURIComponent(e))}function f(e){return c(s(u(t=d(e)),8*t.length));var t}function h(e,t){return function(e,t){var r,n,o=u(e),i=[],a=[];for(i[15]=a[15]=void 0,o.length>16&&(o=s(o,8*e.length)),r=0;r<16;r+=1)i[r]=909522486^o[r],a[r]=1549556828^o[r];return n=s(i.concat(u(t)),512+8*t.length),c(s(a.concat(n),640))}(d(e),d(t))}function p(e,t,r){return t?r?h(t,e):l(h(t,e)):r?f(e):function(e){return l(f(e))}(e)}Tn.exports?Tn.exports=p:e.md5=p}(tn);var Cn=rn(Rn.exports),En="function"==typeof btoa,In="function"==typeof Buffer;"function"==typeof TextDecoder&&new TextDecoder;var On,Bn="function"==typeof TextEncoder?new TextEncoder:void 0,Pn=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");On={},Pn.forEach(function(e,t){return On[e]=t});var Mn=String.fromCharCode.bind(String);"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array);var Nn=En?function(e){return btoa(e)}:In?function(e){return Buffer.from(e,"binary").toString("base64")}:function(e){for(var t,r,n,o,i="",a=e.length%3,s=0;s255||(n=e.charCodeAt(s++))>255||(o=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");i+=Pn[(t=r<<16|n<<8|o)>>18&63]+Pn[t>>12&63]+Pn[t>>6&63]+Pn[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},Dn=In?function(e){return Buffer.from(e).toString("base64")}:function(e){for(var t=[],r=0,n=e.length;r>>6)+Mn(128|63&t):Mn(224|t>>>12&15)+Mn(128|t>>>6&63)+Mn(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return Mn(240|t>>>18&7)+Mn(128|t>>>12&63)+Mn(128|t>>>6&63)+Mn(128|63&t)},qn=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Hn=In?function(e){return Buffer.from(e,"utf8").toString("base64")}:Bn?function(e){return Dn(Bn.encode(e))}:function(e){return Nn(e.replace(qn,Ln))},zn=Object.defineProperty,Un=Object.getOwnPropertyDescriptor,Fn=function(e,t,r,n){for(var o,i=Un(t,r),a=e.length-1;a>=0;a--)(o=e[a])&&(i=o(t,r,i)||i);return i&&zn(t,r,i),i},jn=function(){function e(t){var r=this;mt(this,e),this.cgiBatchSize=Bt.cgiBatchSize,this.reportThreshold=Bt.reportThreshold,this.reportDelay=Bt.reportDelay,this.triggerExecuteSend=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[];return function(){for(var o=arguments.length,i=new Array(o),a=0;a=this.reportThreshold)this.executeSend();else{var r=(null==(e=this.configManager)?void 0:e.getRealTimeActionList())||Bt.realTimeActionList;t.some(function(e){return r.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 r=(e.requestConcurrency-e.currentRequestCount)*this.cgiBatchSize,n=this.queueManager.getReportableActions(r),o=this.getBaseInfo();if(!o.openid&&!o.unionid&&(mr.warn("请尽快调用 setOpenId 或 setUnionId 方法设置用户ID!"),n=n.filter(function(e){return null==e?void 0:e.ad_trace_id})),!(n.length<=0)){r=0});t.isNeedContinueSend&&r&&t.executeSend()}).catch(function(e){mr.error(e),t.reportLog({message:"executeSend catch: ".concat(e.message),log_type:Pt,err_stack:e.stack})})}}}},{key:"generateActionReportParams",value:function(e){var t=[],r=[],n=this.getBaseInfo();return e.forEach(function(e){r.push(e.action_id);var n=Object.assign({},e);delete n.inner_status,t.push(n)}),{data:{info:n,actions:t},actionIdList:r}}},{key:"dealSuccessData",value:function(e,t,r){[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:Mt,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)}),mr.error("上报失败:",e)),this.doTrackCallbackFn(this.onReportComplete,e,r),-1===[0,51001,51003].indexOf(null==e?void 0:e.code)&&this.doTrackCallbackFn(this.onReportFail,e,r)}},{key:"dealFailData",value:function(e,t,r){this.queueManager.updateActionsForReportFail(t),this.reportLog({log_type:Mt,code:e.code,message:e.message}),mr.error("上报失败:",e),this.doTrackCallbackFn(this.onReportComplete,e,r)}},{key:"report",value:function(t){var r=this,n=t.data,o=t.actionIdList;return this.queueManager.updateActionsForReporting(o),mr.debug&&(mr.info("上报行为类型: ","【".concat(n.actions.map(function(e){return e.action_type}).join("、"),"】")),mr.info("上报请求参数: ",n)),new Promise(function(t){var i,a,s,c,u,l,d,f,h=Date.now();try{var p=function(e){var t="",r=null==e?void 0:e.appid,n=null==e?void 0:e.secret_key,o=null==e?void 0:e.sdk_version,i=null==e?void 0:e.timestamp;if(!(r&&n&&o&&i&&32===n.length))return t;for(var a=Cn(o+r+i),s=0;s<32;s++)t+=s%2==0?n[s]:a[s];return t}({appid:null==(i=null==n?void 0:n.info)?void 0:i.appid,secret_key:null==(a=null==n?void 0:n.info)?void 0:a.secret_key,sdk_version:null==(s=null==n?void 0:n.info)?void 0:s.sdk_version,timestamp:h}),v=function(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?Hn(e).replace(/=/g,"").replace(/[+\/]/g,function(e){return"+"==e?"-":"_"}):Hn(e)}(JSON.stringify(n));d={"Client-Time":h,"Sign-Value":Cn(v+(null==(c=null==n?void 0:n.info)?void 0:c.user_action_set_id)+(null==(u=null==n?void 0:n.info)?void 0:u.secret_key)+p),"Sign-Version":Bt.signVersion,"content-type":"text/plain;charset=UTF-8"},f=v}catch(g){d={"Client-Time":h},f=n,r.reportLog({log_type:Ht,message:"sign error msg: ".concat(null==g?void 0:g.message),err_stack:null==g?void 0:g.stack}),mr.error(g)}wx.request({url:"https://api.datanexus.qq.com/data-nexus-cgi/miniprogram",method:"POST",timeout:(null==(l=r.configManager)?void 0:l.getRequestTimeout())||Bt.requestTimeout,header:d,data:f,success:function(i){var a,s;mr.devLog("上报接口返回码:",null==(a=null==i?void 0:i.data)?void 0:a.code);var c=(null==(s=null==i?void 0:i.header)?void 0:s["Server-Time"])||-1;if(Xt.revise(c),e.currentRequestCount-=1,200===(null==i?void 0:i.statusCode))return r.dealSuccessData(null==i?void 0:i.data,o,n),void t((null==i?void 0:i.data).code);var u="";try{u="object"==yt(null==i?void 0:i.data)?JSON.stringify(null==i?void 0:i.data):null==i?void 0:i.data}catch(d){mr.error(d)}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(u)};r.dealFailData(l,o,n),t(l.code)},fail:function(i){mr.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};r.dealFailData(a,o,n),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,r){if("function"==typeof e)try{for(var n=[],o=0;o10?mr.error("网络请求最大并发量不能大于10"):e.requestConcurrency=t:mr.error("网络请求最大并发量需设置为数字")}}]),e}(),Wn=jn;Wn.currentRequestCount=0,Wn.requestConcurrency=Bt.requestConcurrency,Fn([kr],Wn.prototype,"batchSend"),Fn([kr],Wn.prototype,"flushSend"),Fn([kr],Wn.prototype,"executeSend");var Kn=Mr,Vn=Nr,Gn=Dr,Jn=Lr,$n=qr,Yn=Kr,Qn=Hr,Xn=zr,Zn=Ur,eo=Fr,to=Wr,ro=jr,no=function(){function e(){mt(this,e)}return kt(e,[{key:"install",value:function(e,t){var r=function(t){Br.subscribe(t,function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.track(t,Object.assign(r||{},o,ct(ct({},vo,!0),go,n)))}}(t))};r(Vn),r(Kn),r(Gn),r(Jn),"all"===t&&(r($n),r(Yn),r(Qn),r(Zn),r(Xn),r("CREATE_GAME_ROOM"),r(eo),r(to),r(ro))}}]),e}(),oo=function(){function e(){mt(this,e),this.special_method_symbol=/* @__PURE__ */Symbol("special_method_symbol")}return kt(e,[{key:"onPurchase",value:function(e){return"number"!=typeof e&&mr.warn("付费金额需要为数字"),e<=0&&mr.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||{},ct({},this.special_method_symbol,1)))}}]),e}(),io=function(){ft(t,oo);var e=pt(t);function t(){return mt(this,t),e.apply(this,arguments)}return kt(t,[{key:"onRegister",value:function(){return this.wrapTrack("REGISTER")}},{key:"onCreateRole",value:function(e){return e&&"string"!=typeof e&&mr.warn("角色名称需要为字符串"),this.wrapTrack("CREATE_ROLE",e?{name:e}:{})}},{key:"onTutorialFinish",value:function(){return this.wrapTrack("TUTORIAL_FINISH")}}]),t}(),ao="(如果确认无误,请忽略该提示)",so=/* @__PURE__ */function(){var e=[];return{requestActionList:function(){try{Zt({conf_name:"data_nexus_common",conf_key:"action_types"}).then(function(t){ir(t)&&(e=t)})}catch(t){mr.error(t)}},getActionList:function(){return e}}}();function co(e,t){try{if(0===e.length)return t.length;if(0===t.length)return e.length;for(var r=[],n=0;n<=t.length;n++)r[n]=[n];for(var o=0;o<=e.length;o++)r[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)?r[i][a]=r[i-1][a-1]:r[i][a]=Math.min(r[i-1][a-1]+1,r[i][a-1]+1,r[i-1][a]+1);return r[t.length][e.length]}catch(s){mr.error(s)}}function uo(e){try{e&&!/^[a-zA-Z0-9_\-]+$/.test(e)&&mr.warn("通过SDK上报的openid:".concat(e,"可能有误,请检查openid是否正确!").concat(ao))}catch(t){mr.error(t)}}var lo=Object.defineProperty,fo=Object.getOwnPropertyDescriptor,ho=function(e,t,r,n){for(var o,i=fo(t,r),a=e.length-1;a>=0;a--)(o=e[a])&&(i=o(t,r,i)||i);return i&&lo(t,r,i),i},po=/* @__PURE__ */Symbol("initializedInstance"),vo=/* @__PURE__ */Symbol("autoTrack"),go=/* @__PURE__ */Symbol("actionTime"),_o=function(){ft(t,io);var e=pt(t);function t(r){var n;if(mt(this,t),(n=e.call(this)).env="production",n.sdk_version="1.5.5",n.sdk_name="@dn-sdk/minigame",n.deviceInfo={},n.gameInfo={},n.session_id="",n.log_id=0,n.inited=!1,n.initErrMsg="",null==wx||!wx.createCanvas)return n.initErrMsg="不支持非微信小游戏中使用",mr.error(n.initErrMsg),vt(n);var o=vr();if(t[po].length>=o.maxSdkInstance)return n.initErrMsg="初始化超过上限",mr.error(n.initErrMsg),vt(n);var i=function(e){return or(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 r in e)t.includes(r)||mr.warn("Invalid property '".concat(r,"' 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 类型"}(r),a=$t();if(!0!==i)return n.initErrMsg=i,mr.error(i),vt(n);var s=null==a?void 0:a.appId;if(s&&s!==r.appid)return n.initErrMsg="初始化传入的appid与当前小游戏appid不一致",mr.error(n.initErrMsg),vt(n);n.config=r,gr(r,"auto_track")||(n.config.auto_track=pr("autoTrack")),n.openid=r.openid,n.unionid=r.unionid,n.user_unique_id=r.user_unique_id,n.onReportComplete=r.on_report_complete,n.onReportFail=r.on_report_fail,n.saveValidOpenidToStorage();var c,u,l,d,f=r.user_action_set_id;return t[po].includes(f)?(n.initErrMsg="同个数据源[".concat(f,"]只能初始化一次"),mr.error(n.initErrMsg),n.reportLog({log_type:Pt,message:n.initErrMsg}),vt(n)):(n.reportLog=n.reportLog.bind(gt(n)),n.getTrackBaseInfo=n.getTrackBaseInfo.bind(gt(n)),n.deviceInfo=Kt(),n.gameInfo=wr(),n.session_id=cr(),n.queueManage=new Er({userActionSetId:f,maxLength:o.maxQueueLength,ogEvents:Pr}),n.actionReporter=new Wn({getBaseInfo:n.getTrackBaseInfo,reportLog:n.reportLog,queueManager:n.queueManage,configManager:$r,onReportComplete:n.onReportComplete,onReportFail:n.onReportFail}),n.inited=!0,t[po].push(f),n.useAutoTrack(),n.doReportOnEnterBackground(),"release"===(null==a?void 0:a.envVersion)?(mr.info("初始化成功"),vt(n)):(c={conf_name:"mini_game_sdk_common",conf_key:"version",sdk_version:n.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(){n.inited=!1}},u=c.sdk_version,l=c.default_download_url,d=c.fail_handler,Zt({conf_name:c.conf_name,conf_key:c.conf_key}).then(function(e){if(or(e)){var t=null==e?void 0:e.blackVersions,r=null==e?void 0:e.minVersion,n=null==e?void 0:e.bestVersion,o=null==e?void 0:e.downloadUrl,i=l;return o&&/^https/.test(o)&&(i=o),ir(t)&&(null==t?void 0:t.indexOf(u))>-1?(null==d||d(),void mr.error("初始化失败!当前SDK版本存在兼容问题,请尽快升级至最新版!下载地址:".concat(i))):r&&hr(u,r)<0?(null==d||d(),void mr.error("初始化失败!当前SDK版本过低,请尽快升级至最新版!下载地址:".concat(i))):(n&&hr(u,n)<0&&mr.warn("新版本SDK已上线,强烈建议您升级至最新版,尽早享受新特性!下载地址:".concat(i)),void mr.info("初始化成功"))}mr.info("初始化成功")}).catch(function(){mr.info("初始化成功")}),so.requestActionList(),uo(r.openid),vt(n)))}return kt(t,[{key:"getInitResult",value:function(){return{inited:this.inited,initErrMsg:this.initErrMsg}}},{key:"track",value:function(e,t){var r,n;if(!this.inited||!this.queueManage)return mr.error("上报失败,请先完成初始化"),{code:100,message:"未完成初始化或重复初始化导致初始化失败,请先完成初始化"};var o=bn.validateActionType(e),i=bn.validateActionParam(t);if(o&&i){!this.openid&&!this.unionid&&mr.warn("缺少 openid 或 unionid");var a=pr("actionParamMaxLength");if(JSON.stringify(t||{}).length>a)return mr.error("监测到超过".concat(a,"的上报日志:").concat(e," ").concat(t)),{code:102,message:"action_param 参数过大,不能超过 ".concat(a," 字符")};var s=!(null==t||!t[vo]),c=this.createAction(e,t||{},s);"release"!==(null==(r=$t())?void 0:r.envVersion)&&function(e,t){try{e.is_sdk_auto_track||(function(e){try{var t=so.getActionList();if(!t.includes(e)){var r,n=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=lt(e))){t&&(e=t);var r=0,n=function(){};return{s:n,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:n}}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(n.s();!(r=n.n()).done;){var o=r.value;if(co(o,e)<=parseInt((.3*o.length).toString())){mr.warn("通过SDK上报的".concat(e,"行为名称可能有误,请检查该行为类型是否为腾讯广告提供的标准行为!").concat(ao));break}}}catch(i){n.e(i)}finally{n.f()}}}catch(a){mr.error(a)}}(e.action_type),"minigame"===t?function(e,t){var r,n,o;try{["PURCHASE","ADD_TO_CART"].includes(e.action_type)&&e.action_param&&gr(e.action_param,"value")&&("number"!=typeof(null==(r=e.action_param)?void 0:r.value)?mr.warn("通过SDK上报的".concat(e.action_type,"行为携带的金额参数需要为数字!")):(null==(n=e.action_param)?void 0:n.value)<=0?mr.warn("通过SDK上报的".concat(e.action_type,"行为携带的金额参数需要大于0!")):"minigame"===t&&(null==(o=e.action_param)?void 0:o.value)<100&&mr.warn("通过SDK上报的".concat(e.action_type,"行为携带的金额参数可能有误,金额的单位为‘分’,请检查金额是否正确!").concat(ao)))}catch(i){mr.error(i)}}(e,t):"miniprogram"===t&&function(e){try{var t=null==e?void 0:e.action_type,r=(null==e?void 0:e.action_param)||{};"PURCHASE"===t&&gr(r,"value")&&("number"!=typeof(null==r?void 0:r.value)?mr.warn("通过SDK上报的".concat(t,"行为携带的金额参数需要为数字!")):(null==r?void 0:r.value)<=0&&mr.warn("通过SDK上报的".concat(t,"行为携带的金额参数需要大于0!")))}catch(n){mr.error(n)}}(e))}catch(r){mr.error(r)}}(c,"minigame");var u=this.queueManage.addAction(c);return null==(n=this.actionReporter)||n.batchSend(),u}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&&!Wt.getSync(It)&&Br.publish("START_APP"),this.flush(),this.saveValidOpenidToStorage(),"release"!==(null==(t=$t())?void 0:t.envVersion)&&uo(e),{code:0,message:"成功"};var r="openid 格式错误";return mr.error(r),{code:101,message:r}}},{key:"setUnionId",value:function(e){if(e&&"string"==typeof e)return this.unionid=e,this.flush(),{code:0,message:"成功"};var t="unionid 格式错误";return mr.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 mr.error(t),{code:101,message:t}}},{key:"doReportOnEnterBackground",value:function(){var e=this;wx.onHide(function(){var t,r;null==(t=e.actionReporter)||t.flushSend(),null==(r=e.queueManage)||r.reportLostNum()})}},{key:"getTrackBaseInfo",value:function(){var e,t,r=$t();return Object.assign({},this.deviceInfo,(e=this.config,t={},["user_action_set_id","appid","openid","secret_key","user_unique_id","unionid"].forEach(function(r){gr(e,r)&&(t[r]=e[r])}),t),{local_id:Vt(),sdk_name:this.sdk_name,sdk_version:this.sdk_version,openid:this.openid||Jt(),unionid:this.unionid,user_unique_id:this.user_unique_id,inner_param:{app_env_version:r.envVersion,app_version:r.version}})}},{key:"createAction",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];null!=t&&t[vo]&&delete t[vo];var n=Date.now();null!=t&&t[go]&&(n=null==t?void 0:t[go],delete t[go]);var o={action_id:cr(),action_param:t,action_time:n,action_type:e,is_retry:!1,is_sdk_auto_track:r,retry_count:0,revised_action_time:Xt.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:Gt(),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]),$r.getChannelClaimActionList().indexOf(e)>-1&&this.gameInfo.launch_options&&this.addActionInnerParam(o,"launch_options",this.gameInfo.launch_options),o}},{key:"addActionInnerParam",value:function(e,t,r){e.inner_param&&or(e.inner_param)?e.inner_param[t]=r:e.inner_param=ct({},t,r)}},{key:"getChannelByActionType",value:function(e){var t="";return $r.getChannelClaimActionList().indexOf(e)>-1?t=this.gameInfo.channel||"":$r.getNoClaimActionList().indexOf(e)>-1&&(t="UNKNOWN"),t}},{key:"reportLog",value:function(e){var t,r,n={user_action_set_id:null==(t=this.config)?void 0:t.user_action_set_id,appid:null==(r=this.config)?void 0:r.appid,session_id:this.session_id};Qt(Object.assign(n,e))}},{key:"useAutoTrack",value:function(){var e;if(null!=(e=this.config)&&e.auto_track){var t=!0,r=Wt.getSync(Ct);(null==r?void 0:r.ap)===Ut?t=!0:(null==r?void 0:r.ap)===Ft&&(t=!1),"devtools"===Kt().wx_platform&&(t=!0),(new no).install(this,t?"all":"lifecycle"),en(),t&&wn(),this.getAutoProxyRemoteConfig()}}},{key:"getAutoProxyRemoteConfig",value:function(){var e,t,r,n=Kt();n.os&&n.os_version&&null!=(e=this.config)&&e.user_action_set_id&&(r={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:_r(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)||""}},new Promise(function(e){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/minigame/get",data:r,timeout:Bt.requestTimeout,success:function(t){er(t,e,"minigame/get"),rr(t)},fail:function(e){tr(e,"minigame/get")}})})).then(function(e){or(e)&&Wt.setSync(Ct,e)})}},{key:"saveValidOpenidToStorage",value:function(){this.openid&&function(e){return/^[a-zA-Z0-9_-]{28,30}$/.test(e)}(this.openid)&&Wt.setSync(It,this.openid)}}],[{key:"setRequestConcurrency",value:function(e){Wn.setRequestConcurrency(e)}},{key:"setDebug",value:function(e){mr.debug=e}}]),t}(),yo=_o;yo[po]=[],ho([kr],yo.prototype,"track"),ho([kr,function(e,t,r){var n=r.value;return r.value=function(){if(this.inited){for(var e=arguments.length,t=new Array(e),r=0;r0}getToken(){return this.data.token}getUid(){return this.data.uid}};xo.instance=null;let Ao=xo;const So=()=>new Promise((e,t)=>{wx.login({success(t){let r={code:t.code};e(r)},fail(e){t(e.errMsg)}})}),bo="urlQuery",To={agent_id:0,site_id:0,queryStr:"",gdt_vid:"",weixinadinfo:""},Ro=class e{constructor(){this.data=o(bo,To)??To}static getInstance(){return e.instance||(e.instance=new e),e.instance}get(){return this.data}save(e){return this.data=e,n(bo,e)}clear(){return this.data={...To},i(bo)}};Ro.instance=null;let Co=Ro;const Eo=e=>new Promise(async(t,r)=>{const n=Co.getInstance().get();let o={channel:"wxxyx",code:e.code,gdt_vid:n.gdt_vid,weixinadinfo:n.weixinadinfo};const i=await(a=o,ti.post("/sdk/auth/third_login",a));var a;Ao.getInstance().save(i),i.pop_content&&wx.showModal({title:i.pop_title?i.pop_title:"登录提示",content:i.pop_content,complete(e){console.log(e)}});const s=mo.getInstance();s.setOpenId(i.openid),i.is_first_login?s.onRegister():i.is_reactive_user&&s.track("RE_ACTIVE"),t(i)}),Io=e=>{const t=wx.getDeviceInfo();return e&&e in t?t[e]:t},Oo=()=>{const e=Ao.getInstance().get(),t=u.getInstance().get(),r=Co.getInstance().get(),n=wx.getAppBaseInfo(),i=o("imei")||(()=>{const e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";let t="";for(let r=32;r>0;--r)t+=e[Math.floor(62*Math.random())];return t})(),a=Io("platform"),s="ios"===a?4:3,c=t.version,{agent_id:l,queryStr:d,site_id:f}=r;console.log("{ agent_id, queryStr, site_id }",{agent_id:l,queryStr:d,site_id:f});const{model:h,brand:p}=Io();let v=0,g="";e.game_id?(v=e.game_id,g=e.game_id):(v=t.game_id,g=t.mini_program_id);return{platform:a,os:s,imei:i,model:h,brand:p,app_version:c,query:d,track_id:0,openid:e.openid,sdk_version:"1.0.0",sdk_version_code:Number("1.0.0".split(".").join("")),agent_id:l||Number("1000"),site_id:f||Number("1000"),oaid:0,game_id:v,package_name:g,system_lang:n.language,system_version:n.version,appid:t.mini_program_id}};var Bo,Po,Mo,No,Do,Lo,qo={exports:{}},Ho={exports:{}};function zo(){if(Mo)return Po;Mo=1;var e={utf8:{stringToBytes:function(t){return e.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(e.bin.bytesToString(t)))}},bin:{stringToBytes:function(e){for(var t=[],r=0;r>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&jo.rotl(e,8)|4278255360&jo.rotl(e,24);for(var t=0;t0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],r=0,n=0;r>>5]|=e[r]<<24-n%32;return t},wordsToBytes:function(e){for(var t=[],r=0;r<32*e.length;r+=8)t.push(e[r>>>5]>>>24-r%32&255);return t},bytesToHex:function(e){for(var t=[],r=0;r>>4).toString(16)),t.push((15&e[r]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],r=0;r>>6*(3-o)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],r=0,n=0;r>>6-2*n);return t}},Ho.exports=jo),Wo=Ho.exports,Ko=zo().utf8,Vo=Uo(),Go=zo().bin,(Jo=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?Go.stringToBytes(e):Ko.stringToBytes(e):Vo(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var r=Wo.bytesToWords(e),n=8*e.length,o=1732584193,i=-271733879,a=-1732584194,s=271733878,c=0;c>>24)|4278255360&(r[c]<<24|r[c]>>>8);r[n>>>5]|=128<>>9<<4)]=n;var u=Jo._ff,l=Jo._gg,d=Jo._hh,f=Jo._ii;for(c=0;c>>0,i=i+p>>>0,a=a+v>>>0,s=s+g>>>0}return Wo.endian([o,i,a,s])})._ff=function(e,t,r,n,o,i,a){var s=e+(t&r|~t&n)+(o>>>0)+a;return(s<>>32-i)+t},Jo._gg=function(e,t,r,n,o,i,a){var s=e+(t&n|r&~n)+(o>>>0)+a;return(s<>>32-i)+t},Jo._hh=function(e,t,r,n,o,i,a){var s=e+(t^r^n)+(o>>>0)+a;return(s<>>32-i)+t},Jo._ii=function(e,t,r,n,o,i,a){var s=e+(r^(t|~n))+(o>>>0)+a;return(s<>>32-i)+t},Jo._blocksize=16,Jo._digestsize=16,qo.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var r=Wo.wordsToBytes(Jo(e,t));return t&&t.asBytes?r:t&&t.asString?Go.bytesToString(r):Wo.bytesToHex(r)}),qo.exports);const Yo=/* @__PURE__ */d($o),Qo=e=>{console.log("加密前",e);const t="03fb565b8c319ceb3192f89cf11c0cc7",r=JSON.stringify(e),n=(e=>{const t=[],r=Date.now(),n="undefined"!=typeof performance&&performance.now?performance.now():0;for(let o=0;o>>0;if(o+4>e){const t=e-o;i>>>=32-8*t,i<<=32-8*t}t.push(i)}return rt.lib.WordArray.create(t,e)})(16);let o;o=rt.enc.Utf8.parse(t);const i=rt.AES.encrypt(r,o,{iv:n,mode:rt.mode.CBC,padding:rt.pad.Pkcs7}),a=n.concat(i.ciphertext);return rt.enc.Base64.stringify(a)},Xo=e=>{const t="03fb565b8c319ceb3192f89cf11c0cc7";try{if(!e||"string"!=typeof e)return e;const r=rt.enc.Base64.parse(e),n=rt.lib.WordArray.create(r.words.slice(0,4),16),o=rt.lib.WordArray.create(r.words.slice(4),r.sigBytes-16);let i;t?i=rt.enc.Utf8.parse(t):t&&(i=rt.SHA256(t));const a=rt.lib.CipherParams.create({ciphertext:o}),s=rt.AES.decrypt(a,i,{iv:n,mode:rt.mode.CBC,padding:rt.pad.Pkcs7}).toString(rt.enc.Utf8);return console.log("解密后的数据:",JSON.parse(s)),JSON.parse(s)}catch(r){return console.error("解密失败:",r),e}},Zo=async({url:e,data:t,method:r="GET"})=>{try{return await ei({url:e,data:t,method:r})}catch(n){if(401!==n.code)throw n;console.log("登录过期,尝试重新登录...");try{await(async()=>{let e,t;return[e,t]=await ot(So()),e?Promise.reject(e):([e,t]=await ot(Eo(t)),e?Promise.reject(e):Promise.resolve())})(),console.log("重新登录成功,重新发起请求...");const n=Ao.getInstance().get();return new Promise((o,i)=>{wx.request({url:e,header:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${n.token}`},method:r,data:t,success:e=>{if(200===e.statusCode){const t=e.data;200===t.code?(t.data=Xo(t.data),o(t.data)):i({code:t.code,msg:t.message})}else i({code:-1,msg:`网络请求失败 ${e.statusCode}`})},fail:e=>{i({code:-1,msg:e.errMsg})}})})}catch(o){throw console.error("重新登录失败:",o),n}}},ei=async({url:e,data:t,method:r="GET"})=>new Promise((n,o)=>{const i=Ao.getInstance().getToken();let a={...Oo(),...t};a=(e=>{const t=u.getInstance().get();e.time=Math.floor(/* @__PURE__ */(new Date).getTime()/1e3);let r=(e=>{let t=[];for(let o in e)t.push(o);t=t.sort();let r={};for(var n in t)r[t[n]]=e[t[n]];return r})(e),n="";for(let i in r)"sign"!==i&&""!==r[i]&&void 0!==r[i]&&null!==r[i]&&(n=n+i+"="+r[i]+"&");n=n.substring(0,n.length-1)+"&secret="+t.mini_program_id,e.sign=Yo(n);let o={};return o.encrypt_data=Qo(e),o})(a),wx.request({url:e,data:a,method:r,header:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${i}`},success:t=>{if(200===t.statusCode){const r=t.data;return 200===r.code?(r.data=Xo(r.data),n(r.data)):401===r.code?o({code:401,msg:r.message}):(wx.showModal({title:"网络错误",icon:"none",showCancel:!1,content:`${e}:${r.message}`}),o({code:r.code,msg:r.message})),r}o({code:-1,msg:`network error ${t.message}`})},fail:e=>{o({code:-1,msg:`network error ${e.errMsg}`})}})}),ti={get:(e,t)=>Zo({url:`https://sdk-api.gzshisan.com${e}`,data:t,method:"GET"}),post:(e,t)=>Zo({url:`https://sdk-api.gzshisan.com${e}`,data:t,method:"POST"})},ri="shareConfig",ni={title:"",imageUrl:"",query:"",share_ext:""},oi=class e{constructor(){this.data=o(ri,ni)??ni}static getInstance(){return e.instance||(e.instance=new e),e.instance}get(){return this.data}save(e){return this.data=e,n(ri,e)}clear(){return this.data={...ni},i(ri)}};oi.instance=null;const ii=oi.getInstance(),ai=async()=>{try{ii.clear();const e=await ti.get("/sdk/wx/share_config");if(console.log("shareConfigData",e),e.length){const t=e[Math.floor(Math.random()*e.length)];ii.save(t)}return Promise.resolve()}catch(e){return Promise.reject(e)}},si=async e=>{if(ii.get())try{await ai();let t=ui(e);return wx.shareAppMessage(t),Promise.resolve()}catch(t){return Promise.reject(t)}},ci=(e,t=["shareAppMessage","shareTimeline"])=>{wx.offShareAppMessage(),wx.offShareTimeline(),wx.offCopyUrl(),wx.offAddToFavorites();let r=ui(e);wx.showShareMenu({withShareTicket:!0,menus:t}),wx.onShareAppMessage(()=>(mo.getInstance().track("SHARE",{target:"APP_MESSAGE"}),r)),wx.onShareTimeline(()=>(mo.getInstance().track("SHARE",{target:"TIME_LINE"}),r)),wx.onCopyUrl(()=>({query:r.query})),wx.onAddToFavorites(()=>{mo.getInstance().track("ADD_TO_WISHLIST",{type:"default"})})},ui=e=>{let t=ii.get(),r={title:t.title,imageUrl:t.imageUrl,query:t.query},n="";return e.hasOwnProperty("title")&&e.title&&(r.title=e.title),e.hasOwnProperty("imageUrl")&&e.imageUrl&&(r.imageUrl=e.imageUrl),e.hasOwnProperty("ext")&&e.ext&&(n=e.ext),r.query+=t.share_ext,n&&(r.query+="&share_ext="+n),r},li="dnsdkConfig",di={dn_source_id:0,dn_source_secret:""},fi=class e{constructor(){this.data=o(li,di)??di}static getInstance(){return e.instance||(e.instance=new e),e.instance}get(){return this.data}save(e){return this.data=e,n(li,e)}clear(){return this.data={...di},i(li)}};fi.instance=null;let hi=fi;const pi=async()=>{const e=await(async()=>await ti.post("/sdk/wx/dn_sdk_config"))();return new Promise((t,r)=>{e?(hi.getInstance().save(e),mo.init({user_action_set_id:e.dn_source_id,secret_key:e.dn_source_secret,appid:u.getInstance().get().mini_program_id}),t({code:0,message:"成功"})):r({code:-1,message:"失败"})})},vi=async e=>{const t=nt(e,["mini_program_id","version","game_id","game_name"]);if(t.length>0)throw new Error(`SDK init error: missing params: ${t.join(", ")}`);return u.getInstance().save(e),await new Promise((e,t)=>{let r=wx.getEnterOptionsSync().query,n={agent_id:r.agent_id||0,site_id:r.site_id||0,queryStr:JSON.stringify(r),gdt_vid:r.gdt_vid||"",weixinadinfo:r.weixinadinfo||""};Co.getInstance().save(n),e(n)}),await pi(),await(async()=>{if(ii.get())try{wx.showShareMenu({withShareTicket:!0}),await ai();let e=ui({});return wx.onShareAppMessage(()=>(mo.getInstance().track("SHARE",{target:"APP_MESSAGE"}),e)),wx.onShareTimeline(()=>(mo.getInstance().track("SHARE",{target:"TIME_LINE"}),e)),wx.onCopyUrl(()=>({query:e})),wx.onAddToFavorites(()=>{mo.getInstance().track("ADD_TO_WISHLIST",{type:"default"})}),Promise.resolve()}catch(e){return Promise.reject(e)}})(),Promise.resolve()};class gi{static instance=null;static timer=null;static reportDelayMap=[20,60,120,180,300,600,1200,1800,3600,7200];constructor(){}async checkOrder(){const e=wx.getStorageInfoSync();for(let t of e.keys)if(t.indexOf("_dnsdkOrderAndReport_")>-1){const e=st(wx.getStorageSync(t));console.log("order",e);const r=gi.reportDelayMap,n=r[e.reportCount],o=it()-e.timestamp;let i=-1;for(let t=r.length-1;t>=0;t--)if(o>=r[t]){i=t;break}if(null==n){wx.removeStorageSync(t),console.log(t+" removed!");continue}if(o>=n){let n=0;if(n=(await ti.post("/payment/order/query",{order_id:e.order_id??null,ext:e.ext})).sync_status??0,n)mo.getInstance().onPurchase(100*e.money),wx.removeStorageSync(t),console.log(t+" report success and removed!");else{if(i==r.length-1){wx.removeStorageSync(t),console.log(t+" removed!");continue}i>e.reportCount&&(e.reportCount=i),e.reportCount+=1,wx.setStorageSync(t,at(e))}}}gi.getInstance().timer=setTimeout(gi.getInstance().checkOrder,6e4)}run(){gi.getInstance().timer||gi.getInstance().checkOrder()}static getInstance(){return this.instance||(this.instance=new gi),this.instance}}const _i=async()=>{const e=await So(),t=await Eo(e);return gi.getInstance().run(),Promise.resolve(t)},yi=()=>{try{let e=Ao.getInstance().get();const t=wx.getLaunchOptionsSync().query.share_ext;return e.share_ext=t||"",Promise.resolve(e)}catch(e){return Promise.reject(e)}},mi=async e=>{const t=nt(e,["data_type","server_id","server_name","role_id","role_name","role_level"]);if(t.length>0)throw new Error(`SDK init error: missing params: ${t.join(", ")}`);2==e.data_type&&mo.getInstance().onCreateRole(),5==e.data_type&&mo.getInstance().onTutorialFinish();const r={data_type:e.data_type,server_id:e.server_id,server_name:e.server_name,role_id:e.role_id,role_name:e.role_name,role_level:e.role_level};return await(async e=>await ti.post("/sdk/role/report",e))(r),Promise.resolve()},wi=async e=>{try{let{cp_order_id:r,money:n,product_id:o,product_name:i,server_id:a,server_name:s,role_id:c,role_name:u,role_level:l,ext:d}=e;const f=await(t={cp_order_id:r,money:n,product_id:o,product_name:i,server_id:a,server_name:s,role_id:c,role_name:u,role_level:l,ext:d},ti.post("/payment/order/create",t)),{inapp:h,wechat_jsapi:p}=f.pay_channel;console.log("createOrderResult",f);let v={},g={};const _=await ki(f),y={..._,pay_type:h?"midas":p?"kf":"",ext:d,money:n,order_id:f.order_id,inapp:h,product_name:i};if(h&&(v=void 0!==_?{..._,pay_type:"midas"}:{}),p){let e={order_id:f.order_id,pay_channel_id:p};g={sessionFrom:JSON.stringify(e),showMessageCard:!0,sendMessagePath:"",sendMessageTitle:"",sendMessageImage:"https://sdk-api.gzshisan.com/img/pay.png",pay_type:"w_gzh"}}return Promise.resolve({midasPayParams:v,gzhPayParams:g,curOrderInfo:y})}catch(r){return Promise.reject(r)}var t},ki=async e=>{if("ios"===Io("platform"))return Promise.resolve({});try{let r={order_id:e.order_id,pay_channel_id:e.pay_channel.inapp?e.pay_channel.inapp:e.pay_channel.wechat_jsapi};const n=await(t=r,ti.post("/payment/order/pay",t));return Promise.resolve(n)}catch(r){return Promise.reject(r)}var t},xi=async({curOrderInfo:e,midasPayParams:t})=>{let r=Io("platform");try{wx.requestMidasPayment({mode:"game",env:t.env,offerId:t.offerId,currencyType:"CNY",platform:r,buyQuantity:t.buyQuantity,amt:e.money,zoneId:t.zoneId,outTradeNo:e.order_id,success:t=>{mo.getInstance().onPurchase(100*e.money);return((e,t)=>{ti.post(`/payment/notify/${e}`,t)})(e.inapp,{money:e.money,order_id:e.order_id,callback_type:"client"}),Promise.resolve()},fail:e=>Promise.reject(e)})}catch(n){return Promise.reject(n)}},Ai=((e,t=2e3)=>{let r=0,n=null;return function(...o){const i=Date.now();return i-r>=t?(r=i,n=null,e.apply(this,o)):(n||(n=Promise.reject(new Error("点击太快,请稍后再试"))),n)}})(async e=>{try{const t={cp_order_id:e.cp_order_id,money:e.money,role_id:e.role_id,role_name:e.role_name,server_id:e.server_id,server_name:e.server_name,ext:e.ext?e.ext:"",role_level:e.role_level,product_id:e.product_id,product_name:e.product_name},{curOrderInfo:r,midasPayParams:o,gzhPayParams:i}=await wi(t);"midas"!=r.pay_type&&n("extOrderAndReport_"+r.order_id,{ext:r.ext,money:r.money,order_id:r.order_id,product_name:r.product_name||"Purchase Item",timestamp:it(),reportCount:0});const a=await(async({curOrderInfo:e,gzhPayParams:t})=>{const r=Io("platform");if("midas"===e.pay_type){if("ios"===r)return Promise.resolve("MIDAS_IOS");wx.checkSession({success:()=>Promise.resolve(),fail(){Ao.getInstance().clear(),So().then(function(e){Eo(e).then(function(){return Promise.resolve()}).catch(e=>Promise.reject(e))}).catch(e=>Promise.reject(e))}})}else if("kf"===e.pay_type)return wx.openCustomerServiceConversation({sessionFrom:t.sessionFrom,showMessageCard:t.showMessageCard,sendMessagePath:t.sendMessagePath,sendMessageTitle:t.sendMessageTitle,sendMessageImg:t.sendMessageImage}),console.log("kfkkk===>",{sessionFrom:t.sessionFrom,showMessageCard:t.showMessageCard,sendMessagePath:t.sendMessagePath,sendMessageTitle:t.sendMessageTitle,sendMessageImg:t.sendMessageImage}),Promise.resolve("CUSTOMER")})({curOrderInfo:r,gzhPayParams:i});return wx.hideLoading(),"object"==typeof a?Promise.resolve({code:0,data:a,msg:"订单创建成功"}):("CUSTOMER"===a||await xi({curOrderInfo:r,midasPayParams:o}),Promise.resolve({code:0,data:null,msg:"订单创建成功"}))}catch(t){return Promise.reject(t)}},2e3),Si=({content:e,scene:t})=>new Promise(async(r,n)=>{var o;r(await(o={do:"secCheckText",version:2,content:e,scene:t},ti.post("/sdk/wx/msg_sec_check",o)))});export{_i as authLogin,yi as getCurrentUserInfo,vi as init,ci as onShareAppMessage,Ai as payment,mi as reportRole,Si as safeTextCheck,si as share};