game.js 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711
  1. (function (t) {
  2. "use strict";
  3. function e() { }
  4. function n(t) {
  5. if (t = t || {}, this.IS_MASTER = t.isMaster || !1, !this.IS_MASTER) throw Error("The DataStore can only be instantiated by the Master");
  6. this.dataStore = {}
  7. }
  8. function r(t, e) {
  9. if (this.IS_MASTER = t && t.isMaster ? t.isMaster : !1, this.IS_SLAVE = !this.IS_MASTER, this.messenger = null, this.subscribers = {}, this.moduleReady = e ? e : !1, this.gameState = "resume", !t || !t.messenger) throw Error("No messenger passed to the Game module instance");
  10. this.messenger = t.messenger, window.addEventListener ? window.addEventListener("message", this._performAction.bind(this), !1) : window.attachEvent && window.attachEvent("onmessage", this._performAction.bind(this))
  11. }
  12. function i(t, e) {
  13. t = t || {}, this.IS_MASTER = t.isMaster, this.IS_SLAVE = !this.IS_MASTER, this.moduleReady = e ? e : !1, this.messenger = t.messenger, this.data = t.data || null, this._setupMasterEvent()
  14. }
  15. function o(t, e) {
  16. t = t || {}, this.isMaster = t.isMaster, this.isStandalone = t.isStandalone, this.messenger = t.messenger, this.moduleReady = e ? e : !1, this.timeoutAfter = 500, this.timeout = !1, this._callbacks = {
  17. pause: !1,
  18. resume: !1
  19. }
  20. }
  21. function a(t, e) {
  22. t = t || {}, this.IS_MASTER = t.isMaster, this.isStandalone = t.isStandalone, this.messenger = t.messenger, this.eventTracking = t.eventTracking, this.moduleReady = e ? e : !1, this.events = {
  23. GAME_START: "GAME_START",
  24. GAME_END: "GAME_END",
  25. GAME_PAUSE: "GAME_PAUSE",
  26. GAME_CONTINUE: "GAME_CONTINUE",
  27. GAME_MUTE: "GAME_MUTE",
  28. LEVEL_FAIL: "LEVEL_FAIL",
  29. LEVEL_COMPLETE: "LEVEL_COMPLETE"
  30. }, this._setupEvents()
  31. }
  32. function s(t, e) {
  33. t = t || {}, this.IS_MASTER = t.isMaster, this.IS_SLAVE = !this.IS_MASTER, this.data = t.data, this.messenger = t.messenger, this.moduleReady = e ? e : !1, this.gamePlayTracking = {
  34. started: !1,
  35. appid: null,
  36. host: null,
  37. timestamp: null
  38. }, this.timeInGameTracking = {
  39. started: !1,
  40. appid: null,
  41. timestamp: null
  42. }
  43. }
  44. function u(t, e) {
  45. t = t || {}, this.IS_MASTER = t.isMaster, this.IS_SLAVE = !this.IS_MASTER, this.moduleReady = e ? e : !1, this.messenger = t.messenger, this.components = t.components, this.data = t.data || null
  46. }
  47. function c(t) {
  48. var e = "string" == typeof t ? p(t) : t;
  49. e && (this.type = e.type, this.callbackId = e.callbackId, this.data = e.data)
  50. }
  51. function p(t) {
  52. var e, n, r, i = !1,
  53. o = [];
  54. if ("string" == typeof t && (o = t.split("|"), "gameapi" === o[0])) {
  55. o.shift(), e = o.shift(), r = parseInt(o.shift(), 10), n = o.join("|");
  56. try {
  57. i = {
  58. type: e,
  59. callbackId: r,
  60. data: "" !== n ? JSON.parse(n) : ""
  61. }
  62. } catch (a) { }
  63. }
  64. return i
  65. }
  66. // ih5game.setShare({
  67. // desc: "圣诞节来啦!圣诞老人快起床!!~~~~"
  68. // });
  69. function l(t) {
  70. t = t || {}, this.IS_MASTER = "boolean" == typeof t.isMaster ? t.isMaster : !1, this.IS_SLAVE = !this.IS_MASTER, this.api = t.api ? t.api : {}, this._target = t.target ? t.target : {}, this._callbacks = [], this._channels = [], this.IS_MASTER && t.dataStore && (this.dataStore = t.dataStore), this._setupEventListener()
  71. }
  72. function d(t, n, o, s, u) {
  73. this.version = "0.13.7", this.isReady = !1, this._setRole(), this.__ = {}, this.__.dataStore = this.IS_MASTER ? new t({
  74. isMaster: !0
  75. }) : null, this.__.messenger = new n({
  76. isMaster: this.IS_MASTER,
  77. api: this,
  78. target: this._getTarget(),
  79. dataStore: this.__.dataStore
  80. }), this.__.components = new e, this.Branding = new o({
  81. isMaster: this.IS_MASTER,
  82. messenger: this.__.messenger,
  83. components: this.__.components
  84. }, !1), this.__.EventTracking = new s({
  85. isMaster: this.IS_MASTER,
  86. data: null,
  87. messenger: this.__.messenger
  88. }, !1), this.GameBreak = new u({
  89. isMaster: this.IS_MASTER,
  90. isStandalone: this.IS_STANDALONE,
  91. messenger: this.__.messenger
  92. }, !1), this.Game = new r({
  93. isMaster: this.IS_MASTER,
  94. messenger: this.__.messenger
  95. }, !1), this.Score = new i({
  96. isMaster: this.IS_MASTER,
  97. messenger: this.__.messenger
  98. }, !1), this.GameEvent = new a({
  99. isMaster: this.IS_MASTER,
  100. messenger: this.__.messenger,
  101. eventTracking: this.__.EventTracking
  102. }, !1)
  103. }
  104. var h;
  105. (function (t) {
  106. if ("function" == typeof bootstrap) bootstrap("promise", t);
  107. else if ("object" == typeof exports) module.exports = t();
  108. else if ("function" == typeof define && define.amd) define(t);
  109. else if ("undefined" != typeof ses) {
  110. if (!ses.ok()) return;
  111. ses.makeQ = t
  112. } else h = t()
  113. })(function () {
  114. function t(t) {
  115. return function () {
  116. return X.apply(t, arguments)
  117. }
  118. }
  119. function e(t) {
  120. return t === Object(t)
  121. }
  122. function n(t) {
  123. return "[object StopIteration]" === ee(t) || t instanceof W
  124. }
  125. function r(t, e) {
  126. if (q && e.stack && "object" == typeof t && null !== t && t.stack && -1 === t.stack.indexOf(ne)) {
  127. for (var n = [], r = e; r; r = r.source) r.stack && n.unshift(r.stack);
  128. n.unshift(t.stack);
  129. var o = n.join("\n" + ne + "\n");
  130. t.stack = i(o)
  131. }
  132. }
  133. function i(t) {
  134. for (var e = t.split("\n"), n = [], r = 0; e.length > r; ++r) {
  135. var i = e[r];
  136. s(i) || o(i) || !i || n.push(i)
  137. }
  138. return n.join("\n")
  139. }
  140. function o(t) {
  141. return -1 !== t.indexOf("(module.js:") || -1 !== t.indexOf("(node.js:")
  142. }
  143. function a(t) {
  144. var e = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(t);
  145. if (e) return [e[1], Number(e[2])];
  146. var n = /at ([^ ]+):(\d+):(?:\d+)$/.exec(t);
  147. if (n) return [n[1], Number(n[2])];
  148. var r = /.*@(.+):(\d+)$/.exec(t);
  149. return r ? [r[1], Number(r[2])] : void 0
  150. }
  151. function s(t) {
  152. var e = a(t);
  153. if (!e) return !1;
  154. var n = e[0],
  155. r = e[1];
  156. return n === F && r >= J && ae >= r
  157. }
  158. function u() {
  159. if (q) try {
  160. throw Error()
  161. } catch (t) {
  162. var e = t.stack.split("\n"),
  163. n = e[0].indexOf("@") > 0 ? e[1] : e[2],
  164. r = a(n);
  165. if (!r) return;
  166. return F = r[0], r[1]
  167. }
  168. }
  169. function c(t, e, n) {
  170. return function () {
  171. return "undefined" != typeof console && "function" == typeof console.warn && console.warn(e + " is deprecated, use " + n + " instead.", Error("").stack), t.apply(t, arguments)
  172. }
  173. }
  174. function p(t) {
  175. return y(t) ? t : v(t) ? I(t) : k(t)
  176. }
  177. function l() {
  178. function t(t) {
  179. e = t, o.source = t, Q(n, function (e, n) {
  180. H(function () {
  181. t.promiseDispatch.apply(t, n)
  182. })
  183. }, void 0), n = void 0, r = void 0
  184. }
  185. var e, n = [],
  186. r = [],
  187. i = Y(l.prototype),
  188. o = Y(f.prototype);
  189. if (o.promiseDispatch = function (t, i, o) {
  190. var a = K(arguments);
  191. n ? (n.push(a), "when" === i && o[1] && r.push(o[1])) : H(function () {
  192. e.promiseDispatch.apply(e, a)
  193. })
  194. }, o.valueOf = function () {
  195. if (n) return o;
  196. var t = m(e);
  197. return y(t) && (e = t), t
  198. }, o.inspect = function () {
  199. return e ? e.inspect() : {
  200. state: "pending"
  201. }
  202. }, p.longStackSupport && q) try {
  203. throw Error()
  204. } catch (a) {
  205. o.stack = a.stack.substring(a.stack.indexOf("\n") + 1)
  206. }
  207. return i.promise = o, i.resolve = function (n) {
  208. e || t(p(n))
  209. }, i.fulfill = function (n) {
  210. e || t(k(n))
  211. }, i.reject = function (n) {
  212. e || t(T(n))
  213. }, i.notify = function (t) {
  214. e || Q(r, function (e, n) {
  215. H(function () {
  216. n(t)
  217. })
  218. }, void 0)
  219. }, i
  220. }
  221. function d(t) {
  222. if ("function" != typeof t) throw new TypeError("resolver must be a function.");
  223. var e = l();
  224. try {
  225. t(e.resolve, e.reject, e.notify)
  226. } catch (n) {
  227. e.reject(n)
  228. }
  229. return e.promise
  230. }
  231. function h(t) {
  232. return d(function (e, n) {
  233. for (var r = 0, i = t.length; i > r; r++) p(t[r]).then(e, n)
  234. })
  235. }
  236. function f(t, e, n) {
  237. void 0 === e && (e = function (t) {
  238. return T(Error("Promise does not support operation: " + t))
  239. }), void 0 === n && (n = function () {
  240. return {
  241. state: "unknown"
  242. }
  243. });
  244. var r = Y(f.prototype);
  245. if (r.promiseDispatch = function (n, i, o) {
  246. var a;
  247. try {
  248. a = t[i] ? t[i].apply(r, o) : e.call(r, i, o)
  249. } catch (s) {
  250. a = T(s)
  251. }
  252. n && n(a)
  253. }, r.inspect = n, n) {
  254. var i = n();
  255. "rejected" === i.state && (r.exception = i.reason), r.valueOf = function () {
  256. var t = n();
  257. return "pending" === t.state || "rejected" === t.state ? r : t.value
  258. }
  259. }
  260. return r
  261. }
  262. function g(t, e, n, r) {
  263. return p(t).then(e, n, r)
  264. }
  265. function m(t) {
  266. if (y(t)) {
  267. var e = t.inspect();
  268. if ("fulfilled" === e.state) return e.value
  269. }
  270. return t
  271. }
  272. function y(t) {
  273. return e(t) && "function" == typeof t.promiseDispatch && "function" == typeof t.inspect
  274. }
  275. function v(t) {
  276. return e(t) && "function" == typeof t.then
  277. }
  278. function _(t) {
  279. return y(t) && "pending" === t.inspect().state
  280. }
  281. function S(t) {
  282. return !y(t) || "fulfilled" === t.inspect().state
  283. }
  284. function w(t) {
  285. return y(t) && "rejected" === t.inspect().state
  286. }
  287. function b() {
  288. re.length = 0, ie.length = 0, oe || (oe = !0)
  289. }
  290. function A(t, e) {
  291. oe && (ie.push(t), e && e.stack !== void 0 ? re.push(e.stack) : re.push("(no stack) " + e))
  292. }
  293. function E(t) {
  294. if (oe) {
  295. var e = $(ie, t); -1 !== e && (ie.splice(e, 1), re.splice(e, 1))
  296. }
  297. }
  298. function T(t) {
  299. var e = f({
  300. when: function (e) {
  301. return e && E(this), e ? e(t) : this
  302. }
  303. }, function () {
  304. return this
  305. }, function () {
  306. return {
  307. state: "rejected",
  308. reason: t
  309. }
  310. });
  311. return A(e, t), e
  312. }
  313. function k(t) {
  314. return f({
  315. when: function () {
  316. return t
  317. },
  318. get: function (e) {
  319. return t[e]
  320. },
  321. set: function (e, n) {
  322. t[e] = n
  323. },
  324. "delete": function (e) {
  325. delete t[e]
  326. },
  327. post: function (e, n) {
  328. return null === e || void 0 === e ? t.apply(void 0, n) : t[e].apply(t, n)
  329. },
  330. apply: function (e, n) {
  331. return t.apply(e, n)
  332. },
  333. keys: function () {
  334. return te(t)
  335. }
  336. }, void 0, function () {
  337. return {
  338. state: "fulfilled",
  339. value: t
  340. }
  341. })
  342. }
  343. function I(t) {
  344. var e = l();
  345. return H(function () {
  346. try {
  347. t.then(e.resolve, e.reject, e.notify)
  348. } catch (n) {
  349. e.reject(n)
  350. }
  351. }), e.promise
  352. }
  353. function M(t) {
  354. return f({
  355. isDef: function () { }
  356. }, function (e, n) {
  357. return L(t, e, n)
  358. }, function () {
  359. return p(t).inspect()
  360. })
  361. }
  362. function R(t, e, n) {
  363. return p(t).spread(e, n)
  364. }
  365. function C(t) {
  366. return function () {
  367. function e(t, e) {
  368. var a;
  369. if ("undefined" == typeof StopIteration) {
  370. try {
  371. a = r[t](e)
  372. } catch (s) {
  373. return T(s)
  374. }
  375. return a.done ? a.value : g(a.value, i, o)
  376. }
  377. try {
  378. a = r[t](e)
  379. } catch (s) {
  380. return n(s) ? s.value : T(s)
  381. }
  382. return g(a, i, o)
  383. }
  384. var r = t.apply(this, arguments),
  385. i = e.bind(e, "next"),
  386. o = e.bind(e, "throw");
  387. return i()
  388. }
  389. }
  390. function P(t) {
  391. p.done(p.async(t)())
  392. }
  393. function O(t) {
  394. throw new W(t)
  395. }
  396. function x(t) {
  397. return function () {
  398. return R([this, G(arguments)], function (e, n) {
  399. return t.apply(e, n)
  400. })
  401. }
  402. }
  403. function L(t, e, n) {
  404. return p(t).dispatch(e, n)
  405. }
  406. function G(t) {
  407. return g(t, function (t) {
  408. var e = 0,
  409. n = l();
  410. return Q(t, function (r, i, o) {
  411. var a;
  412. y(i) && "fulfilled" === (a = i.inspect()).state ? t[o] = a.value : (++e, g(i, function (r) {
  413. t[o] = r, 0 === --e && n.resolve(t)
  414. }, n.reject, function (t) {
  415. n.notify({
  416. index: o,
  417. value: t
  418. })
  419. }))
  420. }, void 0), 0 === e && n.resolve(t), n.promise
  421. })
  422. }
  423. function N(t) {
  424. return g(t, function (t) {
  425. return t = z(t, p), g(G(z(t, function (t) {
  426. return g(t, U, U)
  427. })), function () {
  428. return t
  429. })
  430. })
  431. }
  432. function j(t) {
  433. return p(t).allSettled()
  434. }
  435. function D(t, e) {
  436. return p(t).then(void 0, void 0, e)
  437. }
  438. function B(t, e) {
  439. return p(t).nodeify(e)
  440. }
  441. var q = !1;
  442. try {
  443. throw Error()
  444. } catch (V) {
  445. q = !!V.stack
  446. }
  447. var F, W, J = u(),
  448. U = function () { },
  449. H = function () {
  450. function t() {
  451. for (; e.next;) {
  452. e = e.next;
  453. var n = e.task;
  454. e.task = void 0;
  455. var i = e.domain;
  456. i && (e.domain = void 0, i.enter());
  457. try {
  458. n()
  459. } catch (a) {
  460. if (o) throw i && i.exit(), setTimeout(t, 0), i && i.enter(), a;
  461. setTimeout(function () {
  462. throw a
  463. }, 0)
  464. }
  465. i && i.exit()
  466. }
  467. r = !1
  468. }
  469. var e = {
  470. task: void 0,
  471. next: null
  472. },
  473. n = e,
  474. r = !1,
  475. i = void 0,
  476. o = !1;
  477. if (H = function (t) {
  478. n = n.next = {
  479. task: t,
  480. domain: o && process.domain,
  481. next: null
  482. }, r || (r = !0, i())
  483. }, "undefined" != typeof process && process.nextTick) o = !0, i = function () {
  484. process.nextTick(t)
  485. };
  486. else if ("function" == typeof setImmediate) i = "undefined" != typeof window ? setImmediate.bind(window, t) : function () {
  487. setImmediate(t)
  488. };
  489. else if ("undefined" != typeof MessageChannel) {
  490. var a = new MessageChannel;
  491. a.port1.onmessage = function () {
  492. i = s, a.port1.onmessage = t, t()
  493. };
  494. var s = function () {
  495. a.port2.postMessage(0)
  496. };
  497. i = function () {
  498. setTimeout(t, 0), s()
  499. }
  500. } else i = function () {
  501. setTimeout(t, 0)
  502. };
  503. return H
  504. }(),
  505. X = Function.call,
  506. K = t(Array.prototype.slice),
  507. Q = t(Array.prototype.reduce || function (t, e) {
  508. var n = 0,
  509. r = this.length;
  510. if (1 === arguments.length)
  511. for (; ;) {
  512. if (n in this) {
  513. e = this[n++];
  514. break
  515. }
  516. if (++n >= r) throw new TypeError
  517. }
  518. for (; r > n; n++) n in this && (e = t(e, this[n], n));
  519. return e
  520. }),
  521. $ = t(Array.prototype.indexOf || function (t) {
  522. for (var e = 0; this.length > e; e++)
  523. if (this[e] === t) return e;
  524. return -1
  525. }),
  526. z = t(Array.prototype.map || function (t, e) {
  527. var n = this,
  528. r = [];
  529. return Q(n, function (i, o, a) {
  530. r.push(t.call(e, o, a, n))
  531. }, void 0), r
  532. }),
  533. Y = Object.create || function (t) {
  534. function e() { }
  535. return e.prototype = t, new e
  536. },
  537. Z = t(Object.prototype.hasOwnProperty),
  538. te = Object.keys || function (t) {
  539. var e = [];
  540. for (var n in t) Z(t, n) && e.push(n);
  541. return e
  542. },
  543. ee = t(Object.prototype.toString);
  544. W = "undefined" != typeof ReturnValue ? ReturnValue : function (t) {
  545. this.value = t
  546. };
  547. var ne = "From previous event:";
  548. p.resolve = p, p.nextTick = H, p.longStackSupport = !1, p.defer = l, l.prototype.makeNodeResolver = function () {
  549. var t = this;
  550. return function (e, n) {
  551. e ? t.reject(e) : arguments.length > 2 ? t.resolve(K(arguments, 1)) : t.resolve(n)
  552. }
  553. }, p.Promise = d, p.promise = d, d.race = h, d.all = G, d.reject = T, d.resolve = p, p.passByCopy = function (t) {
  554. return t
  555. }, f.prototype.passByCopy = function () {
  556. return this
  557. }, p.join = function (t, e) {
  558. return p(t).join(e)
  559. }, f.prototype.join = function (t) {
  560. return p([this, t]).spread(function (t, e) {
  561. if (t === e) return t;
  562. throw Error("Can't join: not the same: " + t + " " + e)
  563. })
  564. }, p.race = h, f.prototype.race = function () {
  565. return this.then(p.race)
  566. }, p.makePromise = f, f.prototype.toString = function () {
  567. return "[object Promise]"
  568. }, f.prototype.then = function (t, e, n) {
  569. function i(e) {
  570. try {
  571. return "function" == typeof t ? t(e) : e
  572. } catch (n) {
  573. return T(n)
  574. }
  575. }
  576. function o(t) {
  577. if ("function" == typeof e) {
  578. r(t, s);
  579. try {
  580. return e(t)
  581. } catch (n) {
  582. return T(n)
  583. }
  584. }
  585. return T(t)
  586. }
  587. function a(t) {
  588. return "function" == typeof n ? n(t) : t
  589. }
  590. var s = this,
  591. u = l(),
  592. c = !1;
  593. return H(function () {
  594. s.promiseDispatch(function (t) {
  595. c || (c = !0, u.resolve(i(t)))
  596. }, "when", [
  597. function (t) {
  598. c || (c = !0, u.resolve(o(t)))
  599. }
  600. ])
  601. }), s.promiseDispatch(void 0, "when", [void 0,
  602. function (t) {
  603. var e, n = !1;
  604. try {
  605. e = a(t)
  606. } catch (r) {
  607. if (n = !0, !p.onerror) throw r;
  608. p.onerror(r)
  609. }
  610. n || u.notify(e)
  611. }
  612. ]), u.promise
  613. }, p.when = g, f.prototype.thenResolve = function (t) {
  614. return this.then(function () {
  615. return t
  616. })
  617. }, p.thenResolve = function (t, e) {
  618. return p(t).thenResolve(e)
  619. }, f.prototype.thenReject = function (t) {
  620. return this.then(function () {
  621. throw t
  622. })
  623. }, p.thenReject = function (t, e) {
  624. return p(t).thenReject(e)
  625. }, p.nearer = m, p.isPromise = y, p.isPromiseAlike = v, p.isPending = _, f.prototype.isPending = function () {
  626. return "pending" === this.inspect().state
  627. }, p.isFulfilled = S, f.prototype.isFulfilled = function () {
  628. return "fulfilled" === this.inspect().state
  629. }, p.isRejected = w, f.prototype.isRejected = function () {
  630. return "rejected" === this.inspect().state
  631. };
  632. var re = [],
  633. ie = [],
  634. oe = !0;
  635. p.resetUnhandledRejections = b, p.getUnhandledReasons = function () {
  636. return re.slice()
  637. }, p.stopUnhandledRejectionTracking = function () {
  638. b(), oe = !1
  639. }, b(), p.reject = T, p.fulfill = k, p.master = M, p.spread = R, f.prototype.spread = function (t, e) {
  640. return this.all().then(function (e) {
  641. return t.apply(void 0, e)
  642. }, e)
  643. }, p.async = C, p.spawn = P, p["return"] = O, p.promised = x, p.dispatch = L, f.prototype.dispatch = function (t, e) {
  644. var n = this,
  645. r = l();
  646. return H(function () {
  647. n.promiseDispatch(r.resolve, t, e)
  648. }), r.promise
  649. }, p.get = function (t, e) {
  650. return p(t).dispatch("get", [e])
  651. }, f.prototype.get = function (t) {
  652. return this.dispatch("get", [t])
  653. }, p.set = function (t, e, n) {
  654. return p(t).dispatch("set", [e, n])
  655. }, f.prototype.set = function (t, e) {
  656. return this.dispatch("set", [t, e])
  657. }, p.del = p["delete"] = function (t, e) {
  658. return p(t).dispatch("delete", [e])
  659. }, f.prototype.del = f.prototype["delete"] = function (t) {
  660. return this.dispatch("delete", [t])
  661. }, p.mapply = p.post = function (t, e, n) {
  662. return p(t).dispatch("post", [e, n])
  663. }, f.prototype.mapply = f.prototype.post = function (t, e) {
  664. return this.dispatch("post", [t, e])
  665. }, p.send = p.mcall = p.invoke = function (t, e) {
  666. return p(t).dispatch("post", [e, K(arguments, 2)])
  667. }, f.prototype.send = f.prototype.mcall = f.prototype.invoke = function (t) {
  668. return this.dispatch("post", [t, K(arguments, 1)])
  669. }, p.fapply = function (t, e) {
  670. return p(t).dispatch("apply", [void 0, e])
  671. }, f.prototype.fapply = function (t) {
  672. return this.dispatch("apply", [void 0, t])
  673. }, p["try"] = p.fcall = function (t) {
  674. return p(t).dispatch("apply", [void 0, K(arguments, 1)])
  675. }, f.prototype.fcall = function () {
  676. return this.dispatch("apply", [void 0, K(arguments)])
  677. }, p.fbind = function (t) {
  678. var e = p(t),
  679. n = K(arguments, 1);
  680. return function () {
  681. return e.dispatch("apply", [this, n.concat(K(arguments))])
  682. }
  683. }, f.prototype.fbind = function () {
  684. var t = this,
  685. e = K(arguments);
  686. return function () {
  687. return t.dispatch("apply", [this, e.concat(K(arguments))])
  688. }
  689. }, p.keys = function (t) {
  690. return p(t).dispatch("keys", [])
  691. }, f.prototype.keys = function () {
  692. return this.dispatch("keys", [])
  693. }, p.all = G, f.prototype.all = function () {
  694. return G(this)
  695. }, p.allResolved = c(N, "allResolved", "allSettled"), f.prototype.allResolved = function () {
  696. return N(this)
  697. }, p.allSettled = j, f.prototype.allSettled = function () {
  698. return this.then(function (t) {
  699. return G(z(t, function (t) {
  700. function e() {
  701. return t.inspect()
  702. }
  703. return t = p(t), t.then(e, e)
  704. }))
  705. })
  706. }, p.fail = p["catch"] = function (t, e) {
  707. return p(t).then(void 0, e)
  708. }, f.prototype.fail = f.prototype["catch"] = function (t) {
  709. return this.then(void 0, t)
  710. }, p.progress = D, f.prototype.progress = function (t) {
  711. return this.then(void 0, void 0, t)
  712. }, p.fin = p["finally"] = function (t, e) {
  713. return p(t)["finally"](e)
  714. }, f.prototype.fin = f.prototype["finally"] = function (t) {
  715. return t = p(t), this.then(function (e) {
  716. return t.fcall().then(function () {
  717. return e
  718. })
  719. }, function (e) {
  720. return t.fcall().then(function () {
  721. throw e
  722. })
  723. })
  724. }, p.done = function (t, e, n, r) {
  725. return p(t).done(e, n, r)
  726. }, f.prototype.done = function (t, e, n) {
  727. var i = function (t) {
  728. H(function () {
  729. if (r(t, o), !p.onerror) throw t;
  730. p.onerror(t)
  731. })
  732. },
  733. o = t || e || n ? this.then(t, e, n) : this;
  734. "object" == typeof process && process && process.domain && (i = process.domain.bind(i)), o.then(void 0, i)
  735. }, p.timeout = function (t, e, n) {
  736. return p(t).timeout(e, n)
  737. }, f.prototype.timeout = function (t, e) {
  738. var n = l(),
  739. r = setTimeout(function () {
  740. n.reject(Error(e || "Timed out after " + t + " ms"))
  741. }, t);
  742. return this.then(function (t) {
  743. clearTimeout(r), n.resolve(t)
  744. }, function (t) {
  745. clearTimeout(r), n.reject(t)
  746. }, n.notify), n.promise
  747. }, p.delay = function (t, e) {
  748. return void 0 === e && (e = t, t = void 0), p(t).delay(e)
  749. }, f.prototype.delay = function (t) {
  750. return this.then(function (e) {
  751. var n = l();
  752. return setTimeout(function () {
  753. n.resolve(e)
  754. }, t), n.promise
  755. })
  756. }, p.nfapply = function (t, e) {
  757. return p(t).nfapply(e)
  758. }, f.prototype.nfapply = function (t) {
  759. var e = l(),
  760. n = K(t);
  761. return n.push(e.makeNodeResolver()), this.fapply(n).fail(e.reject), e.promise
  762. }, p.nfcall = function (t) {
  763. var e = K(arguments, 1);
  764. return p(t).nfapply(e)
  765. }, f.prototype.nfcall = function () {
  766. var t = K(arguments),
  767. e = l();
  768. return t.push(e.makeNodeResolver()), this.fapply(t).fail(e.reject), e.promise
  769. }, p.nfbind = p.denodeify = function (t) {
  770. var e = K(arguments, 1);
  771. return function () {
  772. var n = e.concat(K(arguments)),
  773. r = l();
  774. return n.push(r.makeNodeResolver()), p(t).fapply(n).fail(r.reject), r.promise
  775. }
  776. }, f.prototype.nfbind = f.prototype.denodeify = function () {
  777. var t = K(arguments);
  778. return t.unshift(this), p.denodeify.apply(void 0, t)
  779. }, p.nbind = function (t, e) {
  780. var n = K(arguments, 2);
  781. return function () {
  782. function r() {
  783. return t.apply(e, arguments)
  784. }
  785. var i = n.concat(K(arguments)),
  786. o = l();
  787. return i.push(o.makeNodeResolver()), p(r).fapply(i).fail(o.reject), o.promise
  788. }
  789. }, f.prototype.nbind = function () {
  790. var t = K(arguments, 0);
  791. return t.unshift(this), p.nbind.apply(void 0, t)
  792. }, p.nmapply = p.npost = function (t, e, n) {
  793. return p(t).npost(e, n)
  794. }, f.prototype.nmapply = f.prototype.npost = function (t, e) {
  795. var n = K(e || []),
  796. r = l();
  797. return n.push(r.makeNodeResolver()), this.dispatch("post", [t, n]).fail(r.reject), r.promise
  798. }, p.nsend = p.nmcall = p.ninvoke = function (t, e) {
  799. var n = K(arguments, 2),
  800. r = l();
  801. return n.push(r.makeNodeResolver()), p(t).dispatch("post", [e, n]).fail(r.reject), r.promise
  802. }, f.prototype.nsend = f.prototype.nmcall = f.prototype.ninvoke = function (t) {
  803. var e = K(arguments, 1),
  804. n = l();
  805. return e.push(n.makeNodeResolver()), this.dispatch("post", [t, e]).fail(n.reject), n.promise
  806. }, p.nodeify = B, f.prototype.nodeify = function (t) {
  807. return t ? (this.then(function (e) {
  808. H(function () {
  809. t(null, e)
  810. })
  811. }, function (e) {
  812. H(function () {
  813. t(e)
  814. })
  815. }), void 0) : this
  816. };
  817. var ae = u();
  818. return p
  819. }),
  820. function (t) {
  821. var e = "Promise" in t && "cast" in t.Promise && "resolve" in t.Promise && "reject" in t.Promise && "all" in t.Promise && "race" in t.Promise && "spread" in t.Promise;
  822. e || (t.Promise = h.promise, t.Promise.all = h.all, t.Promise.timeout = h.timeout, h.stopUnhandledRejectionTracking())
  823. }(t !== void 0 ? t : this);
  824. var f = {
  825. timeout: 3e3
  826. };
  827. f.getGameConfig = function () {
  828. var t = h.defer();
  829. return SpilGames(["JSLib"], function (e) {
  830. var n = e.get("current.game.integration.info");
  831. n ? t.resolve(n) : t.reject(Error("No data retrieved from JSLib"))
  832. }), t.promise.timeout(this.timeout)
  833. }, f.getBrandingConfig = function (t) {
  834. var e = h.defer(),
  835. n = "configs",
  836. r = t.portal.siteId,
  837. i = t.portal.channelId,
  838. o = t.portal.applicationId;
  839. return SpilGames(["Net", "JSLib"], function (t, a) {
  840. t.send({
  841. url: [n, i, r, o].join("/"),
  842. type: "GET",
  843. dataType: "JSON"
  844. }, function (t) {
  845. if (t && t.configar) window.postMessage(new c({
  846. type: "success",
  847. callbackId: null,
  848. data: "log.configar.getBranding.success"
  849. }), "*"), e.resolve(t.configar);
  850. else {
  851. var n = {};
  852. try {
  853. n = a.get("configar.data.cached") || n
  854. } catch (r) { }
  855. e.reject(n)
  856. }
  857. })
  858. }), e.promise.timeout(this.timeout)
  859. };
  860. var g = {};
  861. g.argsToArray = function (t) {
  862. return t ? Array.prototype.slice.apply(t) : []
  863. }, g.isA10 = function () {
  864. return /4399.com/.test(window.location.host)
  865. }, g.disableKeys = function (t) {
  866. var e = t.keyCode;
  867. (8 === e || 9 === e || e >= 32 && 40 >= e || 46 === e) && t.preventDefault()
  868. }, g.trackGA = function () { }, g.getRole = function () {
  869. var t = "function" == typeof window.SpilGames,
  870. e = window.self !== window.top,
  871. n = null;
  872. if (g.isA10()) return window.onkeydown = this.disableKeys, {
  873. IS_MASTER: !0,
  874. IS_SLAVE: !0,
  875. IS_STANDALONE: !0
  876. };
  877. if (t) {
  878. var r = document.getElementById("#iframegame");
  879. switch (r) {
  880. case "null":
  881. n = {
  882. IS_MASTER: !0,
  883. IS_SLAVE: !0,
  884. IS_STANDALONE: !1
  885. };
  886. break;
  887. default:
  888. n = {
  889. IS_MASTER: !0,
  890. IS_SLAVE: !1,
  891. IS_STANDALONE: !1
  892. }
  893. }
  894. } else e ? (window.onkeydown = this.disableKeys, this.trackGA(), n = {
  895. IS_MASTER: !1,
  896. IS_SLAVE: !0,
  897. IS_STANDALONE: !1
  898. }) : (window.onkeydown = this.disableKeys, this.trackGA(), n = {
  899. IS_MASTER: !0,
  900. IS_SLAVE: !0,
  901. IS_STANDALONE: !0
  902. });
  903. return n
  904. }, g.callConfigar = function (t, e) {
  905. var n, r, i = t.site || 500,
  906. o = t.channel || 100,
  907. a = t.id || null;
  908. window.XDomainRequest ? (n = new XDomainRequest, n.onload = function () {
  909. e(200, n.responseText)
  910. }, n.onerror = function () {
  911. e(404, null)
  912. }, n.onprogress = function () { }) : window.XMLHttpRequest ? (n = new XMLHttpRequest, n.onreadystatechange = function () {
  913. 4 === n.readyState && e(n.status, n.responseText)
  914. }) : window.ActiveXObject && (n = new ActiveXObject("Microsoft.XMLHTTP"), n.onreadystatechange = function () {
  915. 4 === n.readyState && e(n.status, n.responseText)
  916. }), a && (r = ["configs", o, i, a].join("/"), n.open("GET", r, !0), n.timeout = 3e3, n.ontimeout = function () {
  917. e(404, null)
  918. }, n.send())
  919. }, g.isWrapped = function () {
  920. return void 0 !== (window.PhoneGap || window.cordova || window.Cordova)
  921. }, g.isArray = Array.isArray || function (t) {
  922. return "[object Array]" === Object.prototype.toString.call(t)
  923. }, g._getQueryString = function () {
  924. return window.location.search
  925. }, g._getPortalHost = function () {
  926. return window && window.location && window.location.hostname ? window.location.hostname : "unknown"
  927. }, g.validateSchema = function (t, e) {
  928. for (var n in e)
  929. if (e.hasOwnProperty(n)) {
  930. if (!t.hasOwnProperty(n)) return {
  931. error: "Wrong argument passed: " + n
  932. };
  933. if (t.hasOwnProperty(n)) {
  934. var r = "object" == typeof t[n] ? t[n].type : t[n];
  935. if (e[n].constructor.name !== r) return {
  936. error: "Wrong value type for " + n + ": expected " + t[n] + ", got " + e[n].constructor.name
  937. };
  938. var i = t[n] && t[n].values || [];
  939. if (-1 === i.indexOf(e[n])) return {
  940. error: "Wrong value for " + n + ": expected " + i.join(" or ") + ", got " + e[n]
  941. }
  942. }
  943. }
  944. return {
  945. error: !1
  946. }
  947. };
  948. var m = {};
  949. m.getGameConfig = function () {
  950. return f.getGameConfig().catch(function () {
  951. return m.getLocalConfig()
  952. })
  953. }, m.getBrandingConfig = function (t) {
  954. return new Promise(function (e) {
  955. return f.getBrandingConfig(t).then(e, function (t) {
  956. e(t), window.postMessage(new c({
  957. type: "warning",
  958. callbackId: null,
  959. data: "log.configar.getBranding.failure"
  960. }), "*")
  961. })
  962. })
  963. }, m.getLocalConfig = function (t) {
  964. t = t && Object.keys(t).length ? t : {
  965. portal: {},
  966. game: {},
  967. branding: {}
  968. };
  969. var e = {
  970. game: {
  971. applicationId: t.portal.applicationId || "0",
  972. contentarId: t.portal.contentarId || "0",
  973. info: t.game.info || {},
  974. settings: t.game.objectSettings || {},
  975. features: {
  976. achievements: t.game.achievements || !1,
  977. gameSidePanel: t.game.gameSidePanel || !1,
  978. highscores: t.game.highscores || !1,
  979. recommendedGames: t.game.recommendedGames || !1
  980. }
  981. },
  982. user: {
  983. authenticated: t.portal.authenticated || !1,
  984. username: t.portal.username || ""
  985. },
  986. portal: {
  987. host: g._getPortalHost(),
  988. siteId: t.portal.siteId || 0,
  989. channelId: t.portal.channelId || 0,
  990. applicationId: t.portal.applicationId || "0"
  991. },
  992. branding: t.branding || {}
  993. };
  994. return e.branding.logo = e.branding.logo || {}, e.branding.logo.url = e.branding.logo.url || !1, e.branding.logo.image = e.branding.logo.image || !1, e
  995. }, m.setupStandaloneMode = function (t, e) {
  996. var n = {},
  997. r = {
  998. configar: {
  999. branding: {
  1000. main: {
  1001. label: "main",
  1002. image: "space.png",
  1003. url: "#",
  1004. style: "",
  1005. width: "202",
  1006. height: "50",
  1007. mime: "image/png",
  1008. type: "png",
  1009. handler: "newTab",
  1010. blacklisted: !0
  1011. },
  1012. logo: {
  1013. label: "logo",
  1014. image: "space.png",
  1015. url: "#",
  1016. style: "",
  1017. width: "202",
  1018. height: "50",
  1019. mime: "image/png",
  1020. type: "png",
  1021. handler: "newTab",
  1022. blacklisted: !1
  1023. },
  1024. more_games: {
  1025. label: "more_games",
  1026. image: null,
  1027. url: "#",
  1028. style: "",
  1029. width: null,
  1030. height: null,
  1031. mime: null,
  1032. type: null,
  1033. handler: "newTab",
  1034. blacklisted: !1
  1035. },
  1036. splash_screen: {
  1037. label: "splash_screen",
  1038. image: "place_holder_string",
  1039. url: "#",
  1040. style: "",
  1041. width: "0",
  1042. height: "0",
  1043. mime: "image/png",
  1044. type: "png",
  1045. handler: "newTab",
  1046. blacklisted: !1
  1047. }
  1048. }
  1049. }
  1050. };
  1051. n.JSLib = {
  1052. memory: {},
  1053. _channels: {},
  1054. get: function (t) {
  1055. return this.memory[t] ? this.memory[t] : !1
  1056. },
  1057. set: function (t, e) {
  1058. return this.memory[t] = e, e
  1059. },
  1060. publish: function (t, e) {
  1061. this._channels[t] && this._channels[t].forEach(function (t) {
  1062. try {
  1063. t.fn.call(this, e)
  1064. } catch (n) { }
  1065. })
  1066. },
  1067. subscribe: function (t, e) {
  1068. if ("function" != typeof e) throw Error("Callback has to be a function");
  1069. if ("string" != typeof t) throw Error("Channel name has to be a string");
  1070. this._channels[t] || (this._channels[t] = []), this._channels[t].push({
  1071. fn: e
  1072. })
  1073. }
  1074. }, n.Net = {
  1075. send: function (t, e) {
  1076. e.call(this, {})
  1077. }
  1078. }, window.SpilGamesBootstrap = [], window.SpilGames = function () {
  1079. var t = arguments;
  1080. if (t[0] && "string" == typeof t[0]) n.JSLib.publish(t[0], t[1] || null);
  1081. else if (t[0] && t[0] instanceof Array) {
  1082. var e, r, i = [];
  1083. for (e = 0, r = t[0].length; r > e; e++) i.push(n[t[0][e]]);
  1084. t[1].apply(this, i)
  1085. }
  1086. }, t && t.id ? e.call(this, {
  1087. branding: r.configar.branding
  1088. }) : e.call(this, {
  1089. branding: r.configar.branding
  1090. })
  1091. }, m.getCachedConfig = function () { }, e.prototype.newTab = function (t) {
  1092. try { /*ih5game.more();*/ parent.moregame(); } catch (e) { }
  1093. }, e.prototype.displayOnTop = function (t) {
  1094. if (t === void 0 || t.url === void 0 || "string" != typeof t.url || t.action === void 0 || "function" != typeof t.action) return t.callback !== void 0 || "function" == typeof t.callback ? (t.callback(), void 0) : void 0;
  1095. var e = document.createElement("div"),
  1096. n = t.url,
  1097. r = t.action,
  1098. i = t.callback;
  1099. return e.setAttribute("id", "spilgames-splash-screen-sample"), document.body.appendChild(e), e.style.left = "0", e.style.top = "0", e.style.width = "100%", e.style.height = "100%", e.style.position = "absolute", e.style.zIndex = "10000", e.onclick = r, n && (e.style.background = "url('" + n + "') center center no-repeat #FFF"), window.setTimeout(function () {
  1100. var t = document.getElementById("spilgames-splash-screen-sample");
  1101. t.parentNode.removeChild(t), i && i()
  1102. }, 2e3), e
  1103. }, n.prototype.get = function (t) {
  1104. for (var e = this.dataStore, n = t.split("."), r = n.length, i = 0; r - 1 > i; i++) {
  1105. if (!e[n[i]]) return null;
  1106. e = e[n[i]]
  1107. }
  1108. return e[n[r - 1]] || null
  1109. }, n.prototype.put = function (t, e) {
  1110. for (var n = this.dataStore, r = t.split("."), i = r.length, o = 0; i - 1 > o; o++) {
  1111. var a = r[o];
  1112. n[a] || (n[a] = {}), n = n[a]
  1113. }
  1114. n[r[i - 1]] = e
  1115. }, n.prototype.set = function (t, e) {
  1116. this.put(t, e);
  1117. var n = Date.parse(new Date);
  1118. return this.notify({
  1119. type: "new",
  1120. key: t,
  1121. current: e,
  1122. previous: null,
  1123. timestamp: n
  1124. }), e
  1125. }, n.prototype.update = function (t, e) {
  1126. var n, r, i = null;
  1127. return this.get(t) ? (n = "update", i = this.get(t)) : n = "new", this.put(t, e), r = Date.parse(new Date), this.notify({
  1128. type: n,
  1129. key: t,
  1130. current: e,
  1131. previous: i,
  1132. timestamp: r
  1133. }), e
  1134. }, n.prototype.remove = function (t) {
  1135. if (this.get(t)) {
  1136. var e, n = this.get(t);
  1137. return this.put(t, null), e = Date.parse(new Date), this.notify({
  1138. type: "remove",
  1139. key: t,
  1140. current: null,
  1141. previous: n,
  1142. timestamp: e
  1143. }), !0
  1144. }
  1145. return !1
  1146. }, n.prototype._setCache = function (t) {
  1147. this.dataStore = t
  1148. }, n.prototype._getCache = function () {
  1149. return this.dataStore
  1150. }, n.prototype.notify = function (t) {
  1151. if (this.IS_MASTER) {
  1152. var e = new c({
  1153. type: "datachange",
  1154. callbackId: null,
  1155. data: t
  1156. }).encode();
  1157. return window.postMessage(e, "*"), e
  1158. }
  1159. }, r.prototype._performAction = function (t) {
  1160. var e = new c(t.data || {}),
  1161. n = this.messenger,
  1162. r = this.subscribers || {};
  1163. if (e && e.type && e.data) switch (e.type) {
  1164. case "gameEvent":
  1165. e.data[0] && r[e.data[0]] && r[e.data[0]].length > 0 ? r[e.data[0]].forEach(function (t) {
  1166. t.call(this), n._postMessage([e.data[0], {
  1167. origin: "slave"
  1168. },
  1169. null
  1170. ], null, "gameState")
  1171. }) : e.data[0] && e.data[1] && "slave" === e.data[1].origin && "function" == typeof SWFtoJS && SWFtoJS({
  1172. call: e.data[0],
  1173. params: {}
  1174. });
  1175. break;
  1176. case "gameState":
  1177. e.data[0] && e.data[1] && "slave" === e.data[1].origin && (this.gameState = e.data[0])
  1178. }
  1179. }, r.prototype.on = function (t, e) {
  1180. this.IS_SLAVE && (this.subscribers[t] || (this.subscribers[t] = []), this.subscribers[t].push(e))
  1181. }, r.prototype.emit = function (t) {
  1182. if (!this.IS_MASTER) throw Error("Only the master environment can emit game events");
  1183. if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
  1184. if (t === this.gameState) throw Error("The game is already in state: `" + t + "`");
  1185. this.messenger._postMessage([t, {
  1186. origin: "master"
  1187. },
  1188. null
  1189. ], null, "gameEvent")
  1190. }, i.prototype._setupMasterEvent = function () {
  1191. this.IS_MASTER && this.messenger.subscribe("gameapi.score", this.submit, this)
  1192. }, i.prototype.submit = function (t) {
  1193. if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
  1194. return this.IS_MASTER ? "function" == typeof SWFtoJS && SWFtoJS({
  1195. call: "UPDATE_HIGHSCORE",
  1196. params: {
  1197. score: t
  1198. }
  1199. }) : (this.messenger._postMessage(t, void 0, "gameapi.score"), this.messenger._postMessage(["log.gameapi.score.submit", {
  1200. origin: "slave",
  1201. score: t
  1202. },
  1203. null
  1204. ], null, "log")), {
  1205. success: !0,
  1206. value: t
  1207. }
  1208. }, o.prototype.init = function () {
  1209. this._setupEvents()
  1210. }, o.prototype._setupEvents = function () {
  1211. var t = this.messenger;
  1212. this.isMaster ? (SpilGames(["JSLib"], function (e) {
  1213. e.subscribe("ad.request.accepted", function (e) {
  1214. !0 === e && (SpilGames("game.ad.accepted", !0), t._postMessage(!0, void 0, "ad.request.accepted"))
  1215. }), e.subscribe("ad.complete", function () {
  1216. t._postMessage("", "", "ad.complete")
  1217. })
  1218. }), this.messenger.subscribe("game.ad.request", this._triggerAd, this)) : (this.messenger.subscribe("ad.request.accepted", this._onAdAccepted, this), this.messenger.subscribe("ad.complete", this._onAdCompleted, this))
  1219. }, o.prototype._triggerAd = function () {
  1220. SpilGames("game.ad.request")
  1221. }, o.prototype._runCallback = function (t) {
  1222. this._callbacks[t] && (this._callbacks[t](), this._callbacks[t] = !1)
  1223. }, o.prototype.request = function (t, e) {
  1224. var n = this;
  1225. if ("function" != typeof t) throw Error("pauseGame argument should be a function");
  1226. if ("function" != typeof e) throw Error("resumeGame argument should be a function");
  1227. if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
  1228. this._callbacks.pause = t, this._callbacks.resume = e, this.messenger._postMessage(void 0, void 0, "game.ad.request"), this.isMaster || this.messenger._postMessage(["log.gameapi.ad.requested", {
  1229. origin: "slave"
  1230. },
  1231. null
  1232. ], null, "log"), this.timeout = setTimeout(function () {
  1233. n._requestTimeout()
  1234. }, this.timeoutAfter)
  1235. }, o.prototype._onAdAccepted = function (t) {
  1236. var e = this.messenger;
  1237. this.timeout && clearTimeout(this.timeout), !this.isMaster && t && (e._postMessage(["log.gameapi.ad.start", {
  1238. origin: "slave"
  1239. },
  1240. null
  1241. ], null, "log"), this._runCallback("pause"))
  1242. }, o.prototype._onAdCompleted = function () {
  1243. var t = this.messenger;
  1244. this.isMaster || t._postMessage(["log.gameapi.ad.complete", {
  1245. origin: "slave"
  1246. },
  1247. null
  1248. ], null, "log"), this._runCallback("resume")
  1249. }, o.prototype._requestTimeout = function () {
  1250. this._onAdCompleted()
  1251. }, a.prototype._setupEvents = function () {
  1252. this.IS_MASTER && this.messenger.subscribe("gameapi.gameevent", this.emit, this)
  1253. }, a.prototype._validateEvent = function (t) {
  1254. var e = !1;
  1255. return this.events[t] && this.events[t] !== void 0 && (e = !0), e
  1256. }, a.prototype.emit = function (t, e) {
  1257. if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
  1258. this._validateEvent(t) ? this.IS_MASTER ? "function" == typeof SWFtoJS && SWFtoJS({
  1259. call: t
  1260. }) : (this.messenger._postMessage(t, void 0, "gameapi.gameevent"), this.messenger._postMessage(["log.gameapi.gameevent.emit", {
  1261. origin: "slave",
  1262. evt: t
  1263. },
  1264. null
  1265. ], null, "log")) : this.IS_MASTER || this.messenger._postMessage(["log.gameapi.gameevent.emit", {
  1266. origin: "slave"
  1267. },
  1268. null
  1269. ], null, "log")
  1270. }, s.prototype.init = function (t) {
  1271. t = t || {}, this.data = t.data || this.data;
  1272. var e = this.data && this.data.game && this.data.game.applicationId ? this.data.game.applicationId : null,
  1273. n = new Date,
  1274. r = window.location.hostname;
  1275. (this.IS_SLAVE || g.isWrapped()) && this.startInternalTracking(e, n, r)
  1276. }, s.prototype._createEventObject = function (t, e, n) {
  1277. return {
  1278. eventCategory: t,
  1279. eventAction: e,
  1280. properties: n
  1281. }
  1282. }, s.prototype._sendSETEvent = function (t, e, n) {
  1283. return this.messenger && (this.IS_SLAVE || g.isWrapped()) && this.messenger.post("tracker.event." + t, e, n), e
  1284. }, s.prototype.trackGamePlay = function (t) {
  1285. if (!this.gamePlayTracking.started) return !1;
  1286. var e = this.gamePlayTracking.gid,
  1287. n = this.gamePlayTracking.timestamp,
  1288. r = this.gamePlayTracking.host,
  1289. i = this._createEventObject("game", "gameplay", {
  1290. applicationId: e,
  1291. start: n,
  1292. host: r
  1293. });
  1294. return this._sendSETEvent("express", i, t), i
  1295. }, s.prototype.trackTimeInGame = function (t) {
  1296. if (!this.timeInGameTracking.started) return !1;
  1297. var e = this.timeInGameTracking.gid,
  1298. n = this.timeInGameTracking.timestamp,
  1299. r = this._createEventObject("game", "heartbeat", {
  1300. applicationId: e,
  1301. start: n
  1302. });
  1303. return this._sendSETEvent("express", r, t), r
  1304. }, s.prototype.startInternalTracking = function (t, e, n) {
  1305. var r = this,
  1306. i = 6e4,
  1307. o = function (t) {
  1308. if (!t) throw "Could not save the time in game"
  1309. };
  1310. return this.moduleReady ? t ? (this.gamePlayTracking.gid = t, this.gamePlayTracking.timestamp = Date.parse(e), this.gamePlayTracking.host = n, this.gamePlayTracking.started = !0, this.timeInGameTracking.gid = t, this.timeInGameTracking.timestamp = Date.parse(e), this.timeInGameTracking.started = !0, this.trackGamePlay(function (t) {
  1311. if (!t) throw "Could not save the game play"
  1312. }), this.trackTimeInGame(o), setInterval(function () {
  1313. r.trackTimeInGame(o)
  1314. }, i), this.gamePlayTracking.started && this.timeInGameTracking.started) : {
  1315. error: "No application ID defined for this game"
  1316. } : {
  1317. error: "This method cannot be called before the API is loaded"
  1318. }
  1319. }, u.prototype.init = function (t) {
  1320. t = t || {}, this.data = t.data || this.data
  1321. }, u.prototype.getLogo = function (t) {
  1322. if (!this.moduleReady) return {
  1323. error: "This method cannot be called before the API is loaded"
  1324. };
  1325. var e = this.IS_MASTER ? "master" : "slave";
  1326. this.messenger._postMessage(["log.branding.getlogo", {
  1327. origin: e
  1328. },
  1329. null
  1330. ], null, "log");
  1331. var n, r, i = {
  1332. type: {
  1333. type: "String",
  1334. values: ["png"]
  1335. },
  1336. width: "Number",
  1337. height: "Number"
  1338. };
  1339. return n = this._getLink("logo"), t && "object" == typeof t && (r = g.validateSchema(i, t), r.error && (n.error = r.error)), n
  1340. }, u.prototype.getLink = function (t) {
  1341. if (!t) return {
  1342. error: "No link identifier provided"
  1343. };
  1344. var e = this.listLinks();
  1345. if (-1 !== e.indexOf(t)) {
  1346. var n = this.IS_MASTER ? "master" : "slave";
  1347. return this.messenger._postMessage(["log.branding.getlink", {
  1348. origin: n,
  1349. linkName: t
  1350. },
  1351. null
  1352. ], null, "log"), this._getLink(t)
  1353. }
  1354. return {
  1355. error: "Invalid option: '" + t + "'",
  1356. action: function () { }
  1357. }
  1358. }, u.prototype._getLink = function (t) {
  1359. if (!t) return {
  1360. error: "No link identifier provided"
  1361. };
  1362. var e = this.data && this.data.branding ? this.data.branding : {};
  1363. return e && e[t] ? {
  1364. linkName: t,
  1365. image: e[t].image || !1,
  1366. action: this._executeHandler.bind(this, t)
  1367. } : {
  1368. error: "Invalid option: '" + t + "'",
  1369. action: function () { }
  1370. }
  1371. }, u.prototype._getGMLink = function (t) {
  1372. var e = null;
  1373. if (!t) return {
  1374. error: "No link identifier provided"
  1375. };
  1376. var n = this.data && this.data.branding ? this.data.branding : {};
  1377. return n && n[t] ? (e = this._tagUrl(n[t].url, t), {
  1378. linkName: t,
  1379. url: e
  1380. }) : {
  1381. error: "Invalid option: '" + t + "'",
  1382. url: null
  1383. }
  1384. }, u.prototype.getLinks = function () {
  1385. var t = {},
  1386. e = this.listLinks();
  1387. if (0 === e.length) t = {
  1388. more_games: {
  1389. action: function () { }
  1390. }
  1391. };
  1392. else
  1393. for (var n = 0; e.length > n; n++) {
  1394. var r = e[n];
  1395. t[r] = this._getLink(r)
  1396. }
  1397. return t
  1398. }, u.prototype._executeHandler = function (t) {
  1399. var e = this.data && this.data.branding ? this.data.branding : {},
  1400. n = e[t],
  1401. r = n.handler,
  1402. i = this._tagUrl(n.url, t);
  1403. if (n.url && n.url.length > 0 && r && this.components[r]) {
  1404. var o = this.IS_MASTER ? "master" : "slave";
  1405. return this.messenger._postMessage(["log.branding.linkAction", {
  1406. origin: o,
  1407. linkName: t
  1408. },
  1409. null
  1410. ], null, "log"), this.components[r]({
  1411. url: i
  1412. })
  1413. }
  1414. return function () { }
  1415. }, u.prototype.listLinks = function () {
  1416. var t = [],
  1417. e = this.data && this.data.branding ? this.data.branding : {},
  1418. n = Object.keys(e);
  1419. return t = n.filter(function (t) {
  1420. return !e[t].blacklisted
  1421. })
  1422. }, u.prototype.getSplashScreen = function () {
  1423. var t, e = this.IS_MASTER ? "master" : "slave";
  1424. if (this.data && this.data.branding && this.data.branding.splash_screen) {
  1425. var n = !0;
  1426. this.data.branding.splash_screen.image || this.data.branding.splash_screen.url || (n = !1), t = {
  1427. show: n,
  1428. action: this._getLink("splash_screen").action || function () { }
  1429. }
  1430. } else t = {
  1431. show: !0,
  1432. action: function () { }
  1433. };
  1434. return this.messenger._postMessage(["log.branding.splashScreen", {
  1435. origin: e
  1436. },
  1437. null
  1438. ], null, "log"), t
  1439. }, u.prototype.displaySplashScreen = function (t) {
  1440. if ("function" != typeof t) throw Error("argument passed to displaySplashScreen method should be a function");
  1441. var e = this.IS_MASTER ? "master" : "slave",
  1442. n = this._getLink("logo").image;
  1443. n && this.getSplashScreen().show ? ("master" !== e && this.messenger._postMessage(["log.branding.displaySplashScreen", {
  1444. origin: e
  1445. },
  1446. null
  1447. ], null, "log"), this.components.displayOnTop({
  1448. url: n,
  1449. action: this.getSplashScreen().action,
  1450. callback: t
  1451. })) : t()
  1452. }, u.prototype._tagUrl = function (t, e) {
  1453. var n, r, i, o = this.data && this.data.portal ? this.data.portal : {},
  1454. a = this.data && this.data.game ? this.data.game : {},
  1455. s = parseInt(o.siteId, 10);
  1456. if ("string" != typeof t) throw Error("No url specified");
  1457. return n = "string" == typeof e ? e : "logo", r = "brandedgames_" + (s > 0 && 500 > s ? "internal" : "external"), i = ["utm_medium=" + r, "utm_campaign=" + a.applicationId, "utm_source=" + o.host, "utm_content=" + n].join("&"), t += t.indexOf("?") > -1 ? "&" : "?", t + i
  1458. }, c.prototype.encode = function () {
  1459. var t = ["gameapi", this.type, this.callbackId, this.data ? JSON.stringify(this.data) : ""].join("|");
  1460. return t
  1461. }, l.prototype._postMessage = function (t, e, n) {
  1462. var r, i;
  1463. r = g.isArray(t) && "function" == typeof t[t.length - 1] ? this._callbacks.push(t.pop()) - 1 : e, i = new c({
  1464. type: n || "jslib",
  1465. callbackId: r,
  1466. data: t
  1467. }).encode(), this._target.postMessage(i, "*")
  1468. }, l.prototype._callJSLib = function () {
  1469. SpilGames.apply(SpilGames, g.argsToArray(arguments))
  1470. }, l.prototype._setupEventListener = function () {
  1471. window.addEventListener ? window.addEventListener("message", this._handleMessage.bind(this), !1) : window.attachEvent && window.attachEvent("onmessage", this._handleMessage.bind(this))
  1472. }, l.prototype._handleMessage = function (t) {
  1473. var e, n, r, i, o = this,
  1474. a = new c(t.data);
  1475. if (a)
  1476. if (e = a.type, n = a.callbackId, r = a.data, i = this._callbacks[n] || !1, this.IS_MASTER) switch (e) {
  1477. case "jslib":
  1478. "Array" === r.constructor.name && r.push(function (t) {
  1479. o._postMessage(t, n)
  1480. }), this._callJSLib.apply(this, r);
  1481. break;
  1482. case "ugapi":
  1483. this._handleUGARequest(t);
  1484. break;
  1485. case "datachange":
  1486. this._postMessage(r, null, "datachange");
  1487. break;
  1488. default:
  1489. this.publish(e, r)
  1490. } else this.IS_SLAVE && ("function" == typeof i ? (delete this._callbacks[n], i(r)) : "datachange" === e || "jslib" !== e && this.publish(e, r));
  1491. return !1
  1492. }, l.prototype._handleUGARequest = function (t) {
  1493. var e, n, r, i = this,
  1494. o = new c(t.data);
  1495. if (o) switch (e = o.data[0], n = o.callbackId, r = o.data[1] ? o.data[1] : null, e) {
  1496. case "GameAPI.data":
  1497. i._postMessage(this.dataStore._getCache(), n, "ugapi");
  1498. break;
  1499. case "GameAPI.isReady":
  1500. i._postMessage({
  1501. isready: this.api.isReady
  1502. }, n, "ugapi")
  1503. }
  1504. }, l.prototype.post = function () {
  1505. var t = g.argsToArray(arguments);
  1506. return this.IS_SLAVE ? this._postMessage(t) : this._callJSLib.apply(this, t), this
  1507. }, l.prototype.publish = function (t, e) {
  1508. return this._channels[t] && this._channels[t].forEach(function (t) {
  1509. try {
  1510. t.fn.call(t.ctx, e)
  1511. } catch (n) { }
  1512. }), this
  1513. }, l.prototype.subscribe = function (t, e, n) {
  1514. if ("function" != typeof e) throw Error("Callback has to be a function");
  1515. if ("string" != typeof t) throw Error("Channel name has to be a string");
  1516. return this._channels[t] || (this._channels[t] = []), this._channels[t].push({
  1517. fn: e,
  1518. ctx: n
  1519. }), this
  1520. }, l.prototype.unsubscribe = function (t, e) {
  1521. return this._channels[t] && "function" == typeof e && (this._channels[t] = this._channels[t].filter(function (t) {
  1522. return t.fn !== e
  1523. })), this
  1524. }, l.prototype.subscribeOnce = function (t, e, n) {
  1525. function r(n) {
  1526. i.unsubscribe(t, r), e.call(this, n)
  1527. }
  1528. var i = this;
  1529. return this.subscribe(t, r, n)
  1530. }, l.prototype.requestFromParent = function (t, e, n) {
  1531. if (!this.IS_SLAVE) throw "You are the parent, stop talking to yourself";
  1532. e = e || {}, this._postMessage([t, e, n], null, "ugapi")
  1533. }, d.prototype._setRole = function () {
  1534. var t = g.getRole();
  1535. this.IS_MASTER = t.IS_MASTER, this.IS_SLAVE = t.IS_SLAVE, this.IS_STANDALONE = t.IS_STANDALONE
  1536. }, d.prototype._getTarget = function () {
  1537. if (this.IS_STANDALONE) return window;
  1538. var t = document.getElementById("iframegame"),
  1539. e = t && t.contentWindow ? t.contentWindow : window.parent;
  1540. return this.IS_MASTER ? e : window.parent
  1541. }, d.prototype.loadAPI = function (t, e) {
  1542. function r(e) {
  1543. return c.IS_MASTER && (e = i(e)), c.isReady = !0, c.Branding.moduleReady = !0, c.__.EventTracking.moduleReady = !0, c.GameBreak.moduleReady = !0, c.Game.moduleReady = !0, c.Score.moduleReady = !0, c.GameEvent.moduleReady = !0, c.Branding.init({
  1544. data: e
  1545. }), c.__.EventTracking.init({
  1546. data: e
  1547. }), c.GameBreak.init(), c.__.messenger._postMessage(["log.gameapi.loadapi.finish", {
  1548. origin: p,
  1549. version: c.version
  1550. },
  1551. null
  1552. ], null, "log"), t(c)
  1553. }
  1554. function i(t) {
  1555. var e = t.game || {},
  1556. n = t.user || {},
  1557. r = t.portal || {},
  1558. i = t.branding || {};
  1559. return m.getLocalConfig({
  1560. game: e,
  1561. user: n,
  1562. portal: r,
  1563. branding: i
  1564. })
  1565. }
  1566. function o() {
  1567. c.__.messenger.requestFromParent("GameAPI.data", {}, function (t) {
  1568. r(t)
  1569. })
  1570. }
  1571. function a() {
  1572. c.IS_STANDALONE = !0, c.IS_MASTER = !0, c.IS_SLAVE = !0, c.__.dataStore = new n({
  1573. isMaster: !0
  1574. }), e = e || null, m.setupStandaloneMode(e, function (t) {
  1575. c.__.dataStore._setCache(i(t)), r(t)
  1576. })
  1577. }
  1578. function s() {
  1579. c.__.messenger.requestFromParent("GameAPI.isReady", {}, function (t) {
  1580. u && clearTimeout(u), t.isready ? o() : 5 > l ? (l++, setTimeout(s, 500)) : o()
  1581. })
  1582. }
  1583. var u, c = this,
  1584. p = this.IS_MASTER ? "master" : "slave",
  1585. l = 0;
  1586. if ("function" != typeof t) throw Error("argument passed to loadAPI method should be a function");
  1587. return !0 === this.isReady ? (window.console && window.console.log && console.log("WARNING: Detected multiple executions of GameAPI.loadAPI(). This method should only be executed once per page load!"), t(c)) : (this.__.messenger._postMessage(["log.gameapi.loadapi.start", {
  1588. origin: p,
  1589. version: c.version,
  1590. spildata: e
  1591. },
  1592. null
  1593. ], null, "log"), this.IS_STANDALONE ? a() : this.IS_MASTER ? m.getGameConfig().then(function (t) {
  1594. m.getBrandingConfig(t).then(function (e) {
  1595. t && !t.isError && (t.branding = e.branding, c.__.dataStore._setCache(i(t))), r(t)
  1596. })
  1597. }) : (u = setTimeout(a, 600), s()), void 0)
  1598. };
  1599. var y = new d(n, l, u, s, o);
  1600. "function" == typeof define && define.amd && define("GameAPI", y), t.GameAPI = y
  1601. })(window),
  1602. function () {
  1603. "use strict";
  1604. function t(t) {
  1605. t && (t.setTargetValueAtTime || (t.setTargetValueAtTime = t.setTargetAtTime))
  1606. }
  1607. window.hasOwnProperty("AudioContext") && (window.webkitAudioContext = AudioContext, AudioContext.prototype.hasOwnProperty("internal_createGain") || (AudioContext.prototype.internal_createGain = AudioContext.prototype.createGain, AudioContext.prototype.createGain = function () {
  1608. var e = this.internal_createGain();
  1609. return t(e.gain), e
  1610. }), AudioContext.prototype.hasOwnProperty("internal_createDelay") || (AudioContext.prototype.internal_createDelay = AudioContext.prototype.createDelay, AudioContext.prototype.createDelay = function () {
  1611. var e = this.internal_createDelay();
  1612. return t(e.delayTime), e
  1613. }), AudioContext.prototype.hasOwnProperty("internal_createBufferSource") || (AudioContext.prototype.internal_createBufferSource = AudioContext.prototype.createBufferSource, AudioContext.prototype.createBufferSource = function () {
  1614. var e = this.internal_createBufferSource();
  1615. return e.noteOn || (e.noteOn = e.start), e.noteGrainOn || (e.noteGrainOn = e.start), e.noteOff || (e.noteOff = e.stop), t(e.playbackRate), e
  1616. }), AudioContext.prototype.hasOwnProperty("internal_createDynamicsCompressor") || (AudioContext.prototype.internal_createDynamicsCompressor = AudioContext.prototype.createDynamicsCompressor, AudioContext.prototype.createDynamicsCompressor = function () {
  1617. var e = this.internal_createDynamicsCompressor();
  1618. return t(e.threshold), t(e.knee), t(e.ratio), t(e.reduction), t(e.attack), t(e.release), e
  1619. }), AudioContext.prototype.hasOwnProperty("internal_createBiquadFilter") || (AudioContext.prototype.internal_createBiquadFilter = AudioContext.prototype.createBiquadFilter, AudioContext.prototype.createBiquadFilter = function () {
  1620. var e = this.internal_createBiquadFilter();
  1621. t(e.frequency), t(e.detune), t(e.Q), t(e.gain);
  1622. for (var n = ["LOWPASS", "HIGHPASS", "BANDPASS", "LOWSHELF", "HIGHSHELF", "PEAKING", "NOTCH", "ALLPASS"], r = 0; n.length > r; ++r) {
  1623. var i = n[r],
  1624. o = i.toLowerCase();
  1625. e.hasOwnProperty(i) || (e[i] = o)
  1626. }
  1627. return e
  1628. }), AudioContext.prototype.hasOwnProperty("internal_createOscillator") || AudioContext.prototype.hasOwnProperty("createOscillator") && (AudioContext.prototype.internal_createOscillator = AudioContext.prototype.createOscillator, AudioContext.prototype.createOscillator = function () {
  1629. var e = this.internal_createOscillator();
  1630. e.noteOn || (e.noteOn = e.start), e.noteOff || (e.noteOff = e.stop), t(e.frequency), t(e.detune);
  1631. for (var n = ["SINE", "SQUARE", "SAWTOOTH", "TRIANGLE", "CUSTOM"], r = 0; n.length > r; ++r) {
  1632. var i = n[r],
  1633. o = i.toLowerCase();
  1634. e.hasOwnProperty(i) || (e[i] = o)
  1635. }
  1636. return e.hasOwnProperty("setWaveTable") || (e.setWaveTable = e.setPeriodicTable), e
  1637. }), AudioContext.prototype.hasOwnProperty("internal_createPanner") || (AudioContext.prototype.internal_createPanner = AudioContext.prototype.createPanner, AudioContext.prototype.createPanner = function () {
  1638. var t = this.internal_createPanner(),
  1639. e = {
  1640. EQUALPOWER: "equalpower",
  1641. HRTF: "HRTF",
  1642. LINEAR_DISTANCE: "linear",
  1643. INVERSE_DISTANCE: "inverse",
  1644. EXPONENTIAL_DISTANCE: "exponential"
  1645. };
  1646. for (var n in e) {
  1647. var r = e[n];
  1648. t.hasOwnProperty(n) || (t[n] = r)
  1649. }
  1650. return t
  1651. }), AudioContext.prototype.hasOwnProperty("createGainNode") || (AudioContext.prototype.createGainNode = AudioContext.prototype.createGain), AudioContext.prototype.hasOwnProperty("createDelayNode") || (AudioContext.prototype.createDelayNode = AudioContext.prototype.createDelay), AudioContext.prototype.hasOwnProperty("createJavaScriptNode") || (AudioContext.prototype.createJavaScriptNode = AudioContext.prototype.createScriptProcessor), AudioContext.prototype.hasOwnProperty("createWaveTable") || (AudioContext.prototype.createWaveTable = AudioContext.prototype.createPeriodicWave))
  1652. }(window);