moyu.js 77 KB

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