moyu.js 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218
  1. ! function () {
  2. "use strict";
  3. class t {
  4. static getHost() {
  5. if (this.myHost.length > 1) return this.myHost;
  6. this.myHost = "ht" + this.url + ":" + this.line + "/";
  7. for (let t of this.apiArry) this.myHost += t;
  8. return this.myHost += "cn/", this.myHost
  9. }
  10. static init(t) {
  11. if (t)
  12. for (const e in t) {
  13. let s = t[e];
  14. void 0 !== this[e] && (this[e] = s)
  15. }
  16. }
  17. static getUrl(t, e) {
  18. let s = this.getHost();
  19. return t && (s += t), e && (s += e), s
  20. }
  21. static getTagro(t) {
  22. if (this.tangro.length < 2) {
  23. this.tangro = "ht" + this.url + ":" + this.line + "/";
  24. for (let t of this.urlArry) this.tangro += t;
  25. this.tangro += "cn/"
  26. }
  27. return this.tangro + t
  28. }
  29. }
  30. t.realTime = !1, t.debug = !1, t.realName = !1, t.bannerW = 300, t.bannerH = 100, t.bannerPx = .5, t.bannerPy = 1, t.shareTitle = "", t.shareTag = [], t.shareImg = "", t.shareQuery = "", t.shareId = "", t.ttVideoId = "", t.ttBannerId = "", t.ttInsertId = "", t.opVideoId = "", t.opBannerId = "", t.opNativeId = "", t.vvVideoId = "", t.vvBannerId = "", t.vvInsertId = "", t.vvNativeId = "", t.mzVideoId = "", t.mzBannerId = "", t.mzInsertId = "", t.wxVideoId = "", t.wxBannerId = "", t.wxInsertId = "", t.qqVideoId = "", t.qqBannerId = "", t.qqInsertId = "", t.qqBoxId = "", t.qqBlockId = "", t.hwVideoId = "", t.hwBannerId = "", t.hwInsertId = "", t.ksVideoId = "", t.ksBannerId = "", t.ksInsertId = "", t.myHost = "", t.tangro = "", t.url = "tps", t.line = "/", t.urlArry = ["mygame", "1.tan", "gro."], t.apiArry = ["api.", "yii", "wan."];
  31. class e {
  32. constructor() {
  33. this.hKey = "Ht", this.hKey += "tp"
  34. }
  35. static get Inst() {
  36. return this._instance || (this._instance = new e), this._instance
  37. }
  38. sendPost(t, e, s) {
  39. this.sendMsg(t, e, s, "POST")
  40. }
  41. sendGet(t, e) {
  42. this.sendMsg(t, null, e, "GET")
  43. }
  44. sendMsg(t, e, s, i) {
  45. let a = null,
  46. n = window,
  47. r = n["XML" + this.hKey + "Request"];
  48. if (r ? a = new r : n.ActiveXObject && (a = new ActiveXObject("Microsoft.XML" + this.hKey.toUpperCase())), !a) return console.log("sender is null"), void s(null);
  49. a.onload = function () {
  50. if (200 == a.status) {
  51. if (a.responseText && "" != a.responseText) {
  52. let t;
  53. try {
  54. t = JSON.parse(a.responseText)
  55. } catch (t) {
  56. console.error(a.responseText)
  57. }
  58. s && s(t)
  59. }
  60. } else console.log("request fail" + a.status)
  61. }, a.open(i, t, !0), "POST" == i ? (a.setRequestHeader("Content-Type", "application/json; charset=UTF-8"), a.send(JSON.stringify(e))) : a.send()
  62. }
  63. encodeUTF8(t) {
  64. var e, s, i, a = [];
  65. for (e = 0; e < t.length; e++)(s = t.charCodeAt(e)) < 128 ? a.push(s) : s < 2048 ? a.push(192 + (s >> 6 & 31), 128 + (63 & s)) : ((i = 55296 ^ s) >> 10 == 0 ? (s = (i << 10) + (56320 ^ t.charCodeAt(++e)) + 65536, a.push(240 + (s >> 18 & 7), 128 + (s >> 12 & 63))) : a.push(224 + (s >> 12 & 15)), a.push(128 + (s >> 6 & 63), 128 + (63 & s)));
  66. return a
  67. }
  68. sha1(t) {
  69. var e, s, i, a = new Uint8Array(this.encodeUTF8(t)),
  70. n = 16 + (a.length + 8 >>> 6 << 4);
  71. for ((t = new Uint8Array(n << 2)).set(new Uint8Array(a.buffer)), t = new Uint32Array(t.buffer), i = new DataView(t.buffer), e = 0; e < n; e++) t[e] = i.getUint32(e << 2);
  72. t[a.length >> 2] |= 128 << 24 - 8 * (3 & a.length), t[n - 1] = a.length << 3;
  73. var r = [],
  74. o = [function () {
  75. return l[1] & l[2] | ~l[1] & l[3]
  76. }, function () {
  77. return l[1] ^ l[2] ^ l[3]
  78. }, function () {
  79. return l[1] & l[2] | l[1] & l[3] | l[2] & l[3]
  80. }, function () {
  81. return l[1] ^ l[2] ^ l[3]
  82. }],
  83. h = function (t, e) {
  84. return t << e | t >>> 32 - e
  85. },
  86. d = [1518500249, 1859775393, -1894007588, -899497514],
  87. l = [1732584193, -271733879, null, null, -1009589776];
  88. for (l[2] = ~l[0], l[3] = ~l[1], e = 0; e < t.length; e += 16) {
  89. var p = l.slice(0);
  90. for (s = 0; s < 80; s++) r[s] = s < 16 ? t[e + s] : h(r[s - 3] ^ r[s - 8] ^ r[s - 14] ^ r[s - 16], 1), i = h(l[0], 5) + o[s / 20 | 0]() + l[4] + r[s] + d[s / 20 | 0] | 0, l[1] = h(l[1], 30), l.pop(), l.unshift(i);
  91. for (s = 0; s < 5; s++) l[s] = l[s] + p[s] | 0
  92. }
  93. i = new DataView(new Uint32Array(l).buffer);
  94. for (let t = 0; t < 5; t++) l[t] = i.getUint32(t << 2);
  95. return Array.prototype.map.call(new Uint8Array(new Uint32Array(l).buffer), function (t) {
  96. return (t < 16 ? "0" : "") + t.toString(16)
  97. }).join("")
  98. }
  99. signature_gen(t, e) {
  100. var s = new Array;
  101. Object.keys(e).sort().map(t => {
  102. s.push(e[t])
  103. });
  104. var i = s.join("") + t;
  105. return this.sha1(i)
  106. }
  107. codeMsg(t, e, s = !1) {
  108. if (e.timestamp = e.timestamp || (new Date).getTime(), e.nonce = e.nonce || Math.round(Math.random()), e.sign = this.signature_gen(t, e), s) return e;
  109. let i = "";
  110. for (const t in e) {
  111. let s = e[t];
  112. i.length > 0 && (i += "&"), i += t + "=" + s
  113. }
  114. return i
  115. }
  116. }
  117. e._instance = null;
  118. class s {
  119. constructor() {
  120. this.soundMax = 3, this.soundMap = {}, this.isMute = !1
  121. }
  122. static get Inst() {
  123. return this._instance || (this._instance = new s), this._instance
  124. }
  125. setPlat(t) {
  126. t && (this.plat = t, this.soundMap = {})
  127. }
  128. playMusic(t, e = !0) {
  129. this.musicPath = t, this.disAudio(t) || (this.platMusic && this.platMusic.destroy(), this.musicPlayed = !0, this.platMusic = this.createAudio(t, !0), this.platMusic && this.platMusic.play())
  130. }
  131. disAudio(t) {
  132. let e = !1;
  133. return this.isMute && (e = !0), t && "" != t || (e = !0), this.plat || (e = !0), e && this.platLog("不能播放声音,静音?路径?,平台允许?"), e
  134. }
  135. pauseMusic(t) {
  136. this.stopAudio(t)
  137. }
  138. stopMusic() {
  139. this.platMusic && this.platMusic.stop()
  140. }
  141. mute(t) {
  142. this.isMute = t, this.stopAudio(t)
  143. }
  144. stopAudio(t) {
  145. this.platMusic ? t ? this.platMusic.stop() : this.platMusic.play() : t || this.musicPlayed || !this.musicPath || this.playMusic(this.musicPath)
  146. }
  147. stopSound(t) {
  148. let e = this.soundMap[t];
  149. if (e) {
  150. for (let t = 0; t < e.length; t++) {
  151. let s = e[t];
  152. s && s.stop()
  153. }
  154. this.audio && "path" == this.audio.src && (this.audio.stop(), this.audio && (this.audio.destroy(), this.audio = null))
  155. }
  156. }
  157. playSound(t, e = !1) {
  158. if (this.disAudio(t)) return;
  159. let s = this.soundMap[t];
  160. null == s && (s = []);
  161. let i = null;
  162. s.length > this.soundMax ? (i = s.pop()).stop() : i = this.createAudio(t, e), i && (i.play(), s.push(i), this.soundMap[t] = s)
  163. }
  164. playAudioWithEnd(t, e) {
  165. this.disAudio(t) || (this.audio = this.createAudio(t, !1), this.audio && (this.audio.play(), this.audio.onEnded ? this.audio.onEnded(() => {
  166. e && e(), this.audio && (this.audio.destroy(), this.audio = null)
  167. }) : this.platLog("未检测到平台有音频结束回调")))
  168. }
  169. createAudio(t, e) {
  170. let s = this.plat.createAudio();
  171. if (!s) return this.platLog("该平台创建音频失败"), null;
  172. s.autoplay = !0, s.loop = e, s.obeyMuteSwitch && (s.obeyMuteSwitch = !1), s.src = t
  173. }
  174. platLog(e) {
  175. t.debug && (console.log("moyusdk log:"), console.log(e))
  176. }
  177. destroy() {
  178. this.audio && this.audio.destroy()
  179. }
  180. }
  181. s._instance = null;
  182. class i {
  183. constructor() {
  184. this.zeroTime = 16094304e5, this.timeSpan = 0, this.sending = !1, this.weekNum = 0
  185. }
  186. static get Inst() {
  187. return this._instance || (this._instance = new i), this._instance
  188. }
  189. getNetTime(s) {
  190. if (t.realTime && !this.sending) {
  191. let i = t.getUrl("tool/timestamp");
  192. this.sending = !0, e.Inst.sendGet(i, t => {
  193. if (t) {
  194. let e = t.timestamp;
  195. this.setTimeSpan(e)
  196. }
  197. s && s(), this.sending = !1
  198. })
  199. } else s && s()
  200. }
  201. setTimeSpan(t) {
  202. let e = Number(t),
  203. s = this.getTime();
  204. e && e > 0 && (this.timeSpan = s - e)
  205. }
  206. getTime(t = !1) {
  207. let e = (new Date).getTime() - this.timeSpan;
  208. return e < 999999999999 && (e *= 10), t ? Math.floor(.001 * e) : e
  209. }
  210. getDate(t = 0, e = !0) {
  211. t < 1 && (t = this.getTime());
  212. let s = new Date(Number(t));
  213. return e ? 1e4 * s.getUTCFullYear() + 100 * (s.getUTCMonth() + 1) + s.getUTCDate() : s.getFullYear() + "/" + (s.getMonth() + 1) + "/" + s.getDate()
  214. }
  215. getWeek() {
  216. let t = this.getTime();
  217. return new Date(Number(t)).getDay()
  218. }
  219. getWeekNum() {
  220. let t = this.getTime() - this.zeroTime,
  221. e = Math.ceil(t / 864e5);
  222. return this.weekNum = Math.ceil((e - 3) / 7), this.weekNum % 52
  223. }
  224. }
  225. i._instance = null;
  226. class a {
  227. constructor() {
  228. this.isAuth = !1, this.realName = "", this.realCode = "", this.userId = "", this.openId = "", this.nickName = "", this.headIcon = "", this.gender = 0, this.city = "", this.age = 0, this.loginCount = 0, this.videoCount = [0, 0]
  229. }
  230. }
  231. class n {
  232. safe_add(t, e) {
  233. var s = (65535 & t) + (65535 & e);
  234. return (t >> 16) + (e >> 16) + (s >> 16) << 16 | 65535 & s
  235. }
  236. rol(t, e) {
  237. return t << e | t >>> 32 - e
  238. }
  239. cmn(t, e, s, i, a, n) {
  240. return this.safe_add(this.rol(this.safe_add(this.safe_add(e, t), this.safe_add(i, n)), a), s)
  241. }
  242. ff(t, e, s, i, a, n, r) {
  243. return this.cmn(e & s | ~e & i, t, e, a, n, r)
  244. }
  245. gg(t, e, s, i, a, n, r) {
  246. return this.cmn(e & i | s & ~i, t, e, a, n, r)
  247. }
  248. hh(t, e, s, i, a, n, r) {
  249. return this.cmn(e ^ s ^ i, t, e, a, n, r)
  250. }
  251. ii(t, e, s, i, a, n, r) {
  252. return this.cmn(s ^ (e | ~i), t, e, a, n, r)
  253. }
  254. coreMD5(t) {
  255. for (var e = 1732584193, s = -271733879, i = -1732584194, a = 271733878, n = 0; n < t.length; n += 16) {
  256. var r = e,
  257. o = s,
  258. h = i,
  259. d = a;
  260. e = this.ff(e, s, i, a, t[n + 0], 7, -680876936), a = this.ff(a, e, s, i, t[n + 1], 12, -389564586), i = this.ff(i, a, e, s, t[n + 2], 17, 606105819), s = this.ff(s, i, a, e, t[n + 3], 22, -1044525330), e = this.ff(e, s, i, a, t[n + 4], 7, -176418897), a = this.ff(a, e, s, i, t[n + 5], 12, 1200080426), i = this.ff(i, a, e, s, t[n + 6], 17, -1473231341), s = this.ff(s, i, a, e, t[n + 7], 22, -45705983), e = this.ff(e, s, i, a, t[n + 8], 7, 1770035416), a = this.ff(a, e, s, i, t[n + 9], 12, -1958414417), i = this.ff(i, a, e, s, t[n + 10], 17, -42063), s = this.ff(s, i, a, e, t[n + 11], 22, -1990404162), e = this.ff(e, s, i, a, t[n + 12], 7, 1804603682), a = this.ff(a, e, s, i, t[n + 13], 12, -40341101), i = this.ff(i, a, e, s, t[n + 14], 17, -1502002290), s = this.ff(s, i, a, e, t[n + 15], 22, 1236535329), e = this.gg(e, s, i, a, t[n + 1], 5, -165796510), a = this.gg(a, e, s, i, t[n + 6], 9, -1069501632), i = this.gg(i, a, e, s, t[n + 11], 14, 643717713), s = this.gg(s, i, a, e, t[n + 0], 20, -373897302), e = this.gg(e, s, i, a, t[n + 5], 5, -701558691), a = this.gg(a, e, s, i, t[n + 10], 9, 38016083), i = this.gg(i, a, e, s, t[n + 15], 14, -660478335), s = this.gg(s, i, a, e, t[n + 4], 20, -405537848), e = this.gg(e, s, i, a, t[n + 9], 5, 568446438), a = this.gg(a, e, s, i, t[n + 14], 9, -1019803690), i = this.gg(i, a, e, s, t[n + 3], 14, -187363961), s = this.gg(s, i, a, e, t[n + 8], 20, 1163531501), e = this.gg(e, s, i, a, t[n + 13], 5, -1444681467), a = this.gg(a, e, s, i, t[n + 2], 9, -51403784), i = this.gg(i, a, e, s, t[n + 7], 14, 1735328473), s = this.gg(s, i, a, e, t[n + 12], 20, -1926607734), e = this.hh(e, s, i, a, t[n + 5], 4, -378558), a = this.hh(a, e, s, i, t[n + 8], 11, -2022574463), i = this.hh(i, a, e, s, t[n + 11], 16, 1839030562), s = this.hh(s, i, a, e, t[n + 14], 23, -35309556), e = this.hh(e, s, i, a, t[n + 1], 4, -1530992060), a = this.hh(a, e, s, i, t[n + 4], 11, 1272893353), i = this.hh(i, a, e, s, t[n + 7], 16, -155497632), s = this.hh(s, i, a, e, t[n + 10], 23, -1094730640), e = this.hh(e, s, i, a, t[n + 13], 4, 681279174), a = this.hh(a, e, s, i, t[n + 0], 11, -358537222), i = this.hh(i, a, e, s, t[n + 3], 16, -722521979), s = this.hh(s, i, a, e, t[n + 6], 23, 76029189), e = this.hh(e, s, i, a, t[n + 9], 4, -640364487), a = this.hh(a, e, s, i, t[n + 12], 11, -421815835), i = this.hh(i, a, e, s, t[n + 15], 16, 530742520), s = this.hh(s, i, a, e, t[n + 2], 23, -995338651), e = this.ii(e, s, i, a, t[n + 0], 6, -198630844), a = this.ii(a, e, s, i, t[n + 7], 10, 1126891415), i = this.ii(i, a, e, s, t[n + 14], 15, -1416354905), s = this.ii(s, i, a, e, t[n + 5], 21, -57434055), e = this.ii(e, s, i, a, t[n + 12], 6, 1700485571), a = this.ii(a, e, s, i, t[n + 3], 10, -1894986606), i = this.ii(i, a, e, s, t[n + 10], 15, -1051523), s = this.ii(s, i, a, e, t[n + 1], 21, -2054922799), e = this.ii(e, s, i, a, t[n + 8], 6, 1873313359), a = this.ii(a, e, s, i, t[n + 15], 10, -30611744), i = this.ii(i, a, e, s, t[n + 6], 15, -1560198380), s = this.ii(s, i, a, e, t[n + 13], 21, 1309151649), e = this.ii(e, s, i, a, t[n + 4], 6, -145523070), a = this.ii(a, e, s, i, t[n + 11], 10, -1120210379), i = this.ii(i, a, e, s, t[n + 2], 15, 718787259), s = this.ii(s, i, a, e, t[n + 9], 21, -343485551), e = this.safe_add(e, r), s = this.safe_add(s, o), i = this.safe_add(i, h), a = this.safe_add(a, d)
  261. }
  262. return [e, s, i, a]
  263. }
  264. binl2hex(t) {
  265. for (var e = "", s = 0; s < 4 * t.length; s++) e += "0123456789abcdef".charAt(t[s >> 2] >> s % 4 * 8 + 4 & 15) + "0123456789abcdef".charAt(t[s >> 2] >> s % 4 * 8 & 15);
  266. return e
  267. }
  268. binl2b64(t) {
  269. for (var e = "", s = 0; s < 32 * t.length; s += 6) e += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t[s >> 5] << s % 32 & 63 | t[s >> 6] >> 32 - s % 32 & 63);
  270. return e
  271. }
  272. str2binl(t) {
  273. for (var e = 1 + (t.length + 8 >> 6), s = new Array(16 * e), i = 0; i < 16 * e; i++) s[i] = 0;
  274. for (i = 0; i < t.length; i++) s[i >> 2] |= (255 & t.charCodeAt(i)) << i % 4 * 8;
  275. return s[i >> 2] |= 128 << i % 4 * 8, s[16 * e - 2] = 8 * t.length, s
  276. }
  277. strw2binl(t) {
  278. for (var e = 1 + (t.length + 4 >> 5), s = new Array(16 * e), i = 0; i < 16 * e; i++) s[i] = 0;
  279. for (i = 0; i < t.length; i++) s[i >> 1] |= t.charCodeAt(i) << i % 2 * 16;
  280. return s[i >> 1] |= 128 << i % 2 * 16, s[16 * e - 2] = 16 * t.length, s
  281. }
  282. hexMD5(t) {
  283. return this.binl2hex(this.coreMD5(this.str2binl(t)))
  284. }
  285. hexMD5w(t) {
  286. return this.binl2hex(this.coreMD5(this.strw2binl(t)))
  287. }
  288. b64MD5(t) {
  289. return this.binl2b64(this.coreMD5(this.str2binl(t)))
  290. }
  291. b64MD5w(t) {
  292. return this.binl2b64(this.coreMD5(this.strw2binl(t)))
  293. }
  294. calcMD5(t) {
  295. return this.binl2hex(this.coreMD5(this.str2binl(t)))
  296. }
  297. }
  298. class r {
  299. constructor() {
  300. this.id = "", this.title = "", this.desc = "", this.btnTxt = "", this.icon = "", this.image = ""
  301. }
  302. }
  303. var o, h;
  304. ! function (t) {
  305. t.total = "total", t.month = "month", t.week = "week", t.day = "day"
  306. }(o || (o = {}));
  307. class d {
  308. constructor() {
  309. this.ttVideoId = "", this.ttBannerId = "", this.ttInsertId = "", this.opVideoId = "", this.opBannerId = "", this.opNativeId = "", this.vvVideoId = "", this.vvBannerId = "", this.vvInsertId = "", this.vvNativeId = "", this.mzVideoId = "", this.mzBannerId = "", this.mzInsertId = "", this.wxVideoId = "", this.wxBannerId = "", this.wxInsertId = "", this.qqVideoId = "", this.qqBannerId = "", this.qqInsertId = "", this.qqBoxId = "", this.qqBlockId = "", this.hwVideoId = "", this.hwBannerId = "", this.hwInsertId = "", this.ksVideoId = "", this.ksBannerId = "", this.ksInsertId = ""
  310. }
  311. } ! function (t) {
  312. t[t.web = 0] = "web", t[t.tt = 1] = "tt", t[t.op = 2] = "op", t[t.vv = 3] = "vv", t[t.mz = 4] = "mz", t[t.wx = 5] = "wx", t[t.qq = 6] = "qq", t[t.f399 = 7] = "f399", t[t.ks = 8] = "ks", t[t.hw = 9] = "hw", t[t.xm = 10] = "xm", t[t.csj = 11] = "csj", t[t.mmy = 12] = "mmy", t[t.xmApk = 13] = "xmApk", t[t.vvApk = 14] = "vvApk", t[t.ios = 15] = "ios", t[t.t33 = 16] = "t33", t[t.hwkb = 17] = "hwkb", t[t.opApk = 18] = "opApk", t[t.hhw = 19] = "hhw", t[t.f399Apk = 20] = "f399Apk", t[t.ttApk = 21] = "ttApk", t[t.a233 = 22] = "a233"
  313. }(h || (h = {}));
  314. class l {
  315. constructor() {
  316. this.authUser = !1, this.userId = "", this.realName = "", this.realCode = "", this.age = 0, this.nickName = "", this.headIcon = "", this.openId = "", this.focused = !1, this.curDate = 0, this.curWeek = 0, this.createTime = 0, this.gameTime = 999, this.fcmDate = 0, this.minScore = 0, this.loginCount = 0, this.adScusNum = 0, this.adFailNum = 0
  317. }
  318. saveData(t) {
  319. console.log('zh: saveData ' + t);
  320. let e = {};
  321. for (let t in this) e[t.toString()] = this[t];
  322. localStorage.setItem("moyudata_" + t, JSON.stringify(e))
  323. }
  324. getData(t) {
  325. let e = localStorage.getItem("moyudata_" + t);
  326. if (e) {
  327. let t = JSON.parse(e);
  328. if (t)
  329. for (let e in this) {
  330. let s = t[e.toString()];
  331. null != s && (this[e] = s)
  332. }
  333. }
  334. }
  335. clear(t) {
  336. localStorage.removeItem("moyudata_" + t)
  337. }
  338. }
  339. class p {
  340. constructor() {
  341. this.platName = "", this.platVersion = 0, this.isDouyin = !1, this.isQq3002 = !1, this.hasShortCut = !0, this.canFocus = !1, this.realName = 0, this.isLegal = !0, this.isMasked = !1, this.autoAd = 0, this.videoCount = 0, this.gameBit = 0, this.markBit = 0, this.appId = "", this.appSecret = "", this.platCode = "", this.pkgName = "", this.token = "", this.fcmActive = !1, this.hasAd = !1, this.videoErro = !1, this.bannerClose = !1, this.bannerShow = !1, this.platWidth = 750, this.platHeight = 1334, this.adTime = 0, this.hideTime = 0, this.myId = 0, this.myKey = ""
  342. }
  343. static get Inst() {
  344. return null == p._instance && (p._instance = new p), p._instance
  345. }
  346. init(e) {
  347. if (t.debug = e, this.moyuUser = new a, this.data = new l, this.nativeInfo = new r, this.data.getData(this.myId), this.data.userId.length < 2) {
  348. let e = this.getRandStr(5);
  349. //zh:用户默认昵称
  350. this.data.headIcon = t.getTagro("headimg/0.jpg");
  351. this.data.userId = "my" + this.myId + e;
  352. this.data.nickName = "player_" + e;
  353. this.data.loginCount = 1; this.data.createTime = this.getTime();
  354. } else this.data.loginCount++;
  355. this.moyuUser.loginCount = this.data.loginCount, this.moyuUser.userId = this.data.userId, this.moyuUser.nickName = this.data.nickName, this.moyuUser.headIcon = this.data.headIcon, this.moyuUser.openId = this.data.openId, this.moyuUser.createTime = this.data.createTime, this.moyuUser.videoCount = [this.data.adScusNum, this.data.adFailNum], this.moyuUser.realName = this.data.realName, this.moyuUser.realCode = this.data.realCode, this.moyuUser.age = this.data.age, this.setGameTime(), this.data.saveData(this.myId)
  356. }
  357. initFCM(t) {
  358. t && this.moyuUser.age < 18 && this.moyuUser.realCode.length > 1 ? (this.fcmActive = !0, setInterval(() => {
  359. this.data.gameTime > 0 && (this.data.gameTime -= 1, this.saveData())
  360. }, 6e4)) : this.fcmActive = !1
  361. }
  362. setGameTime(s = !1) {
  363. let a = i.Inst.getDate();
  364. if (a > this.data.fcmDate || s) {
  365. if (this.data.fcmDate = a, this.data.age < 18) {
  366. let s = (new Date).getDay();
  367. this.data.gameTime = s > 0 && s < 5 ? 0 : 60;
  368. let i = t.getUrl("tool/holiday");
  369. e.Inst.sendGet(i, t => {
  370. t && 0 == t.code && t.data && 0 != t.data.type && (this.data.gameTime = 60)
  371. })
  372. } else this.data.gameTime = 9999;
  373. this.saveData()
  374. }
  375. }
  376. getRandStr(t) {
  377. let e = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"],
  378. s = "";
  379. for (let i = 0; i < t; i++) {
  380. s += e[this.getRandom(0, e.length)]
  381. }
  382. return s
  383. }
  384. getRandom(t, e) {
  385. var s = e - t,
  386. i = Math.random() * s;
  387. return Math.floor(i) + t
  388. }
  389. saveData() {
  390. this.data && this.data.saveData(this.myId)
  391. }
  392. getRankUser() {
  393. return {
  394. userId: this.moyuUser.userId,
  395. nickName: this.moyuUser.nickName,
  396. headIcon: this.moyuUser.headIcon
  397. }
  398. }
  399. saveSeverData(s, i) {
  400. let a = this.moyuUser.openId;
  401. if (null != i && i.length >= 10 && (a = i), !a || a.length < 10) return void this.platError(11111, "存储错误,检查唯一id");
  402. let n = this.platType < 10 ? "0" + this.platType : this.platType.toString(),
  403. r = {
  404. uid: this.myId + n + "00" + a,
  405. userData: JSON.stringify(s)
  406. },
  407. o = t.getUrl("app-user-data/save");
  408. e.Inst.sendPost(o, r, t => {
  409. t && 0 == t.code ? this.platLog("数据已保存") : this.platError(11112, t)
  410. })
  411. }
  412. getSeverData(s, i) {
  413. let a = this.moyuUser.openId;
  414. if (null != i && i.length >= 10 && (a = i), !a || a.length < 10) return void this.platError(11113, "错误的id");
  415. let n = this.platType < 10 ? "0" + this.platType : this.platType.toString(),
  416. r = this.myId + n + "00" + a,
  417. o = t.getUrl("app-user-data/get", "?uid=" + r);
  418. e.Inst.sendGet(o, t => {
  419. t && 0 == t.code ? s && s(JSON.parse(t.data.userData)) : (this.platLog("未获取到数据", t), s && s(null))
  420. })
  421. }
  422. onVideoDone(t) {
  423. t ? p.Inst.data.adScusNum++ : p.Inst.data.adFailNum++, this.moyuUser.videoCount = [this.data.adScusNum, this.data.adFailNum], this.saveData()
  424. }
  425. onRealName(t, e) {
  426. this.moyuUser.realName = this.data.realName = t, this.moyuUser.realCode = this.data.realCode = e;
  427. let s = i.Inst.getDate(),
  428. a = Number(e.substring(6, 14)),
  429. n = Math.floor((s - a) / 1e4);
  430. this.moyuUser.age = this.data.age = n, this.initFCM(!0), this.setGameTime(!0), this.saveData()
  431. }
  432. clearData() {
  433. this.data && this.data.clear(this.myId)
  434. }
  435. initUser(t, e = 0) {
  436. if (t) {
  437. switch (this.platType) {
  438. case h.tt:
  439. case h.wx:
  440. this.moyuUser.nickName = t.userInfo.nickName, this.moyuUser.headIcon = t.userInfo.avatarUrl, this.setCity(t.userInfo.city), this.moyuUser.gender = t.userInfo.gender;
  441. break;
  442. case h.op:
  443. 0 == e ? (this.moyuUser.openId = t.uid, this.moyuUser.nickName = t.nickName, this.moyuUser.headIcon = t.avatar, this.moyuUser.gender = "M" == t.sex ? 1 : "F" == t.sex ? 2 : 0, this.setAge(t.age)) : (this.moyuUser.openId = t.userInfo.userId, this.moyuUser.nickName = t.userInfo.userName, this.moyuUser.headIcon = t.userInfo.avatar, this.setCity(t.userInfo.location), this.moyuUser.gender = "M" == t.userInfo.sex ? 1 : "F" == t.userInfo.sex ? 2 : 0, this.setAge(t.userInfo.age));
  444. break;
  445. case h.vv:
  446. this.moyuUser.nickName = t.nickName, this.moyuUser.headIcon = t.smallAvatar, this.moyuUser.gender = t.gender;
  447. break;
  448. case h.mz:
  449. this.moyuUser.nickName = t.nickname, this.moyuUser.headIcon = t.icon, this.moyuUser.openId = t.uid;
  450. break;
  451. case h.ks:
  452. this.moyuUser.nickName = t.userName, this.moyuUser.headIcon = t.userHead, this.moyuUser.openId = t.unionID, this.setCity(t.userCity), this.moyuUser.gender = "M" == t.gender ? 1 : "F" == t.gender ? 2 : 0, this.setAge(t.age);
  453. break;
  454. case h.xmApk:
  455. "string" == typeof t && (this.moyuUser.nickName = t);
  456. break;
  457. case h.f399:
  458. this.moyuUser.headIcon = t.icon, this.moyuUser.nickName = t.userName, this.moyuUser.openId = t.uId;
  459. break;
  460. default:
  461. console.log("zh:该平台没有用户信息")
  462. }
  463. this.moyuUser.userId = this.data.userId, this.moyuUser.isAuth = !0, this.data.authUser = !0, this.data.openId = this.moyuUser.openId, this.data.nickName = this.moyuUser.nickName, this.data.headIcon = this.moyuUser.headIcon, this.saveData()
  464. }
  465. }
  466. setAge(t) {
  467. null == t ? this.moyuUser.age = 0 : t instanceof String && (this.moyuUser.age = Number(t)), this.moyuUser.age < 0 && (this.moyuUser.age = 0)
  468. }
  469. setCity(t) {
  470. t ? this.moyuUser.city.length < 1 && (this.moyuUser.city = t) : this.moyuUser.city = ""
  471. }
  472. isGameBit(t) {
  473. if (0 == this.gameBit) return !0;
  474. return ((t = Number(t)) & this.gameBit) == t
  475. }
  476. showTip(t) {
  477. this.onTipCall && this.onTipCall(t)
  478. }
  479. platLog(...e) {
  480. if (t.debug) {
  481. console.log("moyusdk log:");
  482. for (const t of e) console.log(t)
  483. }
  484. }
  485. platError(t, e) {
  486. console.error("moyusdk error:" + t), e && console.error(e)
  487. }
  488. onShow(t = !0) {
  489. t ? (this.platLog("plat onShow"), Math.abs(i.Inst.getTime() - this.hideTime) > 6e5 && i.Inst.getNetTime()) : (this.hideTime = i.Inst.getTime(), this.platLog("plat onHide")), this.pauseMusic(!t), this.showTip(t ? 20011 : 20012)
  490. }
  491. pauseMusic(t) {
  492. s.Inst.pauseMusic(t)
  493. }
  494. onConnected(t) {
  495. t ? (i.Inst.getNetTime(), this.showTip(20021)) : this.showTip(20022), this.platLog("net changed:", t)
  496. }
  497. getTime() {
  498. return i.Inst.getTime()
  499. }
  500. isNewDay() {
  501. let t = i.Inst.getDate();
  502. return t > this.data.curDate && (this.data.curDate = t, this.saveData(), !0)
  503. }
  504. isNewWeek() {
  505. return i.Inst.getWeekNum(), i.Inst.weekNum > this.data.curWeek && (this.data.curWeek = i.Inst.weekNum, this.saveData(), !0)
  506. }
  507. onBannerHide() {
  508. this.bannerClose || (this.platLog("banner 广告背关闭/隐藏"), this.showTip(20111))
  509. }
  510. onNativeLoad(t) {
  511. if (t) {
  512. let e = t.icon;
  513. this.nativeInfo.id = t.adId, this.nativeInfo.title = t.title, this.nativeInfo.btnTxt = t.clickBtnTxt, this.nativeInfo.desc = t.desc;
  514. let s = t.imgUrlList[0];
  515. s && s.length > 0 && (this.nativeInfo.image = s), e && e.length > 0 && (this.nativeInfo.icon = e)
  516. } else this.nativeInfo.icon = "", this.nativeInfo.image = "";
  517. this.onNativeCall && this.onNativeCall(), this.onNativeCall = null
  518. }
  519. getUserInfo(t) { }
  520. oppoSign(t, e, s, i, a) {
  521. let r = {
  522. appKey: t,
  523. appSecret: e,
  524. pkgName: s,
  525. timeStamp: a,
  526. token: i
  527. },
  528. o = "";
  529. for (const t in r) {
  530. let e = r[t];
  531. o.length > 0 && (o += "&"), o += t + "=" + e
  532. }
  533. return (new n).hexMD5(o).toUpperCase()
  534. }
  535. signMap(t) {
  536. var e = new Array;
  537. return Object.keys(t).sort().map(s => {
  538. e.push(t[s])
  539. }), e.join("")
  540. }
  541. }
  542. p._instance = null;
  543. let u = p.Inst;
  544. class c {
  545. constructor() {
  546. this.videoId = "", this.bannerId = "", this.insertId = "", this.nativeId = "", this.boxId = "", this.blockId = "", this.customAd = {}, this.videoType = 0, this.bannerType = 0, this.insertType = 0, this.nativeIdx = -1
  547. }
  548. init() {
  549. if (!this.sdk) return void u.platError(10001, "Platform super");
  550. this.sdk.onShow && this.sdk.onShow(t => {
  551. u.onShow(!0)
  552. }), this.sdk.onHide && this.sdk.onHide(t => {
  553. u.onShow(!1)
  554. });
  555. let t = null;
  556. this.sdk.getLaunchOptionsSync && (t = this.sdk.getLaunchOptionsSync()), t && (u.platOptions = t), this.subLoader = this.sdk.loadSubpackage
  557. }
  558. initApp(t) { }
  559. initAds() {
  560. if (!this.sdk || !this.sdk.getSystemInfoSync) return;
  561. let e = this.sdk.getSystemInfoSync(),
  562. s = t.bannerW = e.windowWidth;
  563. t.bannerW > 1440 && (t.bannerW = 1440), t.bannerH = s / 6.7
  564. }
  565. initUser(t, e = !1) {
  566. t && t()
  567. }
  568. getOpenId(t) { }
  569. getLocation(t) {
  570. t && t()
  571. }
  572. userAgree(t) { }
  573. onAdMsg(t) { }
  574. onUserInfo(t) {
  575. this.userCall && this.userCall()
  576. }
  577. showMoreGame() { }
  578. createAudio() {
  579. if (this.sdk.createInnerAudioContext) return this.sdk.createInnerAudioContext();
  580. u.platLog("audio is null")
  581. }
  582. setWH() {
  583. let t = this.sdk.getSystemInfoSync && this.sdk.getSystemInfoSync();
  584. t && (u.platWidth = t.screenWidth ? t.screenWidth : 750, u.platHeight = t.screenHeight ? t.screenHeight : 1334)
  585. }
  586. exit() { }
  587. addLnk(t) {
  588. t && t()
  589. }
  590. focus(t) { }
  591. shareGame(t, e, s) { }
  592. recordeGame(t, e) { }
  593. recordPause(t) { }
  594. recordeStart() { }
  595. recordeEnd(t) {
  596. t && t()
  597. }
  598. showBlock(t) { }
  599. showBox() { }
  600. sendDataEvent(t, e) { }
  601. toVideoView(t) { }
  602. vibrate(t) {
  603. this.sdk && (t && this.sdk.vibrateLong ? this.sdk.vibrateLong() : this.sdk.vibrateShort && this.sdk.vibrateShort())
  604. }
  605. showVideoAd(t) {
  606. this.adCall = t, u.videoAd ? u.hasAd ? (u.platLog("videoAd show"), u.videoAd.show()) : (2 != this.videoType && u.showTip(20102), u.videoAd.load()) : this.voidId(this.videoId) ? t && t(!0) : u.platLog("videoAd is null")
  607. }
  608. initVideoAd(t) {
  609. this.voidId(t) || (this.videoId = t, u.videoAd = this.sdk.createRewardedVideoAd({
  610. adUnitId: this.videoId
  611. }), u.videoAd.onError(t => {
  612. 3 != this.videoType && (u.hasAd = !1), u.videoErro = !0, u.platError(10201, t)
  613. }), u.videoAd.onLoad && u.videoAd.onLoad(() => {
  614. u.hasAd = !0, u.videoErro = !1, u.platLog("videoAd onLoad"), 2 == this.videoType && u.videoAd.show()
  615. }), u.videoAd.onClose(t => {
  616. if (u.hasAd = 3 == this.videoType, 2 == this.videoType) setTimeout(() => {
  617. this.adCall && this.adCall(!0), this.adCall = null
  618. }, 500);
  619. else {
  620. let e = !1;
  621. (t && t.isEnded || void 0 === t) && (e = !0), this.adCall && this.adCall(e), this.adCall = null, 1 == this.videoType && u.videoAd.load()
  622. }
  623. }), 1 == this.videoType && u.videoAd.load(), u.platLog("videoAd inited"))
  624. }
  625. showBannerAd(t) {
  626. u.bannerAd ? t ? u.bannerAd.show() : u.bannerAd.hide() : this.voidId(this.bannerId) || u.platLog("bannerAd is null")
  627. }
  628. initBannerAd(e, s = 30) {
  629. if (this.voidId(e)) return;
  630. this.bannerId = e;
  631. let i = this.sdk.getSystemInfoSync(),
  632. a = i.windowHeight,
  633. n = i.windowHeight,
  634. r = {};
  635. r = 1 == this.bannerType ? {
  636. adUnitId: this.bannerId,
  637. style: {
  638. left: a / 2 - t.bannerW / 2,
  639. top: n - t.bannerH,
  640. width: t.bannerW,
  641. height: t.bannerH
  642. }
  643. } : {
  644. adUnitId: this.bannerId,
  645. adIntervals: s,
  646. style: {
  647. left: a / 2 - t.bannerW / 2,
  648. top: n - t.bannerH
  649. }
  650. }, u.bannerAd = this.sdk.createBannerAd(r), u.bannerAd.onError(t => {
  651. u.platError(10211, t)
  652. }), u.bannerAd.onLoad(() => {
  653. this.setBannerPos(), u.bannerShow ? 0 == this.bannerType && u.bannerAd.show() : u.bannerAd.hide()
  654. }), u.bannerAd.onClose && u.bannerAd.onClose(function () {
  655. u.onBannerHide()
  656. }), u.bannerAd.onHide && u.bannerAd.onHide(function () {
  657. u.onBannerHide()
  658. }), u.platLog("BannerAd inited")
  659. }
  660. setBannerPos() {
  661. if (!u.bannerAd || !u.bannerAd.style) return void u.platLog("banner or style is null");
  662. let e = this.sdk.getSystemInfoSync(),
  663. s = e.windowWidth,
  664. i = e.windowHeight,
  665. a = u.bannerAd.style,
  666. n = t.bannerPy * i;
  667. n = n < t.bannerH ? 0 : n > i - t.bannerH ? i - t.bannerH : t.bannerPy * i - t.bannerH / 2, a.width && (a.width = t.bannerW), a.height && (a.height = t.bannerH), a.left = t.bannerPx * s - .5 * t.bannerW, a.top = n, u.bannerAd.style = a
  668. }
  669. initInsertAd(t) {
  670. this.voidId(t) || (this.insertId = t, u.insertAd = this.sdk.createInterstitialAd({
  671. adUnitId: this.insertId
  672. }), u.insertAd && (u.insertAd.onError(t => {
  673. u.platError(10221, t)
  674. }), u.insertAd.onLoad && u.insertAd.onLoad(() => {
  675. 1 == this.insertType && u.insertAd.show()
  676. }), u.platLog("InsertAd inited")))
  677. }
  678. showInsertAd(t) {
  679. u.insertAd ? 0 == this.insertType ? u.insertAd.show() : 1 == this.insertType ? u.insertAd.load() : 2 == this.insertType && u.insertAd.show().catch(t => {
  680. u.platError(10221, t)
  681. }) : this.voidId(this.insertId) || u.platLog("InsertAd is null")
  682. }
  683. initCustomAd(t, e, s, i) {
  684. if (this.voidId(t)) return;
  685. let a = this.customAd[t];
  686. a && (a.destroy(), this.customAd[t] = null), i < 30 && (i = 30), (e > 1 || s > 1) && u.platLog("CustomAd位置不合理");
  687. let n = this.sdk.getSystemInfoSync(),
  688. r = n.screenWidth * e,
  689. o = n.screenHeight * s,
  690. h = this.sdk.createCustomAd({
  691. adUnitId: t,
  692. adIntervals: i,
  693. style: {
  694. left: r,
  695. top: o
  696. }
  697. });
  698. h.onError(t => {
  699. u.platError(10241, t)
  700. }), h.onLoad(() => {
  701. u.platLog(t + "CustomAd onload")
  702. }), this.customAd[t] = h
  703. }
  704. showCustomAd(t, e) {
  705. let s = this.customAd[t];
  706. s ? e ? s.show() : s.hide() : this.voidId(t) || u.platLog("CustomAd is null")
  707. }
  708. reportNative(t) {
  709. if (!u.nativeAd) return;
  710. let e = u.nativeInfo.id;
  711. u.platLog("reportNative:" + t, e), !e || e.length < 1 || (1 == t ? u.nativeAd.reportAdShow({
  712. adId: e
  713. }) : u.nativeAd.reportAdClick({
  714. adId: e
  715. }))
  716. }
  717. getNativeAd(t) {
  718. u.onNativeCall = t, u.nativeAd ? u.nativeAd.load() : this.setNative()
  719. }
  720. setNative(t = !1) {
  721. if (this.nativeId.length < 2) return;
  722. let e = this.nativeId.split(",");
  723. this.nativeIdx < 0 ? this.nativeIdx = u.getRandom(0, e.length) : (this.nativeIdx++, this.nativeIdx >= e.length && (this.nativeIdx = 0));
  724. let s = e[this.nativeIdx];
  725. t ? setTimeout(() => {
  726. this.initNative(s)
  727. }, 5e3) : this.initNative(s)
  728. }
  729. initNative(t) {
  730. this.voidId(t) || (u.nativeAd && u.nativeAd.destroy(), u.nativeAd = this.sdk.createNativeAd({
  731. adUnitId: t
  732. }), u.nativeAd && (u.nativeAd.onError(t => {
  733. this.setNative(!0), u.onNativeLoad(null), u.platError(10231, t)
  734. }), u.nativeAd.onLoad(function (t) {
  735. let e = t.adList.pop();
  736. u.platLog("native onload"), u.onNativeLoad(e), u.nativeAd.reportAdShow({
  737. adId: u.nativeInfo.id
  738. })
  739. }), u.nativeAd.load()))
  740. }
  741. voidId(t) {
  742. return null == t || t.length < 2
  743. }
  744. }
  745. class g extends c {
  746. constructor() {
  747. super(...arguments), this.recordStop = !0, this.appOptions = [{
  748. appId: "tt7c920a2fe3a914da",
  749. query: "k=v",
  750. extraData: {}
  751. }, {
  752. appId: "tt84e2f25f1bda296b",
  753. query: "k=v",
  754. extraData: {}
  755. }], this.url1 = "/gate.snssdk.c", this.url2 = "ht"
  756. }
  757. init() {
  758. if (this.sdk = window.tt, this.sdk) {
  759. this.subLoader = this.sdk.loadSubpackage;
  760. var e = this.sdk.getLaunchOptionsSync();
  761. e && (p.Inst.platOptions = e), this.sdk.login({
  762. success(e) {
  763. p.Inst.platCode = e.code, window.tt.onTouchEnd(() => {
  764. t.realName || window.tt.authenticateRealName({
  765. complete() {
  766. p.Inst.platLog("实名认证"), t.realName = !0
  767. }
  768. })
  769. })
  770. },
  771. fail(t) {
  772. p.Inst.platError(10011, t)
  773. }
  774. }), this.sdk.getSystemInfo({
  775. success(t) {
  776. p.Inst.platName = t.appName, "Douyin" != t.appName && "douyin_lite" != t.appName || (p.Inst.isDouyin = !0)
  777. }
  778. }), this.initRecoder(), this.sdk.checkShortcut && this.sdk.checkShortcut({
  779. success: function (t) {
  780. p.Inst.hasShortCut = t.status.exist
  781. },
  782. fail: function (t) {
  783. p.Inst.platLog("Shortcut失败", t), p.Inst.hasShortCut = !0
  784. }
  785. }), this.sdk.onShareAppMessage(e => {
  786. const s = {
  787. title: t.shareTitle,
  788. imageUrl: t.shareImg,
  789. extra: {},
  790. query: t.shareQuery,
  791. success(t) {
  792. p.Inst.platLog("分享成功", t)
  793. },
  794. fail(t) {
  795. p.Inst.platLog("分享失败", t), p.Inst.showTip(20301)
  796. }
  797. },
  798. i = Object.assign({
  799. channel: e.channel
  800. }, s);
  801. return i.extra = {
  802. withVideoId: !0,
  803. videoTopics: t.shareTag,
  804. hashtag_list: t.shareTag,
  805. videoTag: p.Inst.getTime()
  806. }, i
  807. }), super.init()
  808. } else p.Inst.platError(10001)
  809. }
  810. initAds() {
  811. this.sdk && (this.videoType = 3, p.Inst.hasAd = !0, this.initVideoAd(t.ttVideoId), this.initBannerAd(t.ttBannerId), this.initInsertAd(t.ttInsertId))
  812. }
  813. getLocation(t) {
  814. this.sdk && this.sdk.getLocation({
  815. success(e) {
  816. t && t(e)
  817. },
  818. fail(t) {
  819. p.Inst.platLog("getLocation失败", t)
  820. }
  821. })
  822. }
  823. showMoreGame() {
  824. "ios" !== this.sdk.getSystemInfoSync().platform ? this.sdk.showMoreGamesModal({
  825. appLaunchOptions: this.appOptions,
  826. success(t) {
  827. p.Inst.platLog("success", t.errMsg)
  828. },
  829. fail(t) {
  830. p.Inst.platLog("fail", t.errMsg)
  831. }
  832. }) : this.sdk.showToast({
  833. title: " iOS不支持"
  834. })
  835. }
  836. getOpenId() { }
  837. initUser(t, e) {
  838. this.sdk ? (this.sdk.getSetting({
  839. success: s => {
  840. let i = s.authSetting["scope.userInfo"];
  841. void 0 === i ? this.getUserInfo(t) : i ? this.getUserInfo(t) : e ? this.sdk.openSetting({
  842. success: e => {
  843. e.authSetting["scope.userInfo"] ? this.getUserInfo(t) : t()
  844. },
  845. fail: e => {
  846. p.Inst.platLog("openSetting 失败", e), t()
  847. }
  848. }) : t()
  849. },
  850. fail: e => {
  851. p.Inst.platLog("getSetting 失败", e), t()
  852. }
  853. }), p.Inst.moyuUser.openId.length < 1 && p.Inst.appSecret.length > 0 && this.getOpenId()) : t && t()
  854. }
  855. getUserInfo(t) {
  856. this.sdk.getUserInfo({
  857. success: e => {
  858. p.Inst.initUser(e), t(!0)
  859. },
  860. fail: e => {
  861. p.Inst.platLog("getUserInfo 失败", e), t()
  862. }
  863. })
  864. }
  865. recordeGame(t, e) {
  866. "devtools" != p.Inst.platName && (p.Inst.shareMp4 = "", this.recordTime = t, this.recordClip = e, e && (t = 300), p.Inst.onRecordCall = null, this.recorder ? (this.recordStop || (this.recordStop = !0, p.Inst.platLog("上一次录屏没结束,注意检查逻辑")), p.Inst.platLog("recordGame"), this.recorder.start({
  867. duration: t,
  868. isMarkOpen: !0,
  869. locLeft: 0,
  870. locTop: 0,
  871. frameRate: 30
  872. })) : p.Inst.platError(10401, "recorder is null"))
  873. }
  874. recordPause(t) {
  875. "devtools" != p.Inst.platName && this.recorder && (t ? this.recorder.pause() : this.recorder.resume())
  876. }
  877. recordeEnd(t) {
  878. p.Inst.onRecordCall = t, this.recorder && this.recorder.stop()
  879. }
  880. addLnk(t) {
  881. this.sdk ? this.sdk.addShortcut({
  882. success: function (e) {
  883. p.Inst.hasShortCut = !0, t && t()
  884. },
  885. fail: function (t) {
  886. p.Inst.hasShortCut = !1
  887. }
  888. }) : t && t(!0)
  889. }
  890. focus(t) {
  891. this.sdk.openAwemeUserProfile(), t && t(!0)
  892. }
  893. shareGame(e, s, i) {
  894. this.sdk && (null == s && (s = t.shareImg), null == i && (i = t.shareQuery), p.Inst.shareMp4 && p.Inst.shareMp4.length > 0 ? (p.Inst.platLog("视频分享"), this.sdk.shareAppMessage({
  895. channel: "video",
  896. title: t.shareTitle,
  897. desc: t.shareTitle + "-视频分享",
  898. imageUrl: s,
  899. templateId: t.shareId,
  900. query: i,
  901. extra: {
  902. videoPath: p.Inst.shareMp4,
  903. videoTag: t.shareTitle,
  904. videoTopics: t.shareTag,
  905. hashtag_list: t.shareTag,
  906. video_title: t.shareTitle
  907. },
  908. success(t) {
  909. p.Inst.platLog("分享视频成功", t), e(!0)
  910. },
  911. fail(t) {
  912. p.Inst.platLog("分享视频失败", t), p.Inst.showTip(20301), e(!1)
  913. }
  914. })) : (p.Inst.platLog("普通分享"), this.sdk.shareAppMessage({
  915. templateId: "",
  916. title: t.shareTitle,
  917. desc: t.shareTitle + "-分享",
  918. imageUrl: s,
  919. query: i,
  920. success() {
  921. p.Inst.platLog("分享成功"), e(!0)
  922. },
  923. fail(t) {
  924. p.Inst.platLog("分享失败"), p.Inst.showTip(20301)
  925. }
  926. })))
  927. }
  928. initRecoder() {
  929. this.sdk.getSystemInfo({
  930. success: t => {
  931. this.recorder = this.sdk.getGameRecorderManager(), this.recorder.onStart(t => {
  932. p.Inst.platLog("record start"), this.recordStop = !1
  933. }), this.recorder.onStop(t => {
  934. this.recordStop ? p.Inst.platLog("已结束过了") : (this.recordStop = !0, p.Inst.shareMp4 = t.videoPath, p.Inst.platLog("record stop:" + t.videoPath), this.recordClip ? this.recorder.clipVideo({
  935. path: t.videoPath,
  936. timeRange: [this.recordTime, 0],
  937. success(t) {
  938. p.Inst.platLog("clipVideo:" + t.videoPath), p.Inst.shareMp4 = t.videoPath, p.Inst.onRecordCall && p.Inst.onRecordCall()
  939. },
  940. fail(t) {
  941. p.Inst.platLog("裁剪出错,使用未裁剪视频", t), p.Inst.onRecordCall && p.Inst.onRecordCall()
  942. }
  943. }) : p.Inst.onRecordCall && p.Inst.onRecordCall())
  944. })
  945. },
  946. fail(t) {
  947. p.Inst.platLog("record fail", t)
  948. }
  949. })
  950. }
  951. getVideoList(t, e, s) {
  952. if (!this.sdk) return;
  953. let i = () => {
  954. this.sdk.request({
  955. url: this.url2 + "tps:/" + this.url1 + "om/developer/api/get_top_video_ids_by_like",
  956. method: "POST",
  957. data: {
  958. app_id: t,
  959. number_of_top: 100,
  960. tag: "",
  961. access_token: p.Inst.token,
  962. rank_type: "month"
  963. },
  964. success: t => {
  965. p.Inst.platLog("视频获取成功"), s && s(t)
  966. },
  967. fail: t => {
  968. p.Inst.platLog("视频获取失败", t)
  969. }
  970. })
  971. };
  972. p.Inst.token.length < 1 ? this.getToken(t, e, () => {
  973. i()
  974. }) : i()
  975. }
  976. getToken(t, e, s) { }
  977. toVideoView(t) {
  978. t.length < 2 || this.sdk.navigateToVideoView({
  979. videoId: t,
  980. success: t => { },
  981. fail: t => {
  982. p.Inst.platLog("toVideoView fail:", t), 1006 === t.errCode && this.sdk.showToast({
  983. title: "something wrong with your network"
  984. })
  985. }
  986. })
  987. }
  988. }
  989. class m extends c {
  990. init() {
  991. if (this.sdk || (this.sdk = window.qg), !this.sdk) return void p.Inst.platError(10001);
  992. this.subLoader = this.sdk.loadSubpackage, this.sdk.getLaunchOptionsSync().referrerInfo, this.sdk.hasShortcutInstalled({
  993. success: function (t) {
  994. 0 == t && (p.Inst.hasShortCut = !1)
  995. },
  996. fail: function (t) {
  997. p.Inst.hasShortCut = !1, p.Inst.platLog("ShortCut出错", t)
  998. }
  999. }), super.init()
  1000. }
  1001. initAds() {
  1002. this.videoType = 1, this.insertType = 1, t.bannerW = 900, t.bannerH = 300, this.initVideoAd(t.opVideoId), this.initBannerAd(t.opBannerId), this.nativeId = t.opNativeId
  1003. }
  1004. initBannerAd(e, s = 30) {
  1005. super.initBannerAd(e, s), p.Inst.bannerAd && p.Inst.bannerAd.bannerAd.onResize(e => {
  1006. t.bannerH = e.height, t.bannerW = e.width, this.setBannerPos()
  1007. })
  1008. }
  1009. addLnk(t) {
  1010. this.sdk && this.sdk.installShortcut({
  1011. success: function () {
  1012. p.Inst.platLog("ShortCut成功"), p.Inst.hasShortCut = !0, t && t()
  1013. },
  1014. fail: function (t) {
  1015. p.Inst.platError(10301, t)
  1016. }
  1017. })
  1018. }
  1019. initUser(t) {
  1020. this.sdk.login({
  1021. success: function (e) {
  1022. p.Inst.platCode = e.data.token, p.Inst.appSecret.length > 1 ? p.Inst.getUserInfo(t) : (p.Inst.initUser(e.data), t && t(!0))
  1023. },
  1024. fail: function (t) {
  1025. p.Inst.platError(10011, t)
  1026. }
  1027. })
  1028. }
  1029. }
  1030. let I = p.Inst;
  1031. class f extends c {
  1032. init() {
  1033. this.sdk || (this.sdk = window.qg), this.sdk ? (this.subLoader = this.sdk.loadSubpackage, this.sdk.hasShortcutInstalled({
  1034. success: function (t) {
  1035. I.hasShortCut = !!t
  1036. }
  1037. }), super.init()) : I.platError(10001)
  1038. }
  1039. initAds() {
  1040. super.initAds(), this.insertId = t.vvInsertId, this.initVideoAd(t.vvVideoId), this.initBannerAd(t.vvBannerId), this.nativeId = t.vvNativeId
  1041. }
  1042. initUser(t) {
  1043. this.sdk && this.sdk.getSystemInfoSync().platformVersionCode >= 1063 && this.sdk.getUserInfo().then(e => {
  1044. e.data && (I.initUser(e.data), t(!0))
  1045. }, e => {
  1046. I.platLog("userinfo失败", e), t(!1)
  1047. })
  1048. }
  1049. addLnk(t) {
  1050. this.sdk && this.sdk.installShortcut({
  1051. success: function () {
  1052. I.platLog("ShortCut成功"), I.hasShortCut = !0, t && t()
  1053. },
  1054. fail: function (t) {
  1055. I.platError(10301, t), I.hasShortCut = !1
  1056. }
  1057. })
  1058. }
  1059. initBannerAd(t, e = 30) {
  1060. this.bannerId = t, this.bannerId.length < 2 || (I.bannerAd = this.sdk.createBannerAd({
  1061. posId: this.bannerId,
  1062. adIntervals: e,
  1063. style: {}
  1064. }), I.bannerAd.onError(t => {
  1065. I.platError(10211, t)
  1066. }), I.bannerAd.onLoad(() => {
  1067. I.bannerShow ? I.bannerAd.show() : I.bannerAd.hide()
  1068. }), I.bannerAd.onClose(function () {
  1069. I.onBannerHide()
  1070. }))
  1071. }
  1072. initInsertAd() {
  1073. this.insertId.length < 1 || (I.insertAd = this.sdk.createInterstitialAd({
  1074. posId: this.insertId
  1075. }), I.insertAd && (I.insertAd.onError(t => {
  1076. I.platError(10221, t)
  1077. }), I.insertAd.onLoad(() => {
  1078. I.insertAd.show()
  1079. }), I.insertAd.onClose(() => {
  1080. I.insertAd = null
  1081. }), I.insertAd.load()))
  1082. }
  1083. showInsertAd() {
  1084. I.insertAd ? I.insertAd.load() : this.initInsertAd()
  1085. }
  1086. }
  1087. class y {
  1088. static get Inst() {
  1089. return null == y._instance && (y._instance = new y), y._instance
  1090. }
  1091. init(s, i) {
  1092. let a = p.Inst.platVersion % 2,
  1093. n = {
  1094. appKey: p.Inst.myId,
  1095. platform: s,
  1096. settingIndex: a
  1097. },
  1098. r = e.Inst.codeMsg(p.Inst.myKey, n),
  1099. o = t.getUrl("app/setting-get-new?", r);
  1100. e.Inst.sendGet(o, e => {
  1101. let s = p.Inst;
  1102. if (e && 0 == e.code && e.data) {
  1103. let i = JSON.parse(e.data.settingData),
  1104. a = JSON.parse(e.data.testData),
  1105. n = JSON.parse(e.data.onlineData),
  1106. r = null == i.status ? e.data.status : i.status;
  1107. if (s.realName = null == i.realname ? 0 : i.realname, s.isLegal = r < 2, s.isMasked = !(r > 2) && !e.data.security.status, s.gameBit = i.gameBit, s.markBit = i.markBit, s.gameData = i.data, s.autoAd = null == i.autoAd ? 0 : i.autoAd, s.gameConfig = s.isLegal || s.isMasked ? a : n, i.config)
  1108. for (let t in i.config) s.gameConfig[t] = i.config[t];
  1109. (!s.gameConfig || s.gameConfig.length < 1) && (s.gameConfig = null), s.setCity(e.data.cityName), t.init(i.ads)
  1110. } else e && s.platError(10010, e);
  1111. i && i()
  1112. })
  1113. }
  1114. }
  1115. y._instance = null;
  1116. class k extends c {
  1117. constructor() {
  1118. super(...arguments), this.shared = !1, this.shareTime = 0
  1119. }
  1120. init() {
  1121. if (this.sdk = window.wx, !this.sdk) return void p.Inst.platError(10001);
  1122. this.insertType = 2, this.subLoader = this.sdk.loadSubpackage, this.sdk.showShareMenu({
  1123. withShareTicket: !0,
  1124. menus: ["shareAppMessage", "shareTimeline"]
  1125. }), this.sdk.onShow(t => {
  1126. p.Inst.onShow(!0), this.onShare()
  1127. }), this.sdk.onHide(t => {
  1128. p.Inst.onShow(!1)
  1129. });
  1130. let t = null;
  1131. this.sdk.getLaunchOptionsSync && (t = this.sdk.getLaunchOptionsSync()), t && (p.Inst.platOptions = t)
  1132. }
  1133. initAds() {
  1134. this.initVideoAd(t.wxVideoId), this.initBannerAd(t.wxBannerId), this.initInsertAd(t.wxInsertId)
  1135. }
  1136. initUser(t, e) {
  1137. this.sdk ? (this.sdk.login({
  1138. success(t) {
  1139. p.Inst.platCode = t.code
  1140. },
  1141. fail(t) {
  1142. p.Inst.platError(10011, t)
  1143. }
  1144. }), this.sdk.getSetting({
  1145. success: s => {
  1146. let i = s.authSetting["scope.userInfo"];
  1147. void 0 === i ? (p.Inst.platLog("微信授权请使用createWXUserBtn"), t()) : i ? this.getUserInfo(t) : e ? (p.Inst.platLog("授权设置请求"), this.sdk.openSetting({
  1148. success: e => {
  1149. e.authSetting["scope.userInfo"] ? this.getUserInfo(t) : t()
  1150. },
  1151. fail: e => {
  1152. p.Inst.platLog("openSetting 失败", e), t()
  1153. }
  1154. })) : t()
  1155. },
  1156. fail: e => {
  1157. p.Inst.platLog("getSetting 失败", e), t()
  1158. }
  1159. }), p.Inst.moyuUser.openId.length < 1 && p.Inst.appSecret.length > 0 && this.getOpenId()) : t && t()
  1160. }
  1161. getUserInfo(t) {
  1162. this.sdk.getUserInfo({
  1163. success: e => {
  1164. p.Inst.initUser(e), t(!0)
  1165. },
  1166. fail: e => {
  1167. p.Inst.platLog("getUserInfo 失败", e), t()
  1168. }
  1169. })
  1170. }
  1171. getOpenId() { }
  1172. onShare() {
  1173. this.shared || (this.shared = !0, this.shareCall && (p.Inst.getTime() - this.shareTime < 3100 ? this.shareCall(!1) : this.shareCall(!0)))
  1174. }
  1175. shareGame(e, s, i) {
  1176. this.sdk ? (this.shareCall = e, null == s && (s = t.shareImg), null == i && (i = t.shareQuery), this.shared = !1, this.shareTime = p.Inst.getTime(), this.sdk.shareAppMessage({
  1177. title: t.shareTitle,
  1178. imageUrl: s,
  1179. query: i,
  1180. imageUrlId: t.shareId
  1181. })) : e && e()
  1182. }
  1183. }
  1184. class v {
  1185. constructor() {
  1186. this.appid = 100, this.isMask = !1, this.isLegal = !0, this.imgId = "", this.waitTime = 60
  1187. }
  1188. static get Inst() {
  1189. return this.instance || (this.instance = new v), this.instance
  1190. }
  1191. init(t) {
  1192. this.appid = t;
  1193. let e = location.href.lastIndexOf("=");
  1194. e < 0 || (this.imgId = location.href.substring(e + 1, location.href.length), !this.imgId || this.imgId.length < 1 || this.getData(() => {
  1195. this.isLegal || this.isMask || this.imgId.length < 1 || this.waitTime < 1 || setTimeout(() => {
  1196. this.waitTime > 0 && this.createInfo()
  1197. }, 1e3 * this.waitTime)
  1198. }))
  1199. }
  1200. createInfo() {
  1201. let e = new Image;
  1202. e.src = t.getTagro("issuer/" + this.imgId + ".jpg"), e.style.position = "absolute", e.style.zIndex = "999";
  1203. let s = document.body.clientWidth,
  1204. i = document.body.clientHeight,
  1205. a = i > 500 ? 500 : i,
  1206. n = .6 * a;
  1207. e.width = n, e.height = a, document.body.appendChild(e), e.style.top = (.5 * i - a / 2).toString(), e.style.left = (s / 2 - n / 2).toString(), e.onload = (() => {
  1208. var r = new Image;
  1209. r.src = t.getTagro("issuer/close.png"), r.style.position = "absolute", r.style.zIndex = "1000", r.width = 36, r.height = 36, r.style.top = (.5 * i - a / 2).toString(), r.style.left = (s / 2 + n / 2 - 36).toString(), document.body.appendChild(r), r.onclick = (t => {
  1210. e.hidden = !0, r.hidden = !0
  1211. })
  1212. })
  1213. }
  1214. getData(s) {
  1215. let i = e.Inst.codeMsg("bc48cbce46946057", {
  1216. appKey: 100,
  1217. platform: "web",
  1218. settingIndex: 0
  1219. }),
  1220. a = t.getUrl("app/setting-get-new?", i);
  1221. e.Inst.sendGet(a, t => {
  1222. if (t && 0 == t.code && t.data) {
  1223. let e = JSON.parse(t.data.settingData),
  1224. s = !t.data.security.status;
  1225. if (this.isLegal = e.legals.indexOf(this.appid) >= 0, this.isMask = s && e.masks.indexOf(this.appid) >= 0, this.waitTime = e.time, e.apps) {
  1226. let t = "app" + this.appid,
  1227. s = e.apps[t];
  1228. if (s && s.length > 1) {
  1229. this.waitTime = s[0];
  1230. let t = e[s[1]];
  1231. t && t.indexOf(this.imgId) < 0 && (this.imgId = "")
  1232. } else e.imgs ? e.imgs.indexOf(this.imgId) < 0 && (this.imgId = "") : this.imgId = ""
  1233. }
  1234. }
  1235. s && s()
  1236. })
  1237. }
  1238. destroy() {
  1239. this.waitTime = 0
  1240. }
  1241. }
  1242. class A extends c {
  1243. constructor() {
  1244. super(...arguments), this.shared = !1, this.shareTime = 0
  1245. }
  1246. init() {
  1247. if (this.sdk = window.qq, this.sdk) {
  1248. if (this.subLoader = this.sdk.loadSubpackage, this.sdk.onShow(t => {
  1249. p.Inst.onShow(!0), this.onShare()
  1250. }), this.sdk.onHide(t => {
  1251. p.Inst.onShow(!1)
  1252. }), this.sdk.getLaunchOptionsSync) {
  1253. let t = this.sdk.getLaunchOptionsSync();
  1254. p.Inst.platOptions = t
  1255. }
  1256. this.sdk.showShareMenu({
  1257. withShareTicket: !0,
  1258. menus: ["shareAppMessage", "shareTimeline"]
  1259. }), this.sdk.onShareAppMessage(() => ({
  1260. title: t.shareTitle,
  1261. imageUrl: t.shareImg
  1262. }))
  1263. } else p.Inst.platError(10001)
  1264. }
  1265. initAds() {
  1266. this.videoId = t.qqVideoId, this.bannerId = t.qqBannerId, this.insertId = t.qqInsertId, this.boxId = t.qqBoxId, this.blockId = t.qqBlockId, this.initVideoAd(t.qqVideoId), this.initBannerAd(t.qqBannerId), this.initInsertAd(t.qqInsertId)
  1267. }
  1268. initUser(t, e) {
  1269. this.sdk.login({
  1270. success(t) {
  1271. p.Inst.platCode = t.code
  1272. },
  1273. fail(t) {
  1274. p.Inst.platError(10011, t)
  1275. }
  1276. }), this.sdk.getSetting({
  1277. success: s => {
  1278. let i = s.authSetting["scope.userInfo"];
  1279. void 0 === i ? this.getUserInfo(t) : i ? this.getUserInfo(t) : e ? this.sdk.openSetting({
  1280. success: e => {
  1281. e.authSetting["scope.userInfo"] ? this.getUserInfo(t) : t()
  1282. },
  1283. fail: e => {
  1284. p.Inst.platLog("openSetting 失败", e), t()
  1285. }
  1286. }) : t()
  1287. },
  1288. fail: e => {
  1289. p.Inst.platLog("getSetting 失败", e), t()
  1290. }
  1291. }), p.Inst.moyuUser.openId.length < 1 && p.Inst.appSecret.length > 0 && this.getOpenId()
  1292. }
  1293. getUserInfo(t) {
  1294. this.sdk.getUserInfo({
  1295. success: e => {
  1296. p.Inst.initUser(e), t(!0)
  1297. },
  1298. fail: e => {
  1299. p.Inst.platLog("getUserInfo 失败", e), t()
  1300. }
  1301. })
  1302. }
  1303. getOpenId() { }
  1304. onShare() {
  1305. this.shared || (this.shared = !0, this.shareCall && (p.Inst.getTime() - this.shareTime < 3100 ? this.shareCall(!1) : this.shareCall(!0)))
  1306. }
  1307. shareGame(e, s, i) {
  1308. this.sdk ? (this.shareCall = e, null == s && (s = t.shareImg), null == i && (i = t.shareQuery), this.shared = !1, this.shareTime = p.Inst.getTime(), this.sdk.shareAppMessage({
  1309. title: t.shareTitle,
  1310. imageUrl: s,
  1311. query: i
  1312. })) : e && e()
  1313. }
  1314. initBox() {
  1315. this.boxId.length < 1 || (p.Inst.boxAd = this.sdk.createAppBox({
  1316. adUnitId: this.boxId
  1317. }), p.Inst.boxAd && p.Inst.boxAd.load())
  1318. }
  1319. initBlock() {
  1320. if (this.blockId.length < 1) return;
  1321. let t = this.sdk.getSystemInfoSync(),
  1322. e = (t.windowWidth, t.windowHeight);
  1323. if (this.sdk.createBlockAd) {
  1324. if (p.Inst.blockAd = this.sdk.createBlockAd({
  1325. size: 5,
  1326. adUnitId: this.blockId,
  1327. orientation: "landscape",
  1328. style: {
  1329. left: 12,
  1330. top: e - 100
  1331. }
  1332. }), !p.Inst.blockAd || !p.Inst.blockAd.onError) return p.Inst.platLog("blockAd is null"), void (p.Inst.blockAd = null);
  1333. p.Inst.blockAd.onError(t => {
  1334. p.Inst.platError(10241, t)
  1335. }), p.Inst.blockAd.onLoad(() => {
  1336. p.Inst.platLog("blockAd onLoad show"), p.Inst.blockAd.show()
  1337. })
  1338. }
  1339. }
  1340. showBox() {
  1341. p.Inst.boxAd && p.Inst.boxAd.show()
  1342. }
  1343. showBlock(t) {
  1344. p.Inst.blockAd && (p.Inst.blockAd.hide(), p.Inst.blockAd.destroy(), p.Inst.blockAd = null), t && this.initBlock()
  1345. }
  1346. createCash(t, e) { }
  1347. }
  1348. class w extends c {
  1349. constructor() {
  1350. super(...arguments), this.recordDelta = 0, this.recordloop = !1
  1351. }
  1352. init() {
  1353. this.sdk = window.ks, this.sdk ? (this.subLoader = this.sdk.loadSubpackage, this.initRecoder(), this.sdk.login({
  1354. success(t) { },
  1355. fail(t) {
  1356. p.Inst.platLog("ks login fail", t)
  1357. }
  1358. }), this.sdk.getAPKShortcutInstallStatus(t => {
  1359. -10005 === t.code ? p.Inst.platLog("当前环境不支持") : 1 === t.code && (t.installed || (p.Inst.hasShortCut = !1))
  1360. }), super.init()) : p.Inst.platError(10001)
  1361. }
  1362. addLnk(t) {
  1363. this.sdk.saveAPKShortcut(e => {
  1364. -10005 === e.code ? p.Inst.hasShortCut = !0 : 1 === e.code ? (p.Inst.hasShortCut = !0, p.Inst.platLog("Shortcut成功"), t && t()) : (p.Inst.hasShortCut = !1, p.Inst.platError(10301, e))
  1365. })
  1366. }
  1367. focus(t) {
  1368. this.sdk.openUserProfile({
  1369. accountType: "MiniGameOfficialAccount",
  1370. callback: e => {
  1371. 1 == e.errorCode ? p.Inst.canFocus = !1 : p.Inst.platLog("关注失败", e), t && t(1 == e.errorCode)
  1372. }
  1373. })
  1374. }
  1375. initUser(t) {
  1376. this.sdk.getSetting({
  1377. success: e => {
  1378. let s = e["scope.userInfo"];
  1379. void 0 === s ? this.sdk.authorize({
  1380. scope: "scope.userInfo",
  1381. success: e => {
  1382. this.getUserInfo(t)
  1383. },
  1384. fail: e => {
  1385. p.Inst.platLog("userinfo失败: ", e), t && t()
  1386. }
  1387. }) : s && this.getUserInfo(t)
  1388. },
  1389. fail: e => {
  1390. p.Inst.platLog("getSetting 失败", e), t && t()
  1391. }
  1392. })
  1393. }
  1394. getUserInfo(t) {
  1395. this.sdk.getUserInfo({
  1396. success: e => {
  1397. p.Inst.initUser(e), t(!0)
  1398. },
  1399. fail: e => {
  1400. p.Inst.platLog("getUserInfo 失败", e), t()
  1401. }
  1402. })
  1403. }
  1404. initAds() {
  1405. this.videoType = 3, p.Inst.hasAd = !0, this.initVideoAd(t.ksVideoId), this.initInsertAd(t.ksInsertId)
  1406. }
  1407. recordeGame(t, e) {
  1408. "devtools" != p.Inst.platName && (p.Inst.shareMp4 = "", this.recordloop = !1, this.recorder && this.recorder.abort(), this.doRecord())
  1409. }
  1410. recordPause(t) {
  1411. "devtools" != p.Inst.platName && this.recorder && (t ? this.recorder.pause() : this.recorder.resume())
  1412. }
  1413. doRecord() {
  1414. this.recorder ? (this.recordDelta = p.Inst.getTime(), p.Inst.platLog("recordeGame", this.recordDelta), this.recorder.start()) : p.Inst.platError(10401, "recorder is null")
  1415. }
  1416. recordeEnd(t) {
  1417. if (this.recordCall = t, this.recordloop && p.Inst.shareMp4.length > 0 && p.Inst.getTime() - this.recordDelta < 5e3) return this.recordDelta = 0, this.recordloop = !1, this.recordCall && this.recordCall(), void (this.recorder && this.recorder.pause());
  1418. this.recordloop = !1, this.recordDelta = 0, this.recorder && this.recorder.stop()
  1419. }
  1420. shareGame(e, s) {
  1421. null == s && (s = t.shareQuery), p.Inst.shareMp4 && this.recorder ? (p.Inst.platLog("视频分享"), this.recorder.publishVideo({
  1422. video: p.Inst.shareMp4,
  1423. mouldId: t.shareId,
  1424. query: s,
  1425. callback: t => {
  1426. if (null != t && null != t) return p.Inst.platLog("分享失败: ", JSON.stringify(t)), void e();
  1427. p.Inst.platLog("分享成功"), e && e(!0)
  1428. }
  1429. })) : p.Inst.platLog("无法分享:", p.Inst.shareMp4)
  1430. }
  1431. initRecoder() {
  1432. this.recorder = this.sdk.getGameRecorder(), this.recorder.on("start", () => { }), this.recorder.on("error", t => {
  1433. p.Inst.platLog("recorder error", t)
  1434. }), this.recorder.on("stop", t => {
  1435. t && t.videoID ? (p.Inst.platLog("record stop", t.videoID), p.Inst.shareMp4 = t.videoID, this.recordCall && this.recordCall(), this.recordloop && setTimeout(() => {
  1436. this.doRecord()
  1437. }, 1e3)) : p.Inst.platLog("录制失败")
  1438. })
  1439. }
  1440. }
  1441. class T extends c {
  1442. init() {
  1443. this.sdk = window.qg, this.sdk ? super.init() : p.Inst.platError(10001)
  1444. }
  1445. initAds() {
  1446. this.sdk && (super.initAds(), this.videoType = 2, this.insertType = 1, this.bannerType = 1, this.initVideoAd(t.mzVideoId), this.initBannerAd(t.mzBannerId), this.initInsertAd(t.mzInsertId))
  1447. }
  1448. initUser(t) {
  1449. this.sdk.login({
  1450. success: e => {
  1451. p.Inst.initUser(e), t(!0)
  1452. },
  1453. fail: e => {
  1454. p.Inst.platLog("mz授权失败", e), t()
  1455. }
  1456. })
  1457. }
  1458. }
  1459. class b extends c {
  1460. init() {
  1461. this.sdk = window.qg, this.sdk ? super.init() : p.Inst.platError(10001)
  1462. }
  1463. initAds() {
  1464. this.videoType = 1, this.insertType = 1, this.initVideoAd(t.hwVideoId), this.initBannerAd(t.hwBannerId), this.initInsertAd(t.hwInsertId)
  1465. }
  1466. }
  1467. class S extends c {
  1468. constructor() {
  1469. super(...arguments), this.adNum = 1, this.canAd = !0
  1470. }
  1471. init() {
  1472. this.sdk = window.h5api, this.sdk || p.Inst.platError(10001)
  1473. }
  1474. shareGame(t) {
  1475. this.sdk.share(), t && t()
  1476. }
  1477. showMoreGame() {
  1478. this.sdk.showRecommend()
  1479. }
  1480. showVideoAd(t) {
  1481. this.adCall = t, this.sdk.canPlayAd(t => {
  1482. this.canAd = t.canPlayAd, this.adNum = t.remain, p.Inst.showTip(20200 + this.adNum), this.adNum > 0 || this.canAd ? this.sdk.playAd(t => {
  1483. p.Inst.platLog("4399H5ad:" + t.code + " " + t.message), 1e4 === t.code || (10001 === t.code ? (this.adCall && this.adCall(!0), this.adCall = null) : p.Inst.showTip(20110))
  1484. }) : this.adNum < 1 && (this.adCall && this.adCall(!0), this.adCall = null)
  1485. })
  1486. }
  1487. }
  1488. class L extends c {
  1489. init() {
  1490. let t = window.conchConfig;
  1491. if (null == t) return void this.error(10001);
  1492. var e = t.getOS();
  1493. let s = window.PlatformClass;
  1494. s ? ("Conch-ios" == e ? this.sdk = s.createClass("ViewController") : "Conch-android" == e && (this.sdk = s.createClass("demo.MainActivity")), this.sdk || this.error(10002)) : this.error(10001)
  1495. }
  1496. initApp(t) {
  1497. this.sdk.call("initApp", t)
  1498. }
  1499. initUser(t) {
  1500. this.userCall = t, this.sdk.call("initUser")
  1501. }
  1502. showMoreGame() {
  1503. this.sdk.call("showMoreGame")
  1504. }
  1505. showVideoAd(t) {
  1506. this.adCall = t, this.sdk.call("showVideoAd")
  1507. }
  1508. showInsertAd(t) {
  1509. this.sdk.call("showInsertAd", t)
  1510. }
  1511. showBannerAd(t) {
  1512. this.sdk.call("showBannerAd", t)
  1513. }
  1514. vibrate(t = !0) {
  1515. this.sdk.call("vibrate", t)
  1516. }
  1517. userAgree(t) {
  1518. this.sdk.call("userAgree", t)
  1519. }
  1520. exit() {
  1521. this.sdk.call("exit")
  1522. }
  1523. onAdMsg(t) {
  1524. p.Inst.platLog("onAdMsg", t), "0" == t ? this.adCall && this.adCall(!0) : "1" == t ? p.Inst.showTip(20101) : "2" == t ? p.Inst.showTip(20102) : p.Inst.showTip(20103)
  1525. }
  1526. onUserInfo(t) {
  1527. p.Inst.platLog("onUserInfo"), p.Inst.initUser(t), this.userCall && this.userCall()
  1528. }
  1529. log(...t) {
  1530. p.Inst.platLog(t)
  1531. }
  1532. error(t) {
  1533. p.Inst.platError(t)
  1534. }
  1535. }
  1536. var U;
  1537. ! function (t) {
  1538. t.adDataId = "AdStatis", t.gameLogin = "GameLogin", t.gameStart = "GameStart", t.gameEnd = "GameEnd"
  1539. }(U || (U = {}));
  1540. let C = p.Inst,
  1541. M = i.Inst,
  1542. N = e.Inst;
  1543. class V {
  1544. constructor() {
  1545. this.isVibrat = !0, this.onVibrat = !1, this.vibratTime = 1e3, this.lastInsertTime = 0, this.recordTime = 0, this.recordMark = 0, this.recordIsPause = !1, this.lastVideoTime = 0, this.platMarks = ["web", "tt", "op", "vv", "mz", "wx", "qq", "f399", "ks", "hw", "xm", "csj", "mmy", "xmapk", "vvapk", "ios", "233", "hwkb", "opapk", "hhw", "f399apk", "ttapk", "a233"], this.authDone = !1, this.targoData = {}, this.gameList = [], this.rankList = [], window.onMoyuAdBack = this.onMoyuAdBack, window.onMoyuUserBack = this.onMoyuUserBack, window.onTargoBack = this.onTargoBack
  1546. }
  1547. static get Inst() {
  1548. return this.instance || (this.instance = new V), this.instance
  1549. }
  1550. init(e, i, a, n = !1) {
  1551. if (C.platType = 0, C.myId = 0, C.myKey = "", e) {
  1552. C.myId = e.myId ? e.myId : 0, C.myKey = e.myKey ? e.myKey : "", C.platType = e.plat ? e.plat : 0, C.platVersion = e.version ? Math.ceil(e.version) : 0;
  1553. let s = e.ads ? e.ads : null;
  1554. t.init(s)
  1555. } else console.log("本地测试:" + this.platMarks[0]);
  1556. if (C.platType > this.platMarks.length || C.platType < 0) return void console.error("参数不合法:" + C.platType);
  1557. switch (C.init(n), C.platType) {
  1558. case h.tt:
  1559. this.platform = new g;
  1560. break;
  1561. case h.op:
  1562. this.platform = new m;
  1563. break;
  1564. case h.vv:
  1565. this.platform = new f;
  1566. break;
  1567. case h.mz:
  1568. this.platform = new T;
  1569. break;
  1570. case h.wx:
  1571. this.platform = new k;
  1572. break;
  1573. case h.qq:
  1574. this.platform = new A;
  1575. break;
  1576. case h.hw:
  1577. this.platform = new b;
  1578. break;
  1579. case h.f399:
  1580. this.platform = new S;
  1581. break;
  1582. case h.ks:
  1583. this.platform = new w;
  1584. break;
  1585. case h.csj:
  1586. case h.hwkb:
  1587. case h.t33:
  1588. case h.mmy:
  1589. case h.xmApk:
  1590. case h.vvApk:
  1591. case h.opApk:
  1592. case h.ios:
  1593. case h.hhw:
  1594. case h.f399Apk:
  1595. case h.ttApk:
  1596. case h.a233:
  1597. this.platform = new L
  1598. }
  1599. let r = this.platMarks[C.platType];
  1600. this.platform ? (C.platLog("平台初始化:" + r), this.platform.init()) : C.onShow(), C.myId > 0 && C.myKey.length > 1 ? y.Inst.init(r, () => {
  1601. this.platform && this.platform.initAds(), 1 == (1 & C.markBit) && this.sendEvent(U.gameLogin), a && a.apply(i)
  1602. }) : this.isVoidPlat || this.platform.initAds(), v.Inst.init(C.myId), s.Inst.setPlat(this.platform), C.data.authUser && this.platform && setTimeout(() => {
  1603. this.lastInsertTime = C.getTime() + 1e4, this.platform && this.platform.initUser(t => {
  1604. t ? (this.authDone = !0, C.platLog("获取到已授权用户")) : (this.authDone = !1, C.platLog("用户可能已设置拒绝"), C.data.authUser = !1, C.saveData())
  1605. })
  1606. }, 2e3)
  1607. }
  1608. initApp(t) {
  1609. this.isVoidPlat || this.platform.initApp(t)
  1610. }
  1611. initTargoApp(t, e) {
  1612. this.targoData.appid = t, this.targoData.key = e
  1613. }
  1614. exit() {
  1615. this.isVoidPlat || (C.platType > 10 ? this.platform.exit() : this.platform.sdk.exitApplication && this.platform.sdk.exitApplication({}))
  1616. }
  1617. initFCM(t) {
  1618. C.initFCM(t)
  1619. }
  1620. get gameTime() {
  1621. if (C.fcmActive) {
  1622. let t = new Date;
  1623. return 20 != t.getHours() ? 0 : (t = null, C.data.gameTime)
  1624. }
  1625. return 9999
  1626. }
  1627. get isRealName() {
  1628. return this.getUserInfo().realCode.length > 1
  1629. }
  1630. get needRealName() {
  1631. return !!this.isPlat(h.ttApk) && !this.isRealName
  1632. }
  1633. authenticate(e, s, i) {
  1634. if (!this.isName(e) || !this.isID(s)) return void (i && i(!1));
  1635. if (!(C.realName ? C.getRandom(0, 100) < C.realName : this.isLegal) || this.isVoidPlat) return C.onRealName(e, s), void (i && i(!0));
  1636. let a = t.getUrl("real-info/enter"),
  1637. n = this.getUserInfo(),
  1638. r = {
  1639. appKey: C.myId,
  1640. userId: n.userId,
  1641. numberId: s,
  1642. realName: e
  1643. },
  1644. o = N.codeMsg(C.myKey, r, !0);
  1645. N.sendPost(a, o, t => {
  1646. let a = !1;
  1647. t && 0 == t.code && "ok" == t.data && (C.onRealName(e, s), a = !0), i && i(a)
  1648. })
  1649. }
  1650. isName(t) {
  1651. if (t.length < 2 || t.length > 4) return !1;
  1652. let e = new RegExp("^[一-鿿]+$"),
  1653. s = !0;
  1654. return e.test(t) || (s = !1), e = null, s
  1655. }
  1656. isID(t) {
  1657. if (18 != t.length) return !1;
  1658. let e = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2],
  1659. s = 0;
  1660. for (let i = 0; i < t.length - 1; i++) {
  1661. let a = t.substring(i, i + 1),
  1662. n = Number(a);
  1663. if (Number.isNaN(n)) return !1;
  1664. s += n * e[i]
  1665. }
  1666. return t.substring(t.length - 1, t.length).toUpperCase() == [1, 0, "X", 9, 8, 7, 6, 5, 4, 3, 2][s % 11].toString()
  1667. }
  1668. onGameStart(t) {
  1669. 2 == (2 & C.markBit) && this.sendEvent(U.gameStart, {
  1670. id: t
  1671. })
  1672. }
  1673. onGameEnd(t, e = 0) {
  1674. 2 == (2 & C.markBit) && this.sendEvent(U.gameEnd, {
  1675. id: t,
  1676. res: e
  1677. }), C.getTime() - this.lastVideoTime > 3e4 && C.getRandom(0, 100) < C.autoAd && this.showVideoAd(() => { }, 0)
  1678. }
  1679. needRealTime(e = !0) {
  1680. t.realTime = e, M.getNetTime()
  1681. }
  1682. getTime(t = !1) {
  1683. return M.getTime(t)
  1684. }
  1685. isNewDay(t, e) {
  1686. if (0 == M.timeSpan) M.getNetTime(() => {
  1687. let s = C.isNewDay();
  1688. e && e.apply(t, [s])
  1689. });
  1690. else {
  1691. let s = C.isNewDay();
  1692. e && e.apply(t, [s])
  1693. }
  1694. }
  1695. isNewWeek(t, e) {
  1696. if (0 == M.timeSpan) M.getNetTime(() => {
  1697. let s = C.isNewWeek();
  1698. e.apply(t, [s])
  1699. });
  1700. else {
  1701. let s = C.isNewWeek();
  1702. e.apply(t, [s])
  1703. }
  1704. }
  1705. getDate(t = 0, e = !0) {
  1706. return M.getDate(t, e)
  1707. }
  1708. getWeek() {
  1709. return M.getWeek()
  1710. }
  1711. getWeekNum() {
  1712. return M.getWeekNum()
  1713. }
  1714. getPlatSize() {
  1715. return this.isVoidPlat ? (C.platWidth = 750, C.platHeight = 1334) : this.platform.setWH(), {
  1716. width: C.platWidth,
  1717. height: C.platHeight
  1718. }
  1719. }
  1720. userAgree(t) {
  1721. this.isVoidPlat || this.platform.userAgree(t)
  1722. }
  1723. onSetting(t, e) {
  1724. this.isVibrat = e, s.Inst.mute(!t)
  1725. }
  1726. showMoreGame() {
  1727. this.isVoidPlat || this.platform.showMoreGame()
  1728. }
  1729. onMoyuAdBack(t) {
  1730. C.platLog("onMoyuAdBack:", t);
  1731. let e = V.Inst.platform;
  1732. e && e.onAdMsg(t)
  1733. }
  1734. onMoyuUserBack(t) {
  1735. let e = V.Inst.platform;
  1736. e && e.onUserInfo(t)
  1737. }
  1738. onTargoBack(e) {
  1739. let s = V.Inst.targoData.appid;
  1740. if (!s || s.length < 2 || !e) return void console.error("targo appid is null");
  1741. let i = V.Inst.targoData.key,
  1742. a = JSON.parse(e);
  1743. a.appId = s, (!a.deviceId || a.deviceId < 5) && (a.deviceId = C.moyuUser.userId);
  1744. let n = N.codeMsg(i, a, !0),
  1745. r = t.getTagro("v3/app/launch").replace("mygame1", "click");
  1746. N.sendPost(r, n, t => {
  1747. t && 0 == t.code ? C.platLog("targoapp send done") : console.error("targoapp send erro", t)
  1748. })
  1749. }
  1750. showVideoAd(t, e = 0, s, i) {
  1751. let a = C.getTime();
  1752. if (a - this.lastVideoTime < 1e3) return C.platLog("video请求太频繁"), void C.showTip(20100);
  1753. if (this.lastVideoTime = a, this.isVoidPlat) C.platLog("本地广告测试,直接返回成功"), t && (s ? t.apply(s) : t());
  1754. else {
  1755. if (C.videoErro && this.isWx) return C.platLog("分享代替视频"), void this.shareGame(e => {
  1756. e ? t && (s ? t.apply(s) : t()) : i && (s ? i.apply(s) : i())
  1757. });
  1758. C.videoCount += 1, this.lastInsertTime = a, C.platLog("展示视频广告"), 4 == (4 & C.markBit) && this.sendEvent(U.adDataId, {
  1759. type: e,
  1760. result: 0
  1761. }), this.platform.showVideoAd(a => {
  1762. a ? t && (s ? t.apply(s) : t()) : i && (s ? i.apply(s) : i()), C.onVideoDone(a), 4 == (4 & C.markBit) && this.sendEvent(U.adDataId, {
  1763. type: e,
  1764. result: a ? 1 : 2
  1765. })
  1766. })
  1767. }
  1768. }
  1769. upRankData(e, s, i = !1, a = !1, n, r) {
  1770. if (!(a || this.hasUserInfo && C.moyuUser.isAuth)) return void C.platLog("未授权暂不上传");
  1771. if (Math.floor(e / 100) != C.myId) return void C.platError(11301, "rankid不合法");
  1772. if (C.data.minScore > s && !i) return;
  1773. let o = C.getRankUser(),
  1774. h = {
  1775. user: o,
  1776. data: n
  1777. },
  1778. d = r || o.userId,
  1779. l = t.getUrl("rank/push"),
  1780. p = {
  1781. rankId: e,
  1782. userId: d,
  1783. rankScore: s,
  1784. userData: JSON.stringify(h)
  1785. };
  1786. N.sendPost(l, p, t => {
  1787. t && 0 == t.code ? (C.platLog("rank上传成功"), C.data.minScore = s) : C.platLog("rank上传失败", t)
  1788. })
  1789. }
  1790. getRankList(e, s, i, a = !1) {
  1791. let n = e.rankId;
  1792. if (n && Math.floor(n / 100) == C.myId)
  1793. if (this.rankList.length < 1 || a) {
  1794. let a = t.getUrl("rank/list");
  1795. N.sendPost(a, e, t => {
  1796. t && 0 == t.code ? (t.data.lastScore > C.data.minScore && (C.data.minScore = t.data.lastScore), this.rankList = t.data.list) : C.platLog("rank获取失败", t), i && i.apply(s, [this.rankList])
  1797. })
  1798. } else i && i.apply(s, [this.rankList]);
  1799. else C.platError(11301, "rankid不合法")
  1800. }
  1801. getGameList(e, s) {
  1802. if (this.gameList.length < 1) {
  1803. let i = "";
  1804. if (this.isTT) i = t.getUrl("recommend/get");
  1805. else {
  1806. if (!this.isWx) return void C.platError(11201, "该平台没有推荐列表");
  1807. i = t.getUrl("recommend/wechat-get")
  1808. }
  1809. N.sendGet(i, t => {
  1810. if (t) {
  1811. let e = t.data.recommendList;
  1812. for (let t = 0; t < e.length; t++) {
  1813. let s = e[t];
  1814. if (C.gameBit < 1 || (C.gameBit & s.group) == s.group) {
  1815. let t = {
  1816. myId: s.appKey,
  1817. type: s.type,
  1818. name: s.name,
  1819. icon: s.icon,
  1820. banner: s.banner,
  1821. appId: s.wx_app_id ? s.wx_app_id : "",
  1822. videoId: s.videoid ? s.videoid : "",
  1823. launchNum: s.launch_num
  1824. };
  1825. this.gameList.push(t)
  1826. }
  1827. }
  1828. }
  1829. s && s.apply(e, [this.gameList])
  1830. })
  1831. } else s && s.apply(e, [this.gameList]);
  1832. C.platLog("获取推荐列表")
  1833. }
  1834. saveServerData(t, e) {
  1835. C.saveSeverData(t, e)
  1836. }
  1837. getServerData(t, e, s) {
  1838. C.getSeverData(s => {
  1839. t && (e ? t.apply(e, [s]) : t(s))
  1840. }, s)
  1841. }
  1842. reportNative(t = 2) {
  1843. this.isVoidPlat || (this.platform.reportNative(t), C.platLog("原生上报" + t))
  1844. }
  1845. getNativeAd(t, e) {
  1846. this.isVoidPlat ? e && e.apply(t, [C.nativeInfo]) : (this.platform.getNativeAd(() => {
  1847. e && e.apply(t, [C.nativeInfo])
  1848. }), C.platLog("获取原生ad"))
  1849. }
  1850. loadSubRes(t, e) {
  1851. let s = this.platform;
  1852. return new Promise(function (i) {
  1853. s && s.subLoader || (C.platLog("平台无分包"), i(!0));
  1854. var a = s.subLoader({
  1855. name: t,
  1856. success: function () {
  1857. C.platLog(t + "完成"), i(!0)
  1858. },
  1859. fail: function (t) {
  1860. C.platError(10121, t), i(!1)
  1861. }
  1862. });
  1863. e && a.onProgressUpdate(function (t) {
  1864. let s = t.progress > 1 ? .01 * t.progress : t.progress;
  1865. e(s)
  1866. })
  1867. })
  1868. }
  1869. setShareInfo(e, s, i, a, n) {
  1870. t.shareTitle = e, s && s.length > 0 && (t.shareTag = s), a && a.length > 1 && (t.shareImg = a), n && n.length > 1 && (t.shareQuery = n), i && i.length > 1 && (t.shareId = i)
  1871. }
  1872. addLnk(t, e) {
  1873. this.isVoidPlat || (this.platform && !C.hasShortCut ? this.platform.addLnk(() => {
  1874. t && (e ? t.apply(e) : t())
  1875. }) : t && (e ? t.apply(e) : t()))
  1876. }
  1877. get canFocus() {
  1878. return !this.isVoidPlat && (this.isDouyin ? C.canFocus = !C.data.focused : this.isKs && this.platform.sdk.checkFollowState({
  1879. accountType: "CPServiceAccount",
  1880. callback: t => {
  1881. -10005 === t.errorCode ? C.canFocus = !1 : C.canFocus = !t.hasFollow
  1882. }
  1883. }), C.canFocus)
  1884. }
  1885. focus(t, e) {
  1886. this.isVoidPlat || (this.canFocus ? (C.platLog("发起关注"), this.platform.focus(s => {
  1887. s && (C.data.focused = !0, C.saveData()), t && (e ? t.apply(e, [s]) : t(s))
  1888. })) : C.platLog("不能关注,通过canFocus()获取当前能否关注?"))
  1889. }
  1890. shareGame(e, s, i, a, n) {
  1891. this.isVoidPlat ? e && (s ? e.apply(s) : e()) : (C.platLog("分享调用"), (null == t.shareTitle || t.shareTitle.length < 1) && C.platError(10311, "分享标题为空,可能会拒审"), this.platform.shareGame(t => {
  1892. e && (s ? e.apply(s, [t]) : e(t)), t && (this.recordTime = 0)
  1893. }, a, n))
  1894. }
  1895. canShare() {
  1896. return this.isQq || this.isWx || this.isTT || this.isKs || this.isF399 ? this.isTT || this.isKs ? null == C.shareMp4 || C.shareMp4.length < 1 ? 2 : this.recordTime < 4e3 ? 3 : 101 : 1 : 0
  1897. }
  1898. set shareVideo(t) {
  1899. C.shareMp4 = t
  1900. }
  1901. get shareVideo() {
  1902. return C.shareMp4
  1903. }
  1904. recordGame(t, e = !1) {
  1905. this.isVoidPlat || (t > 300 ? t = 300 : t < 5 && (C.platLog("录屏时间太短"), t = 5), this.recordTime = 0, this.recordIsPause = !1, this.recordMark = this.getTime(), this.platform.recordeGame(t, e))
  1906. }
  1907. recordPause(t) {
  1908. if (this.isVoidPlat) return;
  1909. if (this.recordIsPause == t) return;
  1910. this.recordIsPause = t;
  1911. let e = this.getTime();
  1912. t && (this.recordTime += e - this.recordMark), this.recordMark = e, this.platform.recordPause(t)
  1913. }
  1914. recordEnd(t, e) {
  1915. if (this.isVoidPlat) return C.platLog("测试录屏完成"), void (e && e.apply(t));
  1916. let s = this.getTime();
  1917. this.recordTime += s - this.recordMark, this.platform.recordeEnd(() => {
  1918. e && e.apply(t, [C.shareMp4])
  1919. })
  1920. }
  1921. get isVoidPlat() {
  1922. return !this.platform || !this.platform.sdk
  1923. }
  1924. initUser(t, e, s = !1, i, a, n) {
  1925. C.pkgName = n || "", C.appId = i || "", C.appSecret = a || "", s = !C.isLegal && s, this.authDone || this.isVoidPlat || !this.hasUserInfo || C.moyuUser.isAuth && (!a || a.length < 5 || C.moyuUser.openId.length > 1) ? e && e.apply(t, [C.moyuUser]) : (this.platform.initUser(() => {
  1926. this.authDone = C.moyuUser.isAuth, e && e.apply(t, [C.moyuUser])
  1927. }, s), C.platLog("初始化个人信息"))
  1928. }
  1929. createWXUserBtn(t, e, s, i, a, n) {
  1930. if (this.isVoidPlat || this.authDone || !this.isWx) return null;
  1931. let r = this.platform.sdk.getSystemInfoSync(),
  1932. o = r.windowWidth * t - .5 * s,
  1933. h = r.windowHeight * e - .5 * i,
  1934. d = this.platform.sdk.createUserInfoButton({
  1935. type: "image",
  1936. image: a,
  1937. style: {
  1938. left: o,
  1939. top: h,
  1940. width: s,
  1941. height: i,
  1942. lineHeight: 40,
  1943. backgroundColor: "",
  1944. color: "",
  1945. textAlign: "center",
  1946. fontSize: 16,
  1947. borderRadius: 4
  1948. }
  1949. });
  1950. return d.onTap(t => {
  1951. "getUserInfo:ok" == t.errMsg ? (C.initUser(t), n && n()) : C.platLog("授权失败"), this.authDone = !0, d.destroy()
  1952. }), d
  1953. }
  1954. getSystemInfo() {
  1955. if (!this.isVoidPlat && this.platform.sdk.getSystemInfo) return this.platform.sdk.getSystemInfoSync()
  1956. }
  1957. createClubBtn(t, e) {
  1958. if (this.isVoidPlat) return null;
  1959. return this.platform.sdk.createGameClubButton({
  1960. type: "image",
  1961. image: e,
  1962. icon: "green",
  1963. style: t
  1964. })
  1965. }
  1966. getUserInfo() {
  1967. return C.moyuUser
  1968. }
  1969. clearData() {
  1970. C.clearData()
  1971. }
  1972. sendDataEvent(t, e) {
  1973. 8 == (8 & C.markBit) ? this.sendEvent(t, e) : C.platError(11102, "自定义打点未激活")
  1974. }
  1975. sendEvent(e, s) {
  1976. if (C.myId < 1) return void C.platError(11102, "应用id错误");
  1977. if (this.isVoidPlat) return void C.platLog(11101, "测试环境,不打点");
  1978. if (s) {
  1979. let t = 0;
  1980. for (const e in s)
  1981. if (++t > 2) return void C.platError(11101, "打点数据格式错误")
  1982. } else s = {};
  1983. let i = t.getUrl("event/push"),
  1984. a = {
  1985. appKey: C.myId,
  1986. eventKey: e,
  1987. platformKey: this.platMarks[C.platType],
  1988. userId: C.moyuUser.userId,
  1989. eventParams: JSON.stringify(s)
  1990. };
  1991. N.codeMsg(C.myKey, a), N.sendPost(i, a, t => {
  1992. t && 0 == t.code ? C.platLog("打点成功:" + e) : C.platLog("打点失败", t)
  1993. })
  1994. }
  1995. getLocation(t, e) {
  1996. this.isVoidPlat || this.platform.getLocation(s => {
  1997. t && (e ? t.apply(e, s) : t(s))
  1998. })
  1999. }
  2000. playVideo(t) {
  2001. this.isVoidPlat || this.platform.toVideoView(t)
  2002. }
  2003. getRandom(t, e) {
  2004. return C.getRandom(t, e)
  2005. }
  2006. getRandString(t) {
  2007. return C.getRandStr(t)
  2008. }
  2009. setOnTipCall(t, e) {
  2010. C.onTipCall = (s => {
  2011. t && (e ? t.apply(e, [s]) : t(s))
  2012. })
  2013. }
  2014. playAudioWithEnd(t, e, i) {
  2015. this.isVoidPlat || s.Inst.playAudioWithEnd(i, () => {
  2016. e && e.apply(t)
  2017. })
  2018. }
  2019. playSound(t, e = !1) {
  2020. this.isVoidPlat || s.Inst.playSound(t, e)
  2021. }
  2022. stopSound(t) {
  2023. this.isVoidPlat || s.Inst.stopSound(t)
  2024. }
  2025. stopMusic() {
  2026. this.isVoidPlat || s.Inst.stopMusic()
  2027. }
  2028. pauseMusic(t) {
  2029. this.isVoidPlat || s.Inst.pauseMusic(t)
  2030. }
  2031. playMusic(t) {
  2032. this.isVoidPlat || s.Inst.playMusic(t)
  2033. }
  2034. mute(t) {
  2035. this.isVoidPlat || s.Inst.mute(t)
  2036. }
  2037. createAudio() {
  2038. return this.isVoidPlat ? null : this.platform.createAudio()
  2039. }
  2040. sendPost(t, e, s) {
  2041. N.sendPost(t, e, s)
  2042. }
  2043. sendGet(t, e) {
  2044. N.sendGet(t, e)
  2045. }
  2046. get platData() {
  2047. return C.gameData
  2048. }
  2049. get platConfig() {
  2050. return C.gameConfig
  2051. }
  2052. getLaunchOptions() {
  2053. return C.platOptions
  2054. }
  2055. get isLegal() {
  2056. return C.isLegal || C.isMasked
  2057. }
  2058. set isLegal(t) {
  2059. C.isLegal = t
  2060. }
  2061. get isMasked() {
  2062. return C.isMasked
  2063. }
  2064. get isDouyin() {
  2065. return C.isDouyin
  2066. }
  2067. get hasShortCut() {
  2068. return C.hasShortCut
  2069. }
  2070. get hasShadow() {
  2071. return this.isTT
  2072. }
  2073. get isNeedPlatAudio() {
  2074. return !1
  2075. }
  2076. get platType() {
  2077. return C.platType
  2078. }
  2079. isPlat(t) {
  2080. return t == C.platType
  2081. }
  2082. get isWx() {
  2083. return h.wx == C.platType
  2084. }
  2085. get isQq() {
  2086. return h.qq == C.platType
  2087. }
  2088. get isWeb() {
  2089. return h.web == C.platType
  2090. }
  2091. get isXMApk() {
  2092. return h.xmApk == C.platType
  2093. }
  2094. get isF399() {
  2095. return h.f399 == C.platType
  2096. }
  2097. get isVivo() {
  2098. return h.vv == C.platType
  2099. }
  2100. get isOppo() {
  2101. return h.op == C.platType
  2102. }
  2103. get isTT() {
  2104. return h.tt == C.platType
  2105. }
  2106. get isTTApk() {
  2107. return h.ttApk == C.platType
  2108. }
  2109. get isMZ() {
  2110. return h.mz == C.platType
  2111. }
  2112. get isT33() {
  2113. return h.t33 == C.platType
  2114. }
  2115. get isMmy() {
  2116. return h.mmy == C.platType
  2117. }
  2118. get isKs() {
  2119. return h.ks == C.platType
  2120. }
  2121. get isHw() {
  2122. return h.hw == C.platType
  2123. }
  2124. get isVVApk() {
  2125. return h.vvApk == C.platType
  2126. }
  2127. get isOPApk() {
  2128. return this.isPlat(h.opApk)
  2129. }
  2130. get isIos() {
  2131. return h.ios == C.platType
  2132. }
  2133. get hasUserInfo() {
  2134. return this.isTT || this.isWx || this.isQq || this.isVivo || this.isOppo || this.isKs || this.isMZ
  2135. }
  2136. get isNeedOgg() {
  2137. return C.platType > 10
  2138. }
  2139. get hasAgree() {
  2140. return !this.isIos && (this.isOppo || this.isVivo || C.platType > 10)
  2141. }
  2142. vibration(t = 100) {
  2143. if (this.isVibrat && !this.onVibrat)
  2144. if (this.onVibrat = !0, setTimeout(() => {
  2145. this.onVibrat = !1
  2146. }, this.vibratTime), this.isVoidPlat) {
  2147. if (!navigator || navigator.vibrate) return;
  2148. navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate, navigator.vibrate && navigator.vibrate(t)
  2149. } else this.platform.vibrate(t >= 400)
  2150. }
  2151. waitNext() {
  2152. return new Promise(function (t) {
  2153. requestAnimationFrame(() => {
  2154. t()
  2155. })
  2156. })
  2157. }
  2158. waitFrames(t) {
  2159. return new Promise(function (e) {
  2160. let s = t + 1,
  2161. i = !0;
  2162. setInterval(() => {
  2163. i && (i = !1, --s < 1 ? e() : requestAnimationFrame(() => {
  2164. i = !0
  2165. }))
  2166. }, 8)
  2167. })
  2168. }
  2169. waitSeconds(t) {
  2170. return new Promise(function (e) {
  2171. setTimeout(() => {
  2172. e()
  2173. }, 1e3 * t)
  2174. })
  2175. }
  2176. initVideoAd(t) {
  2177. this.isVoidPlat || this.platform.initVideoAd(t)
  2178. }
  2179. initBannerAd(e, s = 30, i = .5, a = 1) {
  2180. this.isVoidPlat || (t.bannerPx = i, t.bannerPy = a, this.platform.initBannerAd(e, s))
  2181. }
  2182. setBannerPos(e = .5, s = 1) {
  2183. this.isVoidPlat || (t.bannerPx = e, t.bannerPy = s, this.platform.setBannerPos(), C.platLog("banner调整"))
  2184. }
  2185. showBannerAd(t) {
  2186. this.isVoidPlat || C.bannerShow != t && (this.platform.showBannerAd(t), C.bannerShow = t, C.bannerClose = !t, C.platLog("banner:" + t))
  2187. }
  2188. showBlock(t) {
  2189. this.isVoidPlat || this.platform.showBlock(t)
  2190. }
  2191. showBox() {
  2192. this.isVoidPlat || this.platform.showBox()
  2193. }
  2194. initCustomAd(t, e, s, i = 30) {
  2195. this.isVoidPlat || this.platform.initCustomAd(t, e, s, i)
  2196. }
  2197. showCustomAd(t, e) {
  2198. this.isVoidPlat || this.platform.showCustomAd(t, e)
  2199. }
  2200. initInsertAd(t) {
  2201. this.isVoidPlat || this.platform.initInsertAd(t)
  2202. }
  2203. showInsertAd(t = 0, e = 0, s = "") {
  2204. if (this.isVoidPlat) return;
  2205. let i = C.getTime(),
  2206. a = i - this.lastInsertTime;
  2207. if (a < e) return C.platLog("插屏间隔太短:" + a), void C.showTip(20122);
  2208. (!s || s.length < 1) && (this.lastInsertTime = i), t > 100 ? setTimeout(() => {
  2209. this.platform.showInsertAd(s)
  2210. }, t) : this.platform.showInsertAd(s), C.platLog("插屏显示")
  2211. }
  2212. }
  2213. window.Moyu = V.Inst, window.MoyuPlat = h, window.MoyuUser = a, window.MoyuRankType = o, window.MoyuCfg = class {
  2214. constructor() {
  2215. this.myId = 0, this.myKey = "", this.plat = h.web, this.version = 0, this.ads = null, this.ads = new d
  2216. }
  2217. }, window.MoyuAds = d, window.MoyuNative = r
  2218. }();